[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-10 23:24:19.215025989 +0200
+++ linux-2.6/fs/super.c	2010-05-10 23:24:54.148210860 +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>
@@ -101,8 +100,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-10 23:24:30.453195565 +0200
+++ linux-2.6/include/linux/quotaops.h	2010-05-10 23:37:46.910024731 +0200
@@ -140,9 +140,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)
@@ -186,12 +183,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-10 23:24:19.201253535 +0200
+++ linux-2.6/fs/jfs/super.c	2010-05-10 23:37:46.837004197 +0200
@@ -479,6 +479,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-10 23:22:58.822262265 +0200
+++ linux-2.6/fs/udf/super.c	2010-05-10 23:40:26.739255629 +0200
@@ -56,6 +56,7 @@
 #include <linux/mount.h>
 #include <linux/seq_file.h>
 #include <linux/bitmap.h>
+#include <linux/quotaops.h>
 #include <linux/crc-itu-t.h>
 #include <asm/byteorder.h>
 
@@ -1939,7 +1940,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-10 23:24:19.220276582 +0200
+++ linux-2.6/fs/ufs/super.c	2010-05-10 23:37:46.895004477 +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);

--
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