Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b1838f89 authored by Jaegeuk Kim's avatar Jaegeuk Kim
Browse files

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: default avatarJaegeuk Kim <jaegeuk.kim@samsung.com>
parent 3d1e3807
Loading
Loading
Loading
Loading
+0 −13
Original line number Original line Diff line number Diff line
@@ -18,8 +18,6 @@
#include <linux/crc32.h>
#include <linux/crc32.h>
#include <linux/magic.h>
#include <linux/magic.h>
#include <linux/kobject.h>
#include <linux/kobject.h>
#include <linux/wait.h>
#include <linux/sched.h>


/*
/*
 * For mount options
 * For mount options
@@ -360,7 +358,6 @@ struct f2fs_sb_info {
	struct inode *meta_inode;		/* cache meta blocks */
	struct inode *meta_inode;		/* cache meta blocks */
	struct mutex cp_mutex;			/* checkpoint procedure lock */
	struct mutex cp_mutex;			/* checkpoint procedure lock */
	struct rw_semaphore cp_rwsem;		/* blocking FS operations */
	struct rw_semaphore cp_rwsem;		/* blocking FS operations */
	wait_queue_head_t cp_wait;		/* checkpoint wait queue */
	struct mutex node_write;		/* locking node writes */
	struct mutex node_write;		/* locking node writes */
	struct mutex writepages;		/* mutex for writepages() */
	struct mutex writepages;		/* mutex for writepages() */
	int por_doing;				/* recovery is doing or not */
	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)


static inline void f2fs_lock_op(struct f2fs_sb_info *sbi)
static inline void f2fs_lock_op(struct f2fs_sb_info *sbi)
{
{
	/*
	 * If the checkpoint thread is waiting for cp_rwsem, add cuurent task
	 * into wait list to avoid the checkpoint thread starvation
	 */
	while (!list_empty(&sbi->cp_rwsem.wait_list))
		wait_event_interruptible(sbi->cp_wait,
				list_empty(&sbi->cp_rwsem.wait_list));
	down_read(&sbi->cp_rwsem);
	down_read(&sbi->cp_rwsem);
}
}


@@ -539,9 +529,6 @@ static inline void f2fs_lock_all(struct f2fs_sb_info *sbi)
static inline void f2fs_unlock_all(struct f2fs_sb_info *sbi)
static inline void f2fs_unlock_all(struct f2fs_sb_info *sbi)
{
{
	up_write(&sbi->cp_rwsem);
	up_write(&sbi->cp_rwsem);

	/* wake up all tasks blocked by checkpoint */
	wake_up_all(&sbi->cp_wait);
}
}


/*
/*
+0 −1
Original line number Original line Diff line number Diff line
@@ -841,7 +841,6 @@ static int f2fs_fill_super(struct super_block *sb, void *data, int silent)
	spin_lock_init(&sbi->stat_lock);
	spin_lock_init(&sbi->stat_lock);
	init_rwsem(&sbi->bio_sem);
	init_rwsem(&sbi->bio_sem);
	init_rwsem(&sbi->cp_rwsem);
	init_rwsem(&sbi->cp_rwsem);
	init_waitqueue_head(&sbi->cp_wait);
	init_sb_info(sbi);
	init_sb_info(sbi);


	/* get an inode for meta space */
	/* get an inode for meta space */