Stefan Behrens
2011-Jul-29 16:06 UTC
[PATCH v2 0/4] xfstests: Changed a couple of tests to be generic
Changes v1->v2: - Instead of just adding btrfs to the list of supported filesystems, the 7 tests that are touched by this patch series are now executed for all filesystems (since the tests are generic ones). - The changes in src/t_immutable.c are revised to make the setting of append-only and immutable flags generic instead of just adding code for btrfs. This patch series changes the tests 015, 062, 079, 083, 117, 120 and 192 to be generic for all filesystems and to be executed for all filesystems. For test 079 to run, src/t_immutable.c was also modified to use the new generic FS_IOC_SETFLAGS/FS_IOC_GETFLAGS ioctl() if they are available. Stefan Behrens (4): xfstests: Changed test 062 to be generic for all filesystems xfstests: Changed tests 083, 117, 120 and 192 to be generic for all filesystems xfstests: Changed test 015 to be generic for all filesystems xfstests: Changed test 079 to be generic for all filesystems 015 | 4 +- 062 | 4 +- 062.out | 6 ----- 079 | 13 ++++++++-- 083 | 12 +++++++-- 117 | 4 +- 120 | 4 +- 192 | 2 +- src/t_immutable.c | 66 +++++++++++++++++----------------------------------- 9 files changed, 50 insertions(+), 65 deletions(-) -- 1.7.3.4 -- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Stefan Behrens
2011-Jul-29 16:06 UTC
[PATCH v2 1/4] xfstests: Changed test 062 to be generic for all filesystems
Changed the test 062 to be generic for all filesystems and to be executed for all filesystems. Remove output of mkfs since this is specific to mkfs.xfs and now filtered out. Signed-off-by: Stefan Behrens <sbehrens@giantdisaster.de> --- 062 | 4 ++-- 062.out | 6 ------ 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/062 b/062 index 5cb6f92..a6e4bc8 100755 --- a/062 +++ b/062 @@ -71,7 +71,7 @@ _create_test_bed() } # real QA test starts here -_supported_fs xfs udf nfs +_supported_fs generic _supported_os Linux _require_scratch @@ -80,7 +80,7 @@ _require_attrs rm -f $tmp.backup1 $tmp.backup2 $seq.full # real QA test starts here -_scratch_mkfs_xfs | _filter_mkfs 2>$tmp.mkfs +_scratch_mkfs > /dev/null 2>&1 || _fail "mkfs failed" _scratch_mount || _fail "mount failed" _create_test_bed diff --git a/062.out b/062.out index 73fd628..1d5a094 100644 --- a/062.out +++ b/062.out @@ -1,10 +1,4 @@ QA output created by 062 -meta-data=DDEV isize=XXX agcount=N, agsize=XXX blks -data = bsize=XXX blocks=XXX, imaxpct=PCT - = sunit=XXX swidth=XXX, unwritten=X -naming =VERN bsize=XXX -log =LDEV bsize=XXX blocks=XXX -realtime =RDEV extsz=XXX blocks=XXX, rtextents=XXX *** create test bed SCRATCH_MNT SCRATCH_MNT/dev -- 1.7.3.4 -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Stefan Behrens
2011-Jul-29 16:06 UTC
[PATCH v2 2/4] xfstests: Changed tests 083, 117, 120 and 192 to be generic for all filesystems
Changed the tests 083, 117, 120 and 192 to be generic for all filesystems and to be executed for all filesystems. For test 083 also changed to use _scratch_mkfs_sized instead of _scratch_mks_xfs for all filesystem types except for XFS. Signed-off-by: Stefan Behrens <sbehrens@giantdisaster.de> --- 083 | 12 +++++++++--- 117 | 4 ++-- 120 | 4 ++-- 192 | 2 +- 4 files changed, 14 insertions(+), 8 deletions(-) diff --git a/083 b/083 index 7342baa..441284e 100755 --- a/083 +++ b/083 @@ -54,7 +54,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 . ./common.filter # real QA test starts here -_supported_fs xfs +_supported_fs generic _supported_os IRIX Linux _require_scratch @@ -72,8 +72,14 @@ workout() umount $SCRATCH_DEV >/dev/null 2>&1 echo "*** mkfs -dsize=$fsz,agcount=$ags" >>$seq.full echo "" >>$seq.full - _scratch_mkfs_xfs -dsize=$fsz,agcount=$ags >>$seq.full 2>&1 \ - || _fail "size=$fsz,agcount=$ags mkfs failed" + if [ $FSTYP = xfs ] + then + _scratch_mkfs_xfs -dsize=$fsz,agcount=$ags >>$seq.full 2>&1 \ + || _fail "size=$fsz,agcount=$ags mkfs failed" + else + _scratch_mkfs_sized $fsz >>$seq.full 2>&1 \ + || _fail "size=$fsz mkfs failed" + fi _scratch_mount >>$seq.full 2>&1 \ || _fail "mount failed" diff --git a/117 b/117 index dd880cb..fcf0485 100755 --- a/117 +++ b/117 @@ -51,7 +51,7 @@ _cleanup() . ./common.attr # real QA test starts here -_supported_fs xfs +_supported_fs generic _supported_os IRIX Linux _setup_testdir @@ -62,7 +62,7 @@ rm -f $seq.full umount $SCRATCH_DEV >/dev/null 2>&1 echo "*** MKFS ***" >>$seq.full echo "" >>$seq.full -_scratch_mkfs_xfs >>$seq.full 2>&1 \ +_scratch_mkfs >>$seq.full 2>&1 \ || _fail "mkfs failed" _scratch_mount >>$seq.full 2>&1 \ || _fail "mount failed" diff --git a/120 b/120 index bf1e617..010a8f3 100755 --- a/120 +++ b/120 @@ -37,11 +37,11 @@ trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15 . ./common.filter # real QA test starts here -_supported_fs xfs +_supported_fs generic _supported_os Linux IRIX _require_scratch -_scratch_mkfs_xfs >/dev/null 2>&1 +_scratch_mkfs >/dev/null 2>&1 || _fail "mkfs failed" _compare_access_times() { diff --git a/192 b/192 index d8301d5..4b69147 100755 --- a/192 +++ b/192 @@ -45,7 +45,7 @@ _access_time() # real QA test starts here -_supported_fs xfs udf nfs +_supported_fs generic _supported_os Linux #delay=150 #delay=75 -- 1.7.3.4 -- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Stefan Behrens
2011-Jul-29 16:07 UTC
[PATCH v2 3/4] xfstests: Changed test 015 to be generic for all filesystems
Changed the test 015 to be generic for all filesystems and to be executed for all filesystems. Replaced the call to _scratch_mkfs_xfs with the XFS specific size parameter by the generic one for sized filesystem creation which is _scratch_mkfs_sized. Signed-off-by: Stefan Behrens <sbehrens@giantdisaster.de> --- 015 | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/015 b/015 index 8f2be7c..686a211 100755 --- a/015 +++ b/015 @@ -48,13 +48,13 @@ _free() } # real QA test starts here -_supported_fs xfs +_supported_fs generic _supported_os IRIX Linux _require_scratch _require_nobigloopfs -_scratch_mkfs_xfs -d size=50m >/dev/null || _fail "mkfs failed" +_scratch_mkfs_sized `expr 50 \* 1024 \* 1024` >/dev/null 2>&1 || _fail "mkfs failed" _scratch_mount || _fail "mount failed" out=$SCRATCH_MNT/fillup.$$ rm -f $seq.full -- 1.7.3.4 -- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Stefan Behrens
2011-Jul-29 16:07 UTC
[PATCH v2 4/4] xfstests: Changed test 079 to be generic for all filesystems
Changed the test 079 to be generic for all filesystems and to be executed for all filesystems. In src/t_immutable.c which is compiled for Linux only, replaced the old style XFS and ext2 specific code for setting the append-only and immutable flags by generic code that makes use of the ioctl(FS_IOC_SETFLAGS) and ioctl(FS_IOC_GETFLAGS). Therefore the check for the specific filesystem type was removed. FS_IOC_GETFLAGS/FS_IOC_SETFLAGS is always used. This code is inside an ''#ifdef FS_IOC_SETFLAGS'' block in order to never fail compilation. Without support for FS_IOC_SETFLAGS, the test completes with _notrun. Signed-off-by: Stefan Behrens <sbehrens@giantdisaster.de> --- 079 | 13 ++++++++-- src/t_immutable.c | 66 +++++++++++++++++----------------------------------- 2 files changed, 32 insertions(+), 47 deletions(-) diff --git a/079 b/079 index 6c43fe7..0c70811 100755 --- a/079 +++ b/079 @@ -46,7 +46,7 @@ _cleanup() . ./common.filter . ./common.attr -_supported_fs xfs +_supported_fs generic _supported_os Linux _require_attrs @@ -55,10 +55,17 @@ _require_scratch [ -x $timmutable ] || _notrun "t_immutable was not built for this platform" # real QA test starts here -_scratch_mkfs_xfs 2>&1 >/dev/null || _fail "mkfs failed" +_scratch_mkfs >/dev/null 2>&1 || _fail "mkfs failed" _scratch_mount || _fail "mount failed" echo "*** starting up" -$timmutable -c $SCRATCH_MNT/$seq +$timmutable -c $SCRATCH_MNT/$seq >$tmp.out 2>&1 +if grep -q ''Operation not supported'' $tmp.out +then + rm -f $tmp.out + _notrun "Setting immutable/append flag not supported" +fi +cat $tmp.out +rm -f $tmp.out status=$? exit diff --git a/src/t_immutable.c b/src/t_immutable.c index 7bb3154..87ffc75 100644 --- a/src/t_immutable.c +++ b/src/t_immutable.c @@ -41,11 +41,8 @@ #include <xfs/xfs.h> #include <xfs/handle.h> #include <xfs/jdm.h> - -#define EXT2_SUPER_MAGIC 0xEF53 -#define EXT2_IMMUTABLE_FL 0x00000010 -#define EXT2_APPEND_FL 0x00000020 -#define EXT2_IOC_SETFLAGS _IOW(''f'', 2, long) +#include <linux/fs.h> +#include <linux/magic.h> #ifndef XFS_SUPER_MAGIC #define XFS_SUPER_MAGIC 0x58465342 @@ -55,52 +52,33 @@ extern const char *__progname; static int fsetflag(const char *path, int fd, int on, int immutable) { - int e2flags = 0; - struct fsxattr attr; - struct statfs stfs; - int xfsfl; - int e2fl; - - if (immutable) { - xfsfl = XFS_XFLAG_IMMUTABLE; - e2fl = EXT2_IMMUTABLE_FL; - } else { - xfsfl = XFS_XFLAG_APPEND; - e2fl = EXT2_APPEND_FL; - } +#ifdef FS_IOC_SETFLAGS + int fsflags = 0; + int fsfl; - if (fstatfs(fd, &stfs) != 0) + if (ioctl(fd, FS_IOC_GETFLAGS, &fsflags) < 0) { + close(fd); return 1; - - if (stfs.f_type == XFS_SUPER_MAGIC) { - if (xfsctl(path, fd, XFS_IOC_FSGETXATTR, &attr) < 0) { - close(fd); - return 1; - } - if (on) - attr.fsx_xflags |= xfsfl; - else - attr.fsx_xflags &= ~xfsfl; - if (xfsctl(path, fd, XFS_IOC_FSSETXATTR, &attr) < 0) { - close(fd); - return 1; - } - } else if (stfs.f_type == EXT2_SUPER_MAGIC) { - if (on) - e2flags |= e2fl; - else - e2flags &= ~e2fl; - if (ioctl(fd, EXT2_IOC_SETFLAGS, &e2flags) < 0) { - close(fd); - return 1; - } - } else { - errno = EOPNOTSUPP; + } + if (immutable) + fsfl = FS_IMMUTABLE_FL; + else + fsfl = FS_APPEND_FL; + if (on) + fsflags |= fsfl; + else + fsflags &= ~fsfl; + if (ioctl(fd, FS_IOC_SETFLAGS, &fsflags) < 0) { close(fd); return 1; } close(fd); return 0; +#else + errno = EOPNOTSUPP; + close(fd); + return 1; +#endif } static int add_acl(const char *path, const char *acl_text) -- 1.7.3.4 -- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Christoph Hellwig
2011-Jul-30 14:25 UTC
Re: [PATCH v2 1/4] xfstests: Changed test 062 to be generic for all filesystems
On Fri, Jul 29, 2011 at 06:06:58PM +0200, Stefan Behrens wrote:> Changed the test 062 to be generic for all filesystems and to be > executed for all filesystems. > Remove output of mkfs since this is specific to mkfs.xfs and now > filtered out.The first three patches look good, but can you please merge them into on. And maybe make the subject description a bit less verbose, e.g. xfstests: make more tests generic Use _scratch_mkfs / _scratch_mkfs_sized instead of _scratch_mkfs_xfs where possible. -- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Christoph Hellwig
2011-Jul-30 14:28 UTC
Re: [PATCH v2 4/4] xfstests: Changed test 079 to be generic for all filesystems
On Fri, Jul 29, 2011 at 06:07:01PM +0200, Stefan Behrens wrote:> Changed the test 079 to be generic for all filesystems and to be > executed for all filesystems. > In src/t_immutable.c which is compiled for Linux only, replaced the > old style XFS and ext2 specific code for setting the append-only and > immutable flags by generic code that makes use of the > ioctl(FS_IOC_SETFLAGS) and ioctl(FS_IOC_GETFLAGS). > Therefore the check for the specific filesystem type was removed. > FS_IOC_GETFLAGS/FS_IOC_SETFLAGS is always used. This code is inside an > ''#ifdef FS_IOC_SETFLAGS'' block in order to never fail compilation. > Without support for FS_IOC_SETFLAGS, the test completes with _notrun.A little nitpicking for the subject again, I''d rather see something like: xfstests: make t_immutable and 079 filesystem-agnostic> +$timmutable -c $SCRATCH_MNT/$seq >$tmp.out 2>&1 > +if grep -q ''Operation not supported'' $tmp.out > +thenif grep -q ''Operation not supported'' $tmp.out; then please -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html