提交 fbfa6c88 编写于 作者: A Artem Bityutskiy

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: NArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
上级 ff46d7b3
...@@ -278,7 +278,7 @@ static void ubifs_destroy_inode(struct inode *inode) ...@@ -278,7 +278,7 @@ static void ubifs_destroy_inode(struct inode *inode)
*/ */
static int ubifs_write_inode(struct inode *inode, int wait) 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_info *c = inode->i_sb->s_fs_info;
struct ubifs_inode *ui = ubifs_inode(inode); struct ubifs_inode *ui = ubifs_inode(inode);
...@@ -299,10 +299,18 @@ static int ubifs_write_inode(struct inode *inode, int wait) ...@@ -299,10 +299,18 @@ static int ubifs_write_inode(struct inode *inode, int wait)
return 0; return 0;
} }
dbg_gen("inode %lu, mode %#x", inode->i_ino, (int)inode->i_mode); /*
err = ubifs_jnl_write_inode(c, inode, 0); * As an optimization, do not write orphan inodes to the media just
if (err) * because this is not needed.
ubifs_err("can't write inode %lu, error %d", inode->i_ino, err); */
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; ui->dirty = 0;
mutex_unlock(&ui->ui_mutex); mutex_unlock(&ui->ui_mutex);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册