[PATCH 5/6] quota: explicitly set ->dq_op and ->s_qcop

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Only set the quota operation vectors if the filesystem actually supports
quota instead of doing it for all filesystems in alloc_super().

Signed-off-by: Christoph Hellwig <hch@xxxxxx>

Index: linux-2.6/fs/super.c
===================================================================
--- linux-2.6.orig/fs/super.c	2010-05-19 13:02:48.178254030 +0200
+++ linux-2.6/fs/super.c	2010-05-19 13:03:04.542254380 +0200
@@ -26,7 +26,6 @@
 #include <linux/smp_lock.h>
 #include <linux/acct.h>
 #include <linux/blkdev.h>
-#include <linux/quotaops.h>
 #include <linux/namei.h>
 #include <linux/mount.h>
 #include <linux/security.h>
@@ -100,8 +99,6 @@ static struct super_block *alloc_super(s
 		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: linux-2.6/include/linux/quotaops.h
===================================================================
--- linux-2.6.orig/include/linux/quotaops.h	2010-05-19 13:02:48.221253960 +0200
+++ linux-2.6/include/linux/quotaops.h	2010-05-19 13:03:20.346254030 +0200
@@ -149,9 +149,6 @@ static inline unsigned sb_any_quota_acti
 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)
@@ -195,12 +192,6 @@ static inline int sb_any_quota_active(st
 	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)
 {
 }
Index: linux-2.6/fs/jfs/super.c
===================================================================
--- linux-2.6.orig/fs/jfs/super.c	2010-05-19 13:02:48.185254379 +0200
+++ linux-2.6/fs/jfs/super.c	2010-05-19 13:03:20.291254100 +0200
@@ -483,6 +483,10 @@ static int jfs_fill_super(struct super_b
 	 */
 	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: linux-2.6/fs/udf/super.c
===================================================================
--- linux-2.6.orig/fs/udf/super.c	2010-05-19 13:02:48.203254100 +0200
+++ linux-2.6/fs/udf/super.c	2010-05-19 13:03:20.329254030 +0200
@@ -1948,7 +1948,11 @@ static int udf_fill_super(struct super_b
 	/* 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: linux-2.6/fs/ufs/super.c
===================================================================
--- linux-2.6.orig/fs/ufs/super.c	2010-05-19 13:02:48.211254030 +0200
+++ linux-2.6/fs/ufs/super.c	2010-05-19 13:03:20.321254030 +0200
@@ -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: linux-2.6/fs/ext2/super.c
===================================================================
--- linux-2.6.orig/fs/ext2/super.c	2010-05-19 13:03:40.554254239 +0200
+++ linux-2.6/fs/ext2/super.c	2010-05-19 13:04:04.879254100 +0200
@@ -1065,6 +1065,12 @@ static int ext2_fill_super(struct super_
 	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);

--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux