aboutsummaryrefslogtreecommitdiff
path: root/fs/f2fs/f2fs.h
diff options
context:
space:
mode:
authorGravatar Chao Yu <yuchao0@huawei.com> 2020-01-14 19:36:50 +0800
committerGravatar Jaegeuk Kim <jaegeuk@kernel.org> 2020-01-17 16:48:44 -0800
commitfb24fea75ca5ceef59f753494b2efd453606e08a (patch)
treecfd402783f78a9122d6b70551a1e786304463de9 /fs/f2fs/f2fs.h
parentf2fs: update f2fs document regarding to fsync_mode (diff)
downloadlinux-fb24fea75ca5ceef59f753494b2efd453606e08a.tar.gz
linux-fb24fea75ca5ceef59f753494b2efd453606e08a.tar.bz2
linux-fb24fea75ca5ceef59f753494b2efd453606e08a.zip
f2fs: change to use rwsem for gc_mutex
Mutex lock won't serialize callers, in order to avoid starving of unlucky caller, let's use rwsem lock instead. Signed-off-by: Chao Yu <yuchao0@huawei.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs/f2fs/f2fs.h')
-rw-r--r--fs/f2fs/f2fs.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
index e7208442d32a..61d62cd06449 100644
--- a/fs/f2fs/f2fs.h
+++ b/fs/f2fs/f2fs.h
@@ -1391,7 +1391,10 @@ struct f2fs_sb_info {
struct f2fs_mount_info mount_opt; /* mount options */
/* for cleaning operations */
- struct mutex gc_mutex; /* mutex for GC */
+ struct rw_semaphore gc_lock; /*
+ * semaphore for GC, avoid
+ * race between GC and GC or CP
+ */
struct f2fs_gc_kthread *gc_thread; /* GC thread */
unsigned int cur_victim_sec; /* current victim section num */
unsigned int gc_mode; /* current GC state */