aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2008-07-22 04:52:52 -0400
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2008-08-13 04:25:27 -0400
commitfbfa6c884aae2aff479eb8c996c564b1a34eae30 (patch)
treec1dcfd2ba1d1109905274b35833f1db3fe8db5bf
parentff46d7b3e0870a70331b069372c36fbc43018c2d (diff)
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>
-rw-r--r--fs/ubifs/super.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c
index 884beed1dcb8..13e90b0dd95d 100644
--- a/fs/ubifs/super.c
+++ b/fs/ubifs/super.c
@@ -278,7 +278,7 @@ static void ubifs_destroy_inode(struct inode *inode)
278 */ 278 */
279static int ubifs_write_inode(struct inode *inode, int wait) 279static int ubifs_write_inode(struct inode *inode, int wait)
280{ 280{
281 int err; 281 int err = 0;
282 struct ubifs_info *c = inode->i_sb->s_fs_info; 282 struct ubifs_info *c = inode->i_sb->s_fs_info;
283 struct ubifs_inode *ui = ubifs_inode(inode); 283 struct ubifs_inode *ui = ubifs_inode(inode);
284 284
@@ -299,10 +299,18 @@ static int ubifs_write_inode(struct inode *inode, int wait)
299 return 0; 299 return 0;
300 } 300 }
301 301
302 dbg_gen("inode %lu, mode %#x", inode->i_ino, (int)inode->i_mode); 302 /*
303 err = ubifs_jnl_write_inode(c, inode, 0); 303 * As an optimization, do not write orphan inodes to the media just
304 if (err) 304 * because this is not needed.
305 ubifs_err("can't write inode %lu, error %d", inode->i_ino, err); 305 */
306 dbg_gen("inode %lu, mode %#x, nlink %u",
307 inode->i_ino, (int)inode->i_mode, inode->i_nlink);
308 if (inode->i_nlink) {
309 err = ubifs_jnl_write_inode(c, inode, 0);
310 if (err)
311 ubifs_err("can't write inode %lu, error %d",
312 inode->i_ino, err);
313 }
306 314
307 ui->dirty = 0; 315 ui->dirty = 0;
308 mutex_unlock(&ui->ui_mutex); 316 mutex_unlock(&ui->ui_mutex);