diff mbox

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

Message ID 1438235311-23788-30-git-send-email-yangds.fnst@cn.fujitsu.com (mailing list archive)
State New, archived
Headers show

Commit Message

Yang Dongsheng July 30, 2015, 5:48 a.m. UTC
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@cn.fujitsu.com>
---
 fs/ubifs/journal.c | 6 ++++++
 1 file changed, 6 insertions(+)
diff mbox

Patch

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);