Skip to contentSkip to conversation

xfstests: more generic fs work

PATCH Superseded Eric Sandeen 3 participants 35 messages May 27, 2009 – Jun 2, 2009

lore
Share & tools
lore
#1 lore raw

PATCH 1/9 Use xfs.h rather than libxfs.h

Use xfs/xfs.h when possible rather than xfs/libxfs.h, now that libxfs.h isn't part of a normal xfsprogs-devel install.

---
 aclocal.m4            |   15 +++++++++++++--
 configure.in          |    1 +
 m4/package_xfslibs.m4 |   10 ++++++++++
 src/global.h          |   12 ++++++++++++
 src/godown.c          |    2 +-
 src/iopat.c           |    2 +-
 src/t_immutable.c     |    6 +++++-
 src/unwritten_mmap.c  |    2 +-
 src/xfsctl.c          |    2 +-
 9 files changed, 45 insertions(+), 7 deletions(-)
aclocal.m4 +13 -2
index 52f1c7d..6cc5dce 100644
@@ -405,6 +405,17 @@ AC_DEFUN([AC_PACKAGE_NEED_UUIDCOMPARE],
     AC_SUBST(libuuid)
   ])
 
+AC_DEFUN([AC_PACKAGE_NEED_XFS_XFS_H],
+  [ AC_CHECK_HEADERS([xfs/xfs.h])
+    if test "$ac_cv_header_xfs_xfs_h" != "yes"; then
+        echo
+        echo 'FATAL ERROR: cannot find a valid <xfs/xfs.h> header file.'
+        echo 'Install or upgrade the XFS development package.'
+        echo 'Alternatively, run "make install-dev" from the xfsprogs source.'
+        exit 1
+    fi
+  ])
+
 AC_DEFUN([AC_PACKAGE_NEED_XFS_LIBXFS_H],
   [ AC_CHECK_HEADERS([xfs/libxfs.h])
     if test "$ac_cv_header_xfs_libxfs_h" != "yes"; then
@@ -500,8 +511,8 @@ AC_DEFUN([AC_PACKAGE_NEED_IRIX_LIBHANDLE],
   ])
 
 AC_DEFUN([AC_PACKAGE_NEED_XFSCTL_MACRO],
-  [ AC_MSG_CHECKING([xfsctl from xfs/libxfs.h])
-    AC_TRY_LINK([#include <xfs/libxfs.h>], [ int x = xfsctl(0, 0, 0, 0); ],
+  [ AC_MSG_CHECKING([xfsctl from xfs/xfs.h])
+    AC_TRY_LINK([#include <xfs/xfs.h>], [ int x = xfsctl(0, 0, 0, 0); ],
       [ echo ok ],
       [ echo
         echo 'FATAL ERROR: cannot find required macros in the XFS headers.'
configure.in +1 -0
index 32a2496..f087454 100644
@@ -44,6 +44,7 @@ in
 		;;
 	*)
 		AC_MULTILIB($enable_lib64)
+		AC_PACKAGE_NEED_XFS_XFS_H
 		AC_PACKAGE_NEED_XFS_LIBXFS_H
 		AC_PACKAGE_NEED_XFS_XQM_H
 		AC_PACKAGE_NEED_XFSCTL_MACRO
m4/package_xfslibs.m4 +10 -0
index cafd959..2c8d694 100644
@@ -1,3 +1,13 @@
+AC_DEFUN([AC_PACKAGE_NEED_XFS_XFS_H],
+  [ AC_CHECK_HEADERS([xfs/xfs.h])
+    if test "$ac_cv_header_xfs_xfs_h" != "yes"; then
+        echo
+        echo 'FATAL ERROR: cannot find a valid <xfs/xfs.h> header file.'
+        echo 'Run "make install-qa" from the xfsprogs source.'
+        exit 1
+    fi
+  ])
+
 AC_DEFUN([AC_PACKAGE_NEED_XFS_LIBXFS_H],
   [ AC_CHECK_HEADERS([xfs/libxfs.h])
     if test "$ac_cv_header_xfs_libxfs_h" != "yes"; then
src/global.h +12 -0
index 158c1fa..a766cfd 100644
@@ -26,6 +26,10 @@
 #include <../../xfsprogs/include/irix.h>
 #endif
 
+#ifdef HAVE_XFS_XFS_H
+#include <xfs/xfs.h>
+#endif
+
 #ifdef HAVE_XFS_LIBXFS_H
 #include <xfs/libxfs.h>
 #endif
@@ -150,4 +154,12 @@
 #include <sys/param.h>
 #endif
 
+/*
+ * MAXNAMELEN is the length (including the terminating null) of
+ * the longest permissible file (component) name.
+ */
+#ifndef MAXNAMELEN
+#define MAXNAMELEN 256
+#endif
+
 #endif
src/godown.c +1 -1
index 4105aee..fa04f24 100644
@@ -18,7 +18,7 @@
 
 #include "global.h"
 
-/* These should be in libxfs.h */
+/* These should be in xfs.h */
 #ifndef XFS_IOC_GOINGDOWN
 #define XFS_IOC_GOINGDOWN           _IOR ('X', 125, __uint32_t)
 #endif
src/iopat.c +1 -1
index 1e7d61b..c06071f 100644
@@ -18,7 +18,7 @@
 
 #include <fcntl.h>
 #include <sys/ioctl.h>
-#include <xfs/libxfs.h>
+#include <xfs/xfs.h>
 struct xfs_flock64 f;
 
 int main(int argc, char **argv)
src/t_immutable.c +5 -1
index 667355b..07a36cd 100644
@@ -38,7 +38,7 @@
 #include <libgen.h>
 #include <sys/acl.h>
 #include <attr/xattr.h>
-#include <xfs/libxfs.h>
+#include <xfs/xfs.h>
 #include <xfs/handle.h>
 #include <xfs/jdm.h>
 
@@ -47,6 +47,10 @@
 #define EXT2_APPEND_FL          0x00000020
 #define EXT2_IOC_SETFLAGS	_IOW('f', 2, long)
 
+#ifndef XFS_SUPER_MAGIC
+#define XFS_SUPER_MAGIC 0x58465342
+#endif
+
 extern const char *__progname;
 
 static int fsetflag(const char *path, int fd, int on, int immutable)
src/unwritten_mmap.c +1 -1
index 5e63486..aec6a69 100644
@@ -2,7 +2,7 @@
 #include <stdlib.h>
 #include <unistd.h>
 #include <fcntl.h>
-#include <xfs/libxfs.h>
+#include <xfs/xfs.h>
 #include <sys/mman.h>
 
 /*
src/xfsctl.c +1 -1
index f8afb16..8fa3348 100644
@@ -16,7 +16,7 @@
  * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
-#include <xfs/libxfs.h>
+#include <xfs/xfs.h>
 #include <xfs/jdm.h>
 
 /* simple test program to try out a bunch of xfsctls:
Signature · 6 lines
1.5.5.6

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

Re: [PATCH 1/9] Use xfs.h rather than libxfs.h

src/global.h line 163

Quoted 11 lines · Eric Sandeen

Use xfs/xfs.h when possible rather than xfs/libxfs.h, now that libxfs.h isn't part of a normal xfsprogs-devel install.

src/global.h +7 -0
+/*
+ * MAXNAMELEN is the length (including the terminating null) of
+ * the longest permissible file (component) name.
+ */
+#ifndef MAXNAMELEN
+#define MAXNAMELEN 256
+#endif

Just switch all users to the posix NAME_MAX instead. Note that NAME_MAX does not include the NULL termination, so it's one-off vs MAXNAMELEN.

src/godown.c line 24

Quoted 13 lines
src/godown.c +1 -1
index 4105aee..fa04f24 100644
@@ -18,7 +18,7 @@
 
 #include "global.h"
 
-/* These should be in libxfs.h */
+/* These should be in xfs.h */
 #ifndef XFS_IOC_GOINGDOWN
 #define XFS_IOC_GOINGDOWN           _IOR ('X', 125, __uint32_t)
 #endif

Might be worth to remove now as we had it in xfs_fs.h forever.

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

#3 lore raw

PATCH 1/1 Replace MAXNAMELEN with NAME_MAX + 1

Drop the xfs-specific MAXNAMELEN in favor of the Posix NAME_MAX

This makes it easier to lose libxfs.h later.

---

dmapi/src/common/lib/print.c +2 -5
index 373064f..bbed8f3 100644
@@ -25,9 +25,6 @@
 #include <lib/hsm.h>
 
 #include <string.h>
-#ifdef linux
-#define MAXNAMELEN 256
-#endif
 
   /*
    * Define some standard formats for the printf statements below.
@@ -96,7 +93,7 @@ print_one_mount_event(
 	char		hans1[HANDLE_STR], hans2[HANDLE_STR], hans3[HANDLE_STR];
 	void		*namp1, *namp2;
 	size_t		nlen1, nlen2;
-	char		nams1[MAXNAMELEN], nams2[MAXNAMELEN];
+	char		nams1[NAME_MAX + 1], nams2[NAME_MAX + 1];
 	mode_t		mode;
 
 #if	VERITAS_21
@@ -207,7 +204,7 @@ print_one_message(
 	void		*hanp1, *hanp2, *namp1, *namp2;
 	u_int		hlen1, hlen2, nlen1, nlen2;
 	char		hans1[HANDLE_STR], hans2[HANDLE_STR];
-	char		nams1[MAXNAMELEN], nams2[MAXNAMELEN];
+	char		nams1[NAME_MAX + 1], nams2[NAME_MAX + 1];
 
 	/***** USER EVENTS *****/
 
dmapi/src/suite1/cmd/print_event.c +2 -4
index 9a4beba..e34cafe 100644
@@ -65,8 +65,6 @@ clear_region_event(
 	size_t		 hlen,
 	char		*hans1);
 
-#define MAXNAMELEN 256
-
 /*
  * Keep these global so the exit_handler and err_msg routines can get to them
  */
@@ -294,7 +292,7 @@ print_one_mount_event(
 	char		hans1[HANDLE_STR], hans2[HANDLE_STR], hans3[HANDLE_STR];
 	void		*namp1, *namp2;
 	size_t		nlen1, nlen2;
-	char		nams1[MAXNAMELEN], nams2[MAXNAMELEN];
+	char		nams1[NAME_MAX + 1], nams2[NAME_MAX + 1];
 	mode_t		mode;
 
 #if	VERITAS_21
@@ -391,7 +389,7 @@ handle_message(
   void			*hanp1, *hanp2, *namp1, *namp2;
   u_int			hlen1, hlen2, nlen1, nlen2;
   char			hans1[HANDLE_STR], hans2[HANDLE_STR];
-  char			nams1[MAXNAMELEN], nams2[MAXNAMELEN];
+  char			nams1[NAME_MAX + 1], nams2[NAME_MAX + 1];
 
   /*
    * Set the defaults for responding to events
dmapi/src/suite2/src/dm_test_daemon.c +2 -6
index 214750a..02f5d0e 100644
@@ -39,10 +39,6 @@
 #include <lib/dmport.h>
 #include <lib/hsm.h>
 
-#ifdef linux
-#define MAXNAMELEN 256
-#endif
-
   /*
    * Define some standard formats for the printf statements below.
    */
@@ -291,7 +287,7 @@ print_one_mount_event(
 	char		hans1[HANDLE_STR], hans2[HANDLE_STR], hans3[HANDLE_STR];
 	void		*namp1, *namp2;
 	size_t		nlen1, nlen2;
-	char		nams1[MAXNAMELEN], nams2[MAXNAMELEN];
+	char		nams1[NAME_MAX + 1], nams2[NAME_MAX + 1];
 	mode_t		mode;
 
 #if	VERITAS
@@ -386,7 +382,7 @@ handle_message(
   void			*hanp1, *hanp2, *namp1, *namp2;
   u_int			hlen1, hlen2, nlen1, nlen2;
   char			hans1[HANDLE_STR], hans2[HANDLE_STR];
-  char			nams1[MAXNAMELEN], nams2[MAXNAMELEN];
+  char			nams1[NAME_MAX + 1], nams2[NAME_MAX + 1];
   void		        *fs_hanp;
   size_t		fs_hlen;
   dm_timestruct_t       *pending_time;
ltp/fsstress.c +23 -23

172 lines not on this page · raw message

src/dirperf.c +3 -4
index a222fff..459ae34 100644
@@ -28,7 +28,6 @@
 #include <string.h>
 #include <unistd.h>
 
-#define MAXNAMELEN 256
 #ifndef __sgi__
 typedef unsigned int uint_t;
 #endif
@@ -81,7 +80,7 @@ main(int argc, char **argv)
 	DIR		*dirp;
 	int		i;
 	int		j;
-	char		name[MAXNAMELEN];
+	char		name[NAME_MAX + 1];
 	struct stat	stb;
 	double		stime;
 
@@ -150,8 +149,8 @@ main(int argc, char **argv)
 	minchars = hexchars(lastsize - 1);
 	if (nchars < minchars)
 		nchars = minchars;
-	else if (nchars >= MAXNAMELEN)
-		nchars = MAXNAMELEN - 1;
+	else if (nchars >= NAME_MAX + 1)
+		nchars = NAME_MAX;
 	if (ndirs > MAX_DIR_COUNT)
 		ndirs = MAX_DIR_COUNT;
 	if (ndirs < MIN_DIR_COUNT)
src/dmiperf.c +3 -4
index e27d783..bcd0625 100644
@@ -34,7 +34,6 @@
 #include <attr/attributes.h>
 #endif
 
-#define MAXNAMELEN 256
 #ifndef sgi
 typedef unsigned int uint_t;
 #endif
@@ -92,7 +91,7 @@ main(int argc, char **argv)
 	uint_t		cursize;
 	int		i;
 	int		j;
-	char		name[MAXNAMELEN];
+	char		name[NAME_MAX + 1];
 	char		attr[DMFATTRLEN];
 	double		stime;
 
@@ -168,8 +167,8 @@ main(int argc, char **argv)
 	minchars = hexchars(lastsize - 1);
 	if (nchars < minchars)
 		nchars = minchars;
-	else if (nchars >= MAXNAMELEN)
-		nchars = MAXNAMELEN - 1;
+	else if (nchars >= NAME_MAX + 1)
+		nchars = NAME_MAX;
 	if (ndirs > MAX_DIR_COUNT)
 		ndirs = MAX_DIR_COUNT;
 	if (ndirs < MIN_DIR_COUNT)

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

#5 lore raw

PATCH v2 1/9 Use xfs.h rather than libxfs.h

In reply to Christoph Hellwig

Use xfs/xfs.h when possible rather than xfs/libxfs.h, now that libxfs.h isn't part of a normal xfsprogs-devel install.

v2: take the MAXNAMELEN changes out of the mix and remove redefinitions of ioctls easily available from xfs.h

---

aclocal.m4 +13 -2
index 52f1c7d..6cc5dce 100644
@@ -405,6 +405,17 @@ AC_DEFUN([AC_PACKAGE_NEED_UUIDCOMPARE],
     AC_SUBST(libuuid)
   ])
 
+AC_DEFUN([AC_PACKAGE_NEED_XFS_XFS_H],
+  [ AC_CHECK_HEADERS([xfs/xfs.h])
+    if test "$ac_cv_header_xfs_xfs_h" != "yes"; then
+        echo
+        echo 'FATAL ERROR: cannot find a valid <xfs/xfs.h> header file.'
+        echo 'Install or upgrade the XFS development package.'
+        echo 'Alternatively, run "make install-dev" from the xfsprogs source.'
+        exit 1
+    fi
+  ])
+
 AC_DEFUN([AC_PACKAGE_NEED_XFS_LIBXFS_H],
   [ AC_CHECK_HEADERS([xfs/libxfs.h])
     if test "$ac_cv_header_xfs_libxfs_h" != "yes"; then
@@ -500,8 +511,8 @@ AC_DEFUN([AC_PACKAGE_NEED_IRIX_LIBHANDLE],
   ])
 
 AC_DEFUN([AC_PACKAGE_NEED_XFSCTL_MACRO],
-  [ AC_MSG_CHECKING([xfsctl from xfs/libxfs.h])
-    AC_TRY_LINK([#include <xfs/libxfs.h>], [ int x = xfsctl(0, 0, 0, 0); ],
+  [ AC_MSG_CHECKING([xfsctl from xfs/xfs.h])
+    AC_TRY_LINK([#include <xfs/xfs.h>], [ int x = xfsctl(0, 0, 0, 0); ],
       [ echo ok ],
       [ echo
         echo 'FATAL ERROR: cannot find required macros in the XFS headers.'
configure.in +1 -0
index 32a2496..f087454 100644
@@ -44,6 +44,7 @@ in
 		;;
 	*)
 		AC_MULTILIB($enable_lib64)
+		AC_PACKAGE_NEED_XFS_XFS_H
 		AC_PACKAGE_NEED_XFS_LIBXFS_H
 		AC_PACKAGE_NEED_XFS_XQM_H
 		AC_PACKAGE_NEED_XFSCTL_MACRO
m4/package_xfslibs.m4 +10 -0
index cafd959..2c8d694 100644
@@ -1,3 +1,13 @@
+AC_DEFUN([AC_PACKAGE_NEED_XFS_XFS_H],
+  [ AC_CHECK_HEADERS([xfs/xfs.h])
+    if test "$ac_cv_header_xfs_xfs_h" != "yes"; then
+        echo
+        echo 'FATAL ERROR: cannot find a valid <xfs/xfs.h> header file.'
+        echo 'Run "make install-qa" from the xfsprogs source.'
+        exit 1
+    fi
+  ])
+
 AC_DEFUN([AC_PACKAGE_NEED_XFS_LIBXFS_H],
   [ AC_CHECK_HEADERS([xfs/libxfs.h])
     if test "$ac_cv_header_xfs_libxfs_h" != "yes"; then
src/global.h +4 -0
index 158c1fa..61862f6 100644
@@ -26,6 +26,10 @@
 #include <../../xfsprogs/include/irix.h>
 #endif
 
+#ifdef HAVE_XFS_XFS_H
+#include <xfs/xfs.h>
+#endif
+
 #ifdef HAVE_XFS_LIBXFS_H
 #include <xfs/libxfs.h>
 #endif
src/godown.c +0 -14
index 4105aee..07b6980 100644
@@ -18,20 +18,6 @@
 
 #include "global.h"
 
-/* These should be in libxfs.h */
-#ifndef XFS_IOC_GOINGDOWN
-#define XFS_IOC_GOINGDOWN           _IOR ('X', 125, __uint32_t)
-#endif
-#ifndef XFS_FSOP_GOING_FLAGS_DEFAULT
-#define XFS_FSOP_GOING_FLAGS_DEFAULT    0x0     /* going down */
-#endif
-#ifndef XFS_FSOP_GOING_FLAGS_LOGFLUSH
-#define XFS_FSOP_GOING_FLAGS_LOGFLUSH    0x1     /* flush log */
-#endif
-#ifndef XFS_FSOP_GOING_FLAGS_NOLOGFLUSH
-#define XFS_FSOP_GOING_FLAGS_NOLOGFLUSH  0x2     /* don't flush log */
-#endif
-
 static char *xprogname;
 
 
src/iopat.c +1 -1
index 1e7d61b..c06071f 100644
@@ -18,7 +18,7 @@
 
 #include <fcntl.h>
 #include <sys/ioctl.h>
-#include <xfs/libxfs.h>
+#include <xfs/xfs.h>
 struct xfs_flock64 f;
 
 int main(int argc, char **argv)
src/t_immutable.c +5 -1
index 667355b..07a36cd 100644
@@ -38,7 +38,7 @@
 #include <libgen.h>
 #include <sys/acl.h>
 #include <attr/xattr.h>
-#include <xfs/libxfs.h>
+#include <xfs/xfs.h>
 #include <xfs/handle.h>
 #include <xfs/jdm.h>
 
@@ -47,6 +47,10 @@
 #define EXT2_APPEND_FL          0x00000020
 #define EXT2_IOC_SETFLAGS	_IOW('f', 2, long)
 
+#ifndef XFS_SUPER_MAGIC
+#define XFS_SUPER_MAGIC 0x58465342
+#endif
+
 extern const char *__progname;
 
 static int fsetflag(const char *path, int fd, int on, int immutable)
src/unwritten_mmap.c +1 -1
index 5e63486..aec6a69 100644
@@ -2,7 +2,7 @@
 #include <stdlib.h>
 #include <unistd.h>
 #include <fcntl.h>
-#include <xfs/libxfs.h>
+#include <xfs/xfs.h>
 #include <sys/mman.h>
 
 /*
src/xfsctl.c +1 -1
index f8afb16..8fa3348 100644
@@ -16,7 +16,7 @@
  * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
-#include <xfs/libxfs.h>
+#include <xfs/xfs.h>
 #include <xfs/jdm.h>
 
 /* simple test program to try out a bunch of xfsctls:

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

Reviewed-by on v2 1/9
#6 lore raw

Re: [PATCH 1/9 V2] Use xfs.h rather than libxfs.h

src/t_immutable.c line 52

Quoted 3 lines
src/t_immutable.c +3 -0
+#ifndef XFS_SUPER_MAGIC
+#define XFS_SUPER_MAGIC 0x58465342
+#endif

This should eventually be replaced by just using platform_test_xfs_fd from xfs.h

But for now the patch is fine,

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

#7 lore raw

PATCH 2/9 Make libxfs.h optional

In reply to Eric Sandeen

libxfs.h is really only needed for the loggen test; make it config-time optional.

---
 044                   |    2 ++
 aclocal.m4            |   12 +++---------
 configure.in          |    2 +-
 include/builddefs.in  |    1 +
 m4/package_xfslibs.m4 |   11 +++--------
 src/Makefile          |    6 +++++-
 6 files changed, 15 insertions(+), 19 deletions(-)
044 +2 -0
index 7975db4..ba2d33b 100755
@@ -108,6 +108,8 @@ _filter_mkfs <$tmp.mkfs0 2>$tmp.mkfs1
 [ $lversion -ne 1 ] && \
     _notrun "Cannot run this test yet using MKFS_OPTIONS specified"
 
+[ $here/src/loggen ] || _notrun "loggen not built, skipping test"
+
 _check_mount
 _check_require_logdev
 
aclocal.m4 +3 -9
index 6cc5dce..ac616d1 100644
@@ -416,15 +416,9 @@ AC_DEFUN([AC_PACKAGE_NEED_XFS_XFS_H],
     fi
   ])
 
-AC_DEFUN([AC_PACKAGE_NEED_XFS_LIBXFS_H],
-  [ AC_CHECK_HEADERS([xfs/libxfs.h])
-    if test "$ac_cv_header_xfs_libxfs_h" != "yes"; then
-        echo
-        echo 'FATAL ERROR: cannot find a valid <xfs/libxfs.h> header file.'
-        echo 'Install or upgrade the XFS development package.'
-        echo 'Alternatively, run "make install-dev" from the xfsprogs source.'
-        exit 1
-    fi
+AC_DEFUN([AC_PACKAGE_WANT_XFS_LIBXFS_H],
+  [ AC_CHECK_HEADERS([xfs/libxfs.h], [ have_libxfs=true ], [ have_libxfs=false ])
+    AC_SUBST(have_libxfs)
   ])
 
 AC_DEFUN([AC_PACKAGE_NEED_XFS_XQM_H],
configure.in +1 -1
index f087454..210a91e 100644
@@ -45,7 +45,7 @@ in
 	*)
 		AC_MULTILIB($enable_lib64)
 		AC_PACKAGE_NEED_XFS_XFS_H
-		AC_PACKAGE_NEED_XFS_LIBXFS_H
+		AC_PACKAGE_WANT_XFS_LIBXFS_H
 		AC_PACKAGE_NEED_XFS_XQM_H
 		AC_PACKAGE_NEED_XFSCTL_MACRO
 		AC_PACKAGE_NEED_XFS_HANDLE_H
include/builddefs.in +1 -0
index 636f632..e8f4b6b 100644
@@ -14,6 +14,7 @@ LOADERFLAGS = @LDFLAGS@
 CFLAGS = @CFLAGS@
 CPPFLAGS = @CPPFLAGS@
 
+HAVE_LIBXFS = @have_libxfs@
 LIBXFS = @libxfs@
 LIBACL = @libacl@
 LIBATTR = @libattr@
m4/package_xfslibs.m4 +3 -8
index 2c8d694..903e4a7 100644
@@ -8,14 +8,9 @@ AC_DEFUN([AC_PACKAGE_NEED_XFS_XFS_H],
     fi
   ])
 
-AC_DEFUN([AC_PACKAGE_NEED_XFS_LIBXFS_H],
-  [ AC_CHECK_HEADERS([xfs/libxfs.h])
-    if test "$ac_cv_header_xfs_libxfs_h" != "yes"; then
-        echo
-        echo 'FATAL ERROR: cannot find a valid <xfs/libxfs.h> header file.'
-        echo 'Run "make install-qa" from the xfsprogs source.'
-        exit 1
-    fi
+AC_DEFUN([AC_PACKAGE_WANT_LIBXFS_H],
+  [ AC_CHECK_HEADERS([xfs/libxfs.h], [ have_libxfs=true ], [ have_libxfs=false ])
+    AC_SUBST(have_libxfs)
   ])
 
 AC_DEFUN([AC_PACKAGE_NEED_XFS_XQM_H],
src/Makefile +5 -1
index 634e1b3..2a09488 100644
@@ -12,11 +12,15 @@ TARGETS = dirstress fill fill2 getpagesize holes lstat64 \
 	godown resvtest writemod makeextents itrash rename \
 	multi_open_unlink dmiperf unwritten_sync genhashnames
 
-LINUX_TARGETS = loggen xfsctl bstat t_mtab getdevicesize \
+LINUX_TARGETS = xfsctl bstat t_mtab getdevicesize \
 	preallo_rw_pattern_reader preallo_rw_pattern_writer ftrunc trunc \
 	fs_perms testx looptest locktest unwritten_mmap \
 	bulkstat_unlink_test bulkstat_unlink_test_modified t_dir_offset
 
+ifeq ($(HAVE_LIBXFS), true)
+LINUX_TARGETS += loggen
+endif
+
 IRIX_TARGETS = open_unlink
 
 ifeq ($(PKG_PLATFORM),linux)
Signature · 6 lines
1.5.5.6

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

Re: [PATCH 2/9] Make libxfs.h optional

Quoted 5 lines · Christoph Hellwig
Quoted 2 lines · Eric Sandeen

libxfs.h is really only needed for the loggen test; make it config-time optional.

Maybe we should just move loggen into xfsprogs?

Perhaps, though it has no use outside of qa ... even if we do that it'll take a while to trickle into people's xfsprogs, so any problem with putting this patch in for now, even if we move loggen?

Thanks,
-Eric

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

#10 lore raw

Re: [PATCH 2/9] Make libxfs.h optional

Quoted 10 lines · Eric Sandeen
Quoted 5 lines · Christoph Hellwig
Quoted 2 lines · Eric Sandeen

libxfs.h is really only needed for the loggen test; make it config-time optional.

Maybe we should just move loggen into xfsprogs?

Perhaps, though it has no use outside of qa ... even if we do that it'll take a while to trickle into people's xfsprogs, so any problem with putting this patch in for now, even if we move loggen?

I will send a patch to add loggen to xfsprogs ASAP. After that we can remove loggen and thus the requirement for libxfs.h from xfstests completely. The tests that use loggen would ismply check for a xfs_loggen binary in their PATH and not run, so far less drama then the current situation.

Quoted 8 lines

Thanks,
-Eric

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

---end quoted text---

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

#11 lore raw

Re: [PATCH 2/9] Make libxfs.h optional

Quoted 10 lines · Christoph Hellwig
Quoted 8 lines · Eric Sandeen
Quoted 4 lines · Christoph Hellwig
Quoted 2 lines · Eric Sandeen

libxfs.h is really only needed for the loggen test; make it config-time optional.

Maybe we should just move loggen into xfsprogs?

Perhaps, though it has no use outside of qa ... even if we do that it'll take a while to trickle into people's xfsprogs, so any problem with putting this patch in for now, even if we move loggen?

Quoted 5 lines

I will send a patch to add loggen to xfsprogs ASAP. After that we can remove loggen and thus the requirement for libxfs.h from xfstests completely. The tests that use loggen would ismply check for a xfs_loggen binary in their PATH and not run, so far less drama then the current situation.

Ok, sounds fine.

-Eric

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

#12 lore raw

PATCH 3/9 Support "generic" filesystem type

In reply to Eric Sandeen

Create a new "generic" _supported_fs type for tests which are not really filesystem-specific. "generic" tests do expect that acl & attr are supported though.

---
 001       |    2 +-
 002       |    2 +-
 005       |    2 +-
 006       |    2 +-
 007       |    2 +-
 010       |    2 +-
 011       |    2 +-
 013       |    2 +-
 014       |    2 +-
 069       |    2 +-
 070       |    2 +-
 074       |    2 +-
 076       |    2 +-
 093       |    2 +-
 097       |    2 +-
 099       |    2 +-
 100       |    2 +-
 105       |    2 +-
 123       |    2 +-
 124       |    2 +-
 125       |    2 +-
 128       |    2 +-
 131       |    2 +-
 184       |    2 +-
 193       |    2 +-
 common.rc |    2 +-
 new       |    2 +-
 27 files changed, 27 insertions(+), 27 deletions(-)
001 +1 -1
index 2ff2c05..2dddffb 100755
@@ -33,7 +33,7 @@ done_cleanup=false
 trap "_cleanup; rm -f $tmp.*; exit \$status" 0 1 2 3 15
 
 # real QA test starts here
-_supported_fs xfs udf nfs
+_supported_fs generic
 _supported_os IRIX Linux
 
 verbose=true
002 +1 -1
index 13c6be3..c2d2b5a 100755
@@ -30,7 +30,7 @@ _cleanup()
 }
 
 # real QA test starts here
-_supported_fs xfs udf nfs
+_supported_fs generic
 _supported_os IRIX Linux
 
 _setup_testdir
005 +1 -1
index d21dcb5..644f63d 100755
@@ -53,7 +53,7 @@ _touch()
 . ./common.filter
 
 # real QA test starts here
-_supported_fs xfs udf nfs
+_supported_fs generic
 
 # IRIX UDF does not support symlinks
 if [ $FSTYP == 'udf' ]; then
006 +1 -1
index 4da277f..49b5949 100755
@@ -40,7 +40,7 @@ _count()
 . ./common.filter
 
 # real QA test starts here
-_supported_fs xfs udf nfs
+_supported_fs generic
 _supported_os IRIX Linux
 
 _setup_testdir
007 +1 -1
index 290f716..7a97d71 100755
@@ -34,7 +34,7 @@ _cleanup()
 . ./common.filter
 
 # real QA test starts here
-_supported_fs xfs udf nfs
+_supported_fs generic
 _supported_os IRIX Linux
 
 _setup_testdir
010 +1 -1
index c51ecb2..f1bc885 100755
@@ -42,7 +42,7 @@ _filter_dbtest()
 [ -x $here/src/dbtest ] || _notrun "dbtest was not built for this platform"
 
 # real QA test starts here
-_supported_fs xfs udf nfs
+_supported_fs generic
 _supported_os IRIX Linux
 
 _setup_testdir
011 +1 -1
index 655229b..e1a3d7d 100755
@@ -32,7 +32,7 @@ _cleanup()
 . ./common.filter
 
 # real QA test starts here
-_supported_fs xfs udf nfs
+_supported_fs generic
 _supported_os IRIX Linux
 
 _setup_testdir
013 +1 -1
index 1c99e8f..e417d5a 100755
@@ -78,7 +78,7 @@ _do_test()
 
 
 # real QA test starts here
-_supported_fs xfs udf
+_supported_fs generic
 _supported_os IRIX Linux
 
 _setup_testdir
014 +1 -1
index acc3696..f5b64d0 100755
@@ -30,7 +30,7 @@ _cleanup()
 . ./common.rc
 . ./common.filter
 
-_supported_fs xfs udf nfs
+_supported_fs generic
 _supported_os IRIX Linux
 
 _setup_testdir
069 +1 -1
index 11efd98..4950901 100755
@@ -23,7 +23,7 @@ trap "rm -rf $tmp.*; exit \$status" 0 1 2 3 15
 . ./common.filter
 
 # real QA test starts here
-_supported_fs xfs udf nfs
+_supported_fs generic
 _supported_os IRIX Linux
 
 _require_scratch
070 +1 -1
index 65e158a..9302500 100755
@@ -30,7 +30,7 @@ _cleanup()
 . ./common.filter
 
 # real QA test starts here
-_supported_fs xfs udf nfs
+_supported_fs generic
 _supported_os IRIX Linux
 
 _setup_testdir
074 +1 -1
index d5e0364..0bd0807 100755
@@ -97,7 +97,7 @@ _process_args()
 # real QA test starts here
 rm -f $here/$seq.full
 
-_supported_fs xfs udf nfs
+_supported_fs generic
 _supported_os IRIX Linux
 
 #
076 +1 -1
index 975de2e..c0f6675 100755
@@ -39,7 +39,7 @@ trap "_cleanup; rm -f $tmp.*; exit \$status" 0 1 2 3 15
 . ./common.filter
 
 # real QA test starts here
-_supported_fs xfs udf
+_supported_fs generic
 _supported_os IRIX Linux
 
 _require_scratch
093 +1 -1
index c1243e2..1139788 100755
@@ -43,7 +43,7 @@ _filefilter()
 }
 
 # real QA test starts here
-_supported_fs xfs udf
+_supported_fs generic
 _supported_os IRIX
 
 [ -x $runas ] || _notrun "$runas executable not found"
097 +1 -1
index b7fe1f2..9c38d18 100755
@@ -58,7 +58,7 @@ else
 fi
 
 # real QA test starts here
-_supported_fs udf xfs
+_supported_fs generic
 _supported_os IRIX
 
 _require_scratch
099 +1 -1
index 1c5daeb..6b824dd 100755
@@ -62,7 +62,7 @@ rm -f $seq.full
 
 #-------------------------------------------------------
 # real QA test starts here
-_supported_fs xfs udf
+_supported_fs generic
 _supported_os IRIX
 
 _acl_setup_ids
100 +1 -1
index aa6c4ca..57e9bb6 100755
@@ -29,7 +29,7 @@ _cleanup()
 }
  
 # real QA test starts here
-_supported_fs xfs udf nfs
+_supported_fs generic
 _supported_os IRIX Linux
 
 # Use _populate_fs() in common.rc to create a directory structure.
105 +1 -1
index cd201dd..f154422 100755
@@ -32,7 +32,7 @@ _cleanup()
 . ./common.attr
 
 # Modify as appropriate.
-_supported_fs xfs udf
+_supported_fs generic
 _supported_os IRIX Linux
 
 # real QA test starts here
123 +1 -1
index 63cd48f..ba7c454 100755
@@ -57,7 +57,7 @@ _user_do()
 . ./common.filter
 
 # real QA test starts here
-_supported_fs xfs udf nfs
+_supported_fs generic
 _supported_os Linux IRIX
 
 _require_user
124 +1 -1
index 29af340..5adef48 100755
@@ -33,7 +33,7 @@ _cleanup()
 . ./common.filter
 
 # real QA test starts here
-_supported_fs xfs udf nfs
+_supported_fs generic
 _supported_os Linux
 
 _setup_testdir
125 +1 -1
index ff538ef..f432034 100755
@@ -28,7 +28,7 @@ _cleanup()
 . ./common.filter
 
 # real QA test starts here
-_supported_fs xfs udf nfs
+_supported_fs generic
 _supported_os Linux
 
 _require_user
128 +1 -1
index 24bdac7..227d05c 100755
@@ -30,7 +30,7 @@ _cleanup()
 . ./common.filter
 
 # real QA test starts here
-_supported_fs xfs udf nfs
+_supported_fs generic
 _supported_os Linux
 
 _setup_testdir
131 +1 -1
index 78627f5..67adb81 100755
@@ -28,7 +28,7 @@ _cleanup()
 . ./common.filter
 
 # real QA test starts here
-_supported_fs xfs udf nfs
+_supported_fs generic
 _supported_os Linux
 
 _setup_testdir
184 +1 -1
index 30839cb..408e645 100755
@@ -30,7 +30,7 @@ _cleanup()
 . ./common.filter
 
 # real QA test starts here
-_supported_fs xfs udf nfs
+_supported_fs generic
 _supported_os IRIX Linux
 
 _setup_testdir
193 +1 -1
index 54c51a2..743c70f 100755
@@ -50,7 +50,7 @@ _cleanup_files()
 . ./common.filter
 
 # real QA test starts here
-_supported_fs xfs nfs udf
+_supported_fs generic
 _supported_os Linux
 
 _require_user
common.rc +1 -1
index 317e009..f649bc2 100644
@@ -546,7 +546,7 @@ _supported_fs()
 {
     for f
     do
-	if [ "$f" = "$FSTYP" ]
+	if [ "$f" = "$FSTYP" -o "$f" = "generic" ]
 	then
 	    return
 	fi
new +1 -1
index c924ffe..ac61221 100755
@@ -99,7 +99,7 @@ _cleanup()
 # real QA test starts here
 
 # Modify as appropriate.
-_supported_fs xfs udf nfs
+_supported_fs generic
 _supported_os IRIX Linux
 
 # if error
Signature · 6 lines
1.5.5.6

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

PATCH 4/9 069: make scratch mkfs quiet

In reply to Eric Sandeen

The _scratch_mkfs call in test 069 was not redirecting stderr to /dev/null; other mkfs's may be more noisy on stderr.

---
 069 |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
069 +1 -1
index 4950901..78689ed 100755
@@ -32,7 +32,7 @@ rm -f $seq.full
 umount $SCRATCH_DEV >/dev/null 2>&1
 
 echo "*** mkfs"
-_scratch_mkfs >/dev/null || _fail "mkfs failed"
+_scratch_mkfs >/dev/null 2>&1 || _fail "mkfs failed"
 
 echo "*** mount FS"
 _scratch_mount >/dev/null || _fail "mount failed"
Signature · 6 lines
1.5.5.6

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

PATCH 5/9 Set up testdir for generic filesystems

In reply to Eric Sandeen

Make the default filesystem testdir setup the same as what xfs did; simply set up the testdir variable.

Update the comment for UDF & NFS, as to why they are currently doing something different.

---
 common.rc |   31 ++++++++++---------------------
 1 files changed, 10 insertions(+), 21 deletions(-)
common.rc +10 -21
index f649bc2..78514f4 100644
@@ -988,15 +988,6 @@ _check_testdir()
     esac
 }
 
-
-_setup_xfs_testdir()
-{
-    [ "$FSTYP" != "xfs" ] \
-	&& _fail "setup_xfs_testdir: \$FSTYP ($FSTYP) is not xfs"
-
-    testdir=$TEST_DIR
-}
-
 _setup_udf_scratchdir()
 {
     [ "$FSTYP" != "udf" ] \
@@ -1050,16 +1041,17 @@ _setup_nfs_scratchdir()
 }
 
 #
-# Warning for UDF and NFS this function calls _setup_udf_scratchdir and
-# _setup_udf_scratchdir. This is done because testdir is a persistent
-# XFS only partition.
+# Warning for UDF and NFS:
+# this function calls _setup_udf_scratchdir and _setup_udf_scratchdir
+# which actually uses the scratch dir for the test dir.
+#
+# This was done because testdir was intended to be a persistent
+# XFS only partition.  This should eventually change, and treat
+# at least local filesystems all the same.
 #
 _setup_testdir()
 {
     case $FSTYP in
-    xfs)
-	_setup_xfs_testdir
-	;;
     udf)
 	_setup_udf_scratchdir
 	;;
@@ -1067,7 +1059,7 @@ _setup_testdir()
 	_setup_nfs_scratchdir
 	;;
     *)
-	_fail "\$FSTYP is not xfs, udf or nfs"
+	testdir=$TEST_DIR
 	;;
     esac
 }
@@ -1075,10 +1067,6 @@ _setup_testdir()
 _cleanup_testdir()
 {
     case $FSTYP in
-    xfs)
-	# do nothing, testdir is $TEST_DIR
-	:
-	;;
     udf)
 	# umount testdir as it is $SCRATCH_MNT which could be used by xfs next
 	[ -n "$testdir" ] && $UMOUNT_PROG $testdir
@@ -1088,7 +1076,8 @@ _cleanup_testdir()
 	[ -n "$testdir" ] && $UMOUNT_PROG $testdir
 	;;
     *)
-	_fail "\$FSTYP is not xfs, udf or nfs"
+	# do nothing, testdir is $TEST_DIR
+	:
 	;;
     esac
 }
Signature · 6 lines
1.5.5.6

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

PATCH 6/9 Detect FS type to test based on TEST_DEV

In reply to Eric Sandeen

This helps support generic / non-xfs fileystems.

Rather than defaulting to xfs or expecting a fs
type passed in, just look at what is on TEST_DEV
and use that for FSTYP by default.

We may wish to add a generic way to override this later.

---
 common |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)
common +7 -1
index 92ec9e2..b5ca5d0 100644
@@ -30,7 +30,13 @@ have_test_arg=false
 randomize=false
 rm -f $tmp.list $tmp.tmp $tmp.sed
 
-export FSTYP=xfs
+# Autodetect fs type based on what's on $TEST_DEV
+if [ "$HOSTOS" == "Linux" ]
+then
+    export FSTYP=`blkid -s TYPE -o value $TEST_DEV`
+else
+    export FSTYP=xfs
+fi
 
 for r
 do
Signature · 6 lines
1.5.5.6

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Reviewed-by on v1 6/9
#19 lore raw

Re: [PATCH 6/9] Detect FS type to test based on TEST_DEV

Quoted 7 lines · Eric Sandeen

This helps support generic / non-xfs fileystems.

Rather than defaulting to xfs or expecting a fs
type passed in, just look at what is on TEST_DEV
and use that for FSTYP by default.

We may wish to add a generic way to override this later.

Looks good,

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

#20 lore raw

PATCH 7/9 Set default extN mount options

In reply to Eric Sandeen

ext2/3/4 don't support acls & attrs w/o specific mount options, so make those the default whenever we mount these filesystems.

---
 common.rc |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
common.rc +5 -1
index 78514f4..54c36f3 100644
@@ -49,6 +49,10 @@ _mount_opts()
     nfs)
 	export MOUNT_OPTIONS=$NFS_MOUNT_OPTIONS
 	;;
+    ext2|ext3|ext4)
+	# acls & xattrs aren't turned on by default on ext$FOO
+	export MOUNT_OPTIONS="-o acl,user_xattr $EXT_MOUNT_OPTIONS"
+	;;
     *)
 	;;
     esac
@@ -585,7 +589,7 @@ _require_scratch()
 		     _notrun "this test requires a valid \$SCRATCH_DEV"
 		 fi
 		 ;;
-	nfs*|ext2|ext3|reiserfs)
+	nfs*|ext2|ext3|ext4|reiserfs)
 		 echo $SCRATCH_DEV | grep -q ":" > /dev/null 2>&1
 		 if [ ! -z "$SCRATCH_DEV" -a ! -b "$SCRATCH_DEV" -a "$?" != "0" ]
 		 then
Signature · 6 lines
1.5.5.6

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

Re: [PATCH 7/9] Set default extN mount options

Quoted 3 lines · On Mittwoch 27 Mai 2009 Eric Sandeen wrote:

ext2/3/4 don't support acls & attrs w/o specific mount options, so make those the default whenever we mount these filesystems.

The same for reiserfs, but I don't know if that is wanted/needed.

mfg zmi

Signature · 5 lines
// Michael Monnerie, Ing.BSc    -----      http://it-management.at
// Tel: 0660 / 415 65 31                      .network.your.ideas.
// PGP Key:         "curl -s http://zmi.at/zmi.asc | gpg --import"
// Fingerprint: AC19 F9D5 36ED CD8A EF38  500E CE14 91F7 1C12 09B4
// Keyserver: wwwkeys.eu.pgp.net                  Key-ID: 1C1209B4

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

#22 lore raw

Re: [PATCH 7/9] Set default extN mount options

Quoted 8 lines · Michael Monnerie
Quoted 3 lines · On Mittwoch 27 Mai 2009 Eric Sandeen wrote:

ext2/3/4 don't support acls & attrs w/o specific mount options, so make those the default whenever we mount these filesystems.

The same for reiserfs, but I don't know if that is wanted/needed.

From a look at the point option parser it would need the same

options.

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

#23 lore raw

Re: [PATCH 7/9] Set default extN mount options

Quoted 4 lines · On Donnerstag 28 Mai 2009 Christoph Hellwig wrote:
Quoted 1 line

The same for reiserfs, but I don't know if that is wanted/needed.

From a look at the point option parser it would need the same options.

Sorry, didn't express it well. Try to clear up: I know the options are needed for ACLs, as I use reiserfs a lot, but I don't know if it's in the list of FSs that are to be directly supported.

mfg zmi

Signature · 5 lines
// Michael Monnerie, Ing.BSc    -----      http://it-management.at
// Tel: 0660 / 415 65 31                      .network.your.ideas.
// PGP Key:         "curl -s http://zmi.at/zmi.asc | gpg --import"
// Fingerprint: AC19 F9D5 36ED CD8A EF38  500E CE14 91F7 1C12 09B4
// Keyserver: wwwkeys.eu.pgp.net                  Key-ID: 1C1209B4

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

#24 lore raw

Re: [PATCH 7/9] Set default extN mount options

Quoted 10 lines · Michael Monnerie
Quoted 3 lines · On Donnerstag 28 Mai 2009 Christoph Hellwig wrote:
Quoted 1 line

The same for reiserfs, but I don't know if that is wanted/needed.

From a look at the point option parser it would need the same options.

Sorry, didn't express it well. Try to clear up: I know the options are needed for ACLs, as I use reiserfs a lot, but I don't know if it's in the list of FSs that are to be directly supported.

mfg zmi

I'd be happy to include support for reiserfs as well. I'd be even happier if you tested this yourself and sent patches to make it work :)

-Eric

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

#25 lore raw

Re: [PATCH 7/9] Set default extN mount options

Quoted 3 lines · On Donnerstag 28 Mai 2009 Eric Sandeen wrote:

'd be happy to include support for reiserfs as well.  I'd be even happier if you tested this yourself and sent patches to make it work :)

I'm not a coder, really, but just changing your line:
+ ext2|ext3|ext4)
to:
+ ext2|ext3|ext4|reiserfs)
does the job here. I meant that part:

common.rc +3 -0
index 78514f4..54c36f3 100644
@@ -49,6 +49,10 @@ _mount_opts()
     nfs)
        export MOUNT_OPTIONS=$NFS_MOUNT_OPTIONS
        ;;
+    ext2|ext3|ext4)
+       # acls & xattrs aren't turned on by default on ext$FOO
+       export MOUNT_OPTIONS="-o acl,user_xattr $EXT_MOUNT_OPTIONS"
 

I never used xfstest as well, and won't realistically have time to do it.

mfg zmi

Signature · 5 lines
// Michael Monnerie, Ing.BSc    -----      http://it-management.at
// Tel: 0660 / 415 65 31                      .network.your.ideas.
// PGP Key:         "curl -s http://zmi.at/zmi.asc | gpg --import"
// Fingerprint: AC19 F9D5 36ED CD8A EF38  500E CE14 91F7 1C12 09B4
// Keyserver: wwwkeys.eu.pgp.net                  Key-ID: 1C1209B4

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

Reviewed-by on v1 7/9
#26 lore raw

Re: [PATCH 7/9] Set default extN mount options

In reply to Eric Sandeen
Quoted 14 lines · Eric Sandeen

ext2/3/4 don't support acls & attrs w/o specific mount options, so make those the default whenever we mount these filesystems.

---
 common.rc |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
common.rc +0 -0
index 78514f4..54c36f3 100644

common.rc _mount_opts() · line 55

Quoted 7 lines
common.rc +4 -0
@@ -49,6 +49,10 @@ _mount_opts()
     nfs)
 	export MOUNT_OPTIONS=$NFS_MOUNT_OPTIONS
 	;;
+    ext2|ext3|ext4)
+	# acls & xattrs aren't turned on by default on ext$FOO
+	export MOUNT_OPTIONS="-o acl,user_xattr $EXT_MOUNT_OPTIONS"
+	;;

This part looks good.

common.rc _require_scratch() · line 594

Quoted 8 lines
common.rc +1 -1
@@ -585,7 +589,7 @@ _require_scratch()
 		     _notrun "this test requires a valid \$SCRATCH_DEV"
 		 fi
 		 ;;
-	nfs*|ext2|ext3|reiserfs)
+	nfs*|ext2|ext3|ext4|reiserfs)
 		 echo $SCRATCH_DEV | grep -q ":" > /dev/null 2>&1
 		 if [ ! -z "$SCRATCH_DEV" -a ! -b "$SCRATCH_DEV" -a "$?" != "0" ]

This whole function looks fishy to me, but just treating ext4 the same as ext2/ext3 makes sense at least.

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

#27 lore raw

Re: [PATCH 7/9] Set default extN mount options

Quoted 11 lines · Christoph Hellwig

common.rc _require_scratch() · line 594

Quoted 8 lines
common.rc +1 -1
@@ -585,7 +589,7 @@ _require_scratch()
 		     _notrun "this test requires a valid \$SCRATCH_DEV"
 		 fi
 		 ;;
-	nfs*|ext2|ext3|reiserfs)
+	nfs*|ext2|ext3|ext4|reiserfs)
 		 echo $SCRATCH_DEV | grep -q ":" > /dev/null 2>&1
 		 if [ ! -z "$SCRATCH_DEV" -a ! -b "$SCRATCH_DEV" -a "$?" != "0" ]

This whole function looks fishy to me, but just treating ext4 the same as ext2/ext3 makes sense at least.

I agree, I Need to sort out what's going on here but this was a "make it work" patch :)

Thanks,

-Eric

Quoted 3 lines

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

#28 lore raw

PATCH 8/9 Enable generic filesystems to be fsck'd

In reply to Eric Sandeen

This includes a fair bit of rearranging to avoid code duplication, but the goal is to allow 'fsck -n -t $FSTYP $device' to be run on any generic filesystem.

Any FS for which this doesn't work will need it's own fsck routine.

---
 common.rc |  164 ++++++++++++++++++++++++++++++++++++++++++++++++-------------
 1 files changed, 130 insertions(+), 34 deletions(-)
common.rc +130 -34
index 54c36f3..c0e6582 100644
@@ -693,29 +693,36 @@ _require_user()
     [ "$?" == "0" ] || _notrun "$qa_user user not defined."
 }
 
-# check that a FS is mounted as XFS. if so, return mount point
+# check that a FS on a device ($1) is mounted (optionally as fstype ($2)).
+# if so, return mount point
 #
-_xfs_mounted()
+_is_mounted()
 {
-    if [ $# -ne 1 ]
+    if [ $# -le 0 -o $# -ge 3 ]
     then
-	echo "Usage: _xfs_mounted device" 1>&2
+	echo "Usage: _is_mounted device [fstype]" 1>&2
 	exit 1
     fi
 
     device=$1
 
-    if _mount | grep "$device " | $AWK_PROG '
-        /type xfs/  { print $3 ; exit 0 }
-        END         { exit 1 }
+    if [ $# -eq 2 ]
+    then
+	fstype=$2
+    else
+	fstype=$FSTYP
+    fi
+
+    if _mount | grep "$device " | $AWK_PROG -v pattern="type $fstype" '
+        pattern        { print $3 ; exit 0 }
+        END            { exit 1 }
     '
     then
-        echo "_xfs_mounted: $device is not a mounted XFS FS"
+        echo "_is_mounted: $device is not a mounted $fstype FS"
         exit 1
     fi
 }
 
-
 # remount a FS to a new mode (ro or rw)
 #
 _remount()
@@ -735,14 +742,105 @@ _remount()
     fi
 }
 
-# run xfs_check and friends on a FS.
+# Run the apropriate repair/check on a filesystem
 #
 # if the filesystem is mounted, it's either remounted ro before being
 # checked or it's unmounted and then remounted
 #
 
+# If set, we remount ro instead of unmounting for fsck
 USE_REMOUNT=0
 
+_umount_or_remount_ro()
+{
+    if [ $# -ne 1 ]
+    then
+	echo "Usage: _umount_or_remount_ro device" 1>&2
+	exit 1
+    fi
+    device=$1
+
+    if [ $USE_REMOUNT -eq 0 ]
+    then
+        mountpoint=`_is_mounted $device`
+        $UMOUNT_PROG $device
+    else
+        _remount $device ro
+    fi
+    echo "$mountpoint"
+}
+
+_mount_or_remount_rw()
+{
+    if [ $# -ne 3 ]
+    then
+	echo "Usage: _mount_or_remount_rw opts device mountpoint" 1>&2
+	exit 1
+    fi
+    mount_opts=$1
+    device=$2
+    mountpoint=$3
+
+    if [ $USE_REMOUNT -eq 0 ]
+    then
+        if ! _mount -t $FSTYP $mount_opts $device $mountpoint
+        then
+            echo "!!! failed to remount $device on $mountpoint"
+            return 0 # ok=0
+        fi
+    else
+        _remount $device rw
+    fi
+
+    return 1 # ok=1
+}
+
+_check_generic_filesystem()
+{
+    device=$1
+
+    # If type is set, we're mounted
+    type=`_fs_type $device`
+    ok=1
+
+    if [ "$type" = "$FSTYP" ]
+    then
+        # mounted ...
+        mountpoint=`_umount_or_remount_ro $device`
+    fi
+
+    fsck -t $FSTYP -n $device >$tmp.fsck 2>&1
+    if [ $? -ne 0 ]
+    then
+        echo "_check_generic_filesystem: filesystem on $device is inconsistent (see $seq.full)"
+
+        echo "_check_generic filesystem: filesystem on $device is inconsistent" >>$here/$seq.full
+        echo "*** fsck.$FSTYP output ***"                     >>$here/$seq.full
+        cat $tmp.fsck                                         >>$here/$seq.full
+        echo "*** end fsck.$FSTYP output"                     >>$here/$seq.full
+
+        ok=0
+    fi
+    rm -f $tmp.fsck
+
+    if [ $ok -eq 0 ]
+    then
+        echo "*** mount output ***"                             >>$here/$seq.full
+        _mount                                                  >>$here/$seq.full
+        echo "*** end mount output"                             >>$here/$seq.full
+    elif [ "$type" = "$FSTYP" ]
+    then
+        # was mounted ...
+	_mount_or_remount_rw "$MOUNT_OPTIONS" $device $mountpoint
+        ok=$?
+    fi
+
+    [ $ok -eq 0 ] && exit 1
+    return 0
+}
+
+# run xfs_check and friends on a FS.
+
 _check_xfs_filesystem()
 {
     if [ $# -ne 3 ]
@@ -773,15 +871,8 @@ _check_xfs_filesystem()
 
     if [ "$type" = "xfs" ]
     then
-        # mounted...
-
-        if [ $USE_REMOUNT -eq 0 ]
-        then
-            mountpoint=`_xfs_mounted $device`
-            $UMOUNT_PROG $device
-        else
-            _remount $device ro
-        fi
+        # mounted ...
+        mountpoint=`_umount_or_remount_ro $device`
     fi
 
     $XFS_LOGPRINT_PROG -t $extra_log_options $device 2>&1 \
@@ -834,17 +925,7 @@ _check_xfs_filesystem()
         echo "*** end mount output"                             >>$here/$seq.full
     elif [ "$type" = "xfs" ]
     then
-        # mounted...
-        if [ $USE_REMOUNT -eq 0 ]
-        then
-            if ! _mount -t xfs $extra_mount_options $device $mountpoint
-            then
-                echo "!!! failed to remount $device on $mountpoint"
-                ok=0
-            fi
-        else
-            _remount $device rw
-        fi
+	_mount_or_remount_rw "$extra_mount_options" $device $mountpoint
     fi
 
     [ $ok -eq 0 ] && exit 1
@@ -894,12 +975,13 @@ _check_udf_filesystem()
 
 }
 
-_check_test_fs()
+_check_generic_test_fs()
 {
-    if [ "$FSTYP" != "xfs" ]; then
-        return
-    fi
+    _check_generic_filesystem $TEST_DEV
+}
 
+_check_xfs_test_fs()
+{
     TEST_LOG="none"
     TEST_RT="none"
     [ "$USE_EXTERNAL" = yes -a ! -z "$TEST_LOGDEV" ] && \
@@ -918,6 +1000,18 @@ _check_test_fs()
     fi
 }
 
+_check_test_fs()
+{
+    case $FSTYP in
+    xfs)
+	_check_xfs_test_fs
+	;;
+    *)
+	_check_generic_test_fs
+	;;
+    esac
+}
+
 _check_scratch_fs()
 {
     case $FSTYP in
@@ -939,6 +1033,7 @@ _check_scratch_fs()
 	# Don't know how to check an NFS filesystem, yet.
 	;;
     *)
+	_check_generic_filesystem $SCRATCH_DEV
 	;;
     esac
 }
@@ -988,6 +1083,7 @@ _check_testdir()
 	# Don't know how to check an NFS filesystem, yet.
 	;;
     *)
+	_check_generic_test_fs
 	;;
     esac
 }
Signature · 6 lines
1.5.5.6

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

Re: [PATCH 8/9] Enable generic filesystems to be fsck'd

Quoted 5 lines · Eric Sandeen

This includes a fair bit of rearranging to avoid code duplication, but the goal is to allow 'fsck -n -t $FSTYP $device' to be run on any generic filesystem.

Any FS for which this doesn't work will need it's own fsck routine.

Looks generally good, some comments:

- I would get rid of _check_generic_test_fs and just opencode the _check_generic_filesystem $TEST_DEV in the two callers.
- why the odd calling convention of _is_mounted which allows to optionally pass the fstype? Currently we only have one caller that doesn't pass it, and if we grow one that needs it I would rather always pass it explicitly..

Btw, I seems like _check_testdir is never actually called, and I can't really see a reason why it would be different from _check_test_fs.

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

#30 lore raw

Re: [PATCH 8/9] Enable generic filesystems to be fsck'd

Quoted 16 lines · Christoph Hellwig
Quoted 5 lines · Eric Sandeen

This includes a fair bit of rearranging to avoid code duplication, but the goal is to allow 'fsck -n -t $FSTYP $device' to be run on any generic filesystem.

Any FS for which this doesn't work will need it's own fsck routine.

Looks generally good, some comments:

- I would get rid of _check_generic_test_fs and just opencode the _check_generic_filesystem $TEST_DEV in the two callers.
- why the odd calling convention of _is_mounted which allows to optionally pass the fstype? Currently we only have one caller that doesn't pass it, and if we grow one that needs it I would rather always pass it explicitly..

Quoted 2 lines

Btw, I seems like _check_testdir is never actually called, and I can't really see a reason why it would be different from _check_test_fs.

Here's a version with those changes and additionally making sure _check_test_fs continues to be a no-op for nfs and udf.

common.rc +123 -53
Index: xfstests-dev/common.rc
===================================================================
@@ -707,29 +707,29 @@
     [ "$?" == "0" ] || _notrun "$qa_user user not defined."
 }
 
-# check that a FS is mounted as XFS. if so, return mount point
+# check that a FS on a device is mounted
+# if so, return mount point
 #
-_xfs_mounted()
+_is_mounted()
 {
     if [ $# -ne 1 ]
     then
-	echo "Usage: _xfs_mounted device" 1>&2
+	echo "Usage: _is_mounted device" 1>&2
 	exit 1
     fi
 
     device=$1
 
-    if _mount | grep "$device " | $AWK_PROG '
-        /type xfs/  { print $3 ; exit 0 }
-        END         { exit 1 }
+    if _mount | grep "$device " | $AWK_PROG -v pattern="type $FSTYP" '
+        pattern        { print $3 ; exit 0 }
+        END            { exit 1 }
     '
     then
-        echo "_xfs_mounted: $device is not a mounted XFS FS"
+        echo "_is_mounted: $device is not a mounted $FSTYP FS"
         exit 1
     fi
 }
 
-
 # remount a FS to a new mode (ro or rw)
 #
 _remount()
@@ -749,14 +749,105 @@
     fi
 }
 
-# run xfs_check and friends on a FS.
+# Run the apropriate repair/check on a filesystem
 #
 # if the filesystem is mounted, it's either remounted ro before being
 # checked or it's unmounted and then remounted
 #
 
+# If set, we remount ro instead of unmounting for fsck
 USE_REMOUNT=0
 
+_umount_or_remount_ro()
+{
+    if [ $# -ne 1 ]
+    then
+	echo "Usage: _umount_or_remount_ro device" 1>&2
+	exit 1
+    fi
+    device=$1
+
+    if [ $USE_REMOUNT -eq 0 ]
+    then
+        mountpoint=`_is_mounted $device`
+        $UMOUNT_PROG $device
+    else
+        _remount $device ro
+    fi
+    echo "$mountpoint"
+}
+
+_mount_or_remount_rw()
+{
+    if [ $# -ne 3 ]
+    then
+	echo "Usage: _mount_or_remount_rw opts device mountpoint" 1>&2
+	exit 1
+    fi
+    mount_opts=$1
+    device=$2
+    mountpoint=$3
+
+    if [ $USE_REMOUNT -eq 0 ]
+    then
+        if ! _mount -t $FSTYP $mount_opts $device $mountpoint
+        then
+            echo "!!! failed to remount $device on $mountpoint"
+            return 0 # ok=0
+        fi
+    else
+        _remount $device rw
+    fi
+
+    return 1 # ok=1
+}
+
+_check_generic_filesystem()
+{
+    device=$1
+
+    # If type is set, we're mounted
+    type=`_fs_type $device`
+    ok=1
+
+    if [ "$type" = "$FSTYP" ]
+    then
+        # mounted ...
+        mountpoint=`_umount_or_remount_ro $device`
+    fi
+
+    fsck -t $FSTYP -n $device >$tmp.fsck 2>&1
+    if [ $? -ne 0 ]
+    then
+        echo "_check_generic_filesystem: filesystem on $device is inconsistent (see $seq.full)"
+
+        echo "_check_generic filesystem: filesystem on $device is inconsistent" >>$here/$seq.full
+        echo "*** fsck.$FSTYP output ***"                     >>$here/$seq.full
+        cat $tmp.fsck                                         >>$here/$seq.full
+        echo "*** end fsck.$FSTYP output"                     >>$here/$seq.full
+
+        ok=0
+    fi
+    rm -f $tmp.fsck
+
+    if [ $ok -eq 0 ]
+    then
+        echo "*** mount output ***"                             >>$here/$seq.full
+        _mount                                                  >>$here/$seq.full
+        echo "*** end mount output"                             >>$here/$seq.full
+    elif [ "$type" = "$FSTYP" ]
+    then
+        # was mounted ...
+	_mount_or_remount_rw "$MOUNT_OPTIONS" $device $mountpoint
+        ok=$?
+    fi
+
+    [ $ok -eq 0 ] && exit 1
+    return 0
+}
+
+# run xfs_check and friends on a FS.
+
 _check_xfs_filesystem()
 {
     if [ $# -ne 3 ]
@@ -787,15 +878,8 @@
 
     if [ "$type" = "xfs" ]
     then
-        # mounted...
-
-        if [ $USE_REMOUNT -eq 0 ]
-        then
-            mountpoint=`_xfs_mounted $device`
-            $UMOUNT_PROG $device
-        else
-            _remount $device ro
-        fi
+        # mounted ...
+        mountpoint=`_umount_or_remount_ro $device`
     fi
 
     $XFS_LOGPRINT_PROG -t $extra_log_options $device 2>&1 \
@@ -848,17 +932,7 @@
         echo "*** end mount output"                             >>$here/$seq.full
     elif [ "$type" = "xfs" ]
     then
-        # mounted...
-        if [ $USE_REMOUNT -eq 0 ]
-        then
-            if ! _mount -t xfs $extra_mount_options $device $mountpoint
-            then
-                echo "!!! failed to remount $device on $mountpoint"
-                ok=0
-            fi
-        else
-            _remount $device rw
-        fi
+	_mount_or_remount_rw "$extra_mount_options" $device $mountpoint
     fi
 
     [ $ok -eq 0 ] && exit 1
@@ -908,12 +982,8 @@
 
 }
 
-_check_test_fs()
+_check_xfs_test_fs()
 {
-    if [ "$FSTYP" != "xfs" ]; then
-        return
-    fi
-
     TEST_LOG="none"
     TEST_RT="none"
     [ "$USE_EXTERNAL" = yes -a ! -z "$TEST_LOGDEV" ] && \
@@ -932,6 +1002,24 @@
     fi
 }
 
+_check_test_fs()
+{
+    case $FSTYP in
+    xfs)
+	_check_xfs_test_fs
+	;;
+    nfs)
+	# no way to check consistency for nfs
+	;;
+    udf)
+	# do nothing for now
+	;;
+    *)
+        _check_generic_filesystem $TEST_DEV
+	;;
+    esac
+}
+
 _check_scratch_fs()
 {
     case $FSTYP in
@@ -953,6 +1041,7 @@
 	# Don't know how to check an NFS filesystem, yet.
 	;;
     *)
+	_check_generic_filesystem $SCRATCH_DEV
 	;;
     esac
 }
@@ -987,25 +1076,6 @@
      echo "$os/$platform $host $kernel"
 }
 
-_check_testdir()
-{
-    case $FSTYP in
-    xfs)
-	_check_test_fs
-	;;
-    udf)
-	_cleanup_testdir
-	_check_scratch_fs
-	_scratch_mount
-	;;
-    nfs*)
-	# Don't know how to check an NFS filesystem, yet.
-	;;
-    *)
-	;;
-    esac
-}
-
 _setup_udf_scratchdir()
 {
     [ "$FSTYP" != "udf" ] \

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

#31 lore raw

Re: [PATCH 8/9] Enable generic filesystems to be fsck'd

Quoted 16 lines · Christoph Hellwig
Quoted 15 lines · Christoph Hellwig
Quoted 5 lines · Eric Sandeen

This includes a fair bit of rearranging to avoid code duplication, but the goal is to allow 'fsck -n -t $FSTYP $device' to be run on any generic filesystem.

Any FS for which this doesn't work will need it's own fsck routine.

Looks generally good, some comments:

- I would get rid of _check_generic_test_fs and just opencode the _check_generic_filesystem $TEST_DEV in the two callers.
- why the odd calling convention of _is_mounted which allows to optionally pass the fstype? Currently we only have one caller that doesn't pass it, and if we grow one that needs it I would rather always pass it explicitly..

Quoted 5 lines
Quoted 2 lines

Btw, I seems like _check_testdir is never actually called, and I can't really see a reason why it would be different from _check_test_fs.

Here's a version with those changes and additionally making sure _check_test_fs continues to be a no-op for nfs and udf.

Thanks :) nitpicky comments below, mostly probably nitpicking stuff that was in my original patch ;)

Quoted 43 lines

Index: xfstests-dev/common.rc
===================================================================

common.rc +8 -8
@@ -707,29 +707,29 @@
     [ "$?" == "0" ] || _notrun "$qa_user user not defined."
 }
 
-# check that a FS is mounted as XFS. if so, return mount point
+# check that a FS on a device is mounted
+# if so, return mount point
 #
-_xfs_mounted()
+_is_mounted()
 {
     if [ $# -ne 1 ]
     then
-	echo "Usage: _xfs_mounted device" 1>&2
+	echo "Usage: _is_mounted device" 1>&2
 	exit 1
     fi
 
     device=$1
 
-    if _mount | grep "$device " | $AWK_PROG '
-        /type xfs/  { print $3 ; exit 0 }
-        END         { exit 1 }
+    if _mount | grep "$device " | $AWK_PROG -v pattern="type $FSTYP" '
+        pattern        { print $3 ; exit 0 }
+        END            { exit 1 }
     '
     then
-        echo "_xfs_mounted: $device is not a mounted XFS FS"
+        echo "_is_mounted: $device is not a mounted $FSTYP FS"
         exit 1
     fi
 }
 
-
 # remount a FS to a new mode (ro or rw)
 #
 _remount()

common.rc line 752

Quoted 5 lines
common.rc +1 -1
@@ -749,14 +749,105 @@
     fi
 }
 
-# run xfs_check and friends on a FS.
+# Run the apropriate repair/check on a filesystem

appropriate (that was probably my typo to start with!)

common.rc line 765

Quoted 13 lines
common.rc +6 -0
 #
 # if the filesystem is mounted, it's either remounted ro before being
 # checked or it's unmounted and then remounted
 #
 
+# If set, we remount ro instead of unmounting for fsck
 USE_REMOUNT=0
 
+_umount_or_remount_ro()
+{
+    if [ $# -ne 1 ]
+    then
+	echo "Usage: _umount_or_remount_ro device" 1>&2

<device> might be clearer

common.rc line 777

Quoted 12 lines
common.rc +12 -0
+	exit 1
+    fi
+    device=$1
+
+    if [ $USE_REMOUNT -eq 0 ]
+    then
+        mountpoint=`_is_mounted $device`
+        $UMOUNT_PROG $device
+    else
+        _remount $device ro
+    fi
+    echo "$mountpoint"

Maybe we should move the mountpoint assignment outside the conditional, since we echo it unconditionally. Only the !USE_REMOUNT case cares anyway but still...

common.rc line 784

Quoted 7 lines
common.rc +7 -0
+}
+
+_mount_or_remount_rw()
+{
+    if [ $# -ne 3 ]
+    then
+	echo "Usage: _mount_or_remount_rw opts device mountpoint" 1>&2

<opts> <device> <mountpoint>

Quoted 9 lines
common.rc +9 -0
+	exit 1
+    fi
+    mount_opts=$1
+    device=$2
+    mountpoint=$3
+
+    if [ $USE_REMOUNT -eq 0 ]
+    then
+        if ! _mount -t $FSTYP $mount_opts $device $mountpoint

common.rc line 803

Quoted 10 lines
common.rc +10 -0
+        then
+            echo "!!! failed to remount $device on $mountpoint"
+            return 0 # ok=0
+        fi
+    else
+        _remount $device rw
+    fi
+
+    return 1 # ok=1
+}

# Check a generic filesystem in no-op mode; this assumes that the

# underlying fsck program accepts "-n" for a no-op (check-only) run,
# and that it will still return an errno for corruption in this mode.
#
# Filesystems which don't support this will need to define their
# own check routine.
Quoted 27 lines
common.rc +27 -0
+_check_generic_filesystem()
+{
+    device=$1
+
+    # If type is set, we're mounted
+    type=`_fs_type $device`
+    ok=1
+
+    if [ "$type" = "$FSTYP" ]
+    then
+        # mounted ...
+        mountpoint=`_umount_or_remount_ro $device`
+    fi
+
+    fsck -t $FSTYP -n $device >$tmp.fsck 2>&1
+    if [ $? -ne 0 ]
+    then
+        echo "_check_generic_filesystem: filesystem on $device is inconsistent (see $seq.full)"
+
+        echo "_check_generic filesystem: filesystem on $device is inconsistent" >>$here/$seq.full
+        echo "*** fsck.$FSTYP output ***"                     >>$here/$seq.full
+        cat $tmp.fsck                                         >>$here/$seq.full
+        echo "*** end fsck.$FSTYP output"                     >>$here/$seq.full
+
+        ok=0
+    fi
+    rm -f $tmp.fsck

common.rc line 841

Quoted 10 lines
common.rc +10 -0
+
+    if [ $ok -eq 0 ]
+    then
+        echo "*** mount output ***"                             >>$here/$seq.full
+        _mount                                                  >>$here/$seq.full
+        echo "*** end mount output"                             >>$here/$seq.full
+    elif [ "$type" = "$FSTYP" ]
+    then
+        # was mounted ...
+	_mount_or_remount_rw "$MOUNT_OPTIONS" $device $mountpoint

oops tab vs. space here

Quoted 71 lines
common.rc +17 -25
+        ok=$?
+    fi
+
+    [ $ok -eq 0 ] && exit 1
+    return 0
+}
+
+# run xfs_check and friends on a FS.
+
 _check_xfs_filesystem()
 {
     if [ $# -ne 3 ]
@@ -787,15 +878,8 @@
 
     if [ "$type" = "xfs" ]
     then
-        # mounted...
-
-        if [ $USE_REMOUNT -eq 0 ]
-        then
-            mountpoint=`_xfs_mounted $device`
-            $UMOUNT_PROG $device
-        else
-            _remount $device ro
-        fi
+        # mounted ...
+        mountpoint=`_umount_or_remount_ro $device`
     fi
 
     $XFS_LOGPRINT_PROG -t $extra_log_options $device 2>&1 \
@@ -848,17 +932,7 @@
         echo "*** end mount output"                             >>$here/$seq.full
     elif [ "$type" = "xfs" ]
     then
-        # mounted...
-        if [ $USE_REMOUNT -eq 0 ]
-        then
-            if ! _mount -t xfs $extra_mount_options $device $mountpoint
-            then
-                echo "!!! failed to remount $device on $mountpoint"
-                ok=0
-            fi
-        else
-            _remount $device rw
-        fi
+	_mount_or_remount_rw "$extra_mount_options" $device $mountpoint
     fi
 
     [ $ok -eq 0 ] && exit 1
@@ -908,12 +982,8 @@
 
 }
 
-_check_test_fs()
+_check_xfs_test_fs()
 {
-    if [ "$FSTYP" != "xfs" ]; then
-        return
-    fi
-
     TEST_LOG="none"
     TEST_RT="none"
     [ "$USE_EXTERNAL" = yes -a ! -z "$TEST_LOGDEV" ] && \
@@ -932,6 +1002,24 @@
     fi
 }
 
+_check_test_fs()
+{
+    case $FSTYP in
+    xfs)

common.rc line 1018

Quoted 10 lines
common.rc +10 -0
+	_check_xfs_test_fs
+	;;
+    nfs)
+	# no way to check consistency for nfs
+	;;
+    udf)
+	# do nothing for now
+	;;
+    *)
+        _check_generic_filesystem $TEST_DEV

fix indentation here ...

Quoted 32 lines
common.rc +5 -12
+	;;
+    esac
+}
+
 _check_scratch_fs()
 {
     case $FSTYP in
@@ -953,6 +1041,7 @@
 	# Don't know how to check an NFS filesystem, yet.
 	;;
     *)
+	_check_generic_filesystem $SCRATCH_DEV
 	;;
     esac
 }
@@ -987,25 +1076,6 @@
      echo "$os/$platform $host $kernel"
 }
 
-_check_testdir()
-{
-    case $FSTYP in
-    xfs)
-	_check_test_fs
-	;;
-    udf)
-	_cleanup_testdir
-	_check_scratch_fs
-	_scratch_mount
-	;;
-    nfs*)

common.rc line 1081

Quoted 10 lines
common.rc +0 -7
-	# Don't know how to check an NFS filesystem, yet.
-	;;
-    *)
-	;;
-    esac
-}
-
 _setup_udf_scratchdir()
 {
     [ "$FSTYP" != "udf" ] \

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

#32 lore raw

Re: [PATCH 8/9] Enable generic filesystems to be fsck'd

Quoted 3 lines · Eric Sandeen

Maybe we should move the mountpoint assignment outside the conditional, since we echo it unconditionally. Only the !USE_REMOUNT case cares anyway but still...

It's only used to be passed as an argument to _mount_or_remount_rw where we only care for the !USE_REMOUNT case.

So I've left this one as-is and fixed up all other issues.

common.rc +130 -53
Index: xfstests-dev/common.rc
===================================================================
@@ -707,29 +707,29 @@
     [ "$?" == "0" ] || _notrun "$qa_user user not defined."
 }
 
-# check that a FS is mounted as XFS. if so, return mount point
+# check that a FS on a device is mounted
+# if so, return mount point
 #
-_xfs_mounted()
+_is_mounted()
 {
     if [ $# -ne 1 ]
     then
-	echo "Usage: _xfs_mounted device" 1>&2
+	echo "Usage: _is_mounted device" 1>&2
 	exit 1
     fi
 
     device=$1
 
-    if _mount | grep "$device " | $AWK_PROG '
-        /type xfs/  { print $3 ; exit 0 }
-        END         { exit 1 }
+    if _mount | grep "$device " | $AWK_PROG -v pattern="type $FSTYP" '
+        pattern        { print $3 ; exit 0 }
+        END            { exit 1 }
     '
     then
-        echo "_xfs_mounted: $device is not a mounted XFS FS"
+        echo "_is_mounted: $device is not a mounted $FSTYP FS"
         exit 1
     fi
 }
 
-
 # remount a FS to a new mode (ro or rw)
 #
 _remount()
@@ -749,14 +749,112 @@
     fi
 }
 
-# run xfs_check and friends on a FS.
+# Run the appropriate repair/check on a filesystem
 #
 # if the filesystem is mounted, it's either remounted ro before being
 # checked or it's unmounted and then remounted
 #
 
+# If set, we remount ro instead of unmounting for fsck
 USE_REMOUNT=0
 
+_umount_or_remount_ro()
+{
+    if [ $# -ne 1 ]
+    then
+	echo "Usage: _umount_or_remount_ro <device>" 1>&2
+	exit 1
+    fi
+    device=$1
+
+    if [ $USE_REMOUNT -eq 0 ]
+    then
+        mountpoint=`_is_mounted $device`
+        $UMOUNT_PROG $device
+    else
+        _remount $device ro
+    fi
+    echo "$mountpoint"
+}
+
+_mount_or_remount_rw()
+{
+    if [ $# -ne 3 ]
+    then
+	echo "Usage: _mount_or_remount_rw <opts> <device> <mountpoint>" 1>&2
+	exit 1
+    fi
+    mount_opts=$1
+    device=$2
+    mountpoint=$3
+
+    if [ $USE_REMOUNT -eq 0 ]
+    then
+        if ! _mount -t $FSTYP $mount_opts $device $mountpoint
+        then
+            echo "!!! failed to remount $device on $mountpoint"
+            return 0 # ok=0
+        fi
+    else
+        _remount $device rw
+    fi
+
+    return 1 # ok=1
+}
+
+# Check a generic filesystem in no-op mode; this assumes that the
+# underlying fsck program accepts "-n" for a no-op (check-only) run,
+# and that it will still return an errno for corruption in this mode.
+#
+# Filesystems which don't support this will need to define their
+# own check routine.
+#
+_check_generic_filesystem()
+{
+    device=$1
+
+    # If type is set, we're mounted
+    type=`_fs_type $device`
+    ok=1
+
+    if [ "$type" = "$FSTYP" ]
+    then
+        # mounted ...
+        mountpoint=`_umount_or_remount_ro $device`
+    fi
+
+    fsck -t $FSTYP -n $device >$tmp.fsck 2>&1
+    if [ $? -ne 0 ]
+    then
+        echo "_check_generic_filesystem: filesystem on $device is inconsistent (see $seq.full)"
+
+        echo "_check_generic filesystem: filesystem on $device is inconsistent" >>$here/$seq.full
+        echo "*** fsck.$FSTYP output ***"                     >>$here/$seq.full
+        cat $tmp.fsck                                         >>$here/$seq.full
+        echo "*** end fsck.$FSTYP output"                     >>$here/$seq.full
+
+        ok=0
+    fi
+    rm -f $tmp.fsck
+
+    if [ $ok -eq 0 ]
+    then
+        echo "*** mount output ***"                             >>$here/$seq.full
+        _mount                                                  >>$here/$seq.full
+        echo "*** end mount output"                             >>$here/$seq.full
+    elif [ "$type" = "$FSTYP" ]
+    then
+	# was mounted ...
+	_mount_or_remount_rw "$MOUNT_OPTIONS" $device $mountpoint
+	ok=$?
+    fi
+
+    [ $ok -eq 0 ] && exit 1
+    return 0
+}
+
+# run xfs_check and friends on a FS.
+
 _check_xfs_filesystem()
 {
     if [ $# -ne 3 ]
@@ -787,15 +885,8 @@
 
     if [ "$type" = "xfs" ]
     then
-        # mounted...
-
-        if [ $USE_REMOUNT -eq 0 ]
-        then
-            mountpoint=`_xfs_mounted $device`
-            $UMOUNT_PROG $device
-        else
-            _remount $device ro
-        fi
+        # mounted ...
+        mountpoint=`_umount_or_remount_ro $device`
     fi
 
     $XFS_LOGPRINT_PROG -t $extra_log_options $device 2>&1 \
@@ -848,17 +939,7 @@
         echo "*** end mount output"                             >>$here/$seq.full
     elif [ "$type" = "xfs" ]
     then
-        # mounted...
-        if [ $USE_REMOUNT -eq 0 ]
-        then
-            if ! _mount -t xfs $extra_mount_options $device $mountpoint
-            then
-                echo "!!! failed to remount $device on $mountpoint"
-                ok=0
-            fi
-        else
-            _remount $device rw
-        fi
+	_mount_or_remount_rw "$extra_mount_options" $device $mountpoint
     fi
 
     [ $ok -eq 0 ] && exit 1
@@ -908,12 +989,8 @@
 
 }
 
-_check_test_fs()
+_check_xfs_test_fs()
 {
-    if [ "$FSTYP" != "xfs" ]; then
-        return
-    fi
-
     TEST_LOG="none"
     TEST_RT="none"
     [ "$USE_EXTERNAL" = yes -a ! -z "$TEST_LOGDEV" ] && \
@@ -932,6 +1009,24 @@
     fi
 }
 
+_check_test_fs()
+{
+    case $FSTYP in
+    xfs)
+	_check_xfs_test_fs
+	;;
+    nfs)
+	# no way to check consistency for nfs
+	;;
+    udf)
+	# do nothing for now
+	;;
+    *)
+	_check_generic_filesystem $TEST_DEV
+	;;
+    esac
+}
+
 _check_scratch_fs()
 {
     case $FSTYP in
@@ -953,6 +1048,7 @@
 	# Don't know how to check an NFS filesystem, yet.
 	;;
     *)
+	_check_generic_filesystem $SCRATCH_DEV
 	;;
     esac
 }
@@ -987,25 +1083,6 @@
      echo "$os/$platform $host $kernel"
 }
 
-_check_testdir()
-{
-    case $FSTYP in
-    xfs)
-	_check_test_fs
-	;;
-    udf)
-	_cleanup_testdir
-	_check_scratch_fs
-	_scratch_mount
-	;;
-    nfs*)
-	# Don't know how to check an NFS filesystem, yet.
-	;;
-    *)
-	;;
-    esac
-}
-
 _setup_udf_scratchdir()
 {
     [ "$FSTYP" != "udf" ] \

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

#33 lore raw

PATCH 9/9 Report which tests did get run

In reply to Eric Sandeen

fs type mismatches are now likely enough that it may be nice to report which tests -were- run at the end...

---
 check |   25 ++++++++++++++++++-------
 1 files changed, 18 insertions(+), 7 deletions(-)
check +18 -7
index 7ca17ef..348b68e 100755
@@ -8,7 +8,8 @@
 tmp=/tmp/$$
 status=0
 needwrap=true
-try=0
+n_try=0
+try=""
 n_bad=0
 bad=""
 notrun=""
@@ -86,7 +87,7 @@ END	{ if (NR > 0) {
 	if [ -f $tmp.expunged ]
 	then
 	    notrun=`wc -l <$tmp.expunged | sed -e 's/  *//g'`
-	    try=`expr $try - $notrun`
+	    n_try=`expr $n_try - $notrun`
 	    list=`echo "$list" | sed -f $tmp.expunged`
 	fi
 
@@ -95,20 +96,26 @@ END	{ if (NR > 0) {
 	echo $list | fmt | sed -e 's/^/    /' >>check.log
 	$interrupt && echo "Interrupted!" >>check.log
         
+        if [ ! -z "$n_try" -a $n_try != 0 ]
+	then
+	    echo "Ran:$try"
+	fi
+
 	if [ ! -z "$notrun" ]
 	then
 	    echo "Not run:$notrun"
 	    echo "Not run:$notrun" >>check.log
 	fi
+
         if [ ! -z "$n_bad" -a $n_bad != 0 ]
 	then
 	    echo "Failures:$bad"
-	    echo "Failed $n_bad of $try tests"
+	    echo "Failed $n_bad of $n_try tests"
 	    echo "Failures:$bad" | fmt >>check.log
-	    echo "Failed $n_bad of $try tests" >>check.log
+	    echo "Failed $n_bad of $n_try tests" >>check.log
 	else
-	    echo "Passed all $try tests"
-	    echo "Passed all $try tests" >>check.log
+	    echo "Passed all $n_try tests"
+	    echo "Passed all $n_try tests" >>check.log
 	fi
 	needwrap=false
     fi
@@ -281,7 +288,11 @@ do
 	n_bad=`expr $n_bad + 1`
 	quick=false
     fi
-    [ -f $seq.notrun ] || try=`expr $try + 1`
+    if [ ! -f $seq.notrun ]
+    then
+	try="$try $seq"
+	n_try=`expr $n_try + 1`
+    fi
     
     seq="after_$seq"
     _check_test_fs
Signature · 6 lines
1.5.5.6

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