mirror of
https://github.com/torvalds/linux.git
synced 2026-05-31 10:33:41 +02:00
btrfs: factor out do_async_reclaim_{data,metadata}_space()
Factor out the main part of btrfs_async_reclaim_data_space() to do_async_reclaim_data_space(), so it can take data space_info parameter it is working on. Do the same for metadata. There is no functional change. Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com> Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
ac5578fef3
commit
4ec06a9ddb
|
|
@ -1088,23 +1088,15 @@ static bool maybe_fail_all_tickets(struct btrfs_fs_info *fs_info,
|
|||
return (tickets_id != space_info->tickets_id);
|
||||
}
|
||||
|
||||
/*
|
||||
* This is for normal flushers, we can wait all goddamned day if we want to. We
|
||||
* will loop and continuously try to flush as long as we are making progress.
|
||||
* We count progress as clearing off tickets each time we have to loop.
|
||||
*/
|
||||
static void btrfs_async_reclaim_metadata_space(struct work_struct *work)
|
||||
static void do_async_reclaim_metadata_space(struct btrfs_space_info *space_info)
|
||||
{
|
||||
struct btrfs_fs_info *fs_info;
|
||||
struct btrfs_space_info *space_info;
|
||||
struct btrfs_fs_info *fs_info = space_info->fs_info;
|
||||
u64 to_reclaim;
|
||||
enum btrfs_flush_state flush_state;
|
||||
int commit_cycles = 0;
|
||||
u64 last_tickets_id;
|
||||
enum btrfs_flush_state final_state;
|
||||
|
||||
fs_info = container_of(work, struct btrfs_fs_info, async_reclaim_work);
|
||||
space_info = btrfs_find_space_info(fs_info, BTRFS_BLOCK_GROUP_METADATA);
|
||||
if (btrfs_is_zoned(fs_info))
|
||||
final_state = RESET_ZONES;
|
||||
else
|
||||
|
|
@ -1178,6 +1170,21 @@ static void btrfs_async_reclaim_metadata_space(struct work_struct *work)
|
|||
} while (flush_state <= final_state);
|
||||
}
|
||||
|
||||
/*
|
||||
* This is for normal flushers, it can wait as much time as needed. We will
|
||||
* loop and continuously try to flush as long as we are making progress. We
|
||||
* count progress as clearing off tickets each time we have to loop.
|
||||
*/
|
||||
static void btrfs_async_reclaim_metadata_space(struct work_struct *work)
|
||||
{
|
||||
struct btrfs_fs_info *fs_info;
|
||||
struct btrfs_space_info *space_info;
|
||||
|
||||
fs_info = container_of(work, struct btrfs_fs_info, async_reclaim_work);
|
||||
space_info = btrfs_find_space_info(fs_info, BTRFS_BLOCK_GROUP_METADATA);
|
||||
do_async_reclaim_metadata_space(space_info);
|
||||
}
|
||||
|
||||
/*
|
||||
* This handles pre-flushing of metadata space before we get to the point that
|
||||
* we need to start blocking threads on tickets. The logic here is different
|
||||
|
|
@ -1323,16 +1330,12 @@ static const enum btrfs_flush_state data_flush_states[] = {
|
|||
ALLOC_CHUNK_FORCE,
|
||||
};
|
||||
|
||||
static void btrfs_async_reclaim_data_space(struct work_struct *work)
|
||||
static void do_async_reclaim_data_space(struct btrfs_space_info *space_info)
|
||||
{
|
||||
struct btrfs_fs_info *fs_info;
|
||||
struct btrfs_space_info *space_info;
|
||||
struct btrfs_fs_info *fs_info = space_info->fs_info;
|
||||
u64 last_tickets_id;
|
||||
enum btrfs_flush_state flush_state = 0;
|
||||
|
||||
fs_info = container_of(work, struct btrfs_fs_info, async_data_reclaim_work);
|
||||
space_info = fs_info->data_sinfo;
|
||||
|
||||
spin_lock(&space_info->lock);
|
||||
if (list_empty(&space_info->tickets)) {
|
||||
space_info->flush = 0;
|
||||
|
|
@ -1400,6 +1403,16 @@ static void btrfs_async_reclaim_data_space(struct work_struct *work)
|
|||
spin_unlock(&space_info->lock);
|
||||
}
|
||||
|
||||
static void btrfs_async_reclaim_data_space(struct work_struct *work)
|
||||
{
|
||||
struct btrfs_fs_info *fs_info;
|
||||
struct btrfs_space_info *space_info;
|
||||
|
||||
fs_info = container_of(work, struct btrfs_fs_info, async_data_reclaim_work);
|
||||
space_info = fs_info->data_sinfo;
|
||||
do_async_reclaim_data_space(space_info);
|
||||
}
|
||||
|
||||
void btrfs_init_async_reclaim_work(struct btrfs_fs_info *fs_info)
|
||||
{
|
||||
INIT_WORK(&fs_info->async_reclaim_work, btrfs_async_reclaim_metadata_space);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user