All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/12 RFC] Moving i_dquot out of struct inode
@ 2014-10-01 19:31 ` Jan Kara
  0 siblings, 0 replies; 80+ messages in thread
From: Jan Kara @ 2014-10-01 19:31 UTC (permalink / raw)
  To: linux-fsdevel
  Cc: Dave Kleikamp, jfs-discussion, tytso, Jeff Mahoney, Mark Fasheh,
	Dave Chinner, reiserfs-devel, xfs, cluster-devel, Joel Becker,
	Jan Kara, linux-ext4, Steven Whitehouse, ocfs2-devel

  Hello,

  this patch set moves i_dquot array from struct inode into filesystem private
part of the inode. Thus filesystems which don't need it save 2 pointers in
their inodes (would be 3 after we add project quota support into generic
quota).

I have patches to move inode->i_data.private_list into filesystem private part
of the inode which is going to save another 2 pointers using the same
mechanism. However I didn't want to mix those in.

The patch series also contains a change to quotactl so that each filesystem
can set quota types it supports. This is in the end unrelated change
(originally it was necessary for i_dquot moving but in the end I changed
things so that it's not anymore). I can move that into a separate series
but I was somewhat reluctant to do that since that would mean another 6
one-line patches to the same files we are changing here...

Comments are welcome.

								Honza

------------------------------------------------------------------------------
Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer
Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports
Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper
Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer
http://pubads.g.doubleclick.net/gampad/clk?id=154622311&iu=/4140/ostg.clktrk

^ permalink raw reply	[flat|nested] 80+ messages in thread

* [PATCH 0/12 RFC] Moving i_dquot out of struct inode
@ 2014-10-01 19:31 ` Jan Kara
  0 siblings, 0 replies; 80+ messages in thread
From: Jan Kara @ 2014-10-01 19:31 UTC (permalink / raw)
  To: linux-fsdevel
  Cc: Dave Kleikamp, jfs-discussion, tytso, Jeff Mahoney, Mark Fasheh,
	reiserfs-devel, xfs, cluster-devel, Joel Becker, Jan Kara,
	linux-ext4, Steven Whitehouse, ocfs2-devel

  Hello,

  this patch set moves i_dquot array from struct inode into filesystem private
part of the inode. Thus filesystems which don't need it save 2 pointers in
their inodes (would be 3 after we add project quota support into generic
quota).

I have patches to move inode->i_data.private_list into filesystem private part
of the inode which is going to save another 2 pointers using the same
mechanism. However I didn't want to mix those in.

The patch series also contains a change to quotactl so that each filesystem
can set quota types it supports. This is in the end unrelated change
(originally it was necessary for i_dquot moving but in the end I changed
things so that it's not anymore). I can move that into a separate series
but I was somewhat reluctant to do that since that would mean another 6
one-line patches to the same files we are changing here...

Comments are welcome.

								Honza

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 80+ messages in thread

* [Ocfs2-devel] [PATCH 0/12 RFC] Moving i_dquot out of struct inode
@ 2014-10-01 19:31 ` Jan Kara
  0 siblings, 0 replies; 80+ messages in thread
From: Jan Kara @ 2014-10-01 19:31 UTC (permalink / raw)
  To: linux-fsdevel
  Cc: Dave Kleikamp, jfs-discussion, tytso, Jeff Mahoney, Mark Fasheh,
	Dave Chinner, reiserfs-devel, xfs, cluster-devel, Joel Becker,
	Jan Kara, linux-ext4, Steven Whitehouse, ocfs2-devel

  Hello,

  this patch set moves i_dquot array from struct inode into filesystem private
part of the inode. Thus filesystems which don't need it save 2 pointers in
their inodes (would be 3 after we add project quota support into generic
quota).

I have patches to move inode->i_data.private_list into filesystem private part
of the inode which is going to save another 2 pointers using the same
mechanism. However I didn't want to mix those in.

The patch series also contains a change to quotactl so that each filesystem
can set quota types it supports. This is in the end unrelated change
(originally it was necessary for i_dquot moving but in the end I changed
things so that it's not anymore). I can move that into a separate series
but I was somewhat reluctant to do that since that would mean another 6
one-line patches to the same files we are changing here...

Comments are welcome.

								Honza

^ permalink raw reply	[flat|nested] 80+ messages in thread

* [Cluster-devel] [PATCH 0/12 RFC] Moving i_dquot out of struct inode
@ 2014-10-01 19:31 ` Jan Kara
  0 siblings, 0 replies; 80+ messages in thread
From: Jan Kara @ 2014-10-01 19:31 UTC (permalink / raw)
  To: cluster-devel.redhat.com

  Hello,

  this patch set moves i_dquot array from struct inode into filesystem private
part of the inode. Thus filesystems which don't need it save 2 pointers in
their inodes (would be 3 after we add project quota support into generic
quota).

I have patches to move inode->i_data.private_list into filesystem private part
of the inode which is going to save another 2 pointers using the same
mechanism. However I didn't want to mix those in.

The patch series also contains a change to quotactl so that each filesystem
can set quota types it supports. This is in the end unrelated change
(originally it was necessary for i_dquot moving but in the end I changed
things so that it's not anymore). I can move that into a separate series
but I was somewhat reluctant to do that since that would mean another 6
one-line patches to the same files we are changing here...

Comments are welcome.

								Honza



^ permalink raw reply	[flat|nested] 80+ messages in thread

* [PATCH 01/12] quota: Allow each filesystem to specify which quota types it supports
  2014-10-01 19:31 ` Jan Kara
  (?)
@ 2014-10-01 19:31   ` Jan Kara
  -1 siblings, 0 replies; 80+ messages in thread
From: Jan Kara @ 2014-10-01 19:31 UTC (permalink / raw)
  To: linux-fsdevel
  Cc: Dave Kleikamp, jfs-discussion, tytso, Jeff Mahoney, Mark Fasheh,
	reiserfs-devel, xfs, cluster-devel, Joel Becker, Jan Kara,
	linux-ext4, Steven Whitehouse, ocfs2-devel

Currently all filesystems supporting VFS quota support user and group
quotas. With introduction of project quotas this is going to change so
make sure filesystem isn't called for quota type it doesn't support by
introduction of a bitmask determining which quota types each filesystem
supports.

Signed-off-by: Jan Kara <jack@suse.cz>
---
 fs/quota/quota.c      | 13 +++++++++++--
 fs/super.c            |  7 +++++++
 include/linux/quota.h |  1 +
 3 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/fs/quota/quota.c b/fs/quota/quota.c
index 75621649dbd7..0f28eac6e638 100644
--- a/fs/quota/quota.c
+++ b/fs/quota/quota.c
@@ -47,8 +47,11 @@ static int check_quotactl_permission(struct super_block *sb, int type, int cmd,
 
 static void quota_sync_one(struct super_block *sb, void *arg)
 {
-	if (sb->s_qcop && sb->s_qcop->quota_sync)
-		sb->s_qcop->quota_sync(sb, *(int *)arg);
+	int type = *(int *)arg;
+
+	if (sb->s_qcop && sb->s_qcop->quota_sync &&
+	    (sb->s_dquot.allowed_types & (1 << type)))
+		sb->s_qcop->quota_sync(sb, type);
 }
 
 static int quota_sync_all(int type)
@@ -297,8 +300,14 @@ static int do_quotactl(struct super_block *sb, int type, int cmd, qid_t id,
 
 	if (type >= (XQM_COMMAND(cmd) ? XQM_MAXQUOTAS : MAXQUOTAS))
 		return -EINVAL;
+	/*
+	 * Quota not supported on this fs? Check this before allowed_types
+	 * since they needn't be set if quota is not supported.
+	 */
 	if (!sb->s_qcop)
 		return -ENOSYS;
+	if (!(sb->s_dquot.allowed_types & (1 << type)))
+		return -EINVAL;
 
 	ret = check_quotactl_permission(sb, type, cmd, id);
 	if (ret < 0)
diff --git a/fs/super.c b/fs/super.c
index b9a214d2fe98..dc577370f5fd 100644
--- a/fs/super.c
+++ b/fs/super.c
@@ -215,6 +215,13 @@ static struct super_block *alloc_super(struct file_system_type *type, int flags)
 	atomic_set(&s->s_active, 1);
 	mutex_init(&s->s_vfs_rename_mutex);
 	lockdep_set_class(&s->s_vfs_rename_mutex, &type->s_vfs_rename_key);
+	/*
+	 * For now MAXQUOTAS check in do_quotactl() will limit quota type
+	 * appropriately. When each fs sets allowed_types, we can remove the
+	 * line below
+	 */
+	s->s_dquot.allowed_types = (1 << USRQUOTA) | (1 << GRPQUOTA) |
+				   (1 << PRJQUOTA);
 	mutex_init(&s->s_dquot.dqio_mutex);
 	mutex_init(&s->s_dquot.dqonoff_mutex);
 	s->s_maxbytes = MAX_NON_LFS;
diff --git a/include/linux/quota.h b/include/linux/quota.h
index 80d345a3524c..91f328971acc 100644
--- a/include/linux/quota.h
+++ b/include/linux/quota.h
@@ -388,6 +388,7 @@ static inline void quota_send_warning(struct kqid qid, dev_t dev,
 
 struct quota_info {
 	unsigned int flags;			/* Flags for diskquotas on this device */
+	unsigned int allowed_types;		/* Bitmask of quota types this fs supports */
 	struct mutex dqio_mutex;		/* lock device while I/O in progress */
 	struct mutex dqonoff_mutex;		/* Serialize quotaon & quotaoff */
 	struct inode *files[MAXQUOTAS];		/* inodes of quotafiles */
-- 
1.8.1.4

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply related	[flat|nested] 80+ messages in thread

* [Ocfs2-devel] [PATCH 01/12] quota: Allow each filesystem to specify which quota types it supports
@ 2014-10-01 19:31   ` Jan Kara
  0 siblings, 0 replies; 80+ messages in thread
From: Jan Kara @ 2014-10-01 19:31 UTC (permalink / raw)
  To: linux-fsdevel
  Cc: Dave Kleikamp, jfs-discussion, tytso, Jeff Mahoney, Mark Fasheh,
	reiserfs-devel, xfs, cluster-devel, Joel Becker, Jan Kara,
	linux-ext4, Steven Whitehouse, ocfs2-devel

Currently all filesystems supporting VFS quota support user and group
quotas. With introduction of project quotas this is going to change so
make sure filesystem isn't called for quota type it doesn't support by
introduction of a bitmask determining which quota types each filesystem
supports.

Signed-off-by: Jan Kara <jack@suse.cz>
---
 fs/quota/quota.c      | 13 +++++++++++--
 fs/super.c            |  7 +++++++
 include/linux/quota.h |  1 +
 3 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/fs/quota/quota.c b/fs/quota/quota.c
index 75621649dbd7..0f28eac6e638 100644
--- a/fs/quota/quota.c
+++ b/fs/quota/quota.c
@@ -47,8 +47,11 @@ static int check_quotactl_permission(struct super_block *sb, int type, int cmd,
 
 static void quota_sync_one(struct super_block *sb, void *arg)
 {
-	if (sb->s_qcop && sb->s_qcop->quota_sync)
-		sb->s_qcop->quota_sync(sb, *(int *)arg);
+	int type = *(int *)arg;
+
+	if (sb->s_qcop && sb->s_qcop->quota_sync &&
+	    (sb->s_dquot.allowed_types & (1 << type)))
+		sb->s_qcop->quota_sync(sb, type);
 }
 
 static int quota_sync_all(int type)
@@ -297,8 +300,14 @@ static int do_quotactl(struct super_block *sb, int type, int cmd, qid_t id,
 
 	if (type >= (XQM_COMMAND(cmd) ? XQM_MAXQUOTAS : MAXQUOTAS))
 		return -EINVAL;
+	/*
+	 * Quota not supported on this fs? Check this before allowed_types
+	 * since they needn't be set if quota is not supported.
+	 */
 	if (!sb->s_qcop)
 		return -ENOSYS;
+	if (!(sb->s_dquot.allowed_types & (1 << type)))
+		return -EINVAL;
 
 	ret = check_quotactl_permission(sb, type, cmd, id);
 	if (ret < 0)
diff --git a/fs/super.c b/fs/super.c
index b9a214d2fe98..dc577370f5fd 100644
--- a/fs/super.c
+++ b/fs/super.c
@@ -215,6 +215,13 @@ static struct super_block *alloc_super(struct file_system_type *type, int flags)
 	atomic_set(&s->s_active, 1);
 	mutex_init(&s->s_vfs_rename_mutex);
 	lockdep_set_class(&s->s_vfs_rename_mutex, &type->s_vfs_rename_key);
+	/*
+	 * For now MAXQUOTAS check in do_quotactl() will limit quota type
+	 * appropriately. When each fs sets allowed_types, we can remove the
+	 * line below
+	 */
+	s->s_dquot.allowed_types = (1 << USRQUOTA) | (1 << GRPQUOTA) |
+				   (1 << PRJQUOTA);
 	mutex_init(&s->s_dquot.dqio_mutex);
 	mutex_init(&s->s_dquot.dqonoff_mutex);
 	s->s_maxbytes = MAX_NON_LFS;
diff --git a/include/linux/quota.h b/include/linux/quota.h
index 80d345a3524c..91f328971acc 100644
--- a/include/linux/quota.h
+++ b/include/linux/quota.h
@@ -388,6 +388,7 @@ static inline void quota_send_warning(struct kqid qid, dev_t dev,
 
 struct quota_info {
 	unsigned int flags;			/* Flags for diskquotas on this device */
+	unsigned int allowed_types;		/* Bitmask of quota types this fs supports */
 	struct mutex dqio_mutex;		/* lock device while I/O in progress */
 	struct mutex dqonoff_mutex;		/* Serialize quotaon & quotaoff */
 	struct inode *files[MAXQUOTAS];		/* inodes of quotafiles */
-- 
1.8.1.4

^ permalink raw reply related	[flat|nested] 80+ messages in thread

* [Cluster-devel] [PATCH 01/12] quota: Allow each filesystem to specify which quota types it supports
@ 2014-10-01 19:31   ` Jan Kara
  0 siblings, 0 replies; 80+ messages in thread
From: Jan Kara @ 2014-10-01 19:31 UTC (permalink / raw)
  To: cluster-devel.redhat.com

Currently all filesystems supporting VFS quota support user and group
quotas. With introduction of project quotas this is going to change so
make sure filesystem isn't called for quota type it doesn't support by
introduction of a bitmask determining which quota types each filesystem
supports.

Signed-off-by: Jan Kara <jack@suse.cz>
---
 fs/quota/quota.c      | 13 +++++++++++--
 fs/super.c            |  7 +++++++
 include/linux/quota.h |  1 +
 3 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/fs/quota/quota.c b/fs/quota/quota.c
index 75621649dbd7..0f28eac6e638 100644
--- a/fs/quota/quota.c
+++ b/fs/quota/quota.c
@@ -47,8 +47,11 @@ static int check_quotactl_permission(struct super_block *sb, int type, int cmd,
 
 static void quota_sync_one(struct super_block *sb, void *arg)
 {
-	if (sb->s_qcop && sb->s_qcop->quota_sync)
-		sb->s_qcop->quota_sync(sb, *(int *)arg);
+	int type = *(int *)arg;
+
+	if (sb->s_qcop && sb->s_qcop->quota_sync &&
+	    (sb->s_dquot.allowed_types & (1 << type)))
+		sb->s_qcop->quota_sync(sb, type);
 }
 
 static int quota_sync_all(int type)
@@ -297,8 +300,14 @@ static int do_quotactl(struct super_block *sb, int type, int cmd, qid_t id,
 
 	if (type >= (XQM_COMMAND(cmd) ? XQM_MAXQUOTAS : MAXQUOTAS))
 		return -EINVAL;
+	/*
+	 * Quota not supported on this fs? Check this before allowed_types
+	 * since they needn't be set if quota is not supported.
+	 */
 	if (!sb->s_qcop)
 		return -ENOSYS;
+	if (!(sb->s_dquot.allowed_types & (1 << type)))
+		return -EINVAL;
 
 	ret = check_quotactl_permission(sb, type, cmd, id);
 	if (ret < 0)
diff --git a/fs/super.c b/fs/super.c
index b9a214d2fe98..dc577370f5fd 100644
--- a/fs/super.c
+++ b/fs/super.c
@@ -215,6 +215,13 @@ static struct super_block *alloc_super(struct file_system_type *type, int flags)
 	atomic_set(&s->s_active, 1);
 	mutex_init(&s->s_vfs_rename_mutex);
 	lockdep_set_class(&s->s_vfs_rename_mutex, &type->s_vfs_rename_key);
+	/*
+	 * For now MAXQUOTAS check in do_quotactl() will limit quota type
+	 * appropriately. When each fs sets allowed_types, we can remove the
+	 * line below
+	 */
+	s->s_dquot.allowed_types = (1 << USRQUOTA) | (1 << GRPQUOTA) |
+				   (1 << PRJQUOTA);
 	mutex_init(&s->s_dquot.dqio_mutex);
 	mutex_init(&s->s_dquot.dqonoff_mutex);
 	s->s_maxbytes = MAX_NON_LFS;
diff --git a/include/linux/quota.h b/include/linux/quota.h
index 80d345a3524c..91f328971acc 100644
--- a/include/linux/quota.h
+++ b/include/linux/quota.h
@@ -388,6 +388,7 @@ static inline void quota_send_warning(struct kqid qid, dev_t dev,
 
 struct quota_info {
 	unsigned int flags;			/* Flags for diskquotas on this device */
+	unsigned int allowed_types;		/* Bitmask of quota types this fs supports */
 	struct mutex dqio_mutex;		/* lock device while I/O in progress */
 	struct mutex dqonoff_mutex;		/* Serialize quotaon & quotaoff */
 	struct inode *files[MAXQUOTAS];		/* inodes of quotafiles */
-- 
1.8.1.4



^ permalink raw reply related	[flat|nested] 80+ messages in thread

* [PATCH 02/12] gfs2: Set allowed quota types
  2014-10-01 19:31 ` Jan Kara
  (?)
  (?)
@ 2014-10-01 19:31   ` Jan Kara
  -1 siblings, 0 replies; 80+ messages in thread
From: Jan Kara @ 2014-10-01 19:31 UTC (permalink / raw)
  To: linux-fsdevel
  Cc: Dave Kleikamp, jfs-discussion, tytso, Jeff Mahoney, Mark Fasheh,
	Dave Chinner, reiserfs-devel, xfs, cluster-devel, Joel Becker,
	Jan Kara, linux-ext4, Steven Whitehouse, ocfs2-devel

We support user and group quotas. Tell vfs about it.

CC: Steven Whitehouse <swhiteho@redhat.com>
CC: cluster-devel@redhat.com
Signed-off-by: Jan Kara <jack@suse.cz>
---
 fs/gfs2/ops_fstype.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/fs/gfs2/ops_fstype.c b/fs/gfs2/ops_fstype.c
index d3eae244076e..3032e6d069b5 100644
--- a/fs/gfs2/ops_fstype.c
+++ b/fs/gfs2/ops_fstype.c
@@ -1083,6 +1083,7 @@ static int fill_super(struct super_block *sb, struct gfs2_args *args, int silent
 	sb->s_xattr = gfs2_xattr_handlers;
 	sb->s_qcop = &gfs2_quotactl_ops;
 	sb_dqopt(sb)->flags |= DQUOT_QUOTA_SYS_FILE;
+	sb_dqopt(sb)->allowed_types = (1 << USRQUOTA) | (1 << GRPQUOTA);
 	sb->s_time_gran = 1;
 	sb->s_maxbytes = MAX_LFS_FILESIZE;
 
-- 
1.8.1.4


------------------------------------------------------------------------------
Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer
Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports
Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper
Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer
http://pubads.g.doubleclick.net/gampad/clk?id=154622311&iu=/4140/ostg.clktrk

^ permalink raw reply related	[flat|nested] 80+ messages in thread

* [PATCH 02/12] gfs2: Set allowed quota types
@ 2014-10-01 19:31   ` Jan Kara
  0 siblings, 0 replies; 80+ messages in thread
From: Jan Kara @ 2014-10-01 19:31 UTC (permalink / raw)
  To: linux-fsdevel
  Cc: Dave Kleikamp, jfs-discussion, tytso, Jeff Mahoney, Mark Fasheh,
	reiserfs-devel, xfs, cluster-devel, Joel Becker, Jan Kara,
	linux-ext4, Steven Whitehouse, ocfs2-devel

We support user and group quotas. Tell vfs about it.

CC: Steven Whitehouse <swhiteho@redhat.com>
CC: cluster-devel@redhat.com
Signed-off-by: Jan Kara <jack@suse.cz>
---
 fs/gfs2/ops_fstype.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/fs/gfs2/ops_fstype.c b/fs/gfs2/ops_fstype.c
index d3eae244076e..3032e6d069b5 100644
--- a/fs/gfs2/ops_fstype.c
+++ b/fs/gfs2/ops_fstype.c
@@ -1083,6 +1083,7 @@ static int fill_super(struct super_block *sb, struct gfs2_args *args, int silent
 	sb->s_xattr = gfs2_xattr_handlers;
 	sb->s_qcop = &gfs2_quotactl_ops;
 	sb_dqopt(sb)->flags |= DQUOT_QUOTA_SYS_FILE;
+	sb_dqopt(sb)->allowed_types = (1 << USRQUOTA) | (1 << GRPQUOTA);
 	sb->s_time_gran = 1;
 	sb->s_maxbytes = MAX_LFS_FILESIZE;
 
-- 
1.8.1.4

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply related	[flat|nested] 80+ messages in thread

* [Ocfs2-devel] [PATCH 02/12] gfs2: Set allowed quota types
@ 2014-10-01 19:31   ` Jan Kara
  0 siblings, 0 replies; 80+ messages in thread
From: Jan Kara @ 2014-10-01 19:31 UTC (permalink / raw)
  To: linux-fsdevel
  Cc: Dave Kleikamp, jfs-discussion, tytso, Jeff Mahoney, Mark Fasheh,
	Dave Chinner, reiserfs-devel, xfs, cluster-devel, Joel Becker,
	Jan Kara, linux-ext4, Steven Whitehouse, ocfs2-devel

We support user and group quotas. Tell vfs about it.

CC: Steven Whitehouse <swhiteho@redhat.com>
CC: cluster-devel at redhat.com
Signed-off-by: Jan Kara <jack@suse.cz>
---
 fs/gfs2/ops_fstype.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/fs/gfs2/ops_fstype.c b/fs/gfs2/ops_fstype.c
index d3eae244076e..3032e6d069b5 100644
--- a/fs/gfs2/ops_fstype.c
+++ b/fs/gfs2/ops_fstype.c
@@ -1083,6 +1083,7 @@ static int fill_super(struct super_block *sb, struct gfs2_args *args, int silent
 	sb->s_xattr = gfs2_xattr_handlers;
 	sb->s_qcop = &gfs2_quotactl_ops;
 	sb_dqopt(sb)->flags |= DQUOT_QUOTA_SYS_FILE;
+	sb_dqopt(sb)->allowed_types = (1 << USRQUOTA) | (1 << GRPQUOTA);
 	sb->s_time_gran = 1;
 	sb->s_maxbytes = MAX_LFS_FILESIZE;
 
-- 
1.8.1.4

^ permalink raw reply related	[flat|nested] 80+ messages in thread

* [Cluster-devel] [PATCH 02/12] gfs2: Set allowed quota types
@ 2014-10-01 19:31   ` Jan Kara
  0 siblings, 0 replies; 80+ messages in thread
From: Jan Kara @ 2014-10-01 19:31 UTC (permalink / raw)
  To: cluster-devel.redhat.com

We support user and group quotas. Tell vfs about it.

CC: Steven Whitehouse <swhiteho@redhat.com>
CC: cluster-devel at redhat.com
Signed-off-by: Jan Kara <jack@suse.cz>
---
 fs/gfs2/ops_fstype.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/fs/gfs2/ops_fstype.c b/fs/gfs2/ops_fstype.c
index d3eae244076e..3032e6d069b5 100644
--- a/fs/gfs2/ops_fstype.c
+++ b/fs/gfs2/ops_fstype.c
@@ -1083,6 +1083,7 @@ static int fill_super(struct super_block *sb, struct gfs2_args *args, int silent
 	sb->s_xattr = gfs2_xattr_handlers;
 	sb->s_qcop = &gfs2_quotactl_ops;
 	sb_dqopt(sb)->flags |= DQUOT_QUOTA_SYS_FILE;
+	sb_dqopt(sb)->allowed_types = (1 << USRQUOTA) | (1 << GRPQUOTA);
 	sb->s_time_gran = 1;
 	sb->s_maxbytes = MAX_LFS_FILESIZE;
 
-- 
1.8.1.4



^ permalink raw reply related	[flat|nested] 80+ messages in thread

* [PATCH 03/12] xfs: Set allowed quota types
  2014-10-01 19:31 ` Jan Kara
  (?)
  (?)
@ 2014-10-01 19:31   ` Jan Kara
  -1 siblings, 0 replies; 80+ messages in thread
From: Jan Kara @ 2014-10-01 19:31 UTC (permalink / raw)
  To: linux-fsdevel
  Cc: Dave Kleikamp, jfs-discussion, tytso, Jeff Mahoney, Mark Fasheh,
	Dave Chinner, reiserfs-devel, xfs, cluster-devel, Joel Becker,
	Jan Kara, linux-ext4, Steven Whitehouse, ocfs2-devel

We support user, group, and project quotas. Tell VFS about it.

CC: xfs@oss.sgi.com
CC: Dave Chinner <david@fromorbit.com>
Signed-off-by: Jan Kara <jack@suse.cz>
---
 fs/xfs/xfs_super.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c
index b194652033cd..b32e998e8cbc 100644
--- a/fs/xfs/xfs_super.c
+++ b/fs/xfs/xfs_super.c
@@ -1419,6 +1419,8 @@ xfs_fs_fill_super(
 	sb->s_export_op = &xfs_export_operations;
 #ifdef CONFIG_XFS_QUOTA
 	sb->s_qcop = &xfs_quotactl_operations;
+	sb->s_dquot.allowed_types = (1 << USRQUOTA) | (1 << GRPQUOTA) |
+				    (1 << PRJQUOTA);
 #endif
 	sb->s_op = &xfs_super_operations;
 
-- 
1.8.1.4


------------------------------------------------------------------------------
Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer
Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports
Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper
Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer
http://pubads.g.doubleclick.net/gampad/clk?id=154622311&iu=/4140/ostg.clktrk

^ permalink raw reply related	[flat|nested] 80+ messages in thread

* [PATCH 03/12] xfs: Set allowed quota types
@ 2014-10-01 19:31   ` Jan Kara
  0 siblings, 0 replies; 80+ messages in thread
From: Jan Kara @ 2014-10-01 19:31 UTC (permalink / raw)
  To: linux-fsdevel
  Cc: Dave Kleikamp, jfs-discussion, tytso, Jeff Mahoney, Mark Fasheh,
	reiserfs-devel, xfs, cluster-devel, Joel Becker, Jan Kara,
	linux-ext4, Steven Whitehouse, ocfs2-devel

We support user, group, and project quotas. Tell VFS about it.

CC: xfs@oss.sgi.com
CC: Dave Chinner <david@fromorbit.com>
Signed-off-by: Jan Kara <jack@suse.cz>
---
 fs/xfs/xfs_super.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c
index b194652033cd..b32e998e8cbc 100644
--- a/fs/xfs/xfs_super.c
+++ b/fs/xfs/xfs_super.c
@@ -1419,6 +1419,8 @@ xfs_fs_fill_super(
 	sb->s_export_op = &xfs_export_operations;
 #ifdef CONFIG_XFS_QUOTA
 	sb->s_qcop = &xfs_quotactl_operations;
+	sb->s_dquot.allowed_types = (1 << USRQUOTA) | (1 << GRPQUOTA) |
+				    (1 << PRJQUOTA);
 #endif
 	sb->s_op = &xfs_super_operations;
 
-- 
1.8.1.4

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply related	[flat|nested] 80+ messages in thread

* [Ocfs2-devel] [PATCH 03/12] xfs: Set allowed quota types
@ 2014-10-01 19:31   ` Jan Kara
  0 siblings, 0 replies; 80+ messages in thread
From: Jan Kara @ 2014-10-01 19:31 UTC (permalink / raw)
  To: linux-fsdevel
  Cc: Dave Kleikamp, jfs-discussion, tytso, Jeff Mahoney, Mark Fasheh,
	Dave Chinner, reiserfs-devel, xfs, cluster-devel, Joel Becker,
	Jan Kara, linux-ext4, Steven Whitehouse, ocfs2-devel

We support user, group, and project quotas. Tell VFS about it.

CC: xfs at oss.sgi.com
CC: Dave Chinner <david@fromorbit.com>
Signed-off-by: Jan Kara <jack@suse.cz>
---
 fs/xfs/xfs_super.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c
index b194652033cd..b32e998e8cbc 100644
--- a/fs/xfs/xfs_super.c
+++ b/fs/xfs/xfs_super.c
@@ -1419,6 +1419,8 @@ xfs_fs_fill_super(
 	sb->s_export_op = &xfs_export_operations;
 #ifdef CONFIG_XFS_QUOTA
 	sb->s_qcop = &xfs_quotactl_operations;
+	sb->s_dquot.allowed_types = (1 << USRQUOTA) | (1 << GRPQUOTA) |
+				    (1 << PRJQUOTA);
 #endif
 	sb->s_op = &xfs_super_operations;
 
-- 
1.8.1.4

^ permalink raw reply related	[flat|nested] 80+ messages in thread

* [Cluster-devel] [PATCH 03/12] xfs: Set allowed quota types
@ 2014-10-01 19:31   ` Jan Kara
  0 siblings, 0 replies; 80+ messages in thread
From: Jan Kara @ 2014-10-01 19:31 UTC (permalink / raw)
  To: cluster-devel.redhat.com

We support user, group, and project quotas. Tell VFS about it.

CC: xfs at oss.sgi.com
CC: Dave Chinner <david@fromorbit.com>
Signed-off-by: Jan Kara <jack@suse.cz>
---
 fs/xfs/xfs_super.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c
index b194652033cd..b32e998e8cbc 100644
--- a/fs/xfs/xfs_super.c
+++ b/fs/xfs/xfs_super.c
@@ -1419,6 +1419,8 @@ xfs_fs_fill_super(
 	sb->s_export_op = &xfs_export_operations;
 #ifdef CONFIG_XFS_QUOTA
 	sb->s_qcop = &xfs_quotactl_operations;
+	sb->s_dquot.allowed_types = (1 << USRQUOTA) | (1 << GRPQUOTA) |
+				    (1 << PRJQUOTA);
 #endif
 	sb->s_op = &xfs_super_operations;
 
-- 
1.8.1.4



^ permalink raw reply related	[flat|nested] 80+ messages in thread

* [PATCH 04/12] fs: Generic infrastructure for optional inode fields
  2014-10-01 19:31 ` Jan Kara
  (?)
@ 2014-10-01 19:31   ` Jan Kara
  -1 siblings, 0 replies; 80+ messages in thread
From: Jan Kara @ 2014-10-01 19:31 UTC (permalink / raw)
  To: linux-fsdevel
  Cc: Dave Kleikamp, jfs-discussion, tytso, Jeff Mahoney, Mark Fasheh,
	reiserfs-devel, xfs, cluster-devel, Joel Becker, Jan Kara,
	linux-ext4, Steven Whitehouse, ocfs2-devel

There are parts of struct inode which are used only by a few filesystems
(e.g. i_dquot pointers, i_mapping->private_list, ...). Thus all the
other filesystems are just wasting memory with these fields. On the
other hand it isn't simple to just move these fields to filesystem
specific part of inode because there is generic code which needs to peek
into the fields and it is cumbersome to provide helpers into which fs
has to stuff the field it is storing elsewhere.

We create a simple infrastructure which allows for optional inode fields
stored in the fs-specific part of the inode. Accessing these fields has
a slightly worse performance as we have to lookup their offset in the
offset table stored in the superblock but in most cases this is
acceptable. Notably, this offset-table mechanism is faster than having
fs-specific hook functions which would need to be called to provide
pointers to desired fields.

Signed-off-by: Jan Kara <jack@suse.cz>
---
 include/linux/fs.h | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/include/linux/fs.h b/include/linux/fs.h
index 94187721ad41..977f8fb6ca88 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -615,6 +615,11 @@ struct inode {
 	void			*i_private; /* fs or device private pointer */
 };
 
+/* Optional inode fields (stored in filesystems inode if the fs needs them) */
+enum {
+	IF_FIELD_NR	/* Number of optional inode fields */
+};
+
 static inline int inode_unhashed(struct inode *inode)
 {
 	return hlist_unhashed(&inode->i_hash);
@@ -1236,6 +1241,11 @@ struct super_block {
 	void 			*s_fs_info;	/* Filesystem private info */
 	unsigned int		s_max_links;
 	fmode_t			s_mode;
+	/*
+	 * We could have here just a pointer to the offsets array but this
+	 * way we save one dereference when looking up field offsets
+	 */
+	int			s_inode_fields[IF_FIELD_NR];
 
 	/* Granularity of c/m/atime in ns.
 	   Cannot be worse than a second */
@@ -1286,6 +1296,20 @@ struct super_block {
 	struct rcu_head		rcu;
 };
 
+static inline void *inode_field(const struct inode *inode, int field)
+{
+	int offset = inode->i_sb->s_inode_fields[field];
+
+	if (!offset)	/* Field not present? */
+		return NULL;
+	return ((char *)inode) + offset;
+}
+
+static inline void sb_init_inode_fields(struct super_block *sb, int *fields)
+{
+	memcpy(sb->s_inode_fields, fields, sizeof(int) * IF_FIELD_NR);
+}
+
 extern struct timespec current_fs_time(struct super_block *sb);
 
 /*
-- 
1.8.1.4

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply related	[flat|nested] 80+ messages in thread

* [Ocfs2-devel] [PATCH 04/12] fs: Generic infrastructure for optional inode fields
@ 2014-10-01 19:31   ` Jan Kara
  0 siblings, 0 replies; 80+ messages in thread
From: Jan Kara @ 2014-10-01 19:31 UTC (permalink / raw)
  To: linux-fsdevel
  Cc: Dave Kleikamp, jfs-discussion, tytso, Jeff Mahoney, Mark Fasheh,
	reiserfs-devel, xfs, cluster-devel, Joel Becker, Jan Kara,
	linux-ext4, Steven Whitehouse, ocfs2-devel

There are parts of struct inode which are used only by a few filesystems
(e.g. i_dquot pointers, i_mapping->private_list, ...). Thus all the
other filesystems are just wasting memory with these fields. On the
other hand it isn't simple to just move these fields to filesystem
specific part of inode because there is generic code which needs to peek
into the fields and it is cumbersome to provide helpers into which fs
has to stuff the field it is storing elsewhere.

We create a simple infrastructure which allows for optional inode fields
stored in the fs-specific part of the inode. Accessing these fields has
a slightly worse performance as we have to lookup their offset in the
offset table stored in the superblock but in most cases this is
acceptable. Notably, this offset-table mechanism is faster than having
fs-specific hook functions which would need to be called to provide
pointers to desired fields.

Signed-off-by: Jan Kara <jack@suse.cz>
---
 include/linux/fs.h | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/include/linux/fs.h b/include/linux/fs.h
index 94187721ad41..977f8fb6ca88 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -615,6 +615,11 @@ struct inode {
 	void			*i_private; /* fs or device private pointer */
 };
 
+/* Optional inode fields (stored in filesystems inode if the fs needs them) */
+enum {
+	IF_FIELD_NR	/* Number of optional inode fields */
+};
+
 static inline int inode_unhashed(struct inode *inode)
 {
 	return hlist_unhashed(&inode->i_hash);
@@ -1236,6 +1241,11 @@ struct super_block {
 	void 			*s_fs_info;	/* Filesystem private info */
 	unsigned int		s_max_links;
 	fmode_t			s_mode;
+	/*
+	 * We could have here just a pointer to the offsets array but this
+	 * way we save one dereference when looking up field offsets
+	 */
+	int			s_inode_fields[IF_FIELD_NR];
 
 	/* Granularity of c/m/atime in ns.
 	   Cannot be worse than a second */
@@ -1286,6 +1296,20 @@ struct super_block {
 	struct rcu_head		rcu;
 };
 
+static inline void *inode_field(const struct inode *inode, int field)
+{
+	int offset = inode->i_sb->s_inode_fields[field];
+
+	if (!offset)	/* Field not present? */
+		return NULL;
+	return ((char *)inode) + offset;
+}
+
+static inline void sb_init_inode_fields(struct super_block *sb, int *fields)
+{
+	memcpy(sb->s_inode_fields, fields, sizeof(int) * IF_FIELD_NR);
+}
+
 extern struct timespec current_fs_time(struct super_block *sb);
 
 /*
-- 
1.8.1.4

^ permalink raw reply related	[flat|nested] 80+ messages in thread

* [Cluster-devel] [PATCH 04/12] fs: Generic infrastructure for optional inode fields
@ 2014-10-01 19:31   ` Jan Kara
  0 siblings, 0 replies; 80+ messages in thread
From: Jan Kara @ 2014-10-01 19:31 UTC (permalink / raw)
  To: cluster-devel.redhat.com

There are parts of struct inode which are used only by a few filesystems
(e.g. i_dquot pointers, i_mapping->private_list, ...). Thus all the
other filesystems are just wasting memory with these fields. On the
other hand it isn't simple to just move these fields to filesystem
specific part of inode because there is generic code which needs to peek
into the fields and it is cumbersome to provide helpers into which fs
has to stuff the field it is storing elsewhere.

We create a simple infrastructure which allows for optional inode fields
stored in the fs-specific part of the inode. Accessing these fields has
a slightly worse performance as we have to lookup their offset in the
offset table stored in the superblock but in most cases this is
acceptable. Notably, this offset-table mechanism is faster than having
fs-specific hook functions which would need to be called to provide
pointers to desired fields.

Signed-off-by: Jan Kara <jack@suse.cz>
---
 include/linux/fs.h | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/include/linux/fs.h b/include/linux/fs.h
index 94187721ad41..977f8fb6ca88 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -615,6 +615,11 @@ struct inode {
 	void			*i_private; /* fs or device private pointer */
 };
 
+/* Optional inode fields (stored in filesystems inode if the fs needs them) */
+enum {
+	IF_FIELD_NR	/* Number of optional inode fields */
+};
+
 static inline int inode_unhashed(struct inode *inode)
 {
 	return hlist_unhashed(&inode->i_hash);
@@ -1236,6 +1241,11 @@ struct super_block {
 	void 			*s_fs_info;	/* Filesystem private info */
 	unsigned int		s_max_links;
 	fmode_t			s_mode;
+	/*
+	 * We could have here just a pointer to the offsets array but this
+	 * way we save one dereference when looking up field offsets
+	 */
+	int			s_inode_fields[IF_FIELD_NR];
 
 	/* Granularity of c/m/atime in ns.
 	   Cannot be worse than a second */
@@ -1286,6 +1296,20 @@ struct super_block {
 	struct rcu_head		rcu;
 };
 
+static inline void *inode_field(const struct inode *inode, int field)
+{
+	int offset = inode->i_sb->s_inode_fields[field];
+
+	if (!offset)	/* Field not present? */
+		return NULL;
+	return ((char *)inode) + offset;
+}
+
+static inline void sb_init_inode_fields(struct super_block *sb, int *fields)
+{
+	memcpy(sb->s_inode_fields, fields, sizeof(int) * IF_FIELD_NR);
+}
+
 extern struct timespec current_fs_time(struct super_block *sb);
 
 /*
-- 
1.8.1.4



^ permalink raw reply related	[flat|nested] 80+ messages in thread

* [PATCH 05/12] quota: Use optional inode field for i_dquot pointers
  2014-10-01 19:31 ` Jan Kara
  (?)
  (?)
@ 2014-10-01 19:31   ` Jan Kara
  -1 siblings, 0 replies; 80+ messages in thread
From: Jan Kara @ 2014-10-01 19:31 UTC (permalink / raw)
  To: linux-fsdevel
  Cc: linux-ext4, Dave Chinner, xfs, cluster-devel, Steven Whitehouse,
	Mark Fasheh, Joel Becker, ocfs2-devel, reiserfs-devel,
	Jeff Mahoney, Dave Kleikamp, jfs-discussion, tytso, Jan Kara

i_dquot is a first candidate for using optional inode fields since it is
used by relatively few filesystems (ext?, ocfs2, jfs, reiserfs). We
cannot just pass quota pointers from filesystems to quota functions
because during quotaon and quotaoff we have to traverse list of all
inodes and manipulate i_dquot pointers for each inode.

Firstly, we setup optional inode field so that it points at i_dquot
array in struct inode and convert quota code to use the accessor
function.

Signed-off-by: Jan Kara <jack@suse.cz>
---
 fs/quota/dquot.c   | 51 ++++++++++++++++++++++++++++-----------------------
 fs/super.c         |  3 +++
 include/linux/fs.h |  1 +
 3 files changed, 32 insertions(+), 23 deletions(-)

diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c
index f2d0eee9d1f1..ecb8732fe299 100644
--- a/fs/quota/dquot.c
+++ b/fs/quota/dquot.c
@@ -893,6 +893,11 @@ out:
 }
 EXPORT_SYMBOL(dqget);
 
+static inline struct dquot **i_dquot(const struct inode *inode)
+{
+	return ((struct dquot **)inode_field(inode, IF_DQUOTS));
+}
+
 static int dqinit_needed(struct inode *inode, int type)
 {
 	int cnt;
@@ -900,9 +905,9 @@ static int dqinit_needed(struct inode *inode, int type)
 	if (IS_NOQUOTA(inode))
 		return 0;
 	if (type != -1)
-		return !inode->i_dquot[type];
+		return !i_dquot(inode)[type];
 	for (cnt = 0; cnt < MAXQUOTAS; cnt++)
-		if (!inode->i_dquot[cnt])
+		if (!i_dquot(inode)[cnt])
 			return 1;
 	return 0;
 }
@@ -965,9 +970,9 @@ static void add_dquot_ref(struct super_block *sb, int type)
 static void remove_inode_dquot_ref(struct inode *inode, int type,
 				   struct list_head *tofree_head)
 {
-	struct dquot *dquot = inode->i_dquot[type];
+	struct dquot *dquot = i_dquot(inode)[type];
 
-	inode->i_dquot[type] = NULL;
+	i_dquot(inode)[type] = NULL;
 	if (!dquot)
 		return;
 
@@ -1402,7 +1407,7 @@ static void __dquot_initialize(struct inode *inode, int type)
 		 * we check it without locking here to avoid unnecessary
 		 * dqget()/dqput() calls.
 		 */
-		if (inode->i_dquot[cnt])
+		if (i_dquot(inode)[cnt])
 			continue;
 		init_needed = 1;
 
@@ -1433,8 +1438,8 @@ static void __dquot_initialize(struct inode *inode, int type)
 		/* We could race with quotaon or dqget() could have failed */
 		if (!got[cnt])
 			continue;
-		if (!inode->i_dquot[cnt]) {
-			inode->i_dquot[cnt] = got[cnt];
+		if (!i_dquot(inode)[cnt]) {
+			i_dquot(inode)[cnt] = got[cnt];
 			got[cnt] = NULL;
 			/*
 			 * Make quota reservation system happy if someone
@@ -1442,7 +1447,7 @@ static void __dquot_initialize(struct inode *inode, int type)
 			 */
 			rsv = inode_get_rsv_space(inode);
 			if (unlikely(rsv))
-				dquot_resv_space(inode->i_dquot[cnt], rsv);
+				dquot_resv_space(i_dquot(inode)[cnt], rsv);
 		}
 	}
 out_err:
@@ -1472,8 +1477,8 @@ static void __dquot_drop(struct inode *inode)
 
 	spin_lock(&dq_data_lock);
 	for (cnt = 0; cnt < MAXQUOTAS; cnt++) {
-		put[cnt] = inode->i_dquot[cnt];
-		inode->i_dquot[cnt] = NULL;
+		put[cnt] = i_dquot(inode)[cnt];
+		i_dquot(inode)[cnt] = NULL;
 	}
 	spin_unlock(&dq_data_lock);
 	dqput_all(put);
@@ -1494,7 +1499,7 @@ void dquot_drop(struct inode *inode)
 	 * add quota pointers back anyway.
 	 */
 	for (cnt = 0; cnt < MAXQUOTAS; cnt++) {
-		if (inode->i_dquot[cnt])
+		if (i_dquot(inode)[cnt])
 			break;
 	}
 
@@ -1595,7 +1600,7 @@ int __dquot_alloc_space(struct inode *inode, qsize_t number, int flags)
 {
 	int cnt, ret = 0, index;
 	struct dquot_warn warn[MAXQUOTAS];
-	struct dquot **dquots = inode->i_dquot;
+	struct dquot **dquots = i_dquot(inode);
 	int reserve = flags & DQUOT_SPACE_RESERVE;
 
 	if (!dquot_active(inode)) {
@@ -1647,7 +1652,7 @@ int dquot_alloc_inode(const struct inode *inode)
 {
 	int cnt, ret = 0, index;
 	struct dquot_warn warn[MAXQUOTAS];
-	struct dquot * const *dquots = inode->i_dquot;
+	struct dquot * const *dquots = i_dquot(inode);
 
 	if (!dquot_active(inode))
 		return 0;
@@ -1696,14 +1701,14 @@ int dquot_claim_space_nodirty(struct inode *inode, qsize_t number)
 	spin_lock(&dq_data_lock);
 	/* Claim reserved quotas to allocated quotas */
 	for (cnt = 0; cnt < MAXQUOTAS; cnt++) {
-		if (inode->i_dquot[cnt])
-			dquot_claim_reserved_space(inode->i_dquot[cnt],
+		if (i_dquot(inode)[cnt])
+			dquot_claim_reserved_space(i_dquot(inode)[cnt],
 							number);
 	}
 	/* Update inode bytes */
 	inode_claim_rsv_space(inode, number);
 	spin_unlock(&dq_data_lock);
-	mark_all_dquot_dirty(inode->i_dquot);
+	mark_all_dquot_dirty(i_dquot(inode));
 	srcu_read_unlock(&dquot_srcu, index);
 	return 0;
 }
@@ -1725,14 +1730,14 @@ void dquot_reclaim_space_nodirty(struct inode *inode, qsize_t number)
 	spin_lock(&dq_data_lock);
 	/* Claim reserved quotas to allocated quotas */
 	for (cnt = 0; cnt < MAXQUOTAS; cnt++) {
-		if (inode->i_dquot[cnt])
-			dquot_reclaim_reserved_space(inode->i_dquot[cnt],
+		if (i_dquot(inode)[cnt])
+			dquot_reclaim_reserved_space(i_dquot(inode)[cnt],
 						     number);
 	}
 	/* Update inode bytes */
 	inode_reclaim_rsv_space(inode, number);
 	spin_unlock(&dq_data_lock);
-	mark_all_dquot_dirty(inode->i_dquot);
+	mark_all_dquot_dirty(i_dquot(inode));
 	srcu_read_unlock(&dquot_srcu, index);
 	return;
 }
@@ -1745,7 +1750,7 @@ void __dquot_free_space(struct inode *inode, qsize_t number, int flags)
 {
 	unsigned int cnt;
 	struct dquot_warn warn[MAXQUOTAS];
-	struct dquot **dquots = inode->i_dquot;
+	struct dquot **dquots = i_dquot(inode);
 	int reserve = flags & DQUOT_SPACE_RESERVE, index;
 
 	if (!dquot_active(inode)) {
@@ -1788,7 +1793,7 @@ void dquot_free_inode(const struct inode *inode)
 {
 	unsigned int cnt;
 	struct dquot_warn warn[MAXQUOTAS];
-	struct dquot * const *dquots = inode->i_dquot;
+	struct dquot * const *dquots = i_dquot(inode);
 	int index;
 
 	if (!dquot_active(inode))
@@ -1865,7 +1870,7 @@ int __dquot_transfer(struct inode *inode, struct dquot **transfer_to)
 		if (!sb_has_quota_active(inode->i_sb, cnt))
 			continue;
 		is_valid[cnt] = 1;
-		transfer_from[cnt] = inode->i_dquot[cnt];
+		transfer_from[cnt] = i_dquot(inode)[cnt];
 		ret = check_idq(transfer_to[cnt], 1, &warn_to[cnt]);
 		if (ret)
 			goto over_quota;
@@ -1901,7 +1906,7 @@ int __dquot_transfer(struct inode *inode, struct dquot **transfer_to)
 		dquot_incr_space(transfer_to[cnt], cur_space);
 		dquot_resv_space(transfer_to[cnt], rsv_space);
 
-		inode->i_dquot[cnt] = transfer_to[cnt];
+		i_dquot(inode)[cnt] = transfer_to[cnt];
 	}
 	spin_unlock(&dq_data_lock);
 
diff --git a/fs/super.c b/fs/super.c
index dc577370f5fd..3e70f2e22ea3 100644
--- a/fs/super.c
+++ b/fs/super.c
@@ -228,6 +228,9 @@ static struct super_block *alloc_super(struct file_system_type *type, int flags)
 	s->s_op = &default_op;
 	s->s_time_gran = 1000000000;
 	s->cleancache_poolid = -1;
+#ifdef CONFIG_QUOTA
+	s->s_inode_fields[IF_DQUOTS] = offsetof(struct inode, i_dquot);
+#endif
 
 	s->s_shrink.seeks = DEFAULT_SEEKS;
 	s->s_shrink.scan_objects = super_cache_scan;
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 977f8fb6ca88..d49434866da5 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -617,6 +617,7 @@ struct inode {
 
 /* Optional inode fields (stored in filesystems inode if the fs needs them) */
 enum {
+	IF_DQUOTS,	/* Quota pointers: struct dquot *foo[MAXQUOTAS] */
 	IF_FIELD_NR	/* Number of optional inode fields */
 };
 
-- 
1.8.1.4


^ permalink raw reply related	[flat|nested] 80+ messages in thread

* [PATCH 05/12] quota: Use optional inode field for i_dquot pointers
@ 2014-10-01 19:31   ` Jan Kara
  0 siblings, 0 replies; 80+ messages in thread
From: Jan Kara @ 2014-10-01 19:31 UTC (permalink / raw)
  To: linux-fsdevel
  Cc: Dave Kleikamp, jfs-discussion, tytso, Jeff Mahoney, Mark Fasheh,
	reiserfs-devel, xfs, cluster-devel, Joel Becker, Jan Kara,
	linux-ext4, Steven Whitehouse, ocfs2-devel

i_dquot is a first candidate for using optional inode fields since it is
used by relatively few filesystems (ext?, ocfs2, jfs, reiserfs). We
cannot just pass quota pointers from filesystems to quota functions
because during quotaon and quotaoff we have to traverse list of all
inodes and manipulate i_dquot pointers for each inode.

Firstly, we setup optional inode field so that it points at i_dquot
array in struct inode and convert quota code to use the accessor
function.

Signed-off-by: Jan Kara <jack@suse.cz>
---
 fs/quota/dquot.c   | 51 ++++++++++++++++++++++++++++-----------------------
 fs/super.c         |  3 +++
 include/linux/fs.h |  1 +
 3 files changed, 32 insertions(+), 23 deletions(-)

diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c
index f2d0eee9d1f1..ecb8732fe299 100644
--- a/fs/quota/dquot.c
+++ b/fs/quota/dquot.c
@@ -893,6 +893,11 @@ out:
 }
 EXPORT_SYMBOL(dqget);
 
+static inline struct dquot **i_dquot(const struct inode *inode)
+{
+	return ((struct dquot **)inode_field(inode, IF_DQUOTS));
+}
+
 static int dqinit_needed(struct inode *inode, int type)
 {
 	int cnt;
@@ -900,9 +905,9 @@ static int dqinit_needed(struct inode *inode, int type)
 	if (IS_NOQUOTA(inode))
 		return 0;
 	if (type != -1)
-		return !inode->i_dquot[type];
+		return !i_dquot(inode)[type];
 	for (cnt = 0; cnt < MAXQUOTAS; cnt++)
-		if (!inode->i_dquot[cnt])
+		if (!i_dquot(inode)[cnt])
 			return 1;
 	return 0;
 }
@@ -965,9 +970,9 @@ static void add_dquot_ref(struct super_block *sb, int type)
 static void remove_inode_dquot_ref(struct inode *inode, int type,
 				   struct list_head *tofree_head)
 {
-	struct dquot *dquot = inode->i_dquot[type];
+	struct dquot *dquot = i_dquot(inode)[type];
 
-	inode->i_dquot[type] = NULL;
+	i_dquot(inode)[type] = NULL;
 	if (!dquot)
 		return;
 
@@ -1402,7 +1407,7 @@ static void __dquot_initialize(struct inode *inode, int type)
 		 * we check it without locking here to avoid unnecessary
 		 * dqget()/dqput() calls.
 		 */
-		if (inode->i_dquot[cnt])
+		if (i_dquot(inode)[cnt])
 			continue;
 		init_needed = 1;
 
@@ -1433,8 +1438,8 @@ static void __dquot_initialize(struct inode *inode, int type)
 		/* We could race with quotaon or dqget() could have failed */
 		if (!got[cnt])
 			continue;
-		if (!inode->i_dquot[cnt]) {
-			inode->i_dquot[cnt] = got[cnt];
+		if (!i_dquot(inode)[cnt]) {
+			i_dquot(inode)[cnt] = got[cnt];
 			got[cnt] = NULL;
 			/*
 			 * Make quota reservation system happy if someone
@@ -1442,7 +1447,7 @@ static void __dquot_initialize(struct inode *inode, int type)
 			 */
 			rsv = inode_get_rsv_space(inode);
 			if (unlikely(rsv))
-				dquot_resv_space(inode->i_dquot[cnt], rsv);
+				dquot_resv_space(i_dquot(inode)[cnt], rsv);
 		}
 	}
 out_err:
@@ -1472,8 +1477,8 @@ static void __dquot_drop(struct inode *inode)
 
 	spin_lock(&dq_data_lock);
 	for (cnt = 0; cnt < MAXQUOTAS; cnt++) {
-		put[cnt] = inode->i_dquot[cnt];
-		inode->i_dquot[cnt] = NULL;
+		put[cnt] = i_dquot(inode)[cnt];
+		i_dquot(inode)[cnt] = NULL;
 	}
 	spin_unlock(&dq_data_lock);
 	dqput_all(put);
@@ -1494,7 +1499,7 @@ void dquot_drop(struct inode *inode)
 	 * add quota pointers back anyway.
 	 */
 	for (cnt = 0; cnt < MAXQUOTAS; cnt++) {
-		if (inode->i_dquot[cnt])
+		if (i_dquot(inode)[cnt])
 			break;
 	}
 
@@ -1595,7 +1600,7 @@ int __dquot_alloc_space(struct inode *inode, qsize_t number, int flags)
 {
 	int cnt, ret = 0, index;
 	struct dquot_warn warn[MAXQUOTAS];
-	struct dquot **dquots = inode->i_dquot;
+	struct dquot **dquots = i_dquot(inode);
 	int reserve = flags & DQUOT_SPACE_RESERVE;
 
 	if (!dquot_active(inode)) {
@@ -1647,7 +1652,7 @@ int dquot_alloc_inode(const struct inode *inode)
 {
 	int cnt, ret = 0, index;
 	struct dquot_warn warn[MAXQUOTAS];
-	struct dquot * const *dquots = inode->i_dquot;
+	struct dquot * const *dquots = i_dquot(inode);
 
 	if (!dquot_active(inode))
 		return 0;
@@ -1696,14 +1701,14 @@ int dquot_claim_space_nodirty(struct inode *inode, qsize_t number)
 	spin_lock(&dq_data_lock);
 	/* Claim reserved quotas to allocated quotas */
 	for (cnt = 0; cnt < MAXQUOTAS; cnt++) {
-		if (inode->i_dquot[cnt])
-			dquot_claim_reserved_space(inode->i_dquot[cnt],
+		if (i_dquot(inode)[cnt])
+			dquot_claim_reserved_space(i_dquot(inode)[cnt],
 							number);
 	}
 	/* Update inode bytes */
 	inode_claim_rsv_space(inode, number);
 	spin_unlock(&dq_data_lock);
-	mark_all_dquot_dirty(inode->i_dquot);
+	mark_all_dquot_dirty(i_dquot(inode));
 	srcu_read_unlock(&dquot_srcu, index);
 	return 0;
 }
@@ -1725,14 +1730,14 @@ void dquot_reclaim_space_nodirty(struct inode *inode, qsize_t number)
 	spin_lock(&dq_data_lock);
 	/* Claim reserved quotas to allocated quotas */
 	for (cnt = 0; cnt < MAXQUOTAS; cnt++) {
-		if (inode->i_dquot[cnt])
-			dquot_reclaim_reserved_space(inode->i_dquot[cnt],
+		if (i_dquot(inode)[cnt])
+			dquot_reclaim_reserved_space(i_dquot(inode)[cnt],
 						     number);
 	}
 	/* Update inode bytes */
 	inode_reclaim_rsv_space(inode, number);
 	spin_unlock(&dq_data_lock);
-	mark_all_dquot_dirty(inode->i_dquot);
+	mark_all_dquot_dirty(i_dquot(inode));
 	srcu_read_unlock(&dquot_srcu, index);
 	return;
 }
@@ -1745,7 +1750,7 @@ void __dquot_free_space(struct inode *inode, qsize_t number, int flags)
 {
 	unsigned int cnt;
 	struct dquot_warn warn[MAXQUOTAS];
-	struct dquot **dquots = inode->i_dquot;
+	struct dquot **dquots = i_dquot(inode);
 	int reserve = flags & DQUOT_SPACE_RESERVE, index;
 
 	if (!dquot_active(inode)) {
@@ -1788,7 +1793,7 @@ void dquot_free_inode(const struct inode *inode)
 {
 	unsigned int cnt;
 	struct dquot_warn warn[MAXQUOTAS];
-	struct dquot * const *dquots = inode->i_dquot;
+	struct dquot * const *dquots = i_dquot(inode);
 	int index;
 
 	if (!dquot_active(inode))
@@ -1865,7 +1870,7 @@ int __dquot_transfer(struct inode *inode, struct dquot **transfer_to)
 		if (!sb_has_quota_active(inode->i_sb, cnt))
 			continue;
 		is_valid[cnt] = 1;
-		transfer_from[cnt] = inode->i_dquot[cnt];
+		transfer_from[cnt] = i_dquot(inode)[cnt];
 		ret = check_idq(transfer_to[cnt], 1, &warn_to[cnt]);
 		if (ret)
 			goto over_quota;
@@ -1901,7 +1906,7 @@ int __dquot_transfer(struct inode *inode, struct dquot **transfer_to)
 		dquot_incr_space(transfer_to[cnt], cur_space);
 		dquot_resv_space(transfer_to[cnt], rsv_space);
 
-		inode->i_dquot[cnt] = transfer_to[cnt];
+		i_dquot(inode)[cnt] = transfer_to[cnt];
 	}
 	spin_unlock(&dq_data_lock);
 
diff --git a/fs/super.c b/fs/super.c
index dc577370f5fd..3e70f2e22ea3 100644
--- a/fs/super.c
+++ b/fs/super.c
@@ -228,6 +228,9 @@ static struct super_block *alloc_super(struct file_system_type *type, int flags)
 	s->s_op = &default_op;
 	s->s_time_gran = 1000000000;
 	s->cleancache_poolid = -1;
+#ifdef CONFIG_QUOTA
+	s->s_inode_fields[IF_DQUOTS] = offsetof(struct inode, i_dquot);
+#endif
 
 	s->s_shrink.seeks = DEFAULT_SEEKS;
 	s->s_shrink.scan_objects = super_cache_scan;
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 977f8fb6ca88..d49434866da5 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -617,6 +617,7 @@ struct inode {
 
 /* Optional inode fields (stored in filesystems inode if the fs needs them) */
 enum {
+	IF_DQUOTS,	/* Quota pointers: struct dquot *foo[MAXQUOTAS] */
 	IF_FIELD_NR	/* Number of optional inode fields */
 };
 
-- 
1.8.1.4

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply related	[flat|nested] 80+ messages in thread

* [Ocfs2-devel] [PATCH 05/12] quota: Use optional inode field for i_dquot pointers
@ 2014-10-01 19:31   ` Jan Kara
  0 siblings, 0 replies; 80+ messages in thread
From: Jan Kara @ 2014-10-01 19:31 UTC (permalink / raw)
  To: linux-fsdevel
  Cc: linux-ext4, Dave Chinner, xfs, cluster-devel, Steven Whitehouse,
	Mark Fasheh, Joel Becker, ocfs2-devel, reiserfs-devel,
	Jeff Mahoney, Dave Kleikamp, jfs-discussion, tytso, Jan Kara

i_dquot is a first candidate for using optional inode fields since it is
used by relatively few filesystems (ext?, ocfs2, jfs, reiserfs). We
cannot just pass quota pointers from filesystems to quota functions
because during quotaon and quotaoff we have to traverse list of all
inodes and manipulate i_dquot pointers for each inode.

Firstly, we setup optional inode field so that it points at i_dquot
array in struct inode and convert quota code to use the accessor
function.

Signed-off-by: Jan Kara <jack@suse.cz>
---
 fs/quota/dquot.c   | 51 ++++++++++++++++++++++++++++-----------------------
 fs/super.c         |  3 +++
 include/linux/fs.h |  1 +
 3 files changed, 32 insertions(+), 23 deletions(-)

diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c
index f2d0eee9d1f1..ecb8732fe299 100644
--- a/fs/quota/dquot.c
+++ b/fs/quota/dquot.c
@@ -893,6 +893,11 @@ out:
 }
 EXPORT_SYMBOL(dqget);
 
+static inline struct dquot **i_dquot(const struct inode *inode)
+{
+	return ((struct dquot **)inode_field(inode, IF_DQUOTS));
+}
+
 static int dqinit_needed(struct inode *inode, int type)
 {
 	int cnt;
@@ -900,9 +905,9 @@ static int dqinit_needed(struct inode *inode, int type)
 	if (IS_NOQUOTA(inode))
 		return 0;
 	if (type != -1)
-		return !inode->i_dquot[type];
+		return !i_dquot(inode)[type];
 	for (cnt = 0; cnt < MAXQUOTAS; cnt++)
-		if (!inode->i_dquot[cnt])
+		if (!i_dquot(inode)[cnt])
 			return 1;
 	return 0;
 }
@@ -965,9 +970,9 @@ static void add_dquot_ref(struct super_block *sb, int type)
 static void remove_inode_dquot_ref(struct inode *inode, int type,
 				   struct list_head *tofree_head)
 {
-	struct dquot *dquot = inode->i_dquot[type];
+	struct dquot *dquot = i_dquot(inode)[type];
 
-	inode->i_dquot[type] = NULL;
+	i_dquot(inode)[type] = NULL;
 	if (!dquot)
 		return;
 
@@ -1402,7 +1407,7 @@ static void __dquot_initialize(struct inode *inode, int type)
 		 * we check it without locking here to avoid unnecessary
 		 * dqget()/dqput() calls.
 		 */
-		if (inode->i_dquot[cnt])
+		if (i_dquot(inode)[cnt])
 			continue;
 		init_needed = 1;
 
@@ -1433,8 +1438,8 @@ static void __dquot_initialize(struct inode *inode, int type)
 		/* We could race with quotaon or dqget() could have failed */
 		if (!got[cnt])
 			continue;
-		if (!inode->i_dquot[cnt]) {
-			inode->i_dquot[cnt] = got[cnt];
+		if (!i_dquot(inode)[cnt]) {
+			i_dquot(inode)[cnt] = got[cnt];
 			got[cnt] = NULL;
 			/*
 			 * Make quota reservation system happy if someone
@@ -1442,7 +1447,7 @@ static void __dquot_initialize(struct inode *inode, int type)
 			 */
 			rsv = inode_get_rsv_space(inode);
 			if (unlikely(rsv))
-				dquot_resv_space(inode->i_dquot[cnt], rsv);
+				dquot_resv_space(i_dquot(inode)[cnt], rsv);
 		}
 	}
 out_err:
@@ -1472,8 +1477,8 @@ static void __dquot_drop(struct inode *inode)
 
 	spin_lock(&dq_data_lock);
 	for (cnt = 0; cnt < MAXQUOTAS; cnt++) {
-		put[cnt] = inode->i_dquot[cnt];
-		inode->i_dquot[cnt] = NULL;
+		put[cnt] = i_dquot(inode)[cnt];
+		i_dquot(inode)[cnt] = NULL;
 	}
 	spin_unlock(&dq_data_lock);
 	dqput_all(put);
@@ -1494,7 +1499,7 @@ void dquot_drop(struct inode *inode)
 	 * add quota pointers back anyway.
 	 */
 	for (cnt = 0; cnt < MAXQUOTAS; cnt++) {
-		if (inode->i_dquot[cnt])
+		if (i_dquot(inode)[cnt])
 			break;
 	}
 
@@ -1595,7 +1600,7 @@ int __dquot_alloc_space(struct inode *inode, qsize_t number, int flags)
 {
 	int cnt, ret = 0, index;
 	struct dquot_warn warn[MAXQUOTAS];
-	struct dquot **dquots = inode->i_dquot;
+	struct dquot **dquots = i_dquot(inode);
 	int reserve = flags & DQUOT_SPACE_RESERVE;
 
 	if (!dquot_active(inode)) {
@@ -1647,7 +1652,7 @@ int dquot_alloc_inode(const struct inode *inode)
 {
 	int cnt, ret = 0, index;
 	struct dquot_warn warn[MAXQUOTAS];
-	struct dquot * const *dquots = inode->i_dquot;
+	struct dquot * const *dquots = i_dquot(inode);
 
 	if (!dquot_active(inode))
 		return 0;
@@ -1696,14 +1701,14 @@ int dquot_claim_space_nodirty(struct inode *inode, qsize_t number)
 	spin_lock(&dq_data_lock);
 	/* Claim reserved quotas to allocated quotas */
 	for (cnt = 0; cnt < MAXQUOTAS; cnt++) {
-		if (inode->i_dquot[cnt])
-			dquot_claim_reserved_space(inode->i_dquot[cnt],
+		if (i_dquot(inode)[cnt])
+			dquot_claim_reserved_space(i_dquot(inode)[cnt],
 							number);
 	}
 	/* Update inode bytes */
 	inode_claim_rsv_space(inode, number);
 	spin_unlock(&dq_data_lock);
-	mark_all_dquot_dirty(inode->i_dquot);
+	mark_all_dquot_dirty(i_dquot(inode));
 	srcu_read_unlock(&dquot_srcu, index);
 	return 0;
 }
@@ -1725,14 +1730,14 @@ void dquot_reclaim_space_nodirty(struct inode *inode, qsize_t number)
 	spin_lock(&dq_data_lock);
 	/* Claim reserved quotas to allocated quotas */
 	for (cnt = 0; cnt < MAXQUOTAS; cnt++) {
-		if (inode->i_dquot[cnt])
-			dquot_reclaim_reserved_space(inode->i_dquot[cnt],
+		if (i_dquot(inode)[cnt])
+			dquot_reclaim_reserved_space(i_dquot(inode)[cnt],
 						     number);
 	}
 	/* Update inode bytes */
 	inode_reclaim_rsv_space(inode, number);
 	spin_unlock(&dq_data_lock);
-	mark_all_dquot_dirty(inode->i_dquot);
+	mark_all_dquot_dirty(i_dquot(inode));
 	srcu_read_unlock(&dquot_srcu, index);
 	return;
 }
@@ -1745,7 +1750,7 @@ void __dquot_free_space(struct inode *inode, qsize_t number, int flags)
 {
 	unsigned int cnt;
 	struct dquot_warn warn[MAXQUOTAS];
-	struct dquot **dquots = inode->i_dquot;
+	struct dquot **dquots = i_dquot(inode);
 	int reserve = flags & DQUOT_SPACE_RESERVE, index;
 
 	if (!dquot_active(inode)) {
@@ -1788,7 +1793,7 @@ void dquot_free_inode(const struct inode *inode)
 {
 	unsigned int cnt;
 	struct dquot_warn warn[MAXQUOTAS];
-	struct dquot * const *dquots = inode->i_dquot;
+	struct dquot * const *dquots = i_dquot(inode);
 	int index;
 
 	if (!dquot_active(inode))
@@ -1865,7 +1870,7 @@ int __dquot_transfer(struct inode *inode, struct dquot **transfer_to)
 		if (!sb_has_quota_active(inode->i_sb, cnt))
 			continue;
 		is_valid[cnt] = 1;
-		transfer_from[cnt] = inode->i_dquot[cnt];
+		transfer_from[cnt] = i_dquot(inode)[cnt];
 		ret = check_idq(transfer_to[cnt], 1, &warn_to[cnt]);
 		if (ret)
 			goto over_quota;
@@ -1901,7 +1906,7 @@ int __dquot_transfer(struct inode *inode, struct dquot **transfer_to)
 		dquot_incr_space(transfer_to[cnt], cur_space);
 		dquot_resv_space(transfer_to[cnt], rsv_space);
 
-		inode->i_dquot[cnt] = transfer_to[cnt];
+		i_dquot(inode)[cnt] = transfer_to[cnt];
 	}
 	spin_unlock(&dq_data_lock);
 
diff --git a/fs/super.c b/fs/super.c
index dc577370f5fd..3e70f2e22ea3 100644
--- a/fs/super.c
+++ b/fs/super.c
@@ -228,6 +228,9 @@ static struct super_block *alloc_super(struct file_system_type *type, int flags)
 	s->s_op = &default_op;
 	s->s_time_gran = 1000000000;
 	s->cleancache_poolid = -1;
+#ifdef CONFIG_QUOTA
+	s->s_inode_fields[IF_DQUOTS] = offsetof(struct inode, i_dquot);
+#endif
 
 	s->s_shrink.seeks = DEFAULT_SEEKS;
 	s->s_shrink.scan_objects = super_cache_scan;
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 977f8fb6ca88..d49434866da5 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -617,6 +617,7 @@ struct inode {
 
 /* Optional inode fields (stored in filesystems inode if the fs needs them) */
 enum {
+	IF_DQUOTS,	/* Quota pointers: struct dquot *foo[MAXQUOTAS] */
 	IF_FIELD_NR	/* Number of optional inode fields */
 };
 
-- 
1.8.1.4

^ permalink raw reply related	[flat|nested] 80+ messages in thread

* [Cluster-devel] [PATCH 05/12] quota: Use optional inode field for i_dquot pointers
@ 2014-10-01 19:31   ` Jan Kara
  0 siblings, 0 replies; 80+ messages in thread
From: Jan Kara @ 2014-10-01 19:31 UTC (permalink / raw)
  To: cluster-devel.redhat.com

i_dquot is a first candidate for using optional inode fields since it is
used by relatively few filesystems (ext?, ocfs2, jfs, reiserfs). We
cannot just pass quota pointers from filesystems to quota functions
because during quotaon and quotaoff we have to traverse list of all
inodes and manipulate i_dquot pointers for each inode.

Firstly, we setup optional inode field so that it points at i_dquot
array in struct inode and convert quota code to use the accessor
function.

Signed-off-by: Jan Kara <jack@suse.cz>
---
 fs/quota/dquot.c   | 51 ++++++++++++++++++++++++++++-----------------------
 fs/super.c         |  3 +++
 include/linux/fs.h |  1 +
 3 files changed, 32 insertions(+), 23 deletions(-)

diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c
index f2d0eee9d1f1..ecb8732fe299 100644
--- a/fs/quota/dquot.c
+++ b/fs/quota/dquot.c
@@ -893,6 +893,11 @@ out:
 }
 EXPORT_SYMBOL(dqget);
 
+static inline struct dquot **i_dquot(const struct inode *inode)
+{
+	return ((struct dquot **)inode_field(inode, IF_DQUOTS));
+}
+
 static int dqinit_needed(struct inode *inode, int type)
 {
 	int cnt;
@@ -900,9 +905,9 @@ static int dqinit_needed(struct inode *inode, int type)
 	if (IS_NOQUOTA(inode))
 		return 0;
 	if (type != -1)
-		return !inode->i_dquot[type];
+		return !i_dquot(inode)[type];
 	for (cnt = 0; cnt < MAXQUOTAS; cnt++)
-		if (!inode->i_dquot[cnt])
+		if (!i_dquot(inode)[cnt])
 			return 1;
 	return 0;
 }
@@ -965,9 +970,9 @@ static void add_dquot_ref(struct super_block *sb, int type)
 static void remove_inode_dquot_ref(struct inode *inode, int type,
 				   struct list_head *tofree_head)
 {
-	struct dquot *dquot = inode->i_dquot[type];
+	struct dquot *dquot = i_dquot(inode)[type];
 
-	inode->i_dquot[type] = NULL;
+	i_dquot(inode)[type] = NULL;
 	if (!dquot)
 		return;
 
@@ -1402,7 +1407,7 @@ static void __dquot_initialize(struct inode *inode, int type)
 		 * we check it without locking here to avoid unnecessary
 		 * dqget()/dqput() calls.
 		 */
-		if (inode->i_dquot[cnt])
+		if (i_dquot(inode)[cnt])
 			continue;
 		init_needed = 1;
 
@@ -1433,8 +1438,8 @@ static void __dquot_initialize(struct inode *inode, int type)
 		/* We could race with quotaon or dqget() could have failed */
 		if (!got[cnt])
 			continue;
-		if (!inode->i_dquot[cnt]) {
-			inode->i_dquot[cnt] = got[cnt];
+		if (!i_dquot(inode)[cnt]) {
+			i_dquot(inode)[cnt] = got[cnt];
 			got[cnt] = NULL;
 			/*
 			 * Make quota reservation system happy if someone
@@ -1442,7 +1447,7 @@ static void __dquot_initialize(struct inode *inode, int type)
 			 */
 			rsv = inode_get_rsv_space(inode);
 			if (unlikely(rsv))
-				dquot_resv_space(inode->i_dquot[cnt], rsv);
+				dquot_resv_space(i_dquot(inode)[cnt], rsv);
 		}
 	}
 out_err:
@@ -1472,8 +1477,8 @@ static void __dquot_drop(struct inode *inode)
 
 	spin_lock(&dq_data_lock);
 	for (cnt = 0; cnt < MAXQUOTAS; cnt++) {
-		put[cnt] = inode->i_dquot[cnt];
-		inode->i_dquot[cnt] = NULL;
+		put[cnt] = i_dquot(inode)[cnt];
+		i_dquot(inode)[cnt] = NULL;
 	}
 	spin_unlock(&dq_data_lock);
 	dqput_all(put);
@@ -1494,7 +1499,7 @@ void dquot_drop(struct inode *inode)
 	 * add quota pointers back anyway.
 	 */
 	for (cnt = 0; cnt < MAXQUOTAS; cnt++) {
-		if (inode->i_dquot[cnt])
+		if (i_dquot(inode)[cnt])
 			break;
 	}
 
@@ -1595,7 +1600,7 @@ int __dquot_alloc_space(struct inode *inode, qsize_t number, int flags)
 {
 	int cnt, ret = 0, index;
 	struct dquot_warn warn[MAXQUOTAS];
-	struct dquot **dquots = inode->i_dquot;
+	struct dquot **dquots = i_dquot(inode);
 	int reserve = flags & DQUOT_SPACE_RESERVE;
 
 	if (!dquot_active(inode)) {
@@ -1647,7 +1652,7 @@ int dquot_alloc_inode(const struct inode *inode)
 {
 	int cnt, ret = 0, index;
 	struct dquot_warn warn[MAXQUOTAS];
-	struct dquot * const *dquots = inode->i_dquot;
+	struct dquot * const *dquots = i_dquot(inode);
 
 	if (!dquot_active(inode))
 		return 0;
@@ -1696,14 +1701,14 @@ int dquot_claim_space_nodirty(struct inode *inode, qsize_t number)
 	spin_lock(&dq_data_lock);
 	/* Claim reserved quotas to allocated quotas */
 	for (cnt = 0; cnt < MAXQUOTAS; cnt++) {
-		if (inode->i_dquot[cnt])
-			dquot_claim_reserved_space(inode->i_dquot[cnt],
+		if (i_dquot(inode)[cnt])
+			dquot_claim_reserved_space(i_dquot(inode)[cnt],
 							number);
 	}
 	/* Update inode bytes */
 	inode_claim_rsv_space(inode, number);
 	spin_unlock(&dq_data_lock);
-	mark_all_dquot_dirty(inode->i_dquot);
+	mark_all_dquot_dirty(i_dquot(inode));
 	srcu_read_unlock(&dquot_srcu, index);
 	return 0;
 }
@@ -1725,14 +1730,14 @@ void dquot_reclaim_space_nodirty(struct inode *inode, qsize_t number)
 	spin_lock(&dq_data_lock);
 	/* Claim reserved quotas to allocated quotas */
 	for (cnt = 0; cnt < MAXQUOTAS; cnt++) {
-		if (inode->i_dquot[cnt])
-			dquot_reclaim_reserved_space(inode->i_dquot[cnt],
+		if (i_dquot(inode)[cnt])
+			dquot_reclaim_reserved_space(i_dquot(inode)[cnt],
 						     number);
 	}
 	/* Update inode bytes */
 	inode_reclaim_rsv_space(inode, number);
 	spin_unlock(&dq_data_lock);
-	mark_all_dquot_dirty(inode->i_dquot);
+	mark_all_dquot_dirty(i_dquot(inode));
 	srcu_read_unlock(&dquot_srcu, index);
 	return;
 }
@@ -1745,7 +1750,7 @@ void __dquot_free_space(struct inode *inode, qsize_t number, int flags)
 {
 	unsigned int cnt;
 	struct dquot_warn warn[MAXQUOTAS];
-	struct dquot **dquots = inode->i_dquot;
+	struct dquot **dquots = i_dquot(inode);
 	int reserve = flags & DQUOT_SPACE_RESERVE, index;
 
 	if (!dquot_active(inode)) {
@@ -1788,7 +1793,7 @@ void dquot_free_inode(const struct inode *inode)
 {
 	unsigned int cnt;
 	struct dquot_warn warn[MAXQUOTAS];
-	struct dquot * const *dquots = inode->i_dquot;
+	struct dquot * const *dquots = i_dquot(inode);
 	int index;
 
 	if (!dquot_active(inode))
@@ -1865,7 +1870,7 @@ int __dquot_transfer(struct inode *inode, struct dquot **transfer_to)
 		if (!sb_has_quota_active(inode->i_sb, cnt))
 			continue;
 		is_valid[cnt] = 1;
-		transfer_from[cnt] = inode->i_dquot[cnt];
+		transfer_from[cnt] = i_dquot(inode)[cnt];
 		ret = check_idq(transfer_to[cnt], 1, &warn_to[cnt]);
 		if (ret)
 			goto over_quota;
@@ -1901,7 +1906,7 @@ int __dquot_transfer(struct inode *inode, struct dquot **transfer_to)
 		dquot_incr_space(transfer_to[cnt], cur_space);
 		dquot_resv_space(transfer_to[cnt], rsv_space);
 
-		inode->i_dquot[cnt] = transfer_to[cnt];
+		i_dquot(inode)[cnt] = transfer_to[cnt];
 	}
 	spin_unlock(&dq_data_lock);
 
diff --git a/fs/super.c b/fs/super.c
index dc577370f5fd..3e70f2e22ea3 100644
--- a/fs/super.c
+++ b/fs/super.c
@@ -228,6 +228,9 @@ static struct super_block *alloc_super(struct file_system_type *type, int flags)
 	s->s_op = &default_op;
 	s->s_time_gran = 1000000000;
 	s->cleancache_poolid = -1;
+#ifdef CONFIG_QUOTA
+	s->s_inode_fields[IF_DQUOTS] = offsetof(struct inode, i_dquot);
+#endif
 
 	s->s_shrink.seeks = DEFAULT_SEEKS;
 	s->s_shrink.scan_objects = super_cache_scan;
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 977f8fb6ca88..d49434866da5 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -617,6 +617,7 @@ struct inode {
 
 /* Optional inode fields (stored in filesystems inode if the fs needs them) */
 enum {
+	IF_DQUOTS,	/* Quota pointers: struct dquot *foo[MAXQUOTAS] */
 	IF_FIELD_NR	/* Number of optional inode fields */
 };
 
-- 
1.8.1.4



^ permalink raw reply related	[flat|nested] 80+ messages in thread

* [PATCH 06/12] ext2: Convert to private i_dquot field
  2014-10-01 19:31 ` Jan Kara
  (?)
  (?)
@ 2014-10-01 19:31   ` Jan Kara
  -1 siblings, 0 replies; 80+ messages in thread
From: Jan Kara @ 2014-10-01 19:31 UTC (permalink / raw)
  To: linux-fsdevel
  Cc: linux-ext4, Dave Chinner, xfs, cluster-devel, Steven Whitehouse,
	Mark Fasheh, Joel Becker, ocfs2-devel, reiserfs-devel,
	Jeff Mahoney, Dave Kleikamp, jfs-discussion, tytso, Jan Kara

CC: linux-ext4@vger.kernel.org
Signed-off-by: Jan Kara <jack@suse.cz>
---
 fs/ext2/ext2.h  |  3 +++
 fs/ext2/super.c | 13 +++++++++++++
 2 files changed, 16 insertions(+)

diff --git a/fs/ext2/ext2.h b/fs/ext2/ext2.h
index d9a17d0b124d..e4279ead4a05 100644
--- a/fs/ext2/ext2.h
+++ b/fs/ext2/ext2.h
@@ -689,6 +689,9 @@ struct ext2_inode_info {
 	struct mutex truncate_mutex;
 	struct inode	vfs_inode;
 	struct list_head i_orphan;	/* unlinked but open inodes */
+#ifdef CONFIG_QUOTA
+	struct dquot *i_dquot[MAXQUOTAS];
+#endif
 };
 
 /*
diff --git a/fs/ext2/super.c b/fs/ext2/super.c
index b88edc05c230..f43b2f28b9bc 100644
--- a/fs/ext2/super.c
+++ b/fs/ext2/super.c
@@ -166,6 +166,10 @@ static struct inode *ext2_alloc_inode(struct super_block *sb)
 		return NULL;
 	ei->i_block_alloc_info = NULL;
 	ei->vfs_inode.i_version = 1;
+#ifdef CONFIG_QUOTA
+	memset(&ei->i_dquot, 0, sizeof(ei->i_dquot));
+#endif
+
 	return &ei->vfs_inode;
 }
 
@@ -323,6 +327,13 @@ static const struct super_operations ext2_sops = {
 #endif
 };
 
+static const int ext2_inode_fields[IF_FIELD_NR] = {
+#ifdef CONFIG_QUOTA
+	[IF_DQUOTS] = offsetof(struct ext2_inode_info, i_dquot) -
+		      offsetof(struct ext2_inode_info, vfs_inode),
+#endif
+};
+
 static struct inode *ext2_nfs_get_inode(struct super_block *sb,
 		u64 ino, u32 generation)
 {
@@ -1090,7 +1101,9 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent)
 #ifdef CONFIG_QUOTA
 	sb->dq_op = &dquot_operations;
 	sb->s_qcop = &dquot_quotactl_ops;
+	sb_dqopt(sb)->allowed_types = (1 << USRQUOTA) | (1 << GRPQUOTA);
 #endif
+	sb_init_inode_fields(sb, ext2_inode_fields);
 
 	root = ext2_iget(sb, EXT2_ROOT_INO);
 	if (IS_ERR(root)) {
-- 
1.8.1.4


^ permalink raw reply related	[flat|nested] 80+ messages in thread

* [PATCH 06/12] ext2: Convert to private i_dquot field
@ 2014-10-01 19:31   ` Jan Kara
  0 siblings, 0 replies; 80+ messages in thread
From: Jan Kara @ 2014-10-01 19:31 UTC (permalink / raw)
  To: linux-fsdevel
  Cc: Dave Kleikamp, jfs-discussion, tytso, Jeff Mahoney, Mark Fasheh,
	reiserfs-devel, xfs, cluster-devel, Joel Becker, Jan Kara,
	linux-ext4, Steven Whitehouse, ocfs2-devel

CC: linux-ext4@vger.kernel.org
Signed-off-by: Jan Kara <jack@suse.cz>
---
 fs/ext2/ext2.h  |  3 +++
 fs/ext2/super.c | 13 +++++++++++++
 2 files changed, 16 insertions(+)

diff --git a/fs/ext2/ext2.h b/fs/ext2/ext2.h
index d9a17d0b124d..e4279ead4a05 100644
--- a/fs/ext2/ext2.h
+++ b/fs/ext2/ext2.h
@@ -689,6 +689,9 @@ struct ext2_inode_info {
 	struct mutex truncate_mutex;
 	struct inode	vfs_inode;
 	struct list_head i_orphan;	/* unlinked but open inodes */
+#ifdef CONFIG_QUOTA
+	struct dquot *i_dquot[MAXQUOTAS];
+#endif
 };
 
 /*
diff --git a/fs/ext2/super.c b/fs/ext2/super.c
index b88edc05c230..f43b2f28b9bc 100644
--- a/fs/ext2/super.c
+++ b/fs/ext2/super.c
@@ -166,6 +166,10 @@ static struct inode *ext2_alloc_inode(struct super_block *sb)
 		return NULL;
 	ei->i_block_alloc_info = NULL;
 	ei->vfs_inode.i_version = 1;
+#ifdef CONFIG_QUOTA
+	memset(&ei->i_dquot, 0, sizeof(ei->i_dquot));
+#endif
+
 	return &ei->vfs_inode;
 }
 
@@ -323,6 +327,13 @@ static const struct super_operations ext2_sops = {
 #endif
 };
 
+static const int ext2_inode_fields[IF_FIELD_NR] = {
+#ifdef CONFIG_QUOTA
+	[IF_DQUOTS] = offsetof(struct ext2_inode_info, i_dquot) -
+		      offsetof(struct ext2_inode_info, vfs_inode),
+#endif
+};
+
 static struct inode *ext2_nfs_get_inode(struct super_block *sb,
 		u64 ino, u32 generation)
 {
@@ -1090,7 +1101,9 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent)
 #ifdef CONFIG_QUOTA
 	sb->dq_op = &dquot_operations;
 	sb->s_qcop = &dquot_quotactl_ops;
+	sb_dqopt(sb)->allowed_types = (1 << USRQUOTA) | (1 << GRPQUOTA);
 #endif
+	sb_init_inode_fields(sb, ext2_inode_fields);
 
 	root = ext2_iget(sb, EXT2_ROOT_INO);
 	if (IS_ERR(root)) {
-- 
1.8.1.4

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply related	[flat|nested] 80+ messages in thread

* [Ocfs2-devel] [PATCH 06/12] ext2: Convert to private i_dquot field
@ 2014-10-01 19:31   ` Jan Kara
  0 siblings, 0 replies; 80+ messages in thread
From: Jan Kara @ 2014-10-01 19:31 UTC (permalink / raw)
  To: linux-fsdevel
  Cc: linux-ext4, Dave Chinner, xfs, cluster-devel, Steven Whitehouse,
	Mark Fasheh, Joel Becker, ocfs2-devel, reiserfs-devel,
	Jeff Mahoney, Dave Kleikamp, jfs-discussion, tytso, Jan Kara

CC: linux-ext4 at vger.kernel.org
Signed-off-by: Jan Kara <jack@suse.cz>
---
 fs/ext2/ext2.h  |  3 +++
 fs/ext2/super.c | 13 +++++++++++++
 2 files changed, 16 insertions(+)

diff --git a/fs/ext2/ext2.h b/fs/ext2/ext2.h
index d9a17d0b124d..e4279ead4a05 100644
--- a/fs/ext2/ext2.h
+++ b/fs/ext2/ext2.h
@@ -689,6 +689,9 @@ struct ext2_inode_info {
 	struct mutex truncate_mutex;
 	struct inode	vfs_inode;
 	struct list_head i_orphan;	/* unlinked but open inodes */
+#ifdef CONFIG_QUOTA
+	struct dquot *i_dquot[MAXQUOTAS];
+#endif
 };
 
 /*
diff --git a/fs/ext2/super.c b/fs/ext2/super.c
index b88edc05c230..f43b2f28b9bc 100644
--- a/fs/ext2/super.c
+++ b/fs/ext2/super.c
@@ -166,6 +166,10 @@ static struct inode *ext2_alloc_inode(struct super_block *sb)
 		return NULL;
 	ei->i_block_alloc_info = NULL;
 	ei->vfs_inode.i_version = 1;
+#ifdef CONFIG_QUOTA
+	memset(&ei->i_dquot, 0, sizeof(ei->i_dquot));
+#endif
+
 	return &ei->vfs_inode;
 }
 
@@ -323,6 +327,13 @@ static const struct super_operations ext2_sops = {
 #endif
 };
 
+static const int ext2_inode_fields[IF_FIELD_NR] = {
+#ifdef CONFIG_QUOTA
+	[IF_DQUOTS] = offsetof(struct ext2_inode_info, i_dquot) -
+		      offsetof(struct ext2_inode_info, vfs_inode),
+#endif
+};
+
 static struct inode *ext2_nfs_get_inode(struct super_block *sb,
 		u64 ino, u32 generation)
 {
@@ -1090,7 +1101,9 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent)
 #ifdef CONFIG_QUOTA
 	sb->dq_op = &dquot_operations;
 	sb->s_qcop = &dquot_quotactl_ops;
+	sb_dqopt(sb)->allowed_types = (1 << USRQUOTA) | (1 << GRPQUOTA);
 #endif
+	sb_init_inode_fields(sb, ext2_inode_fields);
 
 	root = ext2_iget(sb, EXT2_ROOT_INO);
 	if (IS_ERR(root)) {
-- 
1.8.1.4

^ permalink raw reply related	[flat|nested] 80+ messages in thread

* [Cluster-devel] [PATCH 06/12] ext2: Convert to private i_dquot field
@ 2014-10-01 19:31   ` Jan Kara
  0 siblings, 0 replies; 80+ messages in thread
From: Jan Kara @ 2014-10-01 19:31 UTC (permalink / raw)
  To: cluster-devel.redhat.com

CC: linux-ext4 at vger.kernel.org
Signed-off-by: Jan Kara <jack@suse.cz>
---
 fs/ext2/ext2.h  |  3 +++
 fs/ext2/super.c | 13 +++++++++++++
 2 files changed, 16 insertions(+)

diff --git a/fs/ext2/ext2.h b/fs/ext2/ext2.h
index d9a17d0b124d..e4279ead4a05 100644
--- a/fs/ext2/ext2.h
+++ b/fs/ext2/ext2.h
@@ -689,6 +689,9 @@ struct ext2_inode_info {
 	struct mutex truncate_mutex;
 	struct inode	vfs_inode;
 	struct list_head i_orphan;	/* unlinked but open inodes */
+#ifdef CONFIG_QUOTA
+	struct dquot *i_dquot[MAXQUOTAS];
+#endif
 };
 
 /*
diff --git a/fs/ext2/super.c b/fs/ext2/super.c
index b88edc05c230..f43b2f28b9bc 100644
--- a/fs/ext2/super.c
+++ b/fs/ext2/super.c
@@ -166,6 +166,10 @@ static struct inode *ext2_alloc_inode(struct super_block *sb)
 		return NULL;
 	ei->i_block_alloc_info = NULL;
 	ei->vfs_inode.i_version = 1;
+#ifdef CONFIG_QUOTA
+	memset(&ei->i_dquot, 0, sizeof(ei->i_dquot));
+#endif
+
 	return &ei->vfs_inode;
 }
 
@@ -323,6 +327,13 @@ static const struct super_operations ext2_sops = {
 #endif
 };
 
+static const int ext2_inode_fields[IF_FIELD_NR] = {
+#ifdef CONFIG_QUOTA
+	[IF_DQUOTS] = offsetof(struct ext2_inode_info, i_dquot) -
+		      offsetof(struct ext2_inode_info, vfs_inode),
+#endif
+};
+
 static struct inode *ext2_nfs_get_inode(struct super_block *sb,
 		u64 ino, u32 generation)
 {
@@ -1090,7 +1101,9 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent)
 #ifdef CONFIG_QUOTA
 	sb->dq_op = &dquot_operations;
 	sb->s_qcop = &dquot_quotactl_ops;
+	sb_dqopt(sb)->allowed_types = (1 << USRQUOTA) | (1 << GRPQUOTA);
 #endif
+	sb_init_inode_fields(sb, ext2_inode_fields);
 
 	root = ext2_iget(sb, EXT2_ROOT_INO);
 	if (IS_ERR(root)) {
-- 
1.8.1.4



^ permalink raw reply related	[flat|nested] 80+ messages in thread

* [PATCH 07/12] ext3: Convert to private i_dquot field
  2014-10-01 19:31 ` Jan Kara
  (?)
  (?)
@ 2014-10-01 19:31   ` Jan Kara
  -1 siblings, 0 replies; 80+ messages in thread
From: Jan Kara @ 2014-10-01 19:31 UTC (permalink / raw)
  To: linux-fsdevel
  Cc: Dave Kleikamp, jfs-discussion, tytso, Jeff Mahoney, Mark Fasheh,
	Dave Chinner, reiserfs-devel, xfs, cluster-devel, Joel Becker,
	Jan Kara, linux-ext4, Steven Whitehouse, ocfs2-devel

CC: linux-ext4@vger.kernel.org
Signed-off-by: Jan Kara <jack@suse.cz>
---
 fs/ext3/ext3.h  |  4 ++++
 fs/ext3/super.c | 13 +++++++++++++
 2 files changed, 17 insertions(+)

diff --git a/fs/ext3/ext3.h b/fs/ext3/ext3.h
index e85ff15a060e..04f30a1f96cb 100644
--- a/fs/ext3/ext3.h
+++ b/fs/ext3/ext3.h
@@ -613,6 +613,10 @@ struct ext3_inode_info {
 	atomic_t i_sync_tid;
 	atomic_t i_datasync_tid;
 
+#ifdef CONFIG_QUOTA
+	struct dquot *i_dquot[MAXQUOTAS];
+#endif
+
 	struct inode vfs_inode;
 };
 
diff --git a/fs/ext3/super.c b/fs/ext3/super.c
index 622e88249024..93373aaa9b77 100644
--- a/fs/ext3/super.c
+++ b/fs/ext3/super.c
@@ -485,6 +485,10 @@ static struct inode *ext3_alloc_inode(struct super_block *sb)
 	ei->vfs_inode.i_version = 1;
 	atomic_set(&ei->i_datasync_tid, 0);
 	atomic_set(&ei->i_sync_tid, 0);
+#ifdef CONFIG_QUOTA
+	memset(&ei->i_dquot, 0, sizeof(ei->i_dquot));
+#endif
+
 	return &ei->vfs_inode;
 }
 
@@ -807,6 +811,13 @@ static const struct super_operations ext3_sops = {
 	.bdev_try_to_free_page = bdev_try_to_free_page,
 };
 
+static const int ext3_inode_fields[IF_FIELD_NR] = {
+#ifdef CONFIG_QUOTA
+	[IF_DQUOTS] = (int)offsetof(struct ext3_inode_info, i_dquot) -
+		      (int)offsetof(struct ext3_inode_info, vfs_inode),
+#endif
+};
+
 static const struct export_operations ext3_export_ops = {
 	.fh_to_dentry = ext3_fh_to_dentry,
 	.fh_to_parent = ext3_fh_to_parent,
@@ -2008,7 +2019,9 @@ static int ext3_fill_super (struct super_block *sb, void *data, int silent)
 #ifdef CONFIG_QUOTA
 	sb->s_qcop = &ext3_qctl_operations;
 	sb->dq_op = &ext3_quota_operations;
+	sb_dqopt(sb)->allowed_types = (1 << USRQUOTA) | (1 << GRPQUOTA);
 #endif
+	sb_init_inode_fields(sb, ext3_inode_fields);
 	memcpy(sb->s_uuid, es->s_uuid, sizeof(es->s_uuid));
 	INIT_LIST_HEAD(&sbi->s_orphan); /* unlinked but open files */
 	mutex_init(&sbi->s_orphan_lock);
-- 
1.8.1.4


------------------------------------------------------------------------------
Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer
Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports
Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper
Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer
http://pubads.g.doubleclick.net/gampad/clk?id=154622311&iu=/4140/ostg.clktrk

^ permalink raw reply related	[flat|nested] 80+ messages in thread

* [PATCH 07/12] ext3: Convert to private i_dquot field
@ 2014-10-01 19:31   ` Jan Kara
  0 siblings, 0 replies; 80+ messages in thread
From: Jan Kara @ 2014-10-01 19:31 UTC (permalink / raw)
  To: linux-fsdevel
  Cc: Dave Kleikamp, jfs-discussion, tytso, Jeff Mahoney, Mark Fasheh,
	reiserfs-devel, xfs, cluster-devel, Joel Becker, Jan Kara,
	linux-ext4, Steven Whitehouse, ocfs2-devel

CC: linux-ext4@vger.kernel.org
Signed-off-by: Jan Kara <jack@suse.cz>
---
 fs/ext3/ext3.h  |  4 ++++
 fs/ext3/super.c | 13 +++++++++++++
 2 files changed, 17 insertions(+)

diff --git a/fs/ext3/ext3.h b/fs/ext3/ext3.h
index e85ff15a060e..04f30a1f96cb 100644
--- a/fs/ext3/ext3.h
+++ b/fs/ext3/ext3.h
@@ -613,6 +613,10 @@ struct ext3_inode_info {
 	atomic_t i_sync_tid;
 	atomic_t i_datasync_tid;
 
+#ifdef CONFIG_QUOTA
+	struct dquot *i_dquot[MAXQUOTAS];
+#endif
+
 	struct inode vfs_inode;
 };
 
diff --git a/fs/ext3/super.c b/fs/ext3/super.c
index 622e88249024..93373aaa9b77 100644
--- a/fs/ext3/super.c
+++ b/fs/ext3/super.c
@@ -485,6 +485,10 @@ static struct inode *ext3_alloc_inode(struct super_block *sb)
 	ei->vfs_inode.i_version = 1;
 	atomic_set(&ei->i_datasync_tid, 0);
 	atomic_set(&ei->i_sync_tid, 0);
+#ifdef CONFIG_QUOTA
+	memset(&ei->i_dquot, 0, sizeof(ei->i_dquot));
+#endif
+
 	return &ei->vfs_inode;
 }
 
@@ -807,6 +811,13 @@ static const struct super_operations ext3_sops = {
 	.bdev_try_to_free_page = bdev_try_to_free_page,
 };
 
+static const int ext3_inode_fields[IF_FIELD_NR] = {
+#ifdef CONFIG_QUOTA
+	[IF_DQUOTS] = (int)offsetof(struct ext3_inode_info, i_dquot) -
+		      (int)offsetof(struct ext3_inode_info, vfs_inode),
+#endif
+};
+
 static const struct export_operations ext3_export_ops = {
 	.fh_to_dentry = ext3_fh_to_dentry,
 	.fh_to_parent = ext3_fh_to_parent,
@@ -2008,7 +2019,9 @@ static int ext3_fill_super (struct super_block *sb, void *data, int silent)
 #ifdef CONFIG_QUOTA
 	sb->s_qcop = &ext3_qctl_operations;
 	sb->dq_op = &ext3_quota_operations;
+	sb_dqopt(sb)->allowed_types = (1 << USRQUOTA) | (1 << GRPQUOTA);
 #endif
+	sb_init_inode_fields(sb, ext3_inode_fields);
 	memcpy(sb->s_uuid, es->s_uuid, sizeof(es->s_uuid));
 	INIT_LIST_HEAD(&sbi->s_orphan); /* unlinked but open files */
 	mutex_init(&sbi->s_orphan_lock);
-- 
1.8.1.4

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply related	[flat|nested] 80+ messages in thread

* [Ocfs2-devel] [PATCH 07/12] ext3: Convert to private i_dquot field
@ 2014-10-01 19:31   ` Jan Kara
  0 siblings, 0 replies; 80+ messages in thread
From: Jan Kara @ 2014-10-01 19:31 UTC (permalink / raw)
  To: linux-fsdevel
  Cc: Dave Kleikamp, jfs-discussion, tytso, Jeff Mahoney, Mark Fasheh,
	Dave Chinner, reiserfs-devel, xfs, cluster-devel, Joel Becker,
	Jan Kara, linux-ext4, Steven Whitehouse, ocfs2-devel

CC: linux-ext4 at vger.kernel.org
Signed-off-by: Jan Kara <jack@suse.cz>
---
 fs/ext3/ext3.h  |  4 ++++
 fs/ext3/super.c | 13 +++++++++++++
 2 files changed, 17 insertions(+)

diff --git a/fs/ext3/ext3.h b/fs/ext3/ext3.h
index e85ff15a060e..04f30a1f96cb 100644
--- a/fs/ext3/ext3.h
+++ b/fs/ext3/ext3.h
@@ -613,6 +613,10 @@ struct ext3_inode_info {
 	atomic_t i_sync_tid;
 	atomic_t i_datasync_tid;
 
+#ifdef CONFIG_QUOTA
+	struct dquot *i_dquot[MAXQUOTAS];
+#endif
+
 	struct inode vfs_inode;
 };
 
diff --git a/fs/ext3/super.c b/fs/ext3/super.c
index 622e88249024..93373aaa9b77 100644
--- a/fs/ext3/super.c
+++ b/fs/ext3/super.c
@@ -485,6 +485,10 @@ static struct inode *ext3_alloc_inode(struct super_block *sb)
 	ei->vfs_inode.i_version = 1;
 	atomic_set(&ei->i_datasync_tid, 0);
 	atomic_set(&ei->i_sync_tid, 0);
+#ifdef CONFIG_QUOTA
+	memset(&ei->i_dquot, 0, sizeof(ei->i_dquot));
+#endif
+
 	return &ei->vfs_inode;
 }
 
@@ -807,6 +811,13 @@ static const struct super_operations ext3_sops = {
 	.bdev_try_to_free_page = bdev_try_to_free_page,
 };
 
+static const int ext3_inode_fields[IF_FIELD_NR] = {
+#ifdef CONFIG_QUOTA
+	[IF_DQUOTS] = (int)offsetof(struct ext3_inode_info, i_dquot) -
+		      (int)offsetof(struct ext3_inode_info, vfs_inode),
+#endif
+};
+
 static const struct export_operations ext3_export_ops = {
 	.fh_to_dentry = ext3_fh_to_dentry,
 	.fh_to_parent = ext3_fh_to_parent,
@@ -2008,7 +2019,9 @@ static int ext3_fill_super (struct super_block *sb, void *data, int silent)
 #ifdef CONFIG_QUOTA
 	sb->s_qcop = &ext3_qctl_operations;
 	sb->dq_op = &ext3_quota_operations;
+	sb_dqopt(sb)->allowed_types = (1 << USRQUOTA) | (1 << GRPQUOTA);
 #endif
+	sb_init_inode_fields(sb, ext3_inode_fields);
 	memcpy(sb->s_uuid, es->s_uuid, sizeof(es->s_uuid));
 	INIT_LIST_HEAD(&sbi->s_orphan); /* unlinked but open files */
 	mutex_init(&sbi->s_orphan_lock);
-- 
1.8.1.4

^ permalink raw reply related	[flat|nested] 80+ messages in thread

* [Cluster-devel] [PATCH 07/12] ext3: Convert to private i_dquot field
@ 2014-10-01 19:31   ` Jan Kara
  0 siblings, 0 replies; 80+ messages in thread
From: Jan Kara @ 2014-10-01 19:31 UTC (permalink / raw)
  To: cluster-devel.redhat.com

CC: linux-ext4 at vger.kernel.org
Signed-off-by: Jan Kara <jack@suse.cz>
---
 fs/ext3/ext3.h  |  4 ++++
 fs/ext3/super.c | 13 +++++++++++++
 2 files changed, 17 insertions(+)

diff --git a/fs/ext3/ext3.h b/fs/ext3/ext3.h
index e85ff15a060e..04f30a1f96cb 100644
--- a/fs/ext3/ext3.h
+++ b/fs/ext3/ext3.h
@@ -613,6 +613,10 @@ struct ext3_inode_info {
 	atomic_t i_sync_tid;
 	atomic_t i_datasync_tid;
 
+#ifdef CONFIG_QUOTA
+	struct dquot *i_dquot[MAXQUOTAS];
+#endif
+
 	struct inode vfs_inode;
 };
 
diff --git a/fs/ext3/super.c b/fs/ext3/super.c
index 622e88249024..93373aaa9b77 100644
--- a/fs/ext3/super.c
+++ b/fs/ext3/super.c
@@ -485,6 +485,10 @@ static struct inode *ext3_alloc_inode(struct super_block *sb)
 	ei->vfs_inode.i_version = 1;
 	atomic_set(&ei->i_datasync_tid, 0);
 	atomic_set(&ei->i_sync_tid, 0);
+#ifdef CONFIG_QUOTA
+	memset(&ei->i_dquot, 0, sizeof(ei->i_dquot));
+#endif
+
 	return &ei->vfs_inode;
 }
 
@@ -807,6 +811,13 @@ static const struct super_operations ext3_sops = {
 	.bdev_try_to_free_page = bdev_try_to_free_page,
 };
 
+static const int ext3_inode_fields[IF_FIELD_NR] = {
+#ifdef CONFIG_QUOTA
+	[IF_DQUOTS] = (int)offsetof(struct ext3_inode_info, i_dquot) -
+		      (int)offsetof(struct ext3_inode_info, vfs_inode),
+#endif
+};
+
 static const struct export_operations ext3_export_ops = {
 	.fh_to_dentry = ext3_fh_to_dentry,
 	.fh_to_parent = ext3_fh_to_parent,
@@ -2008,7 +2019,9 @@ static int ext3_fill_super (struct super_block *sb, void *data, int silent)
 #ifdef CONFIG_QUOTA
 	sb->s_qcop = &ext3_qctl_operations;
 	sb->dq_op = &ext3_quota_operations;
+	sb_dqopt(sb)->allowed_types = (1 << USRQUOTA) | (1 << GRPQUOTA);
 #endif
+	sb_init_inode_fields(sb, ext3_inode_fields);
 	memcpy(sb->s_uuid, es->s_uuid, sizeof(es->s_uuid));
 	INIT_LIST_HEAD(&sbi->s_orphan); /* unlinked but open files */
 	mutex_init(&sbi->s_orphan_lock);
-- 
1.8.1.4



^ permalink raw reply related	[flat|nested] 80+ messages in thread

* [PATCH 08/12] ext4: Convert to private i_dquot field
  2014-10-01 19:31 ` Jan Kara
  (?)
  (?)
@ 2014-10-01 19:31   ` Jan Kara
  -1 siblings, 0 replies; 80+ messages in thread
From: Jan Kara @ 2014-10-01 19:31 UTC (permalink / raw)
  To: linux-fsdevel
  Cc: linux-ext4, Dave Chinner, xfs, cluster-devel, Steven Whitehouse,
	Mark Fasheh, Joel Becker, ocfs2-devel, reiserfs-devel,
	Jeff Mahoney, Dave Kleikamp, jfs-discussion, tytso, Jan Kara

CC: linux-ext4@vger.kernel.org
CC: "Theodore Ts'o" <tytso@mit.edu>
Signed-off-by: Jan Kara <jack@suse.cz>
---
 fs/ext4/ext4.h  |  4 ++++
 fs/ext4/super.c | 10 ++++++++++
 2 files changed, 14 insertions(+)

diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
index b0c225cdb52c..571a9f409e94 100644
--- a/fs/ext4/ext4.h
+++ b/fs/ext4/ext4.h
@@ -940,6 +940,10 @@ struct ext4_inode_info {
 	tid_t i_sync_tid;
 	tid_t i_datasync_tid;
 
+#ifdef CONFIG_QUOTA
+	struct dquot *i_dquot[MAXQUOTAS];
+#endif
+
 	/* Precomputed uuid+inum+igen checksum for seeding inode checksums */
 	__u32 i_csum_seed;
 };
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 0b28b36e7915..a4cccf9fba60 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -895,6 +895,7 @@ static struct inode *ext4_alloc_inode(struct super_block *sb)
 	spin_lock_init(&(ei->i_block_reservation_lock));
 #ifdef CONFIG_QUOTA
 	ei->i_reserved_quota = 0;
+	memset(&ei->i_dquot, 0, sizeof(ei->i_dquot));
 #endif
 	ei->jinode = NULL;
 	INIT_LIST_HEAD(&ei->i_rsv_conversion_list);
@@ -1143,6 +1144,13 @@ static const struct super_operations ext4_nojournal_sops = {
 	.bdev_try_to_free_page = bdev_try_to_free_page,
 };
 
+static const int ext4_inode_fields[IF_FIELD_NR] = {
+#ifdef CONFIG_QUOTA
+	[IF_DQUOTS] = offsetof(struct ext4_inode_info, i_dquot) -
+		      offsetof(struct ext4_inode_info, vfs_inode),
+#endif
+};
+
 static const struct export_operations ext4_export_ops = {
 	.fh_to_dentry = ext4_fh_to_dentry,
 	.fh_to_parent = ext4_fh_to_parent,
@@ -3916,7 +3924,9 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
 		sb->s_qcop = &ext4_qctl_sysfile_operations;
 	else
 		sb->s_qcop = &ext4_qctl_operations;
+	sb_dqopt(sb)->allowed_types = (1 << USRQUOTA) | (1 << GRPQUOTA);
 #endif
+	sb_init_inode_fields(sb, ext4_inode_fields);
 	memcpy(sb->s_uuid, es->s_uuid, sizeof(es->s_uuid));
 
 	INIT_LIST_HEAD(&sbi->s_orphan); /* unlinked but open files */
-- 
1.8.1.4


^ permalink raw reply related	[flat|nested] 80+ messages in thread

* [PATCH 08/12] ext4: Convert to private i_dquot field
@ 2014-10-01 19:31   ` Jan Kara
  0 siblings, 0 replies; 80+ messages in thread
From: Jan Kara @ 2014-10-01 19:31 UTC (permalink / raw)
  To: linux-fsdevel
  Cc: Dave Kleikamp, jfs-discussion, tytso, Jeff Mahoney, Mark Fasheh,
	reiserfs-devel, xfs, cluster-devel, Joel Becker, Jan Kara,
	linux-ext4, Steven Whitehouse, ocfs2-devel

CC: linux-ext4@vger.kernel.org
CC: "Theodore Ts'o" <tytso@mit.edu>
Signed-off-by: Jan Kara <jack@suse.cz>
---
 fs/ext4/ext4.h  |  4 ++++
 fs/ext4/super.c | 10 ++++++++++
 2 files changed, 14 insertions(+)

diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
index b0c225cdb52c..571a9f409e94 100644
--- a/fs/ext4/ext4.h
+++ b/fs/ext4/ext4.h
@@ -940,6 +940,10 @@ struct ext4_inode_info {
 	tid_t i_sync_tid;
 	tid_t i_datasync_tid;
 
+#ifdef CONFIG_QUOTA
+	struct dquot *i_dquot[MAXQUOTAS];
+#endif
+
 	/* Precomputed uuid+inum+igen checksum for seeding inode checksums */
 	__u32 i_csum_seed;
 };
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 0b28b36e7915..a4cccf9fba60 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -895,6 +895,7 @@ static struct inode *ext4_alloc_inode(struct super_block *sb)
 	spin_lock_init(&(ei->i_block_reservation_lock));
 #ifdef CONFIG_QUOTA
 	ei->i_reserved_quota = 0;
+	memset(&ei->i_dquot, 0, sizeof(ei->i_dquot));
 #endif
 	ei->jinode = NULL;
 	INIT_LIST_HEAD(&ei->i_rsv_conversion_list);
@@ -1143,6 +1144,13 @@ static const struct super_operations ext4_nojournal_sops = {
 	.bdev_try_to_free_page = bdev_try_to_free_page,
 };
 
+static const int ext4_inode_fields[IF_FIELD_NR] = {
+#ifdef CONFIG_QUOTA
+	[IF_DQUOTS] = offsetof(struct ext4_inode_info, i_dquot) -
+		      offsetof(struct ext4_inode_info, vfs_inode),
+#endif
+};
+
 static const struct export_operations ext4_export_ops = {
 	.fh_to_dentry = ext4_fh_to_dentry,
 	.fh_to_parent = ext4_fh_to_parent,
@@ -3916,7 +3924,9 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
 		sb->s_qcop = &ext4_qctl_sysfile_operations;
 	else
 		sb->s_qcop = &ext4_qctl_operations;
+	sb_dqopt(sb)->allowed_types = (1 << USRQUOTA) | (1 << GRPQUOTA);
 #endif
+	sb_init_inode_fields(sb, ext4_inode_fields);
 	memcpy(sb->s_uuid, es->s_uuid, sizeof(es->s_uuid));
 
 	INIT_LIST_HEAD(&sbi->s_orphan); /* unlinked but open files */
-- 
1.8.1.4

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply related	[flat|nested] 80+ messages in thread

* [Ocfs2-devel] [PATCH 08/12] ext4: Convert to private i_dquot field
@ 2014-10-01 19:31   ` Jan Kara
  0 siblings, 0 replies; 80+ messages in thread
From: Jan Kara @ 2014-10-01 19:31 UTC (permalink / raw)
  To: linux-fsdevel
  Cc: linux-ext4, Dave Chinner, xfs, cluster-devel, Steven Whitehouse,
	Mark Fasheh, Joel Becker, ocfs2-devel, reiserfs-devel,
	Jeff Mahoney, Dave Kleikamp, jfs-discussion, tytso, Jan Kara

CC: linux-ext4 at vger.kernel.org
CC: "Theodore Ts'o" <tytso@mit.edu>
Signed-off-by: Jan Kara <jack@suse.cz>
---
 fs/ext4/ext4.h  |  4 ++++
 fs/ext4/super.c | 10 ++++++++++
 2 files changed, 14 insertions(+)

diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
index b0c225cdb52c..571a9f409e94 100644
--- a/fs/ext4/ext4.h
+++ b/fs/ext4/ext4.h
@@ -940,6 +940,10 @@ struct ext4_inode_info {
 	tid_t i_sync_tid;
 	tid_t i_datasync_tid;
 
+#ifdef CONFIG_QUOTA
+	struct dquot *i_dquot[MAXQUOTAS];
+#endif
+
 	/* Precomputed uuid+inum+igen checksum for seeding inode checksums */
 	__u32 i_csum_seed;
 };
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 0b28b36e7915..a4cccf9fba60 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -895,6 +895,7 @@ static struct inode *ext4_alloc_inode(struct super_block *sb)
 	spin_lock_init(&(ei->i_block_reservation_lock));
 #ifdef CONFIG_QUOTA
 	ei->i_reserved_quota = 0;
+	memset(&ei->i_dquot, 0, sizeof(ei->i_dquot));
 #endif
 	ei->jinode = NULL;
 	INIT_LIST_HEAD(&ei->i_rsv_conversion_list);
@@ -1143,6 +1144,13 @@ static const struct super_operations ext4_nojournal_sops = {
 	.bdev_try_to_free_page = bdev_try_to_free_page,
 };
 
+static const int ext4_inode_fields[IF_FIELD_NR] = {
+#ifdef CONFIG_QUOTA
+	[IF_DQUOTS] = offsetof(struct ext4_inode_info, i_dquot) -
+		      offsetof(struct ext4_inode_info, vfs_inode),
+#endif
+};
+
 static const struct export_operations ext4_export_ops = {
 	.fh_to_dentry = ext4_fh_to_dentry,
 	.fh_to_parent = ext4_fh_to_parent,
@@ -3916,7 +3924,9 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
 		sb->s_qcop = &ext4_qctl_sysfile_operations;
 	else
 		sb->s_qcop = &ext4_qctl_operations;
+	sb_dqopt(sb)->allowed_types = (1 << USRQUOTA) | (1 << GRPQUOTA);
 #endif
+	sb_init_inode_fields(sb, ext4_inode_fields);
 	memcpy(sb->s_uuid, es->s_uuid, sizeof(es->s_uuid));
 
 	INIT_LIST_HEAD(&sbi->s_orphan); /* unlinked but open files */
-- 
1.8.1.4

^ permalink raw reply related	[flat|nested] 80+ messages in thread

* [Cluster-devel] [PATCH 08/12] ext4: Convert to private i_dquot field
@ 2014-10-01 19:31   ` Jan Kara
  0 siblings, 0 replies; 80+ messages in thread
From: Jan Kara @ 2014-10-01 19:31 UTC (permalink / raw)
  To: cluster-devel.redhat.com

CC: linux-ext4 at vger.kernel.org
CC: "Theodore Ts'o" <tytso@mit.edu>
Signed-off-by: Jan Kara <jack@suse.cz>
---
 fs/ext4/ext4.h  |  4 ++++
 fs/ext4/super.c | 10 ++++++++++
 2 files changed, 14 insertions(+)

diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
index b0c225cdb52c..571a9f409e94 100644
--- a/fs/ext4/ext4.h
+++ b/fs/ext4/ext4.h
@@ -940,6 +940,10 @@ struct ext4_inode_info {
 	tid_t i_sync_tid;
 	tid_t i_datasync_tid;
 
+#ifdef CONFIG_QUOTA
+	struct dquot *i_dquot[MAXQUOTAS];
+#endif
+
 	/* Precomputed uuid+inum+igen checksum for seeding inode checksums */
 	__u32 i_csum_seed;
 };
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 0b28b36e7915..a4cccf9fba60 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -895,6 +895,7 @@ static struct inode *ext4_alloc_inode(struct super_block *sb)
 	spin_lock_init(&(ei->i_block_reservation_lock));
 #ifdef CONFIG_QUOTA
 	ei->i_reserved_quota = 0;
+	memset(&ei->i_dquot, 0, sizeof(ei->i_dquot));
 #endif
 	ei->jinode = NULL;
 	INIT_LIST_HEAD(&ei->i_rsv_conversion_list);
@@ -1143,6 +1144,13 @@ static const struct super_operations ext4_nojournal_sops = {
 	.bdev_try_to_free_page = bdev_try_to_free_page,
 };
 
+static const int ext4_inode_fields[IF_FIELD_NR] = {
+#ifdef CONFIG_QUOTA
+	[IF_DQUOTS] = offsetof(struct ext4_inode_info, i_dquot) -
+		      offsetof(struct ext4_inode_info, vfs_inode),
+#endif
+};
+
 static const struct export_operations ext4_export_ops = {
 	.fh_to_dentry = ext4_fh_to_dentry,
 	.fh_to_parent = ext4_fh_to_parent,
@@ -3916,7 +3924,9 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
 		sb->s_qcop = &ext4_qctl_sysfile_operations;
 	else
 		sb->s_qcop = &ext4_qctl_operations;
+	sb_dqopt(sb)->allowed_types = (1 << USRQUOTA) | (1 << GRPQUOTA);
 #endif
+	sb_init_inode_fields(sb, ext4_inode_fields);
 	memcpy(sb->s_uuid, es->s_uuid, sizeof(es->s_uuid));
 
 	INIT_LIST_HEAD(&sbi->s_orphan); /* unlinked but open files */
-- 
1.8.1.4



^ permalink raw reply related	[flat|nested] 80+ messages in thread

* [PATCH 09/12] ocfs2: Convert to private i_dquot field
  2014-10-01 19:31 ` Jan Kara
  (?)
  (?)
@ 2014-10-01 19:31   ` Jan Kara
  -1 siblings, 0 replies; 80+ messages in thread
From: Jan Kara @ 2014-10-01 19:31 UTC (permalink / raw)
  To: linux-fsdevel
  Cc: linux-ext4, Dave Chinner, xfs, cluster-devel, Steven Whitehouse,
	Mark Fasheh, Joel Becker, ocfs2-devel, reiserfs-devel,
	Jeff Mahoney, Dave Kleikamp, jfs-discussion, tytso, Jan Kara

CC: Mark Fasheh <mfasheh@suse.com>
CC: Joel Becker <jlbec@evilplan.org>
CC: ocfs2-devel@oss.oracle.com
Signed-off-by: Jan Kara <jack@suse.cz>
---
 fs/ocfs2/inode.h |  4 ++++
 fs/ocfs2/super.c | 12 ++++++++++++
 2 files changed, 16 insertions(+)

diff --git a/fs/ocfs2/inode.h b/fs/ocfs2/inode.h
index a6c991c0fc98..aed65d3aff57 100644
--- a/fs/ocfs2/inode.h
+++ b/fs/ocfs2/inode.h
@@ -80,6 +80,10 @@ struct ocfs2_inode_info
 	 */
 	tid_t i_sync_tid;
 	tid_t i_datasync_tid;
+
+#ifdef CONFIG_QUOTA
+	struct dquot *i_dquot[MAXQUOTAS];
+#endif
 };
 
 /*
diff --git a/fs/ocfs2/super.c b/fs/ocfs2/super.c
index ddb662b32447..190dc8620ae0 100644
--- a/fs/ocfs2/super.c
+++ b/fs/ocfs2/super.c
@@ -157,6 +157,13 @@ static const struct super_operations ocfs2_sops = {
 	.quota_write	= ocfs2_quota_write,
 };
 
+static const int ocfs2_inode_fields[IF_FIELD_NR] = {
+#ifdef CONFIG_QUOTA
+	[IF_DQUOTS] = offsetof(struct ocfs2_inode_info, i_dquot) -
+		      offsetof(struct ocfs2_inode_info, vfs_inode),
+#endif
+};
+
 enum {
 	Opt_barrier,
 	Opt_err_panic,
@@ -563,6 +570,9 @@ static struct inode *ocfs2_alloc_inode(struct super_block *sb)
 
 	oi->i_sync_tid = 0;
 	oi->i_datasync_tid = 0;
+#ifdef CONFIG_QUOTA
+	memset(&oi->i_dquot, 0, sizeof(oi->i_dquot));
+#endif
 
 	jbd2_journal_init_jbd_inode(&oi->ip_jinode, &oi->vfs_inode);
 	return &oi->vfs_inode;
@@ -2069,7 +2079,9 @@ static int ocfs2_initialize_super(struct super_block *sb,
 	sb->s_export_op = &ocfs2_export_ops;
 	sb->s_qcop = &ocfs2_quotactl_ops;
 	sb->dq_op = &ocfs2_quota_operations;
+	sb_dqopt(sb)->allowed_types = (1 << USRQUOTA) | (1 << GRPQUOTA);
 	sb->s_xattr = ocfs2_xattr_handlers;
+	sb_init_inode_fields(sb, ocfs2_inode_fields);
 	sb->s_time_gran = 1;
 	sb->s_flags |= MS_NOATIME;
 	/* this is needed to support O_LARGEFILE */
-- 
1.8.1.4


^ permalink raw reply related	[flat|nested] 80+ messages in thread

* [PATCH 09/12] ocfs2: Convert to private i_dquot field
@ 2014-10-01 19:31   ` Jan Kara
  0 siblings, 0 replies; 80+ messages in thread
From: Jan Kara @ 2014-10-01 19:31 UTC (permalink / raw)
  To: linux-fsdevel
  Cc: Dave Kleikamp, jfs-discussion, tytso, Jeff Mahoney, Mark Fasheh,
	reiserfs-devel, xfs, cluster-devel, Joel Becker, Jan Kara,
	linux-ext4, Steven Whitehouse, ocfs2-devel

CC: Mark Fasheh <mfasheh@suse.com>
CC: Joel Becker <jlbec@evilplan.org>
CC: ocfs2-devel@oss.oracle.com
Signed-off-by: Jan Kara <jack@suse.cz>
---
 fs/ocfs2/inode.h |  4 ++++
 fs/ocfs2/super.c | 12 ++++++++++++
 2 files changed, 16 insertions(+)

diff --git a/fs/ocfs2/inode.h b/fs/ocfs2/inode.h
index a6c991c0fc98..aed65d3aff57 100644
--- a/fs/ocfs2/inode.h
+++ b/fs/ocfs2/inode.h
@@ -80,6 +80,10 @@ struct ocfs2_inode_info
 	 */
 	tid_t i_sync_tid;
 	tid_t i_datasync_tid;
+
+#ifdef CONFIG_QUOTA
+	struct dquot *i_dquot[MAXQUOTAS];
+#endif
 };
 
 /*
diff --git a/fs/ocfs2/super.c b/fs/ocfs2/super.c
index ddb662b32447..190dc8620ae0 100644
--- a/fs/ocfs2/super.c
+++ b/fs/ocfs2/super.c
@@ -157,6 +157,13 @@ static const struct super_operations ocfs2_sops = {
 	.quota_write	= ocfs2_quota_write,
 };
 
+static const int ocfs2_inode_fields[IF_FIELD_NR] = {
+#ifdef CONFIG_QUOTA
+	[IF_DQUOTS] = offsetof(struct ocfs2_inode_info, i_dquot) -
+		      offsetof(struct ocfs2_inode_info, vfs_inode),
+#endif
+};
+
 enum {
 	Opt_barrier,
 	Opt_err_panic,
@@ -563,6 +570,9 @@ static struct inode *ocfs2_alloc_inode(struct super_block *sb)
 
 	oi->i_sync_tid = 0;
 	oi->i_datasync_tid = 0;
+#ifdef CONFIG_QUOTA
+	memset(&oi->i_dquot, 0, sizeof(oi->i_dquot));
+#endif
 
 	jbd2_journal_init_jbd_inode(&oi->ip_jinode, &oi->vfs_inode);
 	return &oi->vfs_inode;
@@ -2069,7 +2079,9 @@ static int ocfs2_initialize_super(struct super_block *sb,
 	sb->s_export_op = &ocfs2_export_ops;
 	sb->s_qcop = &ocfs2_quotactl_ops;
 	sb->dq_op = &ocfs2_quota_operations;
+	sb_dqopt(sb)->allowed_types = (1 << USRQUOTA) | (1 << GRPQUOTA);
 	sb->s_xattr = ocfs2_xattr_handlers;
+	sb_init_inode_fields(sb, ocfs2_inode_fields);
 	sb->s_time_gran = 1;
 	sb->s_flags |= MS_NOATIME;
 	/* this is needed to support O_LARGEFILE */
-- 
1.8.1.4

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply related	[flat|nested] 80+ messages in thread

* [Ocfs2-devel] [PATCH 09/12] ocfs2: Convert to private i_dquot field
@ 2014-10-01 19:31   ` Jan Kara
  0 siblings, 0 replies; 80+ messages in thread
From: Jan Kara @ 2014-10-01 19:31 UTC (permalink / raw)
  To: linux-fsdevel
  Cc: linux-ext4, Dave Chinner, xfs, cluster-devel, Steven Whitehouse,
	Mark Fasheh, Joel Becker, ocfs2-devel, reiserfs-devel,
	Jeff Mahoney, Dave Kleikamp, jfs-discussion, tytso, Jan Kara

CC: Mark Fasheh <mfasheh@suse.com>
CC: Joel Becker <jlbec@evilplan.org>
CC: ocfs2-devel at oss.oracle.com
Signed-off-by: Jan Kara <jack@suse.cz>
---
 fs/ocfs2/inode.h |  4 ++++
 fs/ocfs2/super.c | 12 ++++++++++++
 2 files changed, 16 insertions(+)

diff --git a/fs/ocfs2/inode.h b/fs/ocfs2/inode.h
index a6c991c0fc98..aed65d3aff57 100644
--- a/fs/ocfs2/inode.h
+++ b/fs/ocfs2/inode.h
@@ -80,6 +80,10 @@ struct ocfs2_inode_info
 	 */
 	tid_t i_sync_tid;
 	tid_t i_datasync_tid;
+
+#ifdef CONFIG_QUOTA
+	struct dquot *i_dquot[MAXQUOTAS];
+#endif
 };
 
 /*
diff --git a/fs/ocfs2/super.c b/fs/ocfs2/super.c
index ddb662b32447..190dc8620ae0 100644
--- a/fs/ocfs2/super.c
+++ b/fs/ocfs2/super.c
@@ -157,6 +157,13 @@ static const struct super_operations ocfs2_sops = {
 	.quota_write	= ocfs2_quota_write,
 };
 
+static const int ocfs2_inode_fields[IF_FIELD_NR] = {
+#ifdef CONFIG_QUOTA
+	[IF_DQUOTS] = offsetof(struct ocfs2_inode_info, i_dquot) -
+		      offsetof(struct ocfs2_inode_info, vfs_inode),
+#endif
+};
+
 enum {
 	Opt_barrier,
 	Opt_err_panic,
@@ -563,6 +570,9 @@ static struct inode *ocfs2_alloc_inode(struct super_block *sb)
 
 	oi->i_sync_tid = 0;
 	oi->i_datasync_tid = 0;
+#ifdef CONFIG_QUOTA
+	memset(&oi->i_dquot, 0, sizeof(oi->i_dquot));
+#endif
 
 	jbd2_journal_init_jbd_inode(&oi->ip_jinode, &oi->vfs_inode);
 	return &oi->vfs_inode;
@@ -2069,7 +2079,9 @@ static int ocfs2_initialize_super(struct super_block *sb,
 	sb->s_export_op = &ocfs2_export_ops;
 	sb->s_qcop = &ocfs2_quotactl_ops;
 	sb->dq_op = &ocfs2_quota_operations;
+	sb_dqopt(sb)->allowed_types = (1 << USRQUOTA) | (1 << GRPQUOTA);
 	sb->s_xattr = ocfs2_xattr_handlers;
+	sb_init_inode_fields(sb, ocfs2_inode_fields);
 	sb->s_time_gran = 1;
 	sb->s_flags |= MS_NOATIME;
 	/* this is needed to support O_LARGEFILE */
-- 
1.8.1.4

^ permalink raw reply related	[flat|nested] 80+ messages in thread

* [Cluster-devel] [PATCH 09/12] ocfs2: Convert to private i_dquot field
@ 2014-10-01 19:31   ` Jan Kara
  0 siblings, 0 replies; 80+ messages in thread
From: Jan Kara @ 2014-10-01 19:31 UTC (permalink / raw)
  To: cluster-devel.redhat.com

CC: Mark Fasheh <mfasheh@suse.com>
CC: Joel Becker <jlbec@evilplan.org>
CC: ocfs2-devel at oss.oracle.com
Signed-off-by: Jan Kara <jack@suse.cz>
---
 fs/ocfs2/inode.h |  4 ++++
 fs/ocfs2/super.c | 12 ++++++++++++
 2 files changed, 16 insertions(+)

diff --git a/fs/ocfs2/inode.h b/fs/ocfs2/inode.h
index a6c991c0fc98..aed65d3aff57 100644
--- a/fs/ocfs2/inode.h
+++ b/fs/ocfs2/inode.h
@@ -80,6 +80,10 @@ struct ocfs2_inode_info
 	 */
 	tid_t i_sync_tid;
 	tid_t i_datasync_tid;
+
+#ifdef CONFIG_QUOTA
+	struct dquot *i_dquot[MAXQUOTAS];
+#endif
 };
 
 /*
diff --git a/fs/ocfs2/super.c b/fs/ocfs2/super.c
index ddb662b32447..190dc8620ae0 100644
--- a/fs/ocfs2/super.c
+++ b/fs/ocfs2/super.c
@@ -157,6 +157,13 @@ static const struct super_operations ocfs2_sops = {
 	.quota_write	= ocfs2_quota_write,
 };
 
+static const int ocfs2_inode_fields[IF_FIELD_NR] = {
+#ifdef CONFIG_QUOTA
+	[IF_DQUOTS] = offsetof(struct ocfs2_inode_info, i_dquot) -
+		      offsetof(struct ocfs2_inode_info, vfs_inode),
+#endif
+};
+
 enum {
 	Opt_barrier,
 	Opt_err_panic,
@@ -563,6 +570,9 @@ static struct inode *ocfs2_alloc_inode(struct super_block *sb)
 
 	oi->i_sync_tid = 0;
 	oi->i_datasync_tid = 0;
+#ifdef CONFIG_QUOTA
+	memset(&oi->i_dquot, 0, sizeof(oi->i_dquot));
+#endif
 
 	jbd2_journal_init_jbd_inode(&oi->ip_jinode, &oi->vfs_inode);
 	return &oi->vfs_inode;
@@ -2069,7 +2079,9 @@ static int ocfs2_initialize_super(struct super_block *sb,
 	sb->s_export_op = &ocfs2_export_ops;
 	sb->s_qcop = &ocfs2_quotactl_ops;
 	sb->dq_op = &ocfs2_quota_operations;
+	sb_dqopt(sb)->allowed_types = (1 << USRQUOTA) | (1 << GRPQUOTA);
 	sb->s_xattr = ocfs2_xattr_handlers;
+	sb_init_inode_fields(sb, ocfs2_inode_fields);
 	sb->s_time_gran = 1;
 	sb->s_flags |= MS_NOATIME;
 	/* this is needed to support O_LARGEFILE */
-- 
1.8.1.4



^ permalink raw reply related	[flat|nested] 80+ messages in thread

* [PATCH 10/12] reiserfs: Convert to private i_dquot field
  2014-10-01 19:31 ` Jan Kara
  (?)
@ 2014-10-01 19:31   ` Jan Kara
  -1 siblings, 0 replies; 80+ messages in thread
From: Jan Kara @ 2014-10-01 19:31 UTC (permalink / raw)
  To: linux-fsdevel
  Cc: Dave Kleikamp, jfs-discussion, tytso, Jeff Mahoney, Mark Fasheh,
	reiserfs-devel, xfs, cluster-devel, Joel Becker, Jan Kara,
	linux-ext4, Steven Whitehouse, ocfs2-devel

CC: reiserfs-devel@vger.kernel.org
CC: Jeff Mahoney <jeffm@suse.de>
Signed-off-by: Jan Kara <jack@suse.cz>
---
 fs/reiserfs/reiserfs.h |  4 ++++
 fs/reiserfs/super.c    | 13 +++++++++++++
 2 files changed, 17 insertions(+)

diff --git a/fs/reiserfs/reiserfs.h b/fs/reiserfs/reiserfs.h
index 735c2c2b4536..197e59cbeb1c 100644
--- a/fs/reiserfs/reiserfs.h
+++ b/fs/reiserfs/reiserfs.h
@@ -97,6 +97,10 @@ struct reiserfs_inode_info {
 #ifdef CONFIG_REISERFS_FS_XATTR
 	struct rw_semaphore i_xattr_sem;
 #endif
+#ifdef CONFIG_QUOTA
+	struct dquot *i_dquot[MAXQUOTAS];
+#endif
+
 	struct inode vfs_inode;
 };
 
diff --git a/fs/reiserfs/super.c b/fs/reiserfs/super.c
index d46e88a33b02..c39227ded8f2 100644
--- a/fs/reiserfs/super.c
+++ b/fs/reiserfs/super.c
@@ -594,6 +594,10 @@ static struct inode *reiserfs_alloc_inode(struct super_block *sb)
 		return NULL;
 	atomic_set(&ei->openers, 0);
 	mutex_init(&ei->tailpack);
+#ifdef CONFIG_QUOTA
+	memset(&ei->i_dquot, 0, sizeof(ei->i_dquot));
+#endif
+
 	return &ei->vfs_inode;
 }
 
@@ -771,6 +775,13 @@ static const struct super_operations reiserfs_sops = {
 #endif
 };
 
+static const int reiserfs_inode_fields[IF_FIELD_NR] = {
+#ifdef CONFIG_QUOTA
+	[IF_DQUOTS] = (int)offsetof(struct reiserfs_inode_info, i_dquot) -
+		      (int)offsetof(struct reiserfs_inode_info, vfs_inode),
+#endif
+};
+
 #ifdef CONFIG_QUOTA
 #define QTYPE2NAME(t) ((t)==USRQUOTA?"user":"group")
 
@@ -1633,7 +1644,9 @@ static int read_super_block(struct super_block *s, int offset)
 #ifdef CONFIG_QUOTA
 	s->s_qcop = &reiserfs_qctl_operations;
 	s->dq_op = &reiserfs_quota_operations;
+	sb_dqopt(s)->allowed_types = (1 << USRQUOTA) | (1 << GRPQUOTA);
 #endif
+	sb_init_inode_fields(s, reiserfs_inode_fields);
 
 	/*
 	 * new format is limited by the 32 bit wide i_blocks field, want to
-- 
1.8.1.4

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply related	[flat|nested] 80+ messages in thread

* [Ocfs2-devel] [PATCH 10/12] reiserfs: Convert to private i_dquot field
@ 2014-10-01 19:31   ` Jan Kara
  0 siblings, 0 replies; 80+ messages in thread
From: Jan Kara @ 2014-10-01 19:31 UTC (permalink / raw)
  To: linux-fsdevel
  Cc: Dave Kleikamp, jfs-discussion, tytso, Jeff Mahoney, Mark Fasheh,
	reiserfs-devel, xfs, cluster-devel, Joel Becker, Jan Kara,
	linux-ext4, Steven Whitehouse, ocfs2-devel

CC: reiserfs-devel at vger.kernel.org
CC: Jeff Mahoney <jeffm@suse.de>
Signed-off-by: Jan Kara <jack@suse.cz>
---
 fs/reiserfs/reiserfs.h |  4 ++++
 fs/reiserfs/super.c    | 13 +++++++++++++
 2 files changed, 17 insertions(+)

diff --git a/fs/reiserfs/reiserfs.h b/fs/reiserfs/reiserfs.h
index 735c2c2b4536..197e59cbeb1c 100644
--- a/fs/reiserfs/reiserfs.h
+++ b/fs/reiserfs/reiserfs.h
@@ -97,6 +97,10 @@ struct reiserfs_inode_info {
 #ifdef CONFIG_REISERFS_FS_XATTR
 	struct rw_semaphore i_xattr_sem;
 #endif
+#ifdef CONFIG_QUOTA
+	struct dquot *i_dquot[MAXQUOTAS];
+#endif
+
 	struct inode vfs_inode;
 };
 
diff --git a/fs/reiserfs/super.c b/fs/reiserfs/super.c
index d46e88a33b02..c39227ded8f2 100644
--- a/fs/reiserfs/super.c
+++ b/fs/reiserfs/super.c
@@ -594,6 +594,10 @@ static struct inode *reiserfs_alloc_inode(struct super_block *sb)
 		return NULL;
 	atomic_set(&ei->openers, 0);
 	mutex_init(&ei->tailpack);
+#ifdef CONFIG_QUOTA
+	memset(&ei->i_dquot, 0, sizeof(ei->i_dquot));
+#endif
+
 	return &ei->vfs_inode;
 }
 
@@ -771,6 +775,13 @@ static const struct super_operations reiserfs_sops = {
 #endif
 };
 
+static const int reiserfs_inode_fields[IF_FIELD_NR] = {
+#ifdef CONFIG_QUOTA
+	[IF_DQUOTS] = (int)offsetof(struct reiserfs_inode_info, i_dquot) -
+		      (int)offsetof(struct reiserfs_inode_info, vfs_inode),
+#endif
+};
+
 #ifdef CONFIG_QUOTA
 #define QTYPE2NAME(t) ((t)==USRQUOTA?"user":"group")
 
@@ -1633,7 +1644,9 @@ static int read_super_block(struct super_block *s, int offset)
 #ifdef CONFIG_QUOTA
 	s->s_qcop = &reiserfs_qctl_operations;
 	s->dq_op = &reiserfs_quota_operations;
+	sb_dqopt(s)->allowed_types = (1 << USRQUOTA) | (1 << GRPQUOTA);
 #endif
+	sb_init_inode_fields(s, reiserfs_inode_fields);
 
 	/*
 	 * new format is limited by the 32 bit wide i_blocks field, want to
-- 
1.8.1.4

^ permalink raw reply related	[flat|nested] 80+ messages in thread

* [Cluster-devel] [PATCH 10/12] reiserfs: Convert to private i_dquot field
@ 2014-10-01 19:31   ` Jan Kara
  0 siblings, 0 replies; 80+ messages in thread
From: Jan Kara @ 2014-10-01 19:31 UTC (permalink / raw)
  To: cluster-devel.redhat.com

CC: reiserfs-devel at vger.kernel.org
CC: Jeff Mahoney <jeffm@suse.de>
Signed-off-by: Jan Kara <jack@suse.cz>
---
 fs/reiserfs/reiserfs.h |  4 ++++
 fs/reiserfs/super.c    | 13 +++++++++++++
 2 files changed, 17 insertions(+)

diff --git a/fs/reiserfs/reiserfs.h b/fs/reiserfs/reiserfs.h
index 735c2c2b4536..197e59cbeb1c 100644
--- a/fs/reiserfs/reiserfs.h
+++ b/fs/reiserfs/reiserfs.h
@@ -97,6 +97,10 @@ struct reiserfs_inode_info {
 #ifdef CONFIG_REISERFS_FS_XATTR
 	struct rw_semaphore i_xattr_sem;
 #endif
+#ifdef CONFIG_QUOTA
+	struct dquot *i_dquot[MAXQUOTAS];
+#endif
+
 	struct inode vfs_inode;
 };
 
diff --git a/fs/reiserfs/super.c b/fs/reiserfs/super.c
index d46e88a33b02..c39227ded8f2 100644
--- a/fs/reiserfs/super.c
+++ b/fs/reiserfs/super.c
@@ -594,6 +594,10 @@ static struct inode *reiserfs_alloc_inode(struct super_block *sb)
 		return NULL;
 	atomic_set(&ei->openers, 0);
 	mutex_init(&ei->tailpack);
+#ifdef CONFIG_QUOTA
+	memset(&ei->i_dquot, 0, sizeof(ei->i_dquot));
+#endif
+
 	return &ei->vfs_inode;
 }
 
@@ -771,6 +775,13 @@ static const struct super_operations reiserfs_sops = {
 #endif
 };
 
+static const int reiserfs_inode_fields[IF_FIELD_NR] = {
+#ifdef CONFIG_QUOTA
+	[IF_DQUOTS] = (int)offsetof(struct reiserfs_inode_info, i_dquot) -
+		      (int)offsetof(struct reiserfs_inode_info, vfs_inode),
+#endif
+};
+
 #ifdef CONFIG_QUOTA
 #define QTYPE2NAME(t) ((t)==USRQUOTA?"user":"group")
 
@@ -1633,7 +1644,9 @@ static int read_super_block(struct super_block *s, int offset)
 #ifdef CONFIG_QUOTA
 	s->s_qcop = &reiserfs_qctl_operations;
 	s->dq_op = &reiserfs_quota_operations;
+	sb_dqopt(s)->allowed_types = (1 << USRQUOTA) | (1 << GRPQUOTA);
 #endif
+	sb_init_inode_fields(s, reiserfs_inode_fields);
 
 	/*
 	 * new format is limited by the 32 bit wide i_blocks field, want to
-- 
1.8.1.4



^ permalink raw reply related	[flat|nested] 80+ messages in thread

* [PATCH 11/12] jfs: Convert to private i_dquot field
  2014-10-01 19:31 ` Jan Kara
  (?)
  (?)
@ 2014-10-01 19:31   ` Jan Kara
  -1 siblings, 0 replies; 80+ messages in thread
From: Jan Kara @ 2014-10-01 19:31 UTC (permalink / raw)
  To: linux-fsdevel
  Cc: linux-ext4, Dave Chinner, xfs, cluster-devel, Steven Whitehouse,
	Mark Fasheh, Joel Becker, ocfs2-devel, reiserfs-devel,
	Jeff Mahoney, Dave Kleikamp, jfs-discussion, tytso, Jan Kara

CC: Dave Kleikamp <shaggy@kernel.org>
CC: jfs-discussion@lists.sourceforge.net
Signed-off-by: Jan Kara <jack@suse.cz>
---
 fs/jfs/jfs_incore.h |  3 +++
 fs/jfs/super.c      | 13 +++++++++++++
 2 files changed, 16 insertions(+)

diff --git a/fs/jfs/jfs_incore.h b/fs/jfs/jfs_incore.h
index cf47f09e8ac8..fa7e795bd8ae 100644
--- a/fs/jfs/jfs_incore.h
+++ b/fs/jfs/jfs_incore.h
@@ -94,6 +94,9 @@ struct jfs_inode_info {
 			unchar _inline_ea[128];	/* 128: inline extended attr */
 		} link;
 	} u;
+#ifdef CONFIG_QUOTA
+	struct dquot *i_dquot[MAXQUOTAS];
+#endif
 	u32 dev;	/* will die when we get wide dev_t */
 	struct inode	vfs_inode;
 };
diff --git a/fs/jfs/super.c b/fs/jfs/super.c
index adf8cb045b9e..d32b1ee9836d 100644
--- a/fs/jfs/super.c
+++ b/fs/jfs/super.c
@@ -54,6 +54,7 @@ static struct kmem_cache *jfs_inode_cachep;
 
 static const struct super_operations jfs_super_operations;
 static const struct export_operations jfs_export_operations;
+static const int jfs_inode_fields[IF_FIELD_NR];
 static struct file_system_type jfs_fs_type;
 
 #define MAX_COMMIT_THREADS 64
@@ -117,6 +118,9 @@ static struct inode *jfs_alloc_inode(struct super_block *sb)
 	jfs_inode = kmem_cache_alloc(jfs_inode_cachep, GFP_NOFS);
 	if (!jfs_inode)
 		return NULL;
+#ifdef CONFIG_QUOTA
+	memset(&jfs_inode->i_dquot, 0, sizeof(jfs_inode->i_dquot));
+#endif
 	return &jfs_inode->vfs_inode;
 }
 
@@ -537,7 +541,9 @@ static int jfs_fill_super(struct super_block *sb, void *data, int silent)
 #ifdef CONFIG_QUOTA
 	sb->dq_op = &dquot_operations;
 	sb->s_qcop = &dquot_quotactl_ops;
+	sb_dqopt(sb)->allowed_types = (1 << USRQUOTA) | (1 << GRPQUOTA);
 #endif
+	sb_init_inode_fields(sb, jfs_inode_fields);
 
 	/*
 	 * Initialize direct-mapping inode/address-space
@@ -857,6 +863,13 @@ static const struct super_operations jfs_super_operations = {
 #endif
 };
 
+static const int jfs_inode_fields[IF_FIELD_NR] = {
+#ifdef CONFIG_QUOTA
+	[IF_DQUOTS] = (int)offsetof(struct js_inode_info, i_dquot) -
+		      (int)offsetof(struct jfs_inode_info, vfs_inode),
+#endif
+};
+
 static const struct export_operations jfs_export_operations = {
 	.fh_to_dentry	= jfs_fh_to_dentry,
 	.fh_to_parent	= jfs_fh_to_parent,
-- 
1.8.1.4


^ permalink raw reply related	[flat|nested] 80+ messages in thread

* [PATCH 11/12] jfs: Convert to private i_dquot field
@ 2014-10-01 19:31   ` Jan Kara
  0 siblings, 0 replies; 80+ messages in thread
From: Jan Kara @ 2014-10-01 19:31 UTC (permalink / raw)
  To: linux-fsdevel
  Cc: Dave Kleikamp, jfs-discussion, tytso, Jeff Mahoney, Mark Fasheh,
	reiserfs-devel, xfs, cluster-devel, Joel Becker, Jan Kara,
	linux-ext4, Steven Whitehouse, ocfs2-devel

CC: Dave Kleikamp <shaggy@kernel.org>
CC: jfs-discussion@lists.sourceforge.net
Signed-off-by: Jan Kara <jack@suse.cz>
---
 fs/jfs/jfs_incore.h |  3 +++
 fs/jfs/super.c      | 13 +++++++++++++
 2 files changed, 16 insertions(+)

diff --git a/fs/jfs/jfs_incore.h b/fs/jfs/jfs_incore.h
index cf47f09e8ac8..fa7e795bd8ae 100644
--- a/fs/jfs/jfs_incore.h
+++ b/fs/jfs/jfs_incore.h
@@ -94,6 +94,9 @@ struct jfs_inode_info {
 			unchar _inline_ea[128];	/* 128: inline extended attr */
 		} link;
 	} u;
+#ifdef CONFIG_QUOTA
+	struct dquot *i_dquot[MAXQUOTAS];
+#endif
 	u32 dev;	/* will die when we get wide dev_t */
 	struct inode	vfs_inode;
 };
diff --git a/fs/jfs/super.c b/fs/jfs/super.c
index adf8cb045b9e..d32b1ee9836d 100644
--- a/fs/jfs/super.c
+++ b/fs/jfs/super.c
@@ -54,6 +54,7 @@ static struct kmem_cache *jfs_inode_cachep;
 
 static const struct super_operations jfs_super_operations;
 static const struct export_operations jfs_export_operations;
+static const int jfs_inode_fields[IF_FIELD_NR];
 static struct file_system_type jfs_fs_type;
 
 #define MAX_COMMIT_THREADS 64
@@ -117,6 +118,9 @@ static struct inode *jfs_alloc_inode(struct super_block *sb)
 	jfs_inode = kmem_cache_alloc(jfs_inode_cachep, GFP_NOFS);
 	if (!jfs_inode)
 		return NULL;
+#ifdef CONFIG_QUOTA
+	memset(&jfs_inode->i_dquot, 0, sizeof(jfs_inode->i_dquot));
+#endif
 	return &jfs_inode->vfs_inode;
 }
 
@@ -537,7 +541,9 @@ static int jfs_fill_super(struct super_block *sb, void *data, int silent)
 #ifdef CONFIG_QUOTA
 	sb->dq_op = &dquot_operations;
 	sb->s_qcop = &dquot_quotactl_ops;
+	sb_dqopt(sb)->allowed_types = (1 << USRQUOTA) | (1 << GRPQUOTA);
 #endif
+	sb_init_inode_fields(sb, jfs_inode_fields);
 
 	/*
 	 * Initialize direct-mapping inode/address-space
@@ -857,6 +863,13 @@ static const struct super_operations jfs_super_operations = {
 #endif
 };
 
+static const int jfs_inode_fields[IF_FIELD_NR] = {
+#ifdef CONFIG_QUOTA
+	[IF_DQUOTS] = (int)offsetof(struct js_inode_info, i_dquot) -
+		      (int)offsetof(struct jfs_inode_info, vfs_inode),
+#endif
+};
+
 static const struct export_operations jfs_export_operations = {
 	.fh_to_dentry	= jfs_fh_to_dentry,
 	.fh_to_parent	= jfs_fh_to_parent,
-- 
1.8.1.4

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply related	[flat|nested] 80+ messages in thread

* [Ocfs2-devel] [PATCH 11/12] jfs: Convert to private i_dquot field
@ 2014-10-01 19:31   ` Jan Kara
  0 siblings, 0 replies; 80+ messages in thread
From: Jan Kara @ 2014-10-01 19:31 UTC (permalink / raw)
  To: linux-fsdevel
  Cc: linux-ext4, Dave Chinner, xfs, cluster-devel, Steven Whitehouse,
	Mark Fasheh, Joel Becker, ocfs2-devel, reiserfs-devel,
	Jeff Mahoney, Dave Kleikamp, jfs-discussion, tytso, Jan Kara

CC: Dave Kleikamp <shaggy@kernel.org>
CC: jfs-discussion at lists.sourceforge.net
Signed-off-by: Jan Kara <jack@suse.cz>
---
 fs/jfs/jfs_incore.h |  3 +++
 fs/jfs/super.c      | 13 +++++++++++++
 2 files changed, 16 insertions(+)

diff --git a/fs/jfs/jfs_incore.h b/fs/jfs/jfs_incore.h
index cf47f09e8ac8..fa7e795bd8ae 100644
--- a/fs/jfs/jfs_incore.h
+++ b/fs/jfs/jfs_incore.h
@@ -94,6 +94,9 @@ struct jfs_inode_info {
 			unchar _inline_ea[128];	/* 128: inline extended attr */
 		} link;
 	} u;
+#ifdef CONFIG_QUOTA
+	struct dquot *i_dquot[MAXQUOTAS];
+#endif
 	u32 dev;	/* will die when we get wide dev_t */
 	struct inode	vfs_inode;
 };
diff --git a/fs/jfs/super.c b/fs/jfs/super.c
index adf8cb045b9e..d32b1ee9836d 100644
--- a/fs/jfs/super.c
+++ b/fs/jfs/super.c
@@ -54,6 +54,7 @@ static struct kmem_cache *jfs_inode_cachep;
 
 static const struct super_operations jfs_super_operations;
 static const struct export_operations jfs_export_operations;
+static const int jfs_inode_fields[IF_FIELD_NR];
 static struct file_system_type jfs_fs_type;
 
 #define MAX_COMMIT_THREADS 64
@@ -117,6 +118,9 @@ static struct inode *jfs_alloc_inode(struct super_block *sb)
 	jfs_inode = kmem_cache_alloc(jfs_inode_cachep, GFP_NOFS);
 	if (!jfs_inode)
 		return NULL;
+#ifdef CONFIG_QUOTA
+	memset(&jfs_inode->i_dquot, 0, sizeof(jfs_inode->i_dquot));
+#endif
 	return &jfs_inode->vfs_inode;
 }
 
@@ -537,7 +541,9 @@ static int jfs_fill_super(struct super_block *sb, void *data, int silent)
 #ifdef CONFIG_QUOTA
 	sb->dq_op = &dquot_operations;
 	sb->s_qcop = &dquot_quotactl_ops;
+	sb_dqopt(sb)->allowed_types = (1 << USRQUOTA) | (1 << GRPQUOTA);
 #endif
+	sb_init_inode_fields(sb, jfs_inode_fields);
 
 	/*
 	 * Initialize direct-mapping inode/address-space
@@ -857,6 +863,13 @@ static const struct super_operations jfs_super_operations = {
 #endif
 };
 
+static const int jfs_inode_fields[IF_FIELD_NR] = {
+#ifdef CONFIG_QUOTA
+	[IF_DQUOTS] = (int)offsetof(struct js_inode_info, i_dquot) -
+		      (int)offsetof(struct jfs_inode_info, vfs_inode),
+#endif
+};
+
 static const struct export_operations jfs_export_operations = {
 	.fh_to_dentry	= jfs_fh_to_dentry,
 	.fh_to_parent	= jfs_fh_to_parent,
-- 
1.8.1.4

^ permalink raw reply related	[flat|nested] 80+ messages in thread

* [Cluster-devel] [PATCH 11/12] jfs: Convert to private i_dquot field
@ 2014-10-01 19:31   ` Jan Kara
  0 siblings, 0 replies; 80+ messages in thread
From: Jan Kara @ 2014-10-01 19:31 UTC (permalink / raw)
  To: cluster-devel.redhat.com

CC: Dave Kleikamp <shaggy@kernel.org>
CC: jfs-discussion at lists.sourceforge.net
Signed-off-by: Jan Kara <jack@suse.cz>
---
 fs/jfs/jfs_incore.h |  3 +++
 fs/jfs/super.c      | 13 +++++++++++++
 2 files changed, 16 insertions(+)

diff --git a/fs/jfs/jfs_incore.h b/fs/jfs/jfs_incore.h
index cf47f09e8ac8..fa7e795bd8ae 100644
--- a/fs/jfs/jfs_incore.h
+++ b/fs/jfs/jfs_incore.h
@@ -94,6 +94,9 @@ struct jfs_inode_info {
 			unchar _inline_ea[128];	/* 128: inline extended attr */
 		} link;
 	} u;
+#ifdef CONFIG_QUOTA
+	struct dquot *i_dquot[MAXQUOTAS];
+#endif
 	u32 dev;	/* will die when we get wide dev_t */
 	struct inode	vfs_inode;
 };
diff --git a/fs/jfs/super.c b/fs/jfs/super.c
index adf8cb045b9e..d32b1ee9836d 100644
--- a/fs/jfs/super.c
+++ b/fs/jfs/super.c
@@ -54,6 +54,7 @@ static struct kmem_cache *jfs_inode_cachep;
 
 static const struct super_operations jfs_super_operations;
 static const struct export_operations jfs_export_operations;
+static const int jfs_inode_fields[IF_FIELD_NR];
 static struct file_system_type jfs_fs_type;
 
 #define MAX_COMMIT_THREADS 64
@@ -117,6 +118,9 @@ static struct inode *jfs_alloc_inode(struct super_block *sb)
 	jfs_inode = kmem_cache_alloc(jfs_inode_cachep, GFP_NOFS);
 	if (!jfs_inode)
 		return NULL;
+#ifdef CONFIG_QUOTA
+	memset(&jfs_inode->i_dquot, 0, sizeof(jfs_inode->i_dquot));
+#endif
 	return &jfs_inode->vfs_inode;
 }
 
@@ -537,7 +541,9 @@ static int jfs_fill_super(struct super_block *sb, void *data, int silent)
 #ifdef CONFIG_QUOTA
 	sb->dq_op = &dquot_operations;
 	sb->s_qcop = &dquot_quotactl_ops;
+	sb_dqopt(sb)->allowed_types = (1 << USRQUOTA) | (1 << GRPQUOTA);
 #endif
+	sb_init_inode_fields(sb, jfs_inode_fields);
 
 	/*
 	 * Initialize direct-mapping inode/address-space
@@ -857,6 +863,13 @@ static const struct super_operations jfs_super_operations = {
 #endif
 };
 
+static const int jfs_inode_fields[IF_FIELD_NR] = {
+#ifdef CONFIG_QUOTA
+	[IF_DQUOTS] = (int)offsetof(struct js_inode_info, i_dquot) -
+		      (int)offsetof(struct jfs_inode_info, vfs_inode),
+#endif
+};
+
 static const struct export_operations jfs_export_operations = {
 	.fh_to_dentry	= jfs_fh_to_dentry,
 	.fh_to_parent	= jfs_fh_to_parent,
-- 
1.8.1.4



^ permalink raw reply related	[flat|nested] 80+ messages in thread

* [PATCH 12/12] vfs: Remove i_dquot field from inode
  2014-10-01 19:31 ` Jan Kara
  (?)
  (?)
@ 2014-10-01 19:31   ` Jan Kara
  -1 siblings, 0 replies; 80+ messages in thread
From: Jan Kara @ 2014-10-01 19:31 UTC (permalink / raw)
  To: linux-fsdevel
  Cc: linux-ext4, Dave Chinner, xfs, cluster-devel, Steven Whitehouse,
	Mark Fasheh, Joel Becker, ocfs2-devel, reiserfs-devel,
	Jeff Mahoney, Dave Kleikamp, jfs-discussion, tytso, Jan Kara

All filesystems using VFS quotas are now converted to use their private
i_dquot fields. Remove the i_dquot field from generic inode structure.

Signed-off-by: Jan Kara <jack@suse.cz>
---
 fs/inode.c         |  3 ---
 fs/super.c         | 10 ----------
 include/linux/fs.h |  3 ---
 3 files changed, 16 deletions(-)

diff --git a/fs/inode.c b/fs/inode.c
index 26753ba7b6d6..2ed95f7caa4f 100644
--- a/fs/inode.c
+++ b/fs/inode.c
@@ -143,9 +143,6 @@ int inode_init_always(struct super_block *sb, struct inode *inode)
 	inode->i_blocks = 0;
 	inode->i_bytes = 0;
 	inode->i_generation = 0;
-#ifdef CONFIG_QUOTA
-	memset(&inode->i_dquot, 0, sizeof(inode->i_dquot));
-#endif
 	inode->i_pipe = NULL;
 	inode->i_bdev = NULL;
 	inode->i_cdev = NULL;
diff --git a/fs/super.c b/fs/super.c
index 3e70f2e22ea3..b9a214d2fe98 100644
--- a/fs/super.c
+++ b/fs/super.c
@@ -215,22 +215,12 @@ static struct super_block *alloc_super(struct file_system_type *type, int flags)
 	atomic_set(&s->s_active, 1);
 	mutex_init(&s->s_vfs_rename_mutex);
 	lockdep_set_class(&s->s_vfs_rename_mutex, &type->s_vfs_rename_key);
-	/*
-	 * For now MAXQUOTAS check in do_quotactl() will limit quota type
-	 * appropriately. When each fs sets allowed_types, we can remove the
-	 * line below
-	 */
-	s->s_dquot.allowed_types = (1 << USRQUOTA) | (1 << GRPQUOTA) |
-				   (1 << PRJQUOTA);
 	mutex_init(&s->s_dquot.dqio_mutex);
 	mutex_init(&s->s_dquot.dqonoff_mutex);
 	s->s_maxbytes = MAX_NON_LFS;
 	s->s_op = &default_op;
 	s->s_time_gran = 1000000000;
 	s->cleancache_poolid = -1;
-#ifdef CONFIG_QUOTA
-	s->s_inode_fields[IF_DQUOTS] = offsetof(struct inode, i_dquot);
-#endif
 
 	s->s_shrink.seeks = DEFAULT_SEEKS;
 	s->s_shrink.scan_objects = super_cache_scan;
diff --git a/include/linux/fs.h b/include/linux/fs.h
index d49434866da5..fb669113c37c 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -595,9 +595,6 @@ struct inode {
 	const struct file_operations	*i_fop;	/* former ->i_op->default_file_ops */
 	struct file_lock	*i_flock;
 	struct address_space	i_data;
-#ifdef CONFIG_QUOTA
-	struct dquot		*i_dquot[MAXQUOTAS];
-#endif
 	struct list_head	i_devices;
 	union {
 		struct pipe_inode_info	*i_pipe;
-- 
1.8.1.4


^ permalink raw reply related	[flat|nested] 80+ messages in thread

* [PATCH 12/12] vfs: Remove i_dquot field from inode
@ 2014-10-01 19:31   ` Jan Kara
  0 siblings, 0 replies; 80+ messages in thread
From: Jan Kara @ 2014-10-01 19:31 UTC (permalink / raw)
  To: linux-fsdevel
  Cc: Dave Kleikamp, jfs-discussion, tytso, Jeff Mahoney, Mark Fasheh,
	reiserfs-devel, xfs, cluster-devel, Joel Becker, Jan Kara,
	linux-ext4, Steven Whitehouse, ocfs2-devel

All filesystems using VFS quotas are now converted to use their private
i_dquot fields. Remove the i_dquot field from generic inode structure.

Signed-off-by: Jan Kara <jack@suse.cz>
---
 fs/inode.c         |  3 ---
 fs/super.c         | 10 ----------
 include/linux/fs.h |  3 ---
 3 files changed, 16 deletions(-)

diff --git a/fs/inode.c b/fs/inode.c
index 26753ba7b6d6..2ed95f7caa4f 100644
--- a/fs/inode.c
+++ b/fs/inode.c
@@ -143,9 +143,6 @@ int inode_init_always(struct super_block *sb, struct inode *inode)
 	inode->i_blocks = 0;
 	inode->i_bytes = 0;
 	inode->i_generation = 0;
-#ifdef CONFIG_QUOTA
-	memset(&inode->i_dquot, 0, sizeof(inode->i_dquot));
-#endif
 	inode->i_pipe = NULL;
 	inode->i_bdev = NULL;
 	inode->i_cdev = NULL;
diff --git a/fs/super.c b/fs/super.c
index 3e70f2e22ea3..b9a214d2fe98 100644
--- a/fs/super.c
+++ b/fs/super.c
@@ -215,22 +215,12 @@ static struct super_block *alloc_super(struct file_system_type *type, int flags)
 	atomic_set(&s->s_active, 1);
 	mutex_init(&s->s_vfs_rename_mutex);
 	lockdep_set_class(&s->s_vfs_rename_mutex, &type->s_vfs_rename_key);
-	/*
-	 * For now MAXQUOTAS check in do_quotactl() will limit quota type
-	 * appropriately. When each fs sets allowed_types, we can remove the
-	 * line below
-	 */
-	s->s_dquot.allowed_types = (1 << USRQUOTA) | (1 << GRPQUOTA) |
-				   (1 << PRJQUOTA);
 	mutex_init(&s->s_dquot.dqio_mutex);
 	mutex_init(&s->s_dquot.dqonoff_mutex);
 	s->s_maxbytes = MAX_NON_LFS;
 	s->s_op = &default_op;
 	s->s_time_gran = 1000000000;
 	s->cleancache_poolid = -1;
-#ifdef CONFIG_QUOTA
-	s->s_inode_fields[IF_DQUOTS] = offsetof(struct inode, i_dquot);
-#endif
 
 	s->s_shrink.seeks = DEFAULT_SEEKS;
 	s->s_shrink.scan_objects = super_cache_scan;
diff --git a/include/linux/fs.h b/include/linux/fs.h
index d49434866da5..fb669113c37c 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -595,9 +595,6 @@ struct inode {
 	const struct file_operations	*i_fop;	/* former ->i_op->default_file_ops */
 	struct file_lock	*i_flock;
 	struct address_space	i_data;
-#ifdef CONFIG_QUOTA
-	struct dquot		*i_dquot[MAXQUOTAS];
-#endif
 	struct list_head	i_devices;
 	union {
 		struct pipe_inode_info	*i_pipe;
-- 
1.8.1.4

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply related	[flat|nested] 80+ messages in thread

* [Ocfs2-devel] [PATCH 12/12] vfs: Remove i_dquot field from inode
@ 2014-10-01 19:31   ` Jan Kara
  0 siblings, 0 replies; 80+ messages in thread
From: Jan Kara @ 2014-10-01 19:31 UTC (permalink / raw)
  To: linux-fsdevel
  Cc: linux-ext4, Dave Chinner, xfs, cluster-devel, Steven Whitehouse,
	Mark Fasheh, Joel Becker, ocfs2-devel, reiserfs-devel,
	Jeff Mahoney, Dave Kleikamp, jfs-discussion, tytso, Jan Kara

All filesystems using VFS quotas are now converted to use their private
i_dquot fields. Remove the i_dquot field from generic inode structure.

Signed-off-by: Jan Kara <jack@suse.cz>
---
 fs/inode.c         |  3 ---
 fs/super.c         | 10 ----------
 include/linux/fs.h |  3 ---
 3 files changed, 16 deletions(-)

diff --git a/fs/inode.c b/fs/inode.c
index 26753ba7b6d6..2ed95f7caa4f 100644
--- a/fs/inode.c
+++ b/fs/inode.c
@@ -143,9 +143,6 @@ int inode_init_always(struct super_block *sb, struct inode *inode)
 	inode->i_blocks = 0;
 	inode->i_bytes = 0;
 	inode->i_generation = 0;
-#ifdef CONFIG_QUOTA
-	memset(&inode->i_dquot, 0, sizeof(inode->i_dquot));
-#endif
 	inode->i_pipe = NULL;
 	inode->i_bdev = NULL;
 	inode->i_cdev = NULL;
diff --git a/fs/super.c b/fs/super.c
index 3e70f2e22ea3..b9a214d2fe98 100644
--- a/fs/super.c
+++ b/fs/super.c
@@ -215,22 +215,12 @@ static struct super_block *alloc_super(struct file_system_type *type, int flags)
 	atomic_set(&s->s_active, 1);
 	mutex_init(&s->s_vfs_rename_mutex);
 	lockdep_set_class(&s->s_vfs_rename_mutex, &type->s_vfs_rename_key);
-	/*
-	 * For now MAXQUOTAS check in do_quotactl() will limit quota type
-	 * appropriately. When each fs sets allowed_types, we can remove the
-	 * line below
-	 */
-	s->s_dquot.allowed_types = (1 << USRQUOTA) | (1 << GRPQUOTA) |
-				   (1 << PRJQUOTA);
 	mutex_init(&s->s_dquot.dqio_mutex);
 	mutex_init(&s->s_dquot.dqonoff_mutex);
 	s->s_maxbytes = MAX_NON_LFS;
 	s->s_op = &default_op;
 	s->s_time_gran = 1000000000;
 	s->cleancache_poolid = -1;
-#ifdef CONFIG_QUOTA
-	s->s_inode_fields[IF_DQUOTS] = offsetof(struct inode, i_dquot);
-#endif
 
 	s->s_shrink.seeks = DEFAULT_SEEKS;
 	s->s_shrink.scan_objects = super_cache_scan;
diff --git a/include/linux/fs.h b/include/linux/fs.h
index d49434866da5..fb669113c37c 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -595,9 +595,6 @@ struct inode {
 	const struct file_operations	*i_fop;	/* former ->i_op->default_file_ops */
 	struct file_lock	*i_flock;
 	struct address_space	i_data;
-#ifdef CONFIG_QUOTA
-	struct dquot		*i_dquot[MAXQUOTAS];
-#endif
 	struct list_head	i_devices;
 	union {
 		struct pipe_inode_info	*i_pipe;
-- 
1.8.1.4

^ permalink raw reply related	[flat|nested] 80+ messages in thread

* [Cluster-devel] [PATCH 12/12] vfs: Remove i_dquot field from inode
@ 2014-10-01 19:31   ` Jan Kara
  0 siblings, 0 replies; 80+ messages in thread
From: Jan Kara @ 2014-10-01 19:31 UTC (permalink / raw)
  To: cluster-devel.redhat.com

All filesystems using VFS quotas are now converted to use their private
i_dquot fields. Remove the i_dquot field from generic inode structure.

Signed-off-by: Jan Kara <jack@suse.cz>
---
 fs/inode.c         |  3 ---
 fs/super.c         | 10 ----------
 include/linux/fs.h |  3 ---
 3 files changed, 16 deletions(-)

diff --git a/fs/inode.c b/fs/inode.c
index 26753ba7b6d6..2ed95f7caa4f 100644
--- a/fs/inode.c
+++ b/fs/inode.c
@@ -143,9 +143,6 @@ int inode_init_always(struct super_block *sb, struct inode *inode)
 	inode->i_blocks = 0;
 	inode->i_bytes = 0;
 	inode->i_generation = 0;
-#ifdef CONFIG_QUOTA
-	memset(&inode->i_dquot, 0, sizeof(inode->i_dquot));
-#endif
 	inode->i_pipe = NULL;
 	inode->i_bdev = NULL;
 	inode->i_cdev = NULL;
diff --git a/fs/super.c b/fs/super.c
index 3e70f2e22ea3..b9a214d2fe98 100644
--- a/fs/super.c
+++ b/fs/super.c
@@ -215,22 +215,12 @@ static struct super_block *alloc_super(struct file_system_type *type, int flags)
 	atomic_set(&s->s_active, 1);
 	mutex_init(&s->s_vfs_rename_mutex);
 	lockdep_set_class(&s->s_vfs_rename_mutex, &type->s_vfs_rename_key);
-	/*
-	 * For now MAXQUOTAS check in do_quotactl() will limit quota type
-	 * appropriately. When each fs sets allowed_types, we can remove the
-	 * line below
-	 */
-	s->s_dquot.allowed_types = (1 << USRQUOTA) | (1 << GRPQUOTA) |
-				   (1 << PRJQUOTA);
 	mutex_init(&s->s_dquot.dqio_mutex);
 	mutex_init(&s->s_dquot.dqonoff_mutex);
 	s->s_maxbytes = MAX_NON_LFS;
 	s->s_op = &default_op;
 	s->s_time_gran = 1000000000;
 	s->cleancache_poolid = -1;
-#ifdef CONFIG_QUOTA
-	s->s_inode_fields[IF_DQUOTS] = offsetof(struct inode, i_dquot);
-#endif
 
 	s->s_shrink.seeks = DEFAULT_SEEKS;
 	s->s_shrink.scan_objects = super_cache_scan;
diff --git a/include/linux/fs.h b/include/linux/fs.h
index d49434866da5..fb669113c37c 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -595,9 +595,6 @@ struct inode {
 	const struct file_operations	*i_fop;	/* former ->i_op->default_file_ops */
 	struct file_lock	*i_flock;
 	struct address_space	i_data;
-#ifdef CONFIG_QUOTA
-	struct dquot		*i_dquot[MAXQUOTAS];
-#endif
 	struct list_head	i_devices;
 	union {
 		struct pipe_inode_info	*i_pipe;
-- 
1.8.1.4



^ permalink raw reply related	[flat|nested] 80+ messages in thread

* Re: [PATCH 04/12] fs: Generic infrastructure for optional inode fields
  2014-10-01 19:31   ` [Ocfs2-devel] " Jan Kara
  (?)
  (?)
@ 2014-10-01 21:05     ` Andreas Dilger
  -1 siblings, 0 replies; 80+ messages in thread
From: Andreas Dilger @ 2014-10-01 21:05 UTC (permalink / raw)
  To: Jan Kara
  Cc: linux-fsdevel, linux-ext4, Dave Chinner, xfs, cluster-devel,
	Steven Whitehouse, Mark Fasheh, Joel Becker, ocfs2-devel,
	reiserfs-devel, Jeff Mahoney, Dave Kleikamp, jfs-discussion,
	tytso

[-- Attachment #1: Type: text/plain, Size: 3441 bytes --]

On Oct 1, 2014, at 1:31 PM, Jan Kara <jack@suse.cz> wrote:
> There are parts of struct inode which are used only by a few filesystems
> (e.g. i_dquot pointers, i_mapping->private_list, ...). Thus all the
> other filesystems are just wasting memory with these fields. On the
> other hand it isn't simple to just move these fields to filesystem
> specific part of inode because there is generic code which needs to peek
> into the fields and it is cumbersome to provide helpers into which fs
> has to stuff the field it is storing elsewhere.
> 
> We create a simple infrastructure which allows for optional inode fields
> stored in the fs-specific part of the inode. Accessing these fields has
> a slightly worse performance as we have to lookup their offset in the
> offset table stored in the superblock but in most cases this is
> acceptable. Notably, this offset-table mechanism is faster than having
> fs-specific hook functions which would need to be called to provide
> pointers to desired fields.
> 
> Signed-off-by: Jan Kara <jack@suse.cz>
> ---
> include/linux/fs.h | 24 ++++++++++++++++++++++++
> 1 file changed, 24 insertions(+)
> 
> diff --git a/include/linux/fs.h b/include/linux/fs.h
> index 94187721ad41..977f8fb6ca88 100644
> --- a/include/linux/fs.h
> +++ b/include/linux/fs.h
> @@ -615,6 +615,11 @@ struct inode {
> 	void			*i_private; /* fs or device private pointer */
> };
> 
> +/* Optional inode fields (stored in filesystems inode if the fs needs them) */
> +enum {

This should be a named enum, like "enum inode_field" or similar, so it
can be referenced below.

> +	IF_FIELD_NR	/* Number of optional inode fields */
> +};
> +
> static inline int inode_unhashed(struct inode *inode)
> {
> 	return hlist_unhashed(&inode->i_hash);
> @@ -1236,6 +1241,11 @@ struct super_block {
> 	void 			*s_fs_info;	/* Filesystem private info */
> 	unsigned int		s_max_links;
> 	fmode_t			s_mode;
> +	/*
> +	 * We could have here just a pointer to the offsets array but this
> +	 * way we save one dereference when looking up field offsets
> +	 */
> +	int			s_inode_fields[IF_FIELD_NR];
> 
> 	/* Granularity of c/m/atime in ns.
> 	   Cannot be worse than a second */
> @@ -1286,6 +1296,20 @@ struct super_block {
> 	struct rcu_head		rcu;
> };
> 
> +static inline void *inode_field(const struct inode *inode, int field)

This should use "enum inode_field" instead of int, so the compiler could
warn about invalid parameter values.  It might make sense to add a check:

        if (field < IF_FIELD_NR)

but I'm not sure if the overhead is worthwhile, unless it can always be
resolved at compile time.  That might be possible since this is a static
inline function.

Cheers, Andreas

> +{
> +	int offset = inode->i_sb->s_inode_fields[field];
> +
> +	if (!offset)	/* Field not present? */
> +		return NULL;

> +	return ((char *)inode) + offset;
> +}
> +
> +static inline void sb_init_inode_fields(struct super_block *sb, int *fields)
> +{
> +	memcpy(sb->s_inode_fields, fields, sizeof(int) * IF_FIELD_NR);
> +}
> +
> extern struct timespec current_fs_time(struct super_block *sb);
> 
> /*
> -- 
> 1.8.1.4
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html


Cheers, Andreas






[-- Attachment #2: Message signed with OpenPGP using GPGMail --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 80+ messages in thread

* Re: [PATCH 04/12] fs: Generic infrastructure for optional inode fields
@ 2014-10-01 21:05     ` Andreas Dilger
  0 siblings, 0 replies; 80+ messages in thread
From: Andreas Dilger @ 2014-10-01 21:05 UTC (permalink / raw)
  To: Jan Kara
  Cc: Dave Kleikamp, jfs-discussion, tytso, Jeff Mahoney, Mark Fasheh,
	reiserfs-devel, xfs, cluster-devel, Joel Becker, linux-fsdevel,
	linux-ext4, Steven Whitehouse, ocfs2-devel


[-- Attachment #1.1: Type: text/plain, Size: 3441 bytes --]

On Oct 1, 2014, at 1:31 PM, Jan Kara <jack@suse.cz> wrote:
> There are parts of struct inode which are used only by a few filesystems
> (e.g. i_dquot pointers, i_mapping->private_list, ...). Thus all the
> other filesystems are just wasting memory with these fields. On the
> other hand it isn't simple to just move these fields to filesystem
> specific part of inode because there is generic code which needs to peek
> into the fields and it is cumbersome to provide helpers into which fs
> has to stuff the field it is storing elsewhere.
> 
> We create a simple infrastructure which allows for optional inode fields
> stored in the fs-specific part of the inode. Accessing these fields has
> a slightly worse performance as we have to lookup their offset in the
> offset table stored in the superblock but in most cases this is
> acceptable. Notably, this offset-table mechanism is faster than having
> fs-specific hook functions which would need to be called to provide
> pointers to desired fields.
> 
> Signed-off-by: Jan Kara <jack@suse.cz>
> ---
> include/linux/fs.h | 24 ++++++++++++++++++++++++
> 1 file changed, 24 insertions(+)
> 
> diff --git a/include/linux/fs.h b/include/linux/fs.h
> index 94187721ad41..977f8fb6ca88 100644
> --- a/include/linux/fs.h
> +++ b/include/linux/fs.h
> @@ -615,6 +615,11 @@ struct inode {
> 	void			*i_private; /* fs or device private pointer */
> };
> 
> +/* Optional inode fields (stored in filesystems inode if the fs needs them) */
> +enum {

This should be a named enum, like "enum inode_field" or similar, so it
can be referenced below.

> +	IF_FIELD_NR	/* Number of optional inode fields */
> +};
> +
> static inline int inode_unhashed(struct inode *inode)
> {
> 	return hlist_unhashed(&inode->i_hash);
> @@ -1236,6 +1241,11 @@ struct super_block {
> 	void 			*s_fs_info;	/* Filesystem private info */
> 	unsigned int		s_max_links;
> 	fmode_t			s_mode;
> +	/*
> +	 * We could have here just a pointer to the offsets array but this
> +	 * way we save one dereference when looking up field offsets
> +	 */
> +	int			s_inode_fields[IF_FIELD_NR];
> 
> 	/* Granularity of c/m/atime in ns.
> 	   Cannot be worse than a second */
> @@ -1286,6 +1296,20 @@ struct super_block {
> 	struct rcu_head		rcu;
> };
> 
> +static inline void *inode_field(const struct inode *inode, int field)

This should use "enum inode_field" instead of int, so the compiler could
warn about invalid parameter values.  It might make sense to add a check:

        if (field < IF_FIELD_NR)

but I'm not sure if the overhead is worthwhile, unless it can always be
resolved at compile time.  That might be possible since this is a static
inline function.

Cheers, Andreas

> +{
> +	int offset = inode->i_sb->s_inode_fields[field];
> +
> +	if (!offset)	/* Field not present? */
> +		return NULL;

> +	return ((char *)inode) + offset;
> +}
> +
> +static inline void sb_init_inode_fields(struct super_block *sb, int *fields)
> +{
> +	memcpy(sb->s_inode_fields, fields, sizeof(int) * IF_FIELD_NR);
> +}
> +
> extern struct timespec current_fs_time(struct super_block *sb);
> 
> /*
> -- 
> 1.8.1.4
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html


Cheers, Andreas






[-- Attachment #1.2: Message signed with OpenPGP using GPGMail --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

[-- Attachment #2: Type: text/plain, Size: 121 bytes --]

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 80+ messages in thread

* [Ocfs2-devel] [PATCH 04/12] fs: Generic infrastructure for optional inode fields
@ 2014-10-01 21:05     ` Andreas Dilger
  0 siblings, 0 replies; 80+ messages in thread
From: Andreas Dilger @ 2014-10-01 21:05 UTC (permalink / raw)
  To: Jan Kara
  Cc: linux-fsdevel, linux-ext4, Dave Chinner, xfs, cluster-devel,
	Steven Whitehouse, Mark Fasheh, Joel Becker, ocfs2-devel,
	reiserfs-devel, Jeff Mahoney, Dave Kleikamp, jfs-discussion,
	tytso

On Oct 1, 2014, at 1:31 PM, Jan Kara <jack@suse.cz> wrote:
> There are parts of struct inode which are used only by a few filesystems
> (e.g. i_dquot pointers, i_mapping->private_list, ...). Thus all the
> other filesystems are just wasting memory with these fields. On the
> other hand it isn't simple to just move these fields to filesystem
> specific part of inode because there is generic code which needs to peek
> into the fields and it is cumbersome to provide helpers into which fs
> has to stuff the field it is storing elsewhere.
> 
> We create a simple infrastructure which allows for optional inode fields
> stored in the fs-specific part of the inode. Accessing these fields has
> a slightly worse performance as we have to lookup their offset in the
> offset table stored in the superblock but in most cases this is
> acceptable. Notably, this offset-table mechanism is faster than having
> fs-specific hook functions which would need to be called to provide
> pointers to desired fields.
> 
> Signed-off-by: Jan Kara <jack@suse.cz>
> ---
> include/linux/fs.h | 24 ++++++++++++++++++++++++
> 1 file changed, 24 insertions(+)
> 
> diff --git a/include/linux/fs.h b/include/linux/fs.h
> index 94187721ad41..977f8fb6ca88 100644
> --- a/include/linux/fs.h
> +++ b/include/linux/fs.h
> @@ -615,6 +615,11 @@ struct inode {
> 	void			*i_private; /* fs or device private pointer */
> };
> 
> +/* Optional inode fields (stored in filesystems inode if the fs needs them) */
> +enum {

This should be a named enum, like "enum inode_field" or similar, so it
can be referenced below.

> +	IF_FIELD_NR	/* Number of optional inode fields */
> +};
> +
> static inline int inode_unhashed(struct inode *inode)
> {
> 	return hlist_unhashed(&inode->i_hash);
> @@ -1236,6 +1241,11 @@ struct super_block {
> 	void 			*s_fs_info;	/* Filesystem private info */
> 	unsigned int		s_max_links;
> 	fmode_t			s_mode;
> +	/*
> +	 * We could have here just a pointer to the offsets array but this
> +	 * way we save one dereference when looking up field offsets
> +	 */
> +	int			s_inode_fields[IF_FIELD_NR];
> 
> 	/* Granularity of c/m/atime in ns.
> 	   Cannot be worse than a second */
> @@ -1286,6 +1296,20 @@ struct super_block {
> 	struct rcu_head		rcu;
> };
> 
> +static inline void *inode_field(const struct inode *inode, int field)

This should use "enum inode_field" instead of int, so the compiler could
warn about invalid parameter values.  It might make sense to add a check:

        if (field < IF_FIELD_NR)

but I'm not sure if the overhead is worthwhile, unless it can always be
resolved@compile time.  That might be possible since this is a static
inline function.

Cheers, Andreas

> +{
> +	int offset = inode->i_sb->s_inode_fields[field];
> +
> +	if (!offset)	/* Field not present? */
> +		return NULL;

> +	return ((char *)inode) + offset;
> +}
> +
> +static inline void sb_init_inode_fields(struct super_block *sb, int *fields)
> +{
> +	memcpy(sb->s_inode_fields, fields, sizeof(int) * IF_FIELD_NR);
> +}
> +
> extern struct timespec current_fs_time(struct super_block *sb);
> 
> /*
> -- 
> 1.8.1.4
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
> the body of a message to majordomo at vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html


Cheers, Andreas





-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: Message signed with OpenPGP using GPGMail
Url : http://oss.oracle.com/pipermail/ocfs2-devel/attachments/20141001/67c9609c/attachment.bin 

^ permalink raw reply	[flat|nested] 80+ messages in thread

* [Cluster-devel] [PATCH 04/12] fs: Generic infrastructure for optional inode fields
@ 2014-10-01 21:05     ` Andreas Dilger
  0 siblings, 0 replies; 80+ messages in thread
From: Andreas Dilger @ 2014-10-01 21:05 UTC (permalink / raw)
  To: cluster-devel.redhat.com

On Oct 1, 2014, at 1:31 PM, Jan Kara <jack@suse.cz> wrote:
> There are parts of struct inode which are used only by a few filesystems
> (e.g. i_dquot pointers, i_mapping->private_list, ...). Thus all the
> other filesystems are just wasting memory with these fields. On the
> other hand it isn't simple to just move these fields to filesystem
> specific part of inode because there is generic code which needs to peek
> into the fields and it is cumbersome to provide helpers into which fs
> has to stuff the field it is storing elsewhere.
> 
> We create a simple infrastructure which allows for optional inode fields
> stored in the fs-specific part of the inode. Accessing these fields has
> a slightly worse performance as we have to lookup their offset in the
> offset table stored in the superblock but in most cases this is
> acceptable. Notably, this offset-table mechanism is faster than having
> fs-specific hook functions which would need to be called to provide
> pointers to desired fields.
> 
> Signed-off-by: Jan Kara <jack@suse.cz>
> ---
> include/linux/fs.h | 24 ++++++++++++++++++++++++
> 1 file changed, 24 insertions(+)
> 
> diff --git a/include/linux/fs.h b/include/linux/fs.h
> index 94187721ad41..977f8fb6ca88 100644
> --- a/include/linux/fs.h
> +++ b/include/linux/fs.h
> @@ -615,6 +615,11 @@ struct inode {
> 	void			*i_private; /* fs or device private pointer */
> };
> 
> +/* Optional inode fields (stored in filesystems inode if the fs needs them) */
> +enum {

This should be a named enum, like "enum inode_field" or similar, so it
can be referenced below.

> +	IF_FIELD_NR	/* Number of optional inode fields */
> +};
> +
> static inline int inode_unhashed(struct inode *inode)
> {
> 	return hlist_unhashed(&inode->i_hash);
> @@ -1236,6 +1241,11 @@ struct super_block {
> 	void 			*s_fs_info;	/* Filesystem private info */
> 	unsigned int		s_max_links;
> 	fmode_t			s_mode;
> +	/*
> +	 * We could have here just a pointer to the offsets array but this
> +	 * way we save one dereference when looking up field offsets
> +	 */
> +	int			s_inode_fields[IF_FIELD_NR];
> 
> 	/* Granularity of c/m/atime in ns.
> 	   Cannot be worse than a second */
> @@ -1286,6 +1296,20 @@ struct super_block {
> 	struct rcu_head		rcu;
> };
> 
> +static inline void *inode_field(const struct inode *inode, int field)

This should use "enum inode_field" instead of int, so the compiler could
warn about invalid parameter values.  It might make sense to add a check:

        if (field < IF_FIELD_NR)

but I'm not sure if the overhead is worthwhile, unless it can always be
resolved@compile time.  That might be possible since this is a static
inline function.

Cheers, Andreas

> +{
> +	int offset = inode->i_sb->s_inode_fields[field];
> +
> +	if (!offset)	/* Field not present? */
> +		return NULL;

> +	return ((char *)inode) + offset;
> +}
> +
> +static inline void sb_init_inode_fields(struct super_block *sb, int *fields)
> +{
> +	memcpy(sb->s_inode_fields, fields, sizeof(int) * IF_FIELD_NR);
> +}
> +
> extern struct timespec current_fs_time(struct super_block *sb);
> 
> /*
> -- 
> 1.8.1.4
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
> the body of a message to majordomo at vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html


Cheers, Andreas





-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://listman.redhat.com/archives/cluster-devel/attachments/20141001/67c9609c/attachment.sig>

^ permalink raw reply	[flat|nested] 80+ messages in thread

* Re: [PATCH 02/12] gfs2: Set allowed quota types
  2014-10-01 19:31   ` Jan Kara
  (?)
  (?)
@ 2014-10-02 10:41     ` Steven Whitehouse
  -1 siblings, 0 replies; 80+ messages in thread
From: Steven Whitehouse @ 2014-10-02 10:41 UTC (permalink / raw)
  To: Jan Kara, linux-fsdevel
  Cc: Dave Kleikamp, jfs-discussion, tytso, Jeff Mahoney, Dave Chinner,
	reiserfs-devel, xfs, cluster-devel, linux-ext4, ocfs2-devel

Hi,

On 01/10/14 20:31, Jan Kara wrote:
> We support user and group quotas. Tell vfs about it.
>
> CC: Steven Whitehouse <swhiteho@redhat.com>
> CC: cluster-devel@redhat.com
> Signed-off-by: Jan Kara <jack@suse.cz>
> ---
>   fs/gfs2/ops_fstype.c | 1 +
>   1 file changed, 1 insertion(+)
Acked-by: Steven Whitehouse <swhiteho@redhat.com>

Steve.

> diff --git a/fs/gfs2/ops_fstype.c b/fs/gfs2/ops_fstype.c
> index d3eae244076e..3032e6d069b5 100644
> --- a/fs/gfs2/ops_fstype.c
> +++ b/fs/gfs2/ops_fstype.c
> @@ -1083,6 +1083,7 @@ static int fill_super(struct super_block *sb, struct gfs2_args *args, int silent
>   	sb->s_xattr = gfs2_xattr_handlers;
>   	sb->s_qcop = &gfs2_quotactl_ops;
>   	sb_dqopt(sb)->flags |= DQUOT_QUOTA_SYS_FILE;
> +	sb_dqopt(sb)->allowed_types = (1 << USRQUOTA) | (1 << GRPQUOTA);
>   	sb->s_time_gran = 1;
>   	sb->s_maxbytes = MAX_LFS_FILESIZE;
>   

^ permalink raw reply	[flat|nested] 80+ messages in thread

* Re: [PATCH 02/12] gfs2: Set allowed quota types
@ 2014-10-02 10:41     ` Steven Whitehouse
  0 siblings, 0 replies; 80+ messages in thread
From: Steven Whitehouse @ 2014-10-02 10:41 UTC (permalink / raw)
  To: Jan Kara, linux-fsdevel
  Cc: Dave Kleikamp, jfs-discussion, tytso, Jeff Mahoney, Mark Fasheh,
	reiserfs-devel, xfs, cluster-devel, Joel Becker, linux-ext4,
	ocfs2-devel

Hi,

On 01/10/14 20:31, Jan Kara wrote:
> We support user and group quotas. Tell vfs about it.
>
> CC: Steven Whitehouse <swhiteho@redhat.com>
> CC: cluster-devel@redhat.com
> Signed-off-by: Jan Kara <jack@suse.cz>
> ---
>   fs/gfs2/ops_fstype.c | 1 +
>   1 file changed, 1 insertion(+)
Acked-by: Steven Whitehouse <swhiteho@redhat.com>

Steve.

> diff --git a/fs/gfs2/ops_fstype.c b/fs/gfs2/ops_fstype.c
> index d3eae244076e..3032e6d069b5 100644
> --- a/fs/gfs2/ops_fstype.c
> +++ b/fs/gfs2/ops_fstype.c
> @@ -1083,6 +1083,7 @@ static int fill_super(struct super_block *sb, struct gfs2_args *args, int silent
>   	sb->s_xattr = gfs2_xattr_handlers;
>   	sb->s_qcop = &gfs2_quotactl_ops;
>   	sb_dqopt(sb)->flags |= DQUOT_QUOTA_SYS_FILE;
> +	sb_dqopt(sb)->allowed_types = (1 << USRQUOTA) | (1 << GRPQUOTA);
>   	sb->s_time_gran = 1;
>   	sb->s_maxbytes = MAX_LFS_FILESIZE;
>   

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 80+ messages in thread

* [Ocfs2-devel] [PATCH 02/12] gfs2: Set allowed quota types
@ 2014-10-02 10:41     ` Steven Whitehouse
  0 siblings, 0 replies; 80+ messages in thread
From: Steven Whitehouse @ 2014-10-02 10:41 UTC (permalink / raw)
  To: Jan Kara, linux-fsdevel
  Cc: Dave Kleikamp, jfs-discussion, tytso, Jeff Mahoney, Dave Chinner,
	reiserfs-devel, xfs, cluster-devel, linux-ext4, ocfs2-devel

Hi,

On 01/10/14 20:31, Jan Kara wrote:
> We support user and group quotas. Tell vfs about it.
>
> CC: Steven Whitehouse <swhiteho@redhat.com>
> CC: cluster-devel at redhat.com
> Signed-off-by: Jan Kara <jack@suse.cz>
> ---
>   fs/gfs2/ops_fstype.c | 1 +
>   1 file changed, 1 insertion(+)
Acked-by: Steven Whitehouse <swhiteho@redhat.com>

Steve.

> diff --git a/fs/gfs2/ops_fstype.c b/fs/gfs2/ops_fstype.c
> index d3eae244076e..3032e6d069b5 100644
> --- a/fs/gfs2/ops_fstype.c
> +++ b/fs/gfs2/ops_fstype.c
> @@ -1083,6 +1083,7 @@ static int fill_super(struct super_block *sb, struct gfs2_args *args, int silent
>   	sb->s_xattr = gfs2_xattr_handlers;
>   	sb->s_qcop = &gfs2_quotactl_ops;
>   	sb_dqopt(sb)->flags |= DQUOT_QUOTA_SYS_FILE;
> +	sb_dqopt(sb)->allowed_types = (1 << USRQUOTA) | (1 << GRPQUOTA);
>   	sb->s_time_gran = 1;
>   	sb->s_maxbytes = MAX_LFS_FILESIZE;
>   

^ permalink raw reply	[flat|nested] 80+ messages in thread

* [Cluster-devel] [PATCH 02/12] gfs2: Set allowed quota types
@ 2014-10-02 10:41     ` Steven Whitehouse
  0 siblings, 0 replies; 80+ messages in thread
From: Steven Whitehouse @ 2014-10-02 10:41 UTC (permalink / raw)
  To: cluster-devel.redhat.com

Hi,

On 01/10/14 20:31, Jan Kara wrote:
> We support user and group quotas. Tell vfs about it.
>
> CC: Steven Whitehouse <swhiteho@redhat.com>
> CC: cluster-devel at redhat.com
> Signed-off-by: Jan Kara <jack@suse.cz>
> ---
>   fs/gfs2/ops_fstype.c | 1 +
>   1 file changed, 1 insertion(+)
Acked-by: Steven Whitehouse <swhiteho@redhat.com>

Steve.

> diff --git a/fs/gfs2/ops_fstype.c b/fs/gfs2/ops_fstype.c
> index d3eae244076e..3032e6d069b5 100644
> --- a/fs/gfs2/ops_fstype.c
> +++ b/fs/gfs2/ops_fstype.c
> @@ -1083,6 +1083,7 @@ static int fill_super(struct super_block *sb, struct gfs2_args *args, int silent
>   	sb->s_xattr = gfs2_xattr_handlers;
>   	sb->s_qcop = &gfs2_quotactl_ops;
>   	sb_dqopt(sb)->flags |= DQUOT_QUOTA_SYS_FILE;
> +	sb_dqopt(sb)->allowed_types = (1 << USRQUOTA) | (1 << GRPQUOTA);
>   	sb->s_time_gran = 1;
>   	sb->s_maxbytes = MAX_LFS_FILESIZE;
>   



^ permalink raw reply	[flat|nested] 80+ messages in thread

* Re: [PATCH 03/12] xfs: Set allowed quota types
  2014-10-01 19:31   ` Jan Kara
  (?)
@ 2014-10-06 20:30     ` Dave Chinner
  -1 siblings, 0 replies; 80+ messages in thread
From: Dave Chinner @ 2014-10-06 20:30 UTC (permalink / raw)
  To: Jan Kara
  Cc: Dave Kleikamp, jfs-discussion, tytso, Jeff Mahoney, Mark Fasheh,
	reiserfs-devel, xfs, cluster-devel, Joel Becker, linux-fsdevel,
	linux-ext4, Steven Whitehouse, ocfs2-devel

On Wed, Oct 01, 2014 at 09:31:25PM +0200, Jan Kara wrote:
> We support user, group, and project quotas. Tell VFS about it.
> 
> CC: xfs@oss.sgi.com
> CC: Dave Chinner <david@fromorbit.com>
> Signed-off-by: Jan Kara <jack@suse.cz>
> ---
>  fs/xfs/xfs_super.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c
> index b194652033cd..b32e998e8cbc 100644
> --- a/fs/xfs/xfs_super.c
> +++ b/fs/xfs/xfs_super.c
> @@ -1419,6 +1419,8 @@ xfs_fs_fill_super(
>  	sb->s_export_op = &xfs_export_operations;
>  #ifdef CONFIG_XFS_QUOTA
>  	sb->s_qcop = &xfs_quotactl_operations;
> +	sb->s_dquot.allowed_types = (1 << USRQUOTA) | (1 << GRPQUOTA) |
> +				    (1 << PRJQUOTA);

Would it be better to define masks for these rather than open
coding these shifts everywhere?

Cheers,

Dave.
-- 
Dave Chinner
david@fromorbit.com

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 80+ messages in thread

* [Ocfs2-devel] [PATCH 03/12] xfs: Set allowed quota types
@ 2014-10-06 20:30     ` Dave Chinner
  0 siblings, 0 replies; 80+ messages in thread
From: Dave Chinner @ 2014-10-06 20:30 UTC (permalink / raw)
  To: Jan Kara
  Cc: Dave Kleikamp, jfs-discussion, tytso, Jeff Mahoney, Mark Fasheh,
	reiserfs-devel, xfs, cluster-devel, Joel Becker, linux-fsdevel,
	linux-ext4, Steven Whitehouse, ocfs2-devel

On Wed, Oct 01, 2014 at 09:31:25PM +0200, Jan Kara wrote:
> We support user, group, and project quotas. Tell VFS about it.
> 
> CC: xfs at oss.sgi.com
> CC: Dave Chinner <david@fromorbit.com>
> Signed-off-by: Jan Kara <jack@suse.cz>
> ---
>  fs/xfs/xfs_super.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c
> index b194652033cd..b32e998e8cbc 100644
> --- a/fs/xfs/xfs_super.c
> +++ b/fs/xfs/xfs_super.c
> @@ -1419,6 +1419,8 @@ xfs_fs_fill_super(
>  	sb->s_export_op = &xfs_export_operations;
>  #ifdef CONFIG_XFS_QUOTA
>  	sb->s_qcop = &xfs_quotactl_operations;
> +	sb->s_dquot.allowed_types = (1 << USRQUOTA) | (1 << GRPQUOTA) |
> +				    (1 << PRJQUOTA);

Would it be better to define masks for these rather than open
coding these shifts everywhere?

Cheers,

Dave.
-- 
Dave Chinner
david@fromorbit.com

^ permalink raw reply	[flat|nested] 80+ messages in thread

* [Cluster-devel] [PATCH 03/12] xfs: Set allowed quota types
@ 2014-10-06 20:30     ` Dave Chinner
  0 siblings, 0 replies; 80+ messages in thread
From: Dave Chinner @ 2014-10-06 20:30 UTC (permalink / raw)
  To: cluster-devel.redhat.com

On Wed, Oct 01, 2014 at 09:31:25PM +0200, Jan Kara wrote:
> We support user, group, and project quotas. Tell VFS about it.
> 
> CC: xfs at oss.sgi.com
> CC: Dave Chinner <david@fromorbit.com>
> Signed-off-by: Jan Kara <jack@suse.cz>
> ---
>  fs/xfs/xfs_super.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c
> index b194652033cd..b32e998e8cbc 100644
> --- a/fs/xfs/xfs_super.c
> +++ b/fs/xfs/xfs_super.c
> @@ -1419,6 +1419,8 @@ xfs_fs_fill_super(
>  	sb->s_export_op = &xfs_export_operations;
>  #ifdef CONFIG_XFS_QUOTA
>  	sb->s_qcop = &xfs_quotactl_operations;
> +	sb->s_dquot.allowed_types = (1 << USRQUOTA) | (1 << GRPQUOTA) |
> +				    (1 << PRJQUOTA);

Would it be better to define masks for these rather than open
coding these shifts everywhere?

Cheers,

Dave.
-- 
Dave Chinner
david@fromorbit.com



^ permalink raw reply	[flat|nested] 80+ messages in thread

* Re: [PATCH 03/12] xfs: Set allowed quota types
  2014-10-06 20:30     ` [Ocfs2-devel] " Dave Chinner
  (?)
@ 2014-10-07 19:29       ` Jan Kara
  -1 siblings, 0 replies; 80+ messages in thread
From: Jan Kara @ 2014-10-07 19:29 UTC (permalink / raw)
  To: Dave Chinner
  Cc: Dave Kleikamp, jfs-discussion, Jan Kara, Jeff Mahoney,
	Mark Fasheh, reiserfs-devel, xfs, cluster-devel, Joel Becker,
	linux-fsdevel, tytso, linux-ext4, Steven Whitehouse, ocfs2-devel

On Tue 07-10-14 07:30:28, Dave Chinner wrote:
> On Wed, Oct 01, 2014 at 09:31:25PM +0200, Jan Kara wrote:
> > We support user, group, and project quotas. Tell VFS about it.
> > 
> > CC: xfs@oss.sgi.com
> > CC: Dave Chinner <david@fromorbit.com>
> > Signed-off-by: Jan Kara <jack@suse.cz>
> > ---
> >  fs/xfs/xfs_super.c | 2 ++
> >  1 file changed, 2 insertions(+)
> > 
> > diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c
> > index b194652033cd..b32e998e8cbc 100644
> > --- a/fs/xfs/xfs_super.c
> > +++ b/fs/xfs/xfs_super.c
> > @@ -1419,6 +1419,8 @@ xfs_fs_fill_super(
> >  	sb->s_export_op = &xfs_export_operations;
> >  #ifdef CONFIG_XFS_QUOTA
> >  	sb->s_qcop = &xfs_quotactl_operations;
> > +	sb->s_dquot.allowed_types = (1 << USRQUOTA) | (1 << GRPQUOTA) |
> > +				    (1 << PRJQUOTA);
> 
> Would it be better to define masks for these rather than open
> coding these shifts everywhere?
  I can do that. Any suggestion for a name? I was thinking about it for a
while and couldn't come up with anything satisfactory...

								Honza
-- 
Jan Kara <jack@suse.cz>
SUSE Labs, CR

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 80+ messages in thread

* [Ocfs2-devel] [PATCH 03/12] xfs: Set allowed quota types
@ 2014-10-07 19:29       ` Jan Kara
  0 siblings, 0 replies; 80+ messages in thread
From: Jan Kara @ 2014-10-07 19:29 UTC (permalink / raw)
  To: Dave Chinner
  Cc: Dave Kleikamp, jfs-discussion, Jan Kara, Jeff Mahoney,
	Mark Fasheh, reiserfs-devel, xfs, cluster-devel, Joel Becker,
	linux-fsdevel, tytso, linux-ext4, Steven Whitehouse, ocfs2-devel

On Tue 07-10-14 07:30:28, Dave Chinner wrote:
> On Wed, Oct 01, 2014 at 09:31:25PM +0200, Jan Kara wrote:
> > We support user, group, and project quotas. Tell VFS about it.
> > 
> > CC: xfs at oss.sgi.com
> > CC: Dave Chinner <david@fromorbit.com>
> > Signed-off-by: Jan Kara <jack@suse.cz>
> > ---
> >  fs/xfs/xfs_super.c | 2 ++
> >  1 file changed, 2 insertions(+)
> > 
> > diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c
> > index b194652033cd..b32e998e8cbc 100644
> > --- a/fs/xfs/xfs_super.c
> > +++ b/fs/xfs/xfs_super.c
> > @@ -1419,6 +1419,8 @@ xfs_fs_fill_super(
> >  	sb->s_export_op = &xfs_export_operations;
> >  #ifdef CONFIG_XFS_QUOTA
> >  	sb->s_qcop = &xfs_quotactl_operations;
> > +	sb->s_dquot.allowed_types = (1 << USRQUOTA) | (1 << GRPQUOTA) |
> > +				    (1 << PRJQUOTA);
> 
> Would it be better to define masks for these rather than open
> coding these shifts everywhere?
  I can do that. Any suggestion for a name? I was thinking about it for a
while and couldn't come up with anything satisfactory...

								Honza
-- 
Jan Kara <jack@suse.cz>
SUSE Labs, CR

^ permalink raw reply	[flat|nested] 80+ messages in thread

* [Cluster-devel] [PATCH 03/12] xfs: Set allowed quota types
@ 2014-10-07 19:29       ` Jan Kara
  0 siblings, 0 replies; 80+ messages in thread
From: Jan Kara @ 2014-10-07 19:29 UTC (permalink / raw)
  To: cluster-devel.redhat.com

On Tue 07-10-14 07:30:28, Dave Chinner wrote:
> On Wed, Oct 01, 2014 at 09:31:25PM +0200, Jan Kara wrote:
> > We support user, group, and project quotas. Tell VFS about it.
> > 
> > CC: xfs at oss.sgi.com
> > CC: Dave Chinner <david@fromorbit.com>
> > Signed-off-by: Jan Kara <jack@suse.cz>
> > ---
> >  fs/xfs/xfs_super.c | 2 ++
> >  1 file changed, 2 insertions(+)
> > 
> > diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c
> > index b194652033cd..b32e998e8cbc 100644
> > --- a/fs/xfs/xfs_super.c
> > +++ b/fs/xfs/xfs_super.c
> > @@ -1419,6 +1419,8 @@ xfs_fs_fill_super(
> >  	sb->s_export_op = &xfs_export_operations;
> >  #ifdef CONFIG_XFS_QUOTA
> >  	sb->s_qcop = &xfs_quotactl_operations;
> > +	sb->s_dquot.allowed_types = (1 << USRQUOTA) | (1 << GRPQUOTA) |
> > +				    (1 << PRJQUOTA);
> 
> Would it be better to define masks for these rather than open
> coding these shifts everywhere?
  I can do that. Any suggestion for a name? I was thinking about it for a
while and couldn't come up with anything satisfactory...

								Honza
-- 
Jan Kara <jack@suse.cz>
SUSE Labs, CR



^ permalink raw reply	[flat|nested] 80+ messages in thread

* Re: [PATCH 03/12] xfs: Set allowed quota types
  2014-10-07 19:29       ` [Ocfs2-devel] " Jan Kara
  (?)
  (?)
@ 2014-10-07 19:46         ` Andreas Dilger
  -1 siblings, 0 replies; 80+ messages in thread
From: Andreas Dilger @ 2014-10-07 19:46 UTC (permalink / raw)
  To: Jan Kara
  Cc: Dave Chinner, linux-fsdevel, Ext4 Developers List, xfs,
	cluster-devel, Steven Whitehouse, Mark Fasheh, Joel Becker,
	ocfs2-devel, reiserfs-devel, Jeff Mahoney, Dave Kleikamp,
	jfs-discussion, tytso

[-- Attachment #1: Type: text/plain, Size: 1573 bytes --]

On Oct 7, 2014, at 1:29 PM, Jan Kara <jack@suse.cz> wrote:
> On Tue 07-10-14 07:30:28, Dave Chinner wrote:
>> On Wed, Oct 01, 2014 at 09:31:25PM +0200, Jan Kara wrote:
>>> We support user, group, and project quotas. Tell VFS about it.
>>> 
>>> CC: xfs@oss.sgi.com
>>> CC: Dave Chinner <david@fromorbit.com>
>>> Signed-off-by: Jan Kara <jack@suse.cz>
>>> ---
>>> fs/xfs/xfs_super.c | 2 ++
>>> 1 file changed, 2 insertions(+)
>>> 
>>> diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c
>>> index b194652033cd..b32e998e8cbc 100644
>>> --- a/fs/xfs/xfs_super.c
>>> +++ b/fs/xfs/xfs_super.c
>>> @@ -1419,6 +1419,8 @@ xfs_fs_fill_super(
>>> 	sb->s_export_op = &xfs_export_operations;
>>> #ifdef CONFIG_XFS_QUOTA
>>> 	sb->s_qcop = &xfs_quotactl_operations;
>>> +	sb->s_dquot.allowed_types = (1 << USRQUOTA) | (1 << GRPQUOTA) |
>>> +				    (1 << PRJQUOTA);
>> 
>> Would it be better to define masks for these rather than open
>> coding these shifts everywhere?
>  I can do that. Any suggestion for a name? I was thinking about it for a
> while and couldn't come up with anything satisfactory...

Better to have QUOTA at the start, and TYPE in the name, so maybe:

enum quota_types {
	QUOTA_TYPE_USR = 1 << USRQUOTA,
	QUOTA_TYPE_GRP = 1 << GRPQUOTA,
	QUOTA_TYPE_PRJ = 1 << PRJQUOTA,
};

or maybe "enum quota_type_mask" or similar.

I prefer named enums over #defines since this makes it more clear
when declaring variables like "allowed_types" what valid values are
instead of just "int" that someone might mistakenly set to USRQUOTA
directly or something.

Cheers, Andreas






[-- Attachment #2: Message signed with OpenPGP using GPGMail --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 80+ messages in thread

* Re: [PATCH 03/12] xfs: Set allowed quota types
@ 2014-10-07 19:46         ` Andreas Dilger
  0 siblings, 0 replies; 80+ messages in thread
From: Andreas Dilger @ 2014-10-07 19:46 UTC (permalink / raw)
  To: Jan Kara
  Cc: Dave Kleikamp, jfs-discussion, tytso, Jeff Mahoney, Mark Fasheh,
	reiserfs-devel, xfs, cluster-devel, Joel Becker, linux-fsdevel,
	Ext4 Developers List, Steven Whitehouse, ocfs2-devel


[-- Attachment #1.1: Type: text/plain, Size: 1573 bytes --]

On Oct 7, 2014, at 1:29 PM, Jan Kara <jack@suse.cz> wrote:
> On Tue 07-10-14 07:30:28, Dave Chinner wrote:
>> On Wed, Oct 01, 2014 at 09:31:25PM +0200, Jan Kara wrote:
>>> We support user, group, and project quotas. Tell VFS about it.
>>> 
>>> CC: xfs@oss.sgi.com
>>> CC: Dave Chinner <david@fromorbit.com>
>>> Signed-off-by: Jan Kara <jack@suse.cz>
>>> ---
>>> fs/xfs/xfs_super.c | 2 ++
>>> 1 file changed, 2 insertions(+)
>>> 
>>> diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c
>>> index b194652033cd..b32e998e8cbc 100644
>>> --- a/fs/xfs/xfs_super.c
>>> +++ b/fs/xfs/xfs_super.c
>>> @@ -1419,6 +1419,8 @@ xfs_fs_fill_super(
>>> 	sb->s_export_op = &xfs_export_operations;
>>> #ifdef CONFIG_XFS_QUOTA
>>> 	sb->s_qcop = &xfs_quotactl_operations;
>>> +	sb->s_dquot.allowed_types = (1 << USRQUOTA) | (1 << GRPQUOTA) |
>>> +				    (1 << PRJQUOTA);
>> 
>> Would it be better to define masks for these rather than open
>> coding these shifts everywhere?
>  I can do that. Any suggestion for a name? I was thinking about it for a
> while and couldn't come up with anything satisfactory...

Better to have QUOTA at the start, and TYPE in the name, so maybe:

enum quota_types {
	QUOTA_TYPE_USR = 1 << USRQUOTA,
	QUOTA_TYPE_GRP = 1 << GRPQUOTA,
	QUOTA_TYPE_PRJ = 1 << PRJQUOTA,
};

or maybe "enum quota_type_mask" or similar.

I prefer named enums over #defines since this makes it more clear
when declaring variables like "allowed_types" what valid values are
instead of just "int" that someone might mistakenly set to USRQUOTA
directly or something.

Cheers, Andreas






[-- Attachment #1.2: Message signed with OpenPGP using GPGMail --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

[-- Attachment #2: Type: text/plain, Size: 121 bytes --]

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 80+ messages in thread

* [Ocfs2-devel] [PATCH 03/12] xfs: Set allowed quota types
@ 2014-10-07 19:46         ` Andreas Dilger
  0 siblings, 0 replies; 80+ messages in thread
From: Andreas Dilger @ 2014-10-07 19:46 UTC (permalink / raw)
  To: Jan Kara
  Cc: Dave Chinner, linux-fsdevel, Ext4 Developers List, xfs,
	cluster-devel, Steven Whitehouse, Mark Fasheh, Joel Becker,
	ocfs2-devel, reiserfs-devel, Jeff Mahoney, Dave Kleikamp,
	jfs-discussion, tytso

On Oct 7, 2014, at 1:29 PM, Jan Kara <jack@suse.cz> wrote:
> On Tue 07-10-14 07:30:28, Dave Chinner wrote:
>> On Wed, Oct 01, 2014 at 09:31:25PM +0200, Jan Kara wrote:
>>> We support user, group, and project quotas. Tell VFS about it.
>>> 
>>> CC: xfs at oss.sgi.com
>>> CC: Dave Chinner <david@fromorbit.com>
>>> Signed-off-by: Jan Kara <jack@suse.cz>
>>> ---
>>> fs/xfs/xfs_super.c | 2 ++
>>> 1 file changed, 2 insertions(+)
>>> 
>>> diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c
>>> index b194652033cd..b32e998e8cbc 100644
>>> --- a/fs/xfs/xfs_super.c
>>> +++ b/fs/xfs/xfs_super.c
>>> @@ -1419,6 +1419,8 @@ xfs_fs_fill_super(
>>> 	sb->s_export_op = &xfs_export_operations;
>>> #ifdef CONFIG_XFS_QUOTA
>>> 	sb->s_qcop = &xfs_quotactl_operations;
>>> +	sb->s_dquot.allowed_types = (1 << USRQUOTA) | (1 << GRPQUOTA) |
>>> +				    (1 << PRJQUOTA);
>> 
>> Would it be better to define masks for these rather than open
>> coding these shifts everywhere?
>  I can do that. Any suggestion for a name? I was thinking about it for a
> while and couldn't come up with anything satisfactory...

Better to have QUOTA at the start, and TYPE in the name, so maybe:

enum quota_types {
	QUOTA_TYPE_USR = 1 << USRQUOTA,
	QUOTA_TYPE_GRP = 1 << GRPQUOTA,
	QUOTA_TYPE_PRJ = 1 << PRJQUOTA,
};

or maybe "enum quota_type_mask" or similar.

I prefer named enums over #defines since this makes it more clear
when declaring variables like "allowed_types" what valid values are
instead of just "int" that someone might mistakenly set to USRQUOTA
directly or something.

Cheers, Andreas





-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: Message signed with OpenPGP using GPGMail
Url : http://oss.oracle.com/pipermail/ocfs2-devel/attachments/20141007/c17bf453/attachment.bin 

^ permalink raw reply	[flat|nested] 80+ messages in thread

* [Cluster-devel] [PATCH 03/12] xfs: Set allowed quota types
@ 2014-10-07 19:46         ` Andreas Dilger
  0 siblings, 0 replies; 80+ messages in thread
From: Andreas Dilger @ 2014-10-07 19:46 UTC (permalink / raw)
  To: cluster-devel.redhat.com

On Oct 7, 2014, at 1:29 PM, Jan Kara <jack@suse.cz> wrote:
> On Tue 07-10-14 07:30:28, Dave Chinner wrote:
>> On Wed, Oct 01, 2014 at 09:31:25PM +0200, Jan Kara wrote:
>>> We support user, group, and project quotas. Tell VFS about it.
>>> 
>>> CC: xfs at oss.sgi.com
>>> CC: Dave Chinner <david@fromorbit.com>
>>> Signed-off-by: Jan Kara <jack@suse.cz>
>>> ---
>>> fs/xfs/xfs_super.c | 2 ++
>>> 1 file changed, 2 insertions(+)
>>> 
>>> diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c
>>> index b194652033cd..b32e998e8cbc 100644
>>> --- a/fs/xfs/xfs_super.c
>>> +++ b/fs/xfs/xfs_super.c
>>> @@ -1419,6 +1419,8 @@ xfs_fs_fill_super(
>>> 	sb->s_export_op = &xfs_export_operations;
>>> #ifdef CONFIG_XFS_QUOTA
>>> 	sb->s_qcop = &xfs_quotactl_operations;
>>> +	sb->s_dquot.allowed_types = (1 << USRQUOTA) | (1 << GRPQUOTA) |
>>> +				    (1 << PRJQUOTA);
>> 
>> Would it be better to define masks for these rather than open
>> coding these shifts everywhere?
>  I can do that. Any suggestion for a name? I was thinking about it for a
> while and couldn't come up with anything satisfactory...

Better to have QUOTA at the start, and TYPE in the name, so maybe:

enum quota_types {
	QUOTA_TYPE_USR = 1 << USRQUOTA,
	QUOTA_TYPE_GRP = 1 << GRPQUOTA,
	QUOTA_TYPE_PRJ = 1 << PRJQUOTA,
};

or maybe "enum quota_type_mask" or similar.

I prefer named enums over #defines since this makes it more clear
when declaring variables like "allowed_types" what valid values are
instead of just "int" that someone might mistakenly set to USRQUOTA
directly or something.

Cheers, Andreas





-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://listman.redhat.com/archives/cluster-devel/attachments/20141007/c17bf453/attachment.sig>

^ permalink raw reply	[flat|nested] 80+ messages in thread

* Re: [PATCH 03/12] xfs: Set allowed quota types
  2014-10-07 19:46         ` Andreas Dilger
  (?)
  (?)
@ 2014-10-08  8:42           ` Jan Kara
  -1 siblings, 0 replies; 80+ messages in thread
From: Jan Kara @ 2014-10-08  8:42 UTC (permalink / raw)
  To: Andreas Dilger
  Cc: Jan Kara, Dave Chinner, linux-fsdevel, Ext4 Developers List, xfs,
	cluster-devel, Steven Whitehouse, Mark Fasheh, Joel Becker,
	ocfs2-devel, reiserfs-devel, Jeff Mahoney, Dave Kleikamp,
	jfs-discussion, tytso

On Tue 07-10-14 13:46:20, Andreas Dilger wrote:
> On Oct 7, 2014, at 1:29 PM, Jan Kara <jack@suse.cz> wrote:
> > On Tue 07-10-14 07:30:28, Dave Chinner wrote:
> >> On Wed, Oct 01, 2014 at 09:31:25PM +0200, Jan Kara wrote:
> >>> We support user, group, and project quotas. Tell VFS about it.
> >>> 
> >>> CC: xfs@oss.sgi.com
> >>> CC: Dave Chinner <david@fromorbit.com>
> >>> Signed-off-by: Jan Kara <jack@suse.cz>
> >>> ---
> >>> fs/xfs/xfs_super.c | 2 ++
> >>> 1 file changed, 2 insertions(+)
> >>> 
> >>> diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c
> >>> index b194652033cd..b32e998e8cbc 100644
> >>> --- a/fs/xfs/xfs_super.c
> >>> +++ b/fs/xfs/xfs_super.c
> >>> @@ -1419,6 +1419,8 @@ xfs_fs_fill_super(
> >>> 	sb->s_export_op = &xfs_export_operations;
> >>> #ifdef CONFIG_XFS_QUOTA
> >>> 	sb->s_qcop = &xfs_quotactl_operations;
> >>> +	sb->s_dquot.allowed_types = (1 << USRQUOTA) | (1 << GRPQUOTA) |
> >>> +				    (1 << PRJQUOTA);
> >> 
> >> Would it be better to define masks for these rather than open
> >> coding these shifts everywhere?
> >  I can do that. Any suggestion for a name? I was thinking about it for a
> > while and couldn't come up with anything satisfactory...
> 
> Better to have QUOTA at the start, and TYPE in the name, so maybe:
> 
> enum quota_types {
> 	QUOTA_TYPE_USR = 1 << USRQUOTA,
> 	QUOTA_TYPE_GRP = 1 << GRPQUOTA,
> 	QUOTA_TYPE_PRJ = 1 << PRJQUOTA,
> };
> 
> or maybe "enum quota_type_mask" or similar.
> 
> I prefer named enums over #defines since this makes it more clear
> when declaring variables like "allowed_types" what valid values are
> instead of just "int" that someone might mistakenly set to USRQUOTA
> directly or something.
  OK, QUOTA_TYPE_USR etc. looks good. I'm not so sure about named enum. I'd
be fine with named enum for USRQUOTA, GRPQUOTA, etc. - i.e., types which
should have one of the named values but for a bitmask with arbitrary
combinations of flags it looks confusing to me (although technically
it would work).

								Honza
-- 
Jan Kara <jack@suse.cz>
SUSE Labs, CR

^ permalink raw reply	[flat|nested] 80+ messages in thread

* Re: [PATCH 03/12] xfs: Set allowed quota types
@ 2014-10-08  8:42           ` Jan Kara
  0 siblings, 0 replies; 80+ messages in thread
From: Jan Kara @ 2014-10-08  8:42 UTC (permalink / raw)
  To: Andreas Dilger
  Cc: Dave Kleikamp, jfs-discussion, Jan Kara, Jeff Mahoney,
	Mark Fasheh, reiserfs-devel, xfs, cluster-devel, Joel Becker,
	linux-fsdevel, tytso, Ext4 Developers List, Steven Whitehouse,
	ocfs2-devel

On Tue 07-10-14 13:46:20, Andreas Dilger wrote:
> On Oct 7, 2014, at 1:29 PM, Jan Kara <jack@suse.cz> wrote:
> > On Tue 07-10-14 07:30:28, Dave Chinner wrote:
> >> On Wed, Oct 01, 2014 at 09:31:25PM +0200, Jan Kara wrote:
> >>> We support user, group, and project quotas. Tell VFS about it.
> >>> 
> >>> CC: xfs@oss.sgi.com
> >>> CC: Dave Chinner <david@fromorbit.com>
> >>> Signed-off-by: Jan Kara <jack@suse.cz>
> >>> ---
> >>> fs/xfs/xfs_super.c | 2 ++
> >>> 1 file changed, 2 insertions(+)
> >>> 
> >>> diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c
> >>> index b194652033cd..b32e998e8cbc 100644
> >>> --- a/fs/xfs/xfs_super.c
> >>> +++ b/fs/xfs/xfs_super.c
> >>> @@ -1419,6 +1419,8 @@ xfs_fs_fill_super(
> >>> 	sb->s_export_op = &xfs_export_operations;
> >>> #ifdef CONFIG_XFS_QUOTA
> >>> 	sb->s_qcop = &xfs_quotactl_operations;
> >>> +	sb->s_dquot.allowed_types = (1 << USRQUOTA) | (1 << GRPQUOTA) |
> >>> +				    (1 << PRJQUOTA);
> >> 
> >> Would it be better to define masks for these rather than open
> >> coding these shifts everywhere?
> >  I can do that. Any suggestion for a name? I was thinking about it for a
> > while and couldn't come up with anything satisfactory...
> 
> Better to have QUOTA at the start, and TYPE in the name, so maybe:
> 
> enum quota_types {
> 	QUOTA_TYPE_USR = 1 << USRQUOTA,
> 	QUOTA_TYPE_GRP = 1 << GRPQUOTA,
> 	QUOTA_TYPE_PRJ = 1 << PRJQUOTA,
> };
> 
> or maybe "enum quota_type_mask" or similar.
> 
> I prefer named enums over #defines since this makes it more clear
> when declaring variables like "allowed_types" what valid values are
> instead of just "int" that someone might mistakenly set to USRQUOTA
> directly or something.
  OK, QUOTA_TYPE_USR etc. looks good. I'm not so sure about named enum. I'd
be fine with named enum for USRQUOTA, GRPQUOTA, etc. - i.e., types which
should have one of the named values but for a bitmask with arbitrary
combinations of flags it looks confusing to me (although technically
it would work).

								Honza
-- 
Jan Kara <jack@suse.cz>
SUSE Labs, CR

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 80+ messages in thread

* [Ocfs2-devel] [PATCH 03/12] xfs: Set allowed quota types
@ 2014-10-08  8:42           ` Jan Kara
  0 siblings, 0 replies; 80+ messages in thread
From: Jan Kara @ 2014-10-08  8:42 UTC (permalink / raw)
  To: Andreas Dilger
  Cc: Jan Kara, Dave Chinner, linux-fsdevel, Ext4 Developers List, xfs,
	cluster-devel, Steven Whitehouse, Mark Fasheh, Joel Becker,
	ocfs2-devel, reiserfs-devel, Jeff Mahoney, Dave Kleikamp,
	jfs-discussion, tytso

On Tue 07-10-14 13:46:20, Andreas Dilger wrote:
> On Oct 7, 2014, at 1:29 PM, Jan Kara <jack@suse.cz> wrote:
> > On Tue 07-10-14 07:30:28, Dave Chinner wrote:
> >> On Wed, Oct 01, 2014 at 09:31:25PM +0200, Jan Kara wrote:
> >>> We support user, group, and project quotas. Tell VFS about it.
> >>> 
> >>> CC: xfs at oss.sgi.com
> >>> CC: Dave Chinner <david@fromorbit.com>
> >>> Signed-off-by: Jan Kara <jack@suse.cz>
> >>> ---
> >>> fs/xfs/xfs_super.c | 2 ++
> >>> 1 file changed, 2 insertions(+)
> >>> 
> >>> diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c
> >>> index b194652033cd..b32e998e8cbc 100644
> >>> --- a/fs/xfs/xfs_super.c
> >>> +++ b/fs/xfs/xfs_super.c
> >>> @@ -1419,6 +1419,8 @@ xfs_fs_fill_super(
> >>> 	sb->s_export_op = &xfs_export_operations;
> >>> #ifdef CONFIG_XFS_QUOTA
> >>> 	sb->s_qcop = &xfs_quotactl_operations;
> >>> +	sb->s_dquot.allowed_types = (1 << USRQUOTA) | (1 << GRPQUOTA) |
> >>> +				    (1 << PRJQUOTA);
> >> 
> >> Would it be better to define masks for these rather than open
> >> coding these shifts everywhere?
> >  I can do that. Any suggestion for a name? I was thinking about it for a
> > while and couldn't come up with anything satisfactory...
> 
> Better to have QUOTA at the start, and TYPE in the name, so maybe:
> 
> enum quota_types {
> 	QUOTA_TYPE_USR = 1 << USRQUOTA,
> 	QUOTA_TYPE_GRP = 1 << GRPQUOTA,
> 	QUOTA_TYPE_PRJ = 1 << PRJQUOTA,
> };
> 
> or maybe "enum quota_type_mask" or similar.
> 
> I prefer named enums over #defines since this makes it more clear
> when declaring variables like "allowed_types" what valid values are
> instead of just "int" that someone might mistakenly set to USRQUOTA
> directly or something.
  OK, QUOTA_TYPE_USR etc. looks good. I'm not so sure about named enum. I'd
be fine with named enum for USRQUOTA, GRPQUOTA, etc. - i.e., types which
should have one of the named values but for a bitmask with arbitrary
combinations of flags it looks confusing to me (although technically
it would work).

								Honza
-- 
Jan Kara <jack@suse.cz>
SUSE Labs, CR

^ permalink raw reply	[flat|nested] 80+ messages in thread

* [Cluster-devel] [PATCH 03/12] xfs: Set allowed quota types
@ 2014-10-08  8:42           ` Jan Kara
  0 siblings, 0 replies; 80+ messages in thread
From: Jan Kara @ 2014-10-08  8:42 UTC (permalink / raw)
  To: cluster-devel.redhat.com

On Tue 07-10-14 13:46:20, Andreas Dilger wrote:
> On Oct 7, 2014, at 1:29 PM, Jan Kara <jack@suse.cz> wrote:
> > On Tue 07-10-14 07:30:28, Dave Chinner wrote:
> >> On Wed, Oct 01, 2014 at 09:31:25PM +0200, Jan Kara wrote:
> >>> We support user, group, and project quotas. Tell VFS about it.
> >>> 
> >>> CC: xfs at oss.sgi.com
> >>> CC: Dave Chinner <david@fromorbit.com>
> >>> Signed-off-by: Jan Kara <jack@suse.cz>
> >>> ---
> >>> fs/xfs/xfs_super.c | 2 ++
> >>> 1 file changed, 2 insertions(+)
> >>> 
> >>> diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c
> >>> index b194652033cd..b32e998e8cbc 100644
> >>> --- a/fs/xfs/xfs_super.c
> >>> +++ b/fs/xfs/xfs_super.c
> >>> @@ -1419,6 +1419,8 @@ xfs_fs_fill_super(
> >>> 	sb->s_export_op = &xfs_export_operations;
> >>> #ifdef CONFIG_XFS_QUOTA
> >>> 	sb->s_qcop = &xfs_quotactl_operations;
> >>> +	sb->s_dquot.allowed_types = (1 << USRQUOTA) | (1 << GRPQUOTA) |
> >>> +				    (1 << PRJQUOTA);
> >> 
> >> Would it be better to define masks for these rather than open
> >> coding these shifts everywhere?
> >  I can do that. Any suggestion for a name? I was thinking about it for a
> > while and couldn't come up with anything satisfactory...
> 
> Better to have QUOTA at the start, and TYPE in the name, so maybe:
> 
> enum quota_types {
> 	QUOTA_TYPE_USR = 1 << USRQUOTA,
> 	QUOTA_TYPE_GRP = 1 << GRPQUOTA,
> 	QUOTA_TYPE_PRJ = 1 << PRJQUOTA,
> };
> 
> or maybe "enum quota_type_mask" or similar.
> 
> I prefer named enums over #defines since this makes it more clear
> when declaring variables like "allowed_types" what valid values are
> instead of just "int" that someone might mistakenly set to USRQUOTA
> directly or something.
  OK, QUOTA_TYPE_USR etc. looks good. I'm not so sure about named enum. I'd
be fine with named enum for USRQUOTA, GRPQUOTA, etc. - i.e., types which
should have one of the named values but for a bitmask with arbitrary
combinations of flags it looks confusing to me (although technically
it would work).

								Honza
-- 
Jan Kara <jack@suse.cz>
SUSE Labs, CR



^ permalink raw reply	[flat|nested] 80+ messages in thread

* Re: [PATCH 04/12] fs: Generic infrastructure for optional inode fields
  2014-10-01 21:05     ` Andreas Dilger
  (?)
@ 2014-10-08  8:45       ` Jan Kara
  -1 siblings, 0 replies; 80+ messages in thread
From: Jan Kara @ 2014-10-08  8:45 UTC (permalink / raw)
  To: Andreas Dilger
  Cc: Dave Kleikamp, jfs-discussion, Jan Kara, Jeff Mahoney,
	Mark Fasheh, reiserfs-devel, xfs, cluster-devel, Joel Becker,
	linux-fsdevel, tytso, linux-ext4, Steven Whitehouse, ocfs2-devel

On Wed 01-10-14 15:05:46, Andreas Dilger wrote:
> On Oct 1, 2014, at 1:31 PM, Jan Kara <jack@suse.cz> wrote:
> > There are parts of struct inode which are used only by a few filesystems
> > (e.g. i_dquot pointers, i_mapping->private_list, ...). Thus all the
> > other filesystems are just wasting memory with these fields. On the
> > other hand it isn't simple to just move these fields to filesystem
> > specific part of inode because there is generic code which needs to peek
> > into the fields and it is cumbersome to provide helpers into which fs
> > has to stuff the field it is storing elsewhere.
> > 
> > We create a simple infrastructure which allows for optional inode fields
> > stored in the fs-specific part of the inode. Accessing these fields has
> > a slightly worse performance as we have to lookup their offset in the
> > offset table stored in the superblock but in most cases this is
> > acceptable. Notably, this offset-table mechanism is faster than having
> > fs-specific hook functions which would need to be called to provide
> > pointers to desired fields.
> > 
> > Signed-off-by: Jan Kara <jack@suse.cz>
> > ---
> > include/linux/fs.h | 24 ++++++++++++++++++++++++
> > 1 file changed, 24 insertions(+)
> > 
> > diff --git a/include/linux/fs.h b/include/linux/fs.h
> > index 94187721ad41..977f8fb6ca88 100644
> > --- a/include/linux/fs.h
> > +++ b/include/linux/fs.h
> > @@ -615,6 +615,11 @@ struct inode {
> > 	void			*i_private; /* fs or device private pointer */
> > };
> > 
> > +/* Optional inode fields (stored in filesystems inode if the fs needs them) */
> > +enum {
> 
> This should be a named enum, like "enum inode_field" or similar, so it
> can be referenced below.
> 
> > +	IF_FIELD_NR	/* Number of optional inode fields */
> > +};
> > +
> > static inline int inode_unhashed(struct inode *inode)
> > {
> > 	return hlist_unhashed(&inode->i_hash);
> > @@ -1236,6 +1241,11 @@ struct super_block {
> > 	void 			*s_fs_info;	/* Filesystem private info */
> > 	unsigned int		s_max_links;
> > 	fmode_t			s_mode;
> > +	/*
> > +	 * We could have here just a pointer to the offsets array but this
> > +	 * way we save one dereference when looking up field offsets
> > +	 */
> > +	int			s_inode_fields[IF_FIELD_NR];
> > 
> > 	/* Granularity of c/m/atime in ns.
> > 	   Cannot be worse than a second */
> > @@ -1286,6 +1296,20 @@ struct super_block {
> > 	struct rcu_head		rcu;
> > };
> > 
> > +static inline void *inode_field(const struct inode *inode, int field)
> 
> This should use "enum inode_field" instead of int, so the compiler could
> warn about invalid parameter values.  It might make sense to add a check:
  OK, makes sense.

>         if (field < IF_FIELD_NR)
> 
> but I'm not sure if the overhead is worthwhile, unless it can always be
> resolved at compile time.  That might be possible since this is a static
> inline function.
  Well, I can stick there BUG_ON(field >= IF_FIELD_NR). That looks like a
sensible debugging measure with negligible overhead.

								Honza
> > +{
> > +	int offset = inode->i_sb->s_inode_fields[field];
> > +
> > +	if (!offset)	/* Field not present? */
> > +		return NULL;
> 
> > +	return ((char *)inode) + offset;
> > +}
> > +
> > +static inline void sb_init_inode_fields(struct super_block *sb, int *fields)
> > +{
> > +	memcpy(sb->s_inode_fields, fields, sizeof(int) * IF_FIELD_NR);
> > +}
> > +
> > extern struct timespec current_fs_time(struct super_block *sb);
> > 
> > /*
> > -- 
> > 1.8.1.4
> > 
> > --
> > To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
> > the body of a message to majordomo@vger.kernel.org
> > More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 
> 
> Cheers, Andreas
> 
> 
> 
> 
> 


-- 
Jan Kara <jack@suse.cz>
SUSE Labs, CR

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 80+ messages in thread

* [Ocfs2-devel] [PATCH 04/12] fs: Generic infrastructure for optional inode fields
@ 2014-10-08  8:45       ` Jan Kara
  0 siblings, 0 replies; 80+ messages in thread
From: Jan Kara @ 2014-10-08  8:45 UTC (permalink / raw)
  To: Andreas Dilger
  Cc: Dave Kleikamp, jfs-discussion, Jan Kara, Jeff Mahoney,
	Mark Fasheh, reiserfs-devel, xfs, cluster-devel, Joel Becker,
	linux-fsdevel, tytso, linux-ext4, Steven Whitehouse, ocfs2-devel

On Wed 01-10-14 15:05:46, Andreas Dilger wrote:
> On Oct 1, 2014, at 1:31 PM, Jan Kara <jack@suse.cz> wrote:
> > There are parts of struct inode which are used only by a few filesystems
> > (e.g. i_dquot pointers, i_mapping->private_list, ...). Thus all the
> > other filesystems are just wasting memory with these fields. On the
> > other hand it isn't simple to just move these fields to filesystem
> > specific part of inode because there is generic code which needs to peek
> > into the fields and it is cumbersome to provide helpers into which fs
> > has to stuff the field it is storing elsewhere.
> > 
> > We create a simple infrastructure which allows for optional inode fields
> > stored in the fs-specific part of the inode. Accessing these fields has
> > a slightly worse performance as we have to lookup their offset in the
> > offset table stored in the superblock but in most cases this is
> > acceptable. Notably, this offset-table mechanism is faster than having
> > fs-specific hook functions which would need to be called to provide
> > pointers to desired fields.
> > 
> > Signed-off-by: Jan Kara <jack@suse.cz>
> > ---
> > include/linux/fs.h | 24 ++++++++++++++++++++++++
> > 1 file changed, 24 insertions(+)
> > 
> > diff --git a/include/linux/fs.h b/include/linux/fs.h
> > index 94187721ad41..977f8fb6ca88 100644
> > --- a/include/linux/fs.h
> > +++ b/include/linux/fs.h
> > @@ -615,6 +615,11 @@ struct inode {
> > 	void			*i_private; /* fs or device private pointer */
> > };
> > 
> > +/* Optional inode fields (stored in filesystems inode if the fs needs them) */
> > +enum {
> 
> This should be a named enum, like "enum inode_field" or similar, so it
> can be referenced below.
> 
> > +	IF_FIELD_NR	/* Number of optional inode fields */
> > +};
> > +
> > static inline int inode_unhashed(struct inode *inode)
> > {
> > 	return hlist_unhashed(&inode->i_hash);
> > @@ -1236,6 +1241,11 @@ struct super_block {
> > 	void 			*s_fs_info;	/* Filesystem private info */
> > 	unsigned int		s_max_links;
> > 	fmode_t			s_mode;
> > +	/*
> > +	 * We could have here just a pointer to the offsets array but this
> > +	 * way we save one dereference when looking up field offsets
> > +	 */
> > +	int			s_inode_fields[IF_FIELD_NR];
> > 
> > 	/* Granularity of c/m/atime in ns.
> > 	   Cannot be worse than a second */
> > @@ -1286,6 +1296,20 @@ struct super_block {
> > 	struct rcu_head		rcu;
> > };
> > 
> > +static inline void *inode_field(const struct inode *inode, int field)
> 
> This should use "enum inode_field" instead of int, so the compiler could
> warn about invalid parameter values.  It might make sense to add a check:
  OK, makes sense.

>         if (field < IF_FIELD_NR)
> 
> but I'm not sure if the overhead is worthwhile, unless it can always be
> resolved at compile time.  That might be possible since this is a static
> inline function.
  Well, I can stick there BUG_ON(field >= IF_FIELD_NR). That looks like a
sensible debugging measure with negligible overhead.

								Honza
> > +{
> > +	int offset = inode->i_sb->s_inode_fields[field];
> > +
> > +	if (!offset)	/* Field not present? */
> > +		return NULL;
> 
> > +	return ((char *)inode) + offset;
> > +}
> > +
> > +static inline void sb_init_inode_fields(struct super_block *sb, int *fields)
> > +{
> > +	memcpy(sb->s_inode_fields, fields, sizeof(int) * IF_FIELD_NR);
> > +}
> > +
> > extern struct timespec current_fs_time(struct super_block *sb);
> > 
> > /*
> > -- 
> > 1.8.1.4
> > 
> > --
> > To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
> > the body of a message to majordomo at vger.kernel.org
> > More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 
> 
> Cheers, Andreas
> 
> 
> 
> 
> 


-- 
Jan Kara <jack@suse.cz>
SUSE Labs, CR

^ permalink raw reply	[flat|nested] 80+ messages in thread

* [Cluster-devel] [PATCH 04/12] fs: Generic infrastructure for optional inode fields
@ 2014-10-08  8:45       ` Jan Kara
  0 siblings, 0 replies; 80+ messages in thread
From: Jan Kara @ 2014-10-08  8:45 UTC (permalink / raw)
  To: cluster-devel.redhat.com

On Wed 01-10-14 15:05:46, Andreas Dilger wrote:
> On Oct 1, 2014, at 1:31 PM, Jan Kara <jack@suse.cz> wrote:
> > There are parts of struct inode which are used only by a few filesystems
> > (e.g. i_dquot pointers, i_mapping->private_list, ...). Thus all the
> > other filesystems are just wasting memory with these fields. On the
> > other hand it isn't simple to just move these fields to filesystem
> > specific part of inode because there is generic code which needs to peek
> > into the fields and it is cumbersome to provide helpers into which fs
> > has to stuff the field it is storing elsewhere.
> > 
> > We create a simple infrastructure which allows for optional inode fields
> > stored in the fs-specific part of the inode. Accessing these fields has
> > a slightly worse performance as we have to lookup their offset in the
> > offset table stored in the superblock but in most cases this is
> > acceptable. Notably, this offset-table mechanism is faster than having
> > fs-specific hook functions which would need to be called to provide
> > pointers to desired fields.
> > 
> > Signed-off-by: Jan Kara <jack@suse.cz>
> > ---
> > include/linux/fs.h | 24 ++++++++++++++++++++++++
> > 1 file changed, 24 insertions(+)
> > 
> > diff --git a/include/linux/fs.h b/include/linux/fs.h
> > index 94187721ad41..977f8fb6ca88 100644
> > --- a/include/linux/fs.h
> > +++ b/include/linux/fs.h
> > @@ -615,6 +615,11 @@ struct inode {
> > 	void			*i_private; /* fs or device private pointer */
> > };
> > 
> > +/* Optional inode fields (stored in filesystems inode if the fs needs them) */
> > +enum {
> 
> This should be a named enum, like "enum inode_field" or similar, so it
> can be referenced below.
> 
> > +	IF_FIELD_NR	/* Number of optional inode fields */
> > +};
> > +
> > static inline int inode_unhashed(struct inode *inode)
> > {
> > 	return hlist_unhashed(&inode->i_hash);
> > @@ -1236,6 +1241,11 @@ struct super_block {
> > 	void 			*s_fs_info;	/* Filesystem private info */
> > 	unsigned int		s_max_links;
> > 	fmode_t			s_mode;
> > +	/*
> > +	 * We could have here just a pointer to the offsets array but this
> > +	 * way we save one dereference when looking up field offsets
> > +	 */
> > +	int			s_inode_fields[IF_FIELD_NR];
> > 
> > 	/* Granularity of c/m/atime in ns.
> > 	   Cannot be worse than a second */
> > @@ -1286,6 +1296,20 @@ struct super_block {
> > 	struct rcu_head		rcu;
> > };
> > 
> > +static inline void *inode_field(const struct inode *inode, int field)
> 
> This should use "enum inode_field" instead of int, so the compiler could
> warn about invalid parameter values.  It might make sense to add a check:
  OK, makes sense.

>         if (field < IF_FIELD_NR)
> 
> but I'm not sure if the overhead is worthwhile, unless it can always be
> resolved at compile time.  That might be possible since this is a static
> inline function.
  Well, I can stick there BUG_ON(field >= IF_FIELD_NR). That looks like a
sensible debugging measure with negligible overhead.

								Honza
> > +{
> > +	int offset = inode->i_sb->s_inode_fields[field];
> > +
> > +	if (!offset)	/* Field not present? */
> > +		return NULL;
> 
> > +	return ((char *)inode) + offset;
> > +}
> > +
> > +static inline void sb_init_inode_fields(struct super_block *sb, int *fields)
> > +{
> > +	memcpy(sb->s_inode_fields, fields, sizeof(int) * IF_FIELD_NR);
> > +}
> > +
> > extern struct timespec current_fs_time(struct super_block *sb);
> > 
> > /*
> > -- 
> > 1.8.1.4
> > 
> > --
> > To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
> > the body of a message to majordomo at vger.kernel.org
> > More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 
> 
> Cheers, Andreas
> 
> 
> 
> 
> 


-- 
Jan Kara <jack@suse.cz>
SUSE Labs, CR



^ permalink raw reply	[flat|nested] 80+ messages in thread

* Re: [PATCH 01/12] quota: Allow each filesystem to specify which quota types it supports
  2014-10-10 15:26     ` Dave Kleikamp
@ 2014-10-10 15:37       ` Jan Kara
  -1 siblings, 0 replies; 80+ messages in thread
From: Jan Kara @ 2014-10-10 15:37 UTC (permalink / raw)
  To: Dave Kleikamp
  Cc: Jan Kara, linux-fsdevel, linux-ext4, Dave Chinner, xfs,
	cluster-devel, Steven Whitehouse, Mark Fasheh, Joel Becker,
	ocfs2-devel, reiserfs-devel, Jeff Mahoney, Dave Kleikamp,
	jfs-discussion, tytso, viro

On Fri 10-10-14 10:26:41, Dave Kleikamp wrote:
> On 10/10/2014 09:54 AM, Jan Kara wrote:
> > diff --git a/include/linux/quota.h b/include/linux/quota.h
> > index 80d345a3524c..b52539f42e19 100644
> > --- a/include/linux/quota.h
> > +++ b/include/linux/quota.h
> > @@ -56,6 +56,11 @@ enum quota_type {
> >  	PRJQUOTA = 2,		/* element used for project quotas */
> >  };
> >  
> > +/* Masks for quota types when used as a bitmask */
> > +#define QTYPE_MASK_USER (1 << USRQUOTA)
> > +#define QTYPE_MASK_GROUP (1 << GRPQUOTA)
> > +#define QTYPE_MASK_PROJECT (1 << PRJQUOTA)
> 
> The uses of these masks use the names QTYPE_MASK_USR, QTYPE_MASK_GRP,
> and QTYPE_MASK_PRJ
  Sigh. Friday afternoon isn't a good time for sending out patch sets :(
Thanks for catching this. I'll wait if someone has other feedback before
resending the patches...

								Honza
-- 
Jan Kara <jack@suse.cz>
SUSE Labs, CR

^ permalink raw reply	[flat|nested] 80+ messages in thread

* Re: [PATCH 01/12] quota: Allow each filesystem to specify which quota types it supports
@ 2014-10-10 15:37       ` Jan Kara
  0 siblings, 0 replies; 80+ messages in thread
From: Jan Kara @ 2014-10-10 15:37 UTC (permalink / raw)
  To: Dave Kleikamp
  Cc: Dave Kleikamp, jfs-discussion, Jan Kara, Jeff Mahoney,
	Mark Fasheh, reiserfs-devel, xfs, cluster-devel, Joel Becker,
	linux-fsdevel, tytso, linux-ext4, Steven Whitehouse, ocfs2-devel,
	viro

On Fri 10-10-14 10:26:41, Dave Kleikamp wrote:
> On 10/10/2014 09:54 AM, Jan Kara wrote:
> > diff --git a/include/linux/quota.h b/include/linux/quota.h
> > index 80d345a3524c..b52539f42e19 100644
> > --- a/include/linux/quota.h
> > +++ b/include/linux/quota.h
> > @@ -56,6 +56,11 @@ enum quota_type {
> >  	PRJQUOTA = 2,		/* element used for project quotas */
> >  };
> >  
> > +/* Masks for quota types when used as a bitmask */
> > +#define QTYPE_MASK_USER (1 << USRQUOTA)
> > +#define QTYPE_MASK_GROUP (1 << GRPQUOTA)
> > +#define QTYPE_MASK_PROJECT (1 << PRJQUOTA)
> 
> The uses of these masks use the names QTYPE_MASK_USR, QTYPE_MASK_GRP,
> and QTYPE_MASK_PRJ
  Sigh. Friday afternoon isn't a good time for sending out patch sets :(
Thanks for catching this. I'll wait if someone has other feedback before
resending the patches...

								Honza
-- 
Jan Kara <jack@suse.cz>
SUSE Labs, CR

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 80+ messages in thread

* Re: [PATCH 01/12] quota: Allow each filesystem to specify which quota types it supports
  2014-10-10 14:54   ` Jan Kara
@ 2014-10-10 15:26     ` Dave Kleikamp
  -1 siblings, 0 replies; 80+ messages in thread
From: Dave Kleikamp @ 2014-10-10 15:26 UTC (permalink / raw)
  To: Jan Kara, linux-fsdevel
  Cc: Dave Kleikamp, jfs-discussion, tytso, Jeff Mahoney, Mark Fasheh,
	Dave Chinner, reiserfs-devel, xfs, cluster-devel, linux-ext4,
	Steven Whitehouse, ocfs2-devel, viro

On 10/10/2014 09:54 AM, Jan Kara wrote:
> Currently all filesystems supporting VFS quota support user and group
> quotas. With introduction of project quotas this is going to change so
> make sure filesystem isn't called for quota type it doesn't support by
> introduction of a bitmask determining which quota types each filesystem
> supports.
> 
> Signed-off-by: Jan Kara <jack@suse.cz>
> ---
>  fs/quota/quota.c      | 13 +++++++++++--
>  fs/super.c            |  7 +++++++
>  include/linux/quota.h |  6 ++++++
>  3 files changed, 24 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/quota/quota.c b/fs/quota/quota.c
> index 75621649dbd7..0f28eac6e638 100644
> --- a/fs/quota/quota.c
> +++ b/fs/quota/quota.c
> @@ -47,8 +47,11 @@ static int check_quotactl_permission(struct super_block *sb, int type, int cmd,
>  
>  static void quota_sync_one(struct super_block *sb, void *arg)
>  {
> -	if (sb->s_qcop && sb->s_qcop->quota_sync)
> -		sb->s_qcop->quota_sync(sb, *(int *)arg);
> +	int type = *(int *)arg;
> +
> +	if (sb->s_qcop && sb->s_qcop->quota_sync &&
> +	    (sb->s_dquot.allowed_types & (1 << type)))
> +		sb->s_qcop->quota_sync(sb, type);
>  }
>  
>  static int quota_sync_all(int type)
> @@ -297,8 +300,14 @@ static int do_quotactl(struct super_block *sb, int type, int cmd, qid_t id,
>  
>  	if (type >= (XQM_COMMAND(cmd) ? XQM_MAXQUOTAS : MAXQUOTAS))
>  		return -EINVAL;
> +	/*
> +	 * Quota not supported on this fs? Check this before allowed_types
> +	 * since they needn't be set if quota is not supported.
> +	 */
>  	if (!sb->s_qcop)
>  		return -ENOSYS;
> +	if (!(sb->s_dquot.allowed_types & (1 << type)))
> +		return -EINVAL;
>  
>  	ret = check_quotactl_permission(sb, type, cmd, id);
>  	if (ret < 0)
> diff --git a/fs/super.c b/fs/super.c
> index b9a214d2fe98..c6c9b2de9e31 100644
> --- a/fs/super.c
> +++ b/fs/super.c
> @@ -215,6 +215,13 @@ static struct super_block *alloc_super(struct file_system_type *type, int flags)
>  	atomic_set(&s->s_active, 1);
>  	mutex_init(&s->s_vfs_rename_mutex);
>  	lockdep_set_class(&s->s_vfs_rename_mutex, &type->s_vfs_rename_key);
> +	/*
> +	 * For now MAXQUOTAS check in do_quotactl() will limit quota type
> +	 * appropriately. When each fs sets allowed_types, we can remove the
> +	 * line below
> +	 */
> +	s->s_dquot.allowed_types = QTYPE_MASK_USR | QTYPE_MASK_GRP |
> +				   QTYPE_MASK_PRJ;
>  	mutex_init(&s->s_dquot.dqio_mutex);
>  	mutex_init(&s->s_dquot.dqonoff_mutex);
>  	s->s_maxbytes = MAX_NON_LFS;
> diff --git a/include/linux/quota.h b/include/linux/quota.h
> index 80d345a3524c..b52539f42e19 100644
> --- a/include/linux/quota.h
> +++ b/include/linux/quota.h
> @@ -56,6 +56,11 @@ enum quota_type {
>  	PRJQUOTA = 2,		/* element used for project quotas */
>  };
>  
> +/* Masks for quota types when used as a bitmask */
> +#define QTYPE_MASK_USER (1 << USRQUOTA)
> +#define QTYPE_MASK_GROUP (1 << GRPQUOTA)
> +#define QTYPE_MASK_PROJECT (1 << PRJQUOTA)

The uses of these masks use the names QTYPE_MASK_USR, QTYPE_MASK_GRP,
and QTYPE_MASK_PRJ

> +
>  typedef __kernel_uid32_t qid_t; /* Type in which we store ids in memory */
>  typedef long long qsize_t;	/* Type in which we store sizes */
>  
> @@ -388,6 +393,7 @@ static inline void quota_send_warning(struct kqid qid, dev_t dev,
>  
>  struct quota_info {
>  	unsigned int flags;			/* Flags for diskquotas on this device */
> +	unsigned int allowed_types;		/* Bitmask of quota types this fs supports */
>  	struct mutex dqio_mutex;		/* lock device while I/O in progress */
>  	struct mutex dqonoff_mutex;		/* Serialize quotaon & quotaoff */
>  	struct inode *files[MAXQUOTAS];		/* inodes of quotafiles */
> 

^ permalink raw reply	[flat|nested] 80+ messages in thread

* Re: [PATCH 01/12] quota: Allow each filesystem to specify which quota types it supports
@ 2014-10-10 15:26     ` Dave Kleikamp
  0 siblings, 0 replies; 80+ messages in thread
From: Dave Kleikamp @ 2014-10-10 15:26 UTC (permalink / raw)
  To: Jan Kara, linux-fsdevel
  Cc: Dave Kleikamp, jfs-discussion, tytso, Jeff Mahoney, Mark Fasheh,
	reiserfs-devel, xfs, cluster-devel, Joel Becker, linux-ext4,
	Steven Whitehouse, ocfs2-devel, viro

On 10/10/2014 09:54 AM, Jan Kara wrote:
> Currently all filesystems supporting VFS quota support user and group
> quotas. With introduction of project quotas this is going to change so
> make sure filesystem isn't called for quota type it doesn't support by
> introduction of a bitmask determining which quota types each filesystem
> supports.
> 
> Signed-off-by: Jan Kara <jack@suse.cz>
> ---
>  fs/quota/quota.c      | 13 +++++++++++--
>  fs/super.c            |  7 +++++++
>  include/linux/quota.h |  6 ++++++
>  3 files changed, 24 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/quota/quota.c b/fs/quota/quota.c
> index 75621649dbd7..0f28eac6e638 100644
> --- a/fs/quota/quota.c
> +++ b/fs/quota/quota.c
> @@ -47,8 +47,11 @@ static int check_quotactl_permission(struct super_block *sb, int type, int cmd,
>  
>  static void quota_sync_one(struct super_block *sb, void *arg)
>  {
> -	if (sb->s_qcop && sb->s_qcop->quota_sync)
> -		sb->s_qcop->quota_sync(sb, *(int *)arg);
> +	int type = *(int *)arg;
> +
> +	if (sb->s_qcop && sb->s_qcop->quota_sync &&
> +	    (sb->s_dquot.allowed_types & (1 << type)))
> +		sb->s_qcop->quota_sync(sb, type);
>  }
>  
>  static int quota_sync_all(int type)
> @@ -297,8 +300,14 @@ static int do_quotactl(struct super_block *sb, int type, int cmd, qid_t id,
>  
>  	if (type >= (XQM_COMMAND(cmd) ? XQM_MAXQUOTAS : MAXQUOTAS))
>  		return -EINVAL;
> +	/*
> +	 * Quota not supported on this fs? Check this before allowed_types
> +	 * since they needn't be set if quota is not supported.
> +	 */
>  	if (!sb->s_qcop)
>  		return -ENOSYS;
> +	if (!(sb->s_dquot.allowed_types & (1 << type)))
> +		return -EINVAL;
>  
>  	ret = check_quotactl_permission(sb, type, cmd, id);
>  	if (ret < 0)
> diff --git a/fs/super.c b/fs/super.c
> index b9a214d2fe98..c6c9b2de9e31 100644
> --- a/fs/super.c
> +++ b/fs/super.c
> @@ -215,6 +215,13 @@ static struct super_block *alloc_super(struct file_system_type *type, int flags)
>  	atomic_set(&s->s_active, 1);
>  	mutex_init(&s->s_vfs_rename_mutex);
>  	lockdep_set_class(&s->s_vfs_rename_mutex, &type->s_vfs_rename_key);
> +	/*
> +	 * For now MAXQUOTAS check in do_quotactl() will limit quota type
> +	 * appropriately. When each fs sets allowed_types, we can remove the
> +	 * line below
> +	 */
> +	s->s_dquot.allowed_types = QTYPE_MASK_USR | QTYPE_MASK_GRP |
> +				   QTYPE_MASK_PRJ;
>  	mutex_init(&s->s_dquot.dqio_mutex);
>  	mutex_init(&s->s_dquot.dqonoff_mutex);
>  	s->s_maxbytes = MAX_NON_LFS;
> diff --git a/include/linux/quota.h b/include/linux/quota.h
> index 80d345a3524c..b52539f42e19 100644
> --- a/include/linux/quota.h
> +++ b/include/linux/quota.h
> @@ -56,6 +56,11 @@ enum quota_type {
>  	PRJQUOTA = 2,		/* element used for project quotas */
>  };
>  
> +/* Masks for quota types when used as a bitmask */
> +#define QTYPE_MASK_USER (1 << USRQUOTA)
> +#define QTYPE_MASK_GROUP (1 << GRPQUOTA)
> +#define QTYPE_MASK_PROJECT (1 << PRJQUOTA)

The uses of these masks use the names QTYPE_MASK_USR, QTYPE_MASK_GRP,
and QTYPE_MASK_PRJ

> +
>  typedef __kernel_uid32_t qid_t; /* Type in which we store ids in memory */
>  typedef long long qsize_t;	/* Type in which we store sizes */
>  
> @@ -388,6 +393,7 @@ static inline void quota_send_warning(struct kqid qid, dev_t dev,
>  
>  struct quota_info {
>  	unsigned int flags;			/* Flags for diskquotas on this device */
> +	unsigned int allowed_types;		/* Bitmask of quota types this fs supports */
>  	struct mutex dqio_mutex;		/* lock device while I/O in progress */
>  	struct mutex dqonoff_mutex;		/* Serialize quotaon & quotaoff */
>  	struct inode *files[MAXQUOTAS];		/* inodes of quotafiles */
> 

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 80+ messages in thread

* [PATCH 01/12] quota: Allow each filesystem to specify which quota types it supports
  2014-10-10 14:54 [PATCH 0/12 v2] Moving i_dquot out of struct inode Jan Kara
@ 2014-10-10 14:54   ` Jan Kara
  0 siblings, 0 replies; 80+ messages in thread
From: Jan Kara @ 2014-10-10 14:54 UTC (permalink / raw)
  To: linux-fsdevel
  Cc: linux-ext4, Dave Chinner, xfs, cluster-devel, Steven Whitehouse,
	Mark Fasheh, Joel Becker, ocfs2-devel, reiserfs-devel,
	Jeff Mahoney, Dave Kleikamp, jfs-discussion, tytso, viro,
	Jan Kara

Currently all filesystems supporting VFS quota support user and group
quotas. With introduction of project quotas this is going to change so
make sure filesystem isn't called for quota type it doesn't support by
introduction of a bitmask determining which quota types each filesystem
supports.

Signed-off-by: Jan Kara <jack@suse.cz>
---
 fs/quota/quota.c      | 13 +++++++++++--
 fs/super.c            |  7 +++++++
 include/linux/quota.h |  6 ++++++
 3 files changed, 24 insertions(+), 2 deletions(-)

diff --git a/fs/quota/quota.c b/fs/quota/quota.c
index 75621649dbd7..0f28eac6e638 100644
--- a/fs/quota/quota.c
+++ b/fs/quota/quota.c
@@ -47,8 +47,11 @@ static int check_quotactl_permission(struct super_block *sb, int type, int cmd,
 
 static void quota_sync_one(struct super_block *sb, void *arg)
 {
-	if (sb->s_qcop && sb->s_qcop->quota_sync)
-		sb->s_qcop->quota_sync(sb, *(int *)arg);
+	int type = *(int *)arg;
+
+	if (sb->s_qcop && sb->s_qcop->quota_sync &&
+	    (sb->s_dquot.allowed_types & (1 << type)))
+		sb->s_qcop->quota_sync(sb, type);
 }
 
 static int quota_sync_all(int type)
@@ -297,8 +300,14 @@ static int do_quotactl(struct super_block *sb, int type, int cmd, qid_t id,
 
 	if (type >= (XQM_COMMAND(cmd) ? XQM_MAXQUOTAS : MAXQUOTAS))
 		return -EINVAL;
+	/*
+	 * Quota not supported on this fs? Check this before allowed_types
+	 * since they needn't be set if quota is not supported.
+	 */
 	if (!sb->s_qcop)
 		return -ENOSYS;
+	if (!(sb->s_dquot.allowed_types & (1 << type)))
+		return -EINVAL;
 
 	ret = check_quotactl_permission(sb, type, cmd, id);
 	if (ret < 0)
diff --git a/fs/super.c b/fs/super.c
index b9a214d2fe98..c6c9b2de9e31 100644
--- a/fs/super.c
+++ b/fs/super.c
@@ -215,6 +215,13 @@ static struct super_block *alloc_super(struct file_system_type *type, int flags)
 	atomic_set(&s->s_active, 1);
 	mutex_init(&s->s_vfs_rename_mutex);
 	lockdep_set_class(&s->s_vfs_rename_mutex, &type->s_vfs_rename_key);
+	/*
+	 * For now MAXQUOTAS check in do_quotactl() will limit quota type
+	 * appropriately. When each fs sets allowed_types, we can remove the
+	 * line below
+	 */
+	s->s_dquot.allowed_types = QTYPE_MASK_USR | QTYPE_MASK_GRP |
+				   QTYPE_MASK_PRJ;
 	mutex_init(&s->s_dquot.dqio_mutex);
 	mutex_init(&s->s_dquot.dqonoff_mutex);
 	s->s_maxbytes = MAX_NON_LFS;
diff --git a/include/linux/quota.h b/include/linux/quota.h
index 80d345a3524c..b52539f42e19 100644
--- a/include/linux/quota.h
+++ b/include/linux/quota.h
@@ -56,6 +56,11 @@ enum quota_type {
 	PRJQUOTA = 2,		/* element used for project quotas */
 };
 
+/* Masks for quota types when used as a bitmask */
+#define QTYPE_MASK_USER (1 << USRQUOTA)
+#define QTYPE_MASK_GROUP (1 << GRPQUOTA)
+#define QTYPE_MASK_PROJECT (1 << PRJQUOTA)
+
 typedef __kernel_uid32_t qid_t; /* Type in which we store ids in memory */
 typedef long long qsize_t;	/* Type in which we store sizes */
 
@@ -388,6 +393,7 @@ static inline void quota_send_warning(struct kqid qid, dev_t dev,
 
 struct quota_info {
 	unsigned int flags;			/* Flags for diskquotas on this device */
+	unsigned int allowed_types;		/* Bitmask of quota types this fs supports */
 	struct mutex dqio_mutex;		/* lock device while I/O in progress */
 	struct mutex dqonoff_mutex;		/* Serialize quotaon & quotaoff */
 	struct inode *files[MAXQUOTAS];		/* inodes of quotafiles */
-- 
1.8.1.4


^ permalink raw reply related	[flat|nested] 80+ messages in thread

* [PATCH 01/12] quota: Allow each filesystem to specify which quota types it supports
@ 2014-10-10 14:54   ` Jan Kara
  0 siblings, 0 replies; 80+ messages in thread
From: Jan Kara @ 2014-10-10 14:54 UTC (permalink / raw)
  To: linux-fsdevel
  Cc: Dave Kleikamp, jfs-discussion, tytso, Jeff Mahoney, Mark Fasheh,
	reiserfs-devel, xfs, cluster-devel, Joel Becker, Jan Kara,
	linux-ext4, Steven Whitehouse, ocfs2-devel, viro

Currently all filesystems supporting VFS quota support user and group
quotas. With introduction of project quotas this is going to change so
make sure filesystem isn't called for quota type it doesn't support by
introduction of a bitmask determining which quota types each filesystem
supports.

Signed-off-by: Jan Kara <jack@suse.cz>
---
 fs/quota/quota.c      | 13 +++++++++++--
 fs/super.c            |  7 +++++++
 include/linux/quota.h |  6 ++++++
 3 files changed, 24 insertions(+), 2 deletions(-)

diff --git a/fs/quota/quota.c b/fs/quota/quota.c
index 75621649dbd7..0f28eac6e638 100644
--- a/fs/quota/quota.c
+++ b/fs/quota/quota.c
@@ -47,8 +47,11 @@ static int check_quotactl_permission(struct super_block *sb, int type, int cmd,
 
 static void quota_sync_one(struct super_block *sb, void *arg)
 {
-	if (sb->s_qcop && sb->s_qcop->quota_sync)
-		sb->s_qcop->quota_sync(sb, *(int *)arg);
+	int type = *(int *)arg;
+
+	if (sb->s_qcop && sb->s_qcop->quota_sync &&
+	    (sb->s_dquot.allowed_types & (1 << type)))
+		sb->s_qcop->quota_sync(sb, type);
 }
 
 static int quota_sync_all(int type)
@@ -297,8 +300,14 @@ static int do_quotactl(struct super_block *sb, int type, int cmd, qid_t id,
 
 	if (type >= (XQM_COMMAND(cmd) ? XQM_MAXQUOTAS : MAXQUOTAS))
 		return -EINVAL;
+	/*
+	 * Quota not supported on this fs? Check this before allowed_types
+	 * since they needn't be set if quota is not supported.
+	 */
 	if (!sb->s_qcop)
 		return -ENOSYS;
+	if (!(sb->s_dquot.allowed_types & (1 << type)))
+		return -EINVAL;
 
 	ret = check_quotactl_permission(sb, type, cmd, id);
 	if (ret < 0)
diff --git a/fs/super.c b/fs/super.c
index b9a214d2fe98..c6c9b2de9e31 100644
--- a/fs/super.c
+++ b/fs/super.c
@@ -215,6 +215,13 @@ static struct super_block *alloc_super(struct file_system_type *type, int flags)
 	atomic_set(&s->s_active, 1);
 	mutex_init(&s->s_vfs_rename_mutex);
 	lockdep_set_class(&s->s_vfs_rename_mutex, &type->s_vfs_rename_key);
+	/*
+	 * For now MAXQUOTAS check in do_quotactl() will limit quota type
+	 * appropriately. When each fs sets allowed_types, we can remove the
+	 * line below
+	 */
+	s->s_dquot.allowed_types = QTYPE_MASK_USR | QTYPE_MASK_GRP |
+				   QTYPE_MASK_PRJ;
 	mutex_init(&s->s_dquot.dqio_mutex);
 	mutex_init(&s->s_dquot.dqonoff_mutex);
 	s->s_maxbytes = MAX_NON_LFS;
diff --git a/include/linux/quota.h b/include/linux/quota.h
index 80d345a3524c..b52539f42e19 100644
--- a/include/linux/quota.h
+++ b/include/linux/quota.h
@@ -56,6 +56,11 @@ enum quota_type {
 	PRJQUOTA = 2,		/* element used for project quotas */
 };
 
+/* Masks for quota types when used as a bitmask */
+#define QTYPE_MASK_USER (1 << USRQUOTA)
+#define QTYPE_MASK_GROUP (1 << GRPQUOTA)
+#define QTYPE_MASK_PROJECT (1 << PRJQUOTA)
+
 typedef __kernel_uid32_t qid_t; /* Type in which we store ids in memory */
 typedef long long qsize_t;	/* Type in which we store sizes */
 
@@ -388,6 +393,7 @@ static inline void quota_send_warning(struct kqid qid, dev_t dev,
 
 struct quota_info {
 	unsigned int flags;			/* Flags for diskquotas on this device */
+	unsigned int allowed_types;		/* Bitmask of quota types this fs supports */
 	struct mutex dqio_mutex;		/* lock device while I/O in progress */
 	struct mutex dqonoff_mutex;		/* Serialize quotaon & quotaoff */
 	struct inode *files[MAXQUOTAS];		/* inodes of quotafiles */
-- 
1.8.1.4

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply related	[flat|nested] 80+ messages in thread

end of thread, other threads:[~2014-10-10 15:37 UTC | newest]

Thread overview: 80+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-10-01 19:31 [PATCH 0/12 RFC] Moving i_dquot out of struct inode Jan Kara
2014-10-01 19:31 ` [Cluster-devel] " Jan Kara
2014-10-01 19:31 ` [Ocfs2-devel] " Jan Kara
2014-10-01 19:31 ` Jan Kara
2014-10-01 19:31 ` [PATCH 01/12] quota: Allow each filesystem to specify which quota types it supports Jan Kara
2014-10-01 19:31   ` [Cluster-devel] " Jan Kara
2014-10-01 19:31   ` [Ocfs2-devel] " Jan Kara
2014-10-01 19:31 ` [PATCH 02/12] gfs2: Set allowed quota types Jan Kara
2014-10-01 19:31   ` [Cluster-devel] " Jan Kara
2014-10-01 19:31   ` [Ocfs2-devel] " Jan Kara
2014-10-01 19:31   ` Jan Kara
2014-10-02 10:41   ` Steven Whitehouse
2014-10-02 10:41     ` [Cluster-devel] " Steven Whitehouse
2014-10-02 10:41     ` [Ocfs2-devel] " Steven Whitehouse
2014-10-02 10:41     ` Steven Whitehouse
2014-10-01 19:31 ` [PATCH 03/12] xfs: " Jan Kara
2014-10-01 19:31   ` [Cluster-devel] " Jan Kara
2014-10-01 19:31   ` [Ocfs2-devel] " Jan Kara
2014-10-01 19:31   ` Jan Kara
2014-10-06 20:30   ` Dave Chinner
2014-10-06 20:30     ` [Cluster-devel] " Dave Chinner
2014-10-06 20:30     ` [Ocfs2-devel] " Dave Chinner
2014-10-07 19:29     ` Jan Kara
2014-10-07 19:29       ` [Cluster-devel] " Jan Kara
2014-10-07 19:29       ` [Ocfs2-devel] " Jan Kara
2014-10-07 19:46       ` Andreas Dilger
2014-10-07 19:46         ` [Cluster-devel] " Andreas Dilger
2014-10-07 19:46         ` [Ocfs2-devel] " Andreas Dilger
2014-10-07 19:46         ` Andreas Dilger
2014-10-08  8:42         ` Jan Kara
2014-10-08  8:42           ` [Cluster-devel] " Jan Kara
2014-10-08  8:42           ` [Ocfs2-devel] " Jan Kara
2014-10-08  8:42           ` Jan Kara
2014-10-01 19:31 ` [PATCH 04/12] fs: Generic infrastructure for optional inode fields Jan Kara
2014-10-01 19:31   ` [Cluster-devel] " Jan Kara
2014-10-01 19:31   ` [Ocfs2-devel] " Jan Kara
2014-10-01 21:05   ` Andreas Dilger
2014-10-01 21:05     ` [Cluster-devel] " Andreas Dilger
2014-10-01 21:05     ` [Ocfs2-devel] " Andreas Dilger
2014-10-01 21:05     ` Andreas Dilger
2014-10-08  8:45     ` Jan Kara
2014-10-08  8:45       ` [Cluster-devel] " Jan Kara
2014-10-08  8:45       ` [Ocfs2-devel] " Jan Kara
2014-10-01 19:31 ` [PATCH 05/12] quota: Use optional inode field for i_dquot pointers Jan Kara
2014-10-01 19:31   ` [Cluster-devel] " Jan Kara
2014-10-01 19:31   ` [Ocfs2-devel] " Jan Kara
2014-10-01 19:31   ` Jan Kara
2014-10-01 19:31 ` [PATCH 06/12] ext2: Convert to private i_dquot field Jan Kara
2014-10-01 19:31   ` [Cluster-devel] " Jan Kara
2014-10-01 19:31   ` [Ocfs2-devel] " Jan Kara
2014-10-01 19:31   ` Jan Kara
2014-10-01 19:31 ` [PATCH 07/12] ext3: " Jan Kara
2014-10-01 19:31   ` [Cluster-devel] " Jan Kara
2014-10-01 19:31   ` [Ocfs2-devel] " Jan Kara
2014-10-01 19:31   ` Jan Kara
2014-10-01 19:31 ` [PATCH 08/12] ext4: " Jan Kara
2014-10-01 19:31   ` [Cluster-devel] " Jan Kara
2014-10-01 19:31   ` [Ocfs2-devel] " Jan Kara
2014-10-01 19:31   ` Jan Kara
2014-10-01 19:31 ` [PATCH 09/12] ocfs2: " Jan Kara
2014-10-01 19:31   ` [Cluster-devel] " Jan Kara
2014-10-01 19:31   ` [Ocfs2-devel] " Jan Kara
2014-10-01 19:31   ` Jan Kara
2014-10-01 19:31 ` [PATCH 10/12] reiserfs: " Jan Kara
2014-10-01 19:31   ` [Cluster-devel] " Jan Kara
2014-10-01 19:31   ` [Ocfs2-devel] " Jan Kara
2014-10-01 19:31 ` [PATCH 11/12] jfs: " Jan Kara
2014-10-01 19:31   ` [Cluster-devel] " Jan Kara
2014-10-01 19:31   ` [Ocfs2-devel] " Jan Kara
2014-10-01 19:31   ` Jan Kara
2014-10-01 19:31 ` [PATCH 12/12] vfs: Remove i_dquot field from inode Jan Kara
2014-10-01 19:31   ` [Cluster-devel] " Jan Kara
2014-10-01 19:31   ` [Ocfs2-devel] " Jan Kara
2014-10-01 19:31   ` Jan Kara
2014-10-10 14:54 [PATCH 0/12 v2] Moving i_dquot out of struct inode Jan Kara
2014-10-10 14:54 ` [PATCH 01/12] quota: Allow each filesystem to specify which quota types it supports Jan Kara
2014-10-10 14:54   ` Jan Kara
2014-10-10 15:26   ` Dave Kleikamp
2014-10-10 15:26     ` Dave Kleikamp
2014-10-10 15:37     ` Jan Kara
2014-10-10 15:37       ` Jan Kara

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.