OSDN Git Service

f2fs: manipulate dirty file inodes when DATA_FLUSH is set
authorJaegeuk Kim <jaegeuk@kernel.org>
Mon, 16 May 2016 17:33:40 +0000 (10:33 -0700)
committerJaegeuk Kim <jaegeuk@kernel.org>
Mon, 16 May 2016 22:32:03 +0000 (15:32 -0700)
It needs to maintain dirty file inodes only if DATA_FLUSH is set.
Otherwise, let's avoid its overhead.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
fs/f2fs/checkpoint.c

index 3da6499..d04113b 100644 (file)
@@ -785,9 +785,11 @@ void update_dirty_page(struct inode *inode, struct page *page)
                        !S_ISLNK(inode->i_mode))
                return;
 
-       spin_lock(&sbi->inode_lock[type]);
-       __add_dirty_inode(inode, type);
-       spin_unlock(&sbi->inode_lock[type]);
+       if (type != FILE_INODE || test_opt(sbi, DATA_FLUSH)) {
+               spin_lock(&sbi->inode_lock[type]);
+               __add_dirty_inode(inode, type);
+               spin_unlock(&sbi->inode_lock[type]);
+       }
 
        inode_inc_dirty_pages(inode);
        SetPagePrivate(page);
@@ -803,6 +805,9 @@ void remove_dirty_inode(struct inode *inode)
                        !S_ISLNK(inode->i_mode))
                return;
 
+       if (type == FILE_INODE && !test_opt(sbi, DATA_FLUSH))
+               return;
+
        spin_lock(&sbi->inode_lock[type]);
        __remove_dirty_inode(inode, type);
        spin_unlock(&sbi->inode_lock[type]);