]> git.hungrycats.org Git - linux/commitdiff
btrfs: stripe_alloc: show per-group trapped bytes in the space info dump
authorZygo Blaxell <ce3g8jdj@umail.furryterror.org>
Sat, 5 Sep 2026 09:50:30 +0000 (05:50 -0400)
committerZygo Blaxell <ce3g8jdj@umail.furryterror.org>
Sun, 6 Sep 2026 18:22:15 +0000 (14:22 -0400)
Assisted-by: Claude:claude-fable-5
fs/btrfs/space-info.c

index a8e3be86868064b485909ffa78ff887ed8629a1e..b275393131051b411603c9a1caedad3e9e32df35 100644 (file)
@@ -783,11 +783,15 @@ again:
                spin_lock(&cache->lock);
                avail = cache->length - cache->used - cache->pinned -
                        cache->reserved - cache->bytes_super - cache->zone_unusable;
+               if (READ_ONCE(cache->stripe_unusable_ready))
+                       avail -= min(avail, READ_ONCE(cache->stripe_unusable));
                btrfs_info(fs_info,
-"block group %llu has %llu bytes, %llu used %llu pinned %llu reserved %llu delalloc %llu super %llu zone_unusable (%llu bytes available) %s",
+"block group %llu has %llu bytes, %llu used %llu pinned %llu reserved %llu delalloc %llu super %llu zone_unusable %llu stripe_unusable (%llu bytes available) %s",
                           cache->start, cache->length, cache->used, cache->pinned,
                           cache->reserved, cache->delalloc_bytes,
                           cache->bytes_super, cache->zone_unusable,
+                          READ_ONCE(cache->stripe_unusable_ready) ?
+                                  READ_ONCE(cache->stripe_unusable) : 0,
                           avail, cache->ro ? "[readonly]" : "");
                spin_unlock(&cache->lock);
                btrfs_dump_free_space(cache, bytes);