mirror of
https://github.com/team-infusion-developers/android_kernel_samsung_msm8976.git
synced 2024-11-07 04:09:21 +00:00
f2fs: use wq_has_sleeper for cp_wait wait_queue
We need to use wq_has_sleeper including smp_mb to consider cp_wait concurrency. Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
This commit is contained in:
parent
50e5d0bc0b
commit
5cb608f866
2 changed files with 22 additions and 2 deletions
|
@ -75,8 +75,7 @@ static void f2fs_write_end_io(struct bio *bio, int err)
|
|||
dec_page_count(sbi, F2FS_WRITEBACK);
|
||||
}
|
||||
|
||||
if (!get_pages(sbi, F2FS_WRITEBACK) &&
|
||||
!list_empty(&sbi->cp_wait.task_list))
|
||||
if (!get_pages(sbi, F2FS_WRITEBACK) && wq_has_sleeper(&sbi->cp_wait))
|
||||
wake_up(&sbi->cp_wait);
|
||||
|
||||
bio_put(bio);
|
||||
|
|
|
@ -105,6 +105,27 @@ static inline bool f2fs_crc_valid(__u32 blk_crc, void *buf, size_t buf_size)
|
|||
return f2fs_crc32(buf, buf_size) == blk_crc;
|
||||
}
|
||||
|
||||
/**
|
||||
* wq_has_sleeper - check if there are any waiting processes
|
||||
* @wq: wait queue head
|
||||
*
|
||||
* Returns true if wq has waiting processes
|
||||
*
|
||||
* Please refer to the comment for waitqueue_active.
|
||||
*/
|
||||
static inline bool wq_has_sleeper(wait_queue_head_t *wq)
|
||||
{
|
||||
/*
|
||||
* We need to be sure we are in sync with the
|
||||
* add_wait_queue modifications to the wait queue.
|
||||
*
|
||||
* This memory barrier should be paired with one on the
|
||||
* waiting side.
|
||||
*/
|
||||
smp_mb();
|
||||
return waitqueue_active(wq);
|
||||
}
|
||||
|
||||
/*
|
||||
* For checkpoint manager
|
||||
*/
|
||||
|
|
Loading…
Reference in a new issue