mirror of
https://github.com/raspberrypi/linux.git
synced 2025-12-16 06:51:42 +00:00
btrfs: simplify range parameters of btrfs_wait_ordered_roots()
The range is specified only in two ways, we can simplify the case for the whole filesystem range as a NULL block group parameter. Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
@@ -19,6 +19,7 @@
|
||||
#include "qgroup.h"
|
||||
#include "subpage.h"
|
||||
#include "file.h"
|
||||
#include "block-group.h"
|
||||
|
||||
static struct kmem_cache *btrfs_ordered_extent_cache;
|
||||
|
||||
@@ -711,11 +712,11 @@ static void btrfs_run_ordered_extent_work(struct btrfs_work *work)
|
||||
}
|
||||
|
||||
/*
|
||||
* wait for all the ordered extents in a root. This is done when balancing
|
||||
* space between drives.
|
||||
* Wait for all the ordered extents in a root. Use @bg as range or do whole
|
||||
* range if it's NULL.
|
||||
*/
|
||||
u64 btrfs_wait_ordered_extents(struct btrfs_root *root, u64 nr,
|
||||
const u64 range_start, const u64 range_len)
|
||||
const struct btrfs_block_group *bg)
|
||||
{
|
||||
struct btrfs_fs_info *fs_info = root->fs_info;
|
||||
LIST_HEAD(splice);
|
||||
@@ -723,7 +724,17 @@ u64 btrfs_wait_ordered_extents(struct btrfs_root *root, u64 nr,
|
||||
LIST_HEAD(works);
|
||||
struct btrfs_ordered_extent *ordered, *next;
|
||||
u64 count = 0;
|
||||
const u64 range_end = range_start + range_len;
|
||||
u64 range_start, range_len;
|
||||
u64 range_end;
|
||||
|
||||
if (bg) {
|
||||
range_start = bg->start;
|
||||
range_len = bg->length;
|
||||
} else {
|
||||
range_start = 0;
|
||||
range_len = U64_MAX;
|
||||
}
|
||||
range_end = range_start + range_len;
|
||||
|
||||
mutex_lock(&root->ordered_extent_mutex);
|
||||
spin_lock(&root->ordered_extent_lock);
|
||||
@@ -770,8 +781,12 @@ u64 btrfs_wait_ordered_extents(struct btrfs_root *root, u64 nr,
|
||||
return count;
|
||||
}
|
||||
|
||||
/*
|
||||
* Wait for @nr ordered extents that intersect the @bg, or the whole range of
|
||||
* the filesystem if @bg is NULL.
|
||||
*/
|
||||
void btrfs_wait_ordered_roots(struct btrfs_fs_info *fs_info, u64 nr,
|
||||
const u64 range_start, const u64 range_len)
|
||||
const struct btrfs_block_group *bg)
|
||||
{
|
||||
struct btrfs_root *root;
|
||||
LIST_HEAD(splice);
|
||||
@@ -789,8 +804,7 @@ void btrfs_wait_ordered_roots(struct btrfs_fs_info *fs_info, u64 nr,
|
||||
&fs_info->ordered_roots);
|
||||
spin_unlock(&fs_info->ordered_root_lock);
|
||||
|
||||
done = btrfs_wait_ordered_extents(root, nr,
|
||||
range_start, range_len);
|
||||
done = btrfs_wait_ordered_extents(root, nr, bg);
|
||||
btrfs_put_root(root);
|
||||
|
||||
spin_lock(&fs_info->ordered_root_lock);
|
||||
|
||||
Reference in New Issue
Block a user