diff options
| author | Christoph Hellwig <hch@infradead.org> | 2010-05-19 07:16:44 -0400 |
|---|---|---|
| committer | Jan Kara <jack@suse.cz> | 2010-05-24 08:10:17 -0400 |
| commit | 123e9caf1e85008ab7eb5f6cd58c44f9a5d73b2b (patch) | |
| tree | a7a49a9aabb2136e8d19a3d86096bb525a16e0b9 | |
| parent | 307ae18a56e5b706056a2050d52e8cc01b5171c0 (diff) | |
quota: explicitly set ->dq_op and ->s_qcop
Only set the quota operation vectors if the filesystem actually supports
quota instead of doing it for all filesystems in alloc_super().
[Jan Kara: Export dquot_operations and vfs_quotactl_ops]
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jan Kara <jack@suse.cz>
| -rw-r--r-- | fs/ext2/super.c | 6 | ||||
| -rw-r--r-- | fs/jfs/super.c | 4 | ||||
| -rw-r--r-- | fs/quota/dquot.c | 3 | ||||
| -rw-r--r-- | fs/super.c | 3 | ||||
| -rw-r--r-- | fs/udf/super.c | 6 | ||||
| -rw-r--r-- | fs/ufs/super.c | 6 | ||||
| -rw-r--r-- | include/linux/quotaops.h | 9 |
7 files changed, 22 insertions, 15 deletions
diff --git a/fs/ext2/super.c b/fs/ext2/super.c index b9b77c3e7ae0..df752b71b869 100644 --- a/fs/ext2/super.c +++ b/fs/ext2/super.c | |||
| @@ -1065,6 +1065,12 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent) | |||
| 1065 | sb->s_op = &ext2_sops; | 1065 | sb->s_op = &ext2_sops; |
| 1066 | sb->s_export_op = &ext2_export_ops; | 1066 | sb->s_export_op = &ext2_export_ops; |
| 1067 | sb->s_xattr = ext2_xattr_handlers; | 1067 | sb->s_xattr = ext2_xattr_handlers; |
| 1068 | |||
| 1069 | #ifdef CONFIG_QUOTA | ||
| 1070 | sb->dq_op = &dquot_operations; | ||
| 1071 | sb->s_qcop = &vfs_quotactl_ops; | ||
| 1072 | #endif | ||
| 1073 | |||
| 1068 | root = ext2_iget(sb, EXT2_ROOT_INO); | 1074 | root = ext2_iget(sb, EXT2_ROOT_INO); |
| 1069 | if (IS_ERR(root)) { | 1075 | if (IS_ERR(root)) { |
| 1070 | ret = PTR_ERR(root); | 1076 | ret = PTR_ERR(root); |
diff --git a/fs/jfs/super.c b/fs/jfs/super.c index 7d940a3a3d93..2e7ec5e8cda4 100644 --- a/fs/jfs/super.c +++ b/fs/jfs/super.c | |||
| @@ -481,6 +481,10 @@ static int jfs_fill_super(struct super_block *sb, void *data, int silent) | |||
| 481 | */ | 481 | */ |
| 482 | sb->s_op = &jfs_super_operations; | 482 | sb->s_op = &jfs_super_operations; |
| 483 | sb->s_export_op = &jfs_export_operations; | 483 | sb->s_export_op = &jfs_export_operations; |
| 484 | #ifdef CONFIG_QUOTA | ||
| 485 | sb->dq_op = &dquot_operations; | ||
| 486 | sb->s_qcop = &vfs_quotactl_ops; | ||
| 487 | #endif | ||
| 484 | 488 | ||
| 485 | /* | 489 | /* |
| 486 | * Initialize direct-mapping inode/address-space | 490 | * Initialize direct-mapping inode/address-space |
diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c index b84422657f6d..9ba526e3f719 100644 --- a/fs/quota/dquot.c +++ b/fs/quota/dquot.c | |||
| @@ -1847,6 +1847,7 @@ const struct dquot_operations dquot_operations = { | |||
| 1847 | .alloc_dquot = dquot_alloc, | 1847 | .alloc_dquot = dquot_alloc, |
| 1848 | .destroy_dquot = dquot_destroy, | 1848 | .destroy_dquot = dquot_destroy, |
| 1849 | }; | 1849 | }; |
| 1850 | EXPORT_SYMBOL(dquot_operations); | ||
| 1850 | 1851 | ||
| 1851 | /* | 1852 | /* |
| 1852 | * Generic helper for ->open on filesystems supporting disk quotas. | 1853 | * Generic helper for ->open on filesystems supporting disk quotas. |
| @@ -2491,7 +2492,7 @@ const struct quotactl_ops vfs_quotactl_ops = { | |||
| 2491 | .get_dqblk = vfs_get_dqblk, | 2492 | .get_dqblk = vfs_get_dqblk, |
| 2492 | .set_dqblk = vfs_set_dqblk | 2493 | .set_dqblk = vfs_set_dqblk |
| 2493 | }; | 2494 | }; |
| 2494 | 2495 | EXPORT_SYMBOL(vfs_quotactl_ops); | |
| 2495 | 2496 | ||
| 2496 | static int do_proc_dqstats(struct ctl_table *table, int write, | 2497 | static int do_proc_dqstats(struct ctl_table *table, int write, |
| 2497 | void __user *buffer, size_t *lenp, loff_t *ppos) | 2498 | void __user *buffer, size_t *lenp, loff_t *ppos) |
diff --git a/fs/super.c b/fs/super.c index 05f62e5d464d..af9fd02185aa 100644 --- a/fs/super.c +++ b/fs/super.c | |||
| @@ -24,7 +24,6 @@ | |||
| 24 | #include <linux/slab.h> | 24 | #include <linux/slab.h> |
| 25 | #include <linux/acct.h> | 25 | #include <linux/acct.h> |
| 26 | #include <linux/blkdev.h> | 26 | #include <linux/blkdev.h> |
| 27 | #include <linux/quotaops.h> | ||
| 28 | #include <linux/mount.h> | 27 | #include <linux/mount.h> |
| 29 | #include <linux/security.h> | 28 | #include <linux/security.h> |
| 30 | #include <linux/writeback.h> /* for the emergency remount stuff */ | 29 | #include <linux/writeback.h> /* for the emergency remount stuff */ |
| @@ -94,8 +93,6 @@ static struct super_block *alloc_super(struct file_system_type *type) | |||
| 94 | init_rwsem(&s->s_dquot.dqptr_sem); | 93 | init_rwsem(&s->s_dquot.dqptr_sem); |
| 95 | init_waitqueue_head(&s->s_wait_unfrozen); | 94 | init_waitqueue_head(&s->s_wait_unfrozen); |
| 96 | s->s_maxbytes = MAX_NON_LFS; | 95 | s->s_maxbytes = MAX_NON_LFS; |
| 97 | s->dq_op = sb_dquot_ops; | ||
| 98 | s->s_qcop = sb_quotactl_ops; | ||
| 99 | s->s_op = &default_op; | 96 | s->s_op = &default_op; |
| 100 | s->s_time_gran = 1000000000; | 97 | s->s_time_gran = 1000000000; |
| 101 | } | 98 | } |
diff --git a/fs/udf/super.c b/fs/udf/super.c index 76a61566f299..ef9221b7456e 100644 --- a/fs/udf/super.c +++ b/fs/udf/super.c | |||
| @@ -1948,7 +1948,11 @@ static int udf_fill_super(struct super_block *sb, void *options, int silent) | |||
| 1948 | /* Fill in the rest of the superblock */ | 1948 | /* Fill in the rest of the superblock */ |
| 1949 | sb->s_op = &udf_sb_ops; | 1949 | sb->s_op = &udf_sb_ops; |
| 1950 | sb->s_export_op = &udf_export_ops; | 1950 | sb->s_export_op = &udf_export_ops; |
| 1951 | sb->dq_op = NULL; | 1951 | #ifdef CONFIG_QUOTA |
| 1952 | sb->s_qcop = &vfs_quotactl_ops; | ||
| 1953 | sb->dq_op = NULL; /* &dquot_operations */ | ||
| 1954 | #endif | ||
| 1955 | |||
| 1952 | sb->s_dirt = 0; | 1956 | sb->s_dirt = 0; |
| 1953 | sb->s_magic = UDF_SUPER_MAGIC; | 1957 | sb->s_magic = UDF_SUPER_MAGIC; |
| 1954 | sb->s_time_gran = 1000; | 1958 | sb->s_time_gran = 1000; |
diff --git a/fs/ufs/super.c b/fs/ufs/super.c index d3977c7128e3..60c989b7012f 100644 --- a/fs/ufs/super.c +++ b/fs/ufs/super.c | |||
| @@ -1045,7 +1045,11 @@ magic_found: | |||
| 1045 | */ | 1045 | */ |
| 1046 | sb->s_op = &ufs_super_ops; | 1046 | sb->s_op = &ufs_super_ops; |
| 1047 | sb->s_export_op = &ufs_export_ops; | 1047 | sb->s_export_op = &ufs_export_ops; |
| 1048 | sb->dq_op = NULL; /***/ | 1048 | #ifdef CONFIG_QUOTA |
| 1049 | sb->s_qcop = &vfs_quotactl_ops; | ||
| 1050 | sb->dq_op = NULL; /* &dquot_operations */ | ||
| 1051 | #endif | ||
| 1052 | |||
| 1049 | sb->s_magic = fs32_to_cpu(sb, usb3->fs_magic); | 1053 | sb->s_magic = fs32_to_cpu(sb, usb3->fs_magic); |
| 1050 | 1054 | ||
| 1051 | uspi->s_sblkno = fs32_to_cpu(sb, usb1->fs_sblkno); | 1055 | uspi->s_sblkno = fs32_to_cpu(sb, usb1->fs_sblkno); |
diff --git a/include/linux/quotaops.h b/include/linux/quotaops.h index a6592ddc349f..84b8dbf59c03 100644 --- a/include/linux/quotaops.h +++ b/include/linux/quotaops.h | |||
| @@ -153,9 +153,6 @@ static inline unsigned sb_any_quota_active(struct super_block *sb) | |||
| 153 | extern const struct dquot_operations dquot_operations; | 153 | extern const struct dquot_operations dquot_operations; |
| 154 | extern const struct quotactl_ops vfs_quotactl_ops; | 154 | extern const struct quotactl_ops vfs_quotactl_ops; |
| 155 | 155 | ||
| 156 | #define sb_dquot_ops (&dquot_operations) | ||
| 157 | #define sb_quotactl_ops (&vfs_quotactl_ops) | ||
| 158 | |||
| 159 | #else | 156 | #else |
| 160 | 157 | ||
| 161 | static inline int sb_has_quota_usage_enabled(struct super_block *sb, int type) | 158 | static inline int sb_has_quota_usage_enabled(struct super_block *sb, int type) |
| @@ -199,12 +196,6 @@ static inline int sb_any_quota_active(struct super_block *sb) | |||
| 199 | return 0; | 196 | return 0; |
| 200 | } | 197 | } |
| 201 | 198 | ||
| 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) | 199 | static inline void dquot_initialize(struct inode *inode) |
| 209 | { | 200 | { |
| 210 | } | 201 | } |
