]> git.hungrycats.org Git - linux/commitdiff
btrfs: print the error when reclaim fails to relocate a block group
authorZygo Blaxell <ce3g8jdj@umail.furryterror.org>
Sun, 27 Sep 2026 19:02:40 +0000 (15:02 -0400)
committerZygo Blaxell <ce3g8jdj@umail.furryterror.org>
Sun, 8 Nov 2026 23:38:18 +0000 (18:38 -0500)
When the background reclaim of a block group fails, the error is logged
as just "error relocating chunk <start>".  The reclaim worker retries
the group on its next pass, so a persistent failure shows up as the same
line every 30 seconds with nothing saying why: -ENOSPC from a
reservation, -EIO from a bad read, and -ETXTBSY from an active swapfile
all look alike, and telling them apart takes tracing the relocation
path.

Print the error code.

Assisted-by: Claude:claude-opus-5-5
fs/btrfs/block-group.c

index bc6168e3773ec2b933aa8b3068898310c19c8768..d853b203a43c6f66d6e76f473512001f611f84ef 100644 (file)
@@ -5598,8 +5598,8 @@ static int btrfs_reclaim_block_group(struct btrfs_block_group *bg, int *reclaime
        }
        if (ret) {
                btrfs_dec_block_group_ro(bg);
-               btrfs_err(fs_info, "error relocating chunk %llu",
-                         bg->start);
+               btrfs_err(fs_info, "error relocating chunk %llu: %d",
+                         bg->start, ret);
                used = 0;
                reserved = 0;
                spin_lock(&space_info->lock);