btrfs: use btrfs_fs_closing for background bg work
For both unused bg deletion and async balance work we'll happily run if the fs is closing. However I want to move these to their own worker thread, and they can be long running jobs, so add a check to see if we're closing and simply bail. Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com> Signed-off-by: Josef Bacik <josef@toxicpanda.com> Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
d1f68ba069
commit
2f12741f81
@ -1304,6 +1304,9 @@ void btrfs_delete_unused_bgs(struct btrfs_fs_info *fs_info)
|
|||||||
if (!test_bit(BTRFS_FS_OPEN, &fs_info->flags))
|
if (!test_bit(BTRFS_FS_OPEN, &fs_info->flags))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (btrfs_fs_closing(fs_info))
|
||||||
|
return;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Long running balances can keep us blocked here for eternity, so
|
* Long running balances can keep us blocked here for eternity, so
|
||||||
* simply skip deletion if we're unable to get the mutex.
|
* simply skip deletion if we're unable to get the mutex.
|
||||||
@ -1543,6 +1546,9 @@ void btrfs_reclaim_bgs_work(struct work_struct *work)
|
|||||||
if (!test_bit(BTRFS_FS_OPEN, &fs_info->flags))
|
if (!test_bit(BTRFS_FS_OPEN, &fs_info->flags))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (btrfs_fs_closing(fs_info))
|
||||||
|
return;
|
||||||
|
|
||||||
if (!btrfs_should_reclaim(fs_info))
|
if (!btrfs_should_reclaim(fs_info))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user