Skip to contentSkip to conversation

xfs/614: query correct direct I/O alignment

PATCH In review Christoph Hellwig 3 participants 8 messages Feb 4, 2025 – Feb 10, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 xfs/614: query correct direct I/O alignment

When creating XFS file systems on files, mkfs will query the file system for the minimum alignment, which can be larger than that of the underlying device. Do the same to link the right output file.

---
 tests/xfs/614 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tests/xfs/614 +1 -1
index 0f8952e50b9a..06cc2384f38c 100755
@@ -26,7 +26,7 @@ _require_loop
 $MKFS_XFS_PROG 2>&1 | grep -q concurrency || \
 	_notrun "mkfs does not support concurrency options"
 
-test_dev_lbasize=$(blockdev --getss $TEST_DEV)
+test_dev_lbasize=$($here/src/min_dio_alignment $TEST_DIR $TEST_DEV)
 seqfull=$0
 _link_out_file "lba${test_dev_lbasize}"
 
Signature · 1 line
2.45.2
#1 lore raw

PATCH 2/2 xfs/614: remove the _require_loop call

This test only creates file system images as regular files, but never actually uses the kernel loop driver. Remove the extra requirement.

---
 tests/xfs/614 | 1 -
 1 file changed, 1 deletion(-)
tests/xfs/614 +0 -1
index 06cc2384f38c..f2ea99edb342 100755
@@ -22,7 +22,6 @@ _cleanup()
 
 
 _require_test
-_require_loop
 $MKFS_XFS_PROG 2>&1 | grep -q concurrency || \
 	_notrun "mkfs does not support concurrency options"
 
Signature · 1 line
2.45.2
Reviewed-by on v1 2/2
#2 lore raw

Re: [PATCH 2/2] xfs/614: remove the _require_loop call

Quoted 4 lines · Christoph Hellwig

This test only creates file system images as regular files, but never actually uses the kernel loop driver. Remove the extra requirement.

Oh, heh, yeah, loopdev not necessary!

--D

Quoted 20 lines
---
 tests/xfs/614 | 1 -
 1 file changed, 1 deletion(-)
tests/xfs/614 +0 -1
index 06cc2384f38c..f2ea99edb342 100755
@@ -22,7 +22,6 @@ _cleanup()
 
 
 _require_test
-_require_loop
 $MKFS_XFS_PROG 2>&1 | grep -q concurrency || \
 	_notrun "mkfs does not support concurrency options"
 
Signature · 1 line
2.45.2
#3 lore raw

Re: [PATCH 2/2] xfs/614: remove the _require_loop call

In reply to Christoph Hellwig
Quoted 5 lines · Christoph Hellwig

This test only creates file system images as regular files, but never actually uses the kernel loop driver. Remove the extra requirement.

---

I think this one doesn't depend on the [PATCH 1/2], so I'll merge this one at first. About the other one, I'll wait you or Darrick's next patch :)

Thanks,
Zorro

Quoted 18 lines
 tests/xfs/614 | 1 -
 1 file changed, 1 deletion(-)
tests/xfs/614 +0 -1
index 06cc2384f38c..f2ea99edb342 100755
@@ -22,7 +22,6 @@ _cleanup()
 
 
 _require_test
-_require_loop
 $MKFS_XFS_PROG 2>&1 | grep -q concurrency || \
 	_notrun "mkfs does not support concurrency options"
 
Signature · 1 line
2.45.2
#4 lore raw
In reply to Christoph Hellwig
Quoted 14 lines · Christoph Hellwig

When creating XFS file systems on files, mkfs will query the file system for the minimum alignment, which can be larger than that of the underlying device. Do the same to link the right output file.

---
 tests/xfs/614 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tests/xfs/614 +0 -0
index 0f8952e50b9a..06cc2384f38c 100755

tests/xfs/614 _require_loop · line 29

Quoted 5 lines
tests/xfs/614 +1 -1
@@ -26,7 +26,7 @@ _require_loop
 $MKFS_XFS_PROG 2>&1 | grep -q concurrency || \
 	_notrun "mkfs does not support concurrency options"
 
-test_dev_lbasize=$(blockdev --getss $TEST_DEV)
+test_dev_lbasize=$($here/src/min_dio_alignment $TEST_DIR $TEST_DEV)

Hmmmm... I have a patch with a similar aim in my dev tree that determines the lba size from whatever mkfs decides is the sector size:

# Figure out what sector size mkfs will use to format, which might be dependent

# upon the directio write geometry of the test filesystem.
loop_file=$TEST_DIR/$seq.loop
rm -f "$loop_file"
truncate -s 16M "$loop_file"
$MKFS_XFS_PROG -f -N "$loop_file" | _filter_mkfs 2>$tmp.mkfs >/dev/null
. $tmp.mkfs
seqfull=$0
_link_out_file "lba${sectsz}"

What do you think of that approach?

--D

Quoted 7 lines
tests/xfs/614 +0 -0
 seqfull=$0
 _link_out_file "lba${test_dev_lbasize}"
 
Signature · 1 line
2.45.2
#5 lore raw
Quoted 13 lines · Darrick J. Wong

Hmmmm... I have a patch with a similar aim in my dev tree that determines the lba size from whatever mkfs decides is the sector size:

# Figure out what sector size mkfs will use to format, which might be dependent

# upon the directio write geometry of the test filesystem.
loop_file=$TEST_DIR/$seq.loop
rm -f "$loop_file"
truncate -s 16M "$loop_file"
$MKFS_XFS_PROG -f -N "$loop_file" | _filter_mkfs 2>$tmp.mkfs >/dev/null
. $tmp.mkfs
seqfull=$0
_link_out_file "lba${sectsz}"
Quoted 1 line

What do you think of that approach?

That sound sensible. Where is that patch, it doesn't seem to be in the realtime-reflink branch that I'm usually working against.

#6 lore raw
Quoted 14 lines · Christoph Hellwig
Quoted 13 lines · Darrick J. Wong

Hmmmm... I have a patch with a similar aim in my dev tree that determines the lba size from whatever mkfs decides is the sector size:

# Figure out what sector size mkfs will use to format, which might be dependent

# upon the directio write geometry of the test filesystem.
loop_file=$TEST_DIR/$seq.loop
rm -f "$loop_file"
truncate -s 16M "$loop_file"
$MKFS_XFS_PROG -f -N "$loop_file" | _filter_mkfs 2>$tmp.mkfs >/dev/null
. $tmp.mkfs
seqfull=$0
_link_out_file "lba${sectsz}"
Quoted 4 lines
Quoted 1 line

What do you think of that approach?

That sound sensible. Where is that patch, it doesn't seem to be in the realtime-reflink branch that I'm usually working against.

It's one of the few zoned changes I have in the fstests branch:

https://git.kernel.org/pub/scm/linux/kernel/git/djwong/xfstests-dev.git/log/?h=zoned_2025-02-04

--D

#7 lore raw
Quoted 3 lines · Darrick J. Wong

It's one of the few zoned changes I have in the fstests branch:

https://git.kernel.org/pub/scm/linux/kernel/git/djwong/xfstests-dev.git/log/?h=zoned_2025-02-04

Oh, you probably want to pull this in to make your life easier:

http://git.infradead.org/?p=users/hch/xfstests-dev.git;a=shortlog;h=refs/heads/xfs-zoned-rebase

Note that the dio size mismatch also happens when using a 4k LBA rt device with a 512 byte LBA data device without any zoned code.