Skip to content

Commit

Permalink
btrfs: reinsert BGs failed to reclaim
Browse files Browse the repository at this point in the history
commit 7e27180 upstream.

The reclaim process can temporarily fail. For example, if the space is
getting tight, it fails to make the block group read-only. If there are no
further writes on that block group, the block group will never get back to
the reclaim list, and the BG never gets reclaimed. In a certain workload,
we can leave many such block groups never reclaimed.

So, let's get it back to the list and give it a chance to be reclaimed.

Fixes: 18bb8bb ("btrfs: zoned: automatically reclaim zones")
CC: stable@vger.kernel.org # 5.15+
Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
naota authored and gregkh committed Jul 19, 2023
1 parent 7b06370 commit 6c65062
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions fs/btrfs/block-group.c
Original file line number Diff line number Diff line change
Expand Up @@ -1837,6 +1837,8 @@ void btrfs_reclaim_bgs_work(struct work_struct *work)
}

next:
if (ret)
btrfs_mark_bg_to_reclaim(bg);
btrfs_put_block_group(bg);

mutex_unlock(&fs_info->reclaim_bgs_lock);
Expand Down

0 comments on commit 6c65062

Please sign in to comment.