summaryrefslogtreecommitdiffstats
path: root/fs/btrfs/inode.c
diff options
context:
space:
mode:
authorJosef Bacik <jbacik@fusionio.com>2012-08-01 15:36:24 -0400
committerChris Mason <chris.mason@oracle.com>2012-08-28 16:53:33 -0400
commit66657b318e0e443ada229fccd40c8be86cfebdbf (patch)
treebf1334fff93556fbc8d82b26a6d5431fd9e74b5c /fs/btrfs/inode.c
parent1fa11e265fa2562fb713171b6a58e72bb7afd276 (diff)
downloadop-kernel-dev-66657b318e0e443ada229fccd40c8be86cfebdbf.zip
op-kernel-dev-66657b318e0e443ada229fccd40c8be86cfebdbf.tar.gz
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>
Diffstat (limited to 'fs/btrfs/inode.c')
-rw-r--r--fs/btrfs/inode.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 2d65c52..97baf00 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -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);
OpenPOWER on IntegriCloud