aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJaegeuk Kim <jaegeuk.kim@samsung.com>2013-10-10 01:36:00 -0400
committerJaegeuk Kim <jaegeuk.kim@samsung.com>2013-10-17 20:44:13 -0400
commitb1838f8952123842b00d6f8979e0f19a3b680e87 (patch)
treef93aa47a01af72ed58010097bd2ef78b78f56736
parent3d1e38073b3f33d31df1ae09aaccab3dfd9fb61e (diff)
f2fs: fix the starvation problem on cp_rwsem
This patch removes the logic previously introduced to address the starvation on cp_rwsem. One potential there-in bug is that we should cover the wait.list with spin_lock, but the previous code broke this rule. And, actually current rwsem handles this starvation issue reasonably, so that we didn't need to do this before neither. Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
-rw-r--r--fs/f2fs/f2fs.h13
-rw-r--r--fs/f2fs/super.c1
2 files changed, 0 insertions, 14 deletions
diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
index a955a59dfdbe..308967b71674 100644
--- a/fs/f2fs/f2fs.h
+++ b/fs/f2fs/f2fs.h
@@ -18,8 +18,6 @@
18#include <linux/crc32.h> 18#include <linux/crc32.h>
19#include <linux/magic.h> 19#include <linux/magic.h>
20#include <linux/kobject.h> 20#include <linux/kobject.h>
21#include <linux/wait.h>
22#include <linux/sched.h>
23 21
24/* 22/*
25 * For mount options 23 * For mount options
@@ -360,7 +358,6 @@ struct f2fs_sb_info {
360 struct inode *meta_inode; /* cache meta blocks */ 358 struct inode *meta_inode; /* cache meta blocks */
361 struct mutex cp_mutex; /* checkpoint procedure lock */ 359 struct mutex cp_mutex; /* checkpoint procedure lock */
362 struct rw_semaphore cp_rwsem; /* blocking FS operations */ 360 struct rw_semaphore cp_rwsem; /* blocking FS operations */
363 wait_queue_head_t cp_wait; /* checkpoint wait queue */
364 struct mutex node_write; /* locking node writes */ 361 struct mutex node_write; /* locking node writes */
365 struct mutex writepages; /* mutex for writepages() */ 362 struct mutex writepages; /* mutex for writepages() */
366 int por_doing; /* recovery is doing or not */ 363 int por_doing; /* recovery is doing or not */
@@ -516,13 +513,6 @@ static inline void clear_ckpt_flags(struct f2fs_checkpoint *cp, unsigned int f)
516 513
517static inline void f2fs_lock_op(struct f2fs_sb_info *sbi) 514static inline void f2fs_lock_op(struct f2fs_sb_info *sbi)
518{ 515{
519 /*
520 * If the checkpoint thread is waiting for cp_rwsem, add cuurent task
521 * into wait list to avoid the checkpoint thread starvation
522 */
523 while (!list_empty(&sbi->cp_rwsem.wait_list))
524 wait_event_interruptible(sbi->cp_wait,
525 list_empty(&sbi->cp_rwsem.wait_list));
526 down_read(&sbi->cp_rwsem); 516 down_read(&sbi->cp_rwsem);
527} 517}
528 518
@@ -539,9 +529,6 @@ static inline void f2fs_lock_all(struct f2fs_sb_info *sbi)
539static inline void f2fs_unlock_all(struct f2fs_sb_info *sbi) 529static inline void f2fs_unlock_all(struct f2fs_sb_info *sbi)
540{ 530{
541 up_write(&sbi->cp_rwsem); 531 up_write(&sbi->cp_rwsem);
542
543 /* wake up all tasks blocked by checkpoint */
544 wake_up_all(&sbi->cp_wait);
545} 532}
546 533
547/* 534/*
diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
index 539c009d4138..3b786c85b5cd 100644
--- a/fs/f2fs/super.c
+++ b/fs/f2fs/super.c
@@ -841,7 +841,6 @@ static int f2fs_fill_super(struct super_block *sb, void *data, int silent)
841 spin_lock_init(&sbi->stat_lock); 841 spin_lock_init(&sbi->stat_lock);
842 init_rwsem(&sbi->bio_sem); 842 init_rwsem(&sbi->bio_sem);
843 init_rwsem(&sbi->cp_rwsem); 843 init_rwsem(&sbi->cp_rwsem);
844 init_waitqueue_head(&sbi->cp_wait);
845 init_sb_info(sbi); 844 init_sb_info(sbi);
846 845
847 /* get an inode for meta space */ 846 /* get an inode for meta space */