public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/2] btrfs: enhance BTRFS_ORDERED_* flags sanity checks
@ 2026-03-14  0:00 Qu Wenruo
  2026-03-14  0:00 ` [PATCH v2 1/2] btrfs: check type flags in alloc_ordered_extent() Qu Wenruo
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Qu Wenruo @ 2026-03-14  0:00 UTC (permalink / raw)
  To: linux-btrfs

[CHANGELOG]
v2:
- Minor grammar fixes
- Change the output message when overlapping OEs are found
- Use has_single_bit_set() to replace hweight*()


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] 4+ messages in thread

end of thread, other threads:[~2026-03-16  8:49 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-14  0:00 [PATCH v2 0/2] btrfs: enhance BTRFS_ORDERED_* flags sanity checks Qu Wenruo
2026-03-14  0:00 ` [PATCH v2 1/2] btrfs: check type flags in alloc_ordered_extent() Qu Wenruo
2026-03-14  0:00 ` [PATCH v2 2/2] btrfs: output more info when duplicated ordered extent is found Qu Wenruo
2026-03-16  8:49 ` [PATCH v2 0/2] btrfs: enhance BTRFS_ORDERED_* flags sanity checks David Sterba

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