public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] btrfs: enhance BTRFS_ORDERED_* flags sanity checks
@ 2026-03-07  9:13 Qu Wenruo
  2026-03-07  9:13 ` [PATCH 1/2] btrfs: check type flags in alloc_ordered_extent() Qu Wenruo
  2026-03-07  9:13 ` [PATCH 2/2] btrfs: output more info when duplicated ordered extent is found Qu Wenruo
  0 siblings, 2 replies; 6+ messages in thread
From: Qu Wenruo @ 2026-03-07  9:13 UTC (permalink / raw)
  To: linux-btrfs

During my development of introduce a new DELAYED type, I incorrectly
called something like:

	oe = alloc_ordered_extent(.., BTRFS_ORDERED_DELAYED, ..);

That doesn't trigger any warning at runtime, but will cause unexpected
bugs due to the fact that, BTRFS_ORDERED_* can not be directly used as a
flag. They are only bit numbers, thus should be utilized with bit
operations like "test_bit(BTRFS_ORDERED_DELAYED, ..)".

My stupid bug inspired me to enhance the @flags sanity checks in
alloc_ordered_extent().

The first one is to make sure that my stupid bug can always be caught
early.

The second one is to enhance the error message when a duplicated OE is
found during insert_ordered_extent().

Qu Wenruo (2):
  btrfs: check type flags in alloc_ordered_extent()
  btrfs: output more info when duplicated ordered extent is found

 fs/btrfs/ordered-data.c | 24 +++++++++++++++---
 fs/btrfs/ordered-data.h | 55 +++++++++++++++++++++++------------------
 2 files changed, 52 insertions(+), 27 deletions(-)

-- 
2.53.0


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

end of thread, other threads:[~2026-03-13 21:13 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-07  9:13 [PATCH 0/2] btrfs: enhance BTRFS_ORDERED_* flags sanity checks Qu Wenruo
2026-03-07  9:13 ` [PATCH 1/2] btrfs: check type flags in alloc_ordered_extent() Qu Wenruo
2026-03-13 19:36   ` David Sterba
2026-03-07  9:13 ` [PATCH 2/2] btrfs: output more info when duplicated ordered extent is found Qu Wenruo
2026-03-13 19:38   ` David Sterba
2026-03-13 21:13     ` Qu Wenruo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox