Merge branch 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs-2.6

* 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs-2.6:
quota: Convert quota statistics to generic percpu_counter
ext3 uses rb_node = NULL; to zero rb_root.
quota: Fixup dquot_transfer
reiserfs: Fix resuming of quotas on remount read-write
pohmelfs: Remove dead quota code
ufs: Remove dead quota code
udf: Remove dead quota code
quota: rename default quotactl methods to dquot_
quota: explicitly set ->dq_op and ->s_qcop
quota: drop remount argument to ->quota_on and ->quota_off
quota: move unmount handling into the filesystem
quota: kill the vfs_dq_off and vfs_dq_quota_on_remount wrappers
quota: move remount handling into the filesystem
ocfs2: Fix use after free on remount read-only

Fix up conflicts in fs/ext4/super.c and fs/ufs/file.c

+275 -561
-8
drivers/staging/pohmelfs/inode.c
··· 29 #include <linux/slab.h> 30 #include <linux/statfs.h> 31 #include <linux/writeback.h> 32 - #include <linux/quotaops.h> 33 34 #include "netfs.h" 35 ··· 966 if (err) { 967 dprintk("%s: ino: %llu, inode changes are not allowed.\n", __func__, POHMELFS_I(inode)->ino); 968 goto err_out_exit; 969 - } 970 - 971 - if ((attr->ia_valid & ATTR_UID && attr->ia_uid != inode->i_uid) || 972 - (attr->ia_valid & ATTR_GID && attr->ia_gid != inode->i_gid)) { 973 - err = dquot_transfer(inode, attr); 974 - if (err) 975 - goto err_out_exit; 976 } 977 978 err = inode_setattr(inode, attr);
··· 29 #include <linux/slab.h> 30 #include <linux/statfs.h> 31 #include <linux/writeback.h> 32 33 #include "netfs.h" 34 ··· 967 if (err) { 968 dprintk("%s: ino: %llu, inode changes are not allowed.\n", __func__, POHMELFS_I(inode)->ino); 969 goto err_out_exit; 970 } 971 972 err = inode_setattr(inode, attr);
+20
fs/ext2/super.c
··· 119 int i; 120 struct ext2_sb_info *sbi = EXT2_SB(sb); 121 122 if (sb->s_dirt) 123 ext2_write_super(sb); 124 ··· 1065 sb->s_op = &ext2_sops; 1066 sb->s_export_op = &ext2_export_ops; 1067 sb->s_xattr = ext2_xattr_handlers; 1068 root = ext2_iget(sb, EXT2_ROOT_INO); 1069 if (IS_ERR(root)) { 1070 ret = PTR_ERR(root); ··· 1249 spin_unlock(&sbi->s_lock); 1250 return 0; 1251 } 1252 /* 1253 * OK, we are remounting a valid rw partition rdonly, so set 1254 * the rdonly flag and then mark the partition as valid again. ··· 1257 es->s_state = cpu_to_le16(sbi->s_mount_state); 1258 es->s_mtime = cpu_to_le32(get_seconds()); 1259 spin_unlock(&sbi->s_lock); 1260 ext2_sync_super(sb, es, 1); 1261 } else { 1262 __le32 ret = EXT2_HAS_RO_COMPAT_FEATURE(sb, ··· 1285 if (!ext2_setup_super (sb, es, 0)) 1286 sb->s_flags &= ~MS_RDONLY; 1287 spin_unlock(&sbi->s_lock); 1288 ext2_write_super(sb); 1289 } 1290 return 0; 1291 restore_opts: 1292 sbi->s_mount_opt = old_opts.s_mount_opt;
··· 119 int i; 120 struct ext2_sb_info *sbi = EXT2_SB(sb); 121 122 + dquot_disable(sb, -1, DQUOT_USAGE_ENABLED | DQUOT_LIMITS_ENABLED); 123 + 124 if (sb->s_dirt) 125 ext2_write_super(sb); 126 ··· 1063 sb->s_op = &ext2_sops; 1064 sb->s_export_op = &ext2_export_ops; 1065 sb->s_xattr = ext2_xattr_handlers; 1066 + 1067 + #ifdef CONFIG_QUOTA 1068 + sb->dq_op = &dquot_operations; 1069 + sb->s_qcop = &dquot_quotactl_ops; 1070 + #endif 1071 + 1072 root = ext2_iget(sb, EXT2_ROOT_INO); 1073 if (IS_ERR(root)) { 1074 ret = PTR_ERR(root); ··· 1241 spin_unlock(&sbi->s_lock); 1242 return 0; 1243 } 1244 + 1245 /* 1246 * OK, we are remounting a valid rw partition rdonly, so set 1247 * the rdonly flag and then mark the partition as valid again. ··· 1248 es->s_state = cpu_to_le16(sbi->s_mount_state); 1249 es->s_mtime = cpu_to_le32(get_seconds()); 1250 spin_unlock(&sbi->s_lock); 1251 + 1252 + err = dquot_suspend(sb, -1); 1253 + if (err < 0) { 1254 + spin_lock(&sbi->s_lock); 1255 + goto restore_opts; 1256 + } 1257 + 1258 ext2_sync_super(sb, es, 1); 1259 } else { 1260 __le32 ret = EXT2_HAS_RO_COMPAT_FEATURE(sb, ··· 1269 if (!ext2_setup_super (sb, es, 0)) 1270 sb->s_flags &= ~MS_RDONLY; 1271 spin_unlock(&sbi->s_lock); 1272 + 1273 ext2_write_super(sb); 1274 + 1275 + dquot_resume(sb, -1); 1276 } 1277 + 1278 return 0; 1279 restore_opts: 1280 sbi->s_mount_opt = old_opts.s_mount_opt;
+1 -1
fs/ext3/dir.c
··· 297 kfree (old); 298 } 299 if (!parent) 300 - root->rb_node = NULL; 301 else if (parent->rb_left == n) 302 parent->rb_left = NULL; 303 else if (parent->rb_right == n)
··· 297 kfree (old); 298 } 299 if (!parent) 300 + *root = RB_ROOT; 301 else if (parent->rb_left == n) 302 parent->rb_left = NULL; 303 else if (parent->rb_right == n)
+23 -15
fs/ext3/super.c
··· 410 struct ext3_super_block *es = sbi->s_es; 411 int i, err; 412 413 lock_kernel(); 414 415 ext3_xattr_put_super(sb); ··· 750 static int ext3_mark_dquot_dirty(struct dquot *dquot); 751 static int ext3_write_info(struct super_block *sb, int type); 752 static int ext3_quota_on(struct super_block *sb, int type, int format_id, 753 - char *path, int remount); 754 static int ext3_quota_on_mount(struct super_block *sb, int type); 755 static ssize_t ext3_quota_read(struct super_block *sb, int type, char *data, 756 size_t len, loff_t off); ··· 769 770 static const struct quotactl_ops ext3_qctl_operations = { 771 .quota_on = ext3_quota_on, 772 - .quota_off = vfs_quota_off, 773 - .quota_sync = vfs_quota_sync, 774 - .get_info = vfs_get_dqinfo, 775 - .set_info = vfs_set_dqinfo, 776 - .get_dqblk = vfs_get_dqblk, 777 - .set_dqblk = vfs_set_dqblk 778 }; 779 #endif 780 ··· 1529 /* Turn quotas off */ 1530 for (i = 0; i < MAXQUOTAS; i++) { 1531 if (sb_dqopt(sb)->files[i]) 1532 - vfs_quota_off(sb, i, 0); 1533 } 1534 #endif 1535 sb->s_flags = s_flags; /* Restore MS_RDONLY status */ ··· 2553 ext3_fsblk_t n_blocks_count = 0; 2554 unsigned long old_sb_flags; 2555 struct ext3_mount_options old_opts; 2556 int err; 2557 #ifdef CONFIG_QUOTA 2558 int i; ··· 2600 } 2601 2602 if (*flags & MS_RDONLY) { 2603 /* 2604 * First of all, the unconditional stuff we have to do 2605 * to disable replay of the journal when we next remount ··· 2658 goto restore_opts; 2659 if (!ext3_setup_super (sb, es, 0)) 2660 sb->s_flags &= ~MS_RDONLY; 2661 } 2662 } 2663 #ifdef CONFIG_QUOTA ··· 2670 #endif 2671 unlock_super(sb); 2672 unlock_kernel(); 2673 return 0; 2674 restore_opts: 2675 sb->s_flags = old_sb_flags; ··· 2862 */ 2863 static int ext3_quota_on_mount(struct super_block *sb, int type) 2864 { 2865 - return vfs_quota_on_mount(sb, EXT3_SB(sb)->s_qf_names[type], 2866 - EXT3_SB(sb)->s_jquota_fmt, type); 2867 } 2868 2869 /* 2870 * Standard function to be called on quota_on 2871 */ 2872 static int ext3_quota_on(struct super_block *sb, int type, int format_id, 2873 - char *name, int remount) 2874 { 2875 int err; 2876 struct path path; 2877 2878 if (!test_opt(sb, QUOTA)) 2879 return -EINVAL; 2880 - /* When remounting, no checks are needed and in fact, name is NULL */ 2881 - if (remount) 2882 - return vfs_quota_on(sb, type, format_id, name, remount); 2883 2884 err = kern_path(name, LOOKUP_FOLLOW, &path); 2885 if (err) ··· 2914 } 2915 } 2916 2917 - err = vfs_quota_on_path(sb, type, format_id, &path); 2918 path_put(&path); 2919 return err; 2920 }
··· 410 struct ext3_super_block *es = sbi->s_es; 411 int i, err; 412 413 + dquot_disable(sb, -1, DQUOT_USAGE_ENABLED | DQUOT_LIMITS_ENABLED); 414 + 415 lock_kernel(); 416 417 ext3_xattr_put_super(sb); ··· 748 static int ext3_mark_dquot_dirty(struct dquot *dquot); 749 static int ext3_write_info(struct super_block *sb, int type); 750 static int ext3_quota_on(struct super_block *sb, int type, int format_id, 751 + char *path); 752 static int ext3_quota_on_mount(struct super_block *sb, int type); 753 static ssize_t ext3_quota_read(struct super_block *sb, int type, char *data, 754 size_t len, loff_t off); ··· 767 768 static const struct quotactl_ops ext3_qctl_operations = { 769 .quota_on = ext3_quota_on, 770 + .quota_off = dquot_quota_off, 771 + .quota_sync = dquot_quota_sync, 772 + .get_info = dquot_get_dqinfo, 773 + .set_info = dquot_set_dqinfo, 774 + .get_dqblk = dquot_get_dqblk, 775 + .set_dqblk = dquot_set_dqblk 776 }; 777 #endif 778 ··· 1527 /* Turn quotas off */ 1528 for (i = 0; i < MAXQUOTAS; i++) { 1529 if (sb_dqopt(sb)->files[i]) 1530 + dquot_quota_off(sb, i); 1531 } 1532 #endif 1533 sb->s_flags = s_flags; /* Restore MS_RDONLY status */ ··· 2551 ext3_fsblk_t n_blocks_count = 0; 2552 unsigned long old_sb_flags; 2553 struct ext3_mount_options old_opts; 2554 + int enable_quota = 0; 2555 int err; 2556 #ifdef CONFIG_QUOTA 2557 int i; ··· 2597 } 2598 2599 if (*flags & MS_RDONLY) { 2600 + err = dquot_suspend(sb, -1); 2601 + if (err < 0) 2602 + goto restore_opts; 2603 + 2604 /* 2605 * First of all, the unconditional stuff we have to do 2606 * to disable replay of the journal when we next remount ··· 2651 goto restore_opts; 2652 if (!ext3_setup_super (sb, es, 0)) 2653 sb->s_flags &= ~MS_RDONLY; 2654 + enable_quota = 1; 2655 } 2656 } 2657 #ifdef CONFIG_QUOTA ··· 2662 #endif 2663 unlock_super(sb); 2664 unlock_kernel(); 2665 + 2666 + if (enable_quota) 2667 + dquot_resume(sb, -1); 2668 return 0; 2669 restore_opts: 2670 sb->s_flags = old_sb_flags; ··· 2851 */ 2852 static int ext3_quota_on_mount(struct super_block *sb, int type) 2853 { 2854 + return dquot_quota_on_mount(sb, EXT3_SB(sb)->s_qf_names[type], 2855 + EXT3_SB(sb)->s_jquota_fmt, type); 2856 } 2857 2858 /* 2859 * Standard function to be called on quota_on 2860 */ 2861 static int ext3_quota_on(struct super_block *sb, int type, int format_id, 2862 + char *name) 2863 { 2864 int err; 2865 struct path path; 2866 2867 if (!test_opt(sb, QUOTA)) 2868 return -EINVAL; 2869 2870 err = kern_path(name, LOOKUP_FOLLOW, &path); 2871 if (err) ··· 2906 } 2907 } 2908 2909 + err = dquot_quota_on_path(sb, type, format_id, &path); 2910 path_put(&path); 2911 return err; 2912 }
+22 -15
fs/ext4/super.c
··· 646 struct ext4_super_block *es = sbi->s_es; 647 int i, err; 648 649 flush_workqueue(sbi->dio_unwritten_wq); 650 destroy_workqueue(sbi->dio_unwritten_wq); 651 ··· 1064 static int ext4_mark_dquot_dirty(struct dquot *dquot); 1065 static int ext4_write_info(struct super_block *sb, int type); 1066 static int ext4_quota_on(struct super_block *sb, int type, int format_id, 1067 - char *path, int remount); 1068 static int ext4_quota_on_mount(struct super_block *sb, int type); 1069 static ssize_t ext4_quota_read(struct super_block *sb, int type, char *data, 1070 size_t len, loff_t off); ··· 1086 1087 static const struct quotactl_ops ext4_qctl_operations = { 1088 .quota_on = ext4_quota_on, 1089 - .quota_off = vfs_quota_off, 1090 - .quota_sync = vfs_quota_sync, 1091 - .get_info = vfs_get_dqinfo, 1092 - .set_info = vfs_set_dqinfo, 1093 - .get_dqblk = vfs_get_dqblk, 1094 - .set_dqblk = vfs_set_dqblk 1095 }; 1096 #endif 1097 ··· 2056 /* Turn quotas off */ 2057 for (i = 0; i < MAXQUOTAS; i++) { 2058 if (sb_dqopt(sb)->files[i]) 2059 - vfs_quota_off(sb, i, 0); 2060 } 2061 #endif 2062 sb->s_flags = s_flags; /* Restore MS_RDONLY status */ ··· 3578 ext4_fsblk_t n_blocks_count = 0; 3579 unsigned long old_sb_flags; 3580 struct ext4_mount_options old_opts; 3581 ext4_group_t g; 3582 unsigned int journal_ioprio = DEFAULT_JOURNAL_IOPRIO; 3583 int err; ··· 3636 } 3637 3638 if (*flags & MS_RDONLY) { 3639 /* 3640 * First of all, the unconditional stuff we have to do 3641 * to disable replay of the journal when we next remount ··· 3708 goto restore_opts; 3709 if (!ext4_setup_super(sb, es, 0)) 3710 sb->s_flags &= ~MS_RDONLY; 3711 } 3712 } 3713 ext4_setup_system_zone(sb); ··· 3724 #endif 3725 unlock_super(sb); 3726 unlock_kernel(); 3727 3728 ext4_msg(sb, KERN_INFO, "re-mounted. Opts: %s", orig_data); 3729 kfree(orig_data); ··· 3923 */ 3924 static int ext4_quota_on_mount(struct super_block *sb, int type) 3925 { 3926 - return vfs_quota_on_mount(sb, EXT4_SB(sb)->s_qf_names[type], 3927 - EXT4_SB(sb)->s_jquota_fmt, type); 3928 } 3929 3930 /* 3931 * Standard function to be called on quota_on 3932 */ 3933 static int ext4_quota_on(struct super_block *sb, int type, int format_id, 3934 - char *name, int remount) 3935 { 3936 int err; 3937 struct path path; 3938 3939 if (!test_opt(sb, QUOTA)) 3940 return -EINVAL; 3941 - /* When remounting, no checks are needed and in fact, name is NULL */ 3942 - if (remount) 3943 - return vfs_quota_on(sb, type, format_id, name, remount); 3944 3945 err = kern_path(name, LOOKUP_FOLLOW, &path); 3946 if (err) ··· 3976 } 3977 } 3978 3979 - err = vfs_quota_on_path(sb, type, format_id, &path); 3980 path_put(&path); 3981 return err; 3982 }
··· 646 struct ext4_super_block *es = sbi->s_es; 647 int i, err; 648 649 + dquot_disable(sb, -1, DQUOT_USAGE_ENABLED | DQUOT_LIMITS_ENABLED); 650 + 651 flush_workqueue(sbi->dio_unwritten_wq); 652 destroy_workqueue(sbi->dio_unwritten_wq); 653 ··· 1062 static int ext4_mark_dquot_dirty(struct dquot *dquot); 1063 static int ext4_write_info(struct super_block *sb, int type); 1064 static int ext4_quota_on(struct super_block *sb, int type, int format_id, 1065 + char *path); 1066 static int ext4_quota_on_mount(struct super_block *sb, int type); 1067 static ssize_t ext4_quota_read(struct super_block *sb, int type, char *data, 1068 size_t len, loff_t off); ··· 1084 1085 static const struct quotactl_ops ext4_qctl_operations = { 1086 .quota_on = ext4_quota_on, 1087 + .quota_off = dquot_quota_off, 1088 + .quota_sync = dquot_quota_sync, 1089 + .get_info = dquot_get_dqinfo, 1090 + .set_info = dquot_set_dqinfo, 1091 + .get_dqblk = dquot_get_dqblk, 1092 + .set_dqblk = dquot_set_dqblk 1093 }; 1094 #endif 1095 ··· 2054 /* Turn quotas off */ 2055 for (i = 0; i < MAXQUOTAS; i++) { 2056 if (sb_dqopt(sb)->files[i]) 2057 + dquot_quota_off(sb, i); 2058 } 2059 #endif 2060 sb->s_flags = s_flags; /* Restore MS_RDONLY status */ ··· 3576 ext4_fsblk_t n_blocks_count = 0; 3577 unsigned long old_sb_flags; 3578 struct ext4_mount_options old_opts; 3579 + int enable_quota = 0; 3580 ext4_group_t g; 3581 unsigned int journal_ioprio = DEFAULT_JOURNAL_IOPRIO; 3582 int err; ··· 3633 } 3634 3635 if (*flags & MS_RDONLY) { 3636 + err = dquot_suspend(sb, -1); 3637 + if (err < 0) 3638 + goto restore_opts; 3639 + 3640 /* 3641 * First of all, the unconditional stuff we have to do 3642 * to disable replay of the journal when we next remount ··· 3701 goto restore_opts; 3702 if (!ext4_setup_super(sb, es, 0)) 3703 sb->s_flags &= ~MS_RDONLY; 3704 + enable_quota = 1; 3705 } 3706 } 3707 ext4_setup_system_zone(sb); ··· 3716 #endif 3717 unlock_super(sb); 3718 unlock_kernel(); 3719 + if (enable_quota) 3720 + dquot_resume(sb, -1); 3721 3722 ext4_msg(sb, KERN_INFO, "re-mounted. Opts: %s", orig_data); 3723 kfree(orig_data); ··· 3913 */ 3914 static int ext4_quota_on_mount(struct super_block *sb, int type) 3915 { 3916 + return dquot_quota_on_mount(sb, EXT4_SB(sb)->s_qf_names[type], 3917 + EXT4_SB(sb)->s_jquota_fmt, type); 3918 } 3919 3920 /* 3921 * Standard function to be called on quota_on 3922 */ 3923 static int ext4_quota_on(struct super_block *sb, int type, int format_id, 3924 + char *name) 3925 { 3926 int err; 3927 struct path path; 3928 3929 if (!test_opt(sb, QUOTA)) 3930 return -EINVAL; 3931 3932 err = kern_path(name, LOOKUP_FOLLOW, &path); 3933 if (err) ··· 3969 } 3970 } 3971 3972 + err = dquot_quota_on_path(sb, type, format_id, &path); 3973 path_put(&path); 3974 return err; 3975 }
+16
fs/jfs/super.c
··· 179 180 jfs_info("In jfs_put_super"); 181 182 lock_kernel(); 183 184 rc = jfs_umount(sb); ··· 398 399 JFS_SBI(sb)->flag = flag; 400 ret = jfs_mount_rw(sb, 1); 401 unlock_kernel(); 402 return ret; 403 } 404 if ((!(sb->s_flags & MS_RDONLY)) && (*flags & MS_RDONLY)) { 405 rc = jfs_umount_rw(sb); 406 JFS_SBI(sb)->flag = flag; 407 unlock_kernel(); ··· 481 */ 482 sb->s_op = &jfs_super_operations; 483 sb->s_export_op = &jfs_export_operations; 484 485 /* 486 * Initialize direct-mapping inode/address-space
··· 179 180 jfs_info("In jfs_put_super"); 181 182 + dquot_disable(sb, -1, DQUOT_USAGE_ENABLED | DQUOT_LIMITS_ENABLED); 183 + 184 lock_kernel(); 185 186 rc = jfs_umount(sb); ··· 396 397 JFS_SBI(sb)->flag = flag; 398 ret = jfs_mount_rw(sb, 1); 399 + 400 + /* mark the fs r/w for quota activity */ 401 + sb->s_flags &= ~MS_RDONLY; 402 + 403 unlock_kernel(); 404 + dquot_resume(sb, -1); 405 return ret; 406 } 407 if ((!(sb->s_flags & MS_RDONLY)) && (*flags & MS_RDONLY)) { 408 + rc = dquot_suspend(sb, -1); 409 + if (rc < 0) { 410 + unlock_kernel(); 411 + return rc; 412 + } 413 rc = jfs_umount_rw(sb); 414 JFS_SBI(sb)->flag = flag; 415 unlock_kernel(); ··· 469 */ 470 sb->s_op = &jfs_super_operations; 471 sb->s_export_op = &jfs_export_operations; 472 + #ifdef CONFIG_QUOTA 473 + sb->dq_op = &dquot_operations; 474 + sb->s_qcop = &dquot_quotactl_ops; 475 + #endif 476 477 /* 478 * Initialize direct-mapping inode/address-space
+23 -27
fs/ocfs2/super.c
··· 879 if (!OCFS2_HAS_RO_COMPAT_FEATURE(sb, feature[type])) 880 continue; 881 if (unsuspend) 882 - status = vfs_quota_enable( 883 - sb_dqopt(sb)->files[type], 884 - type, QFMT_OCFS2, 885 - DQUOT_SUSPENDED); 886 - else 887 - status = vfs_quota_disable(sb, type, 888 - DQUOT_SUSPENDED); 889 if (status < 0) 890 break; 891 } ··· 918 status = -ENOENT; 919 goto out_quota_off; 920 } 921 - status = vfs_quota_enable(inode[type], type, QFMT_OCFS2, 922 - DQUOT_USAGE_ENABLED); 923 if (status < 0) 924 goto out_quota_off; 925 } ··· 954 /* Turn off quotas. This will remove all dquot structures from 955 * memory and so they will be automatically synced to global 956 * quota files */ 957 - vfs_quota_disable(sb, type, DQUOT_USAGE_ENABLED | 958 - DQUOT_LIMITS_ENABLED); 959 if (!inode) 960 continue; 961 iput(inode); ··· 964 965 /* Handle quota on quotactl */ 966 static int ocfs2_quota_on(struct super_block *sb, int type, int format_id, 967 - char *path, int remount) 968 { 969 unsigned int feature[MAXQUOTAS] = { OCFS2_FEATURE_RO_COMPAT_USRQUOTA, 970 OCFS2_FEATURE_RO_COMPAT_GRPQUOTA}; ··· 972 if (!OCFS2_HAS_RO_COMPAT_FEATURE(sb, feature[type])) 973 return -EINVAL; 974 975 - if (remount) 976 - return 0; /* Just ignore it has been handled in 977 - * ocfs2_remount() */ 978 - return vfs_quota_enable(sb_dqopt(sb)->files[type], type, 979 - format_id, DQUOT_LIMITS_ENABLED); 980 } 981 982 /* Handle quota off quotactl */ 983 - static int ocfs2_quota_off(struct super_block *sb, int type, int remount) 984 { 985 - if (remount) 986 - return 0; /* Ignore now and handle later in 987 - * ocfs2_remount() */ 988 - return vfs_quota_disable(sb, type, DQUOT_LIMITS_ENABLED); 989 } 990 991 static const struct quotactl_ops ocfs2_quotactl_ops = { 992 .quota_on = ocfs2_quota_on, 993 .quota_off = ocfs2_quota_off, 994 - .quota_sync = vfs_quota_sync, 995 - .get_info = vfs_get_dqinfo, 996 - .set_info = vfs_set_dqinfo, 997 - .get_dqblk = vfs_get_dqblk, 998 - .set_dqblk = vfs_set_dqblk, 999 }; 1000 1001 static int ocfs2_fill_super(struct super_block *sb, void *data, int silent)
··· 879 if (!OCFS2_HAS_RO_COMPAT_FEATURE(sb, feature[type])) 880 continue; 881 if (unsuspend) 882 + status = dquot_resume(sb, type); 883 + else { 884 + struct ocfs2_mem_dqinfo *oinfo; 885 + 886 + /* Cancel periodic syncing before suspending */ 887 + oinfo = sb_dqinfo(sb, type)->dqi_priv; 888 + cancel_delayed_work_sync(&oinfo->dqi_sync_work); 889 + status = dquot_suspend(sb, type); 890 + } 891 if (status < 0) 892 break; 893 } ··· 916 status = -ENOENT; 917 goto out_quota_off; 918 } 919 + status = dquot_enable(inode[type], type, QFMT_OCFS2, 920 + DQUOT_USAGE_ENABLED); 921 if (status < 0) 922 goto out_quota_off; 923 } ··· 952 /* Turn off quotas. This will remove all dquot structures from 953 * memory and so they will be automatically synced to global 954 * quota files */ 955 + dquot_disable(sb, type, DQUOT_USAGE_ENABLED | 956 + DQUOT_LIMITS_ENABLED); 957 if (!inode) 958 continue; 959 iput(inode); ··· 962 963 /* Handle quota on quotactl */ 964 static int ocfs2_quota_on(struct super_block *sb, int type, int format_id, 965 + char *path) 966 { 967 unsigned int feature[MAXQUOTAS] = { OCFS2_FEATURE_RO_COMPAT_USRQUOTA, 968 OCFS2_FEATURE_RO_COMPAT_GRPQUOTA}; ··· 970 if (!OCFS2_HAS_RO_COMPAT_FEATURE(sb, feature[type])) 971 return -EINVAL; 972 973 + return dquot_enable(sb_dqopt(sb)->files[type], type, 974 + format_id, DQUOT_LIMITS_ENABLED); 975 } 976 977 /* Handle quota off quotactl */ 978 + static int ocfs2_quota_off(struct super_block *sb, int type) 979 { 980 + return dquot_disable(sb, type, DQUOT_LIMITS_ENABLED); 981 } 982 983 static const struct quotactl_ops ocfs2_quotactl_ops = { 984 .quota_on = ocfs2_quota_on, 985 .quota_off = ocfs2_quota_off, 986 + .quota_sync = dquot_quota_sync, 987 + .get_info = dquot_get_dqinfo, 988 + .set_info = dquot_set_dqinfo, 989 + .get_dqblk = dquot_get_dqblk, 990 + .set_dqblk = dquot_set_dqblk, 991 }; 992 993 static int ocfs2_fill_super(struct super_block *sb, void *data, int silent)
+80 -112
fs/quota/dquot.c
··· 228 229 struct dqstats dqstats; 230 EXPORT_SYMBOL(dqstats); 231 - #ifdef CONFIG_SMP 232 - struct dqstats *dqstats_pcpu; 233 - EXPORT_SYMBOL(dqstats_pcpu); 234 - #endif 235 236 static qsize_t inode_get_rsv_space(struct inode *inode); 237 static void __dquot_initialize(struct inode *inode, int type); ··· 580 } 581 EXPORT_SYMBOL(dquot_scan_active); 582 583 - int vfs_quota_sync(struct super_block *sb, int type, int wait) 584 { 585 struct list_head *dirty; 586 struct dquot *dquot; ··· 652 653 return 0; 654 } 655 - EXPORT_SYMBOL(vfs_quota_sync); 656 657 /* Free unused dquots from cache */ 658 static void prune_dqcache(int count) ··· 672 } 673 } 674 675 - static int dqstats_read(unsigned int type) 676 - { 677 - int count = 0; 678 - #ifdef CONFIG_SMP 679 - int cpu; 680 - for_each_possible_cpu(cpu) 681 - count += per_cpu_ptr(dqstats_pcpu, cpu)->stat[type]; 682 - /* Statistics reading is racy, but absolute accuracy isn't required */ 683 - if (count < 0) 684 - count = 0; 685 - #else 686 - count = dqstats.stat[type]; 687 - #endif 688 - return count; 689 - } 690 - 691 /* 692 * This is called from kswapd when we think we need some 693 * more memory 694 */ 695 - 696 static int shrink_dqcache_memory(int nr, gfp_t gfp_mask) 697 { 698 if (nr) { ··· 683 prune_dqcache(nr); 684 spin_unlock(&dq_list_lock); 685 } 686 - return (dqstats_read(DQST_FREE_DQUOTS)/100) * sysctl_vfs_cache_pressure; 687 } 688 689 static struct shrinker dqcache_shrinker = { ··· 1796 if (iattr->ia_valid & ATTR_UID && iattr->ia_uid != inode->i_uid) 1797 transfer_to[USRQUOTA] = dqget(sb, iattr->ia_uid, USRQUOTA); 1798 if (iattr->ia_valid & ATTR_GID && iattr->ia_gid != inode->i_gid) 1799 - transfer_to[GRPQUOTA] = dqget(sb, iattr->ia_uid, GRPQUOTA); 1800 1801 ret = __dquot_transfer(inode, transfer_to); 1802 dqput_all(transfer_to); ··· 1831 .alloc_dquot = dquot_alloc, 1832 .destroy_dquot = dquot_destroy, 1833 }; 1834 1835 /* 1836 * Generic helper for ->open on filesystems supporting disk quotas. ··· 1850 /* 1851 * Turn quota off on a device. type == -1 ==> quotaoff for all types (umount) 1852 */ 1853 - int vfs_quota_disable(struct super_block *sb, int type, unsigned int flags) 1854 { 1855 int cnt, ret = 0; 1856 struct quota_info *dqopt = sb_dqopt(sb); ··· 1980 } 1981 return ret; 1982 } 1983 - EXPORT_SYMBOL(vfs_quota_disable); 1984 1985 - int vfs_quota_off(struct super_block *sb, int type, int remount) 1986 { 1987 - return vfs_quota_disable(sb, type, remount ? DQUOT_SUSPENDED : 1988 - (DQUOT_USAGE_ENABLED | DQUOT_LIMITS_ENABLED)); 1989 } 1990 - EXPORT_SYMBOL(vfs_quota_off); 1991 /* 1992 * Turn quotas on on a device 1993 */ ··· 2106 } 2107 2108 /* Reenable quotas on remount RW */ 2109 - static int vfs_quota_on_remount(struct super_block *sb, int type) 2110 { 2111 struct quota_info *dqopt = sb_dqopt(sb); 2112 struct inode *inode; 2113 - int ret; 2114 unsigned int flags; 2115 2116 - mutex_lock(&dqopt->dqonoff_mutex); 2117 - if (!sb_has_quota_suspended(sb, type)) { 2118 - mutex_unlock(&dqopt->dqonoff_mutex); 2119 - return 0; 2120 - } 2121 - inode = dqopt->files[type]; 2122 - dqopt->files[type] = NULL; 2123 - spin_lock(&dq_state_lock); 2124 - flags = dqopt->flags & dquot_state_flag(DQUOT_USAGE_ENABLED | 2125 - DQUOT_LIMITS_ENABLED, type); 2126 - dqopt->flags &= ~dquot_state_flag(DQUOT_STATE_FLAGS, type); 2127 - spin_unlock(&dq_state_lock); 2128 - mutex_unlock(&dqopt->dqonoff_mutex); 2129 2130 - flags = dquot_generic_flag(flags, type); 2131 - ret = vfs_load_quota_inode(inode, type, dqopt->info[type].dqi_fmt_id, 2132 - flags); 2133 - iput(inode); 2134 2135 return ret; 2136 } 2137 2138 - int vfs_quota_on_path(struct super_block *sb, int type, int format_id, 2139 struct path *path) 2140 { 2141 int error = security_quota_on(path->dentry); ··· 2157 DQUOT_LIMITS_ENABLED); 2158 return error; 2159 } 2160 - EXPORT_SYMBOL(vfs_quota_on_path); 2161 2162 - int vfs_quota_on(struct super_block *sb, int type, int format_id, char *name, 2163 - int remount) 2164 { 2165 struct path path; 2166 int error; 2167 2168 - if (remount) 2169 - return vfs_quota_on_remount(sb, type); 2170 - 2171 error = kern_path(name, LOOKUP_FOLLOW, &path); 2172 if (!error) { 2173 - error = vfs_quota_on_path(sb, type, format_id, &path); 2174 path_put(&path); 2175 } 2176 return error; 2177 } 2178 - EXPORT_SYMBOL(vfs_quota_on); 2179 2180 /* 2181 * More powerful function for turning on quotas allowing setting 2182 * of individual quota flags 2183 */ 2184 - int vfs_quota_enable(struct inode *inode, int type, int format_id, 2185 - unsigned int flags) 2186 { 2187 int ret = 0; 2188 struct super_block *sb = inode->i_sb; 2189 struct quota_info *dqopt = sb_dqopt(sb); 2190 2191 /* Just unsuspend quotas? */ 2192 - if (flags & DQUOT_SUSPENDED) 2193 - return vfs_quota_on_remount(sb, type); 2194 if (!flags) 2195 return 0; 2196 /* Just updating flags needed? */ ··· 2218 load_quota: 2219 return vfs_load_quota_inode(inode, type, format_id, flags); 2220 } 2221 - EXPORT_SYMBOL(vfs_quota_enable); 2222 2223 /* 2224 * This function is used when filesystem needs to initialize quotas 2225 * during mount time. 2226 */ 2227 - int vfs_quota_on_mount(struct super_block *sb, char *qf_name, 2228 int format_id, int type) 2229 { 2230 struct dentry *dentry; ··· 2250 dput(dentry); 2251 return error; 2252 } 2253 - EXPORT_SYMBOL(vfs_quota_on_mount); 2254 - 2255 - /* Wrapper to turn on quotas when remounting rw */ 2256 - int vfs_dq_quota_on_remount(struct super_block *sb) 2257 - { 2258 - int cnt; 2259 - int ret = 0, err; 2260 - 2261 - if (!sb->s_qcop || !sb->s_qcop->quota_on) 2262 - return -ENOSYS; 2263 - for (cnt = 0; cnt < MAXQUOTAS; cnt++) { 2264 - err = sb->s_qcop->quota_on(sb, cnt, 0, NULL, 1); 2265 - if (err < 0 && !ret) 2266 - ret = err; 2267 - } 2268 - return ret; 2269 - } 2270 - EXPORT_SYMBOL(vfs_dq_quota_on_remount); 2271 2272 static inline qsize_t qbtos(qsize_t blocks) 2273 { ··· 2285 spin_unlock(&dq_data_lock); 2286 } 2287 2288 - int vfs_get_dqblk(struct super_block *sb, int type, qid_t id, 2289 - struct fs_disk_quota *di) 2290 { 2291 struct dquot *dquot; 2292 ··· 2298 2299 return 0; 2300 } 2301 - EXPORT_SYMBOL(vfs_get_dqblk); 2302 2303 #define VFS_FS_DQ_MASK \ 2304 (FS_DQ_BCOUNT | FS_DQ_BSOFT | FS_DQ_BHARD | \ ··· 2397 return 0; 2398 } 2399 2400 - int vfs_set_dqblk(struct super_block *sb, int type, qid_t id, 2401 struct fs_disk_quota *di) 2402 { 2403 struct dquot *dquot; ··· 2413 out: 2414 return rc; 2415 } 2416 - EXPORT_SYMBOL(vfs_set_dqblk); 2417 2418 /* Generic routine for getting common part of quota file information */ 2419 - int vfs_get_dqinfo(struct super_block *sb, int type, struct if_dqinfo *ii) 2420 { 2421 struct mem_dqinfo *mi; 2422 ··· 2435 mutex_unlock(&sb_dqopt(sb)->dqonoff_mutex); 2436 return 0; 2437 } 2438 - EXPORT_SYMBOL(vfs_get_dqinfo); 2439 2440 /* Generic routine for setting common part of quota file information */ 2441 - int vfs_set_dqinfo(struct super_block *sb, int type, struct if_dqinfo *ii) 2442 { 2443 struct mem_dqinfo *mi; 2444 int err = 0; ··· 2465 mutex_unlock(&sb_dqopt(sb)->dqonoff_mutex); 2466 return err; 2467 } 2468 - EXPORT_SYMBOL(vfs_set_dqinfo); 2469 2470 - const struct quotactl_ops vfs_quotactl_ops = { 2471 - .quota_on = vfs_quota_on, 2472 - .quota_off = vfs_quota_off, 2473 - .quota_sync = vfs_quota_sync, 2474 - .get_info = vfs_get_dqinfo, 2475 - .set_info = vfs_set_dqinfo, 2476 - .get_dqblk = vfs_get_dqblk, 2477 - .set_dqblk = vfs_set_dqblk 2478 }; 2479 - 2480 2481 static int do_proc_dqstats(struct ctl_table *table, int write, 2482 void __user *buffer, size_t *lenp, loff_t *ppos) 2483 { 2484 - #ifdef CONFIG_SMP 2485 - /* Update global table */ 2486 unsigned int type = (int *)table->data - dqstats.stat; 2487 - dqstats.stat[type] = dqstats_read(type); 2488 - #endif 2489 return proc_dointvec(table, write, buffer, lenp, ppos); 2490 } 2491 ··· 2578 2579 static int __init dquot_init(void) 2580 { 2581 - int i; 2582 unsigned long nr_hash, order; 2583 2584 printk(KERN_NOTICE "VFS: Disk quotas %s\n", __DQUOT_VERSION__); ··· 2596 if (!dquot_hash) 2597 panic("Cannot create dquot hash table"); 2598 2599 - #ifdef CONFIG_SMP 2600 - dqstats_pcpu = alloc_percpu(struct dqstats); 2601 - if (!dqstats_pcpu) 2602 - panic("Cannot create dquot stats table"); 2603 - #endif 2604 - memset(&dqstats, 0, sizeof(struct dqstats)); 2605 2606 /* Find power-of-two hlist_heads which can fit into allocation */ 2607 nr_hash = (1UL << order) * PAGE_SIZE / sizeof(struct hlist_head);
··· 228 229 struct dqstats dqstats; 230 EXPORT_SYMBOL(dqstats); 231 232 static qsize_t inode_get_rsv_space(struct inode *inode); 233 static void __dquot_initialize(struct inode *inode, int type); ··· 584 } 585 EXPORT_SYMBOL(dquot_scan_active); 586 587 + int dquot_quota_sync(struct super_block *sb, int type, int wait) 588 { 589 struct list_head *dirty; 590 struct dquot *dquot; ··· 656 657 return 0; 658 } 659 + EXPORT_SYMBOL(dquot_quota_sync); 660 661 /* Free unused dquots from cache */ 662 static void prune_dqcache(int count) ··· 676 } 677 } 678 679 /* 680 * This is called from kswapd when we think we need some 681 * more memory 682 */ 683 static int shrink_dqcache_memory(int nr, gfp_t gfp_mask) 684 { 685 if (nr) { ··· 704 prune_dqcache(nr); 705 spin_unlock(&dq_list_lock); 706 } 707 + return ((unsigned) 708 + percpu_counter_read_positive(&dqstats.counter[DQST_FREE_DQUOTS]) 709 + /100) * sysctl_vfs_cache_pressure; 710 } 711 712 static struct shrinker dqcache_shrinker = { ··· 1815 if (iattr->ia_valid & ATTR_UID && iattr->ia_uid != inode->i_uid) 1816 transfer_to[USRQUOTA] = dqget(sb, iattr->ia_uid, USRQUOTA); 1817 if (iattr->ia_valid & ATTR_GID && iattr->ia_gid != inode->i_gid) 1818 + transfer_to[GRPQUOTA] = dqget(sb, iattr->ia_gid, GRPQUOTA); 1819 1820 ret = __dquot_transfer(inode, transfer_to); 1821 dqput_all(transfer_to); ··· 1850 .alloc_dquot = dquot_alloc, 1851 .destroy_dquot = dquot_destroy, 1852 }; 1853 + EXPORT_SYMBOL(dquot_operations); 1854 1855 /* 1856 * Generic helper for ->open on filesystems supporting disk quotas. ··· 1868 /* 1869 * Turn quota off on a device. type == -1 ==> quotaoff for all types (umount) 1870 */ 1871 + int dquot_disable(struct super_block *sb, int type, unsigned int flags) 1872 { 1873 int cnt, ret = 0; 1874 struct quota_info *dqopt = sb_dqopt(sb); ··· 1998 } 1999 return ret; 2000 } 2001 + EXPORT_SYMBOL(dquot_disable); 2002 2003 + int dquot_quota_off(struct super_block *sb, int type) 2004 { 2005 + return dquot_disable(sb, type, 2006 + DQUOT_USAGE_ENABLED | DQUOT_LIMITS_ENABLED); 2007 } 2008 + EXPORT_SYMBOL(dquot_quota_off); 2009 + 2010 /* 2011 * Turn quotas on on a device 2012 */ ··· 2123 } 2124 2125 /* Reenable quotas on remount RW */ 2126 + int dquot_resume(struct super_block *sb, int type) 2127 { 2128 struct quota_info *dqopt = sb_dqopt(sb); 2129 struct inode *inode; 2130 + int ret = 0, cnt; 2131 unsigned int flags; 2132 2133 + for (cnt = 0; cnt < MAXQUOTAS; cnt++) { 2134 + if (type != -1 && cnt != type) 2135 + continue; 2136 2137 + mutex_lock(&dqopt->dqonoff_mutex); 2138 + if (!sb_has_quota_suspended(sb, cnt)) { 2139 + mutex_unlock(&dqopt->dqonoff_mutex); 2140 + continue; 2141 + } 2142 + inode = dqopt->files[cnt]; 2143 + dqopt->files[cnt] = NULL; 2144 + spin_lock(&dq_state_lock); 2145 + flags = dqopt->flags & dquot_state_flag(DQUOT_USAGE_ENABLED | 2146 + DQUOT_LIMITS_ENABLED, 2147 + cnt); 2148 + dqopt->flags &= ~dquot_state_flag(DQUOT_STATE_FLAGS, cnt); 2149 + spin_unlock(&dq_state_lock); 2150 + mutex_unlock(&dqopt->dqonoff_mutex); 2151 + 2152 + flags = dquot_generic_flag(flags, cnt); 2153 + ret = vfs_load_quota_inode(inode, cnt, 2154 + dqopt->info[cnt].dqi_fmt_id, flags); 2155 + iput(inode); 2156 + } 2157 2158 return ret; 2159 } 2160 + EXPORT_SYMBOL(dquot_resume); 2161 2162 + int dquot_quota_on_path(struct super_block *sb, int type, int format_id, 2163 struct path *path) 2164 { 2165 int error = security_quota_on(path->dentry); ··· 2167 DQUOT_LIMITS_ENABLED); 2168 return error; 2169 } 2170 + EXPORT_SYMBOL(dquot_quota_on_path); 2171 2172 + int dquot_quota_on(struct super_block *sb, int type, int format_id, char *name) 2173 { 2174 struct path path; 2175 int error; 2176 2177 error = kern_path(name, LOOKUP_FOLLOW, &path); 2178 if (!error) { 2179 + error = dquot_quota_on_path(sb, type, format_id, &path); 2180 path_put(&path); 2181 } 2182 return error; 2183 } 2184 + EXPORT_SYMBOL(dquot_quota_on); 2185 2186 /* 2187 * More powerful function for turning on quotas allowing setting 2188 * of individual quota flags 2189 */ 2190 + int dquot_enable(struct inode *inode, int type, int format_id, 2191 + unsigned int flags) 2192 { 2193 int ret = 0; 2194 struct super_block *sb = inode->i_sb; 2195 struct quota_info *dqopt = sb_dqopt(sb); 2196 2197 /* Just unsuspend quotas? */ 2198 + BUG_ON(flags & DQUOT_SUSPENDED); 2199 + 2200 if (!flags) 2201 return 0; 2202 /* Just updating flags needed? */ ··· 2232 load_quota: 2233 return vfs_load_quota_inode(inode, type, format_id, flags); 2234 } 2235 + EXPORT_SYMBOL(dquot_enable); 2236 2237 /* 2238 * This function is used when filesystem needs to initialize quotas 2239 * during mount time. 2240 */ 2241 + int dquot_quota_on_mount(struct super_block *sb, char *qf_name, 2242 int format_id, int type) 2243 { 2244 struct dentry *dentry; ··· 2264 dput(dentry); 2265 return error; 2266 } 2267 + EXPORT_SYMBOL(dquot_quota_on_mount); 2268 2269 static inline qsize_t qbtos(qsize_t blocks) 2270 { ··· 2316 spin_unlock(&dq_data_lock); 2317 } 2318 2319 + int dquot_get_dqblk(struct super_block *sb, int type, qid_t id, 2320 + struct fs_disk_quota *di) 2321 { 2322 struct dquot *dquot; 2323 ··· 2329 2330 return 0; 2331 } 2332 + EXPORT_SYMBOL(dquot_get_dqblk); 2333 2334 #define VFS_FS_DQ_MASK \ 2335 (FS_DQ_BCOUNT | FS_DQ_BSOFT | FS_DQ_BHARD | \ ··· 2428 return 0; 2429 } 2430 2431 + int dquot_set_dqblk(struct super_block *sb, int type, qid_t id, 2432 struct fs_disk_quota *di) 2433 { 2434 struct dquot *dquot; ··· 2444 out: 2445 return rc; 2446 } 2447 + EXPORT_SYMBOL(dquot_set_dqblk); 2448 2449 /* Generic routine for getting common part of quota file information */ 2450 + int dquot_get_dqinfo(struct super_block *sb, int type, struct if_dqinfo *ii) 2451 { 2452 struct mem_dqinfo *mi; 2453 ··· 2466 mutex_unlock(&sb_dqopt(sb)->dqonoff_mutex); 2467 return 0; 2468 } 2469 + EXPORT_SYMBOL(dquot_get_dqinfo); 2470 2471 /* Generic routine for setting common part of quota file information */ 2472 + int dquot_set_dqinfo(struct super_block *sb, int type, struct if_dqinfo *ii) 2473 { 2474 struct mem_dqinfo *mi; 2475 int err = 0; ··· 2496 mutex_unlock(&sb_dqopt(sb)->dqonoff_mutex); 2497 return err; 2498 } 2499 + EXPORT_SYMBOL(dquot_set_dqinfo); 2500 2501 + const struct quotactl_ops dquot_quotactl_ops = { 2502 + .quota_on = dquot_quota_on, 2503 + .quota_off = dquot_quota_off, 2504 + .quota_sync = dquot_quota_sync, 2505 + .get_info = dquot_get_dqinfo, 2506 + .set_info = dquot_set_dqinfo, 2507 + .get_dqblk = dquot_get_dqblk, 2508 + .set_dqblk = dquot_set_dqblk 2509 }; 2510 + EXPORT_SYMBOL(dquot_quotactl_ops); 2511 2512 static int do_proc_dqstats(struct ctl_table *table, int write, 2513 void __user *buffer, size_t *lenp, loff_t *ppos) 2514 { 2515 unsigned int type = (int *)table->data - dqstats.stat; 2516 + 2517 + /* Update global table */ 2518 + dqstats.stat[type] = 2519 + percpu_counter_sum_positive(&dqstats.counter[type]); 2520 return proc_dointvec(table, write, buffer, lenp, ppos); 2521 } 2522 ··· 2609 2610 static int __init dquot_init(void) 2611 { 2612 + int i, ret; 2613 unsigned long nr_hash, order; 2614 2615 printk(KERN_NOTICE "VFS: Disk quotas %s\n", __DQUOT_VERSION__); ··· 2627 if (!dquot_hash) 2628 panic("Cannot create dquot hash table"); 2629 2630 + for (i = 0; i < _DQST_DQSTAT_LAST; i++) { 2631 + ret = percpu_counter_init(&dqstats.counter[i], 0); 2632 + if (ret) 2633 + panic("Cannot create dquot stat counters"); 2634 + } 2635 2636 /* Find power-of-two hlist_heads which can fit into allocation */ 2637 nr_hash = (1UL << order) * PAGE_SIZE / sizeof(struct hlist_head);
+2 -2
fs/quota/quota.c
··· 73 if (IS_ERR(pathname)) 74 return PTR_ERR(pathname); 75 if (sb->s_qcop->quota_on) 76 - ret = sb->s_qcop->quota_on(sb, type, id, pathname, 0); 77 putname(pathname); 78 return ret; 79 } ··· 260 case Q_QUOTAOFF: 261 if (!sb->s_qcop->quota_off) 262 return -ENOSYS; 263 - return sb->s_qcop->quota_off(sb, type, 0); 264 case Q_GETFMT: 265 return quota_getfmt(sb, type, addr); 266 case Q_GETINFO:
··· 73 if (IS_ERR(pathname)) 74 return PTR_ERR(pathname); 75 if (sb->s_qcop->quota_on) 76 + ret = sb->s_qcop->quota_on(sb, type, id, pathname); 77 putname(pathname); 78 return ret; 79 } ··· 260 case Q_QUOTAOFF: 261 if (!sb->s_qcop->quota_off) 262 return -ENOSYS; 263 + return sb->s_qcop->quota_off(sb, type); 264 case Q_GETFMT: 265 return quota_getfmt(sb, type, addr); 266 case Q_GETINFO:
+31 -17
fs/reiserfs/super.c
··· 158 #ifdef CONFIG_QUOTA 159 int i; 160 int ms_active_set; 161 #endif 162 163 /* compose key to look for "save" links */ ··· 180 } 181 /* Turn on quotas so that they are updated correctly */ 182 for (i = 0; i < MAXQUOTAS; i++) { 183 if (REISERFS_SB(s)->s_qf_names[i]) { 184 - int ret = reiserfs_quota_on_mount(s, i); 185 if (ret < 0) 186 reiserfs_warning(s, "reiserfs-2500", 187 "cannot turn on journaled " ··· 312 #ifdef CONFIG_QUOTA 313 /* Turn quotas off */ 314 for (i = 0; i < MAXQUOTAS; i++) { 315 - if (sb_dqopt(s)->files[i]) 316 - vfs_quota_off(s, i, 0); 317 } 318 if (ms_active_set) 319 /* Restore the flag back */ ··· 474 struct reiserfs_transaction_handle th; 475 th.t_trans_id = 0; 476 477 reiserfs_write_lock(s); 478 479 if (s->s_dirt) ··· 630 static int reiserfs_release_dquot(struct dquot *); 631 static int reiserfs_mark_dquot_dirty(struct dquot *); 632 static int reiserfs_write_info(struct super_block *, int); 633 - static int reiserfs_quota_on(struct super_block *, int, int, char *, int); 634 635 static const struct dquot_operations reiserfs_quota_operations = { 636 .write_dquot = reiserfs_write_dquot, ··· 644 645 static const struct quotactl_ops reiserfs_qctl_operations = { 646 .quota_on = reiserfs_quota_on, 647 - .quota_off = vfs_quota_off, 648 - .quota_sync = vfs_quota_sync, 649 - .get_info = vfs_get_dqinfo, 650 - .set_info = vfs_set_dqinfo, 651 - .get_dqblk = vfs_get_dqblk, 652 - .set_dqblk = vfs_set_dqblk, 653 }; 654 #endif 655 ··· 1252 if (s->s_flags & MS_RDONLY) 1253 /* it is read-only already */ 1254 goto out_ok; 1255 /* try to remount file system with read-only permissions */ 1256 if (sb_umount_state(rs) == REISERFS_VALID_FS 1257 || REISERFS_SB(s)->s_mount_state != REISERFS_VALID_FS) { ··· 1310 s->s_dirt = 0; 1311 1312 if (!(*mount_flags & MS_RDONLY)) { 1313 finish_unfinished(s); 1314 reiserfs_xattr_init(s, *mount_flags); 1315 } ··· 2038 */ 2039 static int reiserfs_quota_on_mount(struct super_block *sb, int type) 2040 { 2041 - return vfs_quota_on_mount(sb, REISERFS_SB(sb)->s_qf_names[type], 2042 - REISERFS_SB(sb)->s_jquota_fmt, type); 2043 } 2044 2045 /* 2046 * Standard function to be called on quota_on 2047 */ 2048 static int reiserfs_quota_on(struct super_block *sb, int type, int format_id, 2049 - char *name, int remount) 2050 { 2051 int err; 2052 struct path path; ··· 2055 2056 if (!(REISERFS_SB(sb)->s_mount_opt & (1 << REISERFS_QUOTA))) 2057 return -EINVAL; 2058 - /* No more checks needed? Path and format_id are bogus anyway... */ 2059 - if (remount) 2060 - return vfs_quota_on(sb, type, format_id, name, 1); 2061 err = kern_path(name, LOOKUP_FOLLOW, &path); 2062 if (err) 2063 return err; ··· 2099 if (err) 2100 goto out; 2101 } 2102 - err = vfs_quota_on_path(sb, type, format_id, &path); 2103 out: 2104 path_put(&path); 2105 return err;
··· 158 #ifdef CONFIG_QUOTA 159 int i; 160 int ms_active_set; 161 + int quota_enabled[MAXQUOTAS]; 162 #endif 163 164 /* compose key to look for "save" links */ ··· 179 } 180 /* Turn on quotas so that they are updated correctly */ 181 for (i = 0; i < MAXQUOTAS; i++) { 182 + quota_enabled[i] = 1; 183 if (REISERFS_SB(s)->s_qf_names[i]) { 184 + int ret; 185 + 186 + if (sb_has_quota_active(s, i)) { 187 + quota_enabled[i] = 0; 188 + continue; 189 + } 190 + ret = reiserfs_quota_on_mount(s, i); 191 if (ret < 0) 192 reiserfs_warning(s, "reiserfs-2500", 193 "cannot turn on journaled " ··· 304 #ifdef CONFIG_QUOTA 305 /* Turn quotas off */ 306 for (i = 0; i < MAXQUOTAS; i++) { 307 + if (sb_dqopt(s)->files[i] && quota_enabled[i]) 308 + dquot_quota_off(s, i); 309 } 310 if (ms_active_set) 311 /* Restore the flag back */ ··· 466 struct reiserfs_transaction_handle th; 467 th.t_trans_id = 0; 468 469 + dquot_disable(s, -1, DQUOT_USAGE_ENABLED | DQUOT_LIMITS_ENABLED); 470 + 471 reiserfs_write_lock(s); 472 473 if (s->s_dirt) ··· 620 static int reiserfs_release_dquot(struct dquot *); 621 static int reiserfs_mark_dquot_dirty(struct dquot *); 622 static int reiserfs_write_info(struct super_block *, int); 623 + static int reiserfs_quota_on(struct super_block *, int, int, char *); 624 625 static const struct dquot_operations reiserfs_quota_operations = { 626 .write_dquot = reiserfs_write_dquot, ··· 634 635 static const struct quotactl_ops reiserfs_qctl_operations = { 636 .quota_on = reiserfs_quota_on, 637 + .quota_off = dquot_quota_off, 638 + .quota_sync = dquot_quota_sync, 639 + .get_info = dquot_get_dqinfo, 640 + .set_info = dquot_set_dqinfo, 641 + .get_dqblk = dquot_get_dqblk, 642 + .set_dqblk = dquot_set_dqblk, 643 }; 644 #endif 645 ··· 1242 if (s->s_flags & MS_RDONLY) 1243 /* it is read-only already */ 1244 goto out_ok; 1245 + 1246 + err = dquot_suspend(s, -1); 1247 + if (err < 0) 1248 + goto out_err; 1249 + 1250 /* try to remount file system with read-only permissions */ 1251 if (sb_umount_state(rs) == REISERFS_VALID_FS 1252 || REISERFS_SB(s)->s_mount_state != REISERFS_VALID_FS) { ··· 1295 s->s_dirt = 0; 1296 1297 if (!(*mount_flags & MS_RDONLY)) { 1298 + dquot_resume(s, -1); 1299 finish_unfinished(s); 1300 reiserfs_xattr_init(s, *mount_flags); 1301 } ··· 2022 */ 2023 static int reiserfs_quota_on_mount(struct super_block *sb, int type) 2024 { 2025 + return dquot_quota_on_mount(sb, REISERFS_SB(sb)->s_qf_names[type], 2026 + REISERFS_SB(sb)->s_jquota_fmt, type); 2027 } 2028 2029 /* 2030 * Standard function to be called on quota_on 2031 */ 2032 static int reiserfs_quota_on(struct super_block *sb, int type, int format_id, 2033 + char *name) 2034 { 2035 int err; 2036 struct path path; ··· 2039 2040 if (!(REISERFS_SB(sb)->s_mount_opt & (1 << REISERFS_QUOTA))) 2041 return -EINVAL; 2042 + 2043 err = kern_path(name, LOOKUP_FOLLOW, &path); 2044 if (err) 2045 return err; ··· 2085 if (err) 2086 goto out; 2087 } 2088 + err = dquot_quota_on_path(sb, type, format_id, &path); 2089 out: 2090 path_put(&path); 2091 return err;
+2 -11
fs/super.c
··· 24 #include <linux/slab.h> 25 #include <linux/acct.h> 26 #include <linux/blkdev.h> 27 - #include <linux/quotaops.h> 28 #include <linux/mount.h> 29 #include <linux/security.h> 30 #include <linux/writeback.h> /* for the emergency remount stuff */ ··· 93 init_rwsem(&s->s_dquot.dqptr_sem); 94 init_waitqueue_head(&s->s_wait_unfrozen); 95 s->s_maxbytes = MAX_NON_LFS; 96 - s->dq_op = sb_dquot_ops; 97 - s->s_qcop = sb_quotactl_ops; 98 s->s_op = &default_op; 99 s->s_time_gran = 1000000000; 100 } ··· 157 { 158 struct file_system_type *fs = s->s_type; 159 if (atomic_dec_and_test(&s->s_active)) { 160 - vfs_dq_off(s, 0); 161 fs->kill_sb(s); 162 put_filesystem(fs); 163 put_super(s); ··· 520 int do_remount_sb(struct super_block *sb, int flags, void *data, int force) 521 { 522 int retval; 523 - int remount_rw, remount_ro; 524 525 if (sb->s_frozen != SB_UNFROZEN) 526 return -EBUSY; ··· 536 sync_filesystem(sb); 537 538 remount_ro = (flags & MS_RDONLY) && !(sb->s_flags & MS_RDONLY); 539 - remount_rw = !(flags & MS_RDONLY) && (sb->s_flags & MS_RDONLY); 540 541 /* If we are remounting RDONLY and current sb is read/write, 542 make sure there are no rw files opened */ ··· 543 if (force) 544 mark_files_ro(sb); 545 else if (!fs_may_remount_ro(sb)) 546 - return -EBUSY; 547 - retval = vfs_dq_off(sb, 1); 548 - if (retval < 0 && retval != -ENOSYS) 549 return -EBUSY; 550 } 551 ··· 552 return retval; 553 } 554 sb->s_flags = (sb->s_flags & ~MS_RMT_MASK) | (flags & MS_RMT_MASK); 555 - if (remount_rw) 556 - vfs_dq_quota_on_remount(sb); 557 /* 558 * Some filesystems modify their metadata via some other path than the 559 * bdev buffer cache (eg. use a private mapping, or directories in
··· 24 #include <linux/slab.h> 25 #include <linux/acct.h> 26 #include <linux/blkdev.h> 27 #include <linux/mount.h> 28 #include <linux/security.h> 29 #include <linux/writeback.h> /* for the emergency remount stuff */ ··· 94 init_rwsem(&s->s_dquot.dqptr_sem); 95 init_waitqueue_head(&s->s_wait_unfrozen); 96 s->s_maxbytes = MAX_NON_LFS; 97 s->s_op = &default_op; 98 s->s_time_gran = 1000000000; 99 } ··· 160 { 161 struct file_system_type *fs = s->s_type; 162 if (atomic_dec_and_test(&s->s_active)) { 163 fs->kill_sb(s); 164 put_filesystem(fs); 165 put_super(s); ··· 524 int do_remount_sb(struct super_block *sb, int flags, void *data, int force) 525 { 526 int retval; 527 + int remount_ro; 528 529 if (sb->s_frozen != SB_UNFROZEN) 530 return -EBUSY; ··· 540 sync_filesystem(sb); 541 542 remount_ro = (flags & MS_RDONLY) && !(sb->s_flags & MS_RDONLY); 543 544 /* If we are remounting RDONLY and current sb is read/write, 545 make sure there are no rw files opened */ ··· 548 if (force) 549 mark_files_ro(sb); 550 else if (!fs_may_remount_ro(sb)) 551 return -EBUSY; 552 } 553 ··· 560 return retval; 561 } 562 sb->s_flags = (sb->s_flags & ~MS_RMT_MASK) | (flags & MS_RMT_MASK); 563 + 564 /* 565 * Some filesystems modify their metadata via some other path than the 566 * bdev buffer cache (eg. use a private mapping, or directories in
+2 -41
fs/udf/balloc.c
··· 21 22 #include "udfdecl.h" 23 24 - #include <linux/quotaops.h> 25 #include <linux/buffer_head.h> 26 #include <linux/bitops.h> 27 ··· 158 udf_debug("byte=%2x\n", 159 ((char *)bh->b_data)[(bit + i) >> 3]); 160 } else { 161 - if (inode) 162 - dquot_free_block(inode, 1); 163 udf_add_free_space(sb, sbi->s_partition, 1); 164 } 165 } ··· 207 bit = block % (sb->s_blocksize << 3); 208 209 while (bit < (sb->s_blocksize << 3) && block_count > 0) { 210 - if (!udf_test_bit(bit, bh->b_data)) 211 goto out; 212 - else if (dquot_prealloc_block(inode, 1)) 213 - goto out; 214 - else if (!udf_clear_bit(bit, bh->b_data)) { 215 - udf_debug("bit already cleared for block %d\n", bit); 216 - dquot_free_block(inode, 1); 217 - goto out; 218 - } 219 block_count--; 220 alloc_count++; 221 bit++; ··· 328 } 329 330 got_block: 331 - 332 - /* 333 - * Check quota for allocation of this block. 334 - */ 335 - if (inode) { 336 - int ret = dquot_alloc_block(inode, 1); 337 - 338 - if (ret) { 339 - mutex_unlock(&sbi->s_alloc_mutex); 340 - *err = ret; 341 - return 0; 342 - } 343 - } 344 - 345 newblock = bit + (block_group << (sb->s_blocksize_bits + 3)) - 346 (sizeof(struct spaceBitmapDesc) << 3); 347 ··· 377 } 378 379 iinfo = UDF_I(table); 380 - /* We do this up front - There are some error conditions that 381 - could occure, but.. oh well */ 382 - if (inode) 383 - dquot_free_block(inode, count); 384 udf_add_free_space(sb, sbi->s_partition, count); 385 386 start = bloc->logicalBlockNum + offset; ··· 621 epos.offset -= adsize; 622 623 alloc_count = (elen >> sb->s_blocksize_bits); 624 - if (inode && dquot_prealloc_block(inode, 625 - alloc_count > block_count ? block_count : alloc_count)) 626 - alloc_count = 0; 627 - else if (alloc_count > block_count) { 628 alloc_count = block_count; 629 eloc.logicalBlockNum += alloc_count; 630 elen -= (alloc_count << sb->s_blocksize_bits); ··· 721 newblock = goal_eloc.logicalBlockNum; 722 goal_eloc.logicalBlockNum++; 723 goal_elen -= sb->s_blocksize; 724 - if (inode) { 725 - *err = dquot_alloc_block(inode, 1); 726 - if (*err) { 727 - brelse(goal_epos.bh); 728 - mutex_unlock(&sbi->s_alloc_mutex); 729 - return 0; 730 - } 731 - } 732 733 if (goal_elen) 734 udf_write_aext(table, &goal_epos, &goal_eloc, goal_elen, 1);
··· 21 22 #include "udfdecl.h" 23 24 #include <linux/buffer_head.h> 25 #include <linux/bitops.h> 26 ··· 159 udf_debug("byte=%2x\n", 160 ((char *)bh->b_data)[(bit + i) >> 3]); 161 } else { 162 udf_add_free_space(sb, sbi->s_partition, 1); 163 } 164 } ··· 210 bit = block % (sb->s_blocksize << 3); 211 212 while (bit < (sb->s_blocksize << 3) && block_count > 0) { 213 + if (!udf_clear_bit(bit, bh->b_data)) 214 goto out; 215 block_count--; 216 alloc_count++; 217 bit++; ··· 338 } 339 340 got_block: 341 newblock = bit + (block_group << (sb->s_blocksize_bits + 3)) - 342 (sizeof(struct spaceBitmapDesc) << 3); 343 ··· 401 } 402 403 iinfo = UDF_I(table); 404 udf_add_free_space(sb, sbi->s_partition, count); 405 406 start = bloc->logicalBlockNum + offset; ··· 649 epos.offset -= adsize; 650 651 alloc_count = (elen >> sb->s_blocksize_bits); 652 + if (alloc_count > block_count) { 653 alloc_count = block_count; 654 eloc.logicalBlockNum += alloc_count; 655 elen -= (alloc_count << sb->s_blocksize_bits); ··· 752 newblock = goal_eloc.logicalBlockNum; 753 goal_eloc.logicalBlockNum++; 754 goal_elen -= sb->s_blocksize; 755 756 if (goal_elen) 757 udf_write_aext(table, &goal_epos, &goal_eloc, goal_elen, 1);
+1 -25
fs/udf/file.c
··· 34 #include <linux/errno.h> 35 #include <linux/smp_lock.h> 36 #include <linux/pagemap.h> 37 - #include <linux/quotaops.h> 38 #include <linux/buffer_head.h> 39 #include <linux/aio.h> 40 #include <linux/smp_lock.h> ··· 218 .read = do_sync_read, 219 .aio_read = generic_file_aio_read, 220 .unlocked_ioctl = udf_ioctl, 221 - .open = dquot_file_open, 222 .mmap = generic_file_mmap, 223 .write = do_sync_write, 224 .aio_write = udf_file_aio_write, ··· 228 .llseek = generic_file_llseek, 229 }; 230 231 - int udf_setattr(struct dentry *dentry, struct iattr *iattr) 232 - { 233 - struct inode *inode = dentry->d_inode; 234 - int error; 235 - 236 - error = inode_change_ok(inode, iattr); 237 - if (error) 238 - return error; 239 - 240 - if (is_quota_modification(inode, iattr)) 241 - dquot_initialize(inode); 242 - 243 - if ((iattr->ia_valid & ATTR_UID && iattr->ia_uid != inode->i_uid) || 244 - (iattr->ia_valid & ATTR_GID && iattr->ia_gid != inode->i_gid)) { 245 - error = dquot_transfer(inode, iattr); 246 - if (error) 247 - return error; 248 - } 249 - 250 - return inode_setattr(inode, iattr); 251 - } 252 - 253 const struct inode_operations udf_file_inode_operations = { 254 .truncate = udf_truncate, 255 - .setattr = udf_setattr, 256 };
··· 34 #include <linux/errno.h> 35 #include <linux/smp_lock.h> 36 #include <linux/pagemap.h> 37 #include <linux/buffer_head.h> 38 #include <linux/aio.h> 39 #include <linux/smp_lock.h> ··· 219 .read = do_sync_read, 220 .aio_read = generic_file_aio_read, 221 .unlocked_ioctl = udf_ioctl, 222 + .open = generic_file_open, 223 .mmap = generic_file_mmap, 224 .write = do_sync_write, 225 .aio_write = udf_file_aio_write, ··· 229 .llseek = generic_file_llseek, 230 }; 231 232 const struct inode_operations udf_file_inode_operations = { 233 .truncate = udf_truncate, 234 };
+1 -20
fs/udf/ialloc.c
··· 20 21 #include "udfdecl.h" 22 #include <linux/fs.h> 23 - #include <linux/quotaops.h> 24 #include <linux/sched.h> 25 #include <linux/slab.h> 26 ··· 30 { 31 struct super_block *sb = inode->i_sb; 32 struct udf_sb_info *sbi = UDF_SB(sb); 33 - 34 - /* 35 - * Note: we must free any quota before locking the superblock, 36 - * as writing the quota to disk may need the lock as well. 37 - */ 38 - dquot_free_inode(inode); 39 - dquot_drop(inode); 40 41 clear_inode(inode); 42 ··· 53 struct super_block *sb = dir->i_sb; 54 struct udf_sb_info *sbi = UDF_SB(sb); 55 struct inode *inode; 56 - int block, ret; 57 uint32_t start = UDF_I(dir)->i_location.logicalBlockNum; 58 struct udf_inode_info *iinfo; 59 struct udf_inode_info *dinfo = UDF_I(dir); ··· 137 iinfo->i_crtime = current_fs_time(inode->i_sb); 138 insert_inode_hash(inode); 139 mark_inode_dirty(inode); 140 - 141 - dquot_initialize(inode); 142 - ret = dquot_alloc_inode(inode); 143 - if (ret) { 144 - dquot_drop(inode); 145 - inode->i_flags |= S_NOQUOTA; 146 - inode->i_nlink = 0; 147 - iput(inode); 148 - *err = ret; 149 - return NULL; 150 - } 151 152 *err = 0; 153 return inode;
··· 20 21 #include "udfdecl.h" 22 #include <linux/fs.h> 23 #include <linux/sched.h> 24 #include <linux/slab.h> 25 ··· 31 { 32 struct super_block *sb = inode->i_sb; 33 struct udf_sb_info *sbi = UDF_SB(sb); 34 35 clear_inode(inode); 36 ··· 61 struct super_block *sb = dir->i_sb; 62 struct udf_sb_info *sbi = UDF_SB(sb); 63 struct inode *inode; 64 + int block; 65 uint32_t start = UDF_I(dir)->i_location.logicalBlockNum; 66 struct udf_inode_info *iinfo; 67 struct udf_inode_info *dinfo = UDF_I(dir); ··· 145 iinfo->i_crtime = current_fs_time(inode->i_sb); 146 insert_inode_hash(inode); 147 mark_inode_dirty(inode); 148 149 *err = 0; 150 return inode;
-5
fs/udf/inode.c
··· 36 #include <linux/pagemap.h> 37 #include <linux/buffer_head.h> 38 #include <linux/writeback.h> 39 - #include <linux/quotaops.h> 40 #include <linux/slab.h> 41 #include <linux/crc-itu-t.h> 42 ··· 70 71 void udf_delete_inode(struct inode *inode) 72 { 73 - if (!is_bad_inode(inode)) 74 - dquot_initialize(inode); 75 - 76 truncate_inode_pages(&inode->i_data, 0); 77 78 if (is_bad_inode(inode)) ··· 109 (unsigned long long)iinfo->i_lenExtents); 110 } 111 112 - dquot_drop(inode); 113 kfree(iinfo->i_ext.i_data); 114 iinfo->i_ext.i_data = NULL; 115 }
··· 36 #include <linux/pagemap.h> 37 #include <linux/buffer_head.h> 38 #include <linux/writeback.h> 39 #include <linux/slab.h> 40 #include <linux/crc-itu-t.h> 41 ··· 71 72 void udf_delete_inode(struct inode *inode) 73 { 74 truncate_inode_pages(&inode->i_data, 0); 75 76 if (is_bad_inode(inode)) ··· 113 (unsigned long long)iinfo->i_lenExtents); 114 } 115 116 kfree(iinfo->i_ext.i_data); 117 iinfo->i_ext.i_data = NULL; 118 }
-20
fs/udf/namei.c
··· 27 #include <linux/errno.h> 28 #include <linux/mm.h> 29 #include <linux/slab.h> 30 - #include <linux/quotaops.h> 31 #include <linux/smp_lock.h> 32 #include <linux/buffer_head.h> 33 #include <linux/sched.h> ··· 562 int err; 563 struct udf_inode_info *iinfo; 564 565 - dquot_initialize(dir); 566 - 567 lock_kernel(); 568 inode = udf_new_inode(dir, mode, &err); 569 if (!inode) { ··· 614 if (!old_valid_dev(rdev)) 615 return -EINVAL; 616 617 - dquot_initialize(dir); 618 - 619 lock_kernel(); 620 err = -EIO; 621 inode = udf_new_inode(dir, mode, &err); ··· 658 int err; 659 struct udf_inode_info *dinfo = UDF_I(dir); 660 struct udf_inode_info *iinfo; 661 - 662 - dquot_initialize(dir); 663 664 lock_kernel(); 665 err = -EMLINK; ··· 793 struct fileIdentDesc *fi, cfi; 794 struct kernel_lb_addr tloc; 795 796 - dquot_initialize(dir); 797 - 798 retval = -ENOENT; 799 lock_kernel(); 800 fi = udf_find_entry(dir, &dentry->d_name, &fibh, &cfi); ··· 838 struct fileIdentDesc *fi; 839 struct fileIdentDesc cfi; 840 struct kernel_lb_addr tloc; 841 - 842 - dquot_initialize(dir); 843 844 retval = -ENOENT; 845 lock_kernel(); ··· 892 int namelen; 893 struct buffer_head *bh; 894 struct udf_inode_info *iinfo; 895 - 896 - dquot_initialize(dir); 897 898 lock_kernel(); 899 inode = udf_new_inode(dir, S_IFLNK | S_IRWXUGO, &err); ··· 1062 int err; 1063 struct buffer_head *bh; 1064 1065 - dquot_initialize(dir); 1066 - 1067 lock_kernel(); 1068 if (inode->i_nlink >= (256 << sizeof(inode->i_nlink)) - 1) { 1069 unlock_kernel(); ··· 1123 int retval = -ENOENT; 1124 struct kernel_lb_addr tloc; 1125 struct udf_inode_info *old_iinfo = UDF_I(old_inode); 1126 - 1127 - dquot_initialize(old_dir); 1128 - dquot_initialize(new_dir); 1129 1130 lock_kernel(); 1131 ofi = udf_find_entry(old_dir, &old_dentry->d_name, &ofibh, &ocfi); ··· 1369 const struct inode_operations udf_dir_inode_operations = { 1370 .lookup = udf_lookup, 1371 .create = udf_create, 1372 - .setattr = udf_setattr, 1373 .link = udf_link, 1374 .unlink = udf_unlink, 1375 .symlink = udf_symlink, ··· 1381 .readlink = generic_readlink, 1382 .follow_link = page_follow_link_light, 1383 .put_link = page_put_link, 1384 - .setattr = udf_setattr, 1385 };
··· 27 #include <linux/errno.h> 28 #include <linux/mm.h> 29 #include <linux/slab.h> 30 #include <linux/smp_lock.h> 31 #include <linux/buffer_head.h> 32 #include <linux/sched.h> ··· 563 int err; 564 struct udf_inode_info *iinfo; 565 566 lock_kernel(); 567 inode = udf_new_inode(dir, mode, &err); 568 if (!inode) { ··· 617 if (!old_valid_dev(rdev)) 618 return -EINVAL; 619 620 lock_kernel(); 621 err = -EIO; 622 inode = udf_new_inode(dir, mode, &err); ··· 663 int err; 664 struct udf_inode_info *dinfo = UDF_I(dir); 665 struct udf_inode_info *iinfo; 666 667 lock_kernel(); 668 err = -EMLINK; ··· 800 struct fileIdentDesc *fi, cfi; 801 struct kernel_lb_addr tloc; 802 803 retval = -ENOENT; 804 lock_kernel(); 805 fi = udf_find_entry(dir, &dentry->d_name, &fibh, &cfi); ··· 847 struct fileIdentDesc *fi; 848 struct fileIdentDesc cfi; 849 struct kernel_lb_addr tloc; 850 851 retval = -ENOENT; 852 lock_kernel(); ··· 903 int namelen; 904 struct buffer_head *bh; 905 struct udf_inode_info *iinfo; 906 907 lock_kernel(); 908 inode = udf_new_inode(dir, S_IFLNK | S_IRWXUGO, &err); ··· 1075 int err; 1076 struct buffer_head *bh; 1077 1078 lock_kernel(); 1079 if (inode->i_nlink >= (256 << sizeof(inode->i_nlink)) - 1) { 1080 unlock_kernel(); ··· 1138 int retval = -ENOENT; 1139 struct kernel_lb_addr tloc; 1140 struct udf_inode_info *old_iinfo = UDF_I(old_inode); 1141 1142 lock_kernel(); 1143 ofi = udf_find_entry(old_dir, &old_dentry->d_name, &ofibh, &ocfi); ··· 1387 const struct inode_operations udf_dir_inode_operations = { 1388 .lookup = udf_lookup, 1389 .create = udf_create, 1390 .link = udf_link, 1391 .unlink = udf_unlink, 1392 .symlink = udf_symlink, ··· 1400 .readlink = generic_readlink, 1401 .follow_link = page_follow_link_light, 1402 .put_link = page_put_link, 1403 };
+7 -6
fs/udf/super.c
··· 557 { 558 struct udf_options uopt; 559 struct udf_sb_info *sbi = UDF_SB(sb); 560 561 uopt.flags = sbi->s_flags; 562 uopt.uid = sbi->s_uid; ··· 583 *flags |= MS_RDONLY; 584 } 585 586 - if ((*flags & MS_RDONLY) == (sb->s_flags & MS_RDONLY)) { 587 - unlock_kernel(); 588 - return 0; 589 - } 590 if (*flags & MS_RDONLY) 591 udf_close_lvid(sb); 592 else 593 udf_open_lvid(sb); 594 595 unlock_kernel(); 596 - return 0; 597 } 598 599 /* Check Volume Structure Descriptors (ECMA 167 2/9.1) */ ··· 1940 /* Fill in the rest of the superblock */ 1941 sb->s_op = &udf_sb_ops; 1942 sb->s_export_op = &udf_export_ops; 1943 - sb->dq_op = NULL; 1944 sb->s_dirt = 0; 1945 sb->s_magic = UDF_SUPER_MAGIC; 1946 sb->s_time_gran = 1000;
··· 557 { 558 struct udf_options uopt; 559 struct udf_sb_info *sbi = UDF_SB(sb); 560 + int error = 0; 561 562 uopt.flags = sbi->s_flags; 563 uopt.uid = sbi->s_uid; ··· 582 *flags |= MS_RDONLY; 583 } 584 585 + if ((*flags & MS_RDONLY) == (sb->s_flags & MS_RDONLY)) 586 + goto out_unlock; 587 + 588 if (*flags & MS_RDONLY) 589 udf_close_lvid(sb); 590 else 591 udf_open_lvid(sb); 592 593 + out_unlock: 594 unlock_kernel(); 595 + return error; 596 } 597 598 /* Check Volume Structure Descriptors (ECMA 167 2/9.1) */ ··· 1939 /* Fill in the rest of the superblock */ 1940 sb->s_op = &udf_sb_ops; 1941 sb->s_export_op = &udf_export_ops; 1942 + 1943 sb->s_dirt = 0; 1944 sb->s_magic = UDF_SUPER_MAGIC; 1945 sb->s_time_gran = 1000;
-1
fs/udf/udfdecl.h
··· 131 132 /* file.c */ 133 extern long udf_ioctl(struct file *, unsigned int, unsigned long); 134 - extern int udf_setattr(struct dentry *dentry, struct iattr *iattr); 135 /* inode.c */ 136 extern struct inode *udf_iget(struct super_block *, struct kernel_lb_addr *); 137 extern int udf_sync_inode(struct inode *);
··· 131 132 /* file.c */ 133 extern long udf_ioctl(struct file *, unsigned int, unsigned long); 134 /* inode.c */ 135 extern struct inode *udf_iget(struct super_block *, struct kernel_lb_addr *); 136 extern int udf_sync_inode(struct inode *);
-24
fs/ufs/balloc.c
··· 12 #include <linux/stat.h> 13 #include <linux/time.h> 14 #include <linux/string.h> 15 - #include <linux/quotaops.h> 16 #include <linux/buffer_head.h> 17 #include <linux/capability.h> 18 #include <linux/bitops.h> ··· 83 ufs_error (sb, "ufs_free_fragments", 84 "bit already cleared for fragment %u", i); 85 } 86 - 87 - dquot_free_block(inode, count); 88 - 89 90 fs32_add(sb, &ucg->cg_cs.cs_nffree, count); 91 uspi->cs_total.cs_nffree += count; ··· 191 ubh_setblock(UCPI_UBH(ucpi), ucpi->c_freeoff, blkno); 192 if ((UFS_SB(sb)->s_flags & UFS_CG_MASK) == UFS_CG_44BSD) 193 ufs_clusteracct (sb, ucpi, blkno, 1); 194 - dquot_free_block(inode, uspi->s_fpb); 195 196 fs32_add(sb, &ucg->cg_cs.cs_nbfree, 1); 197 uspi->cs_total.cs_nbfree++; ··· 506 struct ufs_cg_private_info * ucpi; 507 struct ufs_cylinder_group * ucg; 508 unsigned cgno, fragno, fragoff, count, fragsize, i; 509 - int ret; 510 511 UFSD("ENTER, fragment %llu, oldcount %u, newcount %u\n", 512 (unsigned long long)fragment, oldcount, newcount); ··· 551 fs32_add(sb, &ucg->cg_frsum[fragsize - count], 1); 552 for (i = oldcount; i < newcount; i++) 553 ubh_clrbit (UCPI_UBH(ucpi), ucpi->c_freeoff, fragno + i); 554 - ret = dquot_alloc_block(inode, count); 555 - if (ret) { 556 - *err = ret; 557 - return 0; 558 - } 559 560 fs32_sub(sb, &ucg->cg_cs.cs_nffree, count); 561 fs32_sub(sb, &UFS_SB(sb)->fs_cs(cgno).cs_nffree, count); ··· 587 struct ufs_cylinder_group * ucg; 588 unsigned oldcg, i, j, k, allocsize; 589 u64 result; 590 - int ret; 591 592 UFSD("ENTER, ino %lu, cgno %u, goal %llu, count %u\n", 593 inode->i_ino, cgno, (unsigned long long)goal, count); ··· 655 for (i = count; i < uspi->s_fpb; i++) 656 ubh_setbit (UCPI_UBH(ucpi), ucpi->c_freeoff, goal + i); 657 i = uspi->s_fpb - count; 658 - dquot_free_block(inode, i); 659 660 fs32_add(sb, &ucg->cg_cs.cs_nffree, i); 661 uspi->cs_total.cs_nffree += i; ··· 666 result = ufs_bitmap_search (sb, ucpi, goal, allocsize); 667 if (result == INVBLOCK) 668 return 0; 669 - ret = dquot_alloc_block(inode, count); 670 - if (ret) { 671 - *err = ret; 672 - return 0; 673 - } 674 for (i = 0; i < count; i++) 675 ubh_clrbit (UCPI_UBH(ucpi), ucpi->c_freeoff, result + i); 676 ··· 700 struct ufs_super_block_first * usb1; 701 struct ufs_cylinder_group * ucg; 702 u64 result, blkno; 703 - int ret; 704 705 UFSD("ENTER, goal %llu\n", (unsigned long long)goal); 706 ··· 733 ubh_clrblock (UCPI_UBH(ucpi), ucpi->c_freeoff, blkno); 734 if ((UFS_SB(sb)->s_flags & UFS_CG_MASK) == UFS_CG_44BSD) 735 ufs_clusteracct (sb, ucpi, blkno, -1); 736 - ret = dquot_alloc_block(inode, uspi->s_fpb); 737 - if (ret) { 738 - *err = ret; 739 - return INVBLOCK; 740 - } 741 742 fs32_sub(sb, &ucg->cg_cs.cs_nbfree, 1); 743 uspi->cs_total.cs_nbfree--;
··· 12 #include <linux/stat.h> 13 #include <linux/time.h> 14 #include <linux/string.h> 15 #include <linux/buffer_head.h> 16 #include <linux/capability.h> 17 #include <linux/bitops.h> ··· 84 ufs_error (sb, "ufs_free_fragments", 85 "bit already cleared for fragment %u", i); 86 } 87 88 fs32_add(sb, &ucg->cg_cs.cs_nffree, count); 89 uspi->cs_total.cs_nffree += count; ··· 195 ubh_setblock(UCPI_UBH(ucpi), ucpi->c_freeoff, blkno); 196 if ((UFS_SB(sb)->s_flags & UFS_CG_MASK) == UFS_CG_44BSD) 197 ufs_clusteracct (sb, ucpi, blkno, 1); 198 199 fs32_add(sb, &ucg->cg_cs.cs_nbfree, 1); 200 uspi->cs_total.cs_nbfree++; ··· 511 struct ufs_cg_private_info * ucpi; 512 struct ufs_cylinder_group * ucg; 513 unsigned cgno, fragno, fragoff, count, fragsize, i; 514 515 UFSD("ENTER, fragment %llu, oldcount %u, newcount %u\n", 516 (unsigned long long)fragment, oldcount, newcount); ··· 557 fs32_add(sb, &ucg->cg_frsum[fragsize - count], 1); 558 for (i = oldcount; i < newcount; i++) 559 ubh_clrbit (UCPI_UBH(ucpi), ucpi->c_freeoff, fragno + i); 560 561 fs32_sub(sb, &ucg->cg_cs.cs_nffree, count); 562 fs32_sub(sb, &UFS_SB(sb)->fs_cs(cgno).cs_nffree, count); ··· 598 struct ufs_cylinder_group * ucg; 599 unsigned oldcg, i, j, k, allocsize; 600 u64 result; 601 602 UFSD("ENTER, ino %lu, cgno %u, goal %llu, count %u\n", 603 inode->i_ino, cgno, (unsigned long long)goal, count); ··· 667 for (i = count; i < uspi->s_fpb; i++) 668 ubh_setbit (UCPI_UBH(ucpi), ucpi->c_freeoff, goal + i); 669 i = uspi->s_fpb - count; 670 671 fs32_add(sb, &ucg->cg_cs.cs_nffree, i); 672 uspi->cs_total.cs_nffree += i; ··· 679 result = ufs_bitmap_search (sb, ucpi, goal, allocsize); 680 if (result == INVBLOCK) 681 return 0; 682 for (i = 0; i < count; i++) 683 ubh_clrbit (UCPI_UBH(ucpi), ucpi->c_freeoff, result + i); 684 ··· 718 struct ufs_super_block_first * usb1; 719 struct ufs_cylinder_group * ucg; 720 u64 result, blkno; 721 722 UFSD("ENTER, goal %llu\n", (unsigned long long)goal); 723 ··· 752 ubh_clrblock (UCPI_UBH(ucpi), ucpi->c_freeoff, blkno); 753 if ((UFS_SB(sb)->s_flags & UFS_CG_MASK) == UFS_CG_44BSD) 754 ufs_clusteracct (sb, ucpi, blkno, -1); 755 756 fs32_sub(sb, &ucg->cg_cs.cs_nbfree, 1); 757 uspi->cs_total.cs_nbfree--;
+1 -2
fs/ufs/file.c
··· 24 */ 25 26 #include <linux/fs.h> 27 - #include <linux/quotaops.h> 28 29 #include "ufs_fs.h" 30 #include "ufs.h" ··· 40 .write = do_sync_write, 41 .aio_write = generic_file_aio_write, 42 .mmap = generic_file_mmap, 43 - .open = dquot_file_open, 44 .fsync = generic_file_fsync, 45 .splice_read = generic_file_splice_read, 46 };
··· 24 */ 25 26 #include <linux/fs.h> 27 28 #include "ufs_fs.h" 29 #include "ufs.h" ··· 41 .write = do_sync_write, 42 .aio_write = generic_file_aio_write, 43 .mmap = generic_file_mmap, 44 + .open = generic_file_open, 45 .fsync = generic_file_fsync, 46 .splice_read = generic_file_splice_read, 47 };
-13
fs/ufs/ialloc.c
··· 27 #include <linux/time.h> 28 #include <linux/stat.h> 29 #include <linux/string.h> 30 - #include <linux/quotaops.h> 31 #include <linux/buffer_head.h> 32 #include <linux/sched.h> 33 #include <linux/bitops.h> ··· 93 ucg->cg_time = cpu_to_fs32(sb, get_seconds()); 94 95 is_directory = S_ISDIR(inode->i_mode); 96 - 97 - dquot_free_inode(inode); 98 - dquot_drop(inode); 99 100 clear_inode (inode); 101 ··· 343 344 unlock_super (sb); 345 346 - dquot_initialize(inode); 347 - err = dquot_alloc_inode(inode); 348 - if (err) { 349 - dquot_drop(inode); 350 - goto fail_without_unlock; 351 - } 352 - 353 UFSD("allocating inode %lu\n", inode->i_ino); 354 UFSD("EXIT\n"); 355 return inode; 356 357 fail_remove_inode: 358 unlock_super(sb); 359 - fail_without_unlock: 360 - inode->i_flags |= S_NOQUOTA; 361 inode->i_nlink = 0; 362 iput(inode); 363 UFSD("EXIT (FAILED): err %d\n", err);
··· 27 #include <linux/time.h> 28 #include <linux/stat.h> 29 #include <linux/string.h> 30 #include <linux/buffer_head.h> 31 #include <linux/sched.h> 32 #include <linux/bitops.h> ··· 94 ucg->cg_time = cpu_to_fs32(sb, get_seconds()); 95 96 is_directory = S_ISDIR(inode->i_mode); 97 98 clear_inode (inode); 99 ··· 347 348 unlock_super (sb); 349 350 UFSD("allocating inode %lu\n", inode->i_ino); 351 UFSD("EXIT\n"); 352 return inode; 353 354 fail_remove_inode: 355 unlock_super(sb); 356 inode->i_nlink = 0; 357 iput(inode); 358 UFSD("EXIT (FAILED): err %d\n", err);
-4
fs/ufs/inode.c
··· 37 #include <linux/smp_lock.h> 38 #include <linux/buffer_head.h> 39 #include <linux/writeback.h> 40 - #include <linux/quotaops.h> 41 42 #include "ufs_fs.h" 43 #include "ufs.h" ··· 908 void ufs_delete_inode (struct inode * inode) 909 { 910 loff_t old_i_size; 911 - 912 - if (!is_bad_inode(inode)) 913 - dquot_initialize(inode); 914 915 truncate_inode_pages(&inode->i_data, 0); 916 if (is_bad_inode(inode))
··· 37 #include <linux/smp_lock.h> 38 #include <linux/buffer_head.h> 39 #include <linux/writeback.h> 40 41 #include "ufs_fs.h" 42 #include "ufs.h" ··· 909 void ufs_delete_inode (struct inode * inode) 910 { 911 loff_t old_i_size; 912 913 truncate_inode_pages(&inode->i_data, 0); 914 if (is_bad_inode(inode))
-16
fs/ufs/namei.c
··· 30 #include <linux/time.h> 31 #include <linux/fs.h> 32 #include <linux/smp_lock.h> 33 - #include <linux/quotaops.h> 34 35 #include "ufs_fs.h" 36 #include "ufs.h" ··· 85 86 UFSD("BEGIN\n"); 87 88 - dquot_initialize(dir); 89 - 90 inode = ufs_new_inode(dir, mode); 91 err = PTR_ERR(inode); 92 ··· 109 if (!old_valid_dev(rdev)) 110 return -EINVAL; 111 112 - dquot_initialize(dir); 113 - 114 inode = ufs_new_inode(dir, mode); 115 err = PTR_ERR(inode); 116 if (!IS_ERR(inode)) { ··· 132 133 if (l > sb->s_blocksize) 134 goto out_notlocked; 135 - 136 - dquot_initialize(dir); 137 138 lock_kernel(); 139 inode = ufs_new_inode(dir, S_IFLNK | S_IRWXUGO); ··· 178 return -EMLINK; 179 } 180 181 - dquot_initialize(dir); 182 - 183 inode->i_ctime = CURRENT_TIME_SEC; 184 inode_inc_link_count(inode); 185 atomic_inc(&inode->i_count); ··· 194 195 if (dir->i_nlink >= UFS_LINK_MAX) 196 goto out; 197 - 198 - dquot_initialize(dir); 199 200 lock_kernel(); 201 inode_inc_link_count(dir); ··· 239 struct page *page; 240 int err = -ENOENT; 241 242 - dquot_initialize(dir); 243 - 244 de = ufs_find_entry(dir, &dentry->d_name, &page); 245 if (!de) 246 goto out; ··· 282 struct page *old_page; 283 struct ufs_dir_entry *old_de; 284 int err = -ENOENT; 285 - 286 - dquot_initialize(old_dir); 287 - dquot_initialize(new_dir); 288 289 old_de = ufs_find_entry(old_dir, &old_dentry->d_name, &old_page); 290 if (!old_de)
··· 30 #include <linux/time.h> 31 #include <linux/fs.h> 32 #include <linux/smp_lock.h> 33 34 #include "ufs_fs.h" 35 #include "ufs.h" ··· 86 87 UFSD("BEGIN\n"); 88 89 inode = ufs_new_inode(dir, mode); 90 err = PTR_ERR(inode); 91 ··· 112 if (!old_valid_dev(rdev)) 113 return -EINVAL; 114 115 inode = ufs_new_inode(dir, mode); 116 err = PTR_ERR(inode); 117 if (!IS_ERR(inode)) { ··· 137 138 if (l > sb->s_blocksize) 139 goto out_notlocked; 140 141 lock_kernel(); 142 inode = ufs_new_inode(dir, S_IFLNK | S_IRWXUGO); ··· 185 return -EMLINK; 186 } 187 188 inode->i_ctime = CURRENT_TIME_SEC; 189 inode_inc_link_count(inode); 190 atomic_inc(&inode->i_count); ··· 203 204 if (dir->i_nlink >= UFS_LINK_MAX) 205 goto out; 206 207 lock_kernel(); 208 inode_inc_link_count(dir); ··· 250 struct page *page; 251 int err = -ENOENT; 252 253 de = ufs_find_entry(dir, &dentry->d_name, &page); 254 if (!de) 255 goto out; ··· 295 struct page *old_page; 296 struct ufs_dir_entry *old_de; 297 int err = -ENOENT; 298 299 old_de = ufs_find_entry(old_dir, &old_dentry->d_name, &old_page); 300 if (!old_de)
+1 -109
fs/ufs/super.c
··· 77 78 #include <linux/errno.h> 79 #include <linux/fs.h> 80 - #include <linux/quotaops.h> 81 #include <linux/slab.h> 82 #include <linux/time.h> 83 #include <linux/stat.h> ··· 1046 */ 1047 sb->s_op = &ufs_super_ops; 1048 sb->s_export_op = &ufs_export_ops; 1049 - sb->dq_op = NULL; /***/ 1050 sb->s_magic = fs32_to_cpu(sb, usb3->fs_magic); 1051 1052 uspi->s_sblkno = fs32_to_cpu(sb, usb1->fs_sblkno); ··· 1436 kmem_cache_destroy(ufs_inode_cachep); 1437 } 1438 1439 - static void ufs_clear_inode(struct inode *inode) 1440 - { 1441 - dquot_drop(inode); 1442 - } 1443 - 1444 - #ifdef CONFIG_QUOTA 1445 - static ssize_t ufs_quota_read(struct super_block *, int, char *,size_t, loff_t); 1446 - static ssize_t ufs_quota_write(struct super_block *, int, const char *, size_t, loff_t); 1447 - #endif 1448 - 1449 static const struct super_operations ufs_super_ops = { 1450 .alloc_inode = ufs_alloc_inode, 1451 .destroy_inode = ufs_destroy_inode, 1452 .write_inode = ufs_write_inode, 1453 .delete_inode = ufs_delete_inode, 1454 - .clear_inode = ufs_clear_inode, 1455 .put_super = ufs_put_super, 1456 .write_super = ufs_write_super, 1457 .sync_fs = ufs_sync_fs, 1458 .statfs = ufs_statfs, 1459 .remount_fs = ufs_remount, 1460 .show_options = ufs_show_options, 1461 - #ifdef CONFIG_QUOTA 1462 - .quota_read = ufs_quota_read, 1463 - .quota_write = ufs_quota_write, 1464 - #endif 1465 }; 1466 - 1467 - #ifdef CONFIG_QUOTA 1468 - 1469 - /* Read data from quotafile - avoid pagecache and such because we cannot afford 1470 - * acquiring the locks... As quota files are never truncated and quota code 1471 - * itself serializes the operations (and noone else should touch the files) 1472 - * we don't have to be afraid of races */ 1473 - static ssize_t ufs_quota_read(struct super_block *sb, int type, char *data, 1474 - size_t len, loff_t off) 1475 - { 1476 - struct inode *inode = sb_dqopt(sb)->files[type]; 1477 - sector_t blk = off >> sb->s_blocksize_bits; 1478 - int err = 0; 1479 - int offset = off & (sb->s_blocksize - 1); 1480 - int tocopy; 1481 - size_t toread; 1482 - struct buffer_head *bh; 1483 - loff_t i_size = i_size_read(inode); 1484 - 1485 - if (off > i_size) 1486 - return 0; 1487 - if (off+len > i_size) 1488 - len = i_size-off; 1489 - toread = len; 1490 - while (toread > 0) { 1491 - tocopy = sb->s_blocksize - offset < toread ? 1492 - sb->s_blocksize - offset : toread; 1493 - 1494 - bh = ufs_bread(inode, blk, 0, &err); 1495 - if (err) 1496 - return err; 1497 - if (!bh) /* A hole? */ 1498 - memset(data, 0, tocopy); 1499 - else { 1500 - memcpy(data, bh->b_data+offset, tocopy); 1501 - brelse(bh); 1502 - } 1503 - offset = 0; 1504 - toread -= tocopy; 1505 - data += tocopy; 1506 - blk++; 1507 - } 1508 - return len; 1509 - } 1510 - 1511 - /* Write to quotafile */ 1512 - static ssize_t ufs_quota_write(struct super_block *sb, int type, 1513 - const char *data, size_t len, loff_t off) 1514 - { 1515 - struct inode *inode = sb_dqopt(sb)->files[type]; 1516 - sector_t blk = off >> sb->s_blocksize_bits; 1517 - int err = 0; 1518 - int offset = off & (sb->s_blocksize - 1); 1519 - int tocopy; 1520 - size_t towrite = len; 1521 - struct buffer_head *bh; 1522 - 1523 - mutex_lock_nested(&inode->i_mutex, I_MUTEX_QUOTA); 1524 - while (towrite > 0) { 1525 - tocopy = sb->s_blocksize - offset < towrite ? 1526 - sb->s_blocksize - offset : towrite; 1527 - 1528 - bh = ufs_bread(inode, blk, 1, &err); 1529 - if (!bh) 1530 - goto out; 1531 - lock_buffer(bh); 1532 - memcpy(bh->b_data+offset, data, tocopy); 1533 - flush_dcache_page(bh->b_page); 1534 - set_buffer_uptodate(bh); 1535 - mark_buffer_dirty(bh); 1536 - unlock_buffer(bh); 1537 - brelse(bh); 1538 - offset = 0; 1539 - towrite -= tocopy; 1540 - data += tocopy; 1541 - blk++; 1542 - } 1543 - out: 1544 - if (len == towrite) { 1545 - mutex_unlock(&inode->i_mutex); 1546 - return err; 1547 - } 1548 - if (inode->i_size < off+len-towrite) 1549 - i_size_write(inode, off+len-towrite); 1550 - inode->i_version++; 1551 - inode->i_mtime = inode->i_ctime = CURRENT_TIME_SEC; 1552 - mark_inode_dirty(inode); 1553 - mutex_unlock(&inode->i_mutex); 1554 - return len - towrite; 1555 - } 1556 - 1557 - #endif 1558 1559 static int ufs_get_sb(struct file_system_type *fs_type, 1560 int flags, const char *dev_name, void *data, struct vfsmount *mnt)
··· 77 78 #include <linux/errno.h> 79 #include <linux/fs.h> 80 #include <linux/slab.h> 81 #include <linux/time.h> 82 #include <linux/stat.h> ··· 1047 */ 1048 sb->s_op = &ufs_super_ops; 1049 sb->s_export_op = &ufs_export_ops; 1050 + 1051 sb->s_magic = fs32_to_cpu(sb, usb3->fs_magic); 1052 1053 uspi->s_sblkno = fs32_to_cpu(sb, usb1->fs_sblkno); ··· 1437 kmem_cache_destroy(ufs_inode_cachep); 1438 } 1439 1440 static const struct super_operations ufs_super_ops = { 1441 .alloc_inode = ufs_alloc_inode, 1442 .destroy_inode = ufs_destroy_inode, 1443 .write_inode = ufs_write_inode, 1444 .delete_inode = ufs_delete_inode, 1445 .put_super = ufs_put_super, 1446 .write_super = ufs_write_super, 1447 .sync_fs = ufs_sync_fs, 1448 .statfs = ufs_statfs, 1449 .remount_fs = ufs_remount, 1450 .show_options = ufs_show_options, 1451 }; 1452 1453 static int ufs_get_sb(struct file_system_type *fs_type, 1454 int flags, const char *dev_name, void *data, struct vfsmount *mnt)
-10
fs/ufs/truncate.c
··· 44 #include <linux/buffer_head.h> 45 #include <linux/blkdev.h> 46 #include <linux/sched.h> 47 - #include <linux/quotaops.h> 48 49 #include "ufs_fs.h" 50 #include "ufs.h" ··· 515 if (error) 516 return error; 517 518 - if (is_quota_modification(inode, attr)) 519 - dquot_initialize(inode); 520 - 521 - if ((ia_valid & ATTR_UID && attr->ia_uid != inode->i_uid) || 522 - (ia_valid & ATTR_GID && attr->ia_gid != inode->i_gid)) { 523 - error = dquot_transfer(inode, attr); 524 - if (error) 525 - return error; 526 - } 527 if (ia_valid & ATTR_SIZE && attr->ia_size != inode->i_size) { 528 loff_t old_i_size = inode->i_size; 529
··· 44 #include <linux/buffer_head.h> 45 #include <linux/blkdev.h> 46 #include <linux/sched.h> 47 48 #include "ufs_fs.h" 49 #include "ufs.h" ··· 516 if (error) 517 return error; 518 519 if (ia_valid & ATTR_SIZE && attr->ia_size != inode->i_size) { 520 loff_t old_i_size = inode->i_size; 521
+6 -14
include/linux/quota.h
··· 174 #include <linux/rwsem.h> 175 #include <linux/spinlock.h> 176 #include <linux/wait.h> 177 - #include <linux/percpu.h> 178 - #include <linux/smp.h> 179 180 #include <linux/dqblk_xfs.h> 181 #include <linux/dqblk_v1.h> ··· 253 254 struct dqstats { 255 int stat[_DQST_DQSTAT_LAST]; 256 }; 257 258 extern struct dqstats *dqstats_pcpu; ··· 261 262 static inline void dqstats_inc(unsigned int type) 263 { 264 - #ifdef CONFIG_SMP 265 - per_cpu_ptr(dqstats_pcpu, smp_processor_id())->stat[type]++; 266 - #else 267 - dqstats.stat[type]++; 268 - #endif 269 } 270 271 static inline void dqstats_dec(unsigned int type) 272 { 273 - #ifdef CONFIG_SMP 274 - per_cpu_ptr(dqstats_pcpu, smp_processor_id())->stat[type]--; 275 - #else 276 - dqstats.stat[type]--; 277 - #endif 278 } 279 280 #define DQ_MOD_B 0 /* dquot modified since read */ ··· 324 325 /* Operations handling requests from userspace */ 326 struct quotactl_ops { 327 - int (*quota_on)(struct super_block *, int, int, char *, int); 328 - int (*quota_off)(struct super_block *, int, int); 329 int (*quota_sync)(struct super_block *, int, int); 330 int (*get_info)(struct super_block *, int, struct if_dqinfo *); 331 int (*set_info)(struct super_block *, int, struct if_dqinfo *);
··· 174 #include <linux/rwsem.h> 175 #include <linux/spinlock.h> 176 #include <linux/wait.h> 177 + #include <linux/percpu_counter.h> 178 179 #include <linux/dqblk_xfs.h> 180 #include <linux/dqblk_v1.h> ··· 254 255 struct dqstats { 256 int stat[_DQST_DQSTAT_LAST]; 257 + struct percpu_counter counter[_DQST_DQSTAT_LAST]; 258 }; 259 260 extern struct dqstats *dqstats_pcpu; ··· 261 262 static inline void dqstats_inc(unsigned int type) 263 { 264 + percpu_counter_inc(&dqstats.counter[type]); 265 } 266 267 static inline void dqstats_dec(unsigned int type) 268 { 269 + percpu_counter_dec(&dqstats.counter[type]); 270 } 271 272 #define DQ_MOD_B 0 /* dquot modified since read */ ··· 332 333 /* Operations handling requests from userspace */ 334 struct quotactl_ops { 335 + int (*quota_on)(struct super_block *, int, int, char *); 336 + int (*quota_off)(struct super_block *, int); 337 int (*quota_sync)(struct super_block *, int, int); 338 int (*get_info)(struct super_block *, int, struct if_dqinfo *); 339 int (*set_info)(struct super_block *, int, struct if_dqinfo *);
+36 -43
include/linux/quotaops.h
··· 53 int dquot_claim_space_nodirty(struct inode *inode, qsize_t number); 54 void dquot_free_inode(const struct inode *inode); 55 56 int dquot_commit(struct dquot *dquot); 57 int dquot_acquire(struct dquot *dquot); 58 int dquot_release(struct dquot *dquot); ··· 69 70 int dquot_file_open(struct inode *inode, struct file *file); 71 72 - int vfs_quota_on(struct super_block *sb, int type, int format_id, 73 - char *path, int remount); 74 - int vfs_quota_enable(struct inode *inode, int type, int format_id, 75 unsigned int flags); 76 - int vfs_quota_on_path(struct super_block *sb, int type, int format_id, 77 struct path *path); 78 - int vfs_quota_on_mount(struct super_block *sb, char *qf_name, 79 int format_id, int type); 80 - int vfs_quota_off(struct super_block *sb, int type, int remount); 81 - int vfs_quota_disable(struct super_block *sb, int type, unsigned int flags); 82 - int vfs_quota_sync(struct super_block *sb, int type, int wait); 83 - int vfs_get_dqinfo(struct super_block *sb, int type, struct if_dqinfo *ii); 84 - int vfs_set_dqinfo(struct super_block *sb, int type, struct if_dqinfo *ii); 85 - int vfs_get_dqblk(struct super_block *sb, int type, qid_t id, 86 struct fs_disk_quota *di); 87 - int vfs_set_dqblk(struct super_block *sb, int type, qid_t id, 88 struct fs_disk_quota *di); 89 90 int __dquot_transfer(struct inode *inode, struct dquot **transfer_to); 91 int dquot_transfer(struct inode *inode, struct iattr *iattr); 92 - int vfs_dq_quota_on_remount(struct super_block *sb); 93 94 static inline struct mem_dqinfo *sb_dqinfo(struct super_block *sb, int type) 95 { ··· 154 * Operations supported for diskquotas. 155 */ 156 extern const struct dquot_operations dquot_operations; 157 - extern const struct quotactl_ops vfs_quotactl_ops; 158 - 159 - #define sb_dquot_ops (&dquot_operations) 160 - #define sb_quotactl_ops (&vfs_quotactl_ops) 161 - 162 - /* Cannot be called inside a transaction */ 163 - static inline int vfs_dq_off(struct super_block *sb, int remount) 164 - { 165 - int ret = -ENOSYS; 166 - 167 - if (sb->s_qcop && sb->s_qcop->quota_off) 168 - ret = sb->s_qcop->quota_off(sb, -1, remount); 169 - return ret; 170 - } 171 172 #else 173 ··· 199 return 0; 200 } 201 202 - /* 203 - * NO-OP when quota not configured. 204 - */ 205 - #define sb_dquot_ops (NULL) 206 - #define sb_quotactl_ops (NULL) 207 - 208 static inline void dquot_initialize(struct inode *inode) 209 { 210 } ··· 214 215 static inline void dquot_free_inode(const struct inode *inode) 216 { 217 - } 218 - 219 - static inline int vfs_dq_off(struct super_block *sb, int remount) 220 - { 221 - return 0; 222 - } 223 - 224 - static inline int vfs_dq_quota_on_remount(struct super_block *sb) 225 - { 226 - return 0; 227 } 228 229 static inline int dquot_transfer(struct inode *inode, struct iattr *iattr) ··· 239 static inline int dquot_claim_space_nodirty(struct inode *inode, qsize_t number) 240 { 241 inode_add_bytes(inode, number); 242 return 0; 243 } 244
··· 53 int dquot_claim_space_nodirty(struct inode *inode, qsize_t number); 54 void dquot_free_inode(const struct inode *inode); 55 56 + int dquot_disable(struct super_block *sb, int type, unsigned int flags); 57 + /* Suspend quotas on remount RO */ 58 + static inline int dquot_suspend(struct super_block *sb, int type) 59 + { 60 + return dquot_disable(sb, type, DQUOT_SUSPENDED); 61 + } 62 + int dquot_resume(struct super_block *sb, int type); 63 + 64 int dquot_commit(struct dquot *dquot); 65 int dquot_acquire(struct dquot *dquot); 66 int dquot_release(struct dquot *dquot); ··· 61 62 int dquot_file_open(struct inode *inode, struct file *file); 63 64 + int dquot_quota_on(struct super_block *sb, int type, int format_id, 65 + char *path); 66 + int dquot_enable(struct inode *inode, int type, int format_id, 67 unsigned int flags); 68 + int dquot_quota_on_path(struct super_block *sb, int type, int format_id, 69 struct path *path); 70 + int dquot_quota_on_mount(struct super_block *sb, char *qf_name, 71 int format_id, int type); 72 + int dquot_quota_off(struct super_block *sb, int type); 73 + int dquot_quota_sync(struct super_block *sb, int type, int wait); 74 + int dquot_get_dqinfo(struct super_block *sb, int type, struct if_dqinfo *ii); 75 + int dquot_set_dqinfo(struct super_block *sb, int type, struct if_dqinfo *ii); 76 + int dquot_get_dqblk(struct super_block *sb, int type, qid_t id, 77 struct fs_disk_quota *di); 78 + int dquot_set_dqblk(struct super_block *sb, int type, qid_t id, 79 struct fs_disk_quota *di); 80 81 int __dquot_transfer(struct inode *inode, struct dquot **transfer_to); 82 int dquot_transfer(struct inode *inode, struct iattr *iattr); 83 84 static inline struct mem_dqinfo *sb_dqinfo(struct super_block *sb, int type) 85 { ··· 148 * Operations supported for diskquotas. 149 */ 150 extern const struct dquot_operations dquot_operations; 151 + extern const struct quotactl_ops dquot_quotactl_ops; 152 153 #else 154 ··· 206 return 0; 207 } 208 209 static inline void dquot_initialize(struct inode *inode) 210 { 211 } ··· 227 228 static inline void dquot_free_inode(const struct inode *inode) 229 { 230 } 231 232 static inline int dquot_transfer(struct inode *inode, struct iattr *iattr) ··· 262 static inline int dquot_claim_space_nodirty(struct inode *inode, qsize_t number) 263 { 264 inode_add_bytes(inode, number); 265 + return 0; 266 + } 267 + 268 + static inline int dquot_disable(struct super_block *sb, int type, 269 + unsigned int flags) 270 + { 271 + return 0; 272 + } 273 + 274 + static inline int dquot_suspend(struct super_block *sb, int type) 275 + { 276 + return 0; 277 + } 278 + 279 + static inline int dquot_resume(struct super_block *sb, int type) 280 + { 281 return 0; 282 } 283