You've already forked linux-apfs
mirror of
https://github.com/linux-apfs/linux-apfs.git
synced 2026-05-01 15:00:59 -07:00
Btrfs: barrier before waitqueue_active
We need a barrir before calling waitqueue_active otherwise we will miss wakeups. So in places that do atomic_dec(); then atomic_read() use atomic_dec_return() which imply a memory barrier (see memory-barriers.txt) and then add an explicit memory barrier everywhere else that need them. Thanks, Signed-off-by: Josef Bacik <jbacik@fusionio.com>
This commit is contained in:
+1
-3
@@ -1007,9 +1007,7 @@ static noinline void async_cow_submit(struct btrfs_work *work)
|
||||
nr_pages = (async_cow->end - async_cow->start + PAGE_CACHE_SIZE) >>
|
||||
PAGE_CACHE_SHIFT;
|
||||
|
||||
atomic_sub(nr_pages, &root->fs_info->async_delalloc_pages);
|
||||
|
||||
if (atomic_read(&root->fs_info->async_delalloc_pages) <
|
||||
if (atomic_sub_return(nr_pages, &root->fs_info->async_delalloc_pages) <
|
||||
5 * 1024 * 1024 &&
|
||||
waitqueue_active(&root->fs_info->async_submit_wait))
|
||||
wake_up(&root->fs_info->async_submit_wait);
|
||||
|
||||
Reference in New Issue
Block a user