diff options
-rw-r--r-- | fs/f2fs/gc.c | 5 | ||||
-rw-r--r-- | fs/f2fs/inode.c | 2 | ||||
-rw-r--r-- | fs/f2fs/super.c | 18 |
3 files changed, 25 insertions, 0 deletions
diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c index c386910dacc5..9b5d0aad5daf 100644 --- a/fs/f2fs/gc.c +++ b/fs/f2fs/gc.c | |||
@@ -44,6 +44,11 @@ static int gc_thread_func(void *data) | |||
44 | if (kthread_should_stop()) | 44 | if (kthread_should_stop()) |
45 | break; | 45 | break; |
46 | 46 | ||
47 | if (sbi->sb->s_writers.frozen >= SB_FREEZE_WRITE) { | ||
48 | wait_ms = GC_THREAD_MAX_SLEEP_TIME; | ||
49 | continue; | ||
50 | } | ||
51 | |||
47 | f2fs_balance_fs(sbi); | 52 | f2fs_balance_fs(sbi); |
48 | 53 | ||
49 | if (!test_opt(sbi, BG_GC)) | 54 | if (!test_opt(sbi, BG_GC)) |
diff --git a/fs/f2fs/inode.c b/fs/f2fs/inode.c index 340a21be5a76..62433c63e2db 100644 --- a/fs/f2fs/inode.c +++ b/fs/f2fs/inode.c | |||
@@ -278,6 +278,7 @@ void f2fs_evict_inode(struct inode *inode) | |||
278 | if (inode->i_nlink || is_bad_inode(inode)) | 278 | if (inode->i_nlink || is_bad_inode(inode)) |
279 | goto no_delete; | 279 | goto no_delete; |
280 | 280 | ||
281 | sb_start_intwrite(inode->i_sb); | ||
281 | set_inode_flag(F2FS_I(inode), FI_NO_ALLOC); | 282 | set_inode_flag(F2FS_I(inode), FI_NO_ALLOC); |
282 | i_size_write(inode, 0); | 283 | i_size_write(inode, 0); |
283 | 284 | ||
@@ -285,6 +286,7 @@ void f2fs_evict_inode(struct inode *inode) | |||
285 | f2fs_truncate(inode); | 286 | f2fs_truncate(inode); |
286 | 287 | ||
287 | remove_inode_page(inode); | 288 | remove_inode_page(inode); |
289 | sb_end_intwrite(inode->i_sb); | ||
288 | no_delete: | 290 | no_delete: |
289 | clear_inode(inode); | 291 | clear_inode(inode); |
290 | } | 292 | } |
diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c index 25656b6869a4..0b18aee2ed25 100644 --- a/fs/f2fs/super.c +++ b/fs/f2fs/super.c | |||
@@ -143,6 +143,22 @@ int f2fs_sync_fs(struct super_block *sb, int sync) | |||
143 | return 0; | 143 | return 0; |
144 | } | 144 | } |
145 | 145 | ||
146 | static int f2fs_freeze(struct super_block *sb) | ||
147 | { | ||
148 | int err; | ||
149 | |||
150 | if (sb->s_flags & MS_RDONLY) | ||
151 | return 0; | ||
152 | |||
153 | err = f2fs_sync_fs(sb, 1); | ||
154 | return err; | ||
155 | } | ||
156 | |||
157 | static int f2fs_unfreeze(struct super_block *sb) | ||
158 | { | ||
159 | return 0; | ||
160 | } | ||
161 | |||
146 | static int f2fs_statfs(struct dentry *dentry, struct kstatfs *buf) | 162 | static int f2fs_statfs(struct dentry *dentry, struct kstatfs *buf) |
147 | { | 163 | { |
148 | struct super_block *sb = dentry->d_sb; | 164 | struct super_block *sb = dentry->d_sb; |
@@ -213,6 +229,8 @@ static struct super_operations f2fs_sops = { | |||
213 | .evict_inode = f2fs_evict_inode, | 229 | .evict_inode = f2fs_evict_inode, |
214 | .put_super = f2fs_put_super, | 230 | .put_super = f2fs_put_super, |
215 | .sync_fs = f2fs_sync_fs, | 231 | .sync_fs = f2fs_sync_fs, |
232 | .freeze_fs = f2fs_freeze, | ||
233 | .unfreeze_fs = f2fs_unfreeze, | ||
216 | .statfs = f2fs_statfs, | 234 | .statfs = f2fs_statfs, |
217 | }; | 235 | }; |
218 | 236 | ||