[PATCH v2 29/35] ubifs: free quota space when deleting a file

Dongsheng Yang yangds.fnst at cn.fujitsu.com
Wed Jul 29 22:48:25 PDT 2015


When we unlink an inode which has only one last reference,
we are going to free the space in this inode. So free
the quota space at the same time.

Signed-off-by: Dongsheng Yang <yangds.fnst at cn.fujitsu.com>
---
 fs/ubifs/journal.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/fs/ubifs/journal.c b/fs/ubifs/journal.c
index 0b9da5b..a6e02f4 100644
--- a/fs/ubifs/journal.c
+++ b/fs/ubifs/journal.c
@@ -58,6 +58,8 @@
  * all the nodes.
  */
 
+#include <linux/quotaops.h>
+
 #include "ubifs.h"
 
 /**
@@ -614,6 +616,10 @@ int ubifs_jnl_update(struct ubifs_info *c, const struct inode *dir,
 			goto out_finish;
 		}
 		ui->del_cmtno = c->cmt_no;
+		if (S_ISREG(inode->i_mode)) {
+			dquot_initialize((struct inode *)inode);
+			dquot_free_space_nodirty((struct inode *)inode, inode->i_size);
+		}
 	}
 
 	err = write_head(c, BASEHD, dent, len, &lnum, &dent_offs, sync);
-- 
1.8.4.2




More information about the linux-mtd mailing list