Skip to contentSkip to conversation

btrfs/333: require scratch before checking encoded reads

PATCH Superseded Prabhakar Pujeri 2 participants 2 messages Sep 2 Btrfs file system

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 btrfs/333: require scratch before checking encoded reads

_require_btrfs_iouring_encoded_read() formats and mounts the scratch device while checking for encoded-read support. Without a configured scratch device, callers therefore fail inside the helper before any scratch requirement is checked.

Add _require_scratch at the top of the helper so that all of its callers skip cleanly when no scratch device is present.

Changes in v2:
- Move _require_scratch into _require_btrfs_iouring_encoded_read() so the requirement is enforced for all callers of the helper, per Qu Wenruo's suggestion. Revert the v1 caller-side change in btrfs/333.
- Cc Qu Wenruo.

v1: https://lore.kernel.org/fstests/[email protected]/

---
 common/btrfs | 1 +
 1 file changed, 1 insertion(+)
common/btrfs +1 -0
index a75fbf1..ccac862 100644
@@ -1055,6 +1055,7 @@ _require_btrfs_iouring_encoded_read()
 	local tmpfile
 	local ret
 
+	_require_scratch
 	_require_command src/btrfs_encoded_read
 
 	_scratch_mkfs &> /dev/null
Signature · 1 line
2.55.0
Reviewed-by on v2 1/1
#1 lore raw
Quoted 8 lines · Prabhakar Pujeri

_require_btrfs_iouring_encoded_read() formats and mounts the scratch device while checking for encoded-read support. Without a configured scratch device, callers therefore fail inside the helper before any scratch requirement is checked.

Add _require_scratch at the top of the helper so that all of its callers skip cleanly when no scratch device is present.

Quoted 7 lines

Changes in v2:
- Move _require_scratch into _require_btrfs_iouring_encoded_read() so the requirement is enforced for all callers of the helper, per Qu Wenruo's suggestion. Revert the v1 caller-side change in btrfs/333.
- Cc Qu Wenruo.

v1: https://lore.kernel.org/fstests/[email protected]/

Change log should be put after the "---" line.

Otherwise looks good to me.

Thanks,
Qu

Quoted 18 lines
---
  common/btrfs | 1 +
  1 file changed, 1 insertion(+)
common/btrfs +1 -0
index a75fbf1..ccac862 100644
@@ -1055,6 +1055,7 @@ _require_btrfs_iouring_encoded_read()
  	local tmpfile
  	local ret
 
+	_require_scratch
  	_require_command src/btrfs_encoded_read
 
  	_scratch_mkfs &> /dev/null