summaryrefslogtreecommitdiff
path: root/fs/f2fs/super.c
diff options
context:
space:
mode:
authorJaegeuk Kim <jaegeuk@kernel.org>2016-07-01 05:09:37 +0300
committerJaegeuk Kim <jaegeuk@kernel.org>2016-07-08 20:34:09 +0300
commitb56ab837a06f3042a54b17a2a4ab3300eb03ecf5 (patch)
treea5bf616a10f15b4d533aca11464968690f121036 /fs/f2fs/super.c
parenta2ee0a300344a6da76186129b078113354fe13d2 (diff)
downloadlinux-b56ab837a06f3042a54b17a2a4ab3300eb03ecf5.tar.xz
f2fs: avoid mark_inode_dirty
Let's check inode's dirtiness before calling mark_inode_dirty. Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs/f2fs/super.c')
-rw-r--r--fs/f2fs/super.c43
1 files changed, 26 insertions, 17 deletions
diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
index edd1b356d667..451dfb4041e8 100644
--- a/fs/f2fs/super.c
+++ b/fs/f2fs/super.c
@@ -625,29 +625,14 @@ static int f2fs_drop_inode(struct inode *inode)
return generic_drop_inode(inode);
}
-/*
- * f2fs_dirty_inode() is called from __mark_inode_dirty()
- *
- * We should call set_dirty_inode to write the dirty inode through write_inode.
- */
-static void f2fs_dirty_inode(struct inode *inode, int flags)
+int f2fs_inode_dirtied(struct inode *inode)
{
struct f2fs_sb_info *sbi = F2FS_I_SB(inode);
- if (inode->i_ino == F2FS_NODE_INO(sbi) ||
- inode->i_ino == F2FS_META_INO(sbi))
- return;
-
- if (flags == I_DIRTY_TIME)
- return;
-
- if (is_inode_flag_set(inode, FI_AUTO_RECOVER))
- clear_inode_flag(inode, FI_AUTO_RECOVER);
-
spin_lock(&sbi->inode_lock[DIRTY_META]);
if (is_inode_flag_set(inode, FI_DIRTY_INODE)) {
spin_unlock(&sbi->inode_lock[DIRTY_META]);
- return;
+ return 1;
}
set_inode_flag(inode, FI_DIRTY_INODE);
@@ -656,6 +641,8 @@ static void f2fs_dirty_inode(struct inode *inode, int flags)
inc_page_count(sbi, F2FS_DIRTY_IMETA);
stat_inc_dirty_inode(sbi, DIRTY_META);
spin_unlock(&sbi->inode_lock[DIRTY_META]);
+
+ return 0;
}
void f2fs_inode_synced(struct inode *inode)
@@ -675,6 +662,28 @@ void f2fs_inode_synced(struct inode *inode)
spin_unlock(&sbi->inode_lock[DIRTY_META]);
}
+/*
+ * f2fs_dirty_inode() is called from __mark_inode_dirty()
+ *
+ * We should call set_dirty_inode to write the dirty inode through write_inode.
+ */
+static void f2fs_dirty_inode(struct inode *inode, int flags)
+{
+ struct f2fs_sb_info *sbi = F2FS_I_SB(inode);
+
+ if (inode->i_ino == F2FS_NODE_INO(sbi) ||
+ inode->i_ino == F2FS_META_INO(sbi))
+ return;
+
+ if (flags == I_DIRTY_TIME)
+ return;
+
+ if (is_inode_flag_set(inode, FI_AUTO_RECOVER))
+ clear_inode_flag(inode, FI_AUTO_RECOVER);
+
+ f2fs_inode_dirtied(inode);
+}
+
static void f2fs_i_callback(struct rcu_head *head)
{
struct inode *inode = container_of(head, struct inode, i_rcu);