All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/4] btrfs: output more info for -ENOSPC caused transaction abort and other enhancement
@ 2022-07-15  6:57 Qu Wenruo
  2022-07-15  6:57 ` [PATCH 1/4] btrfs: output human readable space info flag Qu Wenruo
                   ` (4 more replies)
  0 siblings, 5 replies; 9+ messages in thread
From: Qu Wenruo @ 2022-07-15  6:57 UTC (permalink / raw)
  To: linux-btrfs

We have some internal reports of transaction abort with -ENOSPC.

Unfortunately it's really hard to debug, since we really got nothing
other than the error message for most cases.

Also we have helpers like __btrfs_dump_space_info(), it needs enospc_debug
mount option which only makes sense if the user can reproduce the bug
and retry with that mount option.

Considering ENOSPC should not happen for critical paths which failure
means transaction abort, we should dump all space info for debug purpose
if the transaction arbot is caused by -ENOSPC.

And since we're here, also enhance the output of
__btrfs_dump_space_info().

Now it should be more human readable, the exmaple would look like this:

 BTRFS info (device dm-1: state A): dumpping space info:
 BTRFS info (device dm-1: state A): space_info DATA has 1175552 free, is not full
 BTRFS info (device dm-1: state A):   total:         8388608
 BTRFS info (device dm-1: state A):   used:          7163904
 BTRFS info (device dm-1: state A):   pinned:        49152
 BTRFS info (device dm-1: state A):   reserved:      0
 BTRFS info (device dm-1: state A):   may_use:       0
 BTRFS info (device dm-1: state A):   read_only:     0
 BTRFS info (device dm-1: state A): space_info META has 263798784 free, is not full
 BTRFS info (device dm-1: state A):   total:         268435456
 BTRFS info (device dm-1: state A):   used:          180224
 BTRFS info (device dm-1: state A):   pinned:        196608
 BTRFS info (device dm-1: state A):   reserved:      0
 BTRFS info (device dm-1: state A):   may_use:       4194304
 BTRFS info (device dm-1: state A):   read_only:     65536
 BTRFS info (device dm-1: state A): space_info SYS has 8372224 free, is not full
 BTRFS info (device dm-1: state A):   total:         8388608
 BTRFS info (device dm-1: state A):   used:          16384
 BTRFS info (device dm-1: state A):   pinned:        0
 BTRFS info (device dm-1: state A):   reserved:      0
 BTRFS info (device dm-1: state A):   may_use:       0
 BTRFS info (device dm-1: state A):   read_only:     0
 BTRFS info (device dm-1: state A): dumpping metadata reservation:
 BTRFS info (device dm-1: state A):   global:          (3670016/3670016)
 BTRFS info (device dm-1: state A):   trans:           (0/0)
 BTRFS info (device dm-1: state A):   chuunk:          (0/0)
 BTRFS info (device dm-1: state A):   delayed_inode:   (0/0)
 BTRFS info (device dm-1: state A):   delayed_refs:    (524288/524288)
 BTRFS: error (device dm-1: state A) in cleanup_transaction:1971: errno=-28 No space left
 BTRFS info (device dm-1: state EA): forced readonly

---

Would this be a candidate for stable kernels?
I believe there will be a lot of conflicts, but I think the extra debug
info would be worthy the effort.

Furthermore, any recommendation on extra info needed would be
appreciated, as I'm not 100% sure if the space info dumps would be
enough.
E.g. for metadata over-commit cases, the META space info would not make
much sense.

Qu Wenruo (4):
  btrfs: output human readable space info flag
  btrfs: make __btrfs_dump_space_info() output better formatted
  btrfs: make DUMP_BLOCK_RSV() to have better output
  btrfs: dump all space infos if we abort transaction due to ENOSPC

 fs/btrfs/ctree.h      |  6 ++--
 fs/btrfs/space-info.c | 82 ++++++++++++++++++++++++++++++++-----------
 fs/btrfs/space-info.h |  2 ++
 fs/btrfs/super.c      |  4 ++-
 4 files changed, 71 insertions(+), 23 deletions(-)

-- 
2.37.0


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2022-07-15  8:18 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-07-15  6:57 [PATCH 0/4] btrfs: output more info for -ENOSPC caused transaction abort and other enhancement Qu Wenruo
2022-07-15  6:57 ` [PATCH 1/4] btrfs: output human readable space info flag Qu Wenruo
2022-07-15  6:57 ` [PATCH 2/4] btrfs: make __btrfs_dump_space_info() output better formatted Qu Wenruo
2022-07-15  6:57 ` [PATCH 3/4] btrfs: make DUMP_BLOCK_RSV() to have better output Qu Wenruo
2022-07-15  8:14   ` Johannes Thumshirn
2022-07-15  8:16     ` Qu Wenruo
2022-07-15  8:18       ` Johannes Thumshirn
2022-07-15  6:57 ` [PATCH 4/4] btrfs: dump all space infos if we abort transaction due to ENOSPC Qu Wenruo
2022-07-15  8:15 ` [PATCH 0/4] btrfs: output more info for -ENOSPC caused transaction abort and other enhancement Johannes Thumshirn

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.