quota: explicitly set ->dq_op and ->s_qcop
authorChristoph Hellwig <hch@infradead.org>
Wed, 19 May 2010 11:16:44 +0000 (07:16 -0400)
committerJan Kara <jack@suse.cz>
Mon, 24 May 2010 12:10:17 +0000 (14:10 +0200)
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>
fs/ext2/super.c
fs/jfs/super.c
fs/quota/dquot.c
fs/super.c
fs/udf/super.c
fs/ufs/super.c
include/linux/quotaops.h

index b9b77c3e7ae05f3dd3866a2f4b924647ac58b9ff..df752b71b8694422fe888d445b0322a338399f65 100644 (file)
@@ -1065,6 +1065,12 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent)
        sb->s_op = &ext2_sops;
        sb->s_export_op = &ext2_export_ops;
        sb->s_xattr = ext2_xattr_handlers;
+
+#ifdef CONFIG_QUOTA
+       sb->dq_op = &dquot_operations;
+       sb->s_qcop = &vfs_quotactl_ops;
+#endif
+
        root = ext2_iget(sb, EXT2_ROOT_INO);
        if (IS_ERR(root)) {
                ret = PTR_ERR(root);
index 7d940a3a3d9343b344355e11ff5884849c54e942..2e7ec5e8cda4f3263ba4acd98ae1ca338e32b7fc 100644 (file)
@@ -481,6 +481,10 @@ static int jfs_fill_super(struct super_block *sb, void *data, int silent)
         */
        sb->s_op = &jfs_super_operations;
        sb->s_export_op = &jfs_export_operations;
+#ifdef CONFIG_QUOTA
+       sb->dq_op = &dquot_operations;
+       sb->s_qcop = &vfs_quotactl_ops;
+#endif
 
        /*
         * Initialize direct-mapping inode/address-space
index b84422657f6dc0bb1796aa91dae52e267852b695..9ba526e3f71985d0ff458a7d8ed6b09f84d6c2a1 100644 (file)
@@ -1847,6 +1847,7 @@ const struct dquot_operations dquot_operations = {
        .alloc_dquot    = dquot_alloc,
        .destroy_dquot  = dquot_destroy,
 };
+EXPORT_SYMBOL(dquot_operations);
 
 /*
  * Generic helper for ->open on filesystems supporting disk quotas.
@@ -2491,7 +2492,7 @@ const struct quotactl_ops vfs_quotactl_ops = {
        .get_dqblk      = vfs_get_dqblk,
        .set_dqblk      = vfs_set_dqblk
 };
-
+EXPORT_SYMBOL(vfs_quotactl_ops);
 
 static int do_proc_dqstats(struct ctl_table *table, int write,
                     void __user *buffer, size_t *lenp, loff_t *ppos)
index 05f62e5d464d99bf88d0777ed6f9396b4ee36b1f..af9fd02185aae83f795c55b2a1d3a74865cba6f5 100644 (file)
@@ -24,7 +24,6 @@
 #include <linux/slab.h>
 #include <linux/acct.h>
 #include <linux/blkdev.h>
-#include <linux/quotaops.h>
 #include <linux/mount.h>
 #include <linux/security.h>
 #include <linux/writeback.h>           /* for the emergency remount stuff */
@@ -94,8 +93,6 @@ static struct super_block *alloc_super(struct file_system_type *type)
                init_rwsem(&s->s_dquot.dqptr_sem);
                init_waitqueue_head(&s->s_wait_unfrozen);
                s->s_maxbytes = MAX_NON_LFS;
-               s->dq_op = sb_dquot_ops;
-               s->s_qcop = sb_quotactl_ops;
                s->s_op = &default_op;
                s->s_time_gran = 1000000000;
        }
index 76a61566f29957d067a18e32838e5f2f268e56e1..ef9221b7456e3c9c0587a8abf116d658694a6baa 100644 (file)
@@ -1948,7 +1948,11 @@ static int udf_fill_super(struct super_block *sb, void *options, int silent)
        /* Fill in the rest of the superblock */
        sb->s_op = &udf_sb_ops;
        sb->s_export_op = &udf_export_ops;
-       sb->dq_op = NULL;
+#ifdef CONFIG_QUOTA
+       sb->s_qcop = &vfs_quotactl_ops;
+       sb->dq_op = NULL; /* &dquot_operations */
+#endif
+
        sb->s_dirt = 0;
        sb->s_magic = UDF_SUPER_MAGIC;
        sb->s_time_gran = 1000;
index d3977c7128e361ca74a2e7d380499e0e5a5ede6c..60c989b7012febad007b07bd9f5bb33150297570 100644 (file)
@@ -1045,7 +1045,11 @@ magic_found:
         */
        sb->s_op = &ufs_super_ops;
        sb->s_export_op = &ufs_export_ops;
-       sb->dq_op = NULL; /***/
+#ifdef CONFIG_QUOTA
+       sb->s_qcop = &vfs_quotactl_ops;
+       sb->dq_op = NULL; /* &dquot_operations */
+#endif
+
        sb->s_magic = fs32_to_cpu(sb, usb3->fs_magic);
 
        uspi->s_sblkno = fs32_to_cpu(sb, usb1->fs_sblkno);
index a6592ddc349f4644561dcd6d373c28317735f7c9..84b8dbf59c03cf2cc36fa6937d9c795a703f9a15 100644 (file)
@@ -153,9 +153,6 @@ static inline unsigned sb_any_quota_active(struct super_block *sb)
 extern const struct dquot_operations dquot_operations;
 extern const struct quotactl_ops vfs_quotactl_ops;
 
-#define sb_dquot_ops (&dquot_operations)
-#define sb_quotactl_ops (&vfs_quotactl_ops)
-
 #else
 
 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)
        return 0;
 }
 
-/*
- * NO-OP when quota not configured.
- */
-#define sb_dquot_ops                           (NULL)
-#define sb_quotactl_ops                                (NULL)
-
 static inline void dquot_initialize(struct inode *inode)
 {
 }