[Ocfs2-tools-devel] [PATCH 4/9] Write out quota info changes on ocfs2_close()

Jan Kara jack at suse.cz
Tue Aug 11 05:26:18 PDT 2009


We don't write out change of information in quota file header on each change,
we rather cache it in ocfs2_filesys structure. So write out all the
information when ocfs2_close() is called.

Signed-off-by: Jan Kara <jack at suse.cz>
---
 libocfs2/closefs.c |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/libocfs2/closefs.c b/libocfs2/closefs.c
index 54411da..383a67c 100644
--- a/libocfs2/closefs.c
+++ b/libocfs2/closefs.c
@@ -33,6 +33,20 @@
 
 errcode_t ocfs2_flush(ocfs2_filesys *fs)
 {
+	int type;
+	errcode_t ret;
+
+	for (type = 0; type < MAXQUOTAS; type++)
+		if (fs->qinfo[type].flags & OCFS2_QF_INFO_DIRTY) {
+			ret = ocfs2_write_global_quota_info(fs, type);
+			if (ret)
+				return ret;
+			ret = ocfs2_write_cached_inode(fs,
+						fs->qinfo[type].qi_inode);
+			if (ret)
+				return ret;
+		}
+
 	return 0;
 }
 
-- 
1.6.0.2




More information about the Ocfs2-tools-devel mailing list