Skip to contentSkip to conversation

xfstests 219: test fiemap

PATCH In review Eric Sandeen 2 participants 5 messages Jul 16, 2009 – Jul 27, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xfstests 219: test fiemap

Preliminary fiemap testing support based on a test util written by Josef Bacik.

For now it's only run with preallocation disabled, because xfs has a tendency to fill in holes with data blocks (EOF prealloc stuff I think) and similar for explicit preallocation, so this is breaking the preallocation tests for now, when it finds a "data" block where it expects a preallocated block.

---

aclocal.m4 +19 -0
index 8a61e39..6c25e5a 100644
@@ -523,3 +523,22 @@ AC_DEFUN([AC_PACKAGE_NEED_XFSCTL_MACRO],
       ])
   ])
 
+AC_DEFUN([AC_PACKAGE_WANT_LINUX_FIEMAP_H],
+  [ AC_CHECK_HEADERS([linux/fiemap.h], [ have_fiemap=true ], [ have_fiemap=false ])
+    AC_SUBST(have_fiemap)
+  ])
+
+AC_DEFUN([AC_PACKAGE_WANT_FALLOCATE],
+  [ AC_MSG_CHECKING([for fallocate])
+    AC_TRY_LINK([
+#define _GNU_SOURCE
+#define _FILE_OFFSET_BITS 64
+#include <fcntl.h>
+#include <linux/falloc.h>
+    ], [
+         fallocate(0, 0, 0, 0);
+    ], have_fallocate=yes
+       AC_MSG_RESULT(yes),
+       AC_MSG_RESULT(no))
+    AC_SUBST(have_fallocate)
+  ])
configure.in +2 -0
index 6c2afe7..a9927c3 100644
@@ -64,6 +64,8 @@ in
 		AC_PACKAGE_WANT_GDBM
 		AC_PACKAGE_WANT_AIO
 		AC_PACKAGE_WANT_DMAPI
+		AC_PACKAGE_WANT_LINUX_FIEMAP_H
+		AC_PACKAGE_WANT_FALLOCATE
 		;;
 esac
 
group +1 -0
index 75224c7..e068e92 100644
@@ -327,3 +327,4 @@ prealloc
 216 log metadata auto quick
 217 log metadata auto
 218 auto fsr quick
+219 auto
include/builddefs.in +2 -0
index 7827ed5..71cee21 100644
@@ -60,6 +60,8 @@ HAVE_DB = @have_db@
 HAVE_AIO = @have_aio@
 HAVE_DMAPI = @have_dmapi@
 HAVE_ATTR_LIST = @have_attr_list@
+HAVE_FIEMAP = @have_fiemap@
+HAVE_FALLOCATE = @have_fallocate@
 
 GCCFLAGS = -funsigned-char -fno-strict-aliasing -Wall
 
src/Makefile +8 -0
index 7b01754..79910be 100644
@@ -21,6 +21,14 @@ ifeq ($(HAVE_XLOG_ASSIGN_LSN), true)
 LINUX_TARGETS += loggen
 endif
 
+ifeq ($(HAVE_FIEMAP), true)
+LINUX_TARGETS += fiemap-tester
+endif
+
+ifeq ($(HAVE_FALLOCATE),yes)
+LCFLAGS += -DHAVE_FALLOCATE
+endif
+
 IRIX_TARGETS = open_unlink
 
 ifeq ($(PKG_PLATFORM),linux)
src/fiemap-tester.c new file +638 -0

638 lines not on this page · raw message

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

#1 lore raw
Quoted 9 lines · Eric Sandeen

Preliminary fiemap testing support based on a test util written by Josef Bacik.

For now it's only run with preallocation disabled, because xfs has a tendency to fill in holes with data blocks (EOF prealloc stuff I think) and similar for explicit preallocation, so this is breaking the preallocation tests for now, when it finds a "data" block where it expects a preallocated block.

Wouldn't we be better off to add an fiemap command to xfs_io so that we can re-use it instead of having a special test program in xfstests?

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

#2 lore raw
Quoted 11 lines · Christoph Hellwig
Quoted 9 lines · Eric Sandeen

Preliminary fiemap testing support based on a test util written by Josef Bacik.

For now it's only run with preallocation disabled, because xfs has a tendency to fill in holes with data blocks (EOF prealloc stuff I think) and similar for explicit preallocation, so this is breaking the preallocation tests for now, when it finds a "data" block where it expects a preallocated block.

Quoted 2 lines

Wouldn't we be better off to add an fiemap command to xfs_io so that we can re-use it instead of having a special test program in xfstests?

I suppose it'd be nice to have, though in this case the test program also generates all the random patterns and does the checking ... the fiemap calls are a relatively simple part of it ...

Using xfs_io would be a bit like saying "xfs_io can already generate all the calls that fsx generates, why not use it instead of a special test program...." IMHO.

-Eric

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

#3 lore raw
Quoted 7 lines · Eric Sandeen

I suppose it'd be nice to have, though in this case the test program also generates all the random patterns and does the checking ... the fiemap calls are a relatively simple part of it ...

Using xfs_io would be a bit like saying "xfs_io can already generate all the calls that fsx generates, why not use it instead of a special test program...." IMHO.

fiemap support in xfs_io would still be useful. The big difference with fsx and co is that the I/O path is quite performance critical even for testcases, while for preallocation it's not.

But if it makes life a lot easier we can certainly drive these tests from a C program.

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

#4 lore raw
Quoted 5 lines · Christoph Hellwig
Quoted 4 lines · Eric Sandeen

I suppose it'd be nice to have, though in this case the test program also generates all the random patterns and does the checking ... the fiemap calls are a relatively simple part of it ...

Quoted 7 lines
Quoted 3 lines

Using xfs_io would be a bit like saying "xfs_io can already generate all the calls that fsx generates, why not use it instead of a special test program...." IMHO.

fiemap support in xfs_io would still be useful. The big difference with fsx and co is that the I/O path is quite performance critical even for testcases, while for preallocation it's not.

Ok, we can add that. Another patch. :)

Quoted 2 lines

But if it makes life a lot easier we can certainly drive these tests from a C program.

It's easier in the sense that it's done. It'd be nice to get some fiemap coverage & this is a quick route that seems to work.

Thanks,
-Eric

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