From mboxrd@z Thu Jan 1 00:00:00 1970 From: Christoph Hellwig Subject: [PATCH 5/6] quota: explicitly set ->dq_op and ->s_qcop Date: Wed, 12 May 2010 15:44:13 -0400 Message-ID: <20100512194454.207523223@bombadil.infradead.org> References: <20100512194408.620390318@bombadil.infradead.org> Cc: linux-fsdevel@vger.kernel.org To: jack@suse.cz Return-path: Received: from bombadil.infradead.org ([18.85.46.34]:49382 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757390Ab0ELToy (ORCPT ); Wed, 12 May 2010 15:44:54 -0400 Content-Disposition: inline; filename=quota-explicitly-set-ops Sender: linux-fsdevel-owner@vger.kernel.org List-ID: 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 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 #include #include -#include #include #include #include @@ -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 #include #include +#include #include #include @@ -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);