From fe4fb3a08f906eb36c9ea8adf05373b9a4b5d92f Mon Sep 17 00:00:00 2001 From: Changman Lee Date: Tue, 29 Jan 2013 18:30:07 +0900 Subject: [PATCH] --- yaml --- r: 358981 b: refs/heads/master c: d6212a5f18c8f9f9cc884070a96e11907711217f h: refs/heads/master i: 358979: 4d6625065d56d63ab9141531d177bfd5302c500c v: v3 --- [refs] | 2 +- trunk/fs/f2fs/gc.c | 5 +++++ trunk/fs/f2fs/inode.c | 2 ++ trunk/fs/f2fs/super.c | 18 ++++++++++++++++++ 4 files changed, 26 insertions(+), 1 deletion(-) diff --git a/[refs] b/[refs] index 57e531dd3421..5366a21bed61 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: a2617dc6863b21a8109c199ab533b3dbfe178f27 +refs/heads/master: d6212a5f18c8f9f9cc884070a96e11907711217f diff --git a/trunk/fs/f2fs/gc.c b/trunk/fs/f2fs/gc.c index c386910dacc5..9b5d0aad5daf 100644 --- a/trunk/fs/f2fs/gc.c +++ b/trunk/fs/f2fs/gc.c @@ -44,6 +44,11 @@ static int gc_thread_func(void *data) if (kthread_should_stop()) break; + if (sbi->sb->s_writers.frozen >= SB_FREEZE_WRITE) { + wait_ms = GC_THREAD_MAX_SLEEP_TIME; + continue; + } + f2fs_balance_fs(sbi); if (!test_opt(sbi, BG_GC)) diff --git a/trunk/fs/f2fs/inode.c b/trunk/fs/f2fs/inode.c index 340a21be5a76..62433c63e2db 100644 --- a/trunk/fs/f2fs/inode.c +++ b/trunk/fs/f2fs/inode.c @@ -278,6 +278,7 @@ void f2fs_evict_inode(struct inode *inode) if (inode->i_nlink || is_bad_inode(inode)) goto no_delete; + sb_start_intwrite(inode->i_sb); set_inode_flag(F2FS_I(inode), FI_NO_ALLOC); i_size_write(inode, 0); @@ -285,6 +286,7 @@ void f2fs_evict_inode(struct inode *inode) f2fs_truncate(inode); remove_inode_page(inode); + sb_end_intwrite(inode->i_sb); no_delete: clear_inode(inode); } diff --git a/trunk/fs/f2fs/super.c b/trunk/fs/f2fs/super.c index 25656b6869a4..0b18aee2ed25 100644 --- a/trunk/fs/f2fs/super.c +++ b/trunk/fs/f2fs/super.c @@ -143,6 +143,22 @@ int f2fs_sync_fs(struct super_block *sb, int sync) return 0; } +static int f2fs_freeze(struct super_block *sb) +{ + int err; + + if (sb->s_flags & MS_RDONLY) + return 0; + + err = f2fs_sync_fs(sb, 1); + return err; +} + +static int f2fs_unfreeze(struct super_block *sb) +{ + return 0; +} + static int f2fs_statfs(struct dentry *dentry, struct kstatfs *buf) { struct super_block *sb = dentry->d_sb; @@ -213,6 +229,8 @@ static struct super_operations f2fs_sops = { .evict_inode = f2fs_evict_inode, .put_super = f2fs_put_super, .sync_fs = f2fs_sync_fs, + .freeze_fs = f2fs_freeze, + .unfreeze_fs = f2fs_unfreeze, .statfs = f2fs_statfs, };