Skip to contentSkip to conversation

more lbs test fixes

PATCH Superseded Pankaj Raghav (Samsung) 4 participants 10 messages May 13, 2024 – May 27, 2024

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

v2 cover more lbs test fixes

From: Pankaj Raghav <[email protected]>

These are some of the tests that failed when we were working on LBS patches [1].

generic/436 and xfs/008 are adapted to work with bs > ps systems.

xfs/161 is an upstream failure, and it happens even on bs <= ps systems.

Changes since v1:
- Corrected copy pasta error in generic/436
- xfs/161 removed hardcoded and incorporated ritesh's comments

[1] https://lore.kernel.org/linux-xfs/[email protected]/

Pankaj Raghav (3):
xfs/161: adapt the test case for 64k FS blocksize generic/436: round up bufsz to nearest filesystem blksz xfs/008: use block size instead of the pagesize

 src/seek_sanity_test.c |  8 ++++----
 tests/xfs/008          | 19 ++++++++++---------
 tests/xfs/008.out      |  8 ++++----
 tests/xfs/161          | 16 ++++++++++++----
 4 files changed, 30 insertions(+), 21 deletions(-)

base-commit: b26d68da08e47e6508a96bee72b25823040ab67e

Signature · 1 line
2.34.1
#1 lore raw

PATCH v2 1/3 xfs/161: adapt the test case for 64k FS blocksize

From: Pankaj Raghav <[email protected]>

This test fails when xfs is formatted with 64k filesystem block size*. It fails because the soft quota is not exceeded with the hardcoded 64k pwrite, thereby, the grace time is not set. Even though soft quota is set to 12k for uid1, it is rounded up to the nearest blocksize.

*** Report for user quotas on device /dev/sdb3
Block grace time: 7days; Inode grace time: 7days
Block limits File limits
User used soft hard grace used soft hard grace
----------------------------------------------------------------------

0        --       0       0       0      0       3     0     0      0
1        --      64      64    1024      0       1     0     0      0
2        --      64       0       0      0       1     0     0      0

Adapt the pwrite to do twice the FS block size and set the soft limit to be 1 FS block and hard limit to be 100 FS blocks. This also gets rid of harcoded quota limit values.

* This happens even on a 64k pagesize system and it is not related to LBS effort.

---
 tests/xfs/161 | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)
tests/xfs/161 +12 -4
index 486fa6ca..5bda7019 100755
@@ -38,15 +38,23 @@ _qmount_option "usrquota"
 _scratch_xfs_db -c 'version' -c 'sb 0' -c 'p' >> $seqres.full
 _scratch_mount >> $seqres.full
 
+
+blksz=$(_get_file_block_size "$SCRATCH_MNT")
+# Write more than one block to exceed the soft block quota limit via
+# xfs_quota.
+filesz=$(( 2 * $blksz))
+lim_bsoft=$blksz
+lim_bhard=$(( 100 * blksz ))
+
 # Force the block counters for uid 1 and 2 above zero
-_pwrite_byte 0x61 0 64k $SCRATCH_MNT/a >> $seqres.full
-_pwrite_byte 0x61 0 64k $SCRATCH_MNT/b >> $seqres.full
+_pwrite_byte 0x61 0 $filesz $SCRATCH_MNT/a >> $seqres.full
+_pwrite_byte 0x61 0 $filesz $SCRATCH_MNT/b >> $seqres.full
 sync
 chown 1 $SCRATCH_MNT/a
 chown 2 $SCRATCH_MNT/b
 
 # Set quota limits on uid 1 before upgrading
-$XFS_QUOTA_PROG -x -c 'limit -u bsoft=12k bhard=1m 1' $SCRATCH_MNT
+$XFS_QUOTA_PROG -x -c 'limit -u bsoft='"$lim_bsoft"' bhard='"$lim_bhard"' 1' $SCRATCH_MNT
 
 # Make sure the grace period is at /some/ point in the future.  We have to
 # use bc because not all bashes can handle integer comparisons with 64-bit
@@ -71,7 +79,7 @@ _scratch_mount
 
 # Set a very generous grace period and quota limits on uid 2 after upgrading
 $XFS_QUOTA_PROG -x -c 'timer -u -b -d 2147483647' $SCRATCH_MNT
-$XFS_QUOTA_PROG -x -c 'limit -u bsoft=10000 bhard=150000 2' $SCRATCH_MNT
+$XFS_QUOTA_PROG -x -c 'limit -u bsoft='"$lim_bsoft"' bhard='"$lim_bhard"' 2' $SCRATCH_MNT
 
 # Query the grace periods to see if they got set properly after the upgrade.
 repquota -upn $SCRATCH_MNT > $tmp.repquota
Signature · 1 line
2.34.1
Reviewed-by on v2 1/3
#2 lore raw

Re: [PATCH v2 1/3] xfs/161: adapt the test case for 64k FS blocksize

Quoted 16 lines · Pankaj Raghav (Samsung)

From: Pankaj Raghav <[email protected]>

This test fails when xfs is formatted with 64k filesystem block size*. It fails because the soft quota is not exceeded with the hardcoded 64k pwrite, thereby, the grace time is not set. Even though soft quota is set to 12k for uid1, it is rounded up to the nearest blocksize.

*** Report for user quotas on device /dev/sdb3
Block grace time: 7days; Inode grace time: 7days
Block limits File limits
User used soft hard grace used soft hard grace
----------------------------------------------------------------------

0        --       0       0       0      0       3     0     0      0
1        --      64      64    1024      0       1     0     0      0
2        --      64       0       0      0       1     0     0      0
Quoted 8 lines

Adapt the pwrite to do twice the FS block size and set the soft limit to be 1 FS block and hard limit to be 100 FS blocks. This also gets rid of harcoded quota limit values.

* This happens even on a 64k pagesize system and it is not related to LBS effort.

Looks good to me. Small nit below.
(I can verify on Power once I am back)

Quoted 22 lines
---
 tests/xfs/161 | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)
tests/xfs/161 +8 -1
index 486fa6ca..5bda7019 100755
@@ -38,15 +38,23 @@ _qmount_option "usrquota"
 _scratch_xfs_db -c 'version' -c 'sb 0' -c 'p' >> $seqres.full
 _scratch_mount >> $seqres.full
 
+
+blksz=$(_get_file_block_size "$SCRATCH_MNT")
+# Write more than one block to exceed the soft block quota limit via
+# xfs_quota.
+filesz=$(( 2 * $blksz))
+lim_bsoft=$blksz
+lim_bhard=$(( 100 * blksz ))
+
 # Force the block counters for uid 1 and 2 above zero
-_pwrite_byte 0x61 0 64k $SCRATCH_MNT/a >> $seqres.full

tests/xfs/161 _qmount_option "usrquota" · line 57

Quoted 10 lines
tests/xfs/161 +3 -2
-_pwrite_byte 0x61 0 64k $SCRATCH_MNT/b >> $seqres.full
+_pwrite_byte 0x61 0 $filesz $SCRATCH_MNT/a >> $seqres.full
+_pwrite_byte 0x61 0 $filesz $SCRATCH_MNT/b >> $seqres.full
 sync
 chown 1 $SCRATCH_MNT/a
 chown 2 $SCRATCH_MNT/b
 
 # Set quota limits on uid 1 before upgrading
-$XFS_QUOTA_PROG -x -c 'limit -u bsoft=12k bhard=1m 1' $SCRATCH_MNT
+$XFS_QUOTA_PROG -x -c 'limit -u bsoft='"$lim_bsoft"' bhard='"$lim_bhard"' 1' $SCRATCH_MNT

Small nit: I am not sure if we really need so many quotes for '"$lim_bsoft"' and "'$lim_bhard"'.

Quoted 14 lines
tests/xfs/161 +1 -1
 # Make sure the grace period is at /some/ point in the future.  We have to
 # use bc because not all bashes can handle integer comparisons with 64-bit
@@ -71,7 +79,7 @@ _scratch_mount
 
 # Set a very generous grace period and quota limits on uid 2 after upgrading
 $XFS_QUOTA_PROG -x -c 'timer -u -b -d 2147483647' $SCRATCH_MNT
-$XFS_QUOTA_PROG -x -c 'limit -u bsoft=10000 bhard=150000 2' $SCRATCH_MNT
+$XFS_QUOTA_PROG -x -c 'limit -u bsoft='"$lim_bsoft"' bhard='"$lim_bhard"' 2' $SCRATCH_MNT
 
 # Query the grace periods to see if they got set properly after the upgrade.
 repquota -upn $SCRATCH_MNT > $tmp.repquota
Signature · 1 line
2.34.1
#3 lore raw

PATCH v2 2/3 generic/436: round up bufsz to nearest filesystem blksz

In reply to Pankaj Raghav (Samsung)

From: Pankaj Raghav <[email protected]>

SEEK_HOLE and SEEK_DATA work in filesystem block size granularity. So while filling up the buffer for test 13 - 16, round up the bufsz to the closest filesystem blksz.

As we only allowed blocksizes lower than the pagesize, this was never an issue and it always aligned. Once we have blocksize > pagesize, this assumption will break.

Fixes the test for LBS configuration.

---
 src/seek_sanity_test.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
src/seek_sanity_test.c +4 -4
index 48b3ccc0..a61ed3da 100644
@@ -541,7 +541,7 @@ static int test16(int fd, int testnum)
 {
 	int ret = 0;
 	char *buf = NULL;
-	int bufsz = sysconf(_SC_PAGE_SIZE);
+	int bufsz = roundup(sysconf(_SC_PAGE_SIZE), alloc_size);
 	int filsz = 4 << 20;
 
 	if (!unwritten_extents) {
@@ -591,7 +591,7 @@ static int test15(int fd, int testnum)
 {
 	int ret = 0;
 	char *buf = NULL;
-	int bufsz = sysconf(_SC_PAGE_SIZE);
+	int bufsz = roundup(sysconf(_SC_PAGE_SIZE), alloc_size);
 	int filsz = 4 << 20;
 
 	if (!unwritten_extents) {
@@ -643,7 +643,7 @@ static int test14(int fd, int testnum)
 {
 	int ret = 0;
 	char *buf = NULL;
-	int bufsz = sysconf(_SC_PAGE_SIZE) * 14;
+	int bufsz = roundup(sysconf(_SC_PAGE_SIZE) * 14, alloc_size);
 	int filsz = 4 << 20;
 
 	if (!unwritten_extents) {
@@ -692,7 +692,7 @@ static int test13(int fd, int testnum)
 {
 	int ret = 0;
 	char *buf = NULL;
-	int bufsz = sysconf(_SC_PAGE_SIZE) * 14;
+	int bufsz = roundup(sysconf(_SC_PAGE_SIZE) * 14, alloc_size);
 	int filsz = 4 << 20;
 
 	if (!unwritten_extents) {
Signature · 1 line
2.34.1
Reviewed-by on v2 2/3
#4 lore raw

Re: [PATCH v2 2/3] generic/436: round up bufsz to nearest filesystem blksz

Quoted 6 lines · Pankaj Raghav (Samsung)

From: Pankaj Raghav <[email protected]>

SEEK_HOLE and SEEK_DATA work in filesystem block size granularity. So while filling up the buffer for test 13 - 16, round up the bufsz to the closest filesystem blksz.

Quoted 7 lines

As we only allowed blocksizes lower than the pagesize, this was never an issue and it always aligned. Once we have blocksize > pagesize, this assumption will break.

Fixes the test for LBS configuration.

Seems fine to me

--D

Quoted 48 lines
---
 src/seek_sanity_test.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
src/seek_sanity_test.c +4 -4
index 48b3ccc0..a61ed3da 100644
@@ -541,7 +541,7 @@ static int test16(int fd, int testnum)
 {
 	int ret = 0;
 	char *buf = NULL;
-	int bufsz = sysconf(_SC_PAGE_SIZE);
+	int bufsz = roundup(sysconf(_SC_PAGE_SIZE), alloc_size);
 	int filsz = 4 << 20;
 
 	if (!unwritten_extents) {
@@ -591,7 +591,7 @@ static int test15(int fd, int testnum)
 {
 	int ret = 0;
 	char *buf = NULL;
-	int bufsz = sysconf(_SC_PAGE_SIZE);
+	int bufsz = roundup(sysconf(_SC_PAGE_SIZE), alloc_size);
 	int filsz = 4 << 20;
 
 	if (!unwritten_extents) {
@@ -643,7 +643,7 @@ static int test14(int fd, int testnum)
 {
 	int ret = 0;
 	char *buf = NULL;
-	int bufsz = sysconf(_SC_PAGE_SIZE) * 14;
+	int bufsz = roundup(sysconf(_SC_PAGE_SIZE) * 14, alloc_size);
 	int filsz = 4 << 20;
 
 	if (!unwritten_extents) {
@@ -692,7 +692,7 @@ static int test13(int fd, int testnum)
 {
 	int ret = 0;
 	char *buf = NULL;
-	int bufsz = sysconf(_SC_PAGE_SIZE) * 14;
+	int bufsz = roundup(sysconf(_SC_PAGE_SIZE) * 14, alloc_size);
 	int filsz = 4 << 20;
 
 	if (!unwritten_extents) {
Signature · 1 line
2.34.1
Reviewed-by on v2 2/3
#5 lore raw

Re: [PATCH v2 2/3] generic/436: round up bufsz to nearest filesystem blksz

In reply to Pankaj Raghav (Samsung)
Quoted 10 lines · Pankaj Raghav (Samsung)

From: Pankaj Raghav <[email protected]>

SEEK_HOLE and SEEK_DATA work in filesystem block size granularity. So while filling up the buffer for test 13 - 16, round up the bufsz to the closest filesystem blksz.

As we only allowed blocksizes lower than the pagesize, this was never an issue and it always aligned. Once we have blocksize > pagesize, this assumption will break.

Quoted 6 lines

Fixes the test for LBS configuration.

---
 src/seek_sanity_test.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

The change looks logical to me to align the bufsz to blocksize rather than pagesize for bs > ps. roundup() will not have any effect on bs == ps or bs < ps.

Also IIUC for LBS, even the page cache will have large folios. So essentially the folio's folio_size() that we have in the pagecache matches it's FS blocksize. (So blocksize = folio_size() is anyway true for LBS). I was curious about this because SEEK_HOLE/SEEK_DATA can query the pagecache if the filesystem has unwritten extents.

So this make sense that rather than aligning bufsz with base pagesize, it should be rounded up to FS blocksize to make SEEK_HOLE/SEEK_DATA work with LBS.

#6 lore raw

PATCH v2 3/3 xfs/008: use block size instead of the pagesize

In reply to Pankaj Raghav (Samsung)

From: Pankaj Raghav <[email protected]>

The testcase estimates to have ratio of 1:3/4 for holes:filesize. This holds true where the blocksize is always less than or equal to pagesize and the total size of the file is calculated based on the pagesize. There is an implicit assumption that blocksize will always be less than the pagesize.

LBS support will enable bs > ps where a minimum IO size is one block, which can be greater than a page. Adjust the size calculation to be based on the blocksize and not the pagesize.

---
 tests/xfs/008     | 19 ++++++++++---------
 tests/xfs/008.out |  8 ++++----
 2 files changed, 14 insertions(+), 13 deletions(-)
tests/xfs/008 +10 -9
index e7d6153b..e37e435a 100755
@@ -11,7 +11,8 @@ _begin_fstest rw ioctl auto quick
 
 status=0	# success is the default!
 pgsize=`$here/src/feature -s`
-
+fileblksize=$(_get_file_block_size "$TEST_DIR")
+blksize=$((fileblksize > pgsize ? fileblksize : pgsize))
 # Override the default cleanup function.
 _cleanup()
 {
@@ -21,7 +22,7 @@ _cleanup()
 
 _filter()
 {
-    sed -e "s/-b $pgsize/-b PGSIZE/g" \
+    sed -e "s/-b $blksize/-b BLKSIZE/g" \
 	-e "s/-l .* -c/-l FSIZE -c/g"
 }
 
@@ -73,17 +74,17 @@ _require_test
 # We are trying to create roughly 50 or 100 holes in a file
 # using random writes. Assuming a good distribution of 50 writes
 # in a file, the file only needs to be 3-4x the size of the write
-# size muliplied by the number of writes. Hence we use 200 * pgsize
-# for files we want 50 holes in and 400 * pgsize for files we want
+# size muliplied by the number of writes. Hence we use 200 * blksize
+# for files we want 50 holes in and 400 * blksize for files we want
 # 100 holes in. This keeps the runtime down as low as possible.
 #
-_do_test 1 50 "-l `expr 200 \* $pgsize` -c 50 -b $pgsize"
-_do_test 2 100 "-l `expr 400 \* $pgsize` -c 100 -b $pgsize"
-_do_test 3 100 "-l `expr 400 \* $pgsize` -c 100 -b 512"   # test partial pages
+_do_test 1 50 "-l `expr 200 \* $blksize` -c 50 -b $blksize"
+_do_test 2 100 "-l `expr 400 \* $blksize` -c 100 -b $blksize"
+_do_test 3 100 "-l `expr 400 \* $blksize` -c 100 -b 512"   # test partial blocks
 
 # rinse, lather, repeat for direct IO
-_do_test 4 50 "-d -l `expr 200 \* $pgsize` -c 50 -b $pgsize"
-_do_test 5 100 "-d -l `expr 400 \* $pgsize` -c 100 -b $pgsize"
+_do_test 4 50 "-d -l `expr 200 \* $blksize` -c 50 -b $blksize"
+_do_test 5 100 "-d -l `expr 400 \* $blksize` -c 100 -b $blksize"
 # note: direct IO requires page aligned IO
 
 # todo: realtime.
tests/xfs/008.out +4 -4
index 5e3ae8e3..0941e218 100644
@@ -1,10 +1,10 @@
 QA output created by 008
 
-randholes.1 : -l FSIZE -c 50 -b PGSIZE
+randholes.1 : -l FSIZE -c 50 -b BLKSIZE
 ------------------------------------------
 holes is in range
 
-randholes.2 : -l FSIZE -c 100 -b PGSIZE
+randholes.2 : -l FSIZE -c 100 -b BLKSIZE
 ------------------------------------------
 holes is in range
 
@@ -12,10 +12,10 @@ randholes.3 : -l FSIZE -c 100 -b 512
 ------------------------------------------
 holes is in range
 
-randholes.4 : -d -l FSIZE -c 50 -b PGSIZE
+randholes.4 : -d -l FSIZE -c 50 -b BLKSIZE
 ------------------------------------------
 holes is in range
 
-randholes.5 : -d -l FSIZE -c 100 -b PGSIZE
+randholes.5 : -d -l FSIZE -c 100 -b BLKSIZE
 ------------------------------------------
 holes is in range
Signature · 1 line
2.34.1
#7 lore raw

Re: [PATCH v2 3/3] xfs/008: use block size instead of the pagesize

Quoted 24 lines · Pankaj Raghav (Samsung)

From: Pankaj Raghav <[email protected]>

The testcase estimates to have ratio of 1:3/4 for holes:filesize. This holds true where the blocksize is always less than or equal to pagesize and the total size of the file is calculated based on the pagesize. There is an implicit assumption that blocksize will always be less than the pagesize.

LBS support will enable bs > ps where a minimum IO size is one block, which can be greater than a page. Adjust the size calculation to be based on the blocksize and not the pagesize.

---
 tests/xfs/008     | 19 ++++++++++---------
 tests/xfs/008.out |  8 ++++----
 2 files changed, 14 insertions(+), 13 deletions(-)
tests/xfs/008 +0 -0
index e7d6153b..e37e435a 100755

tests/xfs/008 _begin_fstest rw ioctl auto quick · line 15

Quoted 6 lines
tests/xfs/008 +2 -1
@@ -11,7 +11,8 @@ _begin_fstest rw ioctl auto quick
 
 status=0	# success is the default!
 pgsize=`$here/src/feature -s`
-
+fileblksize=$(_get_file_block_size "$TEST_DIR")
+blksize=$((fileblksize > pgsize ? fileblksize : pgsize))

I assume when the test might be written it might have assumed blocksize = pagesize. Hence the dependency on pagesize in this test.
If that assumption is correct, then we might not need these two paths and can just make it blocksize.

Do you see any problem with blocksize for any of the paths (bs = ps, bs < ps and bs > ps)?

Quoted 25 lines
tests/xfs/008 +3 -6
 # Override the default cleanup function.
 _cleanup()
 {
@@ -21,7 +22,7 @@ _cleanup()
 
 _filter()
 {
-    sed -e "s/-b $pgsize/-b PGSIZE/g" \
+    sed -e "s/-b $blksize/-b BLKSIZE/g" \
 	-e "s/-l .* -c/-l FSIZE -c/g"
 }
 
@@ -73,17 +74,17 @@ _require_test
 # We are trying to create roughly 50 or 100 holes in a file
 # using random writes. Assuming a good distribution of 50 writes
 # in a file, the file only needs to be 3-4x the size of the write
-# size muliplied by the number of writes. Hence we use 200 * pgsize
-# for files we want 50 holes in and 400 * pgsize for files we want
+# size muliplied by the number of writes. Hence we use 200 * blksize
+# for files we want 50 holes in and 400 * blksize for files we want
 # 100 holes in. This keeps the runtime down as low as possible.
 #
-_do_test 1 50 "-l `expr 200 \* $pgsize` -c 50 -b $pgsize"
-_do_test 2 100 "-l `expr 400 \* $pgsize` -c 100 -b $pgsize"
-_do_test 3 100 "-l `expr 400 \* $pgsize` -c 100 -b 512"   # test partial pages

tests/xfs/008 _require_test · line 88

Quoted 10 lines
tests/xfs/008 +5 -2
+_do_test 1 50 "-l `expr 200 \* $blksize` -c 50 -b $blksize"
+_do_test 2 100 "-l `expr 400 \* $blksize` -c 100 -b $blksize"
+_do_test 3 100 "-l `expr 400 \* $blksize` -c 100 -b 512"   # test partial blocks
 
 # rinse, lather, repeat for direct IO
-_do_test 4 50 "-d -l `expr 200 \* $pgsize` -c 50 -b $pgsize"
-_do_test 5 100 "-d -l `expr 400 \* $pgsize` -c 100 -b $pgsize"
+_do_test 4 50 "-d -l `expr 200 \* $blksize` -c 50 -b $blksize"
+_do_test 5 100 "-d -l `expr 400 \* $blksize` -c 100 -b $blksize"
 # note: direct IO requires page aligned IO

^^^ This last comment about direct-io alignment is not valid anymore since kernel 2.6. Maybe it's time to rip that comment off.

From man 2 open
O_DIRECT
<...>
If none of the above is available, then direct I/O support and alignment restrictions can only be assumed from known characteristics of the filesystem, the individual file, the underlying storage device(s), and the kernel
version. In Linux 2.4, most filesystems based on block devices require that the file offset and the length and memory address of all I/O segments be multiples of the filesystem block size (typically 4096 bytes). In Linux
2.6.0, this was relaxed to the logical block size of the block device (typically 512 bytes). A block device's logical block size can be determined using the ioctl(2) BLKSSZGET operation or from the shell using the command:

-ritesh

Quoted 34 lines
tests/xfs/008 +0 -0
 # todo: realtime.
tests/xfs/008.out +4 -4
index 5e3ae8e3..0941e218 100644
@@ -1,10 +1,10 @@
 QA output created by 008
 
-randholes.1 : -l FSIZE -c 50 -b PGSIZE
+randholes.1 : -l FSIZE -c 50 -b BLKSIZE
 ------------------------------------------
 holes is in range
 
-randholes.2 : -l FSIZE -c 100 -b PGSIZE
+randholes.2 : -l FSIZE -c 100 -b BLKSIZE
 ------------------------------------------
 holes is in range
 
@@ -12,10 +12,10 @@ randholes.3 : -l FSIZE -c 100 -b 512
 ------------------------------------------
 holes is in range
 
-randholes.4 : -d -l FSIZE -c 50 -b PGSIZE
+randholes.4 : -d -l FSIZE -c 50 -b BLKSIZE
 ------------------------------------------
 holes is in range
 
-randholes.5 : -d -l FSIZE -c 100 -b PGSIZE
+randholes.5 : -d -l FSIZE -c 100 -b BLKSIZE
 ------------------------------------------
 holes is in range
Signature · 1 line
2.34.1
#8 lore raw

Re: [PATCH v2 3/3] xfs/008: use block size instead of the pagesize

Quoted 38 lines · Ritesh Harjani
Quoted 24 lines · Pankaj Raghav (Samsung)

From: Pankaj Raghav <[email protected]>

The testcase estimates to have ratio of 1:3/4 for holes:filesize. This holds true where the blocksize is always less than or equal to pagesize and the total size of the file is calculated based on the pagesize. There is an implicit assumption that blocksize will always be less than the pagesize.

LBS support will enable bs > ps where a minimum IO size is one block, which can be greater than a page. Adjust the size calculation to be based on the blocksize and not the pagesize.

---
 tests/xfs/008     | 19 ++++++++++---------
 tests/xfs/008.out |  8 ++++----
 2 files changed, 14 insertions(+), 13 deletions(-)
tests/xfs/008 +0 -0
index e7d6153b..e37e435a 100755

tests/xfs/008 _begin_fstest rw ioctl auto quick · line 15

Quoted 6 lines
tests/xfs/008 +2 -1
@@ -11,7 +11,8 @@ _begin_fstest rw ioctl auto quick
 
 status=0	# success is the default!
 pgsize=`$here/src/feature -s`
-
+fileblksize=$(_get_file_block_size "$TEST_DIR")
+blksize=$((fileblksize > pgsize ? fileblksize : pgsize))

I assume when the test might be written it might have assumed blocksize = pagesize. Hence the dependency on pagesize in this test.
If that assumption is correct, then we might not need these two paths and can just make it blocksize.

Quoted 2 lines

Do you see any problem with blocksize for any of the paths (bs = ps, bs < ps and bs > ps)?

Thanks for the comments Ritesh. You are right about not needing to fallback to pgsize.

I made your suggested changes and I will send a new version soon.

Quoted 84 lines
Quoted 27 lines
tests/xfs/008 +3 -6
 # Override the default cleanup function.
 _cleanup()
 {
@@ -21,7 +22,7 @@ _cleanup()
 
 _filter()
 {
-    sed -e "s/-b $pgsize/-b PGSIZE/g" \
+    sed -e "s/-b $blksize/-b BLKSIZE/g" \
 	-e "s/-l .* -c/-l FSIZE -c/g"
 }
 
@@ -73,17 +74,17 @@ _require_test
 # We are trying to create roughly 50 or 100 holes in a file
 # using random writes. Assuming a good distribution of 50 writes
 # in a file, the file only needs to be 3-4x the size of the write
-# size muliplied by the number of writes. Hence we use 200 * pgsize
-# for files we want 50 holes in and 400 * pgsize for files we want
+# size muliplied by the number of writes. Hence we use 200 * blksize
+# for files we want 50 holes in and 400 * blksize for files we want
 # 100 holes in. This keeps the runtime down as low as possible.
 #
-_do_test 1 50 "-l `expr 200 \* $pgsize` -c 50 -b $pgsize"
-_do_test 2 100 "-l `expr 400 \* $pgsize` -c 100 -b $pgsize"
-_do_test 3 100 "-l `expr 400 \* $pgsize` -c 100 -b 512"   # test partial pages

tests/xfs/008 _require_test · line 88

Quoted 10 lines
tests/xfs/008 +5 -2
+_do_test 1 50 "-l `expr 200 \* $blksize` -c 50 -b $blksize"
+_do_test 2 100 "-l `expr 400 \* $blksize` -c 100 -b $blksize"
+_do_test 3 100 "-l `expr 400 \* $blksize` -c 100 -b 512"   # test partial blocks
 
 # rinse, lather, repeat for direct IO
-_do_test 4 50 "-d -l `expr 200 \* $pgsize` -c 50 -b $pgsize"
-_do_test 5 100 "-d -l `expr 400 \* $pgsize` -c 100 -b $pgsize"
+_do_test 4 50 "-d -l `expr 200 \* $blksize` -c 50 -b $blksize"
+_do_test 5 100 "-d -l `expr 400 \* $blksize` -c 100 -b $blksize"
 # note: direct IO requires page aligned IO

^^^ This last comment about direct-io alignment is not valid anymore since kernel 2.6. Maybe it's time to rip that comment off.

From man 2 open
O_DIRECT
<...>
If none of the above is available, then direct I/O support and alignment restrictions can only be assumed from known characteristics of the filesystem, the individual file, the underlying storage device(s), and the kernel
version. In Linux 2.4, most filesystems based on block devices require that the file offset and the length and memory address of all I/O segments be multiples of the filesystem block size (typically 4096 bytes). In Linux
2.6.0, this was relaxed to the logical block size of the block device (typically 512 bytes). A block device's logical block size can be determined using the ioctl(2) BLKSSZGET operation or from the shell using the command:

-ritesh

Quoted 34 lines
tests/xfs/008 +0 -0
 # todo: realtime.
tests/xfs/008.out +4 -4
index 5e3ae8e3..0941e218 100644
@@ -1,10 +1,10 @@
 QA output created by 008
 
-randholes.1 : -l FSIZE -c 50 -b PGSIZE
+randholes.1 : -l FSIZE -c 50 -b BLKSIZE
 ------------------------------------------
 holes is in range
 
-randholes.2 : -l FSIZE -c 100 -b PGSIZE
+randholes.2 : -l FSIZE -c 100 -b BLKSIZE
 ------------------------------------------
 holes is in range
 
@@ -12,10 +12,10 @@ randholes.3 : -l FSIZE -c 100 -b 512
 ------------------------------------------
 holes is in range
 
-randholes.4 : -d -l FSIZE -c 50 -b PGSIZE
+randholes.4 : -d -l FSIZE -c 50 -b BLKSIZE
 ------------------------------------------
 holes is in range
 
-randholes.5 : -d -l FSIZE -c 100 -b PGSIZE
+randholes.5 : -d -l FSIZE -c 100 -b BLKSIZE
 ------------------------------------------
 holes is in range
Signature · 1 line
2.34.1
Signature · 1 line
Pankaj Raghav
#9 lore raw
In reply to Pankaj Raghav (Samsung)

Looks like this patchset still has some review points to discuss. I'll give it more time. The release of this weekend won't have it :)

Thanks,
Zorro

Quoted 31 lines · Pankaj Raghav (Samsung)

From: Pankaj Raghav <[email protected]>

These are some of the tests that failed when we were working on LBS patches [1].

generic/436 and xfs/008 are adapted to work with bs > ps systems.

xfs/161 is an upstream failure, and it happens even on bs <= ps systems.

Changes since v1:
- Corrected copy pasta error in generic/436
- xfs/161 removed hardcoded and incorporated ritesh's comments

[1] https://lore.kernel.org/linux-xfs/[email protected]/

Pankaj Raghav (3):
xfs/161: adapt the test case for 64k FS blocksize generic/436: round up bufsz to nearest filesystem blksz xfs/008: use block size instead of the pagesize

 src/seek_sanity_test.c |  8 ++++----
 tests/xfs/008          | 19 ++++++++++---------
 tests/xfs/008.out      |  8 ++++----
 tests/xfs/161          | 16 ++++++++++++----
 4 files changed, 30 insertions(+), 21 deletions(-)

base-commit: b26d68da08e47e6508a96bee72b25823040ab67e

Signature · 1 line
2.34.1