Skip to contentSkip to conversation

xfsqa: 091 needs to support sector size != 512 bytes

PATCH In review David Chinner 2 participants 2 messages Apr 2, 2008

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xfsqa: 091 needs to support sector size != 512 bytes

Test 091 assumes a direct I/O alignment of 512 bytes, a hold over from 2.4 kernels. On 2.6. kernels, direct I/O needs to be aligned to the sector size the filesystem was mkfs'd with.

Teach 091 about 2.6 kernels and grab the sector size from the xfs_info output.

---
 xfstests/091 |   12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)
xfstests/091 +11 -1
Index: xfs-cmds/xfstests/091
===================================================================
@@ -43,10 +43,20 @@ run_fsx()
 
 psize=`$here/src/feature -s`
 bsize=512
-# 2.4 Linux kernels support bsize aligned direct I/O only
 kernel=`uname -r  | sed -e 's/\(2\..\).*/\1/'`
+
+# 2.4 Linux kernels support bsize aligned direct I/O only
 [ "$HOSTOS" = "Linux" -a "$kernel" = "2.4" ] && bsize=$psize
 
+# 2.6 Linux kernels support sector aligned direct I/O only
+if [ "$HOSTOS" = "Linux" -a "$kernel" = "2.6" ]; then
+	xfs_info $TEST_DIR | _filter_mkfs 2> $tmp.info
+	if [ $? -eq 0 ]; then
+		source $tmp.info
+		bsize=$sectsz
+	fi
+fi
+
 # fsx usage:
 # 
 # -N numops: total # operations to do 
#1 lore raw

Not tested yet, but looks fine.

Quoted 39 lines · David Chinner

Test 091 assumes a direct I/O alignment of 512 bytes, a hold over from 2.4 kernels. On 2.6. kernels, direct I/O needs to be aligned to the sector size the filesystem was mkfs'd with.

Teach 091 about 2.6 kernels and grab the sector size from the xfs_info output.

---
 xfstests/091 |   12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

Index: xfs-cmds/xfstests/091
===================================================================

xfstests/091 +0 -0
@@ -43,10 +43,20 @@ run_fsx()

psize=$here/src/feature -s
bsize=512

xfstests/091 +11 -1
-# 2.4 Linux kernels support bsize aligned direct I/O only
 kernel=`uname -r  | sed -e 's/\(2\..\).*/\1/'`
+
+# 2.4 Linux kernels support bsize aligned direct I/O only
 [ "$HOSTOS" = "Linux" -a "$kernel" = "2.4" ] && bsize=$psize
+# 2.6 Linux kernels support sector aligned direct I/O only
+if [ "$HOSTOS" = "Linux" -a "$kernel" = "2.6" ]; then
+	xfs_info $TEST_DIR | _filter_mkfs 2> $tmp.info
+	if [ $? -eq 0 ]; then
+		source $tmp.info
+		bsize=$sectsz
+	fi
+fi
+
 # fsx usage:
 #
 # -N numops: total # operations to do