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