UBIFS: do not write orphans back

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: <git-commits-head@...>
Date: Friday, August 15, 2008 - 2:59 pm

Gitweb:     http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=fbfa6c...
Commit:     fbfa6c884aae2aff479eb8c996c564b1a34eae30
Parent:     ff46d7b3e0870a70331b069372c36fbc43018c2d
Author:     Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
AuthorDate: Tue Jul 22 11:52:52 2008 +0300
Committer:  Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
CommitDate: Wed Aug 13 11:25:27 2008 +0300

    UBIFS: do not write orphans back
    
    Orphan inodes are deleted inodes which will disappear after FS
    re-mount. There is not need to write orphan inodes back, because
    they are not needed on the flash media.
    
    So optimize orphans a little by not writing them back. Just mark
    them as clean, free the budget, and report success to VFS.
    
    Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
---
 fs/ubifs/super.c |   18 +++++++++++++-----
 1 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c
index 884beed..13e90b0 100644
--- a/fs/ubifs/super.c
+++ b/fs/ubifs/super.c
@@ -278,7 +278,7 @@ static void ubifs_destroy_inode(struct inode *inode)
  */
 static int ubifs_write_inode(struct inode *inode, int wait)
 {
-	int err;
+	int err = 0;
 	struct ubifs_info *c = inode->i_sb->s_fs_info;
 	struct ubifs_inode *ui = ubifs_inode(inode);
 
@@ -299,10 +299,18 @@ static int ubifs_write_inode(struct inode *inode, int wait)
 		return 0;
 	}
 
-	dbg_gen("inode %lu, mode %#x", inode->i_ino, (int)inode->i_mode);
-	err = ubifs_jnl_write_inode(c, inode, 0);
-	if (err)
-		ubifs_err("can't write inode %lu, error %d", inode->i_ino, err);
+	/*
+	 * As an optimization, do not write orphan inodes to the media just
+	 * because this is not needed.
+	 */
+	dbg_gen("inode %lu, mode %#x, nlink %u",
+		inode->i_ino, (int)inode->i_mode, inode->i_nlink);
+	if (inode->i_nlink) {
+		err = ubifs_jnl_write_inode(c, inode, 0);
+		if (err)
+			ubifs_err("can't write inode %lu, error %d",
+				  inode->i_ino, err);
+	}
 
 	ui->dirty = 0;
 	mutex_unlock(&ui->ui_mutex);
--
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
UBIFS: do not write orphans back, Linux Kernel Mailing List..., (Fri Aug 15, 2:59 pm)