Skip to contentSkip to conversation

xfstests 271: use xfs_io to truncate file instead of truncate(1)

PATCH In review Eryu Guan 3 participants 5 messages Jan 10, 2012 – Jan 12, 2012

lore
Share & tools
lore

Eryu Guan

author
#0 lore raw

PATCH 1/1 xfstests 271: use xfs_io to truncate file instead of truncate(1)

Distros(eg. RHEL5) with older version of coreutils have no truncate(1) command. Use xfs_io instead to avoid "command not found" failures.

---
 271 |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
271 +1 -1
index 58a7f91..b96d702 100755
@@ -55,7 +55,7 @@ do
     dd if=/dev/zero of=$SCRATCH_MNT/file bs=4k count=1 seek=$((i*10))
 done
 # truncate last extent
-truncate $SCRATCH_MNT/file --size $((4096* 200))
+$XFS_IO_PROG -F -f -c "truncate $((4096*200))" $SCRATCH_MNT/file
 
 if ! _scratch_unmount; then
 	echo "failed to umount"
Signature · 6 lines
1.7.8.2

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
author
#1 lore raw

PATCH 1/1 xfstests 273: Create lost+found to pass _check_scratch_fs

fsck.extN will complain lost+found is missing and fail 273. So create lost+found explicitly after removing everything in $SCRATCH_MNT.

---
 273 |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
273 +2 -0
index 2965132..9ecb2d3 100755
@@ -36,6 +36,7 @@ _cleanup()
 {
 	cd /
 	rm -rf $SCRATCH_MNT/* $tmp.*
+	mkdir -p $SCRATCH_MNT/lost+found
 	_scratch_unmount
 }
 
@@ -107,6 +108,7 @@ _do_workload()
 	_pid=1
 	
 	rm -rf $SCRATCH_MNT/*
+	mkdir -p $SCRATCH_MNT/lost+found
 
 	_threads_set
 	_file_create
Signature · 6 lines
1.7.8.2

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
#2 lore raw

Re: [PATCH] xfstests 273: Create lost+found to pass _check_scratch_fs

Quoted 3 lines · Eryu Guan

fsck.extN will complain lost+found is missing and fail 273. So create lost+found explicitly after removing everything in $SCRATCH_MNT.

I'd consider that a bug in e2fsck. Other filesystems handle missing lost+found directories without failing, but then again it's only these new tests that do this so fixing the tests is probably the right thing to do here.

Quoted 10 lines
---
 273 |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
273 +0 -0
index 2965132..9ecb2d3 100755

273 _cleanup() · line 41

Quoted 6 lines
273 +1 -0
@@ -36,6 +36,7 @@ _cleanup()
 {
 	cd /
 	rm -rf $SCRATCH_MNT/* $tmp.*
+	mkdir -p $SCRATCH_MNT/lost+found
 	_scratch_unmount
 }

We shouldn't be removing files from the scratch device in the _cleanup function - if the test exits or fails, we need the corpse to be intact for debugging. Remving $SCRATCH_MNT/* from the rm command is what should be done here.

273 _do_workload() · line 111

Quoted 6 lines
273 +1 -0
@@ -107,6 +108,7 @@ _do_workload()
 	_pid=1
 
 	rm -rf $SCRATCH_MNT/*
+	mkdir -p $SCRATCH_MNT/lost+found

And rather than doing this, the test should put all it's files in a known location on the $SCRATCH_MNT and just remove that. e.g:

WORK_DIR="$SCRATCH_MNT/$seq"

....

rm -rf $WORKDIR

....

The same fixes are required for 274 and 275 as well.

Cheers,

Dave.

Signature · 7 lines
Dave Chinner
[email protected]

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
author
#3 lore raw

Re: [PATCH] xfstests 273: Create lost+found to pass _check_scratch_fs

Quoted 44 lines · Dave Chinner
Quoted 3 lines · Eryu Guan

fsck.extN will complain lost+found is missing and fail 273. So create lost+found explicitly after removing everything in $SCRATCH_MNT.

I'd consider that a bug in e2fsck. Other filesystems handle missing lost+found directories without failing, but then again it's only these new tests that do this so fixing the tests is probably the right thing to do here.

Quoted 11 lines

---
 273 |    2 ++

 1 files changed, 2 insertions(+), 0 deletions(-)
273 +0 -0
index 2965132..9ecb2d3 100755
@@ -36,6 +36,7 @@ _cleanup()
  {
Quoted 5 lines

      cd /
      rm -rf $SCRATCH_MNT/* $tmp.*
+     mkdir -p $SCRATCH_MNT/lost+found
      _scratch_unmount
 }

We shouldn't be removing files from the scratch device  in the _cleanup function - if the test exits or fails, we need the corpse to be intact for debugging. Remving $SCRATCH_MNT/* from the rm command is what should be done here.

Quoted 6 lines
273 +0 -0
@@ -107,6 +108,7 @@ _do_workload()

      _pid=1

      rm -rf $SCRATCH_MNT/*
+     mkdir -p $SCRATCH_MNT/lost+found

And rather than doing this, the test should put all it's files in a known location on the $SCRATCH_MNT and just remove that. e.g:

WORK_DIR="$SCRATCH_MNT/$seq"

Quoted 7 lines

....

       rm -rf $WORKDIR

....

The same fixes are required for 274 and 275 as well.

Thanks for the review, I just sent a new patch to fix 273 274 and 275 [PATCH] xfstests 273 274 275: do test in dedicated dir and leave test files in it

Please help review.

Thanks,
Eryu Guan

Quoted 7 lines

Cheers,

Dave.
--
Dave Chinner
[email protected]

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs