[PATCH 2/6] quota: switch reservation space management to aux_attribute

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

 



Signed-off-by: Dmitry Monakhov <dmonakhov@xxxxxxxxxx>
---
 fs/ext4/super.c       |   11 +++++++----
 fs/quota/dquot.c      |    7 ++++---
 include/linux/fs.h    |    5 +++++
 include/linux/quota.h |    3 ---
 4 files changed, 16 insertions(+), 10 deletions(-)

diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 735c20d..84a51d9 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -1018,9 +1018,6 @@ static const struct dquot_operations ext4_quota_operations = {
 	.reserve_space	= dquot_reserve_space,
 	.claim_space	= dquot_claim_space,
 	.release_rsv	= dquot_release_reserved_space,
-#ifdef CONFIG_QUOTA
-	.get_reserved_space = ext4_get_reserved_space,
-#endif
 	.alloc_inode	= dquot_alloc_inode,
 	.free_space	= dquot_free_space,
 	.free_inode	= dquot_free_inode,
@@ -1033,7 +1030,13 @@ static const struct dquot_operations ext4_quota_operations = {
 	.alloc_dquot	= dquot_alloc,
 	.destroy_dquot	= dquot_destroy,
 };
-
+static const struct aux_attributes ext4_aux_attr =
+{
+	.supported = 1,
+#ifdef CONFIG_QUOTA
+	.reserved_space = ext4_get_reserved_space,
+#endif
+};
 static const struct quotactl_ops ext4_qctl_operations = {
 	.quota_on	= ext4_quota_on,
 	.quota_off	= vfs_quota_off,
diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c
index 4d2041f..de4b8fc 100644
--- a/fs/quota/dquot.c
+++ b/fs/quota/dquot.c
@@ -1405,8 +1405,8 @@ static qsize_t *inode_reserved_space(struct inode * inode)
 {
 	/* Filesystem must explicitly define it's own method in order to use
 	 * quota reservation interface */
-	BUG_ON(!inode->i_sb->dq_op->get_reserved_space);
-	return inode->i_sb->dq_op->get_reserved_space(inode);
+	BUG_ON(!inode->i_sb->s_aux_attr->reserved_space);
+	return inode->i_sb->s_aux_attr->reserved_space(inode);
 }
 
 void inode_add_rsv_space(struct inode *inode, qsize_t number)
@@ -1438,7 +1438,8 @@ static qsize_t inode_get_rsv_space(struct inode *inode)
 {
 	qsize_t ret;
 
-	if (!inode->i_sb->dq_op->get_reserved_space)
+	if (!inode->i_sb->s_aux_attr ||
+		!inode->i_sb->s_aux_attr->reserved_space)
 		return 0;
 	spin_lock(&inode->i_lock);
 	ret = *inode_reserved_space(inode);
diff --git a/include/linux/fs.h b/include/linux/fs.h
index c510ef7..0cd0105 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -1581,6 +1581,11 @@ struct super_operations {
 struct aux_attributes
 {
 	int supported;
+#ifdef CONFIG_QUOTA
+	/* Delay allocation space reservation  managed internally by quota,
+	 * and protected by i_lock similar to i_blocks+i_bytes. */
+	qsize_t* (*reserved_space)(struct inode *inode);
+#endif
 };
 /*
  * Inode state bits.  Protected by inode_lock.
diff --git a/include/linux/quota.h b/include/linux/quota.h
index edf34f2..680605d 100644
--- a/include/linux/quota.h
+++ b/include/linux/quota.h
@@ -315,9 +315,6 @@ struct dquot_operations {
 	int (*claim_space) (struct inode *, qsize_t);
 	/* release rsved quota for delayed alloc */
 	void (*release_rsv) (struct inode *, qsize_t);
-	/* get reserved quota for delayed alloc, value returned is managed by
-	 * quota code only */
-	qsize_t *(*get_reserved_space) (struct inode *);
 };
 
 /* Operations handling requests from userspace */
-- 
1.6.6

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

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