diff options
| author | Filipe Manana <[email protected]> | 2024-06-03 12:25:00 +0000 |
|---|---|---|
| committer | David Sterba <[email protected]> | 2024-07-11 13:33:22 +0000 |
| commit | 03103ecf5ec95743615113e5d2d8feb8d1a42859 (patch) | |
| tree | 85395c593e99faf877be71bbb61991c64f4a9914 /fs/btrfs/ordered-data.c | |
| parent | btrfs: constify pointer parameters where applicable (diff) | |
| download | kernel-03103ecf5ec95743615113e5d2d8feb8d1a42859.tar.gz kernel-03103ecf5ec95743615113e5d2d8feb8d1a42859.zip | |
btrfs: reduce critical section at btrfs_wait_ordered_roots()
At btrfs_wait_ordered_roots(), there's no point in decrementing the
counter after locking fs_info->ordered_root_lock as the counter is local.
So change this to decrement the counter before taking the lock.
Reviewed-by: Josef Bacik <[email protected]>
Reviewed-by: Qu Wenruo <[email protected]>
Reviewed-by: Johannes Thumshirn <[email protected]>
Signed-off-by: Filipe Manana <[email protected]>
Reviewed-by: David Sterba <[email protected]>
Signed-off-by: David Sterba <[email protected]>
Diffstat (limited to 'fs/btrfs/ordered-data.c')
| -rw-r--r-- | fs/btrfs/ordered-data.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/fs/btrfs/ordered-data.c b/fs/btrfs/ordered-data.c index 65d0464cd646..15428a8d4886 100644 --- a/fs/btrfs/ordered-data.c +++ b/fs/btrfs/ordered-data.c @@ -829,10 +829,10 @@ void btrfs_wait_ordered_roots(struct btrfs_fs_info *fs_info, u64 nr, done = btrfs_wait_ordered_extents(root, nr, bg); btrfs_put_root(root); - spin_lock(&fs_info->ordered_root_lock); - if (nr != U64_MAX) { + if (nr != U64_MAX) nr -= done; - } + + spin_lock(&fs_info->ordered_root_lock); } list_splice_tail(&splice, &fs_info->ordered_roots); spin_unlock(&fs_info->ordered_root_lock); |
