All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v8 00/13] xfstests: fixes and new tests for rmap/reflink/fsmap
@ 2016-08-25 23:28 ` Darrick J. Wong
  0 siblings, 0 replies; 39+ messages in thread
From: Darrick J. Wong @ 2016-08-25 23:28 UTC (permalink / raw)
  To: david, eguan, darrick.wong; +Cc: linux-xfs, fstests, xfs

Hi all,

This is the eighth revision of a patchset that adds to XFS kernel
support for mapping multiple file logical blocks to the same physical
block (reflink/deduplication), implements the beginnings of online
metadata scrubbing and preening, and implements reverse mapping for
the realtime device.  There shouldn't be any incompatible on-disk
format changes, pending a thorough review of the patches within.

The first several patches in this series fix various minor errors in a
variety of existing tests.  The biggest change fixes xfs_db usage to
work when an external log is specified.

The new tests in this series ensure that xfs_fsr works with files
having a high extent count and reverse mapping enabled.  Next come
more tests for the existing XFS rmap functionality, tests for the
realtime rmap patches against XFS, some quick sanity checks for the
proposed GETFSMAP ioctl, and tests of shared extent reporting via
GETBMAPX.

If you're going to start using this mess, you probably ought to just
pull from my github trees for kernel[1], xfsprogs[2], xfstests[3],
xfs-docs[4], and man-pages[5].  The kernel patches in the git trees
should apply to 4.8-rc3; xfsprogs patches to for-next; and xfstest to
master.

The patches have been xfstested with x64, ppc64, and armhf; all tests
in the clone and rmap groups pass.  AFAICT they don't cause any new
failures for the 'auto' group.

This is an extraordinary way to eat your data.  Enjoy! 
Comments and questions are, as always, welcome.

--D

[1] https://github.com/djwong/linux/tree/djwong-devel
[2] https://github.com/djwong/xfsprogs/tree/djwong-devel
[3] https://github.com/djwong/xfstests/tree/djwong-devel
[4] https://github.com/djwong/xfs-documentation/tree/djwong-devel
[5] https://github.com/djwong/man-pages/tree/djwong-devel
From: "Darrick J. Wong" <darrick.wong@oracle.com>
Subject: [PATCH v8 00/13] xfstests: fixes and new tests for rmap/reflink/etc

Hi all,

This is the eighth revision of a patchset that adds to xfstests
support for testing reverse-mappings of physical blocks to file and
metadata (rmap); support for testing multiple file logical blocks to
the same physical block (reflink); and implements the beginnings of
online metadata scrubbing.

The first eleven tests fix various bugs in existing reflink and rmap
tests, most of which were a result of not using helpers when I should
have.

After that, there are new tests to make sure that we can't clone_range
across mountpoints; test to make sure that swapext works with many
extents on a rmap filesystem; and tests for realtime reverse-mapping.
There are also revised patches for testing xfs_repair's ability to
rebuild filesystem indices correctly, and to run xfs_scrub during each
test.

If you're going to start using this mess, you probably ought to just
pull from my github trees for kernel[1], xfsprogs[2], xfstests[3], and
documentation[4].  The kernel patches should apply to 4.8-rc3;
xfsprogs patches to for-next; and xfstest to master.

The patches have been xfstested with x64, i386, armv7l, and ppc64.
AFAICT these don't cause any new failures for the 'auto' group.

This is an extraordinary way to eat your data.  Enjoy! 
Comments and questions are, as always, welcome.

--D

[1] https://github.com/djwong/linux/tree/djwong-experimental
[2] https://github.com/djwong/xfsprogs/tree/djwong-experimental
[3] https://github.com/djwong/xfstests/tree/djwong-devel
[4] https://github.com/djwong/xfs-documentation/tree/djwong-devel

^ permalink raw reply	[flat|nested] 39+ messages in thread

* [PATCH v8 00/13] xfstests: fixes and new tests for rmap/reflink/fsmap
@ 2016-08-25 23:28 ` Darrick J. Wong
  0 siblings, 0 replies; 39+ messages in thread
From: Darrick J. Wong @ 2016-08-25 23:28 UTC (permalink / raw)
  To: david, eguan, darrick.wong; +Cc: linux-xfs, fstests, xfs

Hi all,

This is the eighth revision of a patchset that adds to XFS kernel
support for mapping multiple file logical blocks to the same physical
block (reflink/deduplication), implements the beginnings of online
metadata scrubbing and preening, and implements reverse mapping for
the realtime device.  There shouldn't be any incompatible on-disk
format changes, pending a thorough review of the patches within.

The first several patches in this series fix various minor errors in a
variety of existing tests.  The biggest change fixes xfs_db usage to
work when an external log is specified.

The new tests in this series ensure that xfs_fsr works with files
having a high extent count and reverse mapping enabled.  Next come
more tests for the existing XFS rmap functionality, tests for the
realtime rmap patches against XFS, some quick sanity checks for the
proposed GETFSMAP ioctl, and tests of shared extent reporting via
GETBMAPX.

If you're going to start using this mess, you probably ought to just
pull from my github trees for kernel[1], xfsprogs[2], xfstests[3],
xfs-docs[4], and man-pages[5].  The kernel patches in the git trees
should apply to 4.8-rc3; xfsprogs patches to for-next; and xfstest to
master.

The patches have been xfstested with x64, ppc64, and armhf; all tests
in the clone and rmap groups pass.  AFAICT they don't cause any new
failures for the 'auto' group.

This is an extraordinary way to eat your data.  Enjoy! 
Comments and questions are, as always, welcome.

--D

[1] https://github.com/djwong/linux/tree/djwong-devel
[2] https://github.com/djwong/xfsprogs/tree/djwong-devel
[3] https://github.com/djwong/xfstests/tree/djwong-devel
[4] https://github.com/djwong/xfs-documentation/tree/djwong-devel
[5] https://github.com/djwong/man-pages/tree/djwong-devel
From: "Darrick J. Wong" <darrick.wong@oracle.com>
Subject: [PATCH v8 00/13] xfstests: fixes and new tests for rmap/reflink/etc

Hi all,

This is the eighth revision of a patchset that adds to xfstests
support for testing reverse-mappings of physical blocks to file and
metadata (rmap); support for testing multiple file logical blocks to
the same physical block (reflink); and implements the beginnings of
online metadata scrubbing.

The first eleven tests fix various bugs in existing reflink and rmap
tests, most of which were a result of not using helpers when I should
have.

After that, there are new tests to make sure that we can't clone_range
across mountpoints; test to make sure that swapext works with many
extents on a rmap filesystem; and tests for realtime reverse-mapping.
There are also revised patches for testing xfs_repair's ability to
rebuild filesystem indices correctly, and to run xfs_scrub during each
test.

If you're going to start using this mess, you probably ought to just
pull from my github trees for kernel[1], xfsprogs[2], xfstests[3], and
documentation[4].  The kernel patches should apply to 4.8-rc3;
xfsprogs patches to for-next; and xfstest to master.

The patches have been xfstested with x64, i386, armv7l, and ppc64.
AFAICT these don't cause any new failures for the 'auto' group.

This is an extraordinary way to eat your data.  Enjoy! 
Comments and questions are, as always, welcome.

--D

[1] https://github.com/djwong/linux/tree/djwong-experimental
[2] https://github.com/djwong/xfsprogs/tree/djwong-experimental
[3] https://github.com/djwong/xfstests/tree/djwong-devel
[4] https://github.com/djwong/xfs-documentation/tree/djwong-devel

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 39+ messages in thread

* [PATCH 01/13] tests/xfs: don't run tests if cowextsize isn't present
  2016-08-25 23:28 ` Darrick J. Wong
@ 2016-08-25 23:28   ` Darrick J. Wong
  -1 siblings, 0 replies; 39+ messages in thread
From: Darrick J. Wong @ 2016-08-25 23:28 UTC (permalink / raw)
  To: david, eguan, darrick.wong; +Cc: linux-xfs, fstests, xfs

Some of the tests forgot to check that xfs_io has a cowextsize command,
so fix that here.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 tests/xfs/215 |    1 +
 tests/xfs/218 |    1 +
 tests/xfs/219 |    1 +
 tests/xfs/221 |    1 +
 tests/xfs/223 |    1 +
 tests/xfs/224 |    1 +
 tests/xfs/225 |    1 +
 tests/xfs/226 |    1 +
 tests/xfs/228 |    1 +
 tests/xfs/230 |    1 +
 tests/xfs/231 |    1 +
 tests/xfs/232 |    1 +
 tests/xfs/243 |    1 +
 tests/xfs/248 |    1 +
 tests/xfs/249 |    1 +
 tests/xfs/251 |    1 +
 tests/xfs/254 |    1 +
 tests/xfs/255 |    1 +
 tests/xfs/256 |    1 +
 tests/xfs/257 |    1 +
 tests/xfs/258 |    1 +
 tests/xfs/315 |    1 +
 tests/xfs/326 |    1 +
 23 files changed, 23 insertions(+)


diff --git a/tests/xfs/215 b/tests/xfs/215
index 7a517d7..b9c9ab4 100755
--- a/tests/xfs/215
+++ b/tests/xfs/215
@@ -50,6 +50,7 @@ _cleanup()
 _supported_os Linux
 _require_scratch_reflink
 _require_xfs_io_command "falloc"
+_require_xfs_io_command "cowextsize"
 _require_odirect
 
 rm -f $seqres.full
diff --git a/tests/xfs/218 b/tests/xfs/218
index 0ab4102..887a135 100755
--- a/tests/xfs/218
+++ b/tests/xfs/218
@@ -50,6 +50,7 @@ _cleanup()
 _supported_os Linux
 _require_scratch_reflink
 _require_xfs_io_command "falloc"
+_require_xfs_io_command "cowextsize"
 
 rm -f $seqres.full
 
diff --git a/tests/xfs/219 b/tests/xfs/219
index df57e07..5ae0714 100755
--- a/tests/xfs/219
+++ b/tests/xfs/219
@@ -50,6 +50,7 @@ _cleanup()
 _supported_os Linux
 _require_scratch_reflink
 _require_xfs_io_command "falloc"
+_require_xfs_io_command "cowextsize"
 _require_odirect
 
 rm -f $seqres.full
diff --git a/tests/xfs/221 b/tests/xfs/221
index 03d81ac..3afc75f 100755
--- a/tests/xfs/221
+++ b/tests/xfs/221
@@ -50,6 +50,7 @@ _cleanup()
 _supported_os Linux
 _require_scratch_reflink
 _require_xfs_io_command "falloc"
+_require_xfs_io_command "cowextsize"
 
 rm -f $seqres.full
 
diff --git a/tests/xfs/223 b/tests/xfs/223
index 7c990a2..3f34bcf 100755
--- a/tests/xfs/223
+++ b/tests/xfs/223
@@ -51,6 +51,7 @@ _cleanup()
 _supported_os Linux
 _require_scratch_reflink
 _require_xfs_io_command "falloc"
+_require_xfs_io_command "cowextsize"
 _require_odirect
 
 rm -f $seqres.full
diff --git a/tests/xfs/224 b/tests/xfs/224
index bf33d1f..91033fa 100755
--- a/tests/xfs/224
+++ b/tests/xfs/224
@@ -51,6 +51,7 @@ _cleanup()
 _supported_os Linux
 _require_scratch_reflink
 _require_xfs_io_command "falloc"
+_require_xfs_io_command "cowextsize"
 
 rm -f $seqres.full
 
diff --git a/tests/xfs/225 b/tests/xfs/225
index 749816f..2260441 100755
--- a/tests/xfs/225
+++ b/tests/xfs/225
@@ -50,6 +50,7 @@ _cleanup()
 _supported_os Linux
 _require_scratch_reflink
 _require_xfs_io_command "falloc"
+_require_xfs_io_command "cowextsize"
 _require_odirect
 
 rm -f $seqres.full
diff --git a/tests/xfs/226 b/tests/xfs/226
index bb94d24..ac70239 100755
--- a/tests/xfs/226
+++ b/tests/xfs/226
@@ -50,6 +50,7 @@ _cleanup()
 _supported_os Linux
 _require_scratch_reflink
 _require_xfs_io_command "falloc"
+_require_xfs_io_command "cowextsize"
 
 rm -f $seqres.full
 
diff --git a/tests/xfs/228 b/tests/xfs/228
index df1fd7a..65d7f51 100755
--- a/tests/xfs/228
+++ b/tests/xfs/228
@@ -54,6 +54,7 @@ _cleanup()
 _supported_os Linux
 _require_scratch_reflink
 _require_xfs_io_command "falloc"
+_require_xfs_io_command "cowextsize"
 _require_xfs_io_command "fpunch"
 _require_cp_reflink
 _require_odirect
diff --git a/tests/xfs/230 b/tests/xfs/230
index 73f599a..73c6267 100755
--- a/tests/xfs/230
+++ b/tests/xfs/230
@@ -54,6 +54,7 @@ _cleanup()
 _supported_os Linux
 _require_scratch_reflink
 _require_xfs_io_command "falloc"
+_require_xfs_io_command "cowextsize"
 _require_xfs_io_command "fpunch"
 _require_cp_reflink
 _require_odirect
diff --git a/tests/xfs/231 b/tests/xfs/231
index 166f6b0..d89139a 100755
--- a/tests/xfs/231
+++ b/tests/xfs/231
@@ -51,6 +51,7 @@ _supported_os Linux
 _supported_fs xfs
 _require_scratch_reflink
 _require_cp_reflink
+_require_xfs_io_command "cowextsize"
 _require_fiemap
 
 old_cow_lifetime=$(cat /proc/sys/fs/xfs/speculative_cow_prealloc_lifetime)
diff --git a/tests/xfs/232 b/tests/xfs/232
index 0008dbf..2438f1f 100755
--- a/tests/xfs/232
+++ b/tests/xfs/232
@@ -50,6 +50,7 @@ _cleanup()
 # real QA test starts here
 _supported_os Linux
 _supported_fs xfs
+_require_xfs_io_command "cowextsize"
 _require_scratch_reflink
 _require_cp_reflink
 _require_fiemap
diff --git a/tests/xfs/243 b/tests/xfs/243
index f6a8692..0bb69c4 100755
--- a/tests/xfs/243
+++ b/tests/xfs/243
@@ -55,6 +55,7 @@ _supported_os Linux
 _supported_fs xfs
 _require_scratch_reflink
 _require_xfs_io_command "falloc"
+_require_xfs_io_command "cowextsize"
 _require_xfs_io_command "fpunch"
 _require_xfs_io_command "bmap" "-c"
 _require_cp_reflink
diff --git a/tests/xfs/248 b/tests/xfs/248
index 7e25258..471205c 100755
--- a/tests/xfs/248
+++ b/tests/xfs/248
@@ -51,6 +51,7 @@ _cleanup()
 _supported_os Linux
 _require_scratch_reflink
 _require_xfs_io_command "falloc"
+_require_xfs_io_command "cowextsize"
 
 rm -f $seqres.full
 
diff --git a/tests/xfs/249 b/tests/xfs/249
index b82d89c..0a7fbf1 100755
--- a/tests/xfs/249
+++ b/tests/xfs/249
@@ -51,6 +51,7 @@ _cleanup()
 _supported_os Linux
 _require_scratch_reflink
 _require_xfs_io_command "falloc"
+_require_xfs_io_command "cowextsize"
 _require_odirect
 
 rm -f $seqres.full
diff --git a/tests/xfs/251 b/tests/xfs/251
index 4f74772..48a027c 100755
--- a/tests/xfs/251
+++ b/tests/xfs/251
@@ -53,6 +53,7 @@ _cleanup()
 _supported_os Linux
 _require_scratch_reflink
 _require_xfs_io_command "falloc"
+_require_xfs_io_command "cowextsize"
 
 rm -f $seqres.full
 
diff --git a/tests/xfs/254 b/tests/xfs/254
index c8ac412..ac87e49 100755
--- a/tests/xfs/254
+++ b/tests/xfs/254
@@ -53,6 +53,7 @@ _cleanup()
 _supported_os Linux
 _require_scratch_reflink
 _require_xfs_io_command "falloc"
+_require_xfs_io_command "cowextsize"
 _require_odirect
 
 rm -f $seqres.full
diff --git a/tests/xfs/255 b/tests/xfs/255
index 93ad13e..97cbb77 100755
--- a/tests/xfs/255
+++ b/tests/xfs/255
@@ -53,6 +53,7 @@ _cleanup()
 _supported_os Linux
 _require_scratch_reflink
 _require_xfs_io_command "falloc"
+_require_xfs_io_command "cowextsize"
 
 rm -f $seqres.full
 
diff --git a/tests/xfs/256 b/tests/xfs/256
index d5cf71b..a182953 100755
--- a/tests/xfs/256
+++ b/tests/xfs/256
@@ -53,6 +53,7 @@ _cleanup()
 _supported_os Linux
 _require_scratch_reflink
 _require_xfs_io_command "falloc"
+_require_xfs_io_command "cowextsize"
 _require_odirect
 
 rm -f $seqres.full
diff --git a/tests/xfs/257 b/tests/xfs/257
index 624f5e3..1fc401b 100755
--- a/tests/xfs/257
+++ b/tests/xfs/257
@@ -54,6 +54,7 @@ _cleanup()
 _supported_os Linux
 _require_scratch_reflink
 _require_xfs_io_command "falloc"
+_require_xfs_io_command "cowextsize"
 
 rm -f $seqres.full
 
diff --git a/tests/xfs/258 b/tests/xfs/258
index 243e853..a3ffc89 100755
--- a/tests/xfs/258
+++ b/tests/xfs/258
@@ -54,6 +54,7 @@ _cleanup()
 _supported_os Linux
 _require_scratch_reflink
 _require_xfs_io_command "falloc"
+_require_xfs_io_command "cowextsize"
 _require_odirect
 
 rm -f $seqres.full
diff --git a/tests/xfs/315 b/tests/xfs/315
index 62d7fcf..6170540 100755
--- a/tests/xfs/315
+++ b/tests/xfs/315
@@ -49,6 +49,7 @@ _supported_fs xfs
 _require_cp_reflink
 _require_scratch_reflink
 _require_error_injection
+_require_xfs_io_command "cowextsize"
 _require_xfs_io_error_injection "free_extent"
 
 rm -f $seqres.full
diff --git a/tests/xfs/326 b/tests/xfs/326
index 2cd6eda..36bdcf4 100755
--- a/tests/xfs/326
+++ b/tests/xfs/326
@@ -50,6 +50,7 @@ _supported_os Linux
 _supported_fs xfs
 _require_cp_reflink
 _require_scratch_reflink
+_require_xfs_io_command "cowextsize"
 _require_xfs_io_error_injection "refcount_finish_one"
 
 rm -f $seqres.full


^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [PATCH 01/13] tests/xfs: don't run tests if cowextsize isn't present
@ 2016-08-25 23:28   ` Darrick J. Wong
  0 siblings, 0 replies; 39+ messages in thread
From: Darrick J. Wong @ 2016-08-25 23:28 UTC (permalink / raw)
  To: david, eguan, darrick.wong; +Cc: linux-xfs, fstests, xfs

Some of the tests forgot to check that xfs_io has a cowextsize command,
so fix that here.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 tests/xfs/215 |    1 +
 tests/xfs/218 |    1 +
 tests/xfs/219 |    1 +
 tests/xfs/221 |    1 +
 tests/xfs/223 |    1 +
 tests/xfs/224 |    1 +
 tests/xfs/225 |    1 +
 tests/xfs/226 |    1 +
 tests/xfs/228 |    1 +
 tests/xfs/230 |    1 +
 tests/xfs/231 |    1 +
 tests/xfs/232 |    1 +
 tests/xfs/243 |    1 +
 tests/xfs/248 |    1 +
 tests/xfs/249 |    1 +
 tests/xfs/251 |    1 +
 tests/xfs/254 |    1 +
 tests/xfs/255 |    1 +
 tests/xfs/256 |    1 +
 tests/xfs/257 |    1 +
 tests/xfs/258 |    1 +
 tests/xfs/315 |    1 +
 tests/xfs/326 |    1 +
 23 files changed, 23 insertions(+)


diff --git a/tests/xfs/215 b/tests/xfs/215
index 7a517d7..b9c9ab4 100755
--- a/tests/xfs/215
+++ b/tests/xfs/215
@@ -50,6 +50,7 @@ _cleanup()
 _supported_os Linux
 _require_scratch_reflink
 _require_xfs_io_command "falloc"
+_require_xfs_io_command "cowextsize"
 _require_odirect
 
 rm -f $seqres.full
diff --git a/tests/xfs/218 b/tests/xfs/218
index 0ab4102..887a135 100755
--- a/tests/xfs/218
+++ b/tests/xfs/218
@@ -50,6 +50,7 @@ _cleanup()
 _supported_os Linux
 _require_scratch_reflink
 _require_xfs_io_command "falloc"
+_require_xfs_io_command "cowextsize"
 
 rm -f $seqres.full
 
diff --git a/tests/xfs/219 b/tests/xfs/219
index df57e07..5ae0714 100755
--- a/tests/xfs/219
+++ b/tests/xfs/219
@@ -50,6 +50,7 @@ _cleanup()
 _supported_os Linux
 _require_scratch_reflink
 _require_xfs_io_command "falloc"
+_require_xfs_io_command "cowextsize"
 _require_odirect
 
 rm -f $seqres.full
diff --git a/tests/xfs/221 b/tests/xfs/221
index 03d81ac..3afc75f 100755
--- a/tests/xfs/221
+++ b/tests/xfs/221
@@ -50,6 +50,7 @@ _cleanup()
 _supported_os Linux
 _require_scratch_reflink
 _require_xfs_io_command "falloc"
+_require_xfs_io_command "cowextsize"
 
 rm -f $seqres.full
 
diff --git a/tests/xfs/223 b/tests/xfs/223
index 7c990a2..3f34bcf 100755
--- a/tests/xfs/223
+++ b/tests/xfs/223
@@ -51,6 +51,7 @@ _cleanup()
 _supported_os Linux
 _require_scratch_reflink
 _require_xfs_io_command "falloc"
+_require_xfs_io_command "cowextsize"
 _require_odirect
 
 rm -f $seqres.full
diff --git a/tests/xfs/224 b/tests/xfs/224
index bf33d1f..91033fa 100755
--- a/tests/xfs/224
+++ b/tests/xfs/224
@@ -51,6 +51,7 @@ _cleanup()
 _supported_os Linux
 _require_scratch_reflink
 _require_xfs_io_command "falloc"
+_require_xfs_io_command "cowextsize"
 
 rm -f $seqres.full
 
diff --git a/tests/xfs/225 b/tests/xfs/225
index 749816f..2260441 100755
--- a/tests/xfs/225
+++ b/tests/xfs/225
@@ -50,6 +50,7 @@ _cleanup()
 _supported_os Linux
 _require_scratch_reflink
 _require_xfs_io_command "falloc"
+_require_xfs_io_command "cowextsize"
 _require_odirect
 
 rm -f $seqres.full
diff --git a/tests/xfs/226 b/tests/xfs/226
index bb94d24..ac70239 100755
--- a/tests/xfs/226
+++ b/tests/xfs/226
@@ -50,6 +50,7 @@ _cleanup()
 _supported_os Linux
 _require_scratch_reflink
 _require_xfs_io_command "falloc"
+_require_xfs_io_command "cowextsize"
 
 rm -f $seqres.full
 
diff --git a/tests/xfs/228 b/tests/xfs/228
index df1fd7a..65d7f51 100755
--- a/tests/xfs/228
+++ b/tests/xfs/228
@@ -54,6 +54,7 @@ _cleanup()
 _supported_os Linux
 _require_scratch_reflink
 _require_xfs_io_command "falloc"
+_require_xfs_io_command "cowextsize"
 _require_xfs_io_command "fpunch"
 _require_cp_reflink
 _require_odirect
diff --git a/tests/xfs/230 b/tests/xfs/230
index 73f599a..73c6267 100755
--- a/tests/xfs/230
+++ b/tests/xfs/230
@@ -54,6 +54,7 @@ _cleanup()
 _supported_os Linux
 _require_scratch_reflink
 _require_xfs_io_command "falloc"
+_require_xfs_io_command "cowextsize"
 _require_xfs_io_command "fpunch"
 _require_cp_reflink
 _require_odirect
diff --git a/tests/xfs/231 b/tests/xfs/231
index 166f6b0..d89139a 100755
--- a/tests/xfs/231
+++ b/tests/xfs/231
@@ -51,6 +51,7 @@ _supported_os Linux
 _supported_fs xfs
 _require_scratch_reflink
 _require_cp_reflink
+_require_xfs_io_command "cowextsize"
 _require_fiemap
 
 old_cow_lifetime=$(cat /proc/sys/fs/xfs/speculative_cow_prealloc_lifetime)
diff --git a/tests/xfs/232 b/tests/xfs/232
index 0008dbf..2438f1f 100755
--- a/tests/xfs/232
+++ b/tests/xfs/232
@@ -50,6 +50,7 @@ _cleanup()
 # real QA test starts here
 _supported_os Linux
 _supported_fs xfs
+_require_xfs_io_command "cowextsize"
 _require_scratch_reflink
 _require_cp_reflink
 _require_fiemap
diff --git a/tests/xfs/243 b/tests/xfs/243
index f6a8692..0bb69c4 100755
--- a/tests/xfs/243
+++ b/tests/xfs/243
@@ -55,6 +55,7 @@ _supported_os Linux
 _supported_fs xfs
 _require_scratch_reflink
 _require_xfs_io_command "falloc"
+_require_xfs_io_command "cowextsize"
 _require_xfs_io_command "fpunch"
 _require_xfs_io_command "bmap" "-c"
 _require_cp_reflink
diff --git a/tests/xfs/248 b/tests/xfs/248
index 7e25258..471205c 100755
--- a/tests/xfs/248
+++ b/tests/xfs/248
@@ -51,6 +51,7 @@ _cleanup()
 _supported_os Linux
 _require_scratch_reflink
 _require_xfs_io_command "falloc"
+_require_xfs_io_command "cowextsize"
 
 rm -f $seqres.full
 
diff --git a/tests/xfs/249 b/tests/xfs/249
index b82d89c..0a7fbf1 100755
--- a/tests/xfs/249
+++ b/tests/xfs/249
@@ -51,6 +51,7 @@ _cleanup()
 _supported_os Linux
 _require_scratch_reflink
 _require_xfs_io_command "falloc"
+_require_xfs_io_command "cowextsize"
 _require_odirect
 
 rm -f $seqres.full
diff --git a/tests/xfs/251 b/tests/xfs/251
index 4f74772..48a027c 100755
--- a/tests/xfs/251
+++ b/tests/xfs/251
@@ -53,6 +53,7 @@ _cleanup()
 _supported_os Linux
 _require_scratch_reflink
 _require_xfs_io_command "falloc"
+_require_xfs_io_command "cowextsize"
 
 rm -f $seqres.full
 
diff --git a/tests/xfs/254 b/tests/xfs/254
index c8ac412..ac87e49 100755
--- a/tests/xfs/254
+++ b/tests/xfs/254
@@ -53,6 +53,7 @@ _cleanup()
 _supported_os Linux
 _require_scratch_reflink
 _require_xfs_io_command "falloc"
+_require_xfs_io_command "cowextsize"
 _require_odirect
 
 rm -f $seqres.full
diff --git a/tests/xfs/255 b/tests/xfs/255
index 93ad13e..97cbb77 100755
--- a/tests/xfs/255
+++ b/tests/xfs/255
@@ -53,6 +53,7 @@ _cleanup()
 _supported_os Linux
 _require_scratch_reflink
 _require_xfs_io_command "falloc"
+_require_xfs_io_command "cowextsize"
 
 rm -f $seqres.full
 
diff --git a/tests/xfs/256 b/tests/xfs/256
index d5cf71b..a182953 100755
--- a/tests/xfs/256
+++ b/tests/xfs/256
@@ -53,6 +53,7 @@ _cleanup()
 _supported_os Linux
 _require_scratch_reflink
 _require_xfs_io_command "falloc"
+_require_xfs_io_command "cowextsize"
 _require_odirect
 
 rm -f $seqres.full
diff --git a/tests/xfs/257 b/tests/xfs/257
index 624f5e3..1fc401b 100755
--- a/tests/xfs/257
+++ b/tests/xfs/257
@@ -54,6 +54,7 @@ _cleanup()
 _supported_os Linux
 _require_scratch_reflink
 _require_xfs_io_command "falloc"
+_require_xfs_io_command "cowextsize"
 
 rm -f $seqres.full
 
diff --git a/tests/xfs/258 b/tests/xfs/258
index 243e853..a3ffc89 100755
--- a/tests/xfs/258
+++ b/tests/xfs/258
@@ -54,6 +54,7 @@ _cleanup()
 _supported_os Linux
 _require_scratch_reflink
 _require_xfs_io_command "falloc"
+_require_xfs_io_command "cowextsize"
 _require_odirect
 
 rm -f $seqres.full
diff --git a/tests/xfs/315 b/tests/xfs/315
index 62d7fcf..6170540 100755
--- a/tests/xfs/315
+++ b/tests/xfs/315
@@ -49,6 +49,7 @@ _supported_fs xfs
 _require_cp_reflink
 _require_scratch_reflink
 _require_error_injection
+_require_xfs_io_command "cowextsize"
 _require_xfs_io_error_injection "free_extent"
 
 rm -f $seqres.full
diff --git a/tests/xfs/326 b/tests/xfs/326
index 2cd6eda..36bdcf4 100755
--- a/tests/xfs/326
+++ b/tests/xfs/326
@@ -50,6 +50,7 @@ _supported_os Linux
 _supported_fs xfs
 _require_cp_reflink
 _require_scratch_reflink
+_require_xfs_io_command "cowextsize"
 _require_xfs_io_error_injection "refcount_finish_one"
 
 rm -f $seqres.full

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [PATCH 02/13] xfs/122: decrease the log update done item sizes
  2016-08-25 23:28 ` Darrick J. Wong
@ 2016-08-25 23:28   ` Darrick J. Wong
  -1 siblings, 0 replies; 39+ messages in thread
From: Darrick J. Wong @ 2016-08-25 23:28 UTC (permalink / raw)
  To: david, eguan, darrick.wong; +Cc: linux-xfs, fstests, xfs

Redundant fields were removed from the rmap/refcount/bmap update done
log items, so fix the size tests.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 tests/xfs/122.out |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)


diff --git a/tests/xfs/122.out b/tests/xfs/122.out
index b20011e..06d1432 100644
--- a/tests/xfs/122.out
+++ b/tests/xfs/122.out
@@ -61,10 +61,10 @@ sizeof(struct xfs_attr3_leaf_hdr) = 80
 sizeof(struct xfs_attr3_leafblock) = 88
 sizeof(struct xfs_attr3_rmt_hdr) = 56
 sizeof(struct xfs_btree_block) = 72
-sizeof(struct xfs_bud_log_format) = 48
+sizeof(struct xfs_bud_log_format) = 16
 sizeof(struct xfs_bui_log_format) = 48
 sizeof(struct xfs_clone_args) = 32
-sizeof(struct xfs_cud_log_format) = 32
+sizeof(struct xfs_cud_log_format) = 16
 sizeof(struct xfs_cui_log_format) = 32
 sizeof(struct xfs_da3_blkinfo) = 56
 sizeof(struct xfs_da3_intnode) = 64
@@ -90,7 +90,7 @@ sizeof(struct xfs_rmap_rec) = 24
 sizeof(struct xfs_rtrmap_key) = 24
 sizeof(struct xfs_rtrmap_rec) = 32
 sizeof(struct xfs_rtrmap_root) = 4
-sizeof(struct xfs_rud_log_format) = 48
+sizeof(struct xfs_rud_log_format) = 16
 sizeof(struct xfs_rui_log_format) = 48
 sizeof(xfs_agf_t) = 224
 sizeof(xfs_agfl_t) = 36


^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [PATCH 02/13] xfs/122: decrease the log update done item sizes
@ 2016-08-25 23:28   ` Darrick J. Wong
  0 siblings, 0 replies; 39+ messages in thread
From: Darrick J. Wong @ 2016-08-25 23:28 UTC (permalink / raw)
  To: david, eguan, darrick.wong; +Cc: linux-xfs, fstests, xfs

Redundant fields were removed from the rmap/refcount/bmap update done
log items, so fix the size tests.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 tests/xfs/122.out |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)


diff --git a/tests/xfs/122.out b/tests/xfs/122.out
index b20011e..06d1432 100644
--- a/tests/xfs/122.out
+++ b/tests/xfs/122.out
@@ -61,10 +61,10 @@ sizeof(struct xfs_attr3_leaf_hdr) = 80
 sizeof(struct xfs_attr3_leafblock) = 88
 sizeof(struct xfs_attr3_rmt_hdr) = 56
 sizeof(struct xfs_btree_block) = 72
-sizeof(struct xfs_bud_log_format) = 48
+sizeof(struct xfs_bud_log_format) = 16
 sizeof(struct xfs_bui_log_format) = 48
 sizeof(struct xfs_clone_args) = 32
-sizeof(struct xfs_cud_log_format) = 32
+sizeof(struct xfs_cud_log_format) = 16
 sizeof(struct xfs_cui_log_format) = 32
 sizeof(struct xfs_da3_blkinfo) = 56
 sizeof(struct xfs_da3_intnode) = 64
@@ -90,7 +90,7 @@ sizeof(struct xfs_rmap_rec) = 24
 sizeof(struct xfs_rtrmap_key) = 24
 sizeof(struct xfs_rtrmap_rec) = 32
 sizeof(struct xfs_rtrmap_root) = 4
-sizeof(struct xfs_rud_log_format) = 48
+sizeof(struct xfs_rud_log_format) = 16
 sizeof(struct xfs_rui_log_format) = 48
 sizeof(xfs_agf_t) = 224
 sizeof(xfs_agfl_t) = 36

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [PATCH 03/13] xfs/{130,235}: deal with an unreplayable dirty log
  2016-08-25 23:28 ` Darrick J. Wong
@ 2016-08-25 23:28   ` Darrick J. Wong
  -1 siblings, 0 replies; 39+ messages in thread
From: Darrick J. Wong @ 2016-08-25 23:28 UTC (permalink / raw)
  To: david, eguan, darrick.wong; +Cc: linux-xfs, fstests, xfs

Now that we have log replay items, an FS shutdown due to a corrupt
btree results in a log that can't be replayed.  The only solution here
is to zap the log when we're fixing the corrupt fs, so do that here.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 tests/xfs/130 |    3 ++-
 tests/xfs/235 |    3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)


diff --git a/tests/xfs/130 b/tests/xfs/130
index 7d8ea2a..554d078 100755
--- a/tests/xfs/130
+++ b/tests/xfs/130
@@ -87,7 +87,8 @@ _cp_reflink "${SCRATCH_MNT}/file1" "${SCRATCH_MNT}/file4" 2> /dev/null && \
 umount "${SCRATCH_MNT}"
 
 echo "+ repair fs"
-_scratch_xfs_repair >> "$seqres.full" 2>&1
+_disable_dmesg_check
+_repair_scratch_fs >> "$seqres.full" 2>&1
 _scratch_xfs_repair >> "$seqres.full" 2>&1
 
 echo "+ mount image (2)"
diff --git a/tests/xfs/235 b/tests/xfs/235
index c2e0340..ef51d22 100755
--- a/tests/xfs/235
+++ b/tests/xfs/235
@@ -85,7 +85,8 @@ test -s ${SCRATCH_MNT}/file4 && _fail "should not be able to copy with busted rm
 umount ${SCRATCH_MNT}
 
 echo "+ repair fs"
-_scratch_xfs_repair >> $seqres.full 2>&1
+_disable_dmesg_check
+_repair_scratch_fs >> "$seqres.full" 2>&1
 _scratch_xfs_repair >> $seqres.full 2>&1
 
 echo "+ mount image (2)"


^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [PATCH 03/13] xfs/{130,235}: deal with an unreplayable dirty log
@ 2016-08-25 23:28   ` Darrick J. Wong
  0 siblings, 0 replies; 39+ messages in thread
From: Darrick J. Wong @ 2016-08-25 23:28 UTC (permalink / raw)
  To: david, eguan, darrick.wong; +Cc: linux-xfs, fstests, xfs

Now that we have log replay items, an FS shutdown due to a corrupt
btree results in a log that can't be replayed.  The only solution here
is to zap the log when we're fixing the corrupt fs, so do that here.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 tests/xfs/130 |    3 ++-
 tests/xfs/235 |    3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)


diff --git a/tests/xfs/130 b/tests/xfs/130
index 7d8ea2a..554d078 100755
--- a/tests/xfs/130
+++ b/tests/xfs/130
@@ -87,7 +87,8 @@ _cp_reflink "${SCRATCH_MNT}/file1" "${SCRATCH_MNT}/file4" 2> /dev/null && \
 umount "${SCRATCH_MNT}"
 
 echo "+ repair fs"
-_scratch_xfs_repair >> "$seqres.full" 2>&1
+_disable_dmesg_check
+_repair_scratch_fs >> "$seqres.full" 2>&1
 _scratch_xfs_repair >> "$seqres.full" 2>&1
 
 echo "+ mount image (2)"
diff --git a/tests/xfs/235 b/tests/xfs/235
index c2e0340..ef51d22 100755
--- a/tests/xfs/235
+++ b/tests/xfs/235
@@ -85,7 +85,8 @@ test -s ${SCRATCH_MNT}/file4 && _fail "should not be able to copy with busted rm
 umount ${SCRATCH_MNT}
 
 echo "+ repair fs"
-_scratch_xfs_repair >> $seqres.full 2>&1
+_disable_dmesg_check
+_repair_scratch_fs >> "$seqres.full" 2>&1
 _scratch_xfs_repair >> $seqres.full 2>&1
 
 echo "+ mount image (2)"

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [PATCH 04/13] generic/159, 160: deal with EACCESS -> EPERM transition
  2016-08-25 23:28 ` Darrick J. Wong
@ 2016-08-25 23:28   ` Darrick J. Wong
  -1 siblings, 0 replies; 39+ messages in thread
From: Darrick J. Wong @ 2016-08-25 23:28 UTC (permalink / raw)
  To: david, eguan, darrick.wong; +Cc: linux-xfs, fstests, xfs

As of 4.8 we can receive EPERM (instead of EACCESS) for attempts to
reflink/dedupe to an immutable file.  Fix this up so that we accept
either answer.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 tests/generic/159 |    6 +++++-
 tests/generic/160 |    6 +++++-
 2 files changed, 10 insertions(+), 2 deletions(-)


diff --git a/tests/generic/159 b/tests/generic/159
index 8898d58..726333a 100755
--- a/tests/generic/159
+++ b/tests/generic/159
@@ -65,9 +65,13 @@ _pwrite_byte 0x61 0 $sz $testdir1/file1 >> $seqres.full
 _pwrite_byte 0x61 0 $sz $testdir1/file2 >> $seqres.full
 sync
 
+do_filter_output() {
+	_filter_test_dir | sed -e 's/Operation not permitted/Permission denied/g'
+}
+
 echo "Try reflink on immutable files"
 $CHATTR_PROG +i $testdir1/file1 $testdir1/file2
-_reflink_range $testdir1/file1 0 $testdir1/file2 0 $blksz 2>&1 | _filter_test_dir
+_reflink_range $testdir1/file1 0 $testdir1/file2 0 $blksz 2>&1 | do_filter_output
 $CHATTR_PROG -i $testdir1/file1 $testdir1/file2
 
 # success, all done
diff --git a/tests/generic/160 b/tests/generic/160
index 3a91dc8..4946bfc 100755
--- a/tests/generic/160
+++ b/tests/generic/160
@@ -65,9 +65,13 @@ _pwrite_byte 0x61 0 $sz $testdir1/file1 >> $seqres.full
 _pwrite_byte 0x61 0 $sz $testdir1/file2 >> $seqres.full
 sync
 
+do_filter_output() {
+	_filter_test_dir | sed -e 's/Operation not permitted/Permission denied/g'
+}
+
 echo "Try dedupe on immutable files"
 $CHATTR_PROG +i $testdir1/file1 $testdir1/file2
-_dedupe_range $testdir1/file1 0 $testdir1/file2 0 $blksz 2>&1 | _filter_test_dir
+_dedupe_range $testdir1/file1 0 $testdir1/file2 0 $blksz 2>&1 | do_filter_output
 $CHATTR_PROG -i $testdir1/file1 $testdir1/file2
 
 # success, all done


^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [PATCH 04/13] generic/159, 160: deal with EACCESS -> EPERM transition
@ 2016-08-25 23:28   ` Darrick J. Wong
  0 siblings, 0 replies; 39+ messages in thread
From: Darrick J. Wong @ 2016-08-25 23:28 UTC (permalink / raw)
  To: david, eguan, darrick.wong; +Cc: linux-xfs, fstests, xfs

As of 4.8 we can receive EPERM (instead of EACCESS) for attempts to
reflink/dedupe to an immutable file.  Fix this up so that we accept
either answer.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 tests/generic/159 |    6 +++++-
 tests/generic/160 |    6 +++++-
 2 files changed, 10 insertions(+), 2 deletions(-)


diff --git a/tests/generic/159 b/tests/generic/159
index 8898d58..726333a 100755
--- a/tests/generic/159
+++ b/tests/generic/159
@@ -65,9 +65,13 @@ _pwrite_byte 0x61 0 $sz $testdir1/file1 >> $seqres.full
 _pwrite_byte 0x61 0 $sz $testdir1/file2 >> $seqres.full
 sync
 
+do_filter_output() {
+	_filter_test_dir | sed -e 's/Operation not permitted/Permission denied/g'
+}
+
 echo "Try reflink on immutable files"
 $CHATTR_PROG +i $testdir1/file1 $testdir1/file2
-_reflink_range $testdir1/file1 0 $testdir1/file2 0 $blksz 2>&1 | _filter_test_dir
+_reflink_range $testdir1/file1 0 $testdir1/file2 0 $blksz 2>&1 | do_filter_output
 $CHATTR_PROG -i $testdir1/file1 $testdir1/file2
 
 # success, all done
diff --git a/tests/generic/160 b/tests/generic/160
index 3a91dc8..4946bfc 100755
--- a/tests/generic/160
+++ b/tests/generic/160
@@ -65,9 +65,13 @@ _pwrite_byte 0x61 0 $sz $testdir1/file1 >> $seqres.full
 _pwrite_byte 0x61 0 $sz $testdir1/file2 >> $seqres.full
 sync
 
+do_filter_output() {
+	_filter_test_dir | sed -e 's/Operation not permitted/Permission denied/g'
+}
+
 echo "Try dedupe on immutable files"
 $CHATTR_PROG +i $testdir1/file1 $testdir1/file2
-_dedupe_range $testdir1/file1 0 $testdir1/file2 0 $blksz 2>&1 | _filter_test_dir
+_dedupe_range $testdir1/file1 0 $testdir1/file2 0 $blksz 2>&1 | do_filter_output
 $CHATTR_PROG -i $testdir1/file1 $testdir1/file2
 
 # success, all done

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [PATCH 05/13] xfs/122: test btree header block sizes
  2016-08-25 23:28 ` Darrick J. Wong
@ 2016-08-25 23:28   ` Darrick J. Wong
  -1 siblings, 0 replies; 39+ messages in thread
From: Darrick J. Wong @ 2016-08-25 23:28 UTC (permalink / raw)
  To: david, eguan, darrick.wong; +Cc: linux-xfs, fstests, xfs

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 tests/xfs/122.out |    2 ++
 1 file changed, 2 insertions(+)


diff --git a/tests/xfs/122.out b/tests/xfs/122.out
index 06d1432..bbffd0f 100644
--- a/tests/xfs/122.out
+++ b/tests/xfs/122.out
@@ -61,6 +61,8 @@ sizeof(struct xfs_attr3_leaf_hdr) = 80
 sizeof(struct xfs_attr3_leafblock) = 88
 sizeof(struct xfs_attr3_rmt_hdr) = 56
 sizeof(struct xfs_btree_block) = 72
+sizeof(struct xfs_btree_block_lhdr) = 64
+sizeof(struct xfs_btree_block_shdr) = 48
 sizeof(struct xfs_bud_log_format) = 16
 sizeof(struct xfs_bui_log_format) = 48
 sizeof(struct xfs_clone_args) = 32


^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [PATCH 05/13] xfs/122: test btree header block sizes
@ 2016-08-25 23:28   ` Darrick J. Wong
  0 siblings, 0 replies; 39+ messages in thread
From: Darrick J. Wong @ 2016-08-25 23:28 UTC (permalink / raw)
  To: david, eguan, darrick.wong; +Cc: linux-xfs, fstests, xfs

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 tests/xfs/122.out |    2 ++
 1 file changed, 2 insertions(+)


diff --git a/tests/xfs/122.out b/tests/xfs/122.out
index 06d1432..bbffd0f 100644
--- a/tests/xfs/122.out
+++ b/tests/xfs/122.out
@@ -61,6 +61,8 @@ sizeof(struct xfs_attr3_leaf_hdr) = 80
 sizeof(struct xfs_attr3_leafblock) = 88
 sizeof(struct xfs_attr3_rmt_hdr) = 56
 sizeof(struct xfs_btree_block) = 72
+sizeof(struct xfs_btree_block_lhdr) = 64
+sizeof(struct xfs_btree_block_shdr) = 48
 sizeof(struct xfs_bud_log_format) = 16
 sizeof(struct xfs_bui_log_format) = 48
 sizeof(struct xfs_clone_args) = 32

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [PATCH 06/13] xfs: fix $XFS_DB_PROG usage
  2016-08-25 23:28 ` Darrick J. Wong
@ 2016-08-25 23:28   ` Darrick J. Wong
  -1 siblings, 0 replies; 39+ messages in thread
From: Darrick J. Wong @ 2016-08-25 23:28 UTC (permalink / raw)
  To: david, eguan, darrick.wong; +Cc: linux-xfs, fstests, xfs

xfs_db requires us to pass in the log device, if any; this can be
accomplished via _scratch_xfs_db_options (if we're operating on the
scratch device, anyway).  However, many of the tests/xfs/ scripts
pass only $SCRATCH_DEV directly, so they'll fail if we test with an
external log.  So, fix that.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 tests/xfs/001 |   14 +++++++-------
 tests/xfs/002 |    4 ++--
 tests/xfs/070 |    2 +-
 tests/xfs/077 |    6 +++---
 tests/xfs/086 |    2 +-
 tests/xfs/087 |    2 +-
 tests/xfs/088 |    2 +-
 tests/xfs/089 |    2 +-
 tests/xfs/091 |    2 +-
 tests/xfs/093 |    2 +-
 tests/xfs/097 |    2 +-
 tests/xfs/098 |    6 +++---
 tests/xfs/099 |    2 +-
 tests/xfs/100 |    4 ++--
 tests/xfs/101 |    2 +-
 tests/xfs/102 |    4 ++--
 tests/xfs/105 |    4 ++--
 tests/xfs/111 |    2 +-
 tests/xfs/112 |    4 ++--
 tests/xfs/113 |    4 ++--
 tests/xfs/117 |    2 +-
 tests/xfs/120 |    2 +-
 tests/xfs/123 |    2 +-
 tests/xfs/124 |   10 +++++-----
 tests/xfs/125 |    8 ++++----
 tests/xfs/126 |   10 +++++-----
 tests/xfs/130 |    2 +-
 tests/xfs/135 |    2 +-
 tests/xfs/137 |    6 +++---
 tests/xfs/179 |   10 +++++-----
 tests/xfs/186 |    8 ++++----
 tests/xfs/187 |   14 +++++++-------
 tests/xfs/235 |    2 +-
 tests/xfs/287 |    2 +-
 tests/xfs/298 |    2 +-
 35 files changed, 77 insertions(+), 77 deletions(-)


diff --git a/tests/xfs/001 b/tests/xfs/001
index c33adae..e1e1411 100755
--- a/tests/xfs/001
+++ b/tests/xfs/001
@@ -44,11 +44,11 @@ _do_bit_test()
 	bits="$2"
 
 	echo "testing $field with $bits bits"
-	$XFS_DB_PROG -x -c "inode $FILE_INO" -c "write $field 0" $SCRATCH_DEV
+	$XFS_DB_PROG -x -c "inode $FILE_INO" -c "write $field 0" `_scratch_xfs_db_options`
 	num=1
 	for n in `seq 0 1 $bits`; do
 		$XFS_DB_PROG -x -c "inode $FILE_INO" \
-			  -c "write $field $num" $SCRATCH_DEV
+			  -c "write $field $num" `_scratch_xfs_db_options`
 		let num=$num*2
 	done
 	echo
@@ -89,10 +89,10 @@ _do_bit_test "u.bmx[0].startoff" $BMBT_STARTOFF_BITLEN
 _do_bit_test "u.bmx[0].startblock" $BMBT_STARTBLOCK_BITLEN
 _do_bit_test "u.bmx[0].blockcount" $BMBT_BLOCKCOUNT_BITLEN
 # test setting the 32 bit generation number
-$XFS_DB_PROG -x -c "inode $FILE_INO" -c "write core.gen 0x5a" $SCRATCH_DEV
-$XFS_DB_PROG -x -c "inode $FILE_INO" -c "write core.gen 0xa5" $SCRATCH_DEV
-$XFS_DB_PROG -x -c "inode $FILE_INO" -c "write core.gen 0" $SCRATCH_DEV
-$XFS_DB_PROG -x -c "inode $FILE_INO" -c "write core.gen #5a5a" $SCRATCH_DEV
-$XFS_DB_PROG -x -c "inode $FILE_INO" -c "write core.gen #a5a5" $SCRATCH_DEV
+$XFS_DB_PROG -x -c "inode $FILE_INO" -c "write core.gen 0x5a" `_scratch_xfs_db_options`
+$XFS_DB_PROG -x -c "inode $FILE_INO" -c "write core.gen 0xa5" `_scratch_xfs_db_options`
+$XFS_DB_PROG -x -c "inode $FILE_INO" -c "write core.gen 0" `_scratch_xfs_db_options`
+$XFS_DB_PROG -x -c "inode $FILE_INO" -c "write core.gen #5a5a" `_scratch_xfs_db_options`
+$XFS_DB_PROG -x -c "inode $FILE_INO" -c "write core.gen #a5a5" `_scratch_xfs_db_options`
 status=0
 exit
diff --git a/tests/xfs/002 b/tests/xfs/002
index 6dfdd6c..e9805e9 100755
--- a/tests/xfs/002
+++ b/tests/xfs/002
@@ -62,8 +62,8 @@ _scratch_mkfs_xfs -m crc=0 -d size=128m >> $seqres.full 2>&1 || _fail "mkfs fail
 # Scribble past a couple V4 secondary superblocks to populate sb_crc
 # (We can't write to the structure member because it doesn't exist
 # on a v4 superblock, so we use the data type & "write fill")
-$XFS_DB_PROG -x -c "sb 1" -c "type data" -c "write fill 0xff 224 4" $SCRATCH_DEV
-$XFS_DB_PROG -x -c "sb 2" -c "type data" -c "write fill 0xff 224 4" $SCRATCH_DEV
+$XFS_DB_PROG -x -c "sb 1" -c "type data" -c "write fill 0xff 224 4" `_scratch_xfs_db_options`
+$XFS_DB_PROG -x -c "sb 2" -c "type data" -c "write fill 0xff 224 4" `_scratch_xfs_db_options`
 
 _scratch_mount
 
diff --git a/tests/xfs/070 b/tests/xfs/070
index e3a48b3..e0deb18 100755
--- a/tests/xfs/070
+++ b/tests/xfs/070
@@ -101,7 +101,7 @@ _scratch_mkfs | _filter_mkfs > /dev/null 2> $tmp.mkfs || _fail "mkfs failed"
 
 # corrupt the last secondary sb in the fs
 $XFS_DB_PROG -x -c "sb $((agcount - 1))" -c "type data" \
-	-c "write fill 0xff 0 512" $SCRATCH_DEV
+	-c "write fill 0xff 0 512" `_scratch_xfs_db_options`
 
 # attempt to repair
 _xfs_repair_noscan
diff --git a/tests/xfs/077 b/tests/xfs/077
index 007d05d..0ddb3f6 100755
--- a/tests/xfs/077
+++ b/tests/xfs/077
@@ -64,9 +64,9 @@ _test_uuid()
 	ACTION=$1
 	EXPECTED_UUID=$2
 
-	$XFS_DB_PROG -x -c "uuid $ACTION" $SCRATCH_DEV \
+	$XFS_DB_PROG -x -c "uuid $ACTION" `_scratch_xfs_db_options` \
 					| _filter_uuid $EXPECTED_UUID
-	NEW_UUID=`$XFS_DB_PROG -c "uuid"  $SCRATCH_DEV | awk '{print $NF}'`
+	NEW_UUID=`$XFS_DB_PROG -c "uuid"  $(_scratch_xfs_db_options) | awk '{print $NF}'`
 	_check_scratch_fs
 	_scratch_mount || _fail "Mount failed after UUID $ACTION"
 	_scratch_unmount
@@ -83,7 +83,7 @@ rm -f $seqres.full
 
 _scratch_mkfs_xfs -m crc=1 >> $seqres.full 2>&1 || _fail "mkfs failed"
 
-ORIG_UUID=`$XFS_DB_PROG -c "uuid" $SCRATCH_DEV | awk '{print $NF}'`
+ORIG_UUID=`$XFS_DB_PROG -c "uuid" $(_scratch_xfs_db_options) | awk '{print $NF}'`
 
 _scratch_mount
 # Put some stuff on the fs
diff --git a/tests/xfs/086 b/tests/xfs/086
index 143915b..57a5ad5 100755
--- a/tests/xfs/086
+++ b/tests/xfs/086
@@ -87,7 +87,7 @@ _scratch_xfs_repair -n >> $seqres.full 2>&1 || _fail "xfs_repair should not fail
 
 echo "+ corrupt image"
 for ag in $(seq 1 $((agcount - 1))) 0; do
-	$XFS_DB_PROG -x -c "agf ${ag}" -c "agf ${ag}" -c "stack" -c "blocktrash -x 32 -o +64 -y 4096 -z ${FUZZ_ARGS}" "${SCRATCH_DEV}" >> $seqres.full 2>&1
+	$XFS_DB_PROG -x -c "agf ${ag}" -c "agf ${ag}" -c "stack" -c "blocktrash -x 32 -o +64 -y 4096 -z ${FUZZ_ARGS}" `_scratch_xfs_db_options` >> $seqres.full 2>&1
 done
 
 # Try to append to files; this should fail
diff --git a/tests/xfs/087 b/tests/xfs/087
index 97c6680..2efe6f7 100755
--- a/tests/xfs/087
+++ b/tests/xfs/087
@@ -86,7 +86,7 @@ _scratch_xfs_repair -n >> $seqres.full 2>&1 || _fail "xfs_repair should not fail
 
 echo "+ corrupt image"
 for ag in $(seq 1 $((agcount - 1))) 0; do
-	$XFS_DB_PROG -x -c "agi ${ag}" -c "agi ${ag}" -c "stack" -c "blocktrash -x 32 -o +64 -y 4096 -z ${FUZZ_ARGS}" "${SCRATCH_DEV}" >> $seqres.full 2>&1
+	$XFS_DB_PROG -x -c "agi ${ag}" -c "agi ${ag}" -c "stack" -c "blocktrash -x 32 -o +64 -y 4096 -z ${FUZZ_ARGS}" `_scratch_xfs_db_options` >> $seqres.full 2>&1
 done
 
 echo "+ mount image"
diff --git a/tests/xfs/088 b/tests/xfs/088
index 18bf6ad..ac9c7da 100755
--- a/tests/xfs/088
+++ b/tests/xfs/088
@@ -86,7 +86,7 @@ _scratch_xfs_repair -n >> $seqres.full 2>&1 || _fail "xfs_repair should not fail
 
 echo "+ corrupt image"
 for ag in $(seq 1 $((agcount - 1))) 0; do
-	$XFS_DB_PROG -x -c "agfl ${ag}" -c "agfl ${ag}" -c "stack" -c "blocktrash -x 32 -o +64 -y 4096 -z ${FUZZ_ARGS}" "${SCRATCH_DEV}" >> $seqres.full 2>&1
+	$XFS_DB_PROG -x -c "agfl ${ag}" -c "agfl ${ag}" -c "stack" -c "blocktrash -x 32 -o +64 -y 4096 -z ${FUZZ_ARGS}" `_scratch_xfs_db_options` >> $seqres.full 2>&1
 done
 
 # Try to append to files; this should fail
diff --git a/tests/xfs/089 b/tests/xfs/089
index b6e512f..496a4cd 100755
--- a/tests/xfs/089
+++ b/tests/xfs/089
@@ -86,7 +86,7 @@ _scratch_xfs_repair -n >> $seqres.full 2>&1 || _fail "xfs_repair should not fail
 
 echo "+ corrupt image"
 for ag in $(seq 1 $((agcount - 1))) 0; do
-	$XFS_DB_PROG -x -c "agf ${ag}" -c "agf ${ag}" -c "addr bnoroot" -c "stack" -c "blocktrash -x 32 -y $((blksz * 8)) -z ${FUZZ_ARGS}" "${SCRATCH_DEV}" >> $seqres.full 2>&1
+	$XFS_DB_PROG -x -c "agf ${ag}" -c "agf ${ag}" -c "addr bnoroot" -c "stack" -c "blocktrash -x 32 -y $((blksz * 8)) -z ${FUZZ_ARGS}" `_scratch_xfs_db_options` >> $seqres.full 2>&1
 done
 
 # Try to append to files; this should fail
diff --git a/tests/xfs/091 b/tests/xfs/091
index f995d9c..3943474 100755
--- a/tests/xfs/091
+++ b/tests/xfs/091
@@ -86,7 +86,7 @@ _scratch_xfs_repair -n >> $seqres.full 2>&1 || _fail "xfs_repair should not fail
 
 echo "+ corrupt image"
 for ag in $(seq 1 $((agcount - 1))) 0; do
-	$XFS_DB_PROG -x -c "agf ${ag}" -c "agf ${ag}" -c "addr cntroot" -c "stack" -c "blocktrash -x 32 -y $((blksz * 8)) -z ${FUZZ_ARGS}" "${SCRATCH_DEV}" >> $seqres.full 2>&1
+	$XFS_DB_PROG -x -c "agf ${ag}" -c "agf ${ag}" -c "addr cntroot" -c "stack" -c "blocktrash -x 32 -y $((blksz * 8)) -z ${FUZZ_ARGS}" `_scratch_xfs_db_options` >> $seqres.full 2>&1
 done
 
 # Try to append to files; this should fail
diff --git a/tests/xfs/093 b/tests/xfs/093
index 7d4d9b8..790fdbe 100755
--- a/tests/xfs/093
+++ b/tests/xfs/093
@@ -86,7 +86,7 @@ _scratch_xfs_repair -n >> $seqres.full 2>&1 || _fail "xfs_repair should not fail
 
 echo "+ corrupt image"
 for ag in $(seq 1 $((agcount - 1))) 0; do
-	$XFS_DB_PROG -x -c "agi ${ag}" -c "agi ${ag}" -c "addr root" -c "stack" -c "blocktrash -x 32 -y $((blksz * 8)) -z ${FUZZ_ARGS}" "${SCRATCH_DEV}" >> $seqres.full 2>&1
+	$XFS_DB_PROG -x -c "agi ${ag}" -c "agi ${ag}" -c "addr root" -c "stack" -c "blocktrash -x 32 -y $((blksz * 8)) -z ${FUZZ_ARGS}" `_scratch_xfs_db_options` >> $seqres.full 2>&1
 done
 
 echo "+ mount image"
diff --git a/tests/xfs/097 b/tests/xfs/097
index f5a8178..4dac34f 100755
--- a/tests/xfs/097
+++ b/tests/xfs/097
@@ -89,7 +89,7 @@ _scratch_xfs_repair -n >> $seqres.full 2>&1 || _fail "xfs_repair should not fail
 
 echo "+ corrupt image"
 for ag in $(seq 1 $((agcount - 1))) 0; do
-	$XFS_DB_PROG -x -c "agi ${ag}" -c "agi ${ag}" -c "addr free_root" -c "stack" -c "blocktrash -x 32 -y $((blksz * 8)) -z ${FUZZ_ARGS}" "${SCRATCH_DEV}" >> $seqres.full 2>&1
+	$XFS_DB_PROG -x -c "agi ${ag}" -c "agi ${ag}" -c "addr free_root" -c "stack" -c "blocktrash -x 32 -y $((blksz * 8)) -z ${FUZZ_ARGS}" `_scratch_xfs_db_options` >> $seqres.full 2>&1
 done
 
 echo "+ mount image"
diff --git a/tests/xfs/098 b/tests/xfs/098
index d91d617..4851618 100755
--- a/tests/xfs/098
+++ b/tests/xfs/098
@@ -84,9 +84,9 @@ echo "+ check fs"
 _scratch_xfs_repair -n >> $seqres.full 2>&1 || _fail "xfs_repair should not fail"
 
 echo "+ corrupt image"
-logstart="$($XFS_DB_PROG -c 'sb 0' -c 'p' "${SCRATCH_DEV}" | grep '^logstart =' | cut -d ' ' -f 3)"
-logstart="$($XFS_DB_PROG -c "convert fsblock ${logstart} byte" "${SCRATCH_DEV}" | sed -e 's/^.*(\([0-9]*\).*$/\1/g')"
-logblocks="$(xfs_db -c 'sb 0' -c 'p' "${SCRATCH_DEV}" | grep '^logblocks =' | cut -d ' ' -f 3)"
+logstart="$($XFS_DB_PROG -c 'sb 0' -c 'p' `_scratch_xfs_db_options` | grep '^logstart =' | cut -d ' ' -f 3)"
+logstart="$($XFS_DB_PROG -c "convert fsblock ${logstart} byte" `_scratch_xfs_db_options` | sed -e 's/^.*(\([0-9]*\).*$/\1/g')"
+logblocks="$($XFS_DB_PROG -c 'sb 0' -c 'p' `_scratch_xfs_db_options` | grep '^logblocks =' | cut -d ' ' -f 3)"
 $XFS_IO_PROG -f -c "pwrite -S 0x62 ${logstart} $((logblocks * blksz))" "${SCRATCH_DEV}" >> $seqres.full
 
 echo "+ mount image"
diff --git a/tests/xfs/099 b/tests/xfs/099
index 36cf893..6c37160 100755
--- a/tests/xfs/099
+++ b/tests/xfs/099
@@ -78,7 +78,7 @@ echo "+ check dir"
 __populate_check_xfs_dir "${SCRATCH_DEV}" "${inode}" block
 
 echo "+ corrupt dir"
-$XFS_DB_PROG -x -c "inode ${inode}" -c 'dblock 0' -c "stack" -c "blocktrash -x 32 -y $((blksz * 8)) -z ${FUZZ_ARGS}" "${SCRATCH_DEV}" >> $seqres.full
+$XFS_DB_PROG -x -c "inode ${inode}" -c 'dblock 0' -c "stack" -c "blocktrash -x 32 -y $((blksz * 8)) -z ${FUZZ_ARGS}" `_scratch_xfs_db_options` >> $seqres.full
 
 echo "+ mount image"
 _scratch_mount
diff --git a/tests/xfs/100 b/tests/xfs/100
index 397c613..19ab43b 100755
--- a/tests/xfs/100
+++ b/tests/xfs/100
@@ -80,8 +80,8 @@ __populate_check_xfs_dir "${SCRATCH_DEV}" "${inode}" leaf
 echo "+ corrupt dir"
 loff=0
 while true; do
-	$XFS_DB_PROG -x -c "inode ${inode}" -c "dblock ${loff}" -c "stack" "${SCRATCH_DEV}" | grep -q 'file data block is unmapped' && break
-	$XFS_DB_PROG -x -c "inode ${inode}" -c "dblock ${loff}" -c "stack" -c "blocktrash -x 32 -y $((blksz * 8)) -z ${FUZZ_ARGS}" "${SCRATCH_DEV}" >> $seqres.full
+	$XFS_DB_PROG -x -c "inode ${inode}" -c "dblock ${loff}" -c "stack" `_scratch_xfs_db_options` | grep -q 'file data block is unmapped' && break
+	$XFS_DB_PROG -x -c "inode ${inode}" -c "dblock ${loff}" -c "stack" -c "blocktrash -x 32 -y $((blksz * 8)) -z ${FUZZ_ARGS}" `_scratch_xfs_db_options` >> $seqres.full
 	loff="$((loff + 1))"
 done
 
diff --git a/tests/xfs/101 b/tests/xfs/101
index 09af649..61a85d2 100755
--- a/tests/xfs/101
+++ b/tests/xfs/101
@@ -78,7 +78,7 @@ echo "+ check dir"
 __populate_check_xfs_dir "${SCRATCH_DEV}" "${inode}" leaf
 
 echo "+ corrupt dir"
-$XFS_DB_PROG -x -c "inode ${inode}" -c "dblock ${leaf_lblk}" -c "stack" -c "blocktrash -x 32 -y $((blksz * 8)) -z ${FUZZ_ARGS}" "${SCRATCH_DEV}" >> $seqres.full
+$XFS_DB_PROG -x -c "inode ${inode}" -c "dblock ${leaf_lblk}" -c "stack" -c "blocktrash -x 32 -y $((blksz * 8)) -z ${FUZZ_ARGS}" `_scratch_xfs_db_options` >> $seqres.full
 
 echo "+ mount image"
 _scratch_mount
diff --git a/tests/xfs/102 b/tests/xfs/102
index 5d1965e..8c4db3e 100755
--- a/tests/xfs/102
+++ b/tests/xfs/102
@@ -80,8 +80,8 @@ __populate_check_xfs_dir "${SCRATCH_DEV}" "${inode}" node
 echo "+ corrupt dir"
 loff=0
 while true; do
-	$XFS_DB_PROG -x -c "inode ${inode}" -c "dblock ${loff}" -c "stack" "${SCRATCH_DEV}" | grep -q 'file data block is unmapped' && break
-	$XFS_DB_PROG -x -c "inode ${inode}" -c "dblock ${loff}" -c "stack" -c "blocktrash -x 32 -y $((blksz * 8)) -z ${FUZZ_ARGS}" "${SCRATCH_DEV}" >> $seqres.full
+	$XFS_DB_PROG -x -c "inode ${inode}" -c "dblock ${loff}" -c "stack" `_scratch_xfs_db_options` | grep -q 'file data block is unmapped' && break
+	$XFS_DB_PROG -x -c "inode ${inode}" -c "dblock ${loff}" -c "stack" -c "blocktrash -x 32 -y $((blksz * 8)) -z ${FUZZ_ARGS}" `_scratch_xfs_db_options` >> $seqres.full
 	loff="$((loff + 1))"
 done
 
diff --git a/tests/xfs/105 b/tests/xfs/105
index 516639a..682e8d5 100755
--- a/tests/xfs/105
+++ b/tests/xfs/105
@@ -80,8 +80,8 @@ __populate_check_xfs_dir "${SCRATCH_DEV}" "${inode}" node
 echo "+ corrupt dir"
 loff="${leaf_lblk}"
 while true; do
-	$XFS_DB_PROG -x -c "inode ${inode}" -c "dblock ${loff}" -c "stack" "${SCRATCH_DEV}" | grep -q 'file data block is unmapped' && break
-	$XFS_DB_PROG -x -c "inode ${inode}" -c "dblock ${loff}" -c "stack" -c "blocktrash -x 32 -y $((blksz * 8)) -z ${FUZZ_ARGS}" "${SCRATCH_DEV}" >> $seqres.full
+	$XFS_DB_PROG -x -c "inode ${inode}" -c "dblock ${loff}" -c "stack" `_scratch_xfs_db_options` | grep -q 'file data block is unmapped' && break
+	$XFS_DB_PROG -x -c "inode ${inode}" -c "dblock ${loff}" -c "stack" -c "blocktrash -x 32 -y $((blksz * 8)) -z ${FUZZ_ARGS}" `_scratch_xfs_db_options` >> $seqres.full
 	loff="$((loff + 1))"
 done
 
diff --git a/tests/xfs/111 b/tests/xfs/111
index f6a41a8..4899020 100755
--- a/tests/xfs/111
+++ b/tests/xfs/111
@@ -64,7 +64,7 @@ INO=`ls -i $SCRATCH_MNT/512 | awk '{print $1}'`
 _scratch_unmount
 
 # Figure out where that middle inode starts
-BYTE=`$XFS_DB_PROG -c "convert inode $INO byte" $SCRATCH_DEV \
+BYTE=`$XFS_DB_PROG -c "convert inode $INO byte" `_scratch_xfs_db_options` \
 	| awk '{print $2}' | sed s/[\(\)]//g`
 
 echo Blat inode clusters
diff --git a/tests/xfs/112 b/tests/xfs/112
index aa7561e..8893e79 100755
--- a/tests/xfs/112
+++ b/tests/xfs/112
@@ -80,8 +80,8 @@ __populate_check_xfs_dir "${SCRATCH_DEV}" "${inode}" node
 echo "+ corrupt dir"
 loff="${node_lblk}"
 while true; do
-	$XFS_DB_PROG -x -c "inode ${inode}" -c "dblock ${loff}" -c "stack" "${SCRATCH_DEV}" | grep -q 'file data block is unmapped' && break
-	$XFS_DB_PROG -x -c "inode ${inode}" -c "dblock ${loff}" -c "stack" -c "blocktrash -x 32 -y $((blksz * 8)) -z ${FUZZ_ARGS}" "${SCRATCH_DEV}" >> $seqres.full
+	$XFS_DB_PROG -x -c "inode ${inode}" -c "dblock ${loff}" -c "stack" `_scratch_xfs_db_options` | grep -q 'file data block is unmapped' && break
+	$XFS_DB_PROG -x -c "inode ${inode}" -c "dblock ${loff}" -c "stack" -c "blocktrash -x 32 -y $((blksz * 8)) -z ${FUZZ_ARGS}" `_scratch_xfs_db_options` >> $seqres.full
 	loff="$((loff + 1))"
 done
 
diff --git a/tests/xfs/113 b/tests/xfs/113
index 8aa3395..e56927f 100755
--- a/tests/xfs/113
+++ b/tests/xfs/113
@@ -80,8 +80,8 @@ __populate_check_xfs_dir "${SCRATCH_DEV}" "${inode}" btree
 echo "+ corrupt dir"
 loff=0
 while true; do
-	$XFS_DB_PROG -x -c "inode ${inode}" -c "dblock ${loff}" -c "stack" "${SCRATCH_DEV}" | grep -q 'file data block is unmapped' && break
-	$XFS_DB_PROG -x -c "inode ${inode}" -c "dblock ${loff}" -c "stack" -c "blocktrash -x 32 -y $((blksz * 8)) -z ${FUZZ_ARGS}" "${SCRATCH_DEV}" >> $seqres.full
+	$XFS_DB_PROG -x -c "inode ${inode}" -c "dblock ${loff}" -c "stack" `_scratch_xfs_db_options` | grep -q 'file data block is unmapped' && break
+	$XFS_DB_PROG -x -c "inode ${inode}" -c "dblock ${loff}" -c "stack" -c "blocktrash -x 32 -y $((blksz * 8)) -z ${FUZZ_ARGS}" `_scratch_xfs_db_options` >> $seqres.full
 	loff="$((loff + 1))"
 done
 
diff --git a/tests/xfs/117 b/tests/xfs/117
index 27dafd9..3aeb555 100755
--- a/tests/xfs/117
+++ b/tests/xfs/117
@@ -85,7 +85,7 @@ _scratch_xfs_repair -n >> $seqres.full 2>&1 || _fail "xfs_repair should not fail
 
 echo "+ corrupt image"
 seq "${inode}" "$((inode + 64))" | while read ino; do
-	$XFS_DB_PROG -x -c "inode ${ino}" -c "stack" -c "blocktrash -x 32 -y $((blksz * 8)) -z ${FUZZ_ARGS}" "${SCRATCH_DEV}" >> $seqres.full 2>&1
+	$XFS_DB_PROG -x -c "inode ${ino}" -c "stack" -c "blocktrash -x 32 -y $((blksz * 8)) -z ${FUZZ_ARGS}" `_scratch_xfs_db_options` >> $seqres.full 2>&1
 done
 
 echo "+ mount image"
diff --git a/tests/xfs/120 b/tests/xfs/120
index 08a4615..b4b5f8b 100755
--- a/tests/xfs/120
+++ b/tests/xfs/120
@@ -75,7 +75,7 @@ echo "+ check fs"
 _scratch_xfs_repair -n >> $seqres.full 2>&1 || _fail "xfs_repair should not fail"
 
 echo "+ corrupt image"
-$XFS_DB_PROG -x -c "inode ${inode}" -c "addr u.bmbt.ptrs[1]" -c "addr u3.bmbt.ptrs[1]" -c "stack" -c "blocktrash -x 32 -y $((blksz * 8)) -z ${FUZZ_ARGS}" "${SCRATCH_DEV}" >> $seqres.full
+$XFS_DB_PROG -x -c "inode ${inode}" -c "addr u.bmbt.ptrs[1]" -c "addr u3.bmbt.ptrs[1]" -c "stack" -c "blocktrash -x 32 -y $((blksz * 8)) -z ${FUZZ_ARGS}" `_scratch_xfs_db_options` >> $seqres.full
 
 echo "+ mount image"
 _scratch_mount
diff --git a/tests/xfs/123 b/tests/xfs/123
index a746d5c..bc6cb64 100755
--- a/tests/xfs/123
+++ b/tests/xfs/123
@@ -74,7 +74,7 @@ echo "+ check fs"
 _scratch_xfs_repair -n >> $seqres.full 2>&1 || _fail "xfs_repair should not fail"
 
 echo "+ corrupt image"
-$XFS_DB_PROG -x -c "inode ${inode}" -c "dblock 0" -c "stack" -c "blocktrash -x 32 -o 256 -y $((blksz * 8)) -z ${FUZZ_ARGS}" "${SCRATCH_DEV}" >> $seqres.full
+$XFS_DB_PROG -x -c "inode ${inode}" -c "dblock 0" -c "stack" -c "blocktrash -x 32 -o 256 -y $((blksz * 8)) -z ${FUZZ_ARGS}" `_scratch_xfs_db_options` >> $seqres.full
 
 echo "+ mount image"
 _scratch_mount
diff --git a/tests/xfs/124 b/tests/xfs/124
index 239c246..f436ba5 100755
--- a/tests/xfs/124
+++ b/tests/xfs/124
@@ -77,13 +77,13 @@ echo "+ check fs"
 _scratch_xfs_repair -n >> $seqres.full 2>&1 || _fail "xfs_repair should not fail"
 
 echo "+ check xattr"
-$XFS_DB_PROG -x -c "inode ${inode}" -c "bmap" "${SCRATCH_DEV}" >> $seqres.full
-$XFS_DB_PROG -x -c "inode ${inode}" -c "ablock 0" -c "stack" "${SCRATCH_DEV}" | grep -q 'file attr block is unmapped' && _fail "failed to create a block xattr (data)"
-$XFS_DB_PROG -x -c "inode ${inode}" -c "ablock ${leaf_lblk}" -c "stack" "${SCRATCH_DEV}" | grep -q 'file attr block is unmapped' || _fail "failed to create a block xattr (leaf)"
-$XFS_DB_PROG -x -c "inode ${inode}" -c "ablock ${node_lblk}" -c "stack" "${SCRATCH_DEV}" | grep -q 'file attr block is unmapped' || _fail "failed to create a block xattr (free)"
+$XFS_DB_PROG -x -c "inode ${inode}" -c "bmap" `_scratch_xfs_db_options` >> $seqres.full
+$XFS_DB_PROG -x -c "inode ${inode}" -c "ablock 0" -c "stack" `_scratch_xfs_db_options` | grep -q 'file attr block is unmapped' && _fail "failed to create a block xattr (data)"
+$XFS_DB_PROG -x -c "inode ${inode}" -c "ablock ${leaf_lblk}" -c "stack" `_scratch_xfs_db_options` | grep -q 'file attr block is unmapped' || _fail "failed to create a block xattr (leaf)"
+$XFS_DB_PROG -x -c "inode ${inode}" -c "ablock ${node_lblk}" -c "stack" `_scratch_xfs_db_options` | grep -q 'file attr block is unmapped' || _fail "failed to create a block xattr (free)"
 
 echo "+ corrupt xattr"
-$XFS_DB_PROG -x -c "inode ${inode}" -c 'ablock 0' -c "stack" -c "blocktrash -x 32 -y $((blksz * 8)) -z ${FUZZ_ARGS}" "${SCRATCH_DEV}" >> $seqres.full
+$XFS_DB_PROG -x -c "inode ${inode}" -c 'ablock 0' -c "stack" -c "blocktrash -x 32 -y $((blksz * 8)) -z ${FUZZ_ARGS}" `_scratch_xfs_db_options` >> $seqres.full
 
 echo "+ mount image"
 _scratch_mount
diff --git a/tests/xfs/125 b/tests/xfs/125
index cf61e02..1779152 100755
--- a/tests/xfs/125
+++ b/tests/xfs/125
@@ -78,12 +78,12 @@ echo "+ check fs"
 _scratch_xfs_repair -n >> $seqres.full 2>&1 || _fail "xfs_repair should not fail"
 
 echo "+ check xattr"
-$XFS_DB_PROG -x -c "inode ${inode}" -c "bmap" "${SCRATCH_DEV}" >> $seqres.full
-$XFS_DB_PROG -x -c "inode ${inode}" -c "ablock 0" -c "stack" "${SCRATCH_DEV}" | grep -q 'file attr block is unmapped' && _fail "failed to create a leaf xattr (index)"
-$XFS_DB_PROG -x -c "inode ${inode}" -c "ablock 1" -c "stack" "${SCRATCH_DEV}" | grep -q 'file attr block is unmapped' && _fail "failed to create a leaf xattr (data)"
+$XFS_DB_PROG -x -c "inode ${inode}" -c "bmap" `_scratch_xfs_db_options` >> $seqres.full
+$XFS_DB_PROG -x -c "inode ${inode}" -c "ablock 0" -c "stack" `_scratch_xfs_db_options` | grep -q 'file attr block is unmapped' && _fail "failed to create a leaf xattr (index)"
+$XFS_DB_PROG -x -c "inode ${inode}" -c "ablock 1" -c "stack" `_scratch_xfs_db_options` | grep -q 'file attr block is unmapped' && _fail "failed to create a leaf xattr (data)"
 
 echo "+ corrupt xattr"
-$XFS_DB_PROG -x -c "inode ${inode}" -c 'ablock 0' -c "stack" -c "blocktrash -x 32 -o +32 -y $((blksz * 8)) -z ${FUZZ_ARGS}" "${SCRATCH_DEV}" >> $seqres.full
+$XFS_DB_PROG -x -c "inode ${inode}" -c 'ablock 0' -c "stack" -c "blocktrash -x 32 -o +32 -y $((blksz * 8)) -z ${FUZZ_ARGS}" `_scratch_xfs_db_options` >> $seqres.full
 
 echo "+ mount image"
 _scratch_mount
diff --git a/tests/xfs/126 b/tests/xfs/126
index ebe84fc..107ff79 100755
--- a/tests/xfs/126
+++ b/tests/xfs/126
@@ -78,15 +78,15 @@ echo "+ check fs"
 _scratch_xfs_repair -n >> $seqres.full 2>&1 || _fail "xfs_repair should not fail"
 
 echo "+ check xattr"
-$XFS_DB_PROG -x -c "inode ${inode}" -c "bmap" "${SCRATCH_DEV}" >> $seqres.full
-$XFS_DB_PROG -x -c "inode ${inode}" -c "ablock 0" -c "stack" "${SCRATCH_DEV}" | grep -q 'file attr block is unmapped' && _fail "failed to create a leaf xattr (index)"
-$XFS_DB_PROG -x -c "inode ${inode}" -c "ablock 1" -c "stack" "${SCRATCH_DEV}" | grep -q 'file attr block is unmapped' && _fail "failed to create a leaf xattr (data)"
+$XFS_DB_PROG -x -c "inode ${inode}" -c "bmap" `_scratch_xfs_db_options` >> $seqres.full
+$XFS_DB_PROG -x -c "inode ${inode}" -c "ablock 0" -c "stack" `_scratch_xfs_db_options` | grep -q 'file attr block is unmapped' && _fail "failed to create a leaf xattr (index)"
+$XFS_DB_PROG -x -c "inode ${inode}" -c "ablock 1" -c "stack" `_scratch_xfs_db_options` | grep -q 'file attr block is unmapped' && _fail "failed to create a leaf xattr (data)"
 
 echo "+ corrupt xattr"
 loff=1
 while true; do
-	$XFS_DB_PROG -x -c "inode ${inode}" -c "ablock ${loff}" -c "stack" "${SCRATCH_DEV}" | grep -q 'file attr block is unmapped' && break
-	$XFS_DB_PROG -x -c "inode ${inode}" -c "ablock ${loff}" -c "stack" -c "blocktrash -x 32 -y $((blksz * 8)) -z ${FUZZ_ARGS}" "${SCRATCH_DEV}" >> $seqres.full
+	$XFS_DB_PROG -x -c "inode ${inode}" -c "ablock ${loff}" -c "stack" `_scratch_xfs_db_options` | grep -q 'file attr block is unmapped' && break
+	$XFS_DB_PROG -x -c "inode ${inode}" -c "ablock ${loff}" -c "stack" -c "blocktrash -x 32 -y $((blksz * 8)) -z ${FUZZ_ARGS}" `_scratch_xfs_db_options` >> $seqres.full
 	loff="$((loff + 1))"
 done
 
diff --git a/tests/xfs/130 b/tests/xfs/130
index 554d078..4078809 100755
--- a/tests/xfs/130
+++ b/tests/xfs/130
@@ -75,7 +75,7 @@ echo "+ corrupt image"
 seq 0 $((agcount - 1)) | while read ag; do
 	$XFS_DB_PROG -x -c "agf ${ag}" -c "agf ${ag}" -c "addr refcntroot" \
 		-c "stack" -c "blocktrash -x 4096 -y 4096 -z -n 8 -3" \
-		"${SCRATCH_DEV}" >> "$seqres.full" 2>&1
+		`_scratch_xfs_db_options` >> "$seqres.full" 2>&1
 done
 
 echo "+ mount image"
diff --git a/tests/xfs/135 b/tests/xfs/135
index 0487f0e..8cc8249 100755
--- a/tests/xfs/135
+++ b/tests/xfs/135
@@ -60,7 +60,7 @@ _scratch_mkfs >> $seqres.full 2>&1 || _fail "mkfs failed"
 # (the log is zeroed when cycle == 1).
 for i in 16 32 64 128 256; do
 	lsunit=$((i * 1024))
-	$XFS_DB_PROG -x -c "logformat -c 3 -s $lsunit" $SCRATCH_DEV | \
+	$XFS_DB_PROG -x -c "logformat -c 3 -s $lsunit" `_scratch_xfs_db_options` | \
 		tee -a $seqres.full
 	# don't redirect error output so it causes test failure
 	$XFS_LOGPRINT_PROG $SCRATCH_DEV >> $seqres.full
diff --git a/tests/xfs/137 b/tests/xfs/137
index dec9fc9..aab306b 100755
--- a/tests/xfs/137
+++ b/tests/xfs/137
@@ -58,7 +58,7 @@ _require_xfs_db_command "logformat"
 _scratch_mkfs >> $seqres.full 2>&1 || _fail "mkfs failed"
 
 # push the log cycle ahead so we have room to move it backwards later
-$XFS_DB_PROG -x -c "logformat -c 3" $SCRATCH_DEV >> $seqres.full 2>&1
+$XFS_DB_PROG -x -c "logformat -c 3" `_scratch_xfs_db_options` >> $seqres.full 2>&1
 
 # do some work on the fs to update metadata LSNs
 _scratch_mount
@@ -68,13 +68,13 @@ _scratch_unmount
 # Reformat to the current cycle and try to mount. This fails in most cases
 # because the sb LSN is ahead of the current LSN. If it doesn't fail, push the
 # cycle back further and try again.
-$XFS_DB_PROG -x -c "logformat" $SCRATCH_DEV >> $seqres.full 2>&1
+$XFS_DB_PROG -x -c "logformat" `_scratch_xfs_db_options` >> $seqres.full 2>&1
 _scratch_mount >> $seqres.full 2>&1
 if [ $? != 0 ]; then
 	echo mount failure detected
 else
 	_scratch_unmount
-	$XFS_DB_PROG -x -c "logformat -c 2" $SCRATCH_DEV >> $seqres.full 2>&1
+	$XFS_DB_PROG -x -c "logformat -c 2" `_scratch_xfs_db_options` >> $seqres.full 2>&1
 	_scratch_mount >> $seqres.full 2>&1 || echo mount failure detected
 fi
 
diff --git a/tests/xfs/179 b/tests/xfs/179
index 18459cb..8cb3ddd 100755
--- a/tests/xfs/179
+++ b/tests/xfs/179
@@ -67,9 +67,9 @@ _cp_reflink $testdir/file1 $testdir/file2 >> $seqres.full
 echo "Change reference count"
 _scratch_unmount
 echo "set refcount to -4" >> $seqres.full
-$XFS_DB_PROG -x -c 'agf 0' -c 'addr refcntroot' -c 'write recs[1].refcount 4294967292' $SCRATCH_DEV >> $seqres.full
+$XFS_DB_PROG -x -c 'agf 0' -c 'addr refcntroot' -c 'write recs[1].refcount 4294967292' `_scratch_xfs_db_options` >> $seqres.full
 echo "check refcount after setting to -4" >> $seqres.full
-$XFS_DB_PROG -c 'agf 0' -c 'addr refcntroot' -c 'p recs[1]' $SCRATCH_DEV >> $seqres.full
+$XFS_DB_PROG -c 'agf 0' -c 'addr refcntroot' -c 'p recs[1]' `_scratch_xfs_db_options` >> $seqres.full
 _scratch_mount >> $seqres.full
 
 echo "Reflink the overlinked file"
@@ -82,7 +82,7 @@ _cp_reflink $testdir/file1 $testdir/file7 >> $seqres.full
 echo "Check scratch fs"
 _scratch_unmount
 echo "check refcount after reflinking 5 more times" >> $seqres.full
-$XFS_DB_PROG -c 'agf 0' -c 'addr refcntroot' -c 'p recs[1]' $SCRATCH_DEV >> $seqres.full
+$XFS_DB_PROG -c 'agf 0' -c 'addr refcntroot' -c 'p recs[1]' `_scratch_xfs_db_options` >> $seqres.full
 _scratch_mount >> $seqres.full
 
 echo "CoW a couple files"
@@ -93,7 +93,7 @@ _pwrite_byte 0x62 0 $blksz $testdir/file7 >> $seqres.full
 echo "Check scratch fs"
 _scratch_unmount
 echo "check refcount after cowing 3 files" >> $seqres.full
-$XFS_DB_PROG -c 'agf 0' -c 'addr refcntroot' -c 'p recs[1]' $SCRATCH_DEV >> $seqres.full
+$XFS_DB_PROG -c 'agf 0' -c 'addr refcntroot' -c 'p recs[1]' `_scratch_xfs_db_options` >> $seqres.full
 _scratch_mount >> $seqres.full
 
 echo "Remove reflinked files"
@@ -102,7 +102,7 @@ rm -rf $testdir/file*
 echo "Check scratch fs"
 _scratch_unmount
 echo "check refcount after removing all files" >> $seqres.full
-$XFS_DB_PROG -c 'agf 0' -c 'addr refcntroot' -c 'p recs[1]' $SCRATCH_DEV >> $seqres.full
+$XFS_DB_PROG -c 'agf 0' -c 'addr refcntroot' -c 'p recs[1]' `_scratch_xfs_db_options` >> $seqres.full
 _scratch_xfs_repair -o force_geometry -n >> $seqres.full 2>&1
 res=$?
 if [ $res -eq 0 ]; then
diff --git a/tests/xfs/186 b/tests/xfs/186
index 192a8c8..347db0d 100755
--- a/tests/xfs/186
+++ b/tests/xfs/186
@@ -98,8 +98,8 @@ _print_inode()
 {
 	echo ""
 	echo "================================="
-	$XFS_DB_PROG -c "version" $SCRATCH_DEV 2>&1 | _filter_version
-	$XFS_DB_PROG -c "inode $inum" -c p $SCRATCH_DEV 2>&1 | _filter_inode
+	$XFS_DB_PROG -c "version" `_scratch_xfs_db_options` 2>&1 | _filter_version
+	$XFS_DB_PROG -c "inode $inum" -c p `_scratch_xfs_db_options` 2>&1 | _filter_inode
 	echo "================================="
 }
 
@@ -136,7 +136,7 @@ _changeto_attr1()
 	echo ""
 	echo "Try setting attr1 by db"
 	echo ""
-	$XFS_DB_PROG -x -c "version attr1" $SCRATCH_DEV | _filter_version
+	$XFS_DB_PROG -x -c "version attr1" `_scratch_xfs_db_options` | _filter_version
 }
 
 # get standard environment, filters and checks
@@ -173,7 +173,7 @@ fi
 
 # set inum to root dir ino
 # we'll add in dirents and EAs into the root directory
-eval `$XFS_DB_PROG -r -c 'sb 0' -c 'p rootino' $SCRATCH_DEV | $SED_PROG 's/ //g'`
+eval `$XFS_DB_PROG -r -c 'sb 0' -c 'p rootino' `_scratch_xfs_db_options` | $SED_PROG 's/ //g'`
 inum=$rootino
 fork_dir=$SCRATCH_MNT
 _print_inode
diff --git a/tests/xfs/187 b/tests/xfs/187
index 836b924..68a00c9 100755
--- a/tests/xfs/187
+++ b/tests/xfs/187
@@ -76,7 +76,7 @@ export MKFS_LAZY="-m crc=0 -l lazy-count=1 -i projid32bit=0"
 # Make sure that when we think we are testing with morebits off
 # that we really are.
 _scratch_mkfs -i attr=1 $MKFS_NO_LAZY  >/dev/null 2>&1
-$XFS_DB_PROG -c version $SCRATCH_DEV 2>&1 >$tmp.db
+$XFS_DB_PROG -c version `_scratch_xfs_db_options` 2>&1 >$tmp.db
 if grep -i morebits $tmp.db
 then
 	echo ""
@@ -91,13 +91,13 @@ echo ""
 echo "attr2 fs"
 echo ""
 _scratch_mkfs -i attr=2 $MKFS_NO_LAZY >/dev/null 2>&1
-$XFS_DB_PROG -r -c version $SCRATCH_DEV 2>&1 | _filter_version
+$XFS_DB_PROG -r -c version `_scratch_xfs_db_options` 2>&1 | _filter_version
 echo ""
 echo "noattr2 fs"
 echo ""
 _scratch_mount -o noattr2
 $UMOUNT_PROG $SCRATCH_MNT
-$XFS_DB_PROG -r -c version $SCRATCH_DEV 2>&1 | _filter_version
+$XFS_DB_PROG -r -c version `_scratch_xfs_db_options` 2>&1 | _filter_version
 
 # adding an EA will ensure the ATTR1 flag is turned on
 echo ""
@@ -106,7 +106,7 @@ echo ""
 echo "attr2 fs"
 echo ""
 _scratch_mkfs -i attr=2 $MKFS_NO_LAZY >/dev/null 2>&1
-$XFS_DB_PROG -r -c version $SCRATCH_DEV 2>&1 | _filter_version
+$XFS_DB_PROG -r -c version `_scratch_xfs_db_options` 2>&1 | _filter_version
 echo ""
 echo "noattr2 fs"
 echo ""
@@ -117,7 +117,7 @@ $SETFATTR_PROG -n user.test -v 0xbabe testfile
 $GETFATTR_PROG testfile
 cd $here
 $UMOUNT_PROG $SCRATCH_MNT
-$XFS_DB_PROG -r -c version $SCRATCH_DEV 2>&1 | _filter_version
+$XFS_DB_PROG -r -c version `_scratch_xfs_db_options` 2>&1 | _filter_version
 
 echo ""
 echo "*** 3. test noattr2 mount and lazy sb ***"
@@ -126,7 +126,7 @@ echo ""
 echo "attr2 fs"
 echo ""
 _scratch_mkfs -i attr=2 $MKFS_LAZY >/dev/null 2>&1
-$XFS_DB_PROG -r -c version $SCRATCH_DEV 2>&1 | _filter_version
+$XFS_DB_PROG -r -c version `_scratch_xfs_db_options` 2>&1 | _filter_version
 echo ""
 echo "noattr2 fs"
 echo ""
@@ -135,7 +135,7 @@ cd $SCRATCH_MNT
 touch testfile
 cd $here
 $UMOUNT_PROG $SCRATCH_MNT
-$XFS_DB_PROG -r -c version $SCRATCH_DEV 2>&1 | _filter_version
+$XFS_DB_PROG -r -c version `_scratch_xfs_db_options` 2>&1 | _filter_version
 
 # success, all done
 status=0
diff --git a/tests/xfs/235 b/tests/xfs/235
index ef51d22..1329c28 100755
--- a/tests/xfs/235
+++ b/tests/xfs/235
@@ -73,7 +73,7 @@ echo "+ corrupt image"
 seq 0 $((agcount - 1)) | while read ag; do
 	$XFS_DB_PROG -x -c "agf ${ag}" -c "agf ${ag}" -c "addr rmaproot" \
 		-c "stack" -c "blocktrash -x 4096 -y 4096 -z -n 8 -3" \
-		${SCRATCH_DEV} >> $seqres.full 2>&1
+		`_scratch_xfs_db_options` >> $seqres.full 2>&1
 done
 
 echo "+ mount image"
diff --git a/tests/xfs/287 b/tests/xfs/287
index aca410a..14fa51b 100755
--- a/tests/xfs/287
+++ b/tests/xfs/287
@@ -49,7 +49,7 @@ _print_projid()
 	$XFS_DB_PROG -r -c "inode $1" \
 		-c "print core.projid_lo" \
 		-c "print core.projid_hi" \
-		$SCRATCH_DEV
+		`_scratch_xfs_db_options`
 }
 
 # real QA test starts here
diff --git a/tests/xfs/298 b/tests/xfs/298
index bb836a0..18781ad 100755
--- a/tests/xfs/298
+++ b/tests/xfs/298
@@ -82,7 +82,7 @@ while [ $SIZE -lt 1024 ];do
 # umount and check the number of extents on the inode. Should be 0.
 	cd
 	_scratch_unmount >/dev/null 2>&1
-	$XFS_DB_PROG  -c "inode $inode" -c "p core.nextents" $SCRATCH_DEV
+	$XFS_DB_PROG  -c "inode $inode" -c "p core.nextents" `_scratch_xfs_db_options`
 
 	let SIZE=$SIZE+32
 done


^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [PATCH 06/13] xfs: fix $XFS_DB_PROG usage
@ 2016-08-25 23:28   ` Darrick J. Wong
  0 siblings, 0 replies; 39+ messages in thread
From: Darrick J. Wong @ 2016-08-25 23:28 UTC (permalink / raw)
  To: david, eguan, darrick.wong; +Cc: linux-xfs, fstests, xfs

xfs_db requires us to pass in the log device, if any; this can be
accomplished via _scratch_xfs_db_options (if we're operating on the
scratch device, anyway).  However, many of the tests/xfs/ scripts
pass only $SCRATCH_DEV directly, so they'll fail if we test with an
external log.  So, fix that.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 tests/xfs/001 |   14 +++++++-------
 tests/xfs/002 |    4 ++--
 tests/xfs/070 |    2 +-
 tests/xfs/077 |    6 +++---
 tests/xfs/086 |    2 +-
 tests/xfs/087 |    2 +-
 tests/xfs/088 |    2 +-
 tests/xfs/089 |    2 +-
 tests/xfs/091 |    2 +-
 tests/xfs/093 |    2 +-
 tests/xfs/097 |    2 +-
 tests/xfs/098 |    6 +++---
 tests/xfs/099 |    2 +-
 tests/xfs/100 |    4 ++--
 tests/xfs/101 |    2 +-
 tests/xfs/102 |    4 ++--
 tests/xfs/105 |    4 ++--
 tests/xfs/111 |    2 +-
 tests/xfs/112 |    4 ++--
 tests/xfs/113 |    4 ++--
 tests/xfs/117 |    2 +-
 tests/xfs/120 |    2 +-
 tests/xfs/123 |    2 +-
 tests/xfs/124 |   10 +++++-----
 tests/xfs/125 |    8 ++++----
 tests/xfs/126 |   10 +++++-----
 tests/xfs/130 |    2 +-
 tests/xfs/135 |    2 +-
 tests/xfs/137 |    6 +++---
 tests/xfs/179 |   10 +++++-----
 tests/xfs/186 |    8 ++++----
 tests/xfs/187 |   14 +++++++-------
 tests/xfs/235 |    2 +-
 tests/xfs/287 |    2 +-
 tests/xfs/298 |    2 +-
 35 files changed, 77 insertions(+), 77 deletions(-)


diff --git a/tests/xfs/001 b/tests/xfs/001
index c33adae..e1e1411 100755
--- a/tests/xfs/001
+++ b/tests/xfs/001
@@ -44,11 +44,11 @@ _do_bit_test()
 	bits="$2"
 
 	echo "testing $field with $bits bits"
-	$XFS_DB_PROG -x -c "inode $FILE_INO" -c "write $field 0" $SCRATCH_DEV
+	$XFS_DB_PROG -x -c "inode $FILE_INO" -c "write $field 0" `_scratch_xfs_db_options`
 	num=1
 	for n in `seq 0 1 $bits`; do
 		$XFS_DB_PROG -x -c "inode $FILE_INO" \
-			  -c "write $field $num" $SCRATCH_DEV
+			  -c "write $field $num" `_scratch_xfs_db_options`
 		let num=$num*2
 	done
 	echo
@@ -89,10 +89,10 @@ _do_bit_test "u.bmx[0].startoff" $BMBT_STARTOFF_BITLEN
 _do_bit_test "u.bmx[0].startblock" $BMBT_STARTBLOCK_BITLEN
 _do_bit_test "u.bmx[0].blockcount" $BMBT_BLOCKCOUNT_BITLEN
 # test setting the 32 bit generation number
-$XFS_DB_PROG -x -c "inode $FILE_INO" -c "write core.gen 0x5a" $SCRATCH_DEV
-$XFS_DB_PROG -x -c "inode $FILE_INO" -c "write core.gen 0xa5" $SCRATCH_DEV
-$XFS_DB_PROG -x -c "inode $FILE_INO" -c "write core.gen 0" $SCRATCH_DEV
-$XFS_DB_PROG -x -c "inode $FILE_INO" -c "write core.gen #5a5a" $SCRATCH_DEV
-$XFS_DB_PROG -x -c "inode $FILE_INO" -c "write core.gen #a5a5" $SCRATCH_DEV
+$XFS_DB_PROG -x -c "inode $FILE_INO" -c "write core.gen 0x5a" `_scratch_xfs_db_options`
+$XFS_DB_PROG -x -c "inode $FILE_INO" -c "write core.gen 0xa5" `_scratch_xfs_db_options`
+$XFS_DB_PROG -x -c "inode $FILE_INO" -c "write core.gen 0" `_scratch_xfs_db_options`
+$XFS_DB_PROG -x -c "inode $FILE_INO" -c "write core.gen #5a5a" `_scratch_xfs_db_options`
+$XFS_DB_PROG -x -c "inode $FILE_INO" -c "write core.gen #a5a5" `_scratch_xfs_db_options`
 status=0
 exit
diff --git a/tests/xfs/002 b/tests/xfs/002
index 6dfdd6c..e9805e9 100755
--- a/tests/xfs/002
+++ b/tests/xfs/002
@@ -62,8 +62,8 @@ _scratch_mkfs_xfs -m crc=0 -d size=128m >> $seqres.full 2>&1 || _fail "mkfs fail
 # Scribble past a couple V4 secondary superblocks to populate sb_crc
 # (We can't write to the structure member because it doesn't exist
 # on a v4 superblock, so we use the data type & "write fill")
-$XFS_DB_PROG -x -c "sb 1" -c "type data" -c "write fill 0xff 224 4" $SCRATCH_DEV
-$XFS_DB_PROG -x -c "sb 2" -c "type data" -c "write fill 0xff 224 4" $SCRATCH_DEV
+$XFS_DB_PROG -x -c "sb 1" -c "type data" -c "write fill 0xff 224 4" `_scratch_xfs_db_options`
+$XFS_DB_PROG -x -c "sb 2" -c "type data" -c "write fill 0xff 224 4" `_scratch_xfs_db_options`
 
 _scratch_mount
 
diff --git a/tests/xfs/070 b/tests/xfs/070
index e3a48b3..e0deb18 100755
--- a/tests/xfs/070
+++ b/tests/xfs/070
@@ -101,7 +101,7 @@ _scratch_mkfs | _filter_mkfs > /dev/null 2> $tmp.mkfs || _fail "mkfs failed"
 
 # corrupt the last secondary sb in the fs
 $XFS_DB_PROG -x -c "sb $((agcount - 1))" -c "type data" \
-	-c "write fill 0xff 0 512" $SCRATCH_DEV
+	-c "write fill 0xff 0 512" `_scratch_xfs_db_options`
 
 # attempt to repair
 _xfs_repair_noscan
diff --git a/tests/xfs/077 b/tests/xfs/077
index 007d05d..0ddb3f6 100755
--- a/tests/xfs/077
+++ b/tests/xfs/077
@@ -64,9 +64,9 @@ _test_uuid()
 	ACTION=$1
 	EXPECTED_UUID=$2
 
-	$XFS_DB_PROG -x -c "uuid $ACTION" $SCRATCH_DEV \
+	$XFS_DB_PROG -x -c "uuid $ACTION" `_scratch_xfs_db_options` \
 					| _filter_uuid $EXPECTED_UUID
-	NEW_UUID=`$XFS_DB_PROG -c "uuid"  $SCRATCH_DEV | awk '{print $NF}'`
+	NEW_UUID=`$XFS_DB_PROG -c "uuid"  $(_scratch_xfs_db_options) | awk '{print $NF}'`
 	_check_scratch_fs
 	_scratch_mount || _fail "Mount failed after UUID $ACTION"
 	_scratch_unmount
@@ -83,7 +83,7 @@ rm -f $seqres.full
 
 _scratch_mkfs_xfs -m crc=1 >> $seqres.full 2>&1 || _fail "mkfs failed"
 
-ORIG_UUID=`$XFS_DB_PROG -c "uuid" $SCRATCH_DEV | awk '{print $NF}'`
+ORIG_UUID=`$XFS_DB_PROG -c "uuid" $(_scratch_xfs_db_options) | awk '{print $NF}'`
 
 _scratch_mount
 # Put some stuff on the fs
diff --git a/tests/xfs/086 b/tests/xfs/086
index 143915b..57a5ad5 100755
--- a/tests/xfs/086
+++ b/tests/xfs/086
@@ -87,7 +87,7 @@ _scratch_xfs_repair -n >> $seqres.full 2>&1 || _fail "xfs_repair should not fail
 
 echo "+ corrupt image"
 for ag in $(seq 1 $((agcount - 1))) 0; do
-	$XFS_DB_PROG -x -c "agf ${ag}" -c "agf ${ag}" -c "stack" -c "blocktrash -x 32 -o +64 -y 4096 -z ${FUZZ_ARGS}" "${SCRATCH_DEV}" >> $seqres.full 2>&1
+	$XFS_DB_PROG -x -c "agf ${ag}" -c "agf ${ag}" -c "stack" -c "blocktrash -x 32 -o +64 -y 4096 -z ${FUZZ_ARGS}" `_scratch_xfs_db_options` >> $seqres.full 2>&1
 done
 
 # Try to append to files; this should fail
diff --git a/tests/xfs/087 b/tests/xfs/087
index 97c6680..2efe6f7 100755
--- a/tests/xfs/087
+++ b/tests/xfs/087
@@ -86,7 +86,7 @@ _scratch_xfs_repair -n >> $seqres.full 2>&1 || _fail "xfs_repair should not fail
 
 echo "+ corrupt image"
 for ag in $(seq 1 $((agcount - 1))) 0; do
-	$XFS_DB_PROG -x -c "agi ${ag}" -c "agi ${ag}" -c "stack" -c "blocktrash -x 32 -o +64 -y 4096 -z ${FUZZ_ARGS}" "${SCRATCH_DEV}" >> $seqres.full 2>&1
+	$XFS_DB_PROG -x -c "agi ${ag}" -c "agi ${ag}" -c "stack" -c "blocktrash -x 32 -o +64 -y 4096 -z ${FUZZ_ARGS}" `_scratch_xfs_db_options` >> $seqres.full 2>&1
 done
 
 echo "+ mount image"
diff --git a/tests/xfs/088 b/tests/xfs/088
index 18bf6ad..ac9c7da 100755
--- a/tests/xfs/088
+++ b/tests/xfs/088
@@ -86,7 +86,7 @@ _scratch_xfs_repair -n >> $seqres.full 2>&1 || _fail "xfs_repair should not fail
 
 echo "+ corrupt image"
 for ag in $(seq 1 $((agcount - 1))) 0; do
-	$XFS_DB_PROG -x -c "agfl ${ag}" -c "agfl ${ag}" -c "stack" -c "blocktrash -x 32 -o +64 -y 4096 -z ${FUZZ_ARGS}" "${SCRATCH_DEV}" >> $seqres.full 2>&1
+	$XFS_DB_PROG -x -c "agfl ${ag}" -c "agfl ${ag}" -c "stack" -c "blocktrash -x 32 -o +64 -y 4096 -z ${FUZZ_ARGS}" `_scratch_xfs_db_options` >> $seqres.full 2>&1
 done
 
 # Try to append to files; this should fail
diff --git a/tests/xfs/089 b/tests/xfs/089
index b6e512f..496a4cd 100755
--- a/tests/xfs/089
+++ b/tests/xfs/089
@@ -86,7 +86,7 @@ _scratch_xfs_repair -n >> $seqres.full 2>&1 || _fail "xfs_repair should not fail
 
 echo "+ corrupt image"
 for ag in $(seq 1 $((agcount - 1))) 0; do
-	$XFS_DB_PROG -x -c "agf ${ag}" -c "agf ${ag}" -c "addr bnoroot" -c "stack" -c "blocktrash -x 32 -y $((blksz * 8)) -z ${FUZZ_ARGS}" "${SCRATCH_DEV}" >> $seqres.full 2>&1
+	$XFS_DB_PROG -x -c "agf ${ag}" -c "agf ${ag}" -c "addr bnoroot" -c "stack" -c "blocktrash -x 32 -y $((blksz * 8)) -z ${FUZZ_ARGS}" `_scratch_xfs_db_options` >> $seqres.full 2>&1
 done
 
 # Try to append to files; this should fail
diff --git a/tests/xfs/091 b/tests/xfs/091
index f995d9c..3943474 100755
--- a/tests/xfs/091
+++ b/tests/xfs/091
@@ -86,7 +86,7 @@ _scratch_xfs_repair -n >> $seqres.full 2>&1 || _fail "xfs_repair should not fail
 
 echo "+ corrupt image"
 for ag in $(seq 1 $((agcount - 1))) 0; do
-	$XFS_DB_PROG -x -c "agf ${ag}" -c "agf ${ag}" -c "addr cntroot" -c "stack" -c "blocktrash -x 32 -y $((blksz * 8)) -z ${FUZZ_ARGS}" "${SCRATCH_DEV}" >> $seqres.full 2>&1
+	$XFS_DB_PROG -x -c "agf ${ag}" -c "agf ${ag}" -c "addr cntroot" -c "stack" -c "blocktrash -x 32 -y $((blksz * 8)) -z ${FUZZ_ARGS}" `_scratch_xfs_db_options` >> $seqres.full 2>&1
 done
 
 # Try to append to files; this should fail
diff --git a/tests/xfs/093 b/tests/xfs/093
index 7d4d9b8..790fdbe 100755
--- a/tests/xfs/093
+++ b/tests/xfs/093
@@ -86,7 +86,7 @@ _scratch_xfs_repair -n >> $seqres.full 2>&1 || _fail "xfs_repair should not fail
 
 echo "+ corrupt image"
 for ag in $(seq 1 $((agcount - 1))) 0; do
-	$XFS_DB_PROG -x -c "agi ${ag}" -c "agi ${ag}" -c "addr root" -c "stack" -c "blocktrash -x 32 -y $((blksz * 8)) -z ${FUZZ_ARGS}" "${SCRATCH_DEV}" >> $seqres.full 2>&1
+	$XFS_DB_PROG -x -c "agi ${ag}" -c "agi ${ag}" -c "addr root" -c "stack" -c "blocktrash -x 32 -y $((blksz * 8)) -z ${FUZZ_ARGS}" `_scratch_xfs_db_options` >> $seqres.full 2>&1
 done
 
 echo "+ mount image"
diff --git a/tests/xfs/097 b/tests/xfs/097
index f5a8178..4dac34f 100755
--- a/tests/xfs/097
+++ b/tests/xfs/097
@@ -89,7 +89,7 @@ _scratch_xfs_repair -n >> $seqres.full 2>&1 || _fail "xfs_repair should not fail
 
 echo "+ corrupt image"
 for ag in $(seq 1 $((agcount - 1))) 0; do
-	$XFS_DB_PROG -x -c "agi ${ag}" -c "agi ${ag}" -c "addr free_root" -c "stack" -c "blocktrash -x 32 -y $((blksz * 8)) -z ${FUZZ_ARGS}" "${SCRATCH_DEV}" >> $seqres.full 2>&1
+	$XFS_DB_PROG -x -c "agi ${ag}" -c "agi ${ag}" -c "addr free_root" -c "stack" -c "blocktrash -x 32 -y $((blksz * 8)) -z ${FUZZ_ARGS}" `_scratch_xfs_db_options` >> $seqres.full 2>&1
 done
 
 echo "+ mount image"
diff --git a/tests/xfs/098 b/tests/xfs/098
index d91d617..4851618 100755
--- a/tests/xfs/098
+++ b/tests/xfs/098
@@ -84,9 +84,9 @@ echo "+ check fs"
 _scratch_xfs_repair -n >> $seqres.full 2>&1 || _fail "xfs_repair should not fail"
 
 echo "+ corrupt image"
-logstart="$($XFS_DB_PROG -c 'sb 0' -c 'p' "${SCRATCH_DEV}" | grep '^logstart =' | cut -d ' ' -f 3)"
-logstart="$($XFS_DB_PROG -c "convert fsblock ${logstart} byte" "${SCRATCH_DEV}" | sed -e 's/^.*(\([0-9]*\).*$/\1/g')"
-logblocks="$(xfs_db -c 'sb 0' -c 'p' "${SCRATCH_DEV}" | grep '^logblocks =' | cut -d ' ' -f 3)"
+logstart="$($XFS_DB_PROG -c 'sb 0' -c 'p' `_scratch_xfs_db_options` | grep '^logstart =' | cut -d ' ' -f 3)"
+logstart="$($XFS_DB_PROG -c "convert fsblock ${logstart} byte" `_scratch_xfs_db_options` | sed -e 's/^.*(\([0-9]*\).*$/\1/g')"
+logblocks="$($XFS_DB_PROG -c 'sb 0' -c 'p' `_scratch_xfs_db_options` | grep '^logblocks =' | cut -d ' ' -f 3)"
 $XFS_IO_PROG -f -c "pwrite -S 0x62 ${logstart} $((logblocks * blksz))" "${SCRATCH_DEV}" >> $seqres.full
 
 echo "+ mount image"
diff --git a/tests/xfs/099 b/tests/xfs/099
index 36cf893..6c37160 100755
--- a/tests/xfs/099
+++ b/tests/xfs/099
@@ -78,7 +78,7 @@ echo "+ check dir"
 __populate_check_xfs_dir "${SCRATCH_DEV}" "${inode}" block
 
 echo "+ corrupt dir"
-$XFS_DB_PROG -x -c "inode ${inode}" -c 'dblock 0' -c "stack" -c "blocktrash -x 32 -y $((blksz * 8)) -z ${FUZZ_ARGS}" "${SCRATCH_DEV}" >> $seqres.full
+$XFS_DB_PROG -x -c "inode ${inode}" -c 'dblock 0' -c "stack" -c "blocktrash -x 32 -y $((blksz * 8)) -z ${FUZZ_ARGS}" `_scratch_xfs_db_options` >> $seqres.full
 
 echo "+ mount image"
 _scratch_mount
diff --git a/tests/xfs/100 b/tests/xfs/100
index 397c613..19ab43b 100755
--- a/tests/xfs/100
+++ b/tests/xfs/100
@@ -80,8 +80,8 @@ __populate_check_xfs_dir "${SCRATCH_DEV}" "${inode}" leaf
 echo "+ corrupt dir"
 loff=0
 while true; do
-	$XFS_DB_PROG -x -c "inode ${inode}" -c "dblock ${loff}" -c "stack" "${SCRATCH_DEV}" | grep -q 'file data block is unmapped' && break
-	$XFS_DB_PROG -x -c "inode ${inode}" -c "dblock ${loff}" -c "stack" -c "blocktrash -x 32 -y $((blksz * 8)) -z ${FUZZ_ARGS}" "${SCRATCH_DEV}" >> $seqres.full
+	$XFS_DB_PROG -x -c "inode ${inode}" -c "dblock ${loff}" -c "stack" `_scratch_xfs_db_options` | grep -q 'file data block is unmapped' && break
+	$XFS_DB_PROG -x -c "inode ${inode}" -c "dblock ${loff}" -c "stack" -c "blocktrash -x 32 -y $((blksz * 8)) -z ${FUZZ_ARGS}" `_scratch_xfs_db_options` >> $seqres.full
 	loff="$((loff + 1))"
 done
 
diff --git a/tests/xfs/101 b/tests/xfs/101
index 09af649..61a85d2 100755
--- a/tests/xfs/101
+++ b/tests/xfs/101
@@ -78,7 +78,7 @@ echo "+ check dir"
 __populate_check_xfs_dir "${SCRATCH_DEV}" "${inode}" leaf
 
 echo "+ corrupt dir"
-$XFS_DB_PROG -x -c "inode ${inode}" -c "dblock ${leaf_lblk}" -c "stack" -c "blocktrash -x 32 -y $((blksz * 8)) -z ${FUZZ_ARGS}" "${SCRATCH_DEV}" >> $seqres.full
+$XFS_DB_PROG -x -c "inode ${inode}" -c "dblock ${leaf_lblk}" -c "stack" -c "blocktrash -x 32 -y $((blksz * 8)) -z ${FUZZ_ARGS}" `_scratch_xfs_db_options` >> $seqres.full
 
 echo "+ mount image"
 _scratch_mount
diff --git a/tests/xfs/102 b/tests/xfs/102
index 5d1965e..8c4db3e 100755
--- a/tests/xfs/102
+++ b/tests/xfs/102
@@ -80,8 +80,8 @@ __populate_check_xfs_dir "${SCRATCH_DEV}" "${inode}" node
 echo "+ corrupt dir"
 loff=0
 while true; do
-	$XFS_DB_PROG -x -c "inode ${inode}" -c "dblock ${loff}" -c "stack" "${SCRATCH_DEV}" | grep -q 'file data block is unmapped' && break
-	$XFS_DB_PROG -x -c "inode ${inode}" -c "dblock ${loff}" -c "stack" -c "blocktrash -x 32 -y $((blksz * 8)) -z ${FUZZ_ARGS}" "${SCRATCH_DEV}" >> $seqres.full
+	$XFS_DB_PROG -x -c "inode ${inode}" -c "dblock ${loff}" -c "stack" `_scratch_xfs_db_options` | grep -q 'file data block is unmapped' && break
+	$XFS_DB_PROG -x -c "inode ${inode}" -c "dblock ${loff}" -c "stack" -c "blocktrash -x 32 -y $((blksz * 8)) -z ${FUZZ_ARGS}" `_scratch_xfs_db_options` >> $seqres.full
 	loff="$((loff + 1))"
 done
 
diff --git a/tests/xfs/105 b/tests/xfs/105
index 516639a..682e8d5 100755
--- a/tests/xfs/105
+++ b/tests/xfs/105
@@ -80,8 +80,8 @@ __populate_check_xfs_dir "${SCRATCH_DEV}" "${inode}" node
 echo "+ corrupt dir"
 loff="${leaf_lblk}"
 while true; do
-	$XFS_DB_PROG -x -c "inode ${inode}" -c "dblock ${loff}" -c "stack" "${SCRATCH_DEV}" | grep -q 'file data block is unmapped' && break
-	$XFS_DB_PROG -x -c "inode ${inode}" -c "dblock ${loff}" -c "stack" -c "blocktrash -x 32 -y $((blksz * 8)) -z ${FUZZ_ARGS}" "${SCRATCH_DEV}" >> $seqres.full
+	$XFS_DB_PROG -x -c "inode ${inode}" -c "dblock ${loff}" -c "stack" `_scratch_xfs_db_options` | grep -q 'file data block is unmapped' && break
+	$XFS_DB_PROG -x -c "inode ${inode}" -c "dblock ${loff}" -c "stack" -c "blocktrash -x 32 -y $((blksz * 8)) -z ${FUZZ_ARGS}" `_scratch_xfs_db_options` >> $seqres.full
 	loff="$((loff + 1))"
 done
 
diff --git a/tests/xfs/111 b/tests/xfs/111
index f6a41a8..4899020 100755
--- a/tests/xfs/111
+++ b/tests/xfs/111
@@ -64,7 +64,7 @@ INO=`ls -i $SCRATCH_MNT/512 | awk '{print $1}'`
 _scratch_unmount
 
 # Figure out where that middle inode starts
-BYTE=`$XFS_DB_PROG -c "convert inode $INO byte" $SCRATCH_DEV \
+BYTE=`$XFS_DB_PROG -c "convert inode $INO byte" `_scratch_xfs_db_options` \
 	| awk '{print $2}' | sed s/[\(\)]//g`
 
 echo Blat inode clusters
diff --git a/tests/xfs/112 b/tests/xfs/112
index aa7561e..8893e79 100755
--- a/tests/xfs/112
+++ b/tests/xfs/112
@@ -80,8 +80,8 @@ __populate_check_xfs_dir "${SCRATCH_DEV}" "${inode}" node
 echo "+ corrupt dir"
 loff="${node_lblk}"
 while true; do
-	$XFS_DB_PROG -x -c "inode ${inode}" -c "dblock ${loff}" -c "stack" "${SCRATCH_DEV}" | grep -q 'file data block is unmapped' && break
-	$XFS_DB_PROG -x -c "inode ${inode}" -c "dblock ${loff}" -c "stack" -c "blocktrash -x 32 -y $((blksz * 8)) -z ${FUZZ_ARGS}" "${SCRATCH_DEV}" >> $seqres.full
+	$XFS_DB_PROG -x -c "inode ${inode}" -c "dblock ${loff}" -c "stack" `_scratch_xfs_db_options` | grep -q 'file data block is unmapped' && break
+	$XFS_DB_PROG -x -c "inode ${inode}" -c "dblock ${loff}" -c "stack" -c "blocktrash -x 32 -y $((blksz * 8)) -z ${FUZZ_ARGS}" `_scratch_xfs_db_options` >> $seqres.full
 	loff="$((loff + 1))"
 done
 
diff --git a/tests/xfs/113 b/tests/xfs/113
index 8aa3395..e56927f 100755
--- a/tests/xfs/113
+++ b/tests/xfs/113
@@ -80,8 +80,8 @@ __populate_check_xfs_dir "${SCRATCH_DEV}" "${inode}" btree
 echo "+ corrupt dir"
 loff=0
 while true; do
-	$XFS_DB_PROG -x -c "inode ${inode}" -c "dblock ${loff}" -c "stack" "${SCRATCH_DEV}" | grep -q 'file data block is unmapped' && break
-	$XFS_DB_PROG -x -c "inode ${inode}" -c "dblock ${loff}" -c "stack" -c "blocktrash -x 32 -y $((blksz * 8)) -z ${FUZZ_ARGS}" "${SCRATCH_DEV}" >> $seqres.full
+	$XFS_DB_PROG -x -c "inode ${inode}" -c "dblock ${loff}" -c "stack" `_scratch_xfs_db_options` | grep -q 'file data block is unmapped' && break
+	$XFS_DB_PROG -x -c "inode ${inode}" -c "dblock ${loff}" -c "stack" -c "blocktrash -x 32 -y $((blksz * 8)) -z ${FUZZ_ARGS}" `_scratch_xfs_db_options` >> $seqres.full
 	loff="$((loff + 1))"
 done
 
diff --git a/tests/xfs/117 b/tests/xfs/117
index 27dafd9..3aeb555 100755
--- a/tests/xfs/117
+++ b/tests/xfs/117
@@ -85,7 +85,7 @@ _scratch_xfs_repair -n >> $seqres.full 2>&1 || _fail "xfs_repair should not fail
 
 echo "+ corrupt image"
 seq "${inode}" "$((inode + 64))" | while read ino; do
-	$XFS_DB_PROG -x -c "inode ${ino}" -c "stack" -c "blocktrash -x 32 -y $((blksz * 8)) -z ${FUZZ_ARGS}" "${SCRATCH_DEV}" >> $seqres.full 2>&1
+	$XFS_DB_PROG -x -c "inode ${ino}" -c "stack" -c "blocktrash -x 32 -y $((blksz * 8)) -z ${FUZZ_ARGS}" `_scratch_xfs_db_options` >> $seqres.full 2>&1
 done
 
 echo "+ mount image"
diff --git a/tests/xfs/120 b/tests/xfs/120
index 08a4615..b4b5f8b 100755
--- a/tests/xfs/120
+++ b/tests/xfs/120
@@ -75,7 +75,7 @@ echo "+ check fs"
 _scratch_xfs_repair -n >> $seqres.full 2>&1 || _fail "xfs_repair should not fail"
 
 echo "+ corrupt image"
-$XFS_DB_PROG -x -c "inode ${inode}" -c "addr u.bmbt.ptrs[1]" -c "addr u3.bmbt.ptrs[1]" -c "stack" -c "blocktrash -x 32 -y $((blksz * 8)) -z ${FUZZ_ARGS}" "${SCRATCH_DEV}" >> $seqres.full
+$XFS_DB_PROG -x -c "inode ${inode}" -c "addr u.bmbt.ptrs[1]" -c "addr u3.bmbt.ptrs[1]" -c "stack" -c "blocktrash -x 32 -y $((blksz * 8)) -z ${FUZZ_ARGS}" `_scratch_xfs_db_options` >> $seqres.full
 
 echo "+ mount image"
 _scratch_mount
diff --git a/tests/xfs/123 b/tests/xfs/123
index a746d5c..bc6cb64 100755
--- a/tests/xfs/123
+++ b/tests/xfs/123
@@ -74,7 +74,7 @@ echo "+ check fs"
 _scratch_xfs_repair -n >> $seqres.full 2>&1 || _fail "xfs_repair should not fail"
 
 echo "+ corrupt image"
-$XFS_DB_PROG -x -c "inode ${inode}" -c "dblock 0" -c "stack" -c "blocktrash -x 32 -o 256 -y $((blksz * 8)) -z ${FUZZ_ARGS}" "${SCRATCH_DEV}" >> $seqres.full
+$XFS_DB_PROG -x -c "inode ${inode}" -c "dblock 0" -c "stack" -c "blocktrash -x 32 -o 256 -y $((blksz * 8)) -z ${FUZZ_ARGS}" `_scratch_xfs_db_options` >> $seqres.full
 
 echo "+ mount image"
 _scratch_mount
diff --git a/tests/xfs/124 b/tests/xfs/124
index 239c246..f436ba5 100755
--- a/tests/xfs/124
+++ b/tests/xfs/124
@@ -77,13 +77,13 @@ echo "+ check fs"
 _scratch_xfs_repair -n >> $seqres.full 2>&1 || _fail "xfs_repair should not fail"
 
 echo "+ check xattr"
-$XFS_DB_PROG -x -c "inode ${inode}" -c "bmap" "${SCRATCH_DEV}" >> $seqres.full
-$XFS_DB_PROG -x -c "inode ${inode}" -c "ablock 0" -c "stack" "${SCRATCH_DEV}" | grep -q 'file attr block is unmapped' && _fail "failed to create a block xattr (data)"
-$XFS_DB_PROG -x -c "inode ${inode}" -c "ablock ${leaf_lblk}" -c "stack" "${SCRATCH_DEV}" | grep -q 'file attr block is unmapped' || _fail "failed to create a block xattr (leaf)"
-$XFS_DB_PROG -x -c "inode ${inode}" -c "ablock ${node_lblk}" -c "stack" "${SCRATCH_DEV}" | grep -q 'file attr block is unmapped' || _fail "failed to create a block xattr (free)"
+$XFS_DB_PROG -x -c "inode ${inode}" -c "bmap" `_scratch_xfs_db_options` >> $seqres.full
+$XFS_DB_PROG -x -c "inode ${inode}" -c "ablock 0" -c "stack" `_scratch_xfs_db_options` | grep -q 'file attr block is unmapped' && _fail "failed to create a block xattr (data)"
+$XFS_DB_PROG -x -c "inode ${inode}" -c "ablock ${leaf_lblk}" -c "stack" `_scratch_xfs_db_options` | grep -q 'file attr block is unmapped' || _fail "failed to create a block xattr (leaf)"
+$XFS_DB_PROG -x -c "inode ${inode}" -c "ablock ${node_lblk}" -c "stack" `_scratch_xfs_db_options` | grep -q 'file attr block is unmapped' || _fail "failed to create a block xattr (free)"
 
 echo "+ corrupt xattr"
-$XFS_DB_PROG -x -c "inode ${inode}" -c 'ablock 0' -c "stack" -c "blocktrash -x 32 -y $((blksz * 8)) -z ${FUZZ_ARGS}" "${SCRATCH_DEV}" >> $seqres.full
+$XFS_DB_PROG -x -c "inode ${inode}" -c 'ablock 0' -c "stack" -c "blocktrash -x 32 -y $((blksz * 8)) -z ${FUZZ_ARGS}" `_scratch_xfs_db_options` >> $seqres.full
 
 echo "+ mount image"
 _scratch_mount
diff --git a/tests/xfs/125 b/tests/xfs/125
index cf61e02..1779152 100755
--- a/tests/xfs/125
+++ b/tests/xfs/125
@@ -78,12 +78,12 @@ echo "+ check fs"
 _scratch_xfs_repair -n >> $seqres.full 2>&1 || _fail "xfs_repair should not fail"
 
 echo "+ check xattr"
-$XFS_DB_PROG -x -c "inode ${inode}" -c "bmap" "${SCRATCH_DEV}" >> $seqres.full
-$XFS_DB_PROG -x -c "inode ${inode}" -c "ablock 0" -c "stack" "${SCRATCH_DEV}" | grep -q 'file attr block is unmapped' && _fail "failed to create a leaf xattr (index)"
-$XFS_DB_PROG -x -c "inode ${inode}" -c "ablock 1" -c "stack" "${SCRATCH_DEV}" | grep -q 'file attr block is unmapped' && _fail "failed to create a leaf xattr (data)"
+$XFS_DB_PROG -x -c "inode ${inode}" -c "bmap" `_scratch_xfs_db_options` >> $seqres.full
+$XFS_DB_PROG -x -c "inode ${inode}" -c "ablock 0" -c "stack" `_scratch_xfs_db_options` | grep -q 'file attr block is unmapped' && _fail "failed to create a leaf xattr (index)"
+$XFS_DB_PROG -x -c "inode ${inode}" -c "ablock 1" -c "stack" `_scratch_xfs_db_options` | grep -q 'file attr block is unmapped' && _fail "failed to create a leaf xattr (data)"
 
 echo "+ corrupt xattr"
-$XFS_DB_PROG -x -c "inode ${inode}" -c 'ablock 0' -c "stack" -c "blocktrash -x 32 -o +32 -y $((blksz * 8)) -z ${FUZZ_ARGS}" "${SCRATCH_DEV}" >> $seqres.full
+$XFS_DB_PROG -x -c "inode ${inode}" -c 'ablock 0' -c "stack" -c "blocktrash -x 32 -o +32 -y $((blksz * 8)) -z ${FUZZ_ARGS}" `_scratch_xfs_db_options` >> $seqres.full
 
 echo "+ mount image"
 _scratch_mount
diff --git a/tests/xfs/126 b/tests/xfs/126
index ebe84fc..107ff79 100755
--- a/tests/xfs/126
+++ b/tests/xfs/126
@@ -78,15 +78,15 @@ echo "+ check fs"
 _scratch_xfs_repair -n >> $seqres.full 2>&1 || _fail "xfs_repair should not fail"
 
 echo "+ check xattr"
-$XFS_DB_PROG -x -c "inode ${inode}" -c "bmap" "${SCRATCH_DEV}" >> $seqres.full
-$XFS_DB_PROG -x -c "inode ${inode}" -c "ablock 0" -c "stack" "${SCRATCH_DEV}" | grep -q 'file attr block is unmapped' && _fail "failed to create a leaf xattr (index)"
-$XFS_DB_PROG -x -c "inode ${inode}" -c "ablock 1" -c "stack" "${SCRATCH_DEV}" | grep -q 'file attr block is unmapped' && _fail "failed to create a leaf xattr (data)"
+$XFS_DB_PROG -x -c "inode ${inode}" -c "bmap" `_scratch_xfs_db_options` >> $seqres.full
+$XFS_DB_PROG -x -c "inode ${inode}" -c "ablock 0" -c "stack" `_scratch_xfs_db_options` | grep -q 'file attr block is unmapped' && _fail "failed to create a leaf xattr (index)"
+$XFS_DB_PROG -x -c "inode ${inode}" -c "ablock 1" -c "stack" `_scratch_xfs_db_options` | grep -q 'file attr block is unmapped' && _fail "failed to create a leaf xattr (data)"
 
 echo "+ corrupt xattr"
 loff=1
 while true; do
-	$XFS_DB_PROG -x -c "inode ${inode}" -c "ablock ${loff}" -c "stack" "${SCRATCH_DEV}" | grep -q 'file attr block is unmapped' && break
-	$XFS_DB_PROG -x -c "inode ${inode}" -c "ablock ${loff}" -c "stack" -c "blocktrash -x 32 -y $((blksz * 8)) -z ${FUZZ_ARGS}" "${SCRATCH_DEV}" >> $seqres.full
+	$XFS_DB_PROG -x -c "inode ${inode}" -c "ablock ${loff}" -c "stack" `_scratch_xfs_db_options` | grep -q 'file attr block is unmapped' && break
+	$XFS_DB_PROG -x -c "inode ${inode}" -c "ablock ${loff}" -c "stack" -c "blocktrash -x 32 -y $((blksz * 8)) -z ${FUZZ_ARGS}" `_scratch_xfs_db_options` >> $seqres.full
 	loff="$((loff + 1))"
 done
 
diff --git a/tests/xfs/130 b/tests/xfs/130
index 554d078..4078809 100755
--- a/tests/xfs/130
+++ b/tests/xfs/130
@@ -75,7 +75,7 @@ echo "+ corrupt image"
 seq 0 $((agcount - 1)) | while read ag; do
 	$XFS_DB_PROG -x -c "agf ${ag}" -c "agf ${ag}" -c "addr refcntroot" \
 		-c "stack" -c "blocktrash -x 4096 -y 4096 -z -n 8 -3" \
-		"${SCRATCH_DEV}" >> "$seqres.full" 2>&1
+		`_scratch_xfs_db_options` >> "$seqres.full" 2>&1
 done
 
 echo "+ mount image"
diff --git a/tests/xfs/135 b/tests/xfs/135
index 0487f0e..8cc8249 100755
--- a/tests/xfs/135
+++ b/tests/xfs/135
@@ -60,7 +60,7 @@ _scratch_mkfs >> $seqres.full 2>&1 || _fail "mkfs failed"
 # (the log is zeroed when cycle == 1).
 for i in 16 32 64 128 256; do
 	lsunit=$((i * 1024))
-	$XFS_DB_PROG -x -c "logformat -c 3 -s $lsunit" $SCRATCH_DEV | \
+	$XFS_DB_PROG -x -c "logformat -c 3 -s $lsunit" `_scratch_xfs_db_options` | \
 		tee -a $seqres.full
 	# don't redirect error output so it causes test failure
 	$XFS_LOGPRINT_PROG $SCRATCH_DEV >> $seqres.full
diff --git a/tests/xfs/137 b/tests/xfs/137
index dec9fc9..aab306b 100755
--- a/tests/xfs/137
+++ b/tests/xfs/137
@@ -58,7 +58,7 @@ _require_xfs_db_command "logformat"
 _scratch_mkfs >> $seqres.full 2>&1 || _fail "mkfs failed"
 
 # push the log cycle ahead so we have room to move it backwards later
-$XFS_DB_PROG -x -c "logformat -c 3" $SCRATCH_DEV >> $seqres.full 2>&1
+$XFS_DB_PROG -x -c "logformat -c 3" `_scratch_xfs_db_options` >> $seqres.full 2>&1
 
 # do some work on the fs to update metadata LSNs
 _scratch_mount
@@ -68,13 +68,13 @@ _scratch_unmount
 # Reformat to the current cycle and try to mount. This fails in most cases
 # because the sb LSN is ahead of the current LSN. If it doesn't fail, push the
 # cycle back further and try again.
-$XFS_DB_PROG -x -c "logformat" $SCRATCH_DEV >> $seqres.full 2>&1
+$XFS_DB_PROG -x -c "logformat" `_scratch_xfs_db_options` >> $seqres.full 2>&1
 _scratch_mount >> $seqres.full 2>&1
 if [ $? != 0 ]; then
 	echo mount failure detected
 else
 	_scratch_unmount
-	$XFS_DB_PROG -x -c "logformat -c 2" $SCRATCH_DEV >> $seqres.full 2>&1
+	$XFS_DB_PROG -x -c "logformat -c 2" `_scratch_xfs_db_options` >> $seqres.full 2>&1
 	_scratch_mount >> $seqres.full 2>&1 || echo mount failure detected
 fi
 
diff --git a/tests/xfs/179 b/tests/xfs/179
index 18459cb..8cb3ddd 100755
--- a/tests/xfs/179
+++ b/tests/xfs/179
@@ -67,9 +67,9 @@ _cp_reflink $testdir/file1 $testdir/file2 >> $seqres.full
 echo "Change reference count"
 _scratch_unmount
 echo "set refcount to -4" >> $seqres.full
-$XFS_DB_PROG -x -c 'agf 0' -c 'addr refcntroot' -c 'write recs[1].refcount 4294967292' $SCRATCH_DEV >> $seqres.full
+$XFS_DB_PROG -x -c 'agf 0' -c 'addr refcntroot' -c 'write recs[1].refcount 4294967292' `_scratch_xfs_db_options` >> $seqres.full
 echo "check refcount after setting to -4" >> $seqres.full
-$XFS_DB_PROG -c 'agf 0' -c 'addr refcntroot' -c 'p recs[1]' $SCRATCH_DEV >> $seqres.full
+$XFS_DB_PROG -c 'agf 0' -c 'addr refcntroot' -c 'p recs[1]' `_scratch_xfs_db_options` >> $seqres.full
 _scratch_mount >> $seqres.full
 
 echo "Reflink the overlinked file"
@@ -82,7 +82,7 @@ _cp_reflink $testdir/file1 $testdir/file7 >> $seqres.full
 echo "Check scratch fs"
 _scratch_unmount
 echo "check refcount after reflinking 5 more times" >> $seqres.full
-$XFS_DB_PROG -c 'agf 0' -c 'addr refcntroot' -c 'p recs[1]' $SCRATCH_DEV >> $seqres.full
+$XFS_DB_PROG -c 'agf 0' -c 'addr refcntroot' -c 'p recs[1]' `_scratch_xfs_db_options` >> $seqres.full
 _scratch_mount >> $seqres.full
 
 echo "CoW a couple files"
@@ -93,7 +93,7 @@ _pwrite_byte 0x62 0 $blksz $testdir/file7 >> $seqres.full
 echo "Check scratch fs"
 _scratch_unmount
 echo "check refcount after cowing 3 files" >> $seqres.full
-$XFS_DB_PROG -c 'agf 0' -c 'addr refcntroot' -c 'p recs[1]' $SCRATCH_DEV >> $seqres.full
+$XFS_DB_PROG -c 'agf 0' -c 'addr refcntroot' -c 'p recs[1]' `_scratch_xfs_db_options` >> $seqres.full
 _scratch_mount >> $seqres.full
 
 echo "Remove reflinked files"
@@ -102,7 +102,7 @@ rm -rf $testdir/file*
 echo "Check scratch fs"
 _scratch_unmount
 echo "check refcount after removing all files" >> $seqres.full
-$XFS_DB_PROG -c 'agf 0' -c 'addr refcntroot' -c 'p recs[1]' $SCRATCH_DEV >> $seqres.full
+$XFS_DB_PROG -c 'agf 0' -c 'addr refcntroot' -c 'p recs[1]' `_scratch_xfs_db_options` >> $seqres.full
 _scratch_xfs_repair -o force_geometry -n >> $seqres.full 2>&1
 res=$?
 if [ $res -eq 0 ]; then
diff --git a/tests/xfs/186 b/tests/xfs/186
index 192a8c8..347db0d 100755
--- a/tests/xfs/186
+++ b/tests/xfs/186
@@ -98,8 +98,8 @@ _print_inode()
 {
 	echo ""
 	echo "================================="
-	$XFS_DB_PROG -c "version" $SCRATCH_DEV 2>&1 | _filter_version
-	$XFS_DB_PROG -c "inode $inum" -c p $SCRATCH_DEV 2>&1 | _filter_inode
+	$XFS_DB_PROG -c "version" `_scratch_xfs_db_options` 2>&1 | _filter_version
+	$XFS_DB_PROG -c "inode $inum" -c p `_scratch_xfs_db_options` 2>&1 | _filter_inode
 	echo "================================="
 }
 
@@ -136,7 +136,7 @@ _changeto_attr1()
 	echo ""
 	echo "Try setting attr1 by db"
 	echo ""
-	$XFS_DB_PROG -x -c "version attr1" $SCRATCH_DEV | _filter_version
+	$XFS_DB_PROG -x -c "version attr1" `_scratch_xfs_db_options` | _filter_version
 }
 
 # get standard environment, filters and checks
@@ -173,7 +173,7 @@ fi
 
 # set inum to root dir ino
 # we'll add in dirents and EAs into the root directory
-eval `$XFS_DB_PROG -r -c 'sb 0' -c 'p rootino' $SCRATCH_DEV | $SED_PROG 's/ //g'`
+eval `$XFS_DB_PROG -r -c 'sb 0' -c 'p rootino' `_scratch_xfs_db_options` | $SED_PROG 's/ //g'`
 inum=$rootino
 fork_dir=$SCRATCH_MNT
 _print_inode
diff --git a/tests/xfs/187 b/tests/xfs/187
index 836b924..68a00c9 100755
--- a/tests/xfs/187
+++ b/tests/xfs/187
@@ -76,7 +76,7 @@ export MKFS_LAZY="-m crc=0 -l lazy-count=1 -i projid32bit=0"
 # Make sure that when we think we are testing with morebits off
 # that we really are.
 _scratch_mkfs -i attr=1 $MKFS_NO_LAZY  >/dev/null 2>&1
-$XFS_DB_PROG -c version $SCRATCH_DEV 2>&1 >$tmp.db
+$XFS_DB_PROG -c version `_scratch_xfs_db_options` 2>&1 >$tmp.db
 if grep -i morebits $tmp.db
 then
 	echo ""
@@ -91,13 +91,13 @@ echo ""
 echo "attr2 fs"
 echo ""
 _scratch_mkfs -i attr=2 $MKFS_NO_LAZY >/dev/null 2>&1
-$XFS_DB_PROG -r -c version $SCRATCH_DEV 2>&1 | _filter_version
+$XFS_DB_PROG -r -c version `_scratch_xfs_db_options` 2>&1 | _filter_version
 echo ""
 echo "noattr2 fs"
 echo ""
 _scratch_mount -o noattr2
 $UMOUNT_PROG $SCRATCH_MNT
-$XFS_DB_PROG -r -c version $SCRATCH_DEV 2>&1 | _filter_version
+$XFS_DB_PROG -r -c version `_scratch_xfs_db_options` 2>&1 | _filter_version
 
 # adding an EA will ensure the ATTR1 flag is turned on
 echo ""
@@ -106,7 +106,7 @@ echo ""
 echo "attr2 fs"
 echo ""
 _scratch_mkfs -i attr=2 $MKFS_NO_LAZY >/dev/null 2>&1
-$XFS_DB_PROG -r -c version $SCRATCH_DEV 2>&1 | _filter_version
+$XFS_DB_PROG -r -c version `_scratch_xfs_db_options` 2>&1 | _filter_version
 echo ""
 echo "noattr2 fs"
 echo ""
@@ -117,7 +117,7 @@ $SETFATTR_PROG -n user.test -v 0xbabe testfile
 $GETFATTR_PROG testfile
 cd $here
 $UMOUNT_PROG $SCRATCH_MNT
-$XFS_DB_PROG -r -c version $SCRATCH_DEV 2>&1 | _filter_version
+$XFS_DB_PROG -r -c version `_scratch_xfs_db_options` 2>&1 | _filter_version
 
 echo ""
 echo "*** 3. test noattr2 mount and lazy sb ***"
@@ -126,7 +126,7 @@ echo ""
 echo "attr2 fs"
 echo ""
 _scratch_mkfs -i attr=2 $MKFS_LAZY >/dev/null 2>&1
-$XFS_DB_PROG -r -c version $SCRATCH_DEV 2>&1 | _filter_version
+$XFS_DB_PROG -r -c version `_scratch_xfs_db_options` 2>&1 | _filter_version
 echo ""
 echo "noattr2 fs"
 echo ""
@@ -135,7 +135,7 @@ cd $SCRATCH_MNT
 touch testfile
 cd $here
 $UMOUNT_PROG $SCRATCH_MNT
-$XFS_DB_PROG -r -c version $SCRATCH_DEV 2>&1 | _filter_version
+$XFS_DB_PROG -r -c version `_scratch_xfs_db_options` 2>&1 | _filter_version
 
 # success, all done
 status=0
diff --git a/tests/xfs/235 b/tests/xfs/235
index ef51d22..1329c28 100755
--- a/tests/xfs/235
+++ b/tests/xfs/235
@@ -73,7 +73,7 @@ echo "+ corrupt image"
 seq 0 $((agcount - 1)) | while read ag; do
 	$XFS_DB_PROG -x -c "agf ${ag}" -c "agf ${ag}" -c "addr rmaproot" \
 		-c "stack" -c "blocktrash -x 4096 -y 4096 -z -n 8 -3" \
-		${SCRATCH_DEV} >> $seqres.full 2>&1
+		`_scratch_xfs_db_options` >> $seqres.full 2>&1
 done
 
 echo "+ mount image"
diff --git a/tests/xfs/287 b/tests/xfs/287
index aca410a..14fa51b 100755
--- a/tests/xfs/287
+++ b/tests/xfs/287
@@ -49,7 +49,7 @@ _print_projid()
 	$XFS_DB_PROG -r -c "inode $1" \
 		-c "print core.projid_lo" \
 		-c "print core.projid_hi" \
-		$SCRATCH_DEV
+		`_scratch_xfs_db_options`
 }
 
 # real QA test starts here
diff --git a/tests/xfs/298 b/tests/xfs/298
index bb836a0..18781ad 100755
--- a/tests/xfs/298
+++ b/tests/xfs/298
@@ -82,7 +82,7 @@ while [ $SIZE -lt 1024 ];do
 # umount and check the number of extents on the inode. Should be 0.
 	cd
 	_scratch_unmount >/dev/null 2>&1
-	$XFS_DB_PROG  -c "inode $inode" -c "p core.nextents" $SCRATCH_DEV
+	$XFS_DB_PROG  -c "inode $inode" -c "p core.nextents" `_scratch_xfs_db_options`
 
 	let SIZE=$SIZE+32
 done

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [PATCH 07/13] xfs: test swapext with reflink
  2016-08-25 23:28 ` Darrick J. Wong
@ 2016-08-25 23:29   ` Darrick J. Wong
  -1 siblings, 0 replies; 39+ messages in thread
From: Darrick J. Wong @ 2016-08-25 23:29 UTC (permalink / raw)
  To: david, eguan, darrick.wong; +Cc: linux-xfs, fstests, xfs

Add a few tests to stress the new swapext code for reflink and rmap.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 tests/xfs/873     |  108 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/xfs/873.out |    6 +++
 tests/xfs/874     |   97 ++++++++++++++++++++++++++++++++++++++++++++++++
 tests/xfs/874.out |   10 +++++
 tests/xfs/875     |  102 ++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/xfs/875.out |   12 ++++++
 tests/xfs/group   |    3 +
 7 files changed, 338 insertions(+)
 create mode 100755 tests/xfs/873
 create mode 100644 tests/xfs/873.out
 create mode 100755 tests/xfs/874
 create mode 100644 tests/xfs/874.out
 create mode 100755 tests/xfs/875
 create mode 100644 tests/xfs/875.out


diff --git a/tests/xfs/873 b/tests/xfs/873
new file mode 100755
index 0000000..75334c6
--- /dev/null
+++ b/tests/xfs/873
@@ -0,0 +1,108 @@
+#! /bin/bash
+# FS QA Test No. 873
+#
+# See how well xfs_fsr handles "defragging" a file with a hojillion extents.
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2016, Oracle and/or its affiliates.  All Rights Reserved.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it would be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write the Free Software Foundation,
+# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+#-----------------------------------------------------------------------
+
+seq=`basename "$0"`
+seqres="$RESULT_DIR/$seq"
+echo "QA output created by $seq"
+
+here=`pwd`
+tmp=/tmp/$$
+status=1    # failure is the default!
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+_cleanup()
+{
+	cd /
+	rm -rf "$tmp".*
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+. ./common/attr
+. ./common/reflink
+
+# real QA test starts here
+_supported_os Linux
+_supported_fs xfs
+_require_scratch_reflink
+_require_cp_reflink
+_require_test_program "punch-alternating"
+_require_command "$XFS_FSR_PROG" "xfs_fsr"
+
+rm -f "$seqres.full"
+
+echo "Format and mount"
+_scratch_mkfs > "$seqres.full" 2>&1
+_scratch_mount >> "$seqres.full" 2>&1
+
+testdir="$SCRATCH_MNT/test-$seq"
+mkdir "$testdir"
+
+# Setup for 16000 blocks, but we'll accept stress testing down to
+# 2^10 blocks... that should be plenty for anyone.
+fnr=$((12 + LOAD_FACTOR))
+free_blocks=$(stat -f -c '%a' "$testdir")
+blksz=$(stat -f -c '%S' "$testdir")
+space_avail=$((free_blocks * blksz))
+calc_space() {
+	blocks_needed=$(( 2 ** (fnr + 1) ))
+	space_needed=$((blocks_needed * blksz * 5 / 4))
+}
+calc_space
+while test $space_needed -gt $space_avail; do
+	fnr=$((fnr - 1))
+	calc_space
+done
+test $fnr -lt 10 && _notrun "Insufficient space for stress test; would only create $blocks_needed extents."
+bytes=$((blocks_needed * blksz))
+
+echo "Create a many-block file"
+echo "creating $blocks_needed blocks..." >> "$seqres.full"
+_pwrite_byte 0x62 0 $blksz $testdir/file0 >> $seqres.full
+"$XFS_IO_PROG" -f -c "pwrite -S 0x61 -b 4194304 0 $bytes" "$testdir/file1" >> "$seqres.full"
+echo "punching..." >> "$seqres.full"
+"$here/src/punch-alternating" "$testdir/file1" >> "$seqres.full"
+seq 0 2 $((2 ** (fnr + 1) )) | while read lblk; do
+	_reflink_range $testdir/file0 0 $testdir/file1 $((lblk * blksz)) $blksz >> $seqres.full
+done
+echo "...done" >> "$seqres.full"
+_scratch_cycle_mount
+
+echo "Reflink the big file"
+echo "reflinking $((blocks_needed / 2)) blocks, $((bytes / 2)) bytes" >> "$seqres.full"
+_reflink_range "$testdir/file1" 0 "$testdir/file2" 0 $bytes >> "$seqres.full"
+
+echo "Defrag the big file"
+old_nextents=$(_count_extents $testdir/file1)
+$XFS_FSR_PROG -v -d $testdir/file1 >> $seqres.full
+new_nextents=$(_count_extents $testdir/file1)
+
+echo "Check extent count"
+$XFS_IO_PROG -c 'stat -v' $testdir/file1 >> $seqres.full
+$XFS_IO_PROG -c 'stat -v' $testdir/file2 >> $seqres.full
+echo "extents: $old_nextents -> $new_nextents" >> $seqres.full
+test $old_nextents -gt $new_nextents || echo "FAIL: $old_nextents -> $new_nextents"
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/873.out b/tests/xfs/873.out
new file mode 100644
index 0000000..9dddf55
--- /dev/null
+++ b/tests/xfs/873.out
@@ -0,0 +1,6 @@
+QA output created by 873
+Format and mount
+Create a many-block file
+Reflink the big file
+Defrag the big file
+Check extent count
diff --git a/tests/xfs/874 b/tests/xfs/874
new file mode 100755
index 0000000..2e799ce
--- /dev/null
+++ b/tests/xfs/874
@@ -0,0 +1,97 @@
+#! /bin/bash
+# FS QA Test No. 874
+#
+# Ensure that xfs_fsr handles errors correctly while defragging files.
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2016, Oracle and/or its affiliates.  All Rights Reserved.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it would be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write the Free Software Foundation,
+# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+#-----------------------------------------------------------------------
+
+seq=`basename "$0"`
+seqres="$RESULT_DIR/$seq"
+echo "QA output created by $seq"
+
+here=`pwd`
+tmp=/tmp/$$
+status=1    # failure is the default!
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+_cleanup()
+{
+	cd /
+	rm -rf "$tmp".*
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+. ./common/attr
+. ./common/reflink
+. ./common/inject
+
+# real QA test starts here
+_supported_os Linux
+_supported_fs xfs
+_require_scratch_reflink
+_require_cp_reflink
+_require_command "$XFS_FSR_PROG" "xfs_fsr"
+_require_xfs_io_error_injection "bmap_finish_one"
+_require_xfs_scratch_rmapbt
+
+rm -f "$seqres.full"
+
+echo "Format and mount"
+_scratch_mkfs > "$seqres.full" 2>&1
+_scratch_mount >> "$seqres.full" 2>&1
+
+testdir="$SCRATCH_MNT/test-$seq"
+blksz=65536
+blks=3
+mkdir "$testdir"
+
+echo "Create a many-block file"
+_pwrite_byte 0x62 0 $((blksz * blks)) $testdir/file1 >> $seqres.full
+_pwrite_byte 0x63 0 $blksz $testdir/file2 >> $seqres.full
+_reflink_range $testdir/file2 0 $testdir/file1 $blksz $blksz >> $seqres.full
+_scratch_cycle_mount
+$XFS_IO_PROG -c 'bmap -v' $testdir/file1 >> $seqres.full
+
+echo "Inject error"
+_scratch_inject_error "bmap_finish_one"
+
+echo "Defrag the file"
+old_nextents=$(_count_extents $testdir/file1)
+$XFS_FSR_PROG -v -d $testdir/file1 >> $seqres.full 2>&1
+
+echo "FS should be shut down, touch will fail"
+touch $SCRATCH_MNT/badfs 2>&1 | _filter_scratch
+
+echo "Remount to replay log" | tee /dev/ttyprintk
+_scratch_inject_logprint >> $seqres.full
+new_nextents=$(_count_extents $testdir/file1)
+
+echo "Check extent count" | tee /dev/ttyprintk
+$XFS_IO_PROG -c 'stat -v' $testdir/file1 >> $seqres.full
+$XFS_IO_PROG -c 'stat -v' $testdir/file2 >> $seqres.full
+echo "extents: $old_nextents -> $new_nextents" >> $seqres.full
+
+echo "FS should be online, touch should succeed"
+touch $SCRATCH_MNT/goodfs
+$XFS_IO_PROG -c 'bmap -v' $testdir/file1 >> $seqres.full
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/874.out b/tests/xfs/874.out
new file mode 100644
index 0000000..dbc0f49
--- /dev/null
+++ b/tests/xfs/874.out
@@ -0,0 +1,10 @@
+QA output created by 874
+Format and mount
+Create a many-block file
+Inject error
+Defrag the file
+FS should be shut down, touch will fail
+touch: cannot touch 'SCRATCH_MNT/badfs': Input/output error
+Remount to replay log
+Check extent count
+FS should be online, touch should succeed
diff --git a/tests/xfs/875 b/tests/xfs/875
new file mode 100755
index 0000000..d579ba1
--- /dev/null
+++ b/tests/xfs/875
@@ -0,0 +1,102 @@
+#! /bin/bash
+# FS QA Test No. 875
+#
+# Ensure that xfs_fsr handles quota correctly while defragging files.
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2016, Oracle and/or its affiliates.  All Rights Reserved.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it would be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write the Free Software Foundation,
+# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+#-----------------------------------------------------------------------
+
+seq=`basename "$0"`
+seqres="$RESULT_DIR/$seq"
+echo "QA output created by $seq"
+
+here=`pwd`
+tmp=/tmp/$$
+status=1    # failure is the default!
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+_cleanup()
+{
+	cd /
+	rm -rf "$tmp".*
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+. ./common/attr
+. ./common/reflink
+. ./common/quota
+
+# real QA test starts here
+_supported_os Linux
+_supported_fs xfs
+_require_scratch_reflink
+_require_cp_reflink
+_require_command "$XFS_FSR_PROG" "xfs_fsr"
+_require_quota
+_require_nobody
+
+do_repquota()
+{
+	repquota $SCRATCH_MNT | egrep '^(fsgqa|root|nobody)'
+}
+
+rm -f "$seqres.full"
+
+echo "Format and mount"
+_scratch_mkfs > "$seqres.full" 2>&1
+export MOUNT_OPTIONS="-o usrquota,grpquota $MOUNT_OPTIONS"
+_scratch_mount >> "$seqres.full" 2>&1
+quotacheck -u -g $SCRATCH_MNT 2> /dev/null
+quotaon $SCRATCH_MNT 2> /dev/null
+
+testdir="$SCRATCH_MNT/test-$seq"
+blksz=65536
+blks=3
+mkdir "$testdir"
+
+echo "Create a many-block file"
+touch $testdir/file1
+chown nobody $testdir/file1
+touch $testdir/file2
+chown nobody $testdir/file2
+_pwrite_byte 0x62 0 $((blksz * blks)) $testdir/file1 >> $seqres.full
+_pwrite_byte 0x63 0 $blksz $testdir/file2 >> $seqres.full
+_reflink_range $testdir/file2 0 $testdir/file1 $blksz $blksz >> $seqres.full
+do_repquota
+_scratch_cycle_mount
+
+echo "Defrag the file"
+old_nextents=$(_count_extents $testdir/file1)
+$XFS_FSR_PROG -v -d $testdir/file1 >> $seqres.full
+new_nextents=$(_count_extents $testdir/file1)
+do_repquota
+
+echo "Remount the FS to see if accounting changes"
+_scratch_cycle_mount
+do_repquota
+
+echo "Check extent count"
+$XFS_IO_PROG -c 'stat -v' $testdir/file1 >> $seqres.full
+$XFS_IO_PROG -c 'stat -v' $testdir/file2 >> $seqres.full
+echo "extents: $old_nextents -> $new_nextents" >> $seqres.full
+test $old_nextents -gt $new_nextents || echo "FAIL: $old_nextents -> $new_nextents"
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/875.out b/tests/xfs/875.out
new file mode 100644
index 0000000..57653e9
--- /dev/null
+++ b/tests/xfs/875.out
@@ -0,0 +1,12 @@
+QA output created by 875
+Format and mount
+Create a many-block file
+root      --       0       0       0              4     0     0       
+nobody    --     256       0       0              2     0     0       
+Defrag the file
+root      --       0       0       0              4     0     0       
+nobody    --     256       0       0              2     0     0       
+Remount the FS to see if accounting changes
+root      --       0       0       0              4     0     0       
+nobody    --     256       0       0              2     0     0       
+Check extent count
diff --git a/tests/xfs/group b/tests/xfs/group
index 6905a62..8565204 100644
--- a/tests/xfs/group
+++ b/tests/xfs/group
@@ -308,3 +308,6 @@
 325 auto quick clone
 326 auto quick clone
 327 auto quick clone
+873 auto quick clone fsr
+874 auto quick clone fsr
+875 auto quick clone fsr quota


^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [PATCH 07/13] xfs: test swapext with reflink
@ 2016-08-25 23:29   ` Darrick J. Wong
  0 siblings, 0 replies; 39+ messages in thread
From: Darrick J. Wong @ 2016-08-25 23:29 UTC (permalink / raw)
  To: david, eguan, darrick.wong; +Cc: linux-xfs, fstests, xfs

Add a few tests to stress the new swapext code for reflink and rmap.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 tests/xfs/873     |  108 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/xfs/873.out |    6 +++
 tests/xfs/874     |   97 ++++++++++++++++++++++++++++++++++++++++++++++++
 tests/xfs/874.out |   10 +++++
 tests/xfs/875     |  102 ++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/xfs/875.out |   12 ++++++
 tests/xfs/group   |    3 +
 7 files changed, 338 insertions(+)
 create mode 100755 tests/xfs/873
 create mode 100644 tests/xfs/873.out
 create mode 100755 tests/xfs/874
 create mode 100644 tests/xfs/874.out
 create mode 100755 tests/xfs/875
 create mode 100644 tests/xfs/875.out


diff --git a/tests/xfs/873 b/tests/xfs/873
new file mode 100755
index 0000000..75334c6
--- /dev/null
+++ b/tests/xfs/873
@@ -0,0 +1,108 @@
+#! /bin/bash
+# FS QA Test No. 873
+#
+# See how well xfs_fsr handles "defragging" a file with a hojillion extents.
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2016, Oracle and/or its affiliates.  All Rights Reserved.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it would be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write the Free Software Foundation,
+# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+#-----------------------------------------------------------------------
+
+seq=`basename "$0"`
+seqres="$RESULT_DIR/$seq"
+echo "QA output created by $seq"
+
+here=`pwd`
+tmp=/tmp/$$
+status=1    # failure is the default!
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+_cleanup()
+{
+	cd /
+	rm -rf "$tmp".*
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+. ./common/attr
+. ./common/reflink
+
+# real QA test starts here
+_supported_os Linux
+_supported_fs xfs
+_require_scratch_reflink
+_require_cp_reflink
+_require_test_program "punch-alternating"
+_require_command "$XFS_FSR_PROG" "xfs_fsr"
+
+rm -f "$seqres.full"
+
+echo "Format and mount"
+_scratch_mkfs > "$seqres.full" 2>&1
+_scratch_mount >> "$seqres.full" 2>&1
+
+testdir="$SCRATCH_MNT/test-$seq"
+mkdir "$testdir"
+
+# Setup for 16000 blocks, but we'll accept stress testing down to
+# 2^10 blocks... that should be plenty for anyone.
+fnr=$((12 + LOAD_FACTOR))
+free_blocks=$(stat -f -c '%a' "$testdir")
+blksz=$(stat -f -c '%S' "$testdir")
+space_avail=$((free_blocks * blksz))
+calc_space() {
+	blocks_needed=$(( 2 ** (fnr + 1) ))
+	space_needed=$((blocks_needed * blksz * 5 / 4))
+}
+calc_space
+while test $space_needed -gt $space_avail; do
+	fnr=$((fnr - 1))
+	calc_space
+done
+test $fnr -lt 10 && _notrun "Insufficient space for stress test; would only create $blocks_needed extents."
+bytes=$((blocks_needed * blksz))
+
+echo "Create a many-block file"
+echo "creating $blocks_needed blocks..." >> "$seqres.full"
+_pwrite_byte 0x62 0 $blksz $testdir/file0 >> $seqres.full
+"$XFS_IO_PROG" -f -c "pwrite -S 0x61 -b 4194304 0 $bytes" "$testdir/file1" >> "$seqres.full"
+echo "punching..." >> "$seqres.full"
+"$here/src/punch-alternating" "$testdir/file1" >> "$seqres.full"
+seq 0 2 $((2 ** (fnr + 1) )) | while read lblk; do
+	_reflink_range $testdir/file0 0 $testdir/file1 $((lblk * blksz)) $blksz >> $seqres.full
+done
+echo "...done" >> "$seqres.full"
+_scratch_cycle_mount
+
+echo "Reflink the big file"
+echo "reflinking $((blocks_needed / 2)) blocks, $((bytes / 2)) bytes" >> "$seqres.full"
+_reflink_range "$testdir/file1" 0 "$testdir/file2" 0 $bytes >> "$seqres.full"
+
+echo "Defrag the big file"
+old_nextents=$(_count_extents $testdir/file1)
+$XFS_FSR_PROG -v -d $testdir/file1 >> $seqres.full
+new_nextents=$(_count_extents $testdir/file1)
+
+echo "Check extent count"
+$XFS_IO_PROG -c 'stat -v' $testdir/file1 >> $seqres.full
+$XFS_IO_PROG -c 'stat -v' $testdir/file2 >> $seqres.full
+echo "extents: $old_nextents -> $new_nextents" >> $seqres.full
+test $old_nextents -gt $new_nextents || echo "FAIL: $old_nextents -> $new_nextents"
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/873.out b/tests/xfs/873.out
new file mode 100644
index 0000000..9dddf55
--- /dev/null
+++ b/tests/xfs/873.out
@@ -0,0 +1,6 @@
+QA output created by 873
+Format and mount
+Create a many-block file
+Reflink the big file
+Defrag the big file
+Check extent count
diff --git a/tests/xfs/874 b/tests/xfs/874
new file mode 100755
index 0000000..2e799ce
--- /dev/null
+++ b/tests/xfs/874
@@ -0,0 +1,97 @@
+#! /bin/bash
+# FS QA Test No. 874
+#
+# Ensure that xfs_fsr handles errors correctly while defragging files.
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2016, Oracle and/or its affiliates.  All Rights Reserved.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it would be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write the Free Software Foundation,
+# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+#-----------------------------------------------------------------------
+
+seq=`basename "$0"`
+seqres="$RESULT_DIR/$seq"
+echo "QA output created by $seq"
+
+here=`pwd`
+tmp=/tmp/$$
+status=1    # failure is the default!
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+_cleanup()
+{
+	cd /
+	rm -rf "$tmp".*
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+. ./common/attr
+. ./common/reflink
+. ./common/inject
+
+# real QA test starts here
+_supported_os Linux
+_supported_fs xfs
+_require_scratch_reflink
+_require_cp_reflink
+_require_command "$XFS_FSR_PROG" "xfs_fsr"
+_require_xfs_io_error_injection "bmap_finish_one"
+_require_xfs_scratch_rmapbt
+
+rm -f "$seqres.full"
+
+echo "Format and mount"
+_scratch_mkfs > "$seqres.full" 2>&1
+_scratch_mount >> "$seqres.full" 2>&1
+
+testdir="$SCRATCH_MNT/test-$seq"
+blksz=65536
+blks=3
+mkdir "$testdir"
+
+echo "Create a many-block file"
+_pwrite_byte 0x62 0 $((blksz * blks)) $testdir/file1 >> $seqres.full
+_pwrite_byte 0x63 0 $blksz $testdir/file2 >> $seqres.full
+_reflink_range $testdir/file2 0 $testdir/file1 $blksz $blksz >> $seqres.full
+_scratch_cycle_mount
+$XFS_IO_PROG -c 'bmap -v' $testdir/file1 >> $seqres.full
+
+echo "Inject error"
+_scratch_inject_error "bmap_finish_one"
+
+echo "Defrag the file"
+old_nextents=$(_count_extents $testdir/file1)
+$XFS_FSR_PROG -v -d $testdir/file1 >> $seqres.full 2>&1
+
+echo "FS should be shut down, touch will fail"
+touch $SCRATCH_MNT/badfs 2>&1 | _filter_scratch
+
+echo "Remount to replay log" | tee /dev/ttyprintk
+_scratch_inject_logprint >> $seqres.full
+new_nextents=$(_count_extents $testdir/file1)
+
+echo "Check extent count" | tee /dev/ttyprintk
+$XFS_IO_PROG -c 'stat -v' $testdir/file1 >> $seqres.full
+$XFS_IO_PROG -c 'stat -v' $testdir/file2 >> $seqres.full
+echo "extents: $old_nextents -> $new_nextents" >> $seqres.full
+
+echo "FS should be online, touch should succeed"
+touch $SCRATCH_MNT/goodfs
+$XFS_IO_PROG -c 'bmap -v' $testdir/file1 >> $seqres.full
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/874.out b/tests/xfs/874.out
new file mode 100644
index 0000000..dbc0f49
--- /dev/null
+++ b/tests/xfs/874.out
@@ -0,0 +1,10 @@
+QA output created by 874
+Format and mount
+Create a many-block file
+Inject error
+Defrag the file
+FS should be shut down, touch will fail
+touch: cannot touch 'SCRATCH_MNT/badfs': Input/output error
+Remount to replay log
+Check extent count
+FS should be online, touch should succeed
diff --git a/tests/xfs/875 b/tests/xfs/875
new file mode 100755
index 0000000..d579ba1
--- /dev/null
+++ b/tests/xfs/875
@@ -0,0 +1,102 @@
+#! /bin/bash
+# FS QA Test No. 875
+#
+# Ensure that xfs_fsr handles quota correctly while defragging files.
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2016, Oracle and/or its affiliates.  All Rights Reserved.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it would be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write the Free Software Foundation,
+# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+#-----------------------------------------------------------------------
+
+seq=`basename "$0"`
+seqres="$RESULT_DIR/$seq"
+echo "QA output created by $seq"
+
+here=`pwd`
+tmp=/tmp/$$
+status=1    # failure is the default!
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+_cleanup()
+{
+	cd /
+	rm -rf "$tmp".*
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+. ./common/attr
+. ./common/reflink
+. ./common/quota
+
+# real QA test starts here
+_supported_os Linux
+_supported_fs xfs
+_require_scratch_reflink
+_require_cp_reflink
+_require_command "$XFS_FSR_PROG" "xfs_fsr"
+_require_quota
+_require_nobody
+
+do_repquota()
+{
+	repquota $SCRATCH_MNT | egrep '^(fsgqa|root|nobody)'
+}
+
+rm -f "$seqres.full"
+
+echo "Format and mount"
+_scratch_mkfs > "$seqres.full" 2>&1
+export MOUNT_OPTIONS="-o usrquota,grpquota $MOUNT_OPTIONS"
+_scratch_mount >> "$seqres.full" 2>&1
+quotacheck -u -g $SCRATCH_MNT 2> /dev/null
+quotaon $SCRATCH_MNT 2> /dev/null
+
+testdir="$SCRATCH_MNT/test-$seq"
+blksz=65536
+blks=3
+mkdir "$testdir"
+
+echo "Create a many-block file"
+touch $testdir/file1
+chown nobody $testdir/file1
+touch $testdir/file2
+chown nobody $testdir/file2
+_pwrite_byte 0x62 0 $((blksz * blks)) $testdir/file1 >> $seqres.full
+_pwrite_byte 0x63 0 $blksz $testdir/file2 >> $seqres.full
+_reflink_range $testdir/file2 0 $testdir/file1 $blksz $blksz >> $seqres.full
+do_repquota
+_scratch_cycle_mount
+
+echo "Defrag the file"
+old_nextents=$(_count_extents $testdir/file1)
+$XFS_FSR_PROG -v -d $testdir/file1 >> $seqres.full
+new_nextents=$(_count_extents $testdir/file1)
+do_repquota
+
+echo "Remount the FS to see if accounting changes"
+_scratch_cycle_mount
+do_repquota
+
+echo "Check extent count"
+$XFS_IO_PROG -c 'stat -v' $testdir/file1 >> $seqres.full
+$XFS_IO_PROG -c 'stat -v' $testdir/file2 >> $seqres.full
+echo "extents: $old_nextents -> $new_nextents" >> $seqres.full
+test $old_nextents -gt $new_nextents || echo "FAIL: $old_nextents -> $new_nextents"
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/875.out b/tests/xfs/875.out
new file mode 100644
index 0000000..57653e9
--- /dev/null
+++ b/tests/xfs/875.out
@@ -0,0 +1,12 @@
+QA output created by 875
+Format and mount
+Create a many-block file
+root      --       0       0       0              4     0     0       
+nobody    --     256       0       0              2     0     0       
+Defrag the file
+root      --       0       0       0              4     0     0       
+nobody    --     256       0       0              2     0     0       
+Remount the FS to see if accounting changes
+root      --       0       0       0              4     0     0       
+nobody    --     256       0       0              2     0     0       
+Check extent count
diff --git a/tests/xfs/group b/tests/xfs/group
index 6905a62..8565204 100644
--- a/tests/xfs/group
+++ b/tests/xfs/group
@@ -308,3 +308,6 @@
 325 auto quick clone
 326 auto quick clone
 327 auto quick clone
+873 auto quick clone fsr
+874 auto quick clone fsr
+875 auto quick clone fsr quota

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [PATCH 08/13] xfs: more rmapbt tests
  2016-08-25 23:28 ` Darrick J. Wong
@ 2016-08-25 23:29   ` Darrick J. Wong
  -1 siblings, 0 replies; 39+ messages in thread
From: Darrick J. Wong @ 2016-08-25 23:29 UTC (permalink / raw)
  To: david, eguan, darrick.wong; +Cc: linux-xfs, fstests, xfs

More tests for the reverse mapping functionality.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 tests/xfs/876     |   75 +++++++++++++++++++++++++++++++++++++++++++
 tests/xfs/876.out |    4 ++
 tests/xfs/877     |   92 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/xfs/877.out |   10 ++++++
 tests/xfs/group   |    2 +
 5 files changed, 183 insertions(+)
 create mode 100755 tests/xfs/876
 create mode 100644 tests/xfs/876.out
 create mode 100755 tests/xfs/877
 create mode 100644 tests/xfs/877.out


diff --git a/tests/xfs/876 b/tests/xfs/876
new file mode 100755
index 0000000..7f447c9
--- /dev/null
+++ b/tests/xfs/876
@@ -0,0 +1,75 @@
+#! /bin/bash
+# FS QA Test No. 876
+#
+# Create a big enough rmapbt that we tickle a fdblocks accounting bug.
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2016, Oracle and/or its affiliates.  All Rights Reserved.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it would be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write the Free Software Foundation,
+# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+#-----------------------------------------------------------------------
+
+seq=`basename "$0"`
+seqres="$RESULT_DIR/$seq"
+echo "QA output created by $seq"
+
+here=`pwd`
+tmp=/tmp/$$
+status=1    # failure is the default!
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+_cleanup()
+{
+	cd /
+	rm -rf "$tmp".*
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+. ./common/reflink
+
+# real QA test starts here
+_supported_os Linux
+_supported_fs xfs
+_require_scratch
+_require_xfs_scratch_rmapbt
+_require_scratch_reflink
+_require_test_program "punch-alternating"
+
+rm -f "$seqres.full"
+
+echo "+ create scratch fs"
+_scratch_mkfs > "$seqres.full" 2>&1
+
+echo "+ mount fs image"
+_scratch_mount
+blksz="$(stat -f $SCRATCH_MNT -c '%S')"
+
+bt_ptrs=$(( (blksz - 56) / 44 ))
+bt_recs=$(( (blksz - 56) / 24 ))
+
+blocks=$((bt_ptrs * bt_recs + 1))
+_require_fs_space $SCRATCH_MNT $(( (2 * blocks * blksz) * 5 / 4096 ))
+len=$((blocks * blksz))
+
+echo "+ make some files"
+$XFS_IO_PROG -f -c "falloc 0 $len" -c "pwrite -S 0x68 -b 1048576 0 $len" $SCRATCH_MNT/f1 >> $seqres.full
+$XFS_IO_PROG -f -c "falloc 0 $len" -c "pwrite -S 0x68 -b 1048576 0 $len" $SCRATCH_MNT/f2 >> $seqres.full
+./src/punch-alternating $SCRATCH_MNT/f1 >> "$seqres.full"
+./src/punch-alternating $SCRATCH_MNT/f2 >> "$seqres.full"
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/876.out b/tests/xfs/876.out
new file mode 100644
index 0000000..96c1970
--- /dev/null
+++ b/tests/xfs/876.out
@@ -0,0 +1,4 @@
+QA output created by 876
++ create scratch fs
++ mount fs image
++ make some files
diff --git a/tests/xfs/877 b/tests/xfs/877
new file mode 100755
index 0000000..2ad7d30
--- /dev/null
+++ b/tests/xfs/877
@@ -0,0 +1,92 @@
+#! /bin/bash
+# FS QA Test No. 877
+#
+# Make sure query_range returns -EINVAL if lowkey > highkey.
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2016, Oracle and/or its affiliates.  All Rights Reserved.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it would be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write the Free Software Foundation,
+# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+#-----------------------------------------------------------------------
+
+seq=`basename "$0"`
+seqres="$RESULT_DIR/$seq"
+echo "QA output created by $seq"
+
+here=`pwd`
+tmp=/tmp/$$
+status=1    # failure is the default!
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+_cleanup()
+{
+	cd /
+	rm -rf "$tmp".* $metadump_file
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+. ./common/attr
+
+# real QA test starts here
+_supported_os Linux
+_supported_fs xfs
+_require_xfs_scratch_rmapbt
+_require_command "$XFS_DB_PROG" "xfs_db"
+_require_xfs_io_command "falloc"
+_require_xfs_io_command "fpunch"
+_require_xfs_io_command "fzero"
+_require_xfs_io_command "fcollapse"
+_require_xfs_io_command "finsert"
+
+rm -f "$seqres.full"
+
+echo "Format and mount"
+_scratch_mkfs > "$seqres.full" 2>&1
+_scratch_mount
+blksz=65536
+blocks=16
+len=$((blocks * blksz))
+
+echo "Create some files"
+$XFS_IO_PROG -f -c "falloc 0 $len" -c "pwrite -S 0x68 -b 1048576 0 $len" $SCRATCH_MNT/f1 >> $seqres.full
+
+echo "Manipulate file"
+$XFS_IO_PROG -c "fpunch $blksz $blksz" \
+	-c "fzero $((3 * blksz)) $blksz" \
+	-c "pwrite -S 0x69 $((5 * blksz)) $blksz" \
+	-c "fpunch $((7 * blksz)) $blksz" \
+	-c "fsync" \
+	-c "pwrite -S 0x70 $((7 * blksz)) $blksz" \
+	-c "fcollapse $((9 * blksz)) $blksz" \
+	-c "finsert $((10 * blksz)) $blksz" $SCRATCH_MNT/f1 >> $seqres.full
+
+echo "Check file"
+md5sum $SCRATCH_MNT/f1 | _filter_scratch
+od -tx1 -Ad -c $SCRATCH_MNT/f1 >> $seqres.full
+
+echo "Unmount"
+_scratch_unmount
+
+echo "Try a regular fsmap"
+$XFS_DB_PROG -c 'fsmap' `_scratch_xfs_db_options` >> $seqres.full
+$XFS_DB_PROG -c 'fsmap 0 5' `_scratch_xfs_db_options` >> $seqres.full
+
+echo "Try a bad fsmap"
+$XFS_DB_PROG -c 'fsmap 5 4' `_scratch_xfs_db_options`
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/877.out b/tests/xfs/877.out
new file mode 100644
index 0000000..4a2242f
--- /dev/null
+++ b/tests/xfs/877.out
@@ -0,0 +1,10 @@
+QA output created by 877
+Format and mount
+Create some files
+Manipulate file
+Check file
+e45c5707fcf6817e914ffb6ce37a0ac7  SCRATCH_MNT/f1
+Unmount
+Try a regular fsmap
+Try a bad fsmap
+Error 22 while querying fsmap btree.
diff --git a/tests/xfs/group b/tests/xfs/group
index 8565204..72580e9 100644
--- a/tests/xfs/group
+++ b/tests/xfs/group
@@ -311,3 +311,5 @@
 873 auto quick clone fsr
 874 auto quick clone fsr
 875 auto quick clone fsr quota
+876 auto quick rmap clone
+877 auto quick rmap clone


^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [PATCH 08/13] xfs: more rmapbt tests
@ 2016-08-25 23:29   ` Darrick J. Wong
  0 siblings, 0 replies; 39+ messages in thread
From: Darrick J. Wong @ 2016-08-25 23:29 UTC (permalink / raw)
  To: david, eguan, darrick.wong; +Cc: linux-xfs, fstests, xfs

More tests for the reverse mapping functionality.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 tests/xfs/876     |   75 +++++++++++++++++++++++++++++++++++++++++++
 tests/xfs/876.out |    4 ++
 tests/xfs/877     |   92 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/xfs/877.out |   10 ++++++
 tests/xfs/group   |    2 +
 5 files changed, 183 insertions(+)
 create mode 100755 tests/xfs/876
 create mode 100644 tests/xfs/876.out
 create mode 100755 tests/xfs/877
 create mode 100644 tests/xfs/877.out


diff --git a/tests/xfs/876 b/tests/xfs/876
new file mode 100755
index 0000000..7f447c9
--- /dev/null
+++ b/tests/xfs/876
@@ -0,0 +1,75 @@
+#! /bin/bash
+# FS QA Test No. 876
+#
+# Create a big enough rmapbt that we tickle a fdblocks accounting bug.
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2016, Oracle and/or its affiliates.  All Rights Reserved.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it would be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write the Free Software Foundation,
+# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+#-----------------------------------------------------------------------
+
+seq=`basename "$0"`
+seqres="$RESULT_DIR/$seq"
+echo "QA output created by $seq"
+
+here=`pwd`
+tmp=/tmp/$$
+status=1    # failure is the default!
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+_cleanup()
+{
+	cd /
+	rm -rf "$tmp".*
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+. ./common/reflink
+
+# real QA test starts here
+_supported_os Linux
+_supported_fs xfs
+_require_scratch
+_require_xfs_scratch_rmapbt
+_require_scratch_reflink
+_require_test_program "punch-alternating"
+
+rm -f "$seqres.full"
+
+echo "+ create scratch fs"
+_scratch_mkfs > "$seqres.full" 2>&1
+
+echo "+ mount fs image"
+_scratch_mount
+blksz="$(stat -f $SCRATCH_MNT -c '%S')"
+
+bt_ptrs=$(( (blksz - 56) / 44 ))
+bt_recs=$(( (blksz - 56) / 24 ))
+
+blocks=$((bt_ptrs * bt_recs + 1))
+_require_fs_space $SCRATCH_MNT $(( (2 * blocks * blksz) * 5 / 4096 ))
+len=$((blocks * blksz))
+
+echo "+ make some files"
+$XFS_IO_PROG -f -c "falloc 0 $len" -c "pwrite -S 0x68 -b 1048576 0 $len" $SCRATCH_MNT/f1 >> $seqres.full
+$XFS_IO_PROG -f -c "falloc 0 $len" -c "pwrite -S 0x68 -b 1048576 0 $len" $SCRATCH_MNT/f2 >> $seqres.full
+./src/punch-alternating $SCRATCH_MNT/f1 >> "$seqres.full"
+./src/punch-alternating $SCRATCH_MNT/f2 >> "$seqres.full"
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/876.out b/tests/xfs/876.out
new file mode 100644
index 0000000..96c1970
--- /dev/null
+++ b/tests/xfs/876.out
@@ -0,0 +1,4 @@
+QA output created by 876
++ create scratch fs
++ mount fs image
++ make some files
diff --git a/tests/xfs/877 b/tests/xfs/877
new file mode 100755
index 0000000..2ad7d30
--- /dev/null
+++ b/tests/xfs/877
@@ -0,0 +1,92 @@
+#! /bin/bash
+# FS QA Test No. 877
+#
+# Make sure query_range returns -EINVAL if lowkey > highkey.
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2016, Oracle and/or its affiliates.  All Rights Reserved.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it would be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write the Free Software Foundation,
+# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+#-----------------------------------------------------------------------
+
+seq=`basename "$0"`
+seqres="$RESULT_DIR/$seq"
+echo "QA output created by $seq"
+
+here=`pwd`
+tmp=/tmp/$$
+status=1    # failure is the default!
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+_cleanup()
+{
+	cd /
+	rm -rf "$tmp".* $metadump_file
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+. ./common/attr
+
+# real QA test starts here
+_supported_os Linux
+_supported_fs xfs
+_require_xfs_scratch_rmapbt
+_require_command "$XFS_DB_PROG" "xfs_db"
+_require_xfs_io_command "falloc"
+_require_xfs_io_command "fpunch"
+_require_xfs_io_command "fzero"
+_require_xfs_io_command "fcollapse"
+_require_xfs_io_command "finsert"
+
+rm -f "$seqres.full"
+
+echo "Format and mount"
+_scratch_mkfs > "$seqres.full" 2>&1
+_scratch_mount
+blksz=65536
+blocks=16
+len=$((blocks * blksz))
+
+echo "Create some files"
+$XFS_IO_PROG -f -c "falloc 0 $len" -c "pwrite -S 0x68 -b 1048576 0 $len" $SCRATCH_MNT/f1 >> $seqres.full
+
+echo "Manipulate file"
+$XFS_IO_PROG -c "fpunch $blksz $blksz" \
+	-c "fzero $((3 * blksz)) $blksz" \
+	-c "pwrite -S 0x69 $((5 * blksz)) $blksz" \
+	-c "fpunch $((7 * blksz)) $blksz" \
+	-c "fsync" \
+	-c "pwrite -S 0x70 $((7 * blksz)) $blksz" \
+	-c "fcollapse $((9 * blksz)) $blksz" \
+	-c "finsert $((10 * blksz)) $blksz" $SCRATCH_MNT/f1 >> $seqres.full
+
+echo "Check file"
+md5sum $SCRATCH_MNT/f1 | _filter_scratch
+od -tx1 -Ad -c $SCRATCH_MNT/f1 >> $seqres.full
+
+echo "Unmount"
+_scratch_unmount
+
+echo "Try a regular fsmap"
+$XFS_DB_PROG -c 'fsmap' `_scratch_xfs_db_options` >> $seqres.full
+$XFS_DB_PROG -c 'fsmap 0 5' `_scratch_xfs_db_options` >> $seqres.full
+
+echo "Try a bad fsmap"
+$XFS_DB_PROG -c 'fsmap 5 4' `_scratch_xfs_db_options`
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/877.out b/tests/xfs/877.out
new file mode 100644
index 0000000..4a2242f
--- /dev/null
+++ b/tests/xfs/877.out
@@ -0,0 +1,10 @@
+QA output created by 877
+Format and mount
+Create some files
+Manipulate file
+Check file
+e45c5707fcf6817e914ffb6ce37a0ac7  SCRATCH_MNT/f1
+Unmount
+Try a regular fsmap
+Try a bad fsmap
+Error 22 while querying fsmap btree.
diff --git a/tests/xfs/group b/tests/xfs/group
index 8565204..72580e9 100644
--- a/tests/xfs/group
+++ b/tests/xfs/group
@@ -311,3 +311,5 @@
 873 auto quick clone fsr
 874 auto quick clone fsr
 875 auto quick clone fsr quota
+876 auto quick rmap clone
+877 auto quick rmap clone

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [PATCH 09/13] xfs: test realtime rmapbt code
  2016-08-25 23:28 ` Darrick J. Wong
@ 2016-08-25 23:29   ` Darrick J. Wong
  -1 siblings, 0 replies; 39+ messages in thread
From: Darrick J. Wong @ 2016-08-25 23:29 UTC (permalink / raw)
  To: david, eguan, darrick.wong; +Cc: linux-xfs, fstests, xfs

Test the realtime rmap btree code by exercising various IO patterns
on realtime files.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 tests/xfs/878     |   91 +++++++++++++++++++++++++++++++++++++++++++
 tests/xfs/878.out |    9 ++++
 tests/xfs/879     |   67 ++++++++++++++++++++++++++++++++
 tests/xfs/879.out |    7 +++
 tests/xfs/880     |   86 +++++++++++++++++++++++++++++++++++++++++
 tests/xfs/880.out |    7 +++
 tests/xfs/881     |   95 +++++++++++++++++++++++++++++++++++++++++++++
 tests/xfs/881.out |    8 ++++
 tests/xfs/882     |  111 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/xfs/882.out |   11 +++++
 tests/xfs/883     |   90 +++++++++++++++++++++++++++++++++++++++++++
 tests/xfs/883.out |   10 +++++
 tests/xfs/884     |   91 +++++++++++++++++++++++++++++++++++++++++++
 tests/xfs/884.out |    9 ++++
 tests/xfs/885     |   95 +++++++++++++++++++++++++++++++++++++++++++++
 tests/xfs/885.out |   10 +++++
 tests/xfs/886     |  104 ++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/xfs/886.out |    7 +++
 tests/xfs/887     |  108 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/xfs/887.out |    7 +++
 tests/xfs/888     |   81 +++++++++++++++++++++++++++++++++++++++
 tests/xfs/888.out |    6 +++
 tests/xfs/group   |   11 +++++
 23 files changed, 1121 insertions(+)
 create mode 100755 tests/xfs/878
 create mode 100644 tests/xfs/878.out
 create mode 100755 tests/xfs/879
 create mode 100644 tests/xfs/879.out
 create mode 100755 tests/xfs/880
 create mode 100644 tests/xfs/880.out
 create mode 100755 tests/xfs/881
 create mode 100644 tests/xfs/881.out
 create mode 100755 tests/xfs/882
 create mode 100644 tests/xfs/882.out
 create mode 100755 tests/xfs/883
 create mode 100644 tests/xfs/883.out
 create mode 100755 tests/xfs/884
 create mode 100644 tests/xfs/884.out
 create mode 100755 tests/xfs/885
 create mode 100644 tests/xfs/885.out
 create mode 100755 tests/xfs/886
 create mode 100644 tests/xfs/886.out
 create mode 100755 tests/xfs/887
 create mode 100644 tests/xfs/887.out
 create mode 100755 tests/xfs/888
 create mode 100644 tests/xfs/888.out


diff --git a/tests/xfs/878 b/tests/xfs/878
new file mode 100755
index 0000000..557e4ae
--- /dev/null
+++ b/tests/xfs/878
@@ -0,0 +1,91 @@
+#! /bin/bash
+# FS QA Test No. 878
+#
+# Set rrmapino to another inode on an non-rt rmap fs and see if repair fixes it.
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2016, Oracle and/or its affiliates.  All Rights Reserved.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it would be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write the Free Software Foundation,
+# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+#-----------------------------------------------------------------------
+
+seq=`basename "$0"`
+seqres="$RESULT_DIR/$seq"
+echo "QA output created by $seq"
+
+here=`pwd`
+tmp=/tmp/$$
+status=1    # failure is the default!
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+_cleanup()
+{
+	cd /
+	rm -rf "$tmp".* $metadump_file
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+
+# real QA test starts here
+_supported_os Linux
+_supported_fs xfs
+_require_xfs_scratch_rmapbt
+
+rm -f "$seqres.full"
+
+unset SCRATCH_RTDEV
+
+echo "Format and mount"
+_scratch_mkfs > "$seqres.full" 2>&1
+_scratch_mount
+
+echo "Create some files"
+$XFS_IO_PROG -f -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f1 >> $seqres.full
+$XFS_IO_PROG -f -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f2 >> $seqres.full
+echo garbage > $SCRATCH_MNT/f3
+ino=$(stat -c '%i' $SCRATCH_MNT/f3)
+_scratch_unmount
+
+echo "Corrupt fs"
+$XFS_DB_PROG -x -c 'sb 0' \
+	-c "write rrmapino $ino" `_scratch_xfs_db_options` >> $seqres.full
+_scratch_mount
+
+echo "Check files"
+md5sum $SCRATCH_MNT/f1 2>&1 | _filter_scratch
+
+echo "Try to create more files"
+$XFS_IO_PROG -f -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f3 >> $seqres.full 2>&1
+
+echo "Repair fs"
+_scratch_unmount 2>&1 | _filter_scratch
+$XFS_LOGPRINT_PROG -t $extra_log_options $device 2>&1 \
+		| tee $tmp.logprint | grep -q "<CLEAN>"
+if [ $? -ne 0 ]; then
+	echo "Dirty log, zeroing..." >> $seqres.full
+	_scratch_xfs_repair -L >> $seqres.full 2>&1
+else
+	_scratch_xfs_repair >> $seqres.full 2>&1
+fi
+_scratch_xfs_repair >> $seqres.full 2>&1
+
+echo "Try to create more files (again)"
+_scratch_mount
+$XFS_IO_PROG -f -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f4 >> $seqres.full
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/878.out b/tests/xfs/878.out
new file mode 100644
index 0000000..e134506
--- /dev/null
+++ b/tests/xfs/878.out
@@ -0,0 +1,9 @@
+QA output created by 878
+Format and mount
+Create some files
+Corrupt fs
+Check files
+8f27047948255cb84872e2dd7c0bc56d  SCRATCH_MNT/f1
+Try to create more files
+Repair fs
+Try to create more files (again)
diff --git a/tests/xfs/879 b/tests/xfs/879
new file mode 100755
index 0000000..247b3af
--- /dev/null
+++ b/tests/xfs/879
@@ -0,0 +1,67 @@
+#! /bin/bash
+# FS QA Test No. 879
+#
+# Ensure that we can create a few realtime files on a rmapbt filesystem.
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2016, Oracle and/or its affiliates.  All Rights Reserved.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it would be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write the Free Software Foundation,
+# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+#-----------------------------------------------------------------------
+
+seq=`basename "$0"`
+seqres="$RESULT_DIR/$seq"
+echo "QA output created by $seq"
+
+here=`pwd`
+tmp=/tmp/$$
+status=1    # failure is the default!
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+_cleanup()
+{
+	cd /
+	rm -rf "$tmp".*
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+
+# real QA test starts here
+_supported_os Linux
+_supported_fs xfs
+_require_realtime
+_require_xfs_scratch_rmapbt
+
+rm -f "$seqres.full"
+
+echo "Format and mount"
+_scratch_mkfs > "$seqres.full" 2>&1
+_scratch_mount
+
+echo "Create a few files"
+$XFS_IO_PROG -f -R -c 'pwrite -S 0x67 0 50000' -c fsync $SCRATCH_MNT/f1 >> $seqres.full
+$XFS_IO_PROG -f -R -c 'pwrite -S 0x67 0 50000' -c fsync $SCRATCH_MNT/f2 >> $seqres.full
+_scratch_cycle_mount
+
+echo "Grab contents"
+md5sum $SCRATCH_MNT/f1 $SCRATCH_MNT/f2 | _filter_scratch
+
+echo "Remove one file"
+rm -rf $SCRATCH_MNT/f2
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/879.out b/tests/xfs/879.out
new file mode 100644
index 0000000..9dfe48b
--- /dev/null
+++ b/tests/xfs/879.out
@@ -0,0 +1,7 @@
+QA output created by 879
+Format and mount
+Create a few files
+Grab contents
+10abe2628d19eb1c2ebe18aad7b14820  SCRATCH_MNT/f1
+10abe2628d19eb1c2ebe18aad7b14820  SCRATCH_MNT/f2
+Remove one file
diff --git a/tests/xfs/880 b/tests/xfs/880
new file mode 100755
index 0000000..8cd509f
--- /dev/null
+++ b/tests/xfs/880
@@ -0,0 +1,86 @@
+#! /bin/bash
+# FS QA Test No. 880
+#
+# Exercise expanding and shrinking the realtime rmap btree.
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2016, Oracle and/or its affiliates.  All Rights Reserved.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it would be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write the Free Software Foundation,
+# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+#-----------------------------------------------------------------------
+
+seq=`basename "$0"`
+seqres="$RESULT_DIR/$seq"
+echo "QA output created by $seq"
+
+here=`pwd`
+tmp=/tmp/$$
+status=1    # failure is the default!
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+_cleanup()
+{
+	cd /
+	rm -rf "$tmp".*
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+
+# real QA test starts here
+_supported_os Linux
+_supported_fs xfs
+_require_realtime
+_require_xfs_scratch_rmapbt
+_require_test_program "punch-alternating"
+_require_xfs_io_command "falloc"
+
+rm -f "$seqres.full"
+
+echo "Format and mount"
+_scratch_mkfs | _filter_mkfs 2>$tmp.mkfs >/dev/null
+. $tmp.mkfs
+cat $tmp.mkfs > "$seqres.full" 2>&1
+_scratch_mount
+blksz="$(stat -f $SCRATCH_MNT -c '%S')"
+
+echo "Create a three-level rtrmapbt"
+i_ptrs=$(( (isize - 176) / 56 ))
+bt_ptrs=$(( (blksz - 56) / 56 ))
+bt_recs=$(( (blksz - 56) / 32 ))
+
+blocks=$((i_ptrs * bt_ptrs * bt_recs))
+_require_fs_space $SCRATCH_MNT $(( (2 * blocks * blksz) * 5 / 4096 ))
+len=$((blocks * rtextsz))
+
+echo "Create big file"
+$XFS_IO_PROG -f -R -c "falloc 0 $len" -c "pwrite -S 0x68 -b 1048576 0 $len" $SCRATCH_MNT/f1 >> $seqres.full
+$XFS_IO_PROG -f -R -c "falloc 0 $len" -c "pwrite -S 0x68 -b 1048576 0 $len" $SCRATCH_MNT/f2 >> $seqres.full
+
+echo "Explode the rtrmapbt"
+./src/punch-alternating $SCRATCH_MNT/f1 >> "$seqres.full"
+./src/punch-alternating $SCRATCH_MNT/f2 >> "$seqres.full"
+_scratch_cycle_mount
+
+echo "Remove half the records"
+rm -rf $SCRATCH_MNT/f1
+_scratch_cycle_mount
+
+echo "Remove the rest of the records"
+rm -rf $SCRATCH_MNT/f2
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/880.out b/tests/xfs/880.out
new file mode 100644
index 0000000..b87665b
--- /dev/null
+++ b/tests/xfs/880.out
@@ -0,0 +1,7 @@
+QA output created by 880
+Format and mount
+Create a three-level rtrmapbt
+Create big file
+Explode the rtrmapbt
+Remove half the records
+Remove the rest of the records
diff --git a/tests/xfs/881 b/tests/xfs/881
new file mode 100755
index 0000000..750a92a
--- /dev/null
+++ b/tests/xfs/881
@@ -0,0 +1,95 @@
+#! /bin/bash
+# FS QA Test No. 881
+#
+# Exercise metadump on realtime rmapbt preservation.
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2016, Oracle and/or its affiliates.  All Rights Reserved.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it would be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write the Free Software Foundation,
+# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+#-----------------------------------------------------------------------
+
+seq=`basename "$0"`
+seqres="$RESULT_DIR/$seq"
+echo "QA output created by $seq"
+
+here=`pwd`
+tmp=/tmp/$$
+status=1    # failure is the default!
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+_cleanup()
+{
+	cd /
+	rm -rf "$tmp".* $metadump_file
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+
+# real QA test starts here
+_supported_os Linux
+_supported_fs xfs
+_require_realtime
+_require_xfs_scratch_rmapbt
+_require_test_program "punch-alternating"
+_require_xfs_io_command "falloc"
+
+rm -f "$seqres.full"
+
+echo "Format and mount"
+_scratch_mkfs | _filter_mkfs 2>$tmp.mkfs >/dev/null
+. $tmp.mkfs
+cat $tmp.mkfs > "$seqres.full" 2>&1
+_scratch_mount
+blksz="$(stat -f $SCRATCH_MNT -c '%S')"
+
+metadump_file=$TEST_DIR/${seq}_metadump
+rm -rf $metadump_file
+
+echo "Create a three-level rtrmapbt"
+i_ptrs=$(( (isize - 176) / 56 ))
+bt_ptrs=$(( (blksz - 56) / 56 ))
+bt_recs=$(( (blksz - 56) / 32 ))
+
+blocks=$((i_ptrs * bt_ptrs * bt_recs))
+_require_fs_space $SCRATCH_MNT $(( (2 * blocks * blksz) * 5 / 4096 ))
+len=$((blocks * rtextsz))
+
+echo "Create big file"
+$XFS_IO_PROG -f -R -c "falloc 0 $len" -c "pwrite -S 0x68 -b 1048576 0 $len" $SCRATCH_MNT/f1 >> $seqres.full
+$XFS_IO_PROG -f -R -c "falloc 0 $len" -c "pwrite -S 0x68 -b 1048576 0 $len" $SCRATCH_MNT/f2 >> $seqres.full
+
+echo "Explode the rtrmapbt"
+./src/punch-alternating $SCRATCH_MNT/f1 >> "$seqres.full"
+./src/punch-alternating $SCRATCH_MNT/f2 >> "$seqres.full"
+_scratch_cycle_mount
+
+echo "Create metadump file"
+_scratch_unmount
+_scratch_metadump $metadump_file
+
+# Now restore the obfuscated one back and take a look around
+echo "Restore metadump"
+xfs_mdrestore $metadump_file $TEST_DIR/image
+SCRATCH_DEV=$TEST_DIR/image _scratch_mount
+SCRATCH_DEV=$TEST_DIR/image _scratch_unmount
+
+echo "Check restored fs"
+_check_generic_filesystem $metadump_file
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/881.out b/tests/xfs/881.out
new file mode 100644
index 0000000..6ad156c
--- /dev/null
+++ b/tests/xfs/881.out
@@ -0,0 +1,8 @@
+QA output created by 881
+Format and mount
+Create a three-level rtrmapbt
+Create big file
+Explode the rtrmapbt
+Create metadump file
+Restore metadump
+Check restored fs
diff --git a/tests/xfs/882 b/tests/xfs/882
new file mode 100755
index 0000000..3c44540
--- /dev/null
+++ b/tests/xfs/882
@@ -0,0 +1,111 @@
+#! /bin/bash
+# FS QA Test No. 882
+#
+# Corrupt the realtime rmapbt and see how the kernel and xfs_repair deal.
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2016, Oracle and/or its affiliates.  All Rights Reserved.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it would be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write the Free Software Foundation,
+# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+#-----------------------------------------------------------------------
+
+seq=`basename "$0"`
+seqres="$RESULT_DIR/$seq"
+echo "QA output created by $seq"
+
+here=`pwd`
+tmp=/tmp/$$
+status=1    # failure is the default!
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+_cleanup()
+{
+	cd /
+	rm -rf "$tmp".*
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+
+# real QA test starts here
+_supported_os Linux
+_supported_fs xfs
+_require_realtime
+_require_xfs_scratch_rmapbt
+_require_test_program "punch-alternating"
+_require_xfs_io_command "falloc"
+
+rm -f "$seqres.full"
+
+echo "+ create scratch fs"
+_scratch_mkfs | _filter_mkfs 2>$tmp.mkfs >/dev/null
+. $tmp.mkfs
+cat $tmp.mkfs > "$seqres.full" 2>&1
+
+echo "+ mount fs image"
+_scratch_mount
+blksz="$(stat -f $SCRATCH_MNT -c '%S')"
+
+i_ptrs=$(( (isize - 176) / 56 ))
+bt_ptrs=$(( (blksz - 56) / 56 ))
+bt_recs=$(( (blksz - 56) / 32 ))
+
+blocks=$((i_ptrs * bt_ptrs * bt_recs + 1))
+_require_fs_space $SCRATCH_MNT $(( (2 * blocks * blksz) * 5 / 4096 ))
+len=$((blocks * blksz))
+
+echo "+ make some files"
+$XFS_IO_PROG -f -R -c "falloc 0 $len" -c "pwrite -S 0x68 -b 1048576 0 $len" $SCRATCH_MNT/f1 >> $seqres.full
+$XFS_IO_PROG -f -R -c "falloc 0 $len" -c "pwrite -S 0x68 -b 1048576 0 $len" $SCRATCH_MNT/f2 >> $seqres.full
+./src/punch-alternating $SCRATCH_MNT/f1 >> "$seqres.full"
+./src/punch-alternating $SCRATCH_MNT/f2 >> "$seqres.full"
+_scratch_unmount
+
+echo "+ check fs"
+_scratch_xfs_repair -n >> $seqres.full 2>&1 || echo "xfs_repair should not fail"
+
+echo "+ corrupt image"
+$XFS_DB_PROG -x -c "sb" -c "addr rrmapino" -c "addr u3.rtrmapbt.ptrs[1]" \
+	-c "stack" -c "blocktrash -x 4096 -y 4096 -n 8 -3 -z" \
+	`_scratch_xfs_db_options` >> $seqres.full 2>&1
+
+echo "+ mount image"
+_scratch_mount
+
+echo "+ copy more"
+$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 1" $SCRATCH_MNT/e3 >> $seqres.full 2>&1
+test -s ${SCRATCH_MNT}/f3 && echo "should not be able to copy with busted rtrmap btree"
+_scratch_unmount
+
+echo "+ repair fs"
+$XFS_LOGPRINT_PROG -t $extra_log_options $device 2>&1 \
+		| tee $tmp.logprint | grep -q "<CLEAN>"
+if [ $? -ne 0 ]; then
+	echo "Dirty log, zeroing..." >> $seqres.full
+	_scratch_xfs_repair -L >> $seqres.full 2>&1
+else
+	_scratch_xfs_repair >> $seqres.full 2>&1
+fi
+_scratch_xfs_repair >> $seqres.full 2>&1
+
+echo "+ mount image (2)"
+_scratch_mount
+
+echo "+ copy more (2)"
+$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 1" $SCRATCH_MNT/e4 >> $seqres.full
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/882.out b/tests/xfs/882.out
new file mode 100644
index 0000000..5ebe620
--- /dev/null
+++ b/tests/xfs/882.out
@@ -0,0 +1,11 @@
+QA output created by 882
++ create scratch fs
++ mount fs image
++ make some files
++ check fs
++ corrupt image
++ mount image
++ copy more
++ repair fs
++ mount image (2)
++ copy more (2)
diff --git a/tests/xfs/883 b/tests/xfs/883
new file mode 100755
index 0000000..86dd047
--- /dev/null
+++ b/tests/xfs/883
@@ -0,0 +1,90 @@
+#! /bin/bash
+# FS QA Test No. 883
+#
+# Set rrmapino to zero on an rtrmap fs and see if repair fixes it.
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2016, Oracle and/or its affiliates.  All Rights Reserved.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it would be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write the Free Software Foundation,
+# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+#-----------------------------------------------------------------------
+
+seq=`basename "$0"`
+seqres="$RESULT_DIR/$seq"
+echo "QA output created by $seq"
+
+here=`pwd`
+tmp=/tmp/$$
+status=1    # failure is the default!
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+_cleanup()
+{
+	cd /
+	rm -rf "$tmp".* $metadump_file
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+
+# real QA test starts here
+_supported_os Linux
+_supported_fs xfs
+_require_realtime
+_require_xfs_scratch_rmapbt
+
+rm -f "$seqres.full"
+
+echo "Format and mount"
+_scratch_mkfs > "$seqres.full" 2>&1
+_scratch_mount
+
+echo "Create some files"
+$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f1 >> $seqres.full
+$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f2 >> $seqres.full
+_scratch_unmount
+
+echo "Corrupt fs"
+$XFS_DB_PROG -x -c 'sb 0' -c 'addr rrmapino' \
+	-c 'write core.nlinkv2 0' -c 'write core.mode 0' -c 'sb 0' \
+	-c 'write rrmapino 0' `_scratch_xfs_db_options` >> $seqres.full
+_scratch_mount >> $seqres.full 2>&1 && echo "mount should have failed"
+
+echo "Check files"
+md5sum $SCRATCH_MNT/f1 2>&1 | _filter_scratch
+
+echo "Try to create more files"
+$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f3 >> $seqres.full 2>&1
+test -e $SCRATCH_MNT/f3 && echo "should not have been able to write f3"
+
+echo "Repair fs"
+_scratch_unmount 2>&1 | _filter_scratch
+$XFS_LOGPRINT_PROG -t $extra_log_options $device 2>&1 \
+		| tee $tmp.logprint | grep -q "<CLEAN>"
+if [ $? -ne 0 ]; then
+	echo "Dirty log, zeroing..." >> $seqres.full
+	_scratch_xfs_repair -L >> $seqres.full 2>&1
+else
+	_scratch_xfs_repair >> $seqres.full 2>&1
+fi
+_scratch_xfs_repair >> $seqres.full 2>&1
+
+echo "Try to create more files (again)"
+_scratch_mount
+$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f4 >> $seqres.full
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/883.out b/tests/xfs/883.out
new file mode 100644
index 0000000..6e75ac1
--- /dev/null
+++ b/tests/xfs/883.out
@@ -0,0 +1,10 @@
+QA output created by 883
+Format and mount
+Create some files
+Corrupt fs
+Check files
+md5sum: SCRATCH_MNT/f1: No such file or directory
+Try to create more files
+Repair fs
+umount: SCRATCH_DEV: not mounted
+Try to create more files (again)
diff --git a/tests/xfs/884 b/tests/xfs/884
new file mode 100755
index 0000000..51071e0
--- /dev/null
+++ b/tests/xfs/884
@@ -0,0 +1,91 @@
+#! /bin/bash
+# FS QA Test No. 884
+#
+# Link rrmapino into the rootdir on an rtrmap fs and see if repair fixes it.
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2016, Oracle and/or its affiliates.  All Rights Reserved.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it would be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write the Free Software Foundation,
+# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+#-----------------------------------------------------------------------
+
+seq=`basename "$0"`
+seqres="$RESULT_DIR/$seq"
+echo "QA output created by $seq"
+
+here=`pwd`
+tmp=/tmp/$$
+status=1    # failure is the default!
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+_cleanup()
+{
+	cd /
+	rm -rf "$tmp".* $metadump_file
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+
+# real QA test starts here
+_supported_os Linux
+_supported_fs xfs
+_require_realtime
+_require_xfs_scratch_rmapbt
+
+rm -f "$seqres.full"
+
+echo "Format and mount"
+_scratch_mkfs > "$seqres.full" 2>&1
+_scratch_mount
+
+echo "Create some files"
+$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f1 >> $seqres.full
+$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f2 >> $seqres.full
+echo garbage > $SCRATCH_MNT/f3
+ln $SCRATCH_MNT/f3 $SCRATCH_MNT/f4
+_scratch_unmount
+
+echo "Corrupt fs"
+rrmapino=$($XFS_DB_PROG -c 'sb 0' -c 'p rrmapino' `_scratch_xfs_db_options` | awk '{print $3}')
+$XFS_DB_PROG -x -c 'sb 0' -c 'addr rootino' \
+	-c "write u3.sfdir3.list[3].inumber.i4 $rrmapino" `_scratch_xfs_db_options` >> $seqres.full
+_scratch_mount
+
+echo "Check files"
+md5sum $SCRATCH_MNT/f1 2>&1 | _filter_scratch
+
+echo "Try to create more files"
+$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f5 >> $seqres.full 2>&1
+
+echo "Repair fs"
+_scratch_unmount 2>&1 | _filter_scratch
+$XFS_LOGPRINT_PROG -t $extra_log_options $device 2>&1 \
+		| tee $tmp.logprint | grep -q "<CLEAN>"
+if [ $? -ne 0 ]; then
+	echo "Dirty log, zeroing..." >> $seqres.full
+	_scratch_xfs_repair -L >> $seqres.full 2>&1
+else
+	_scratch_xfs_repair >> $seqres.full 2>&1
+fi
+_scratch_xfs_repair >> $seqres.full 2>&1
+
+echo "Try to create more files (again)"
+_scratch_mount
+$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f4 >> $seqres.full
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/884.out b/tests/xfs/884.out
new file mode 100644
index 0000000..17a73ef
--- /dev/null
+++ b/tests/xfs/884.out
@@ -0,0 +1,9 @@
+QA output created by 884
+Format and mount
+Create some files
+Corrupt fs
+Check files
+8f27047948255cb84872e2dd7c0bc56d  SCRATCH_MNT/f1
+Try to create more files
+Repair fs
+Try to create more files (again)
diff --git a/tests/xfs/885 b/tests/xfs/885
new file mode 100755
index 0000000..1839c11
--- /dev/null
+++ b/tests/xfs/885
@@ -0,0 +1,95 @@
+#! /bin/bash
+# FS QA Test No. 885
+#
+# Set rrmapino to another inode on an rtrmap fs and see if repair fixes it.
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2016, Oracle and/or its affiliates.  All Rights Reserved.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it would be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write the Free Software Foundation,
+# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+#-----------------------------------------------------------------------
+
+seq=`basename "$0"`
+seqres="$RESULT_DIR/$seq"
+echo "QA output created by $seq"
+
+here=`pwd`
+tmp=/tmp/$$
+status=1    # failure is the default!
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+_cleanup()
+{
+	cd /
+	rm -rf "$tmp".* $metadump_file
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+
+# real QA test starts here
+_supported_os Linux
+_supported_fs xfs
+_require_realtime
+_require_xfs_scratch_rmapbt
+
+rm -f "$seqres.full"
+
+echo "Format and mount"
+_scratch_mkfs > "$seqres.full" 2>&1
+_scratch_mount
+
+echo "Create some files"
+$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f1 >> $seqres.full
+$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f2 >> $seqres.full
+echo garbage > $SCRATCH_MNT/f3
+ino=$(stat -c '%i' $SCRATCH_MNT/f3)
+_scratch_unmount
+
+echo "Corrupt fs"
+rrmapino=$($XFS_DB_PROG -c 'sb 0' -c 'p rrmapino' `_scratch_xfs_db_options` | awk '{print $3}')
+$XFS_DB_PROG -x -c "inode $rrmapino" \
+	-c 'write core.format 2' -c 'write core.size 0' \
+	-c 'write core.nblocks 0' -c 'sb 0' -c 'addr rootino' \
+	-c "write u3.sfdir3.list[2].inumber.i4 $rrmapino" \
+	-c 'sb 0' -c "write rrmapino $ino" `_scratch_xfs_db_options` >> $seqres.full
+_scratch_mount >> $seqres.full 2>&1 && echo "mount should have failed"
+
+echo "Check files"
+md5sum $SCRATCH_MNT/f1 2>&1 | _filter_scratch
+
+echo "Try to create more files"
+$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f3 >> $seqres.full 2>&1
+test -e $SCRATCH_MNT/f3 && echo "should not have been able to write f3"
+
+echo "Repair fs"
+_scratch_unmount 2>&1 | _filter_scratch
+$XFS_LOGPRINT_PROG -t $extra_log_options $device 2>&1 \
+		| tee $tmp.logprint | grep -q "<CLEAN>"
+if [ $? -ne 0 ]; then
+	echo "Dirty log, zeroing..." >> $seqres.full
+	_scratch_xfs_repair -L >> $seqres.full 2>&1
+else
+	_scratch_xfs_repair >> $seqres.full 2>&1
+fi
+_scratch_xfs_repair >> $seqres.full 2>&1
+
+echo "Try to create more files (again)"
+_scratch_mount
+$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f4 >> $seqres.full
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/885.out b/tests/xfs/885.out
new file mode 100644
index 0000000..df04f79
--- /dev/null
+++ b/tests/xfs/885.out
@@ -0,0 +1,10 @@
+QA output created by 885
+Format and mount
+Create some files
+Corrupt fs
+Check files
+md5sum: SCRATCH_MNT/f1: No such file or directory
+Try to create more files
+Repair fs
+umount: SCRATCH_DEV: not mounted
+Try to create more files (again)
diff --git a/tests/xfs/886 b/tests/xfs/886
new file mode 100755
index 0000000..81e7e64
--- /dev/null
+++ b/tests/xfs/886
@@ -0,0 +1,104 @@
+#! /bin/bash
+# FS QA Test No. 886
+#
+# Cross-link rrmapino to another inode on an rtrmap fs and see if repair fixes it.
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2016, Oracle and/or its affiliates.  All Rights Reserved.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it would be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write the Free Software Foundation,
+# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+#-----------------------------------------------------------------------
+
+seq=`basename "$0"`
+seqres="$RESULT_DIR/$seq"
+echo "QA output created by $seq"
+
+here=`pwd`
+tmp=/tmp/$$
+status=1    # failure is the default!
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+_cleanup()
+{
+	cd /
+	rm -rf "$tmp".* $metadump_file
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+
+# real QA test starts here
+_supported_os Linux
+_supported_fs xfs
+_require_realtime
+_require_xfs_scratch_rmapbt
+_require_test_program "punch-alternating"
+
+rm -f "$seqres.full"
+
+echo "Format and mount"
+_scratch_mkfs | _filter_mkfs 2>$tmp.mkfs >/dev/null
+. $tmp.mkfs
+cat $tmp.mkfs > "$seqres.full" 2>&1
+_scratch_mkfs > "$seqres.full" 2>&1
+_scratch_mount
+blksz="$(stat -f $SCRATCH_MNT -c '%S')"
+
+i_ptrs=$(( (isize - 176) / 56 ))
+bt_recs=$(( (blksz - 56) / 32 ))
+
+blocks=$((i_ptrs * bt_recs + 1))
+len=$((blocks * rtextsz))
+
+echo "Create some files"
+$XFS_IO_PROG -f -R -c "falloc 0 $len" -c "pwrite -S 0x68 -b 1048576 0 $len" $SCRATCH_MNT/f1 >> $seqres.full
+$XFS_IO_PROG -f -R -c "falloc 0 $len" -c "pwrite -S 0x68 -b 1048576 0 $len" $SCRATCH_MNT/f2 >> $seqres.full
+./src/punch-alternating $SCRATCH_MNT/f1 >> "$seqres.full"
+./src/punch-alternating $SCRATCH_MNT/f2 >> "$seqres.full"
+echo garbage > $SCRATCH_MNT/f3
+ino=$(stat -c '%i' $SCRATCH_MNT/f3)
+_scratch_unmount
+
+echo "Corrupt fs"
+fsbno=$($XFS_DB_PROG -c "inode $ino" -c 'bmap' `_scratch_xfs_db_options` | \
+	sed -e 's/^.*startblock \([0-9]*\) .*$/\1/g')
+
+$XFS_DB_PROG -x -c 'sb 0' -c 'addr rrmapino' \
+	-c "write u3.rtrmapbt.ptrs[1] $fsbno" -c 'p' `_scratch_xfs_db_options` >> $seqres.full
+_scratch_mount
+
+echo "Try to create more files"
+$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f5 >> $seqres.full 2>&1
+test -e $SCRATCH_MNT/f5 && echo "should not have been able to write f5"
+
+echo "Repair fs"
+_scratch_unmount 2>&1 | _filter_scratch
+$XFS_LOGPRINT_PROG -t $extra_log_options $device 2>&1 \
+		| tee $tmp.logprint | grep -q "<CLEAN>"
+if [ $? -ne 0 ]; then
+	echo "Dirty log, zeroing..." >> $seqres.full
+	_scratch_xfs_repair -L >> $seqres.full 2>&1
+else
+	_scratch_xfs_repair >> $seqres.full 2>&1
+fi
+_scratch_xfs_repair >> $seqres.full 2>&1
+
+echo "Try to create more files (again)"
+_scratch_mount
+$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f4 >> $seqres.full
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/886.out b/tests/xfs/886.out
new file mode 100644
index 0000000..7f00c5d
--- /dev/null
+++ b/tests/xfs/886.out
@@ -0,0 +1,7 @@
+QA output created by 886
+Format and mount
+Create some files
+Corrupt fs
+Try to create more files
+Repair fs
+Try to create more files (again)
diff --git a/tests/xfs/887 b/tests/xfs/887
new file mode 100755
index 0000000..05d0b50
--- /dev/null
+++ b/tests/xfs/887
@@ -0,0 +1,108 @@
+#! /bin/bash
+# FS QA Test No. 887
+#
+# Cross-link rrmapino to another inode on an rtrmap fs and see if repair fixes it.
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2016, Oracle and/or its affiliates.  All Rights Reserved.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it would be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write the Free Software Foundation,
+# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+#-----------------------------------------------------------------------
+
+seq=`basename "$0"`
+seqres="$RESULT_DIR/$seq"
+echo "QA output created by $seq"
+
+here=`pwd`
+tmp=/tmp/$$
+status=1    # failure is the default!
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+_cleanup()
+{
+	cd /
+	rm -rf "$tmp".* $metadump_file
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+
+# real QA test starts here
+_supported_os Linux
+_supported_fs xfs
+_require_realtime
+_require_xfs_scratch_rmapbt
+_require_test_program "punch-alternating"
+
+rm -f "$seqres.full"
+
+echo "Format and mount"
+_scratch_mkfs | _filter_mkfs 2>$tmp.mkfs >/dev/null
+. $tmp.mkfs
+cat $tmp.mkfs > "$seqres.full" 2>&1
+_scratch_mkfs > "$seqres.full" 2>&1
+_scratch_mount
+blksz="$(stat -f $SCRATCH_MNT -c '%S')"
+
+i_ptrs=$(( (isize - 176) / 56 ))
+bt_recs=$(( (blksz - 56) / 32 ))
+
+blocks=$((i_ptrs * bt_recs + 1))
+len=$((blocks * rtextsz))
+
+echo "Create some files"
+$XFS_IO_PROG -f -R -c "falloc 0 $len" -c "pwrite -S 0x68 -b 1048576 0 $len" $SCRATCH_MNT/f1 >> $seqres.full
+$XFS_IO_PROG -f -R -c "falloc 0 $len" -c "pwrite -S 0x68 -b 1048576 0 $len" $SCRATCH_MNT/f2 >> $seqres.full
+./src/punch-alternating $SCRATCH_MNT/f1 >> "$seqres.full"
+./src/punch-alternating $SCRATCH_MNT/f2 >> "$seqres.full"
+echo garbage > $SCRATCH_MNT/f3
+ino=$(stat -c '%i' $SCRATCH_MNT/f3)
+_scratch_unmount
+
+echo "Corrupt fs"
+$XFS_DB_PROG -c 'sb 0' -c 'addr rrmapino' \
+	-c 'p u3.rtrmapbt.ptrs[1]' `_scratch_xfs_db_options` >> $seqres.full
+
+fsbno=$($XFS_DB_PROG -c 'sb 0' -c 'addr rrmapino' \
+	-c 'p u3.rtrmapbt.ptrs[1]' `_scratch_xfs_db_options` | sed -e 's/^.*://g')
+$XFS_DB_PROG -x -c "inode $ino" \
+	-c "write u3.bmx[0].startblock $fsbno" `_scratch_xfs_db_options` >> $seqres.full
+_scratch_mount
+
+od -tx1 -Ad -c $SCRATCH_MNT/f3 >> $seqres.full
+
+echo "Try to create more files"
+$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f5 >> $seqres.full 2>&1
+test ! -e $SCRATCH_MNT/f5 && echo "should have been able to write f5"
+
+echo "Repair fs"
+_scratch_unmount 2>&1 | _filter_scratch
+$XFS_LOGPRINT_PROG -t $extra_log_options $device 2>&1 \
+		| tee $tmp.logprint | grep -q "<CLEAN>"
+if [ $? -ne 0 ]; then
+	echo "Dirty log, zeroing..." >> $seqres.full
+	_scratch_xfs_repair -L >> $seqres.full 2>&1
+else
+	_scratch_xfs_repair >> $seqres.full 2>&1
+fi
+_scratch_xfs_repair >> $seqres.full 2>&1
+
+echo "Try to create more files (again)"
+_scratch_mount
+$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f4 >> $seqres.full
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/887.out b/tests/xfs/887.out
new file mode 100644
index 0000000..30cf032
--- /dev/null
+++ b/tests/xfs/887.out
@@ -0,0 +1,7 @@
+QA output created by 887
+Format and mount
+Create some files
+Corrupt fs
+Try to create more files
+Repair fs
+Try to create more files (again)
diff --git a/tests/xfs/888 b/tests/xfs/888
new file mode 100755
index 0000000..dcc9fd8
--- /dev/null
+++ b/tests/xfs/888
@@ -0,0 +1,81 @@
+#! /bin/bash
+# FS QA Test No. 888
+#
+# Basic rmap manipulation tests for realtime files.
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2016, Oracle and/or its affiliates.  All Rights Reserved.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it would be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write the Free Software Foundation,
+# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+#-----------------------------------------------------------------------
+
+seq=`basename "$0"`
+seqres="$RESULT_DIR/$seq"
+echo "QA output created by $seq"
+
+here=`pwd`
+tmp=/tmp/$$
+status=1    # failure is the default!
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+_cleanup()
+{
+	cd /
+	rm -rf "$tmp".* $metadump_file
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+
+# real QA test starts here
+_supported_os Linux
+_supported_fs xfs
+_require_realtime
+_require_xfs_scratch_rmapbt
+_require_xfs_io_command "falloc"
+_require_xfs_io_command "fpunch"
+_require_xfs_io_command "fzero"
+_require_xfs_io_command "fcollapse"
+_require_xfs_io_command "finsert"
+
+rm -f "$seqres.full"
+
+echo "Format and mount"
+_scratch_mkfs > "$seqres.full" 2>&1
+_scratch_mount
+blksz=65536
+blocks=16
+len=$((blocks * blksz))
+
+echo "Create some files"
+$XFS_IO_PROG -f -R -c "falloc 0 $len" -c "pwrite -S 0x68 -b 1048576 0 $len" $SCRATCH_MNT/f1 >> $seqres.full
+
+echo "Manipulate file"
+$XFS_IO_PROG -c "fpunch $blksz $blksz" \
+	-c "fzero $((3 * blksz)) $blksz" \
+	-c "pwrite -S 0x69 $((5 * blksz)) $blksz" \
+	-c "fpunch $((7 * blksz)) $blksz" \
+	-c "fsync" \
+	-c "pwrite -S 0x70 $((7 * blksz)) $blksz" \
+	-c "fcollapse $((9 * blksz)) $blksz" \
+	-c "finsert $((10 * blksz)) $blksz" $SCRATCH_MNT/f1 >> $seqres.full
+
+echo "Check file"
+md5sum $SCRATCH_MNT/f1 | _filter_scratch
+od -tx1 -Ad -c $SCRATCH_MNT/f1 >> $seqres.full
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/888.out b/tests/xfs/888.out
new file mode 100644
index 0000000..2587697
--- /dev/null
+++ b/tests/xfs/888.out
@@ -0,0 +1,6 @@
+QA output created by 888
+Format and mount
+Create some files
+Manipulate file
+Check file
+e45c5707fcf6817e914ffb6ce37a0ac7  SCRATCH_MNT/f1
diff --git a/tests/xfs/group b/tests/xfs/group
index 72580e9..1b0e22a 100644
--- a/tests/xfs/group
+++ b/tests/xfs/group
@@ -313,3 +313,14 @@
 875 auto quick clone fsr quota
 876 auto quick rmap clone
 877 auto quick rmap clone
+878 auto quick rmap
+879 auto quick rmap
+880 auto quick rmap
+881 auto quick rmap
+882 fuzzers rmap
+883 auto quick rmap
+884 auto quick rmap
+885 auto quick rmap
+886 auto quick rmap
+887 auto quick rmap
+888 auto quick rmap


^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [PATCH 09/13] xfs: test realtime rmapbt code
@ 2016-08-25 23:29   ` Darrick J. Wong
  0 siblings, 0 replies; 39+ messages in thread
From: Darrick J. Wong @ 2016-08-25 23:29 UTC (permalink / raw)
  To: david, eguan, darrick.wong; +Cc: linux-xfs, fstests, xfs

Test the realtime rmap btree code by exercising various IO patterns
on realtime files.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 tests/xfs/878     |   91 +++++++++++++++++++++++++++++++++++++++++++
 tests/xfs/878.out |    9 ++++
 tests/xfs/879     |   67 ++++++++++++++++++++++++++++++++
 tests/xfs/879.out |    7 +++
 tests/xfs/880     |   86 +++++++++++++++++++++++++++++++++++++++++
 tests/xfs/880.out |    7 +++
 tests/xfs/881     |   95 +++++++++++++++++++++++++++++++++++++++++++++
 tests/xfs/881.out |    8 ++++
 tests/xfs/882     |  111 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/xfs/882.out |   11 +++++
 tests/xfs/883     |   90 +++++++++++++++++++++++++++++++++++++++++++
 tests/xfs/883.out |   10 +++++
 tests/xfs/884     |   91 +++++++++++++++++++++++++++++++++++++++++++
 tests/xfs/884.out |    9 ++++
 tests/xfs/885     |   95 +++++++++++++++++++++++++++++++++++++++++++++
 tests/xfs/885.out |   10 +++++
 tests/xfs/886     |  104 ++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/xfs/886.out |    7 +++
 tests/xfs/887     |  108 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/xfs/887.out |    7 +++
 tests/xfs/888     |   81 +++++++++++++++++++++++++++++++++++++++
 tests/xfs/888.out |    6 +++
 tests/xfs/group   |   11 +++++
 23 files changed, 1121 insertions(+)
 create mode 100755 tests/xfs/878
 create mode 100644 tests/xfs/878.out
 create mode 100755 tests/xfs/879
 create mode 100644 tests/xfs/879.out
 create mode 100755 tests/xfs/880
 create mode 100644 tests/xfs/880.out
 create mode 100755 tests/xfs/881
 create mode 100644 tests/xfs/881.out
 create mode 100755 tests/xfs/882
 create mode 100644 tests/xfs/882.out
 create mode 100755 tests/xfs/883
 create mode 100644 tests/xfs/883.out
 create mode 100755 tests/xfs/884
 create mode 100644 tests/xfs/884.out
 create mode 100755 tests/xfs/885
 create mode 100644 tests/xfs/885.out
 create mode 100755 tests/xfs/886
 create mode 100644 tests/xfs/886.out
 create mode 100755 tests/xfs/887
 create mode 100644 tests/xfs/887.out
 create mode 100755 tests/xfs/888
 create mode 100644 tests/xfs/888.out


diff --git a/tests/xfs/878 b/tests/xfs/878
new file mode 100755
index 0000000..557e4ae
--- /dev/null
+++ b/tests/xfs/878
@@ -0,0 +1,91 @@
+#! /bin/bash
+# FS QA Test No. 878
+#
+# Set rrmapino to another inode on an non-rt rmap fs and see if repair fixes it.
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2016, Oracle and/or its affiliates.  All Rights Reserved.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it would be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write the Free Software Foundation,
+# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+#-----------------------------------------------------------------------
+
+seq=`basename "$0"`
+seqres="$RESULT_DIR/$seq"
+echo "QA output created by $seq"
+
+here=`pwd`
+tmp=/tmp/$$
+status=1    # failure is the default!
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+_cleanup()
+{
+	cd /
+	rm -rf "$tmp".* $metadump_file
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+
+# real QA test starts here
+_supported_os Linux
+_supported_fs xfs
+_require_xfs_scratch_rmapbt
+
+rm -f "$seqres.full"
+
+unset SCRATCH_RTDEV
+
+echo "Format and mount"
+_scratch_mkfs > "$seqres.full" 2>&1
+_scratch_mount
+
+echo "Create some files"
+$XFS_IO_PROG -f -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f1 >> $seqres.full
+$XFS_IO_PROG -f -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f2 >> $seqres.full
+echo garbage > $SCRATCH_MNT/f3
+ino=$(stat -c '%i' $SCRATCH_MNT/f3)
+_scratch_unmount
+
+echo "Corrupt fs"
+$XFS_DB_PROG -x -c 'sb 0' \
+	-c "write rrmapino $ino" `_scratch_xfs_db_options` >> $seqres.full
+_scratch_mount
+
+echo "Check files"
+md5sum $SCRATCH_MNT/f1 2>&1 | _filter_scratch
+
+echo "Try to create more files"
+$XFS_IO_PROG -f -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f3 >> $seqres.full 2>&1
+
+echo "Repair fs"
+_scratch_unmount 2>&1 | _filter_scratch
+$XFS_LOGPRINT_PROG -t $extra_log_options $device 2>&1 \
+		| tee $tmp.logprint | grep -q "<CLEAN>"
+if [ $? -ne 0 ]; then
+	echo "Dirty log, zeroing..." >> $seqres.full
+	_scratch_xfs_repair -L >> $seqres.full 2>&1
+else
+	_scratch_xfs_repair >> $seqres.full 2>&1
+fi
+_scratch_xfs_repair >> $seqres.full 2>&1
+
+echo "Try to create more files (again)"
+_scratch_mount
+$XFS_IO_PROG -f -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f4 >> $seqres.full
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/878.out b/tests/xfs/878.out
new file mode 100644
index 0000000..e134506
--- /dev/null
+++ b/tests/xfs/878.out
@@ -0,0 +1,9 @@
+QA output created by 878
+Format and mount
+Create some files
+Corrupt fs
+Check files
+8f27047948255cb84872e2dd7c0bc56d  SCRATCH_MNT/f1
+Try to create more files
+Repair fs
+Try to create more files (again)
diff --git a/tests/xfs/879 b/tests/xfs/879
new file mode 100755
index 0000000..247b3af
--- /dev/null
+++ b/tests/xfs/879
@@ -0,0 +1,67 @@
+#! /bin/bash
+# FS QA Test No. 879
+#
+# Ensure that we can create a few realtime files on a rmapbt filesystem.
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2016, Oracle and/or its affiliates.  All Rights Reserved.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it would be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write the Free Software Foundation,
+# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+#-----------------------------------------------------------------------
+
+seq=`basename "$0"`
+seqres="$RESULT_DIR/$seq"
+echo "QA output created by $seq"
+
+here=`pwd`
+tmp=/tmp/$$
+status=1    # failure is the default!
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+_cleanup()
+{
+	cd /
+	rm -rf "$tmp".*
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+
+# real QA test starts here
+_supported_os Linux
+_supported_fs xfs
+_require_realtime
+_require_xfs_scratch_rmapbt
+
+rm -f "$seqres.full"
+
+echo "Format and mount"
+_scratch_mkfs > "$seqres.full" 2>&1
+_scratch_mount
+
+echo "Create a few files"
+$XFS_IO_PROG -f -R -c 'pwrite -S 0x67 0 50000' -c fsync $SCRATCH_MNT/f1 >> $seqres.full
+$XFS_IO_PROG -f -R -c 'pwrite -S 0x67 0 50000' -c fsync $SCRATCH_MNT/f2 >> $seqres.full
+_scratch_cycle_mount
+
+echo "Grab contents"
+md5sum $SCRATCH_MNT/f1 $SCRATCH_MNT/f2 | _filter_scratch
+
+echo "Remove one file"
+rm -rf $SCRATCH_MNT/f2
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/879.out b/tests/xfs/879.out
new file mode 100644
index 0000000..9dfe48b
--- /dev/null
+++ b/tests/xfs/879.out
@@ -0,0 +1,7 @@
+QA output created by 879
+Format and mount
+Create a few files
+Grab contents
+10abe2628d19eb1c2ebe18aad7b14820  SCRATCH_MNT/f1
+10abe2628d19eb1c2ebe18aad7b14820  SCRATCH_MNT/f2
+Remove one file
diff --git a/tests/xfs/880 b/tests/xfs/880
new file mode 100755
index 0000000..8cd509f
--- /dev/null
+++ b/tests/xfs/880
@@ -0,0 +1,86 @@
+#! /bin/bash
+# FS QA Test No. 880
+#
+# Exercise expanding and shrinking the realtime rmap btree.
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2016, Oracle and/or its affiliates.  All Rights Reserved.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it would be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write the Free Software Foundation,
+# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+#-----------------------------------------------------------------------
+
+seq=`basename "$0"`
+seqres="$RESULT_DIR/$seq"
+echo "QA output created by $seq"
+
+here=`pwd`
+tmp=/tmp/$$
+status=1    # failure is the default!
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+_cleanup()
+{
+	cd /
+	rm -rf "$tmp".*
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+
+# real QA test starts here
+_supported_os Linux
+_supported_fs xfs
+_require_realtime
+_require_xfs_scratch_rmapbt
+_require_test_program "punch-alternating"
+_require_xfs_io_command "falloc"
+
+rm -f "$seqres.full"
+
+echo "Format and mount"
+_scratch_mkfs | _filter_mkfs 2>$tmp.mkfs >/dev/null
+. $tmp.mkfs
+cat $tmp.mkfs > "$seqres.full" 2>&1
+_scratch_mount
+blksz="$(stat -f $SCRATCH_MNT -c '%S')"
+
+echo "Create a three-level rtrmapbt"
+i_ptrs=$(( (isize - 176) / 56 ))
+bt_ptrs=$(( (blksz - 56) / 56 ))
+bt_recs=$(( (blksz - 56) / 32 ))
+
+blocks=$((i_ptrs * bt_ptrs * bt_recs))
+_require_fs_space $SCRATCH_MNT $(( (2 * blocks * blksz) * 5 / 4096 ))
+len=$((blocks * rtextsz))
+
+echo "Create big file"
+$XFS_IO_PROG -f -R -c "falloc 0 $len" -c "pwrite -S 0x68 -b 1048576 0 $len" $SCRATCH_MNT/f1 >> $seqres.full
+$XFS_IO_PROG -f -R -c "falloc 0 $len" -c "pwrite -S 0x68 -b 1048576 0 $len" $SCRATCH_MNT/f2 >> $seqres.full
+
+echo "Explode the rtrmapbt"
+./src/punch-alternating $SCRATCH_MNT/f1 >> "$seqres.full"
+./src/punch-alternating $SCRATCH_MNT/f2 >> "$seqres.full"
+_scratch_cycle_mount
+
+echo "Remove half the records"
+rm -rf $SCRATCH_MNT/f1
+_scratch_cycle_mount
+
+echo "Remove the rest of the records"
+rm -rf $SCRATCH_MNT/f2
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/880.out b/tests/xfs/880.out
new file mode 100644
index 0000000..b87665b
--- /dev/null
+++ b/tests/xfs/880.out
@@ -0,0 +1,7 @@
+QA output created by 880
+Format and mount
+Create a three-level rtrmapbt
+Create big file
+Explode the rtrmapbt
+Remove half the records
+Remove the rest of the records
diff --git a/tests/xfs/881 b/tests/xfs/881
new file mode 100755
index 0000000..750a92a
--- /dev/null
+++ b/tests/xfs/881
@@ -0,0 +1,95 @@
+#! /bin/bash
+# FS QA Test No. 881
+#
+# Exercise metadump on realtime rmapbt preservation.
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2016, Oracle and/or its affiliates.  All Rights Reserved.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it would be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write the Free Software Foundation,
+# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+#-----------------------------------------------------------------------
+
+seq=`basename "$0"`
+seqres="$RESULT_DIR/$seq"
+echo "QA output created by $seq"
+
+here=`pwd`
+tmp=/tmp/$$
+status=1    # failure is the default!
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+_cleanup()
+{
+	cd /
+	rm -rf "$tmp".* $metadump_file
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+
+# real QA test starts here
+_supported_os Linux
+_supported_fs xfs
+_require_realtime
+_require_xfs_scratch_rmapbt
+_require_test_program "punch-alternating"
+_require_xfs_io_command "falloc"
+
+rm -f "$seqres.full"
+
+echo "Format and mount"
+_scratch_mkfs | _filter_mkfs 2>$tmp.mkfs >/dev/null
+. $tmp.mkfs
+cat $tmp.mkfs > "$seqres.full" 2>&1
+_scratch_mount
+blksz="$(stat -f $SCRATCH_MNT -c '%S')"
+
+metadump_file=$TEST_DIR/${seq}_metadump
+rm -rf $metadump_file
+
+echo "Create a three-level rtrmapbt"
+i_ptrs=$(( (isize - 176) / 56 ))
+bt_ptrs=$(( (blksz - 56) / 56 ))
+bt_recs=$(( (blksz - 56) / 32 ))
+
+blocks=$((i_ptrs * bt_ptrs * bt_recs))
+_require_fs_space $SCRATCH_MNT $(( (2 * blocks * blksz) * 5 / 4096 ))
+len=$((blocks * rtextsz))
+
+echo "Create big file"
+$XFS_IO_PROG -f -R -c "falloc 0 $len" -c "pwrite -S 0x68 -b 1048576 0 $len" $SCRATCH_MNT/f1 >> $seqres.full
+$XFS_IO_PROG -f -R -c "falloc 0 $len" -c "pwrite -S 0x68 -b 1048576 0 $len" $SCRATCH_MNT/f2 >> $seqres.full
+
+echo "Explode the rtrmapbt"
+./src/punch-alternating $SCRATCH_MNT/f1 >> "$seqres.full"
+./src/punch-alternating $SCRATCH_MNT/f2 >> "$seqres.full"
+_scratch_cycle_mount
+
+echo "Create metadump file"
+_scratch_unmount
+_scratch_metadump $metadump_file
+
+# Now restore the obfuscated one back and take a look around
+echo "Restore metadump"
+xfs_mdrestore $metadump_file $TEST_DIR/image
+SCRATCH_DEV=$TEST_DIR/image _scratch_mount
+SCRATCH_DEV=$TEST_DIR/image _scratch_unmount
+
+echo "Check restored fs"
+_check_generic_filesystem $metadump_file
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/881.out b/tests/xfs/881.out
new file mode 100644
index 0000000..6ad156c
--- /dev/null
+++ b/tests/xfs/881.out
@@ -0,0 +1,8 @@
+QA output created by 881
+Format and mount
+Create a three-level rtrmapbt
+Create big file
+Explode the rtrmapbt
+Create metadump file
+Restore metadump
+Check restored fs
diff --git a/tests/xfs/882 b/tests/xfs/882
new file mode 100755
index 0000000..3c44540
--- /dev/null
+++ b/tests/xfs/882
@@ -0,0 +1,111 @@
+#! /bin/bash
+# FS QA Test No. 882
+#
+# Corrupt the realtime rmapbt and see how the kernel and xfs_repair deal.
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2016, Oracle and/or its affiliates.  All Rights Reserved.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it would be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write the Free Software Foundation,
+# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+#-----------------------------------------------------------------------
+
+seq=`basename "$0"`
+seqres="$RESULT_DIR/$seq"
+echo "QA output created by $seq"
+
+here=`pwd`
+tmp=/tmp/$$
+status=1    # failure is the default!
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+_cleanup()
+{
+	cd /
+	rm -rf "$tmp".*
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+
+# real QA test starts here
+_supported_os Linux
+_supported_fs xfs
+_require_realtime
+_require_xfs_scratch_rmapbt
+_require_test_program "punch-alternating"
+_require_xfs_io_command "falloc"
+
+rm -f "$seqres.full"
+
+echo "+ create scratch fs"
+_scratch_mkfs | _filter_mkfs 2>$tmp.mkfs >/dev/null
+. $tmp.mkfs
+cat $tmp.mkfs > "$seqres.full" 2>&1
+
+echo "+ mount fs image"
+_scratch_mount
+blksz="$(stat -f $SCRATCH_MNT -c '%S')"
+
+i_ptrs=$(( (isize - 176) / 56 ))
+bt_ptrs=$(( (blksz - 56) / 56 ))
+bt_recs=$(( (blksz - 56) / 32 ))
+
+blocks=$((i_ptrs * bt_ptrs * bt_recs + 1))
+_require_fs_space $SCRATCH_MNT $(( (2 * blocks * blksz) * 5 / 4096 ))
+len=$((blocks * blksz))
+
+echo "+ make some files"
+$XFS_IO_PROG -f -R -c "falloc 0 $len" -c "pwrite -S 0x68 -b 1048576 0 $len" $SCRATCH_MNT/f1 >> $seqres.full
+$XFS_IO_PROG -f -R -c "falloc 0 $len" -c "pwrite -S 0x68 -b 1048576 0 $len" $SCRATCH_MNT/f2 >> $seqres.full
+./src/punch-alternating $SCRATCH_MNT/f1 >> "$seqres.full"
+./src/punch-alternating $SCRATCH_MNT/f2 >> "$seqres.full"
+_scratch_unmount
+
+echo "+ check fs"
+_scratch_xfs_repair -n >> $seqres.full 2>&1 || echo "xfs_repair should not fail"
+
+echo "+ corrupt image"
+$XFS_DB_PROG -x -c "sb" -c "addr rrmapino" -c "addr u3.rtrmapbt.ptrs[1]" \
+	-c "stack" -c "blocktrash -x 4096 -y 4096 -n 8 -3 -z" \
+	`_scratch_xfs_db_options` >> $seqres.full 2>&1
+
+echo "+ mount image"
+_scratch_mount
+
+echo "+ copy more"
+$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 1" $SCRATCH_MNT/e3 >> $seqres.full 2>&1
+test -s ${SCRATCH_MNT}/f3 && echo "should not be able to copy with busted rtrmap btree"
+_scratch_unmount
+
+echo "+ repair fs"
+$XFS_LOGPRINT_PROG -t $extra_log_options $device 2>&1 \
+		| tee $tmp.logprint | grep -q "<CLEAN>"
+if [ $? -ne 0 ]; then
+	echo "Dirty log, zeroing..." >> $seqres.full
+	_scratch_xfs_repair -L >> $seqres.full 2>&1
+else
+	_scratch_xfs_repair >> $seqres.full 2>&1
+fi
+_scratch_xfs_repair >> $seqres.full 2>&1
+
+echo "+ mount image (2)"
+_scratch_mount
+
+echo "+ copy more (2)"
+$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 1" $SCRATCH_MNT/e4 >> $seqres.full
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/882.out b/tests/xfs/882.out
new file mode 100644
index 0000000..5ebe620
--- /dev/null
+++ b/tests/xfs/882.out
@@ -0,0 +1,11 @@
+QA output created by 882
++ create scratch fs
++ mount fs image
++ make some files
++ check fs
++ corrupt image
++ mount image
++ copy more
++ repair fs
++ mount image (2)
++ copy more (2)
diff --git a/tests/xfs/883 b/tests/xfs/883
new file mode 100755
index 0000000..86dd047
--- /dev/null
+++ b/tests/xfs/883
@@ -0,0 +1,90 @@
+#! /bin/bash
+# FS QA Test No. 883
+#
+# Set rrmapino to zero on an rtrmap fs and see if repair fixes it.
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2016, Oracle and/or its affiliates.  All Rights Reserved.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it would be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write the Free Software Foundation,
+# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+#-----------------------------------------------------------------------
+
+seq=`basename "$0"`
+seqres="$RESULT_DIR/$seq"
+echo "QA output created by $seq"
+
+here=`pwd`
+tmp=/tmp/$$
+status=1    # failure is the default!
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+_cleanup()
+{
+	cd /
+	rm -rf "$tmp".* $metadump_file
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+
+# real QA test starts here
+_supported_os Linux
+_supported_fs xfs
+_require_realtime
+_require_xfs_scratch_rmapbt
+
+rm -f "$seqres.full"
+
+echo "Format and mount"
+_scratch_mkfs > "$seqres.full" 2>&1
+_scratch_mount
+
+echo "Create some files"
+$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f1 >> $seqres.full
+$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f2 >> $seqres.full
+_scratch_unmount
+
+echo "Corrupt fs"
+$XFS_DB_PROG -x -c 'sb 0' -c 'addr rrmapino' \
+	-c 'write core.nlinkv2 0' -c 'write core.mode 0' -c 'sb 0' \
+	-c 'write rrmapino 0' `_scratch_xfs_db_options` >> $seqres.full
+_scratch_mount >> $seqres.full 2>&1 && echo "mount should have failed"
+
+echo "Check files"
+md5sum $SCRATCH_MNT/f1 2>&1 | _filter_scratch
+
+echo "Try to create more files"
+$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f3 >> $seqres.full 2>&1
+test -e $SCRATCH_MNT/f3 && echo "should not have been able to write f3"
+
+echo "Repair fs"
+_scratch_unmount 2>&1 | _filter_scratch
+$XFS_LOGPRINT_PROG -t $extra_log_options $device 2>&1 \
+		| tee $tmp.logprint | grep -q "<CLEAN>"
+if [ $? -ne 0 ]; then
+	echo "Dirty log, zeroing..." >> $seqres.full
+	_scratch_xfs_repair -L >> $seqres.full 2>&1
+else
+	_scratch_xfs_repair >> $seqres.full 2>&1
+fi
+_scratch_xfs_repair >> $seqres.full 2>&1
+
+echo "Try to create more files (again)"
+_scratch_mount
+$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f4 >> $seqres.full
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/883.out b/tests/xfs/883.out
new file mode 100644
index 0000000..6e75ac1
--- /dev/null
+++ b/tests/xfs/883.out
@@ -0,0 +1,10 @@
+QA output created by 883
+Format and mount
+Create some files
+Corrupt fs
+Check files
+md5sum: SCRATCH_MNT/f1: No such file or directory
+Try to create more files
+Repair fs
+umount: SCRATCH_DEV: not mounted
+Try to create more files (again)
diff --git a/tests/xfs/884 b/tests/xfs/884
new file mode 100755
index 0000000..51071e0
--- /dev/null
+++ b/tests/xfs/884
@@ -0,0 +1,91 @@
+#! /bin/bash
+# FS QA Test No. 884
+#
+# Link rrmapino into the rootdir on an rtrmap fs and see if repair fixes it.
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2016, Oracle and/or its affiliates.  All Rights Reserved.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it would be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write the Free Software Foundation,
+# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+#-----------------------------------------------------------------------
+
+seq=`basename "$0"`
+seqres="$RESULT_DIR/$seq"
+echo "QA output created by $seq"
+
+here=`pwd`
+tmp=/tmp/$$
+status=1    # failure is the default!
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+_cleanup()
+{
+	cd /
+	rm -rf "$tmp".* $metadump_file
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+
+# real QA test starts here
+_supported_os Linux
+_supported_fs xfs
+_require_realtime
+_require_xfs_scratch_rmapbt
+
+rm -f "$seqres.full"
+
+echo "Format and mount"
+_scratch_mkfs > "$seqres.full" 2>&1
+_scratch_mount
+
+echo "Create some files"
+$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f1 >> $seqres.full
+$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f2 >> $seqres.full
+echo garbage > $SCRATCH_MNT/f3
+ln $SCRATCH_MNT/f3 $SCRATCH_MNT/f4
+_scratch_unmount
+
+echo "Corrupt fs"
+rrmapino=$($XFS_DB_PROG -c 'sb 0' -c 'p rrmapino' `_scratch_xfs_db_options` | awk '{print $3}')
+$XFS_DB_PROG -x -c 'sb 0' -c 'addr rootino' \
+	-c "write u3.sfdir3.list[3].inumber.i4 $rrmapino" `_scratch_xfs_db_options` >> $seqres.full
+_scratch_mount
+
+echo "Check files"
+md5sum $SCRATCH_MNT/f1 2>&1 | _filter_scratch
+
+echo "Try to create more files"
+$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f5 >> $seqres.full 2>&1
+
+echo "Repair fs"
+_scratch_unmount 2>&1 | _filter_scratch
+$XFS_LOGPRINT_PROG -t $extra_log_options $device 2>&1 \
+		| tee $tmp.logprint | grep -q "<CLEAN>"
+if [ $? -ne 0 ]; then
+	echo "Dirty log, zeroing..." >> $seqres.full
+	_scratch_xfs_repair -L >> $seqres.full 2>&1
+else
+	_scratch_xfs_repair >> $seqres.full 2>&1
+fi
+_scratch_xfs_repair >> $seqres.full 2>&1
+
+echo "Try to create more files (again)"
+_scratch_mount
+$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f4 >> $seqres.full
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/884.out b/tests/xfs/884.out
new file mode 100644
index 0000000..17a73ef
--- /dev/null
+++ b/tests/xfs/884.out
@@ -0,0 +1,9 @@
+QA output created by 884
+Format and mount
+Create some files
+Corrupt fs
+Check files
+8f27047948255cb84872e2dd7c0bc56d  SCRATCH_MNT/f1
+Try to create more files
+Repair fs
+Try to create more files (again)
diff --git a/tests/xfs/885 b/tests/xfs/885
new file mode 100755
index 0000000..1839c11
--- /dev/null
+++ b/tests/xfs/885
@@ -0,0 +1,95 @@
+#! /bin/bash
+# FS QA Test No. 885
+#
+# Set rrmapino to another inode on an rtrmap fs and see if repair fixes it.
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2016, Oracle and/or its affiliates.  All Rights Reserved.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it would be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write the Free Software Foundation,
+# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+#-----------------------------------------------------------------------
+
+seq=`basename "$0"`
+seqres="$RESULT_DIR/$seq"
+echo "QA output created by $seq"
+
+here=`pwd`
+tmp=/tmp/$$
+status=1    # failure is the default!
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+_cleanup()
+{
+	cd /
+	rm -rf "$tmp".* $metadump_file
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+
+# real QA test starts here
+_supported_os Linux
+_supported_fs xfs
+_require_realtime
+_require_xfs_scratch_rmapbt
+
+rm -f "$seqres.full"
+
+echo "Format and mount"
+_scratch_mkfs > "$seqres.full" 2>&1
+_scratch_mount
+
+echo "Create some files"
+$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f1 >> $seqres.full
+$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f2 >> $seqres.full
+echo garbage > $SCRATCH_MNT/f3
+ino=$(stat -c '%i' $SCRATCH_MNT/f3)
+_scratch_unmount
+
+echo "Corrupt fs"
+rrmapino=$($XFS_DB_PROG -c 'sb 0' -c 'p rrmapino' `_scratch_xfs_db_options` | awk '{print $3}')
+$XFS_DB_PROG -x -c "inode $rrmapino" \
+	-c 'write core.format 2' -c 'write core.size 0' \
+	-c 'write core.nblocks 0' -c 'sb 0' -c 'addr rootino' \
+	-c "write u3.sfdir3.list[2].inumber.i4 $rrmapino" \
+	-c 'sb 0' -c "write rrmapino $ino" `_scratch_xfs_db_options` >> $seqres.full
+_scratch_mount >> $seqres.full 2>&1 && echo "mount should have failed"
+
+echo "Check files"
+md5sum $SCRATCH_MNT/f1 2>&1 | _filter_scratch
+
+echo "Try to create more files"
+$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f3 >> $seqres.full 2>&1
+test -e $SCRATCH_MNT/f3 && echo "should not have been able to write f3"
+
+echo "Repair fs"
+_scratch_unmount 2>&1 | _filter_scratch
+$XFS_LOGPRINT_PROG -t $extra_log_options $device 2>&1 \
+		| tee $tmp.logprint | grep -q "<CLEAN>"
+if [ $? -ne 0 ]; then
+	echo "Dirty log, zeroing..." >> $seqres.full
+	_scratch_xfs_repair -L >> $seqres.full 2>&1
+else
+	_scratch_xfs_repair >> $seqres.full 2>&1
+fi
+_scratch_xfs_repair >> $seqres.full 2>&1
+
+echo "Try to create more files (again)"
+_scratch_mount
+$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f4 >> $seqres.full
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/885.out b/tests/xfs/885.out
new file mode 100644
index 0000000..df04f79
--- /dev/null
+++ b/tests/xfs/885.out
@@ -0,0 +1,10 @@
+QA output created by 885
+Format and mount
+Create some files
+Corrupt fs
+Check files
+md5sum: SCRATCH_MNT/f1: No such file or directory
+Try to create more files
+Repair fs
+umount: SCRATCH_DEV: not mounted
+Try to create more files (again)
diff --git a/tests/xfs/886 b/tests/xfs/886
new file mode 100755
index 0000000..81e7e64
--- /dev/null
+++ b/tests/xfs/886
@@ -0,0 +1,104 @@
+#! /bin/bash
+# FS QA Test No. 886
+#
+# Cross-link rrmapino to another inode on an rtrmap fs and see if repair fixes it.
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2016, Oracle and/or its affiliates.  All Rights Reserved.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it would be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write the Free Software Foundation,
+# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+#-----------------------------------------------------------------------
+
+seq=`basename "$0"`
+seqres="$RESULT_DIR/$seq"
+echo "QA output created by $seq"
+
+here=`pwd`
+tmp=/tmp/$$
+status=1    # failure is the default!
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+_cleanup()
+{
+	cd /
+	rm -rf "$tmp".* $metadump_file
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+
+# real QA test starts here
+_supported_os Linux
+_supported_fs xfs
+_require_realtime
+_require_xfs_scratch_rmapbt
+_require_test_program "punch-alternating"
+
+rm -f "$seqres.full"
+
+echo "Format and mount"
+_scratch_mkfs | _filter_mkfs 2>$tmp.mkfs >/dev/null
+. $tmp.mkfs
+cat $tmp.mkfs > "$seqres.full" 2>&1
+_scratch_mkfs > "$seqres.full" 2>&1
+_scratch_mount
+blksz="$(stat -f $SCRATCH_MNT -c '%S')"
+
+i_ptrs=$(( (isize - 176) / 56 ))
+bt_recs=$(( (blksz - 56) / 32 ))
+
+blocks=$((i_ptrs * bt_recs + 1))
+len=$((blocks * rtextsz))
+
+echo "Create some files"
+$XFS_IO_PROG -f -R -c "falloc 0 $len" -c "pwrite -S 0x68 -b 1048576 0 $len" $SCRATCH_MNT/f1 >> $seqres.full
+$XFS_IO_PROG -f -R -c "falloc 0 $len" -c "pwrite -S 0x68 -b 1048576 0 $len" $SCRATCH_MNT/f2 >> $seqres.full
+./src/punch-alternating $SCRATCH_MNT/f1 >> "$seqres.full"
+./src/punch-alternating $SCRATCH_MNT/f2 >> "$seqres.full"
+echo garbage > $SCRATCH_MNT/f3
+ino=$(stat -c '%i' $SCRATCH_MNT/f3)
+_scratch_unmount
+
+echo "Corrupt fs"
+fsbno=$($XFS_DB_PROG -c "inode $ino" -c 'bmap' `_scratch_xfs_db_options` | \
+	sed -e 's/^.*startblock \([0-9]*\) .*$/\1/g')
+
+$XFS_DB_PROG -x -c 'sb 0' -c 'addr rrmapino' \
+	-c "write u3.rtrmapbt.ptrs[1] $fsbno" -c 'p' `_scratch_xfs_db_options` >> $seqres.full
+_scratch_mount
+
+echo "Try to create more files"
+$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f5 >> $seqres.full 2>&1
+test -e $SCRATCH_MNT/f5 && echo "should not have been able to write f5"
+
+echo "Repair fs"
+_scratch_unmount 2>&1 | _filter_scratch
+$XFS_LOGPRINT_PROG -t $extra_log_options $device 2>&1 \
+		| tee $tmp.logprint | grep -q "<CLEAN>"
+if [ $? -ne 0 ]; then
+	echo "Dirty log, zeroing..." >> $seqres.full
+	_scratch_xfs_repair -L >> $seqres.full 2>&1
+else
+	_scratch_xfs_repair >> $seqres.full 2>&1
+fi
+_scratch_xfs_repair >> $seqres.full 2>&1
+
+echo "Try to create more files (again)"
+_scratch_mount
+$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f4 >> $seqres.full
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/886.out b/tests/xfs/886.out
new file mode 100644
index 0000000..7f00c5d
--- /dev/null
+++ b/tests/xfs/886.out
@@ -0,0 +1,7 @@
+QA output created by 886
+Format and mount
+Create some files
+Corrupt fs
+Try to create more files
+Repair fs
+Try to create more files (again)
diff --git a/tests/xfs/887 b/tests/xfs/887
new file mode 100755
index 0000000..05d0b50
--- /dev/null
+++ b/tests/xfs/887
@@ -0,0 +1,108 @@
+#! /bin/bash
+# FS QA Test No. 887
+#
+# Cross-link rrmapino to another inode on an rtrmap fs and see if repair fixes it.
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2016, Oracle and/or its affiliates.  All Rights Reserved.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it would be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write the Free Software Foundation,
+# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+#-----------------------------------------------------------------------
+
+seq=`basename "$0"`
+seqres="$RESULT_DIR/$seq"
+echo "QA output created by $seq"
+
+here=`pwd`
+tmp=/tmp/$$
+status=1    # failure is the default!
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+_cleanup()
+{
+	cd /
+	rm -rf "$tmp".* $metadump_file
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+
+# real QA test starts here
+_supported_os Linux
+_supported_fs xfs
+_require_realtime
+_require_xfs_scratch_rmapbt
+_require_test_program "punch-alternating"
+
+rm -f "$seqres.full"
+
+echo "Format and mount"
+_scratch_mkfs | _filter_mkfs 2>$tmp.mkfs >/dev/null
+. $tmp.mkfs
+cat $tmp.mkfs > "$seqres.full" 2>&1
+_scratch_mkfs > "$seqres.full" 2>&1
+_scratch_mount
+blksz="$(stat -f $SCRATCH_MNT -c '%S')"
+
+i_ptrs=$(( (isize - 176) / 56 ))
+bt_recs=$(( (blksz - 56) / 32 ))
+
+blocks=$((i_ptrs * bt_recs + 1))
+len=$((blocks * rtextsz))
+
+echo "Create some files"
+$XFS_IO_PROG -f -R -c "falloc 0 $len" -c "pwrite -S 0x68 -b 1048576 0 $len" $SCRATCH_MNT/f1 >> $seqres.full
+$XFS_IO_PROG -f -R -c "falloc 0 $len" -c "pwrite -S 0x68 -b 1048576 0 $len" $SCRATCH_MNT/f2 >> $seqres.full
+./src/punch-alternating $SCRATCH_MNT/f1 >> "$seqres.full"
+./src/punch-alternating $SCRATCH_MNT/f2 >> "$seqres.full"
+echo garbage > $SCRATCH_MNT/f3
+ino=$(stat -c '%i' $SCRATCH_MNT/f3)
+_scratch_unmount
+
+echo "Corrupt fs"
+$XFS_DB_PROG -c 'sb 0' -c 'addr rrmapino' \
+	-c 'p u3.rtrmapbt.ptrs[1]' `_scratch_xfs_db_options` >> $seqres.full
+
+fsbno=$($XFS_DB_PROG -c 'sb 0' -c 'addr rrmapino' \
+	-c 'p u3.rtrmapbt.ptrs[1]' `_scratch_xfs_db_options` | sed -e 's/^.*://g')
+$XFS_DB_PROG -x -c "inode $ino" \
+	-c "write u3.bmx[0].startblock $fsbno" `_scratch_xfs_db_options` >> $seqres.full
+_scratch_mount
+
+od -tx1 -Ad -c $SCRATCH_MNT/f3 >> $seqres.full
+
+echo "Try to create more files"
+$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f5 >> $seqres.full 2>&1
+test ! -e $SCRATCH_MNT/f5 && echo "should have been able to write f5"
+
+echo "Repair fs"
+_scratch_unmount 2>&1 | _filter_scratch
+$XFS_LOGPRINT_PROG -t $extra_log_options $device 2>&1 \
+		| tee $tmp.logprint | grep -q "<CLEAN>"
+if [ $? -ne 0 ]; then
+	echo "Dirty log, zeroing..." >> $seqres.full
+	_scratch_xfs_repair -L >> $seqres.full 2>&1
+else
+	_scratch_xfs_repair >> $seqres.full 2>&1
+fi
+_scratch_xfs_repair >> $seqres.full 2>&1
+
+echo "Try to create more files (again)"
+_scratch_mount
+$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f4 >> $seqres.full
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/887.out b/tests/xfs/887.out
new file mode 100644
index 0000000..30cf032
--- /dev/null
+++ b/tests/xfs/887.out
@@ -0,0 +1,7 @@
+QA output created by 887
+Format and mount
+Create some files
+Corrupt fs
+Try to create more files
+Repair fs
+Try to create more files (again)
diff --git a/tests/xfs/888 b/tests/xfs/888
new file mode 100755
index 0000000..dcc9fd8
--- /dev/null
+++ b/tests/xfs/888
@@ -0,0 +1,81 @@
+#! /bin/bash
+# FS QA Test No. 888
+#
+# Basic rmap manipulation tests for realtime files.
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2016, Oracle and/or its affiliates.  All Rights Reserved.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it would be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write the Free Software Foundation,
+# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+#-----------------------------------------------------------------------
+
+seq=`basename "$0"`
+seqres="$RESULT_DIR/$seq"
+echo "QA output created by $seq"
+
+here=`pwd`
+tmp=/tmp/$$
+status=1    # failure is the default!
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+_cleanup()
+{
+	cd /
+	rm -rf "$tmp".* $metadump_file
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+
+# real QA test starts here
+_supported_os Linux
+_supported_fs xfs
+_require_realtime
+_require_xfs_scratch_rmapbt
+_require_xfs_io_command "falloc"
+_require_xfs_io_command "fpunch"
+_require_xfs_io_command "fzero"
+_require_xfs_io_command "fcollapse"
+_require_xfs_io_command "finsert"
+
+rm -f "$seqres.full"
+
+echo "Format and mount"
+_scratch_mkfs > "$seqres.full" 2>&1
+_scratch_mount
+blksz=65536
+blocks=16
+len=$((blocks * blksz))
+
+echo "Create some files"
+$XFS_IO_PROG -f -R -c "falloc 0 $len" -c "pwrite -S 0x68 -b 1048576 0 $len" $SCRATCH_MNT/f1 >> $seqres.full
+
+echo "Manipulate file"
+$XFS_IO_PROG -c "fpunch $blksz $blksz" \
+	-c "fzero $((3 * blksz)) $blksz" \
+	-c "pwrite -S 0x69 $((5 * blksz)) $blksz" \
+	-c "fpunch $((7 * blksz)) $blksz" \
+	-c "fsync" \
+	-c "pwrite -S 0x70 $((7 * blksz)) $blksz" \
+	-c "fcollapse $((9 * blksz)) $blksz" \
+	-c "finsert $((10 * blksz)) $blksz" $SCRATCH_MNT/f1 >> $seqres.full
+
+echo "Check file"
+md5sum $SCRATCH_MNT/f1 | _filter_scratch
+od -tx1 -Ad -c $SCRATCH_MNT/f1 >> $seqres.full
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/888.out b/tests/xfs/888.out
new file mode 100644
index 0000000..2587697
--- /dev/null
+++ b/tests/xfs/888.out
@@ -0,0 +1,6 @@
+QA output created by 888
+Format and mount
+Create some files
+Manipulate file
+Check file
+e45c5707fcf6817e914ffb6ce37a0ac7  SCRATCH_MNT/f1
diff --git a/tests/xfs/group b/tests/xfs/group
index 72580e9..1b0e22a 100644
--- a/tests/xfs/group
+++ b/tests/xfs/group
@@ -313,3 +313,14 @@
 875 auto quick clone fsr quota
 876 auto quick rmap clone
 877 auto quick rmap clone
+878 auto quick rmap
+879 auto quick rmap
+880 auto quick rmap
+881 auto quick rmap
+882 fuzzers rmap
+883 auto quick rmap
+884 auto quick rmap
+885 auto quick rmap
+886 auto quick rmap
+887 auto quick rmap
+888 auto quick rmap

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [PATCH 10/13] xfs: test getfsmap ioctl
  2016-08-25 23:28 ` Darrick J. Wong
@ 2016-08-25 23:29   ` Darrick J. Wong
  -1 siblings, 0 replies; 39+ messages in thread
From: Darrick J. Wong @ 2016-08-25 23:29 UTC (permalink / raw)
  To: david, eguan, darrick.wong; +Cc: linux-xfs, fstests, xfs

Add some simple tests for the new getfsmap ioctl.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 common/rc         |    6 +++
 tests/xfs/889     |   82 ++++++++++++++++++++++++++++++++++++++++++++++
 tests/xfs/889.out |   13 +++++++
 tests/xfs/890     |   84 +++++++++++++++++++++++++++++++++++++++++++++++
 tests/xfs/890.out |    6 +++
 tests/xfs/891     |   65 ++++++++++++++++++++++++++++++++++++
 tests/xfs/891.out |    3 ++
 tests/xfs/892     |   95 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/xfs/892.out |    7 ++++
 tests/xfs/893     |   68 ++++++++++++++++++++++++++++++++++++++
 tests/xfs/893.out |    4 ++
 tests/xfs/894     |   85 +++++++++++++++++++++++++++++++++++++++++++++++
 tests/xfs/894.out |    6 +++
 tests/xfs/895     |   68 ++++++++++++++++++++++++++++++++++++++
 tests/xfs/895.out |    4 ++
 tests/xfs/group   |    7 ++++
 16 files changed, 603 insertions(+)
 create mode 100755 tests/xfs/889
 create mode 100644 tests/xfs/889.out
 create mode 100755 tests/xfs/890
 create mode 100644 tests/xfs/890.out
 create mode 100755 tests/xfs/891
 create mode 100644 tests/xfs/891.out
 create mode 100755 tests/xfs/892
 create mode 100644 tests/xfs/892.out
 create mode 100755 tests/xfs/893
 create mode 100644 tests/xfs/893.out
 create mode 100755 tests/xfs/894
 create mode 100644 tests/xfs/894.out
 create mode 100755 tests/xfs/895
 create mode 100644 tests/xfs/895.out


diff --git a/common/rc b/common/rc
index 3b706dd..40e9858 100644
--- a/common/rc
+++ b/common/rc
@@ -2039,6 +2039,12 @@ _require_xfs_io_command()
 		echo $testio | egrep -q "invalid option|Is a directory" && \
 			_notrun "xfs_io $command support is missing"
 		;;
+	"fsmap" )
+		testio=`$XFS_IO_PROG -T -F -c "fsmap" \
+			$TEST_DIR 2>&1`
+		echo $testio | egrep -q "Inappropriate ioctl" && \
+			_notrun "xfs_io $command support is missing"
+		;;
 	*)
 		testio=`$XFS_IO_PROG -c "$command help" 2>&1`
 	esac
diff --git a/tests/xfs/889 b/tests/xfs/889
new file mode 100755
index 0000000..49f3a7b
--- /dev/null
+++ b/tests/xfs/889
@@ -0,0 +1,82 @@
+#! /bin/bash
+# FS QA Test No. 889
+#
+# Check that getfsmap reports the AG metadata we're expecting.
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2016, Oracle and/or its affiliates.  All Rights Reserved.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it would be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write the Free Software Foundation,
+# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+#-----------------------------------------------------------------------
+
+seq=`basename "$0"`
+seqres="$RESULT_DIR/$seq"
+echo "QA output created by $seq"
+
+here=`pwd`
+tmp=/tmp/$$
+status=1    # failure is the default!
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+_cleanup()
+{
+	cd /
+	rm -rf "$tmp".* $TEST_DIR/fsmap $TEST_DIR/testout
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+
+# real QA test starts here
+_supported_os Linux
+_supported_fs xfs
+_require_xfs_scratch_rmapbt
+_require_xfs_io_command "fsmap"
+
+rm -f "$seqres.full"
+
+echo "Format and mount"
+_scratch_mkfs > "$seqres.full" 2>&1
+_scratch_mount
+
+agcount=$(xfs_info $SCRATCH_MNT | grep agcount= | sed -e 's/^.*agcount=\([0-9]*\),.*$/\1/g')
+
+echo "Get fsmap" | tee -a $seqres.full
+$XFS_IO_PROG -c 'fsmap -v' $SCRATCH_MNT > $TEST_DIR/fsmap
+cat $TEST_DIR/fsmap >> $seqres.full
+
+echo "Check AG header" | tee -a $seqres.full
+grep 'static fs metadata[[:space:]]*[0-9]*[[:space:]]*(0\.\.' $TEST_DIR/fsmap | tee -a $seqres.full > $TEST_DIR/testout
+_within_tolerance "AG header count" $(wc -l < $TEST_DIR/testout) $agcount 0 -v
+
+echo "Check freesp/rmap btrees" | tee -a $seqres.full
+grep 'per-AG metadata[[:space:]]*[0-9]*[[:space:]]*([0-9]*\.\.' $TEST_DIR/fsmap | tee -a $seqres.full > $TEST_DIR/testout
+_within_tolerance "freesp extent count" $(wc -l < $TEST_DIR/testout) $((agcount * 3)) 0 999999 -v
+
+echo "Check inode btrees" | tee -a $seqres.full
+grep 'inode btree[[:space:]]*[0-9]*[[:space:]]*([0-9]*\.\.' $TEST_DIR/fsmap | tee -a $seqres.full > $TEST_DIR/testout
+_within_tolerance "inode btree extent count" $(wc -l < $TEST_DIR/testout) $agcount 0 -v
+
+echo "Check inodes" | tee -a $seqres.full
+grep 'inodes[[:space:]]*[0-9]*[[:space:]]*([0-9]*\.\.' $TEST_DIR/fsmap | tee -a $seqres.full > $TEST_DIR/testout
+_within_tolerance "inode extent count" $(wc -l < $TEST_DIR/testout) 1 0 999999 -v
+
+echo "Check journal" | tee -a $seqres.full
+grep 'journalling log' $TEST_DIR/fsmap | tee -a $seqres.full > $TEST_DIR/testout
+_within_tolerance "journal extent count" $(wc -l < $TEST_DIR/testout) 1 0 -v
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/889.out b/tests/xfs/889.out
new file mode 100644
index 0000000..3d2dc3e
--- /dev/null
+++ b/tests/xfs/889.out
@@ -0,0 +1,13 @@
+QA output created by 889
+Format and mount
+Get fsmap
+Check AG header
+AG header count is in range
+Check freesp/rmap btrees
+freesp extent count is in range
+Check inode btrees
+inode btree extent count is in range
+Check inodes
+inode extent count is in range
+Check journal
+journal extent count is in range
diff --git a/tests/xfs/890 b/tests/xfs/890
new file mode 100755
index 0000000..e4f83a5
--- /dev/null
+++ b/tests/xfs/890
@@ -0,0 +1,84 @@
+#! /bin/bash
+# FS QA Test No. 890
+#
+# Check that getfsmap agrees with getbmap.
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2016, Oracle and/or its affiliates.  All Rights Reserved.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it would be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write the Free Software Foundation,
+# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+#-----------------------------------------------------------------------
+
+seq=`basename "$0"`
+seqres="$RESULT_DIR/$seq"
+echo "QA output created by $seq"
+
+here=`pwd`
+tmp=/tmp/$$
+status=1    # failure is the default!
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+_cleanup()
+{
+	cd /
+	rm -rf "$tmp".* $TEST_DIR/fsmap $TEST_DIR/bmap
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+
+# real QA test starts here
+_supported_os Linux
+_supported_fs xfs
+_require_xfs_scratch_rmapbt
+_require_xfs_io_command "fsmap"
+_require_test_program "punch-alternating"
+
+rm -f "$seqres.full"
+
+echo "Format and mount"
+_scratch_mkfs > "$seqres.full" 2>&1
+_scratch_mount
+
+_pwrite_byte 0x80 0 737373 $SCRATCH_MNT/urk >> $seqres.full
+sync
+./src/punch-alternating $SCRATCH_MNT/urk >> $seqres.full
+ino=$(stat -c '%i' $SCRATCH_MNT/urk)
+
+echo "Get fsmap" | tee -a $seqres.full
+$XFS_IO_PROG -c 'fsmap -v' $SCRATCH_MNT >> $seqres.full
+$XFS_IO_PROG -c 'fsmap -v' $SCRATCH_MNT | tr '[]()' '    ' > $TEST_DIR/fsmap
+
+echo "Get bmap" | tee -a $seqres.full
+$XFS_IO_PROG -c 'bmap -v' $SCRATCH_MNT/urk >> $seqres.full
+$XFS_IO_PROG -c 'bmap -v' $SCRATCH_MNT/urk | grep '^[[:space:]]*[0-9]*:' | grep -v 'hole' | tr '[]()' '    ' > $TEST_DIR/bmap
+
+echo "Check bmap and fsmap" | tee -a $seqres.full
+cat $TEST_DIR/bmap | while read ext offrange colon blockrange ag agrange total crap; do
+	qstr="^[[:space:]]*[0-9]*:[[:space:]]*[0-9]*:[0-9]*[[:space:]]*${blockrange} :[[:space:]]*${ino}[[:space:]]*${offrange}[[:space:]]*${ag}[[:space:]]*${agrange}[[:space:]]*${total}$"
+	echo "${qstr}" >> $seqres.full
+	grep "${qstr}" $TEST_DIR/fsmap >> $seqres.full
+	found=$(grep -c "${qstr}" $TEST_DIR/fsmap)
+	test $found -eq 1 || echo "Unexpected output for offset ${offrange}."
+done
+
+echo "Check device field of FS metadata and regular file"
+data_dev=$(grep 'static fs metadata' $TEST_DIR/fsmap | head -n 1 | awk '{print $2}')
+rt_dev=$(grep "${ino}[[:space:]]*[0-9]*\.\.[0-9]*" $TEST_DIR/fsmap | head -n 1 | awk '{print $2}')
+test "${data_dev}" = "${rt_dev}" || echo "data ${data_dev} realtime ${rt_dev}?"
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/890.out b/tests/xfs/890.out
new file mode 100644
index 0000000..962050a
--- /dev/null
+++ b/tests/xfs/890.out
@@ -0,0 +1,6 @@
+QA output created by 890
+Format and mount
+Get fsmap
+Get bmap
+Check bmap and fsmap
+Check device field of FS metadata and regular file
diff --git a/tests/xfs/891 b/tests/xfs/891
new file mode 100755
index 0000000..c2abaaf
--- /dev/null
+++ b/tests/xfs/891
@@ -0,0 +1,65 @@
+#! /bin/bash
+# FS QA Test No. 891
+#
+# Populate filesystem, check that fsmap -n10000 matches fsmap -n1.
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2016, Oracle and/or its affiliates.  All Rights Reserved.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it would be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write the Free Software Foundation,
+# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+#-----------------------------------------------------------------------
+
+seq=`basename "$0"`
+seqres="$RESULT_DIR/$seq"
+echo "QA output created by $seq"
+
+here=`pwd`
+tmp=/tmp/$$
+status=1    # failure is the default!
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+_cleanup()
+{
+	cd /
+	rm -rf "$tmp".* $TEST_DIR/a $TEST_DIR/b
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+. ./common/populate
+
+# real QA test starts here
+_supported_os Linux
+_supported_fs xfs
+_require_scratch
+_require_xfs_io_command "fsmap"
+
+rm -f "$seqres.full"
+
+echo "Format and mount"
+_scratch_mkfs > "$seqres.full" 2>&1
+_scratch_populate >> $seqres.full
+
+echo "Compare fsmap" | tee -a $seqres.full
+_scratch_mount
+$XFS_IO_PROG -c 'fsmap -v -n 65536' $SCRATCH_MNT | grep -v 'EXT:' > $TEST_DIR/a
+$XFS_IO_PROG -c 'fsmap -v -n 1' $SCRATCH_MNT | grep -v 'EXT:' > $TEST_DIR/b
+cat $TEST_DIR/a $TEST_DIR/b >> $seqres.full
+
+diff -uw $TEST_DIR/a $TEST_DIR/b
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/891.out b/tests/xfs/891.out
new file mode 100644
index 0000000..c0d8d42
--- /dev/null
+++ b/tests/xfs/891.out
@@ -0,0 +1,3 @@
+QA output created by 891
+Format and mount
+Compare fsmap
diff --git a/tests/xfs/892 b/tests/xfs/892
new file mode 100755
index 0000000..9241474
--- /dev/null
+++ b/tests/xfs/892
@@ -0,0 +1,95 @@
+#! /bin/bash
+# FS QA Test No. 892
+#
+# Check that getfsmap agrees with getbmap for reflinked files.
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2016, Oracle and/or its affiliates.  All Rights Reserved.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it would be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write the Free Software Foundation,
+# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+#-----------------------------------------------------------------------
+
+seq=`basename "$0"`
+seqres="$RESULT_DIR/$seq"
+echo "QA output created by $seq"
+
+here=`pwd`
+tmp=/tmp/$$
+status=1    # failure is the default!
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+_cleanup()
+{
+	cd /
+	rm -rf "$tmp".* $TEST_DIR/fsmap $TEST_DIR/bmap
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+. ./common/reflink
+
+# real QA test starts here
+_supported_os Linux
+_supported_fs xfs
+_require_scratch_reflink
+_require_xfs_scratch_rmapbt
+_require_xfs_io_command "fsmap"
+_require_test_program "punch-alternating"
+
+rm -f "$seqres.full"
+
+echo "Format and mount"
+_scratch_mkfs > "$seqres.full" 2>&1
+_scratch_mount
+
+_pwrite_byte 0x80 0 737373 $SCRATCH_MNT/f1 >> $seqres.full
+sync
+./src/punch-alternating $SCRATCH_MNT/f1 >> $seqres.full
+_cp_reflink $SCRATCH_MNT/f1 $SCRATCH_MNT/f2
+ino=$(stat -c '%i' $SCRATCH_MNT/f1)
+
+echo "Get fsmap" | tee -a $seqres.full
+$XFS_IO_PROG -c 'fsmap -v' $SCRATCH_MNT >> $seqres.full
+$XFS_IO_PROG -c 'fsmap -v' $SCRATCH_MNT | tr '[]()' '    ' > $TEST_DIR/fsmap
+
+echo "Get f1 bmap" | tee -a $seqres.full
+$XFS_IO_PROG -c 'bmap -v' $SCRATCH_MNT/f1 >> $seqres.full
+$XFS_IO_PROG -c 'bmap -v' $SCRATCH_MNT/f1 | grep '^[[:space:]]*[0-9]*:' | grep -v 'hole' | tr '[]()' '    ' > $TEST_DIR/bmap
+
+echo "Check f1 bmap and fsmap" | tee -a $seqres.full
+cat $TEST_DIR/bmap | while read ext offrange colon blockrange ag agrange total crap; do
+	qstr="^[[:space:]]*[0-9]*:[[:space:]]*[0-9]*:[0-9]*[[:space:]]*${blockrange} :[[:space:]]*${ino}[[:space:]]*${offrange}[[:space:]]*${ag}[[:space:]]*${agrange}[[:space:]]*${total} 1000000$"
+	echo "${qstr}" >> $seqres.full
+	grep "${qstr}" $TEST_DIR/fsmap >> $seqres.full
+	found=$(grep -c "${qstr}" $TEST_DIR/fsmap)
+	test $found -eq 1 || echo "Unexpected output for offset ${offrange}."
+done
+
+echo "Get f2 bmap" | tee -a $seqres.full
+$XFS_IO_PROG -c 'bmap -v' $SCRATCH_MNT/f2 >> $seqres.full
+$XFS_IO_PROG -c 'bmap -v' $SCRATCH_MNT/f2 | grep '^[[:space:]]*[0-9]*:' | grep -v 'hole' | tr '[]()' '    ' > $TEST_DIR/bmap
+
+echo "Check f2 bmap and fsmap" | tee -a $seqres.full
+cat $TEST_DIR/bmap | while read ext offrange colon blockrange ag agrange total crap; do
+	qstr="^[[:space:]]*[0-9]*:[[:space:]]*[0-9]*:[0-9]*[[:space:]]*${blockrange} :[[:space:]]*${ino}[[:space:]]*${offrange}[[:space:]]*${ag}[[:space:]]*${agrange}[[:space:]]*${total} 1000000$"
+	echo "${qstr}" >> $seqres.full
+	grep "${qstr}" $TEST_DIR/fsmap >> $seqres.full
+	found=$(grep -c "${qstr}" $TEST_DIR/fsmap)
+	test $found -eq 1 || echo "Unexpected output for offset ${offrange}."
+done
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/892.out b/tests/xfs/892.out
new file mode 100644
index 0000000..edcffb3
--- /dev/null
+++ b/tests/xfs/892.out
@@ -0,0 +1,7 @@
+QA output created by 892
+Format and mount
+Get fsmap
+Get f1 bmap
+Check f1 bmap and fsmap
+Get f2 bmap
+Check f2 bmap and fsmap
diff --git a/tests/xfs/893 b/tests/xfs/893
new file mode 100755
index 0000000..d0bcf2e
--- /dev/null
+++ b/tests/xfs/893
@@ -0,0 +1,68 @@
+#! /bin/bash
+# FS QA Test No. 893
+#
+# Check that getfsmap reports external log devices
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2016, Oracle and/or its affiliates.  All Rights Reserved.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it would be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write the Free Software Foundation,
+# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+#-----------------------------------------------------------------------
+
+seq=`basename "$0"`
+seqres="$RESULT_DIR/$seq"
+echo "QA output created by $seq"
+
+here=`pwd`
+tmp=/tmp/$$
+status=1    # failure is the default!
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+_cleanup()
+{
+	cd /
+	rm -rf "$tmp".* $TEST_DIR/fsmap $TEST_DIR/testout
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+
+# real QA test starts here
+_supported_os Linux
+_supported_fs xfs
+_require_scratch
+_require_xfs_io_command "fsmap"
+if [ "$USE_EXTERNAL" != "yes" ] || [ -z "$SCRATCH_LOGDEV" ]; then
+	_notrun "Need external log device"
+fi
+
+rm -f "$seqres.full"
+
+echo "Format and mount"
+_scratch_mkfs > "$seqres.full" 2>&1
+_scratch_mount
+
+echo "Get fsmap" | tee -a $seqres.full
+$XFS_IO_PROG -c 'fsmap -v' $SCRATCH_MNT >> $seqres.full
+$XFS_IO_PROG -c 'fsmap -v' $SCRATCH_MNT | tr '[]()' '    ' > $TEST_DIR/fsmap
+
+echo "Check device field of FS metadata and journalling log"
+data_dev=$(grep 'static fs metadata' $TEST_DIR/fsmap | head -n 1 | awk '{print $2}')
+journal_dev=$(grep 'journalling log' $TEST_DIR/fsmap | head -n 1 | awk '{print $2}')
+test "${data_dev}" != "${journal_dev}" || echo "data ${data_dev} journal ${journal_dev}?"
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/893.out b/tests/xfs/893.out
new file mode 100644
index 0000000..2f1ccae
--- /dev/null
+++ b/tests/xfs/893.out
@@ -0,0 +1,4 @@
+QA output created by 893
+Format and mount
+Get fsmap
+Check device field of FS metadata and journalling log
diff --git a/tests/xfs/894 b/tests/xfs/894
new file mode 100755
index 0000000..f5bb5f5
--- /dev/null
+++ b/tests/xfs/894
@@ -0,0 +1,85 @@
+#! /bin/bash
+# FS QA Test No. 894
+#
+# Check that getfsmap agrees with getbmap when realtime files are present.
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2016, Oracle and/or its affiliates.  All Rights Reserved.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it would be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write the Free Software Foundation,
+# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+#-----------------------------------------------------------------------
+
+seq=`basename "$0"`
+seqres="$RESULT_DIR/$seq"
+echo "QA output created by $seq"
+
+here=`pwd`
+tmp=/tmp/$$
+status=1    # failure is the default!
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+_cleanup()
+{
+	cd /
+	rm -rf "$tmp".* $TEST_DIR/fsmap $TEST_DIR/bmap
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+
+# real QA test starts here
+_supported_os Linux
+_supported_fs xfs
+_require_realtime
+_require_xfs_scratch_rmapbt
+_require_xfs_io_command "fsmap"
+_require_test_program "punch-alternating"
+
+rm -f "$seqres.full"
+
+echo "Format and mount"
+_scratch_mkfs > "$seqres.full" 2>&1
+_scratch_mount
+
+$XFS_IO_PROG -f -R -c 'pwrite -S 0x80 0 737373' $SCRATCH_MNT/urk >> $seqres.full
+sync
+./src/punch-alternating $SCRATCH_MNT/urk >> $seqres.full
+ino=$(stat -c '%i' $SCRATCH_MNT/urk)
+
+echo "Get fsmap" | tee -a $seqres.full
+$XFS_IO_PROG -c 'fsmap -v' $SCRATCH_MNT >> $seqres.full
+$XFS_IO_PROG -c 'fsmap -v' $SCRATCH_MNT | tr '[]()' '    ' > $TEST_DIR/fsmap
+
+echo "Get bmap" | tee -a $seqres.full
+$XFS_IO_PROG -c 'bmap -v' $SCRATCH_MNT/urk >> $seqres.full
+$XFS_IO_PROG -c 'bmap -v' $SCRATCH_MNT/urk | grep '^[[:space:]]*[0-9]*:' | grep -v 'hole' | tr '[]()' '    ' > $TEST_DIR/bmap
+
+echo "Check bmap and fsmap" | tee -a $seqres.full
+cat $TEST_DIR/bmap | while read ext offrange colon blockrange ag agrange total crap; do
+	qstr="^[[:space:]]*[0-9]*:[[:space:]]*[0-9]*:[0-9]*[[:space:]]*${blockrange} :[[:space:]]*${ino}[[:space:]]*${offrange}[[:space:]]*${ag}[[:space:]]*${agrange}[[:space:]]*${total}$"
+	echo "${qstr}" >> $seqres.full
+	grep "${qstr}" $TEST_DIR/fsmap >> $seqres.full
+	found=$(grep -c "${qstr}" $TEST_DIR/fsmap)
+	test $found -eq 1 || echo "Unexpected output for offset ${offrange}."
+done
+
+echo "Check device field of FS metadata and realtime file"
+data_dev=$(grep 'static fs metadata' $TEST_DIR/fsmap | head -n 1 | awk '{print $2}')
+rt_dev=$(grep "${ino}[[:space:]]*[0-9]*\.\.[0-9]*" $TEST_DIR/fsmap | head -n 1 | awk '{print $2}')
+test "${data_dev}" != "${rt_dev}" || echo "data ${data_dev} realtime ${rt_dev}?"
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/894.out b/tests/xfs/894.out
new file mode 100644
index 0000000..a1eb886
--- /dev/null
+++ b/tests/xfs/894.out
@@ -0,0 +1,6 @@
+QA output created by 894
+Format and mount
+Get fsmap
+Get bmap
+Check bmap and fsmap
+Check device field of FS metadata and realtime file
diff --git a/tests/xfs/895 b/tests/xfs/895
new file mode 100755
index 0000000..7dc9cf4
--- /dev/null
+++ b/tests/xfs/895
@@ -0,0 +1,68 @@
+#! /bin/bash
+# FS QA Test No. 895
+#
+# Check that getfsmap reports internal log devices
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2016, Oracle and/or its affiliates.  All Rights Reserved.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it would be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write the Free Software Foundation,
+# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+#-----------------------------------------------------------------------
+
+seq=`basename "$0"`
+seqres="$RESULT_DIR/$seq"
+echo "QA output created by $seq"
+
+here=`pwd`
+tmp=/tmp/$$
+status=1    # failure is the default!
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+_cleanup()
+{
+	cd /
+	rm -rf "$tmp".* $TEST_DIR/fsmap $TEST_DIR/testout
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+
+# real QA test starts here
+_supported_os Linux
+_supported_fs xfs
+_require_xfs_scratch_rmapbt
+_require_xfs_io_command "fsmap"
+if [ "$USE_EXTERNAL" = "yes" ] && [ -n "$SCRATCH_LOGDEV" ]; then
+	_notrun "Cannot have external log device"
+fi
+
+rm -f "$seqres.full"
+
+echo "Format and mount"
+_scratch_mkfs > "$seqres.full" 2>&1
+_scratch_mount
+
+echo "Get fsmap" | tee -a $seqres.full
+$XFS_IO_PROG -c 'fsmap -v' $SCRATCH_MNT >> $seqres.full
+$XFS_IO_PROG -c 'fsmap -v' $SCRATCH_MNT | tr '[]()' '    ' > $TEST_DIR/fsmap
+
+echo "Check device field of FS metadata and journalling log"
+data_dev=$(grep 'static fs metadata' $TEST_DIR/fsmap | head -n 1 | awk '{print $2}')
+journal_dev=$(grep 'journalling log' $TEST_DIR/fsmap | head -n 1 | awk '{print $2}')
+test "${data_dev}" = "${journal_dev}" || echo "data ${data_dev} journal ${journal_dev}?"
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/895.out b/tests/xfs/895.out
new file mode 100644
index 0000000..007eeba
--- /dev/null
+++ b/tests/xfs/895.out
@@ -0,0 +1,4 @@
+QA output created by 895
+Format and mount
+Get fsmap
+Check device field of FS metadata and journalling log
diff --git a/tests/xfs/group b/tests/xfs/group
index 1b0e22a..6d349dc 100644
--- a/tests/xfs/group
+++ b/tests/xfs/group
@@ -324,3 +324,10 @@
 886 auto quick rmap
 887 auto quick rmap
 888 auto quick rmap
+889 auto quick rmap fsmap
+890 auto quick rmap fsmap
+891 auto rmap fsmap
+892 auto quick rmap fsmap
+893 auto quick rmap fsmap
+894 auto quick rmap fsmap
+895 auto quick rmap fsmap


^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [PATCH 10/13] xfs: test getfsmap ioctl
@ 2016-08-25 23:29   ` Darrick J. Wong
  0 siblings, 0 replies; 39+ messages in thread
From: Darrick J. Wong @ 2016-08-25 23:29 UTC (permalink / raw)
  To: david, eguan, darrick.wong; +Cc: linux-xfs, fstests, xfs

Add some simple tests for the new getfsmap ioctl.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 common/rc         |    6 +++
 tests/xfs/889     |   82 ++++++++++++++++++++++++++++++++++++++++++++++
 tests/xfs/889.out |   13 +++++++
 tests/xfs/890     |   84 +++++++++++++++++++++++++++++++++++++++++++++++
 tests/xfs/890.out |    6 +++
 tests/xfs/891     |   65 ++++++++++++++++++++++++++++++++++++
 tests/xfs/891.out |    3 ++
 tests/xfs/892     |   95 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/xfs/892.out |    7 ++++
 tests/xfs/893     |   68 ++++++++++++++++++++++++++++++++++++++
 tests/xfs/893.out |    4 ++
 tests/xfs/894     |   85 +++++++++++++++++++++++++++++++++++++++++++++++
 tests/xfs/894.out |    6 +++
 tests/xfs/895     |   68 ++++++++++++++++++++++++++++++++++++++
 tests/xfs/895.out |    4 ++
 tests/xfs/group   |    7 ++++
 16 files changed, 603 insertions(+)
 create mode 100755 tests/xfs/889
 create mode 100644 tests/xfs/889.out
 create mode 100755 tests/xfs/890
 create mode 100644 tests/xfs/890.out
 create mode 100755 tests/xfs/891
 create mode 100644 tests/xfs/891.out
 create mode 100755 tests/xfs/892
 create mode 100644 tests/xfs/892.out
 create mode 100755 tests/xfs/893
 create mode 100644 tests/xfs/893.out
 create mode 100755 tests/xfs/894
 create mode 100644 tests/xfs/894.out
 create mode 100755 tests/xfs/895
 create mode 100644 tests/xfs/895.out


diff --git a/common/rc b/common/rc
index 3b706dd..40e9858 100644
--- a/common/rc
+++ b/common/rc
@@ -2039,6 +2039,12 @@ _require_xfs_io_command()
 		echo $testio | egrep -q "invalid option|Is a directory" && \
 			_notrun "xfs_io $command support is missing"
 		;;
+	"fsmap" )
+		testio=`$XFS_IO_PROG -T -F -c "fsmap" \
+			$TEST_DIR 2>&1`
+		echo $testio | egrep -q "Inappropriate ioctl" && \
+			_notrun "xfs_io $command support is missing"
+		;;
 	*)
 		testio=`$XFS_IO_PROG -c "$command help" 2>&1`
 	esac
diff --git a/tests/xfs/889 b/tests/xfs/889
new file mode 100755
index 0000000..49f3a7b
--- /dev/null
+++ b/tests/xfs/889
@@ -0,0 +1,82 @@
+#! /bin/bash
+# FS QA Test No. 889
+#
+# Check that getfsmap reports the AG metadata we're expecting.
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2016, Oracle and/or its affiliates.  All Rights Reserved.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it would be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write the Free Software Foundation,
+# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+#-----------------------------------------------------------------------
+
+seq=`basename "$0"`
+seqres="$RESULT_DIR/$seq"
+echo "QA output created by $seq"
+
+here=`pwd`
+tmp=/tmp/$$
+status=1    # failure is the default!
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+_cleanup()
+{
+	cd /
+	rm -rf "$tmp".* $TEST_DIR/fsmap $TEST_DIR/testout
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+
+# real QA test starts here
+_supported_os Linux
+_supported_fs xfs
+_require_xfs_scratch_rmapbt
+_require_xfs_io_command "fsmap"
+
+rm -f "$seqres.full"
+
+echo "Format and mount"
+_scratch_mkfs > "$seqres.full" 2>&1
+_scratch_mount
+
+agcount=$(xfs_info $SCRATCH_MNT | grep agcount= | sed -e 's/^.*agcount=\([0-9]*\),.*$/\1/g')
+
+echo "Get fsmap" | tee -a $seqres.full
+$XFS_IO_PROG -c 'fsmap -v' $SCRATCH_MNT > $TEST_DIR/fsmap
+cat $TEST_DIR/fsmap >> $seqres.full
+
+echo "Check AG header" | tee -a $seqres.full
+grep 'static fs metadata[[:space:]]*[0-9]*[[:space:]]*(0\.\.' $TEST_DIR/fsmap | tee -a $seqres.full > $TEST_DIR/testout
+_within_tolerance "AG header count" $(wc -l < $TEST_DIR/testout) $agcount 0 -v
+
+echo "Check freesp/rmap btrees" | tee -a $seqres.full
+grep 'per-AG metadata[[:space:]]*[0-9]*[[:space:]]*([0-9]*\.\.' $TEST_DIR/fsmap | tee -a $seqres.full > $TEST_DIR/testout
+_within_tolerance "freesp extent count" $(wc -l < $TEST_DIR/testout) $((agcount * 3)) 0 999999 -v
+
+echo "Check inode btrees" | tee -a $seqres.full
+grep 'inode btree[[:space:]]*[0-9]*[[:space:]]*([0-9]*\.\.' $TEST_DIR/fsmap | tee -a $seqres.full > $TEST_DIR/testout
+_within_tolerance "inode btree extent count" $(wc -l < $TEST_DIR/testout) $agcount 0 -v
+
+echo "Check inodes" | tee -a $seqres.full
+grep 'inodes[[:space:]]*[0-9]*[[:space:]]*([0-9]*\.\.' $TEST_DIR/fsmap | tee -a $seqres.full > $TEST_DIR/testout
+_within_tolerance "inode extent count" $(wc -l < $TEST_DIR/testout) 1 0 999999 -v
+
+echo "Check journal" | tee -a $seqres.full
+grep 'journalling log' $TEST_DIR/fsmap | tee -a $seqres.full > $TEST_DIR/testout
+_within_tolerance "journal extent count" $(wc -l < $TEST_DIR/testout) 1 0 -v
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/889.out b/tests/xfs/889.out
new file mode 100644
index 0000000..3d2dc3e
--- /dev/null
+++ b/tests/xfs/889.out
@@ -0,0 +1,13 @@
+QA output created by 889
+Format and mount
+Get fsmap
+Check AG header
+AG header count is in range
+Check freesp/rmap btrees
+freesp extent count is in range
+Check inode btrees
+inode btree extent count is in range
+Check inodes
+inode extent count is in range
+Check journal
+journal extent count is in range
diff --git a/tests/xfs/890 b/tests/xfs/890
new file mode 100755
index 0000000..e4f83a5
--- /dev/null
+++ b/tests/xfs/890
@@ -0,0 +1,84 @@
+#! /bin/bash
+# FS QA Test No. 890
+#
+# Check that getfsmap agrees with getbmap.
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2016, Oracle and/or its affiliates.  All Rights Reserved.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it would be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write the Free Software Foundation,
+# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+#-----------------------------------------------------------------------
+
+seq=`basename "$0"`
+seqres="$RESULT_DIR/$seq"
+echo "QA output created by $seq"
+
+here=`pwd`
+tmp=/tmp/$$
+status=1    # failure is the default!
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+_cleanup()
+{
+	cd /
+	rm -rf "$tmp".* $TEST_DIR/fsmap $TEST_DIR/bmap
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+
+# real QA test starts here
+_supported_os Linux
+_supported_fs xfs
+_require_xfs_scratch_rmapbt
+_require_xfs_io_command "fsmap"
+_require_test_program "punch-alternating"
+
+rm -f "$seqres.full"
+
+echo "Format and mount"
+_scratch_mkfs > "$seqres.full" 2>&1
+_scratch_mount
+
+_pwrite_byte 0x80 0 737373 $SCRATCH_MNT/urk >> $seqres.full
+sync
+./src/punch-alternating $SCRATCH_MNT/urk >> $seqres.full
+ino=$(stat -c '%i' $SCRATCH_MNT/urk)
+
+echo "Get fsmap" | tee -a $seqres.full
+$XFS_IO_PROG -c 'fsmap -v' $SCRATCH_MNT >> $seqres.full
+$XFS_IO_PROG -c 'fsmap -v' $SCRATCH_MNT | tr '[]()' '    ' > $TEST_DIR/fsmap
+
+echo "Get bmap" | tee -a $seqres.full
+$XFS_IO_PROG -c 'bmap -v' $SCRATCH_MNT/urk >> $seqres.full
+$XFS_IO_PROG -c 'bmap -v' $SCRATCH_MNT/urk | grep '^[[:space:]]*[0-9]*:' | grep -v 'hole' | tr '[]()' '    ' > $TEST_DIR/bmap
+
+echo "Check bmap and fsmap" | tee -a $seqres.full
+cat $TEST_DIR/bmap | while read ext offrange colon blockrange ag agrange total crap; do
+	qstr="^[[:space:]]*[0-9]*:[[:space:]]*[0-9]*:[0-9]*[[:space:]]*${blockrange} :[[:space:]]*${ino}[[:space:]]*${offrange}[[:space:]]*${ag}[[:space:]]*${agrange}[[:space:]]*${total}$"
+	echo "${qstr}" >> $seqres.full
+	grep "${qstr}" $TEST_DIR/fsmap >> $seqres.full
+	found=$(grep -c "${qstr}" $TEST_DIR/fsmap)
+	test $found -eq 1 || echo "Unexpected output for offset ${offrange}."
+done
+
+echo "Check device field of FS metadata and regular file"
+data_dev=$(grep 'static fs metadata' $TEST_DIR/fsmap | head -n 1 | awk '{print $2}')
+rt_dev=$(grep "${ino}[[:space:]]*[0-9]*\.\.[0-9]*" $TEST_DIR/fsmap | head -n 1 | awk '{print $2}')
+test "${data_dev}" = "${rt_dev}" || echo "data ${data_dev} realtime ${rt_dev}?"
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/890.out b/tests/xfs/890.out
new file mode 100644
index 0000000..962050a
--- /dev/null
+++ b/tests/xfs/890.out
@@ -0,0 +1,6 @@
+QA output created by 890
+Format and mount
+Get fsmap
+Get bmap
+Check bmap and fsmap
+Check device field of FS metadata and regular file
diff --git a/tests/xfs/891 b/tests/xfs/891
new file mode 100755
index 0000000..c2abaaf
--- /dev/null
+++ b/tests/xfs/891
@@ -0,0 +1,65 @@
+#! /bin/bash
+# FS QA Test No. 891
+#
+# Populate filesystem, check that fsmap -n10000 matches fsmap -n1.
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2016, Oracle and/or its affiliates.  All Rights Reserved.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it would be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write the Free Software Foundation,
+# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+#-----------------------------------------------------------------------
+
+seq=`basename "$0"`
+seqres="$RESULT_DIR/$seq"
+echo "QA output created by $seq"
+
+here=`pwd`
+tmp=/tmp/$$
+status=1    # failure is the default!
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+_cleanup()
+{
+	cd /
+	rm -rf "$tmp".* $TEST_DIR/a $TEST_DIR/b
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+. ./common/populate
+
+# real QA test starts here
+_supported_os Linux
+_supported_fs xfs
+_require_scratch
+_require_xfs_io_command "fsmap"
+
+rm -f "$seqres.full"
+
+echo "Format and mount"
+_scratch_mkfs > "$seqres.full" 2>&1
+_scratch_populate >> $seqres.full
+
+echo "Compare fsmap" | tee -a $seqres.full
+_scratch_mount
+$XFS_IO_PROG -c 'fsmap -v -n 65536' $SCRATCH_MNT | grep -v 'EXT:' > $TEST_DIR/a
+$XFS_IO_PROG -c 'fsmap -v -n 1' $SCRATCH_MNT | grep -v 'EXT:' > $TEST_DIR/b
+cat $TEST_DIR/a $TEST_DIR/b >> $seqres.full
+
+diff -uw $TEST_DIR/a $TEST_DIR/b
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/891.out b/tests/xfs/891.out
new file mode 100644
index 0000000..c0d8d42
--- /dev/null
+++ b/tests/xfs/891.out
@@ -0,0 +1,3 @@
+QA output created by 891
+Format and mount
+Compare fsmap
diff --git a/tests/xfs/892 b/tests/xfs/892
new file mode 100755
index 0000000..9241474
--- /dev/null
+++ b/tests/xfs/892
@@ -0,0 +1,95 @@
+#! /bin/bash
+# FS QA Test No. 892
+#
+# Check that getfsmap agrees with getbmap for reflinked files.
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2016, Oracle and/or its affiliates.  All Rights Reserved.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it would be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write the Free Software Foundation,
+# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+#-----------------------------------------------------------------------
+
+seq=`basename "$0"`
+seqres="$RESULT_DIR/$seq"
+echo "QA output created by $seq"
+
+here=`pwd`
+tmp=/tmp/$$
+status=1    # failure is the default!
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+_cleanup()
+{
+	cd /
+	rm -rf "$tmp".* $TEST_DIR/fsmap $TEST_DIR/bmap
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+. ./common/reflink
+
+# real QA test starts here
+_supported_os Linux
+_supported_fs xfs
+_require_scratch_reflink
+_require_xfs_scratch_rmapbt
+_require_xfs_io_command "fsmap"
+_require_test_program "punch-alternating"
+
+rm -f "$seqres.full"
+
+echo "Format and mount"
+_scratch_mkfs > "$seqres.full" 2>&1
+_scratch_mount
+
+_pwrite_byte 0x80 0 737373 $SCRATCH_MNT/f1 >> $seqres.full
+sync
+./src/punch-alternating $SCRATCH_MNT/f1 >> $seqres.full
+_cp_reflink $SCRATCH_MNT/f1 $SCRATCH_MNT/f2
+ino=$(stat -c '%i' $SCRATCH_MNT/f1)
+
+echo "Get fsmap" | tee -a $seqres.full
+$XFS_IO_PROG -c 'fsmap -v' $SCRATCH_MNT >> $seqres.full
+$XFS_IO_PROG -c 'fsmap -v' $SCRATCH_MNT | tr '[]()' '    ' > $TEST_DIR/fsmap
+
+echo "Get f1 bmap" | tee -a $seqres.full
+$XFS_IO_PROG -c 'bmap -v' $SCRATCH_MNT/f1 >> $seqres.full
+$XFS_IO_PROG -c 'bmap -v' $SCRATCH_MNT/f1 | grep '^[[:space:]]*[0-9]*:' | grep -v 'hole' | tr '[]()' '    ' > $TEST_DIR/bmap
+
+echo "Check f1 bmap and fsmap" | tee -a $seqres.full
+cat $TEST_DIR/bmap | while read ext offrange colon blockrange ag agrange total crap; do
+	qstr="^[[:space:]]*[0-9]*:[[:space:]]*[0-9]*:[0-9]*[[:space:]]*${blockrange} :[[:space:]]*${ino}[[:space:]]*${offrange}[[:space:]]*${ag}[[:space:]]*${agrange}[[:space:]]*${total} 1000000$"
+	echo "${qstr}" >> $seqres.full
+	grep "${qstr}" $TEST_DIR/fsmap >> $seqres.full
+	found=$(grep -c "${qstr}" $TEST_DIR/fsmap)
+	test $found -eq 1 || echo "Unexpected output for offset ${offrange}."
+done
+
+echo "Get f2 bmap" | tee -a $seqres.full
+$XFS_IO_PROG -c 'bmap -v' $SCRATCH_MNT/f2 >> $seqres.full
+$XFS_IO_PROG -c 'bmap -v' $SCRATCH_MNT/f2 | grep '^[[:space:]]*[0-9]*:' | grep -v 'hole' | tr '[]()' '    ' > $TEST_DIR/bmap
+
+echo "Check f2 bmap and fsmap" | tee -a $seqres.full
+cat $TEST_DIR/bmap | while read ext offrange colon blockrange ag agrange total crap; do
+	qstr="^[[:space:]]*[0-9]*:[[:space:]]*[0-9]*:[0-9]*[[:space:]]*${blockrange} :[[:space:]]*${ino}[[:space:]]*${offrange}[[:space:]]*${ag}[[:space:]]*${agrange}[[:space:]]*${total} 1000000$"
+	echo "${qstr}" >> $seqres.full
+	grep "${qstr}" $TEST_DIR/fsmap >> $seqres.full
+	found=$(grep -c "${qstr}" $TEST_DIR/fsmap)
+	test $found -eq 1 || echo "Unexpected output for offset ${offrange}."
+done
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/892.out b/tests/xfs/892.out
new file mode 100644
index 0000000..edcffb3
--- /dev/null
+++ b/tests/xfs/892.out
@@ -0,0 +1,7 @@
+QA output created by 892
+Format and mount
+Get fsmap
+Get f1 bmap
+Check f1 bmap and fsmap
+Get f2 bmap
+Check f2 bmap and fsmap
diff --git a/tests/xfs/893 b/tests/xfs/893
new file mode 100755
index 0000000..d0bcf2e
--- /dev/null
+++ b/tests/xfs/893
@@ -0,0 +1,68 @@
+#! /bin/bash
+# FS QA Test No. 893
+#
+# Check that getfsmap reports external log devices
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2016, Oracle and/or its affiliates.  All Rights Reserved.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it would be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write the Free Software Foundation,
+# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+#-----------------------------------------------------------------------
+
+seq=`basename "$0"`
+seqres="$RESULT_DIR/$seq"
+echo "QA output created by $seq"
+
+here=`pwd`
+tmp=/tmp/$$
+status=1    # failure is the default!
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+_cleanup()
+{
+	cd /
+	rm -rf "$tmp".* $TEST_DIR/fsmap $TEST_DIR/testout
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+
+# real QA test starts here
+_supported_os Linux
+_supported_fs xfs
+_require_scratch
+_require_xfs_io_command "fsmap"
+if [ "$USE_EXTERNAL" != "yes" ] || [ -z "$SCRATCH_LOGDEV" ]; then
+	_notrun "Need external log device"
+fi
+
+rm -f "$seqres.full"
+
+echo "Format and mount"
+_scratch_mkfs > "$seqres.full" 2>&1
+_scratch_mount
+
+echo "Get fsmap" | tee -a $seqres.full
+$XFS_IO_PROG -c 'fsmap -v' $SCRATCH_MNT >> $seqres.full
+$XFS_IO_PROG -c 'fsmap -v' $SCRATCH_MNT | tr '[]()' '    ' > $TEST_DIR/fsmap
+
+echo "Check device field of FS metadata and journalling log"
+data_dev=$(grep 'static fs metadata' $TEST_DIR/fsmap | head -n 1 | awk '{print $2}')
+journal_dev=$(grep 'journalling log' $TEST_DIR/fsmap | head -n 1 | awk '{print $2}')
+test "${data_dev}" != "${journal_dev}" || echo "data ${data_dev} journal ${journal_dev}?"
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/893.out b/tests/xfs/893.out
new file mode 100644
index 0000000..2f1ccae
--- /dev/null
+++ b/tests/xfs/893.out
@@ -0,0 +1,4 @@
+QA output created by 893
+Format and mount
+Get fsmap
+Check device field of FS metadata and journalling log
diff --git a/tests/xfs/894 b/tests/xfs/894
new file mode 100755
index 0000000..f5bb5f5
--- /dev/null
+++ b/tests/xfs/894
@@ -0,0 +1,85 @@
+#! /bin/bash
+# FS QA Test No. 894
+#
+# Check that getfsmap agrees with getbmap when realtime files are present.
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2016, Oracle and/or its affiliates.  All Rights Reserved.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it would be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write the Free Software Foundation,
+# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+#-----------------------------------------------------------------------
+
+seq=`basename "$0"`
+seqres="$RESULT_DIR/$seq"
+echo "QA output created by $seq"
+
+here=`pwd`
+tmp=/tmp/$$
+status=1    # failure is the default!
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+_cleanup()
+{
+	cd /
+	rm -rf "$tmp".* $TEST_DIR/fsmap $TEST_DIR/bmap
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+
+# real QA test starts here
+_supported_os Linux
+_supported_fs xfs
+_require_realtime
+_require_xfs_scratch_rmapbt
+_require_xfs_io_command "fsmap"
+_require_test_program "punch-alternating"
+
+rm -f "$seqres.full"
+
+echo "Format and mount"
+_scratch_mkfs > "$seqres.full" 2>&1
+_scratch_mount
+
+$XFS_IO_PROG -f -R -c 'pwrite -S 0x80 0 737373' $SCRATCH_MNT/urk >> $seqres.full
+sync
+./src/punch-alternating $SCRATCH_MNT/urk >> $seqres.full
+ino=$(stat -c '%i' $SCRATCH_MNT/urk)
+
+echo "Get fsmap" | tee -a $seqres.full
+$XFS_IO_PROG -c 'fsmap -v' $SCRATCH_MNT >> $seqres.full
+$XFS_IO_PROG -c 'fsmap -v' $SCRATCH_MNT | tr '[]()' '    ' > $TEST_DIR/fsmap
+
+echo "Get bmap" | tee -a $seqres.full
+$XFS_IO_PROG -c 'bmap -v' $SCRATCH_MNT/urk >> $seqres.full
+$XFS_IO_PROG -c 'bmap -v' $SCRATCH_MNT/urk | grep '^[[:space:]]*[0-9]*:' | grep -v 'hole' | tr '[]()' '    ' > $TEST_DIR/bmap
+
+echo "Check bmap and fsmap" | tee -a $seqres.full
+cat $TEST_DIR/bmap | while read ext offrange colon blockrange ag agrange total crap; do
+	qstr="^[[:space:]]*[0-9]*:[[:space:]]*[0-9]*:[0-9]*[[:space:]]*${blockrange} :[[:space:]]*${ino}[[:space:]]*${offrange}[[:space:]]*${ag}[[:space:]]*${agrange}[[:space:]]*${total}$"
+	echo "${qstr}" >> $seqres.full
+	grep "${qstr}" $TEST_DIR/fsmap >> $seqres.full
+	found=$(grep -c "${qstr}" $TEST_DIR/fsmap)
+	test $found -eq 1 || echo "Unexpected output for offset ${offrange}."
+done
+
+echo "Check device field of FS metadata and realtime file"
+data_dev=$(grep 'static fs metadata' $TEST_DIR/fsmap | head -n 1 | awk '{print $2}')
+rt_dev=$(grep "${ino}[[:space:]]*[0-9]*\.\.[0-9]*" $TEST_DIR/fsmap | head -n 1 | awk '{print $2}')
+test "${data_dev}" != "${rt_dev}" || echo "data ${data_dev} realtime ${rt_dev}?"
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/894.out b/tests/xfs/894.out
new file mode 100644
index 0000000..a1eb886
--- /dev/null
+++ b/tests/xfs/894.out
@@ -0,0 +1,6 @@
+QA output created by 894
+Format and mount
+Get fsmap
+Get bmap
+Check bmap and fsmap
+Check device field of FS metadata and realtime file
diff --git a/tests/xfs/895 b/tests/xfs/895
new file mode 100755
index 0000000..7dc9cf4
--- /dev/null
+++ b/tests/xfs/895
@@ -0,0 +1,68 @@
+#! /bin/bash
+# FS QA Test No. 895
+#
+# Check that getfsmap reports internal log devices
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2016, Oracle and/or its affiliates.  All Rights Reserved.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it would be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write the Free Software Foundation,
+# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+#-----------------------------------------------------------------------
+
+seq=`basename "$0"`
+seqres="$RESULT_DIR/$seq"
+echo "QA output created by $seq"
+
+here=`pwd`
+tmp=/tmp/$$
+status=1    # failure is the default!
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+_cleanup()
+{
+	cd /
+	rm -rf "$tmp".* $TEST_DIR/fsmap $TEST_DIR/testout
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+
+# real QA test starts here
+_supported_os Linux
+_supported_fs xfs
+_require_xfs_scratch_rmapbt
+_require_xfs_io_command "fsmap"
+if [ "$USE_EXTERNAL" = "yes" ] && [ -n "$SCRATCH_LOGDEV" ]; then
+	_notrun "Cannot have external log device"
+fi
+
+rm -f "$seqres.full"
+
+echo "Format and mount"
+_scratch_mkfs > "$seqres.full" 2>&1
+_scratch_mount
+
+echo "Get fsmap" | tee -a $seqres.full
+$XFS_IO_PROG -c 'fsmap -v' $SCRATCH_MNT >> $seqres.full
+$XFS_IO_PROG -c 'fsmap -v' $SCRATCH_MNT | tr '[]()' '    ' > $TEST_DIR/fsmap
+
+echo "Check device field of FS metadata and journalling log"
+data_dev=$(grep 'static fs metadata' $TEST_DIR/fsmap | head -n 1 | awk '{print $2}')
+journal_dev=$(grep 'journalling log' $TEST_DIR/fsmap | head -n 1 | awk '{print $2}')
+test "${data_dev}" = "${journal_dev}" || echo "data ${data_dev} journal ${journal_dev}?"
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/895.out b/tests/xfs/895.out
new file mode 100644
index 0000000..007eeba
--- /dev/null
+++ b/tests/xfs/895.out
@@ -0,0 +1,4 @@
+QA output created by 895
+Format and mount
+Get fsmap
+Check device field of FS metadata and journalling log
diff --git a/tests/xfs/group b/tests/xfs/group
index 1b0e22a..6d349dc 100644
--- a/tests/xfs/group
+++ b/tests/xfs/group
@@ -324,3 +324,10 @@
 886 auto quick rmap
 887 auto quick rmap
 888 auto quick rmap
+889 auto quick rmap fsmap
+890 auto quick rmap fsmap
+891 auto rmap fsmap
+892 auto quick rmap fsmap
+893 auto quick rmap fsmap
+894 auto quick rmap fsmap
+895 auto quick rmap fsmap

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [PATCH 11/13] xfs: test getbmapx shared extent reporting
  2016-08-25 23:28 ` Darrick J. Wong
@ 2016-08-25 23:29   ` Darrick J. Wong
  -1 siblings, 0 replies; 39+ messages in thread
From: Darrick J. Wong @ 2016-08-25 23:29 UTC (permalink / raw)
  To: david, eguan, darrick.wong; +Cc: linux-xfs, fstests, xfs

Test that getbmapx returns exact shared extents.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 tests/xfs/896     |   93 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/xfs/896.out |   17 ++++++++++
 tests/xfs/group   |    1 +
 3 files changed, 111 insertions(+)
 create mode 100755 tests/xfs/896
 create mode 100644 tests/xfs/896.out


diff --git a/tests/xfs/896 b/tests/xfs/896
new file mode 100755
index 0000000..a0281bd
--- /dev/null
+++ b/tests/xfs/896
@@ -0,0 +1,93 @@
+#! /bin/bash
+# FS QA Test No. 896
+#
+# Check that GETBMAPX accurately report shared extents.
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2016 Oracle, Inc.  All Rights Reserved.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it would be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write the Free Software Foundation,
+# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+#-----------------------------------------------------------------------
+#
+
+seq=`basename $0`
+seqres=$RESULT_DIR/$seq
+echo "QA output created by $seq"
+
+here=`pwd`
+tmp=/tmp/$$
+status=1	# failure is the default!
+trap "_cleanup; exit \$status" 0 1 2 3 7 15
+
+_cleanup()
+{
+	cd /
+	rm -rf $tmp.*
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+. ./common/reflink
+
+# real QA test starts here
+_supported_os Linux
+_supported_fs xfs
+_require_scratch_reflink
+_require_xfs_io_command "bmap"
+
+echo "Format and mount"
+_scratch_mkfs > $seqres.full 2>&1
+_scratch_mount >> $seqres.full 2>&1
+
+testdir=$SCRATCH_MNT/test-$seq
+mkdir $testdir
+
+blocks=5
+blksz=65536
+sz=$((blocks * blksz))
+
+echo "Create the original files"
+$XFS_IO_PROG -f -c "falloc 0 $sz" $testdir/file1 >> $seqres.full
+_pwrite_byte 0x61 0 $sz $testdir/file1 >> $seqres.full
+_scratch_cycle_mount
+
+bmap() {
+	$XFS_IO_PROG -c 'bmap -v' $1 | grep '^[[:space:]]*[0-9]*:'
+}
+
+echo "file1 extents and holes"
+bmap $testdir/file1 | grep -v -c hole
+bmap $testdir/file1 | grep -c hole
+
+_reflink_range $testdir/file1 $blksz $testdir/file2 $((blksz * 3)) $blksz >> $seqres.full
+_reflink_range $testdir/file1 $((blksz * 3)) $testdir/file2 $blksz $blksz >> $seqres.full
+_scratch_cycle_mount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file2 | _filter_scratch
+
+echo "file1 extents and holes"
+bmap $testdir/file1 | grep -v -c hole
+bmap $testdir/file1 | grep -c hole
+echo "file2 extents and holes"
+bmap $testdir/file2 | grep -v -c hole
+bmap $testdir/file2 | grep -c hole
+echo "file1 shared extents"
+bmap $testdir/file1 | grep -c '1.....$'
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/896.out b/tests/xfs/896.out
new file mode 100644
index 0000000..63b3a11
--- /dev/null
+++ b/tests/xfs/896.out
@@ -0,0 +1,17 @@
+QA output created by 896
+Format and mount
+Create the original files
+file1 extents and holes
+1
+0
+Compare files
+17af09af790a9b4c79cddf72f6b642cb  SCRATCH_MNT/test-896/file1
+79418df9c55ab7f58781cb7b9e7d5d91  SCRATCH_MNT/test-896/file2
+file1 extents and holes
+5
+0
+file2 extents and holes
+2
+2
+file1 shared extents
+2
diff --git a/tests/xfs/group b/tests/xfs/group
index 6d349dc..5ff35cb 100644
--- a/tests/xfs/group
+++ b/tests/xfs/group
@@ -331,3 +331,4 @@
 893 auto quick rmap fsmap
 894 auto quick rmap fsmap
 895 auto quick rmap fsmap
+896 auto quick clone


^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [PATCH 11/13] xfs: test getbmapx shared extent reporting
@ 2016-08-25 23:29   ` Darrick J. Wong
  0 siblings, 0 replies; 39+ messages in thread
From: Darrick J. Wong @ 2016-08-25 23:29 UTC (permalink / raw)
  To: david, eguan, darrick.wong; +Cc: linux-xfs, fstests, xfs

Test that getbmapx returns exact shared extents.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 tests/xfs/896     |   93 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/xfs/896.out |   17 ++++++++++
 tests/xfs/group   |    1 +
 3 files changed, 111 insertions(+)
 create mode 100755 tests/xfs/896
 create mode 100644 tests/xfs/896.out


diff --git a/tests/xfs/896 b/tests/xfs/896
new file mode 100755
index 0000000..a0281bd
--- /dev/null
+++ b/tests/xfs/896
@@ -0,0 +1,93 @@
+#! /bin/bash
+# FS QA Test No. 896
+#
+# Check that GETBMAPX accurately report shared extents.
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2016 Oracle, Inc.  All Rights Reserved.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it would be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write the Free Software Foundation,
+# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+#-----------------------------------------------------------------------
+#
+
+seq=`basename $0`
+seqres=$RESULT_DIR/$seq
+echo "QA output created by $seq"
+
+here=`pwd`
+tmp=/tmp/$$
+status=1	# failure is the default!
+trap "_cleanup; exit \$status" 0 1 2 3 7 15
+
+_cleanup()
+{
+	cd /
+	rm -rf $tmp.*
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+. ./common/reflink
+
+# real QA test starts here
+_supported_os Linux
+_supported_fs xfs
+_require_scratch_reflink
+_require_xfs_io_command "bmap"
+
+echo "Format and mount"
+_scratch_mkfs > $seqres.full 2>&1
+_scratch_mount >> $seqres.full 2>&1
+
+testdir=$SCRATCH_MNT/test-$seq
+mkdir $testdir
+
+blocks=5
+blksz=65536
+sz=$((blocks * blksz))
+
+echo "Create the original files"
+$XFS_IO_PROG -f -c "falloc 0 $sz" $testdir/file1 >> $seqres.full
+_pwrite_byte 0x61 0 $sz $testdir/file1 >> $seqres.full
+_scratch_cycle_mount
+
+bmap() {
+	$XFS_IO_PROG -c 'bmap -v' $1 | grep '^[[:space:]]*[0-9]*:'
+}
+
+echo "file1 extents and holes"
+bmap $testdir/file1 | grep -v -c hole
+bmap $testdir/file1 | grep -c hole
+
+_reflink_range $testdir/file1 $blksz $testdir/file2 $((blksz * 3)) $blksz >> $seqres.full
+_reflink_range $testdir/file1 $((blksz * 3)) $testdir/file2 $blksz $blksz >> $seqres.full
+_scratch_cycle_mount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file2 | _filter_scratch
+
+echo "file1 extents and holes"
+bmap $testdir/file1 | grep -v -c hole
+bmap $testdir/file1 | grep -c hole
+echo "file2 extents and holes"
+bmap $testdir/file2 | grep -v -c hole
+bmap $testdir/file2 | grep -c hole
+echo "file1 shared extents"
+bmap $testdir/file1 | grep -c '1.....$'
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/896.out b/tests/xfs/896.out
new file mode 100644
index 0000000..63b3a11
--- /dev/null
+++ b/tests/xfs/896.out
@@ -0,0 +1,17 @@
+QA output created by 896
+Format and mount
+Create the original files
+file1 extents and holes
+1
+0
+Compare files
+17af09af790a9b4c79cddf72f6b642cb  SCRATCH_MNT/test-896/file1
+79418df9c55ab7f58781cb7b9e7d5d91  SCRATCH_MNT/test-896/file2
+file1 extents and holes
+5
+0
+file2 extents and holes
+2
+2
+file1 shared extents
+2
diff --git a/tests/xfs/group b/tests/xfs/group
index 6d349dc..5ff35cb 100644
--- a/tests/xfs/group
+++ b/tests/xfs/group
@@ -331,3 +331,4 @@
 893 auto quick rmap fsmap
 894 auto quick rmap fsmap
 895 auto quick rmap fsmap
+896 auto quick clone

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [PATCH 12/13] xfs/122: track xfs_scrub_metadata
  2016-08-25 23:28 ` Darrick J. Wong
                   ` (11 preceding siblings ...)
  (?)
@ 2016-08-25 23:29 ` Darrick J. Wong
  -1 siblings, 0 replies; 39+ messages in thread
From: Darrick J. Wong @ 2016-08-25 23:29 UTC (permalink / raw)
  To: david, eguan, darrick.wong; +Cc: linux-xfs, fstests, xfs

Make sure the metadata scrub ioctl structure doesn't change size.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 tests/xfs/122.out |    1 +
 1 file changed, 1 insertion(+)


diff --git a/tests/xfs/122.out b/tests/xfs/122.out
index bbffd0f..cd909e6 100644
--- a/tests/xfs/122.out
+++ b/tests/xfs/122.out
@@ -94,6 +94,7 @@ sizeof(struct xfs_rtrmap_rec) = 32
 sizeof(struct xfs_rtrmap_root) = 4
 sizeof(struct xfs_rud_log_format) = 16
 sizeof(struct xfs_rui_log_format) = 48
+sizeof(struct xfs_scrub_metadata) = 64
 sizeof(xfs_agf_t) = 224
 sizeof(xfs_agfl_t) = 36
 sizeof(xfs_agi_t) = 336


^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [PATCH 13/13] xfs/122: check the ag reservation counter ioctl
  2016-08-25 23:28 ` Darrick J. Wong
@ 2016-08-25 23:29   ` Darrick J. Wong
  -1 siblings, 0 replies; 39+ messages in thread
From: Darrick J. Wong @ 2016-08-25 23:29 UTC (permalink / raw)
  To: david, eguan, darrick.wong; +Cc: linux-xfs, fstests, xfs

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 tests/xfs/122.out |    1 +
 1 file changed, 1 insertion(+)


diff --git a/tests/xfs/122.out b/tests/xfs/122.out
index cd909e6..ae84283 100644
--- a/tests/xfs/122.out
+++ b/tests/xfs/122.out
@@ -81,6 +81,7 @@ sizeof(struct xfs_dsymlink_hdr) = 56
 sizeof(struct xfs_extent_data) = 24
 sizeof(struct xfs_extent_data_info) = 32
 sizeof(struct xfs_fs_eofblocks) = 128
+sizeof(struct xfs_fsop_ag_resblks) = 32
 sizeof(struct xfs_icreate_log) = 28
 sizeof(struct xfs_log_dinode) = 176
 sizeof(struct xfs_map_extent) = 32


^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [PATCH 13/13] xfs/122: check the ag reservation counter ioctl
@ 2016-08-25 23:29   ` Darrick J. Wong
  0 siblings, 0 replies; 39+ messages in thread
From: Darrick J. Wong @ 2016-08-25 23:29 UTC (permalink / raw)
  To: david, eguan, darrick.wong; +Cc: linux-xfs, fstests, xfs

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 tests/xfs/122.out |    1 +
 1 file changed, 1 insertion(+)


diff --git a/tests/xfs/122.out b/tests/xfs/122.out
index cd909e6..ae84283 100644
--- a/tests/xfs/122.out
+++ b/tests/xfs/122.out
@@ -81,6 +81,7 @@ sizeof(struct xfs_dsymlink_hdr) = 56
 sizeof(struct xfs_extent_data) = 24
 sizeof(struct xfs_extent_data_info) = 32
 sizeof(struct xfs_fs_eofblocks) = 128
+sizeof(struct xfs_fsop_ag_resblks) = 32
 sizeof(struct xfs_icreate_log) = 28
 sizeof(struct xfs_log_dinode) = 176
 sizeof(struct xfs_map_extent) = 32

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply related	[flat|nested] 39+ messages in thread

* Re: [PATCH 06/13] xfs: fix $XFS_DB_PROG usage
  2016-08-25 23:28   ` Darrick J. Wong
@ 2016-09-01  7:37     ` Eryu Guan
  -1 siblings, 0 replies; 39+ messages in thread
From: Eryu Guan @ 2016-09-01  7:37 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: david, linux-xfs, fstests, xfs

On Thu, Aug 25, 2016 at 04:28:57PM -0700, Darrick J. Wong wrote:
> xfs_db requires us to pass in the log device, if any; this can be
> accomplished via _scratch_xfs_db_options (if we're operating on the
> scratch device, anyway).  However, many of the tests/xfs/ scripts
> pass only $SCRATCH_DEV directly, so they'll fail if we test with an
> external log.  So, fix that.
> 
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> ---
[snip]
> diff --git a/tests/xfs/111 b/tests/xfs/111
> index f6a41a8..4899020 100755
> --- a/tests/xfs/111
> +++ b/tests/xfs/111
> @@ -64,7 +64,7 @@ INO=`ls -i $SCRATCH_MNT/512 | awk '{print $1}'`
>  _scratch_unmount
>  
>  # Figure out where that middle inode starts
> -BYTE=`$XFS_DB_PROG -c "convert inode $INO byte" $SCRATCH_DEV \
> +BYTE=`$XFS_DB_PROG -c "convert inode $INO byte" `_scratch_xfs_db_options` \

This has syntax error because of the nested ``, $SCRATCH_DEV is already
within a ``. Replace `` with $() could fix it.

-BYTE=`$XFS_DB_PROG -c "convert inode $INO byte" `_scratch_xfs_db_options` \
+BYTE=`$XFS_DB_PROG -c "convert inode $INO byte" $(_scratch_xfs_db_options) \

[snip]

> diff --git a/tests/xfs/186 b/tests/xfs/186
> index 192a8c8..347db0d 100755
> --- a/tests/xfs/186
> +++ b/tests/xfs/186
> @@ -98,8 +98,8 @@ _print_inode()
>  {
>  	echo ""
>  	echo "================================="
> -	$XFS_DB_PROG -c "version" $SCRATCH_DEV 2>&1 | _filter_version
> -	$XFS_DB_PROG -c "inode $inum" -c p $SCRATCH_DEV 2>&1 | _filter_inode
> +	$XFS_DB_PROG -c "version" `_scratch_xfs_db_options` 2>&1 | _filter_version
> +	$XFS_DB_PROG -c "inode $inum" -c p `_scratch_xfs_db_options` 2>&1 | _filter_inode
>  	echo "================================="
>  }
>  
> @@ -136,7 +136,7 @@ _changeto_attr1()
>  	echo ""
>  	echo "Try setting attr1 by db"
>  	echo ""
> -	$XFS_DB_PROG -x -c "version attr1" $SCRATCH_DEV | _filter_version
> +	$XFS_DB_PROG -x -c "version attr1" `_scratch_xfs_db_options` | _filter_version
>  }
>  
>  # get standard environment, filters and checks
> @@ -173,7 +173,7 @@ fi
>  
>  # set inum to root dir ino
>  # we'll add in dirents and EAs into the root directory
> -eval `$XFS_DB_PROG -r -c 'sb 0' -c 'p rootino' $SCRATCH_DEV | $SED_PROG 's/ //g'`
> +eval `$XFS_DB_PROG -r -c 'sb 0' -c 'p rootino' `_scratch_xfs_db_options` | $SED_PROG 's/ //g'`

And here.

I can fix them at commit time.

Thanks,
Eryu

^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: [PATCH 06/13] xfs: fix $XFS_DB_PROG usage
@ 2016-09-01  7:37     ` Eryu Guan
  0 siblings, 0 replies; 39+ messages in thread
From: Eryu Guan @ 2016-09-01  7:37 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: linux-xfs, fstests, xfs

On Thu, Aug 25, 2016 at 04:28:57PM -0700, Darrick J. Wong wrote:
> xfs_db requires us to pass in the log device, if any; this can be
> accomplished via _scratch_xfs_db_options (if we're operating on the
> scratch device, anyway).  However, many of the tests/xfs/ scripts
> pass only $SCRATCH_DEV directly, so they'll fail if we test with an
> external log.  So, fix that.
> 
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> ---
[snip]
> diff --git a/tests/xfs/111 b/tests/xfs/111
> index f6a41a8..4899020 100755
> --- a/tests/xfs/111
> +++ b/tests/xfs/111
> @@ -64,7 +64,7 @@ INO=`ls -i $SCRATCH_MNT/512 | awk '{print $1}'`
>  _scratch_unmount
>  
>  # Figure out where that middle inode starts
> -BYTE=`$XFS_DB_PROG -c "convert inode $INO byte" $SCRATCH_DEV \
> +BYTE=`$XFS_DB_PROG -c "convert inode $INO byte" `_scratch_xfs_db_options` \

This has syntax error because of the nested ``, $SCRATCH_DEV is already
within a ``. Replace `` with $() could fix it.

-BYTE=`$XFS_DB_PROG -c "convert inode $INO byte" `_scratch_xfs_db_options` \
+BYTE=`$XFS_DB_PROG -c "convert inode $INO byte" $(_scratch_xfs_db_options) \

[snip]

> diff --git a/tests/xfs/186 b/tests/xfs/186
> index 192a8c8..347db0d 100755
> --- a/tests/xfs/186
> +++ b/tests/xfs/186
> @@ -98,8 +98,8 @@ _print_inode()
>  {
>  	echo ""
>  	echo "================================="
> -	$XFS_DB_PROG -c "version" $SCRATCH_DEV 2>&1 | _filter_version
> -	$XFS_DB_PROG -c "inode $inum" -c p $SCRATCH_DEV 2>&1 | _filter_inode
> +	$XFS_DB_PROG -c "version" `_scratch_xfs_db_options` 2>&1 | _filter_version
> +	$XFS_DB_PROG -c "inode $inum" -c p `_scratch_xfs_db_options` 2>&1 | _filter_inode
>  	echo "================================="
>  }
>  
> @@ -136,7 +136,7 @@ _changeto_attr1()
>  	echo ""
>  	echo "Try setting attr1 by db"
>  	echo ""
> -	$XFS_DB_PROG -x -c "version attr1" $SCRATCH_DEV | _filter_version
> +	$XFS_DB_PROG -x -c "version attr1" `_scratch_xfs_db_options` | _filter_version
>  }
>  
>  # get standard environment, filters and checks
> @@ -173,7 +173,7 @@ fi
>  
>  # set inum to root dir ino
>  # we'll add in dirents and EAs into the root directory
> -eval `$XFS_DB_PROG -r -c 'sb 0' -c 'p rootino' $SCRATCH_DEV | $SED_PROG 's/ //g'`
> +eval `$XFS_DB_PROG -r -c 'sb 0' -c 'p rootino' `_scratch_xfs_db_options` | $SED_PROG 's/ //g'`

And here.

I can fix them at commit time.

Thanks,
Eryu

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: [PATCH 08/13] xfs: more rmapbt tests
  2016-08-25 23:29   ` Darrick J. Wong
@ 2016-09-01  8:33     ` Eryu Guan
  -1 siblings, 0 replies; 39+ messages in thread
From: Eryu Guan @ 2016-09-01  8:33 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: david, linux-xfs, fstests, xfs

On Thu, Aug 25, 2016 at 04:29:11PM -0700, Darrick J. Wong wrote:
> More tests for the reverse mapping functionality.
> 
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> ---
>  tests/xfs/876     |   75 +++++++++++++++++++++++++++++++++++++++++++
>  tests/xfs/876.out |    4 ++
>  tests/xfs/877     |   92 +++++++++++++++++++++++++++++++++++++++++++++++++++++
>  tests/xfs/877.out |   10 ++++++
>  tests/xfs/group   |    2 +
>  5 files changed, 183 insertions(+)
>  create mode 100755 tests/xfs/876
>  create mode 100644 tests/xfs/876.out
>  create mode 100755 tests/xfs/877
>  create mode 100644 tests/xfs/877.out
> 
> 
> diff --git a/tests/xfs/876 b/tests/xfs/876
> new file mode 100755
> index 0000000..7f447c9
> --- /dev/null
> +++ b/tests/xfs/876
> @@ -0,0 +1,75 @@
> +#! /bin/bash
> +# FS QA Test No. 876
> +#
> +# Create a big enough rmapbt that we tickle a fdblocks accounting bug.
> +#
> +#-----------------------------------------------------------------------
> +# Copyright (c) 2016, Oracle and/or its affiliates.  All Rights Reserved.
> +#
> +# This program is free software; you can redistribute it and/or
> +# modify it under the terms of the GNU General Public License as
> +# published by the Free Software Foundation.
> +#
> +# This program is distributed in the hope that it would be useful,
> +# but WITHOUT ANY WARRANTY; without even the implied warranty of
> +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> +# GNU General Public License for more details.
> +#
> +# You should have received a copy of the GNU General Public License
> +# along with this program; if not, write the Free Software Foundation,
> +# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
> +#-----------------------------------------------------------------------
> +
> +seq=`basename "$0"`
> +seqres="$RESULT_DIR/$seq"
> +echo "QA output created by $seq"
> +
> +here=`pwd`
> +tmp=/tmp/$$
> +status=1    # failure is the default!
> +trap "_cleanup; exit \$status" 0 1 2 3 15
> +
> +_cleanup()
> +{
> +	cd /
> +	rm -rf "$tmp".*
> +}
> +
> +# get standard environment, filters and checks
> +. ./common/rc
> +. ./common/filter
> +. ./common/reflink
> +
> +# real QA test starts here
> +_supported_os Linux
> +_supported_fs xfs
> +_require_scratch
> +_require_xfs_scratch_rmapbt
> +_require_scratch_reflink
> +_require_test_program "punch-alternating"
> +
> +rm -f "$seqres.full"
> +
> +echo "+ create scratch fs"
> +_scratch_mkfs > "$seqres.full" 2>&1
> +
> +echo "+ mount fs image"
> +_scratch_mount
> +blksz="$(stat -f $SCRATCH_MNT -c '%S')"

There's "get_block_size" helper to do this.

> +
> +bt_ptrs=$(( (blksz - 56) / 44 ))
> +bt_recs=$(( (blksz - 56) / 24 ))

It's unclear to me where do these magic numbers come from. Add some
comments?

> +
> +blocks=$((bt_ptrs * bt_recs + 1))
> +_require_fs_space $SCRATCH_MNT $(( (2 * blocks * blksz) * 5 / 4096 ))

_require_fs_space requires the last argument is represented in 1k block
size, so it should be " / 1024" here?

> +len=$((blocks * blksz))
> +
> +echo "+ make some files"
> +$XFS_IO_PROG -f -c "falloc 0 $len" -c "pwrite -S 0x68 -b 1048576 0 $len" $SCRATCH_MNT/f1 >> $seqres.full
> +$XFS_IO_PROG -f -c "falloc 0 $len" -c "pwrite -S 0x68 -b 1048576 0 $len" $SCRATCH_MNT/f2 >> $seqres.full
> +./src/punch-alternating $SCRATCH_MNT/f1 >> "$seqres.full"
> +./src/punch-alternating $SCRATCH_MNT/f2 >> "$seqres.full"
> +
> +# success, all done
> +status=0
> +exit
> diff --git a/tests/xfs/876.out b/tests/xfs/876.out
> new file mode 100644
> index 0000000..96c1970
> --- /dev/null
> +++ b/tests/xfs/876.out
> @@ -0,0 +1,4 @@
> +QA output created by 876
> ++ create scratch fs
> ++ mount fs image
> ++ make some files
> diff --git a/tests/xfs/877 b/tests/xfs/877
> new file mode 100755
> index 0000000..2ad7d30
> --- /dev/null
> +++ b/tests/xfs/877
> @@ -0,0 +1,92 @@
> +#! /bin/bash
> +# FS QA Test No. 877
> +#
> +# Make sure query_range returns -EINVAL if lowkey > highkey.
> +#
> +#-----------------------------------------------------------------------
> +# Copyright (c) 2016, Oracle and/or its affiliates.  All Rights Reserved.
> +#
> +# This program is free software; you can redistribute it and/or
> +# modify it under the terms of the GNU General Public License as
> +# published by the Free Software Foundation.
> +#
> +# This program is distributed in the hope that it would be useful,
> +# but WITHOUT ANY WARRANTY; without even the implied warranty of
> +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> +# GNU General Public License for more details.
> +#
> +# You should have received a copy of the GNU General Public License
> +# along with this program; if not, write the Free Software Foundation,
> +# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
> +#-----------------------------------------------------------------------
> +
> +seq=`basename "$0"`
> +seqres="$RESULT_DIR/$seq"
> +echo "QA output created by $seq"
> +
> +here=`pwd`
> +tmp=/tmp/$$
> +status=1    # failure is the default!
> +trap "_cleanup; exit \$status" 0 1 2 3 15
> +
> +_cleanup()
> +{
> +	cd /
> +	rm -rf "$tmp".* $metadump_file
> +}
> +
> +# get standard environment, filters and checks
> +. ./common/rc
> +. ./common/filter
> +. ./common/attr

Seems this is not needed.

> +
> +# real QA test starts here
> +_supported_os Linux
> +_supported_fs xfs
> +_require_xfs_scratch_rmapbt
> +_require_command "$XFS_DB_PROG" "xfs_db"
> +_require_xfs_io_command "falloc"
> +_require_xfs_io_command "fpunch"
> +_require_xfs_io_command "fzero"
> +_require_xfs_io_command "fcollapse"
> +_require_xfs_io_command "finsert"
> +
> +rm -f "$seqres.full"
> +
> +echo "Format and mount"
> +_scratch_mkfs > "$seqres.full" 2>&1
> +_scratch_mount
> +blksz=65536
> +blocks=16
> +len=$((blocks * blksz))
> +
> +echo "Create some files"
> +$XFS_IO_PROG -f -c "falloc 0 $len" -c "pwrite -S 0x68 -b 1048576 0 $len" $SCRATCH_MNT/f1 >> $seqres.full
> +
> +echo "Manipulate file"
> +$XFS_IO_PROG -c "fpunch $blksz $blksz" \
> +	-c "fzero $((3 * blksz)) $blksz" \
> +	-c "pwrite -S 0x69 $((5 * blksz)) $blksz" \
> +	-c "fpunch $((7 * blksz)) $blksz" \
> +	-c "fsync" \
> +	-c "pwrite -S 0x70 $((7 * blksz)) $blksz" \
> +	-c "fcollapse $((9 * blksz)) $blksz" \
> +	-c "finsert $((10 * blksz)) $blksz" $SCRATCH_MNT/f1 >> $seqres.full
> +
> +echo "Check file"
> +md5sum $SCRATCH_MNT/f1 | _filter_scratch

I'm a bit confused by the md5sum, f1 is not checked again for
comparison, what's the purpose of this checksum?

Thanks,
Eryu

> +od -tx1 -Ad -c $SCRATCH_MNT/f1 >> $seqres.full
> +
> +echo "Unmount"
> +_scratch_unmount
> +
> +echo "Try a regular fsmap"
> +$XFS_DB_PROG -c 'fsmap' `_scratch_xfs_db_options` >> $seqres.full
> +$XFS_DB_PROG -c 'fsmap 0 5' `_scratch_xfs_db_options` >> $seqres.full
> +
> +echo "Try a bad fsmap"
> +$XFS_DB_PROG -c 'fsmap 5 4' `_scratch_xfs_db_options`
> +
> +# success, all done
> +status=0
> +exit
> diff --git a/tests/xfs/877.out b/tests/xfs/877.out
> new file mode 100644
> index 0000000..4a2242f
> --- /dev/null
> +++ b/tests/xfs/877.out
> @@ -0,0 +1,10 @@
> +QA output created by 877
> +Format and mount
> +Create some files
> +Manipulate file
> +Check file
> +e45c5707fcf6817e914ffb6ce37a0ac7  SCRATCH_MNT/f1
> +Unmount
> +Try a regular fsmap
> +Try a bad fsmap
> +Error 22 while querying fsmap btree.
> diff --git a/tests/xfs/group b/tests/xfs/group
> index 8565204..72580e9 100644
> --- a/tests/xfs/group
> +++ b/tests/xfs/group
> @@ -311,3 +311,5 @@
>  873 auto quick clone fsr
>  874 auto quick clone fsr
>  875 auto quick clone fsr quota
> +876 auto quick rmap clone
> +877 auto quick rmap clone
> 

^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: [PATCH 08/13] xfs: more rmapbt tests
@ 2016-09-01  8:33     ` Eryu Guan
  0 siblings, 0 replies; 39+ messages in thread
From: Eryu Guan @ 2016-09-01  8:33 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: linux-xfs, fstests, xfs

On Thu, Aug 25, 2016 at 04:29:11PM -0700, Darrick J. Wong wrote:
> More tests for the reverse mapping functionality.
> 
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> ---
>  tests/xfs/876     |   75 +++++++++++++++++++++++++++++++++++++++++++
>  tests/xfs/876.out |    4 ++
>  tests/xfs/877     |   92 +++++++++++++++++++++++++++++++++++++++++++++++++++++
>  tests/xfs/877.out |   10 ++++++
>  tests/xfs/group   |    2 +
>  5 files changed, 183 insertions(+)
>  create mode 100755 tests/xfs/876
>  create mode 100644 tests/xfs/876.out
>  create mode 100755 tests/xfs/877
>  create mode 100644 tests/xfs/877.out
> 
> 
> diff --git a/tests/xfs/876 b/tests/xfs/876
> new file mode 100755
> index 0000000..7f447c9
> --- /dev/null
> +++ b/tests/xfs/876
> @@ -0,0 +1,75 @@
> +#! /bin/bash
> +# FS QA Test No. 876
> +#
> +# Create a big enough rmapbt that we tickle a fdblocks accounting bug.
> +#
> +#-----------------------------------------------------------------------
> +# Copyright (c) 2016, Oracle and/or its affiliates.  All Rights Reserved.
> +#
> +# This program is free software; you can redistribute it and/or
> +# modify it under the terms of the GNU General Public License as
> +# published by the Free Software Foundation.
> +#
> +# This program is distributed in the hope that it would be useful,
> +# but WITHOUT ANY WARRANTY; without even the implied warranty of
> +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> +# GNU General Public License for more details.
> +#
> +# You should have received a copy of the GNU General Public License
> +# along with this program; if not, write the Free Software Foundation,
> +# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
> +#-----------------------------------------------------------------------
> +
> +seq=`basename "$0"`
> +seqres="$RESULT_DIR/$seq"
> +echo "QA output created by $seq"
> +
> +here=`pwd`
> +tmp=/tmp/$$
> +status=1    # failure is the default!
> +trap "_cleanup; exit \$status" 0 1 2 3 15
> +
> +_cleanup()
> +{
> +	cd /
> +	rm -rf "$tmp".*
> +}
> +
> +# get standard environment, filters and checks
> +. ./common/rc
> +. ./common/filter
> +. ./common/reflink
> +
> +# real QA test starts here
> +_supported_os Linux
> +_supported_fs xfs
> +_require_scratch
> +_require_xfs_scratch_rmapbt
> +_require_scratch_reflink
> +_require_test_program "punch-alternating"
> +
> +rm -f "$seqres.full"
> +
> +echo "+ create scratch fs"
> +_scratch_mkfs > "$seqres.full" 2>&1
> +
> +echo "+ mount fs image"
> +_scratch_mount
> +blksz="$(stat -f $SCRATCH_MNT -c '%S')"

There's "get_block_size" helper to do this.

> +
> +bt_ptrs=$(( (blksz - 56) / 44 ))
> +bt_recs=$(( (blksz - 56) / 24 ))

It's unclear to me where do these magic numbers come from. Add some
comments?

> +
> +blocks=$((bt_ptrs * bt_recs + 1))
> +_require_fs_space $SCRATCH_MNT $(( (2 * blocks * blksz) * 5 / 4096 ))

_require_fs_space requires the last argument is represented in 1k block
size, so it should be " / 1024" here?

> +len=$((blocks * blksz))
> +
> +echo "+ make some files"
> +$XFS_IO_PROG -f -c "falloc 0 $len" -c "pwrite -S 0x68 -b 1048576 0 $len" $SCRATCH_MNT/f1 >> $seqres.full
> +$XFS_IO_PROG -f -c "falloc 0 $len" -c "pwrite -S 0x68 -b 1048576 0 $len" $SCRATCH_MNT/f2 >> $seqres.full
> +./src/punch-alternating $SCRATCH_MNT/f1 >> "$seqres.full"
> +./src/punch-alternating $SCRATCH_MNT/f2 >> "$seqres.full"
> +
> +# success, all done
> +status=0
> +exit
> diff --git a/tests/xfs/876.out b/tests/xfs/876.out
> new file mode 100644
> index 0000000..96c1970
> --- /dev/null
> +++ b/tests/xfs/876.out
> @@ -0,0 +1,4 @@
> +QA output created by 876
> ++ create scratch fs
> ++ mount fs image
> ++ make some files
> diff --git a/tests/xfs/877 b/tests/xfs/877
> new file mode 100755
> index 0000000..2ad7d30
> --- /dev/null
> +++ b/tests/xfs/877
> @@ -0,0 +1,92 @@
> +#! /bin/bash
> +# FS QA Test No. 877
> +#
> +# Make sure query_range returns -EINVAL if lowkey > highkey.
> +#
> +#-----------------------------------------------------------------------
> +# Copyright (c) 2016, Oracle and/or its affiliates.  All Rights Reserved.
> +#
> +# This program is free software; you can redistribute it and/or
> +# modify it under the terms of the GNU General Public License as
> +# published by the Free Software Foundation.
> +#
> +# This program is distributed in the hope that it would be useful,
> +# but WITHOUT ANY WARRANTY; without even the implied warranty of
> +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> +# GNU General Public License for more details.
> +#
> +# You should have received a copy of the GNU General Public License
> +# along with this program; if not, write the Free Software Foundation,
> +# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
> +#-----------------------------------------------------------------------
> +
> +seq=`basename "$0"`
> +seqres="$RESULT_DIR/$seq"
> +echo "QA output created by $seq"
> +
> +here=`pwd`
> +tmp=/tmp/$$
> +status=1    # failure is the default!
> +trap "_cleanup; exit \$status" 0 1 2 3 15
> +
> +_cleanup()
> +{
> +	cd /
> +	rm -rf "$tmp".* $metadump_file
> +}
> +
> +# get standard environment, filters and checks
> +. ./common/rc
> +. ./common/filter
> +. ./common/attr

Seems this is not needed.

> +
> +# real QA test starts here
> +_supported_os Linux
> +_supported_fs xfs
> +_require_xfs_scratch_rmapbt
> +_require_command "$XFS_DB_PROG" "xfs_db"
> +_require_xfs_io_command "falloc"
> +_require_xfs_io_command "fpunch"
> +_require_xfs_io_command "fzero"
> +_require_xfs_io_command "fcollapse"
> +_require_xfs_io_command "finsert"
> +
> +rm -f "$seqres.full"
> +
> +echo "Format and mount"
> +_scratch_mkfs > "$seqres.full" 2>&1
> +_scratch_mount
> +blksz=65536
> +blocks=16
> +len=$((blocks * blksz))
> +
> +echo "Create some files"
> +$XFS_IO_PROG -f -c "falloc 0 $len" -c "pwrite -S 0x68 -b 1048576 0 $len" $SCRATCH_MNT/f1 >> $seqres.full
> +
> +echo "Manipulate file"
> +$XFS_IO_PROG -c "fpunch $blksz $blksz" \
> +	-c "fzero $((3 * blksz)) $blksz" \
> +	-c "pwrite -S 0x69 $((5 * blksz)) $blksz" \
> +	-c "fpunch $((7 * blksz)) $blksz" \
> +	-c "fsync" \
> +	-c "pwrite -S 0x70 $((7 * blksz)) $blksz" \
> +	-c "fcollapse $((9 * blksz)) $blksz" \
> +	-c "finsert $((10 * blksz)) $blksz" $SCRATCH_MNT/f1 >> $seqres.full
> +
> +echo "Check file"
> +md5sum $SCRATCH_MNT/f1 | _filter_scratch

I'm a bit confused by the md5sum, f1 is not checked again for
comparison, what's the purpose of this checksum?

Thanks,
Eryu

> +od -tx1 -Ad -c $SCRATCH_MNT/f1 >> $seqres.full
> +
> +echo "Unmount"
> +_scratch_unmount
> +
> +echo "Try a regular fsmap"
> +$XFS_DB_PROG -c 'fsmap' `_scratch_xfs_db_options` >> $seqres.full
> +$XFS_DB_PROG -c 'fsmap 0 5' `_scratch_xfs_db_options` >> $seqres.full
> +
> +echo "Try a bad fsmap"
> +$XFS_DB_PROG -c 'fsmap 5 4' `_scratch_xfs_db_options`
> +
> +# success, all done
> +status=0
> +exit
> diff --git a/tests/xfs/877.out b/tests/xfs/877.out
> new file mode 100644
> index 0000000..4a2242f
> --- /dev/null
> +++ b/tests/xfs/877.out
> @@ -0,0 +1,10 @@
> +QA output created by 877
> +Format and mount
> +Create some files
> +Manipulate file
> +Check file
> +e45c5707fcf6817e914ffb6ce37a0ac7  SCRATCH_MNT/f1
> +Unmount
> +Try a regular fsmap
> +Try a bad fsmap
> +Error 22 while querying fsmap btree.
> diff --git a/tests/xfs/group b/tests/xfs/group
> index 8565204..72580e9 100644
> --- a/tests/xfs/group
> +++ b/tests/xfs/group
> @@ -311,3 +311,5 @@
>  873 auto quick clone fsr
>  874 auto quick clone fsr
>  875 auto quick clone fsr quota
> +876 auto quick rmap clone
> +877 auto quick rmap clone
> 

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: [PATCH 06/13] xfs: fix $XFS_DB_PROG usage
  2016-09-01  7:37     ` Eryu Guan
@ 2016-09-01 15:57       ` Darrick J. Wong
  -1 siblings, 0 replies; 39+ messages in thread
From: Darrick J. Wong @ 2016-09-01 15:57 UTC (permalink / raw)
  To: Eryu Guan; +Cc: david, linux-xfs, fstests, xfs

On Thu, Sep 01, 2016 at 03:37:31PM +0800, Eryu Guan wrote:
> On Thu, Aug 25, 2016 at 04:28:57PM -0700, Darrick J. Wong wrote:
> > xfs_db requires us to pass in the log device, if any; this can be
> > accomplished via _scratch_xfs_db_options (if we're operating on the
> > scratch device, anyway).  However, many of the tests/xfs/ scripts
> > pass only $SCRATCH_DEV directly, so they'll fail if we test with an
> > external log.  So, fix that.
> > 
> > Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> > ---
> [snip]
> > diff --git a/tests/xfs/111 b/tests/xfs/111
> > index f6a41a8..4899020 100755
> > --- a/tests/xfs/111
> > +++ b/tests/xfs/111
> > @@ -64,7 +64,7 @@ INO=`ls -i $SCRATCH_MNT/512 | awk '{print $1}'`
> >  _scratch_unmount
> >  
> >  # Figure out where that middle inode starts
> > -BYTE=`$XFS_DB_PROG -c "convert inode $INO byte" $SCRATCH_DEV \
> > +BYTE=`$XFS_DB_PROG -c "convert inode $INO byte" `_scratch_xfs_db_options` \
> 
> This has syntax error because of the nested ``, $SCRATCH_DEV is already
> within a ``. Replace `` with $() could fix it.
> 
> -BYTE=`$XFS_DB_PROG -c "convert inode $INO byte" `_scratch_xfs_db_options` \
> +BYTE=`$XFS_DB_PROG -c "convert inode $INO byte" $(_scratch_xfs_db_options) \
> 
> [snip]
> 
> > diff --git a/tests/xfs/186 b/tests/xfs/186
> > index 192a8c8..347db0d 100755
> > --- a/tests/xfs/186
> > +++ b/tests/xfs/186
> > @@ -98,8 +98,8 @@ _print_inode()
> >  {
> >  	echo ""
> >  	echo "================================="
> > -	$XFS_DB_PROG -c "version" $SCRATCH_DEV 2>&1 | _filter_version
> > -	$XFS_DB_PROG -c "inode $inum" -c p $SCRATCH_DEV 2>&1 | _filter_inode
> > +	$XFS_DB_PROG -c "version" `_scratch_xfs_db_options` 2>&1 | _filter_version
> > +	$XFS_DB_PROG -c "inode $inum" -c p `_scratch_xfs_db_options` 2>&1 | _filter_inode
> >  	echo "================================="
> >  }
> >  
> > @@ -136,7 +136,7 @@ _changeto_attr1()
> >  	echo ""
> >  	echo "Try setting attr1 by db"
> >  	echo ""
> > -	$XFS_DB_PROG -x -c "version attr1" $SCRATCH_DEV | _filter_version
> > +	$XFS_DB_PROG -x -c "version attr1" `_scratch_xfs_db_options` | _filter_version
> >  }
> >  
> >  # get standard environment, filters and checks
> > @@ -173,7 +173,7 @@ fi
> >  
> >  # set inum to root dir ino
> >  # we'll add in dirents and EAs into the root directory
> > -eval `$XFS_DB_PROG -r -c 'sb 0' -c 'p rootino' $SCRATCH_DEV | $SED_PROG 's/ //g'`
> > +eval `$XFS_DB_PROG -r -c 'sb 0' -c 'p rootino' `_scratch_xfs_db_options` | $SED_PROG 's/ //g'`
> 
> And here.
> 
> I can fix them at commit time.

I actually found more files that needed fixing, so I'll resubmit with
the extra fixes + the two fixes above.  Thank you for the review!

--D

> 
> Thanks,
> Eryu

^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: [PATCH 06/13] xfs: fix $XFS_DB_PROG usage
@ 2016-09-01 15:57       ` Darrick J. Wong
  0 siblings, 0 replies; 39+ messages in thread
From: Darrick J. Wong @ 2016-09-01 15:57 UTC (permalink / raw)
  To: Eryu Guan; +Cc: linux-xfs, fstests, xfs

On Thu, Sep 01, 2016 at 03:37:31PM +0800, Eryu Guan wrote:
> On Thu, Aug 25, 2016 at 04:28:57PM -0700, Darrick J. Wong wrote:
> > xfs_db requires us to pass in the log device, if any; this can be
> > accomplished via _scratch_xfs_db_options (if we're operating on the
> > scratch device, anyway).  However, many of the tests/xfs/ scripts
> > pass only $SCRATCH_DEV directly, so they'll fail if we test with an
> > external log.  So, fix that.
> > 
> > Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> > ---
> [snip]
> > diff --git a/tests/xfs/111 b/tests/xfs/111
> > index f6a41a8..4899020 100755
> > --- a/tests/xfs/111
> > +++ b/tests/xfs/111
> > @@ -64,7 +64,7 @@ INO=`ls -i $SCRATCH_MNT/512 | awk '{print $1}'`
> >  _scratch_unmount
> >  
> >  # Figure out where that middle inode starts
> > -BYTE=`$XFS_DB_PROG -c "convert inode $INO byte" $SCRATCH_DEV \
> > +BYTE=`$XFS_DB_PROG -c "convert inode $INO byte" `_scratch_xfs_db_options` \
> 
> This has syntax error because of the nested ``, $SCRATCH_DEV is already
> within a ``. Replace `` with $() could fix it.
> 
> -BYTE=`$XFS_DB_PROG -c "convert inode $INO byte" `_scratch_xfs_db_options` \
> +BYTE=`$XFS_DB_PROG -c "convert inode $INO byte" $(_scratch_xfs_db_options) \
> 
> [snip]
> 
> > diff --git a/tests/xfs/186 b/tests/xfs/186
> > index 192a8c8..347db0d 100755
> > --- a/tests/xfs/186
> > +++ b/tests/xfs/186
> > @@ -98,8 +98,8 @@ _print_inode()
> >  {
> >  	echo ""
> >  	echo "================================="
> > -	$XFS_DB_PROG -c "version" $SCRATCH_DEV 2>&1 | _filter_version
> > -	$XFS_DB_PROG -c "inode $inum" -c p $SCRATCH_DEV 2>&1 | _filter_inode
> > +	$XFS_DB_PROG -c "version" `_scratch_xfs_db_options` 2>&1 | _filter_version
> > +	$XFS_DB_PROG -c "inode $inum" -c p `_scratch_xfs_db_options` 2>&1 | _filter_inode
> >  	echo "================================="
> >  }
> >  
> > @@ -136,7 +136,7 @@ _changeto_attr1()
> >  	echo ""
> >  	echo "Try setting attr1 by db"
> >  	echo ""
> > -	$XFS_DB_PROG -x -c "version attr1" $SCRATCH_DEV | _filter_version
> > +	$XFS_DB_PROG -x -c "version attr1" `_scratch_xfs_db_options` | _filter_version
> >  }
> >  
> >  # get standard environment, filters and checks
> > @@ -173,7 +173,7 @@ fi
> >  
> >  # set inum to root dir ino
> >  # we'll add in dirents and EAs into the root directory
> > -eval `$XFS_DB_PROG -r -c 'sb 0' -c 'p rootino' $SCRATCH_DEV | $SED_PROG 's/ //g'`
> > +eval `$XFS_DB_PROG -r -c 'sb 0' -c 'p rootino' `_scratch_xfs_db_options` | $SED_PROG 's/ //g'`
> 
> And here.
> 
> I can fix them at commit time.

I actually found more files that needed fixing, so I'll resubmit with
the extra fixes + the two fixes above.  Thank you for the review!

--D

> 
> Thanks,
> Eryu

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: [PATCH 06/13] xfs: fix $XFS_DB_PROG usage
  2016-08-25 23:28   ` Darrick J. Wong
@ 2016-09-01 21:34     ` Dave Chinner
  -1 siblings, 0 replies; 39+ messages in thread
From: Dave Chinner @ 2016-09-01 21:34 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: eguan, linux-xfs, fstests, xfs

On Thu, Aug 25, 2016 at 04:28:57PM -0700, Darrick J. Wong wrote:
> xfs_db requires us to pass in the log device, if any; this can be
> accomplished via _scratch_xfs_db_options (if we're operating on the
> scratch device, anyway).  However, many of the tests/xfs/ scripts
> pass only $SCRATCH_DEV directly, so they'll fail if we test with an
> external log.  So, fix that.

I hadn't looked at this until now, but....

> diff --git a/tests/xfs/001 b/tests/xfs/001
> index c33adae..e1e1411 100755
> --- a/tests/xfs/001
> +++ b/tests/xfs/001
> @@ -44,11 +44,11 @@ _do_bit_test()
>  	bits="$2"
>  
>  	echo "testing $field with $bits bits"
> -	$XFS_DB_PROG -x -c "inode $FILE_INO" -c "write $field 0" $SCRATCH_DEV
> +	$XFS_DB_PROG -x -c "inode $FILE_INO" -c "write $field 0" `_scratch_xfs_db_options`

*yuck*

We are going to be getting that wrong -all the time-.

I'd suggest changing these to

	_scratch_xfs_db <command string>

and

_scratch_xfs_db()
{
	$XFS_DB_PROG $* `_scratch_xfs_db_options`
}

And hiding everything to do with devices completely i a much cleaner
and more maintainable solution to the problem.

Cheers,

Dave.
-- 
Dave Chinner
david@fromorbit.com

^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: [PATCH 06/13] xfs: fix $XFS_DB_PROG usage
@ 2016-09-01 21:34     ` Dave Chinner
  0 siblings, 0 replies; 39+ messages in thread
From: Dave Chinner @ 2016-09-01 21:34 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: linux-xfs, eguan, fstests, xfs

On Thu, Aug 25, 2016 at 04:28:57PM -0700, Darrick J. Wong wrote:
> xfs_db requires us to pass in the log device, if any; this can be
> accomplished via _scratch_xfs_db_options (if we're operating on the
> scratch device, anyway).  However, many of the tests/xfs/ scripts
> pass only $SCRATCH_DEV directly, so they'll fail if we test with an
> external log.  So, fix that.

I hadn't looked at this until now, but....

> diff --git a/tests/xfs/001 b/tests/xfs/001
> index c33adae..e1e1411 100755
> --- a/tests/xfs/001
> +++ b/tests/xfs/001
> @@ -44,11 +44,11 @@ _do_bit_test()
>  	bits="$2"
>  
>  	echo "testing $field with $bits bits"
> -	$XFS_DB_PROG -x -c "inode $FILE_INO" -c "write $field 0" $SCRATCH_DEV
> +	$XFS_DB_PROG -x -c "inode $FILE_INO" -c "write $field 0" `_scratch_xfs_db_options`

*yuck*

We are going to be getting that wrong -all the time-.

I'd suggest changing these to

	_scratch_xfs_db <command string>

and

_scratch_xfs_db()
{
	$XFS_DB_PROG $* `_scratch_xfs_db_options`
}

And hiding everything to do with devices completely i a much cleaner
and more maintainable solution to the problem.

Cheers,

Dave.
-- 
Dave Chinner
david@fromorbit.com

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: [PATCH 08/13] xfs: more rmapbt tests
  2016-09-01  8:33     ` Eryu Guan
@ 2016-09-04 17:40       ` Darrick J. Wong
  -1 siblings, 0 replies; 39+ messages in thread
From: Darrick J. Wong @ 2016-09-04 17:40 UTC (permalink / raw)
  To: Eryu Guan; +Cc: david, linux-xfs, fstests, xfs

On Thu, Sep 01, 2016 at 04:33:32PM +0800, Eryu Guan wrote:
> On Thu, Aug 25, 2016 at 04:29:11PM -0700, Darrick J. Wong wrote:
> > More tests for the reverse mapping functionality.
> > 
> > Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> > ---
> >  tests/xfs/876     |   75 +++++++++++++++++++++++++++++++++++++++++++
> >  tests/xfs/876.out |    4 ++
> >  tests/xfs/877     |   92 +++++++++++++++++++++++++++++++++++++++++++++++++++++
> >  tests/xfs/877.out |   10 ++++++
> >  tests/xfs/group   |    2 +
> >  5 files changed, 183 insertions(+)
> >  create mode 100755 tests/xfs/876
> >  create mode 100644 tests/xfs/876.out
> >  create mode 100755 tests/xfs/877
> >  create mode 100644 tests/xfs/877.out
> > 
> > 
> > diff --git a/tests/xfs/876 b/tests/xfs/876
> > new file mode 100755
> > index 0000000..7f447c9
> > --- /dev/null
> > +++ b/tests/xfs/876
> > @@ -0,0 +1,75 @@
> > +#! /bin/bash
> > +# FS QA Test No. 876
> > +#
> > +# Create a big enough rmapbt that we tickle a fdblocks accounting bug.
> > +#
> > +#-----------------------------------------------------------------------
> > +# Copyright (c) 2016, Oracle and/or its affiliates.  All Rights Reserved.
> > +#
> > +# This program is free software; you can redistribute it and/or
> > +# modify it under the terms of the GNU General Public License as
> > +# published by the Free Software Foundation.
> > +#
> > +# This program is distributed in the hope that it would be useful,
> > +# but WITHOUT ANY WARRANTY; without even the implied warranty of
> > +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> > +# GNU General Public License for more details.
> > +#
> > +# You should have received a copy of the GNU General Public License
> > +# along with this program; if not, write the Free Software Foundation,
> > +# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
> > +#-----------------------------------------------------------------------
> > +
> > +seq=`basename "$0"`
> > +seqres="$RESULT_DIR/$seq"
> > +echo "QA output created by $seq"
> > +
> > +here=`pwd`
> > +tmp=/tmp/$$
> > +status=1    # failure is the default!
> > +trap "_cleanup; exit \$status" 0 1 2 3 15
> > +
> > +_cleanup()
> > +{
> > +	cd /
> > +	rm -rf "$tmp".*
> > +}
> > +
> > +# get standard environment, filters and checks
> > +. ./common/rc
> > +. ./common/filter
> > +. ./common/reflink
> > +
> > +# real QA test starts here
> > +_supported_os Linux
> > +_supported_fs xfs
> > +_require_scratch
> > +_require_xfs_scratch_rmapbt
> > +_require_scratch_reflink
> > +_require_test_program "punch-alternating"
> > +
> > +rm -f "$seqres.full"
> > +
> > +echo "+ create scratch fs"
> > +_scratch_mkfs > "$seqres.full" 2>&1
> > +
> > +echo "+ mount fs image"
> > +_scratch_mount
> > +blksz="$(stat -f $SCRATCH_MNT -c '%S')"
> 
> There's "get_block_size" helper to do this.

D'oh.  Ok, noted.

> > +
> > +bt_ptrs=$(( (blksz - 56) / 44 ))
> > +bt_recs=$(( (blksz - 56) / 24 ))
> 
> It's unclear to me where do these magic numbers come from. Add some
> comments?

56 bytes is the size of the rmap btree block header.  44 bytes is the size of
rmapbt key+pointer size, and rmapbt records are 24 bytes each.

> > +
> > +blocks=$((bt_ptrs * bt_recs + 1))
> > +_require_fs_space $SCRATCH_MNT $(( (2 * blocks * blksz) * 5 / 4096 ))
> 
> _require_fs_space requires the last argument is represented in 1k block
> size, so it should be " / 1024" here?

4096 is fine, because we're baking a (4 * 1024) into it:

I need a big enough FS to store two (blocks * blksz) files, and then
an extra 25% (5 / 4) space to cover (hopefully) the log and metadata.
So the size calculation is really:

fs_sz_in_kb = 2 * (blocks * blksz) * (5/4) / 1024

> > +len=$((blocks * blksz))
> > +
> > +echo "+ make some files"
> > +$XFS_IO_PROG -f -c "falloc 0 $len" -c "pwrite -S 0x68 -b 1048576 0 $len" $SCRATCH_MNT/f1 >> $seqres.full
> > +$XFS_IO_PROG -f -c "falloc 0 $len" -c "pwrite -S 0x68 -b 1048576 0 $len" $SCRATCH_MNT/f2 >> $seqres.full
> > +./src/punch-alternating $SCRATCH_MNT/f1 >> "$seqres.full"
> > +./src/punch-alternating $SCRATCH_MNT/f2 >> "$seqres.full"
> > +
> > +# success, all done
> > +status=0
> > +exit
> > diff --git a/tests/xfs/876.out b/tests/xfs/876.out
> > new file mode 100644
> > index 0000000..96c1970
> > --- /dev/null
> > +++ b/tests/xfs/876.out
> > @@ -0,0 +1,4 @@
> > +QA output created by 876
> > ++ create scratch fs
> > ++ mount fs image
> > ++ make some files
> > diff --git a/tests/xfs/877 b/tests/xfs/877
> > new file mode 100755
> > index 0000000..2ad7d30
> > --- /dev/null
> > +++ b/tests/xfs/877
> > @@ -0,0 +1,92 @@
> > +#! /bin/bash
> > +# FS QA Test No. 877
> > +#
> > +# Make sure query_range returns -EINVAL if lowkey > highkey.
> > +#
> > +#-----------------------------------------------------------------------
> > +# Copyright (c) 2016, Oracle and/or its affiliates.  All Rights Reserved.
> > +#
> > +# This program is free software; you can redistribute it and/or
> > +# modify it under the terms of the GNU General Public License as
> > +# published by the Free Software Foundation.
> > +#
> > +# This program is distributed in the hope that it would be useful,
> > +# but WITHOUT ANY WARRANTY; without even the implied warranty of
> > +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> > +# GNU General Public License for more details.
> > +#
> > +# You should have received a copy of the GNU General Public License
> > +# along with this program; if not, write the Free Software Foundation,
> > +# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
> > +#-----------------------------------------------------------------------
> > +
> > +seq=`basename "$0"`
> > +seqres="$RESULT_DIR/$seq"
> > +echo "QA output created by $seq"
> > +
> > +here=`pwd`
> > +tmp=/tmp/$$
> > +status=1    # failure is the default!
> > +trap "_cleanup; exit \$status" 0 1 2 3 15
> > +
> > +_cleanup()
> > +{
> > +	cd /
> > +	rm -rf "$tmp".* $metadump_file
> > +}
> > +
> > +# get standard environment, filters and checks
> > +. ./common/rc
> > +. ./common/filter
> > +. ./common/attr
> 
> Seems this is not needed.

Right.

> > +
> > +# real QA test starts here
> > +_supported_os Linux
> > +_supported_fs xfs
> > +_require_xfs_scratch_rmapbt
> > +_require_command "$XFS_DB_PROG" "xfs_db"
> > +_require_xfs_io_command "falloc"
> > +_require_xfs_io_command "fpunch"
> > +_require_xfs_io_command "fzero"
> > +_require_xfs_io_command "fcollapse"
> > +_require_xfs_io_command "finsert"
> > +
> > +rm -f "$seqres.full"
> > +
> > +echo "Format and mount"
> > +_scratch_mkfs > "$seqres.full" 2>&1
> > +_scratch_mount
> > +blksz=65536
> > +blocks=16
> > +len=$((blocks * blksz))
> > +
> > +echo "Create some files"
> > +$XFS_IO_PROG -f -c "falloc 0 $len" -c "pwrite -S 0x68 -b 1048576 0 $len" $SCRATCH_MNT/f1 >> $seqres.full
> > +
> > +echo "Manipulate file"
> > +$XFS_IO_PROG -c "fpunch $blksz $blksz" \
> > +	-c "fzero $((3 * blksz)) $blksz" \
> > +	-c "pwrite -S 0x69 $((5 * blksz)) $blksz" \
> > +	-c "fpunch $((7 * blksz)) $blksz" \
> > +	-c "fsync" \
> > +	-c "pwrite -S 0x70 $((7 * blksz)) $blksz" \
> > +	-c "fcollapse $((9 * blksz)) $blksz" \
> > +	-c "finsert $((10 * blksz)) $blksz" $SCRATCH_MNT/f1 >> $seqres.full
> > +
> > +echo "Check file"
> > +md5sum $SCRATCH_MNT/f1 | _filter_scratch
> 
> I'm a bit confused by the md5sum, f1 is not checked again for
> comparison, what's the purpose of this checksum?

This test checks that xfs_io can send properly formatted GETFSMAP ioctls to the
kernel to query the filesystem mappings.  Hence we spit out the md5 to make
sure that the file contents match what we just wrote to the file, so that we
actually /have/ some mappings to report.

--D

> 
> Thanks,
> Eryu
> 
> > +od -tx1 -Ad -c $SCRATCH_MNT/f1 >> $seqres.full
> > +
> > +echo "Unmount"
> > +_scratch_unmount
> > +
> > +echo "Try a regular fsmap"
> > +$XFS_DB_PROG -c 'fsmap' `_scratch_xfs_db_options` >> $seqres.full
> > +$XFS_DB_PROG -c 'fsmap 0 5' `_scratch_xfs_db_options` >> $seqres.full
> > +
> > +echo "Try a bad fsmap"
> > +$XFS_DB_PROG -c 'fsmap 5 4' `_scratch_xfs_db_options`
> > +
> > +# success, all done
> > +status=0
> > +exit
> > diff --git a/tests/xfs/877.out b/tests/xfs/877.out
> > new file mode 100644
> > index 0000000..4a2242f
> > --- /dev/null
> > +++ b/tests/xfs/877.out
> > @@ -0,0 +1,10 @@
> > +QA output created by 877
> > +Format and mount
> > +Create some files
> > +Manipulate file
> > +Check file
> > +e45c5707fcf6817e914ffb6ce37a0ac7  SCRATCH_MNT/f1
> > +Unmount
> > +Try a regular fsmap
> > +Try a bad fsmap
> > +Error 22 while querying fsmap btree.
> > diff --git a/tests/xfs/group b/tests/xfs/group
> > index 8565204..72580e9 100644
> > --- a/tests/xfs/group
> > +++ b/tests/xfs/group
> > @@ -311,3 +311,5 @@
> >  873 auto quick clone fsr
> >  874 auto quick clone fsr
> >  875 auto quick clone fsr quota
> > +876 auto quick rmap clone
> > +877 auto quick rmap clone
> > 

^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: [PATCH 08/13] xfs: more rmapbt tests
@ 2016-09-04 17:40       ` Darrick J. Wong
  0 siblings, 0 replies; 39+ messages in thread
From: Darrick J. Wong @ 2016-09-04 17:40 UTC (permalink / raw)
  To: Eryu Guan; +Cc: linux-xfs, fstests, xfs

On Thu, Sep 01, 2016 at 04:33:32PM +0800, Eryu Guan wrote:
> On Thu, Aug 25, 2016 at 04:29:11PM -0700, Darrick J. Wong wrote:
> > More tests for the reverse mapping functionality.
> > 
> > Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> > ---
> >  tests/xfs/876     |   75 +++++++++++++++++++++++++++++++++++++++++++
> >  tests/xfs/876.out |    4 ++
> >  tests/xfs/877     |   92 +++++++++++++++++++++++++++++++++++++++++++++++++++++
> >  tests/xfs/877.out |   10 ++++++
> >  tests/xfs/group   |    2 +
> >  5 files changed, 183 insertions(+)
> >  create mode 100755 tests/xfs/876
> >  create mode 100644 tests/xfs/876.out
> >  create mode 100755 tests/xfs/877
> >  create mode 100644 tests/xfs/877.out
> > 
> > 
> > diff --git a/tests/xfs/876 b/tests/xfs/876
> > new file mode 100755
> > index 0000000..7f447c9
> > --- /dev/null
> > +++ b/tests/xfs/876
> > @@ -0,0 +1,75 @@
> > +#! /bin/bash
> > +# FS QA Test No. 876
> > +#
> > +# Create a big enough rmapbt that we tickle a fdblocks accounting bug.
> > +#
> > +#-----------------------------------------------------------------------
> > +# Copyright (c) 2016, Oracle and/or its affiliates.  All Rights Reserved.
> > +#
> > +# This program is free software; you can redistribute it and/or
> > +# modify it under the terms of the GNU General Public License as
> > +# published by the Free Software Foundation.
> > +#
> > +# This program is distributed in the hope that it would be useful,
> > +# but WITHOUT ANY WARRANTY; without even the implied warranty of
> > +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> > +# GNU General Public License for more details.
> > +#
> > +# You should have received a copy of the GNU General Public License
> > +# along with this program; if not, write the Free Software Foundation,
> > +# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
> > +#-----------------------------------------------------------------------
> > +
> > +seq=`basename "$0"`
> > +seqres="$RESULT_DIR/$seq"
> > +echo "QA output created by $seq"
> > +
> > +here=`pwd`
> > +tmp=/tmp/$$
> > +status=1    # failure is the default!
> > +trap "_cleanup; exit \$status" 0 1 2 3 15
> > +
> > +_cleanup()
> > +{
> > +	cd /
> > +	rm -rf "$tmp".*
> > +}
> > +
> > +# get standard environment, filters and checks
> > +. ./common/rc
> > +. ./common/filter
> > +. ./common/reflink
> > +
> > +# real QA test starts here
> > +_supported_os Linux
> > +_supported_fs xfs
> > +_require_scratch
> > +_require_xfs_scratch_rmapbt
> > +_require_scratch_reflink
> > +_require_test_program "punch-alternating"
> > +
> > +rm -f "$seqres.full"
> > +
> > +echo "+ create scratch fs"
> > +_scratch_mkfs > "$seqres.full" 2>&1
> > +
> > +echo "+ mount fs image"
> > +_scratch_mount
> > +blksz="$(stat -f $SCRATCH_MNT -c '%S')"
> 
> There's "get_block_size" helper to do this.

D'oh.  Ok, noted.

> > +
> > +bt_ptrs=$(( (blksz - 56) / 44 ))
> > +bt_recs=$(( (blksz - 56) / 24 ))
> 
> It's unclear to me where do these magic numbers come from. Add some
> comments?

56 bytes is the size of the rmap btree block header.  44 bytes is the size of
rmapbt key+pointer size, and rmapbt records are 24 bytes each.

> > +
> > +blocks=$((bt_ptrs * bt_recs + 1))
> > +_require_fs_space $SCRATCH_MNT $(( (2 * blocks * blksz) * 5 / 4096 ))
> 
> _require_fs_space requires the last argument is represented in 1k block
> size, so it should be " / 1024" here?

4096 is fine, because we're baking a (4 * 1024) into it:

I need a big enough FS to store two (blocks * blksz) files, and then
an extra 25% (5 / 4) space to cover (hopefully) the log and metadata.
So the size calculation is really:

fs_sz_in_kb = 2 * (blocks * blksz) * (5/4) / 1024

> > +len=$((blocks * blksz))
> > +
> > +echo "+ make some files"
> > +$XFS_IO_PROG -f -c "falloc 0 $len" -c "pwrite -S 0x68 -b 1048576 0 $len" $SCRATCH_MNT/f1 >> $seqres.full
> > +$XFS_IO_PROG -f -c "falloc 0 $len" -c "pwrite -S 0x68 -b 1048576 0 $len" $SCRATCH_MNT/f2 >> $seqres.full
> > +./src/punch-alternating $SCRATCH_MNT/f1 >> "$seqres.full"
> > +./src/punch-alternating $SCRATCH_MNT/f2 >> "$seqres.full"
> > +
> > +# success, all done
> > +status=0
> > +exit
> > diff --git a/tests/xfs/876.out b/tests/xfs/876.out
> > new file mode 100644
> > index 0000000..96c1970
> > --- /dev/null
> > +++ b/tests/xfs/876.out
> > @@ -0,0 +1,4 @@
> > +QA output created by 876
> > ++ create scratch fs
> > ++ mount fs image
> > ++ make some files
> > diff --git a/tests/xfs/877 b/tests/xfs/877
> > new file mode 100755
> > index 0000000..2ad7d30
> > --- /dev/null
> > +++ b/tests/xfs/877
> > @@ -0,0 +1,92 @@
> > +#! /bin/bash
> > +# FS QA Test No. 877
> > +#
> > +# Make sure query_range returns -EINVAL if lowkey > highkey.
> > +#
> > +#-----------------------------------------------------------------------
> > +# Copyright (c) 2016, Oracle and/or its affiliates.  All Rights Reserved.
> > +#
> > +# This program is free software; you can redistribute it and/or
> > +# modify it under the terms of the GNU General Public License as
> > +# published by the Free Software Foundation.
> > +#
> > +# This program is distributed in the hope that it would be useful,
> > +# but WITHOUT ANY WARRANTY; without even the implied warranty of
> > +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> > +# GNU General Public License for more details.
> > +#
> > +# You should have received a copy of the GNU General Public License
> > +# along with this program; if not, write the Free Software Foundation,
> > +# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
> > +#-----------------------------------------------------------------------
> > +
> > +seq=`basename "$0"`
> > +seqres="$RESULT_DIR/$seq"
> > +echo "QA output created by $seq"
> > +
> > +here=`pwd`
> > +tmp=/tmp/$$
> > +status=1    # failure is the default!
> > +trap "_cleanup; exit \$status" 0 1 2 3 15
> > +
> > +_cleanup()
> > +{
> > +	cd /
> > +	rm -rf "$tmp".* $metadump_file
> > +}
> > +
> > +# get standard environment, filters and checks
> > +. ./common/rc
> > +. ./common/filter
> > +. ./common/attr
> 
> Seems this is not needed.

Right.

> > +
> > +# real QA test starts here
> > +_supported_os Linux
> > +_supported_fs xfs
> > +_require_xfs_scratch_rmapbt
> > +_require_command "$XFS_DB_PROG" "xfs_db"
> > +_require_xfs_io_command "falloc"
> > +_require_xfs_io_command "fpunch"
> > +_require_xfs_io_command "fzero"
> > +_require_xfs_io_command "fcollapse"
> > +_require_xfs_io_command "finsert"
> > +
> > +rm -f "$seqres.full"
> > +
> > +echo "Format and mount"
> > +_scratch_mkfs > "$seqres.full" 2>&1
> > +_scratch_mount
> > +blksz=65536
> > +blocks=16
> > +len=$((blocks * blksz))
> > +
> > +echo "Create some files"
> > +$XFS_IO_PROG -f -c "falloc 0 $len" -c "pwrite -S 0x68 -b 1048576 0 $len" $SCRATCH_MNT/f1 >> $seqres.full
> > +
> > +echo "Manipulate file"
> > +$XFS_IO_PROG -c "fpunch $blksz $blksz" \
> > +	-c "fzero $((3 * blksz)) $blksz" \
> > +	-c "pwrite -S 0x69 $((5 * blksz)) $blksz" \
> > +	-c "fpunch $((7 * blksz)) $blksz" \
> > +	-c "fsync" \
> > +	-c "pwrite -S 0x70 $((7 * blksz)) $blksz" \
> > +	-c "fcollapse $((9 * blksz)) $blksz" \
> > +	-c "finsert $((10 * blksz)) $blksz" $SCRATCH_MNT/f1 >> $seqres.full
> > +
> > +echo "Check file"
> > +md5sum $SCRATCH_MNT/f1 | _filter_scratch
> 
> I'm a bit confused by the md5sum, f1 is not checked again for
> comparison, what's the purpose of this checksum?

This test checks that xfs_io can send properly formatted GETFSMAP ioctls to the
kernel to query the filesystem mappings.  Hence we spit out the md5 to make
sure that the file contents match what we just wrote to the file, so that we
actually /have/ some mappings to report.

--D

> 
> Thanks,
> Eryu
> 
> > +od -tx1 -Ad -c $SCRATCH_MNT/f1 >> $seqres.full
> > +
> > +echo "Unmount"
> > +_scratch_unmount
> > +
> > +echo "Try a regular fsmap"
> > +$XFS_DB_PROG -c 'fsmap' `_scratch_xfs_db_options` >> $seqres.full
> > +$XFS_DB_PROG -c 'fsmap 0 5' `_scratch_xfs_db_options` >> $seqres.full
> > +
> > +echo "Try a bad fsmap"
> > +$XFS_DB_PROG -c 'fsmap 5 4' `_scratch_xfs_db_options`
> > +
> > +# success, all done
> > +status=0
> > +exit
> > diff --git a/tests/xfs/877.out b/tests/xfs/877.out
> > new file mode 100644
> > index 0000000..4a2242f
> > --- /dev/null
> > +++ b/tests/xfs/877.out
> > @@ -0,0 +1,10 @@
> > +QA output created by 877
> > +Format and mount
> > +Create some files
> > +Manipulate file
> > +Check file
> > +e45c5707fcf6817e914ffb6ce37a0ac7  SCRATCH_MNT/f1
> > +Unmount
> > +Try a regular fsmap
> > +Try a bad fsmap
> > +Error 22 while querying fsmap btree.
> > diff --git a/tests/xfs/group b/tests/xfs/group
> > index 8565204..72580e9 100644
> > --- a/tests/xfs/group
> > +++ b/tests/xfs/group
> > @@ -311,3 +311,5 @@
> >  873 auto quick clone fsr
> >  874 auto quick clone fsr
> >  875 auto quick clone fsr quota
> > +876 auto quick rmap clone
> > +877 auto quick rmap clone
> > 

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: [PATCH 09/13] xfs: test realtime rmapbt code
  2016-08-25 23:29   ` Darrick J. Wong
  (?)
@ 2016-09-08 10:19   ` Eryu Guan
  2016-09-08 15:39     ` Darrick J. Wong
  -1 siblings, 1 reply; 39+ messages in thread
From: Eryu Guan @ 2016-09-08 10:19 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: david, linux-xfs, fstests, xfs

On Thu, Aug 25, 2016 at 04:29:17PM -0700, Darrick J. Wong wrote:
> Test the realtime rmap btree code by exercising various IO patterns
> on realtime files.
> 
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> ---
>  tests/xfs/878     |   91 +++++++++++++++++++++++++++++++++++++++++++
>  tests/xfs/878.out |    9 ++++
>  tests/xfs/879     |   67 ++++++++++++++++++++++++++++++++
>  tests/xfs/879.out |    7 +++
>  tests/xfs/880     |   86 +++++++++++++++++++++++++++++++++++++++++
>  tests/xfs/880.out |    7 +++
>  tests/xfs/881     |   95 +++++++++++++++++++++++++++++++++++++++++++++
>  tests/xfs/881.out |    8 ++++
>  tests/xfs/882     |  111 +++++++++++++++++++++++++++++++++++++++++++++++++++++
>  tests/xfs/882.out |   11 +++++
>  tests/xfs/883     |   90 +++++++++++++++++++++++++++++++++++++++++++
>  tests/xfs/883.out |   10 +++++
>  tests/xfs/884     |   91 +++++++++++++++++++++++++++++++++++++++++++
>  tests/xfs/884.out |    9 ++++
>  tests/xfs/885     |   95 +++++++++++++++++++++++++++++++++++++++++++++
>  tests/xfs/885.out |   10 +++++
>  tests/xfs/886     |  104 ++++++++++++++++++++++++++++++++++++++++++++++++++
>  tests/xfs/886.out |    7 +++
>  tests/xfs/887     |  108 ++++++++++++++++++++++++++++++++++++++++++++++++++++
>  tests/xfs/887.out |    7 +++
>  tests/xfs/888     |   81 +++++++++++++++++++++++++++++++++++++++
>  tests/xfs/888.out |    6 +++
>  tests/xfs/group   |   11 +++++
>  23 files changed, 1121 insertions(+)
>  create mode 100755 tests/xfs/878
>  create mode 100644 tests/xfs/878.out
>  create mode 100755 tests/xfs/879
>  create mode 100644 tests/xfs/879.out
>  create mode 100755 tests/xfs/880
>  create mode 100644 tests/xfs/880.out
>  create mode 100755 tests/xfs/881
>  create mode 100644 tests/xfs/881.out
>  create mode 100755 tests/xfs/882
>  create mode 100644 tests/xfs/882.out
>  create mode 100755 tests/xfs/883
>  create mode 100644 tests/xfs/883.out
>  create mode 100755 tests/xfs/884
>  create mode 100644 tests/xfs/884.out
>  create mode 100755 tests/xfs/885
>  create mode 100644 tests/xfs/885.out
>  create mode 100755 tests/xfs/886
>  create mode 100644 tests/xfs/886.out
>  create mode 100755 tests/xfs/887
>  create mode 100644 tests/xfs/887.out
>  create mode 100755 tests/xfs/888
>  create mode 100644 tests/xfs/888.out
> 
> 
> diff --git a/tests/xfs/878 b/tests/xfs/878
> new file mode 100755
> index 0000000..557e4ae
> --- /dev/null
> +++ b/tests/xfs/878
> @@ -0,0 +1,91 @@
> +#! /bin/bash
> +# FS QA Test No. 878
> +#
> +# Set rrmapino to another inode on an non-rt rmap fs and see if repair fixes it.
> +#
> +#-----------------------------------------------------------------------
> +# Copyright (c) 2016, Oracle and/or its affiliates.  All Rights Reserved.
> +#
> +# This program is free software; you can redistribute it and/or
> +# modify it under the terms of the GNU General Public License as
> +# published by the Free Software Foundation.
> +#
> +# This program is distributed in the hope that it would be useful,
> +# but WITHOUT ANY WARRANTY; without even the implied warranty of
> +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> +# GNU General Public License for more details.
> +#
> +# You should have received a copy of the GNU General Public License
> +# along with this program; if not, write the Free Software Foundation,
> +# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
> +#-----------------------------------------------------------------------
> +
> +seq=`basename "$0"`
> +seqres="$RESULT_DIR/$seq"
> +echo "QA output created by $seq"
> +
> +here=`pwd`
> +tmp=/tmp/$$
> +status=1    # failure is the default!
> +trap "_cleanup; exit \$status" 0 1 2 3 15
> +
> +_cleanup()
> +{
> +	cd /
> +	rm -rf "$tmp".* $metadump_file

$metadump_file is not used in this test.

> +}
> +
> +# get standard environment, filters and checks
> +. ./common/rc
> +. ./common/filter
> +
> +# real QA test starts here
> +_supported_os Linux
> +_supported_fs xfs
> +_require_xfs_scratch_rmapbt
> +
> +rm -f "$seqres.full"
> +
> +unset SCRATCH_RTDEV
> +
> +echo "Format and mount"
> +_scratch_mkfs > "$seqres.full" 2>&1
> +_scratch_mount
> +
> +echo "Create some files"
> +$XFS_IO_PROG -f -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f1 >> $seqres.full
> +$XFS_IO_PROG -f -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f2 >> $seqres.full
> +echo garbage > $SCRATCH_MNT/f3
> +ino=$(stat -c '%i' $SCRATCH_MNT/f3)
> +_scratch_unmount
> +
> +echo "Corrupt fs"
> +$XFS_DB_PROG -x -c 'sb 0' \
> +	-c "write rrmapino $ino" `_scratch_xfs_db_options` >> $seqres.full
> +_scratch_mount
> +
> +echo "Check files"
> +md5sum $SCRATCH_MNT/f1 2>&1 | _filter_scratch
> +
> +echo "Try to create more files"
> +$XFS_IO_PROG -f -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f3 >> $seqres.full 2>&1
> +
> +echo "Repair fs"
> +_scratch_unmount 2>&1 | _filter_scratch
> +$XFS_LOGPRINT_PROG -t $extra_log_options $device 2>&1 \

Seems above line is copied & pasted from _check_xfs_filesystem(), but
there's no $extra_log_options defined in this test.

> +		| tee $tmp.logprint | grep -q "<CLEAN>"
> +if [ $? -ne 0 ]; then
> +	echo "Dirty log, zeroing..." >> $seqres.full
> +	_scratch_xfs_repair -L >> $seqres.full 2>&1
> +else
> +	_scratch_xfs_repair >> $seqres.full 2>&1
> +fi
> +_scratch_xfs_repair >> $seqres.full 2>&1
> +
> +echo "Try to create more files (again)"
> +_scratch_mount
> +$XFS_IO_PROG -f -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f4 >> $seqres.full
> +
> +# success, all done
> +status=0
> +exit
> diff --git a/tests/xfs/878.out b/tests/xfs/878.out
> new file mode 100644
> index 0000000..e134506
> --- /dev/null
> +++ b/tests/xfs/878.out
> @@ -0,0 +1,9 @@
> +QA output created by 878
> +Format and mount
> +Create some files
> +Corrupt fs
> +Check files
> +8f27047948255cb84872e2dd7c0bc56d  SCRATCH_MNT/f1
> +Try to create more files
> +Repair fs
> +Try to create more files (again)
> diff --git a/tests/xfs/879 b/tests/xfs/879
> new file mode 100755
> index 0000000..247b3af
> --- /dev/null
> +++ b/tests/xfs/879
> @@ -0,0 +1,67 @@
> +#! /bin/bash
> +# FS QA Test No. 879
> +#
> +# Ensure that we can create a few realtime files on a rmapbt filesystem.
> +#
> +#-----------------------------------------------------------------------
> +# Copyright (c) 2016, Oracle and/or its affiliates.  All Rights Reserved.
> +#
> +# This program is free software; you can redistribute it and/or
> +# modify it under the terms of the GNU General Public License as
> +# published by the Free Software Foundation.
> +#
> +# This program is distributed in the hope that it would be useful,
> +# but WITHOUT ANY WARRANTY; without even the implied warranty of
> +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> +# GNU General Public License for more details.
> +#
> +# You should have received a copy of the GNU General Public License
> +# along with this program; if not, write the Free Software Foundation,
> +# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
> +#-----------------------------------------------------------------------
> +
> +seq=`basename "$0"`
> +seqres="$RESULT_DIR/$seq"
> +echo "QA output created by $seq"
> +
> +here=`pwd`
> +tmp=/tmp/$$
> +status=1    # failure is the default!
> +trap "_cleanup; exit \$status" 0 1 2 3 15
> +
> +_cleanup()
> +{
> +	cd /
> +	rm -rf "$tmp".*
> +}
> +
> +# get standard environment, filters and checks
> +. ./common/rc
> +. ./common/filter
> +
> +# real QA test starts here
> +_supported_os Linux
> +_supported_fs xfs
> +_require_realtime
> +_require_xfs_scratch_rmapbt
> +
> +rm -f "$seqres.full"
> +
> +echo "Format and mount"
> +_scratch_mkfs > "$seqres.full" 2>&1
> +_scratch_mount
> +
> +echo "Create a few files"
> +$XFS_IO_PROG -f -R -c 'pwrite -S 0x67 0 50000' -c fsync $SCRATCH_MNT/f1 >> $seqres.full
> +$XFS_IO_PROG -f -R -c 'pwrite -S 0x67 0 50000' -c fsync $SCRATCH_MNT/f2 >> $seqres.full
> +_scratch_cycle_mount
> +
> +echo "Grab contents"
> +md5sum $SCRATCH_MNT/f1 $SCRATCH_MNT/f2 | _filter_scratch
> +
> +echo "Remove one file"
> +rm -rf $SCRATCH_MNT/f2
> +
> +# success, all done
> +status=0
> +exit
> diff --git a/tests/xfs/879.out b/tests/xfs/879.out
> new file mode 100644
> index 0000000..9dfe48b
> --- /dev/null
> +++ b/tests/xfs/879.out
> @@ -0,0 +1,7 @@
> +QA output created by 879
> +Format and mount
> +Create a few files
> +Grab contents
> +10abe2628d19eb1c2ebe18aad7b14820  SCRATCH_MNT/f1
> +10abe2628d19eb1c2ebe18aad7b14820  SCRATCH_MNT/f2
> +Remove one file
> diff --git a/tests/xfs/880 b/tests/xfs/880
> new file mode 100755
> index 0000000..8cd509f
> --- /dev/null
> +++ b/tests/xfs/880
> @@ -0,0 +1,86 @@
> +#! /bin/bash
> +# FS QA Test No. 880
> +#
> +# Exercise expanding and shrinking the realtime rmap btree.
> +#
> +#-----------------------------------------------------------------------
> +# Copyright (c) 2016, Oracle and/or its affiliates.  All Rights Reserved.
> +#
> +# This program is free software; you can redistribute it and/or
> +# modify it under the terms of the GNU General Public License as
> +# published by the Free Software Foundation.
> +#
> +# This program is distributed in the hope that it would be useful,
> +# but WITHOUT ANY WARRANTY; without even the implied warranty of
> +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> +# GNU General Public License for more details.
> +#
> +# You should have received a copy of the GNU General Public License
> +# along with this program; if not, write the Free Software Foundation,
> +# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
> +#-----------------------------------------------------------------------
> +
> +seq=`basename "$0"`
> +seqres="$RESULT_DIR/$seq"
> +echo "QA output created by $seq"
> +
> +here=`pwd`
> +tmp=/tmp/$$
> +status=1    # failure is the default!
> +trap "_cleanup; exit \$status" 0 1 2 3 15
> +
> +_cleanup()
> +{
> +	cd /
> +	rm -rf "$tmp".*
> +}
> +
> +# get standard environment, filters and checks
> +. ./common/rc
> +. ./common/filter
> +
> +# real QA test starts here
> +_supported_os Linux
> +_supported_fs xfs
> +_require_realtime
> +_require_xfs_scratch_rmapbt
> +_require_test_program "punch-alternating"
> +_require_xfs_io_command "falloc"
> +
> +rm -f "$seqres.full"
> +
> +echo "Format and mount"
> +_scratch_mkfs | _filter_mkfs 2>$tmp.mkfs >/dev/null
> +. $tmp.mkfs
> +cat $tmp.mkfs > "$seqres.full" 2>&1
> +_scratch_mount
> +blksz="$(stat -f $SCRATCH_MNT -c '%S')"

You can use get_block_size() helper, and I know I've mentioned it before :)

> +
> +echo "Create a three-level rtrmapbt"
> +i_ptrs=$(( (isize - 176) / 56 ))
> +bt_ptrs=$(( (blksz - 56) / 56 ))
> +bt_recs=$(( (blksz - 56) / 32 ))
> +
> +blocks=$((i_ptrs * bt_ptrs * bt_recs))
> +_require_fs_space $SCRATCH_MNT $(( (2 * blocks * blksz) * 5 / 4096 ))

Better to have some comments on the numbers and why require such a fs
space, as you did in your last reply.

> +len=$((blocks * rtextsz))
> +
> +echo "Create big file"
> +$XFS_IO_PROG -f -R -c "falloc 0 $len" -c "pwrite -S 0x68 -b 1048576 0 $len" $SCRATCH_MNT/f1 >> $seqres.full
> +$XFS_IO_PROG -f -R -c "falloc 0 $len" -c "pwrite -S 0x68 -b 1048576 0 $len" $SCRATCH_MNT/f2 >> $seqres.full
> +
> +echo "Explode the rtrmapbt"
> +./src/punch-alternating $SCRATCH_MNT/f1 >> "$seqres.full"
> +./src/punch-alternating $SCRATCH_MNT/f2 >> "$seqres.full"
> +_scratch_cycle_mount
> +
> +echo "Remove half the records"
> +rm -rf $SCRATCH_MNT/f1
> +_scratch_cycle_mount
> +
> +echo "Remove the rest of the records"
> +rm -rf $SCRATCH_MNT/f2
> +
> +# success, all done
> +status=0
> +exit
> diff --git a/tests/xfs/880.out b/tests/xfs/880.out
> new file mode 100644
> index 0000000..b87665b
> --- /dev/null
> +++ b/tests/xfs/880.out
> @@ -0,0 +1,7 @@
> +QA output created by 880
> +Format and mount
> +Create a three-level rtrmapbt
> +Create big file
> +Explode the rtrmapbt
> +Remove half the records
> +Remove the rest of the records
> diff --git a/tests/xfs/881 b/tests/xfs/881
> new file mode 100755
> index 0000000..750a92a
> --- /dev/null
> +++ b/tests/xfs/881
> @@ -0,0 +1,95 @@
> +#! /bin/bash
> +# FS QA Test No. 881
> +#
> +# Exercise metadump on realtime rmapbt preservation.
> +#
> +#-----------------------------------------------------------------------
> +# Copyright (c) 2016, Oracle and/or its affiliates.  All Rights Reserved.
> +#
> +# This program is free software; you can redistribute it and/or
> +# modify it under the terms of the GNU General Public License as
> +# published by the Free Software Foundation.
> +#
> +# This program is distributed in the hope that it would be useful,
> +# but WITHOUT ANY WARRANTY; without even the implied warranty of
> +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> +# GNU General Public License for more details.
> +#
> +# You should have received a copy of the GNU General Public License
> +# along with this program; if not, write the Free Software Foundation,
> +# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
> +#-----------------------------------------------------------------------
> +
> +seq=`basename "$0"`
> +seqres="$RESULT_DIR/$seq"
> +echo "QA output created by $seq"
> +
> +here=`pwd`
> +tmp=/tmp/$$
> +status=1    # failure is the default!
> +trap "_cleanup; exit \$status" 0 1 2 3 15
> +
> +_cleanup()
> +{
> +	cd /
> +	rm -rf "$tmp".* $metadump_file
> +}
> +
> +# get standard environment, filters and checks
> +. ./common/rc
> +. ./common/filter
> +
> +# real QA test starts here
> +_supported_os Linux
> +_supported_fs xfs
> +_require_realtime
> +_require_xfs_scratch_rmapbt
> +_require_test_program "punch-alternating"
> +_require_xfs_io_command "falloc"
> +
> +rm -f "$seqres.full"
> +
> +echo "Format and mount"
> +_scratch_mkfs | _filter_mkfs 2>$tmp.mkfs >/dev/null
> +. $tmp.mkfs
> +cat $tmp.mkfs > "$seqres.full" 2>&1
> +_scratch_mount
> +blksz="$(stat -f $SCRATCH_MNT -c '%S')"
> +
> +metadump_file=$TEST_DIR/${seq}_metadump
> +rm -rf $metadump_file
> +
> +echo "Create a three-level rtrmapbt"
> +i_ptrs=$(( (isize - 176) / 56 ))
> +bt_ptrs=$(( (blksz - 56) / 56 ))
> +bt_recs=$(( (blksz - 56) / 32 ))
> +
> +blocks=$((i_ptrs * bt_ptrs * bt_recs))
> +_require_fs_space $SCRATCH_MNT $(( (2 * blocks * blksz) * 5 / 4096 ))
> +len=$((blocks * rtextsz))
> +
> +echo "Create big file"
> +$XFS_IO_PROG -f -R -c "falloc 0 $len" -c "pwrite -S 0x68 -b 1048576 0 $len" $SCRATCH_MNT/f1 >> $seqres.full
> +$XFS_IO_PROG -f -R -c "falloc 0 $len" -c "pwrite -S 0x68 -b 1048576 0 $len" $SCRATCH_MNT/f2 >> $seqres.full
> +
> +echo "Explode the rtrmapbt"
> +./src/punch-alternating $SCRATCH_MNT/f1 >> "$seqres.full"
> +./src/punch-alternating $SCRATCH_MNT/f2 >> "$seqres.full"
> +_scratch_cycle_mount
> +
> +echo "Create metadump file"
> +_scratch_unmount
> +_scratch_metadump $metadump_file
> +
> +# Now restore the obfuscated one back and take a look around
> +echo "Restore metadump"
> +xfs_mdrestore $metadump_file $TEST_DIR/image
> +SCRATCH_DEV=$TEST_DIR/image _scratch_mount
> +SCRATCH_DEV=$TEST_DIR/image _scratch_unmount
> +
> +echo "Check restored fs"
> +_check_generic_filesystem $metadump_file

_check_generic_filesystem runs "fsck -t $FSTYP $dev" but "fsck -t xfs"
is a no-op, and $metadump_file is a metadump, not a fs image. Perhaps
what you want to do is "_check_scratch_fs $TEST_DIR/image"?

> +
> +# success, all done
> +status=0
> +exit
> diff --git a/tests/xfs/881.out b/tests/xfs/881.out
> new file mode 100644
> index 0000000..6ad156c
> --- /dev/null
> +++ b/tests/xfs/881.out
> @@ -0,0 +1,8 @@
> +QA output created by 881
> +Format and mount
> +Create a three-level rtrmapbt
> +Create big file
> +Explode the rtrmapbt
> +Create metadump file
> +Restore metadump
> +Check restored fs
> diff --git a/tests/xfs/882 b/tests/xfs/882
> new file mode 100755
> index 0000000..3c44540
> --- /dev/null
> +++ b/tests/xfs/882
> @@ -0,0 +1,111 @@
> +#! /bin/bash
> +# FS QA Test No. 882
> +#
> +# Corrupt the realtime rmapbt and see how the kernel and xfs_repair deal.
> +#
> +#-----------------------------------------------------------------------
> +# Copyright (c) 2016, Oracle and/or its affiliates.  All Rights Reserved.
> +#
> +# This program is free software; you can redistribute it and/or
> +# modify it under the terms of the GNU General Public License as
> +# published by the Free Software Foundation.
> +#
> +# This program is distributed in the hope that it would be useful,
> +# but WITHOUT ANY WARRANTY; without even the implied warranty of
> +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> +# GNU General Public License for more details.
> +#
> +# You should have received a copy of the GNU General Public License
> +# along with this program; if not, write the Free Software Foundation,
> +# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
> +#-----------------------------------------------------------------------
> +
> +seq=`basename "$0"`
> +seqres="$RESULT_DIR/$seq"
> +echo "QA output created by $seq"
> +
> +here=`pwd`
> +tmp=/tmp/$$
> +status=1    # failure is the default!
> +trap "_cleanup; exit \$status" 0 1 2 3 15
> +
> +_cleanup()
> +{
> +	cd /
> +	rm -rf "$tmp".*
> +}
> +
> +# get standard environment, filters and checks
> +. ./common/rc
> +. ./common/filter
> +
> +# real QA test starts here
> +_supported_os Linux
> +_supported_fs xfs
> +_require_realtime
> +_require_xfs_scratch_rmapbt
> +_require_test_program "punch-alternating"
> +_require_xfs_io_command "falloc"
> +
> +rm -f "$seqres.full"
> +
> +echo "+ create scratch fs"
> +_scratch_mkfs | _filter_mkfs 2>$tmp.mkfs >/dev/null
> +. $tmp.mkfs
> +cat $tmp.mkfs > "$seqres.full" 2>&1
> +
> +echo "+ mount fs image"
> +_scratch_mount
> +blksz="$(stat -f $SCRATCH_MNT -c '%S')"
> +
> +i_ptrs=$(( (isize - 176) / 56 ))
> +bt_ptrs=$(( (blksz - 56) / 56 ))
> +bt_recs=$(( (blksz - 56) / 32 ))
> +
> +blocks=$((i_ptrs * bt_ptrs * bt_recs + 1))
> +_require_fs_space $SCRATCH_MNT $(( (2 * blocks * blksz) * 5 / 4096 ))
> +len=$((blocks * blksz))
> +
> +echo "+ make some files"
> +$XFS_IO_PROG -f -R -c "falloc 0 $len" -c "pwrite -S 0x68 -b 1048576 0 $len" $SCRATCH_MNT/f1 >> $seqres.full
> +$XFS_IO_PROG -f -R -c "falloc 0 $len" -c "pwrite -S 0x68 -b 1048576 0 $len" $SCRATCH_MNT/f2 >> $seqres.full
> +./src/punch-alternating $SCRATCH_MNT/f1 >> "$seqres.full"
> +./src/punch-alternating $SCRATCH_MNT/f2 >> "$seqres.full"
> +_scratch_unmount
> +
> +echo "+ check fs"
> +_scratch_xfs_repair -n >> $seqres.full 2>&1 || echo "xfs_repair should not fail"
> +
> +echo "+ corrupt image"
> +$XFS_DB_PROG -x -c "sb" -c "addr rrmapino" -c "addr u3.rtrmapbt.ptrs[1]" \
> +	-c "stack" -c "blocktrash -x 4096 -y 4096 -n 8 -3 -z" \
> +	`_scratch_xfs_db_options` >> $seqres.full 2>&1
> +
> +echo "+ mount image"
> +_scratch_mount
> +
> +echo "+ copy more"
> +$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 1" $SCRATCH_MNT/e3 >> $seqres.full 2>&1
> +test -s ${SCRATCH_MNT}/f3 && echo "should not be able to copy with busted rtrmap btree"
> +_scratch_unmount
> +
> +echo "+ repair fs"
> +$XFS_LOGPRINT_PROG -t $extra_log_options $device 2>&1 \

No $extra_log_options defined.

> +		| tee $tmp.logprint | grep -q "<CLEAN>"
> +if [ $? -ne 0 ]; then
> +	echo "Dirty log, zeroing..." >> $seqres.full
> +	_scratch_xfs_repair -L >> $seqres.full 2>&1
> +else
> +	_scratch_xfs_repair >> $seqres.full 2>&1
> +fi
> +_scratch_xfs_repair >> $seqres.full 2>&1
> +
> +echo "+ mount image (2)"
> +_scratch_mount
> +
> +echo "+ copy more (2)"
> +$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 1" $SCRATCH_MNT/e4 >> $seqres.full
> +
> +# success, all done
> +status=0
> +exit
> diff --git a/tests/xfs/882.out b/tests/xfs/882.out
> new file mode 100644
> index 0000000..5ebe620
> --- /dev/null
> +++ b/tests/xfs/882.out
> @@ -0,0 +1,11 @@
> +QA output created by 882
> ++ create scratch fs
> ++ mount fs image
> ++ make some files
> ++ check fs
> ++ corrupt image
> ++ mount image
> ++ copy more
> ++ repair fs
> ++ mount image (2)
> ++ copy more (2)
> diff --git a/tests/xfs/883 b/tests/xfs/883
> new file mode 100755
> index 0000000..86dd047
> --- /dev/null
> +++ b/tests/xfs/883
> @@ -0,0 +1,90 @@
> +#! /bin/bash
> +# FS QA Test No. 883
> +#
> +# Set rrmapino to zero on an rtrmap fs and see if repair fixes it.
> +#
> +#-----------------------------------------------------------------------
> +# Copyright (c) 2016, Oracle and/or its affiliates.  All Rights Reserved.
> +#
> +# This program is free software; you can redistribute it and/or
> +# modify it under the terms of the GNU General Public License as
> +# published by the Free Software Foundation.
> +#
> +# This program is distributed in the hope that it would be useful,
> +# but WITHOUT ANY WARRANTY; without even the implied warranty of
> +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> +# GNU General Public License for more details.
> +#
> +# You should have received a copy of the GNU General Public License
> +# along with this program; if not, write the Free Software Foundation,
> +# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
> +#-----------------------------------------------------------------------
> +
> +seq=`basename "$0"`
> +seqres="$RESULT_DIR/$seq"
> +echo "QA output created by $seq"
> +
> +here=`pwd`
> +tmp=/tmp/$$
> +status=1    # failure is the default!
> +trap "_cleanup; exit \$status" 0 1 2 3 15
> +
> +_cleanup()
> +{
> +	cd /
> +	rm -rf "$tmp".* $metadump_file

$metadump_file is not used.

> +}
> +
> +# get standard environment, filters and checks
> +. ./common/rc
> +. ./common/filter
> +
> +# real QA test starts here
> +_supported_os Linux
> +_supported_fs xfs
> +_require_realtime
> +_require_xfs_scratch_rmapbt
> +
> +rm -f "$seqres.full"
> +
> +echo "Format and mount"
> +_scratch_mkfs > "$seqres.full" 2>&1
> +_scratch_mount
> +
> +echo "Create some files"
> +$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f1 >> $seqres.full
> +$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f2 >> $seqres.full
> +_scratch_unmount
> +
> +echo "Corrupt fs"
> +$XFS_DB_PROG -x -c 'sb 0' -c 'addr rrmapino' \
> +	-c 'write core.nlinkv2 0' -c 'write core.mode 0' -c 'sb 0' \
> +	-c 'write rrmapino 0' `_scratch_xfs_db_options` >> $seqres.full
> +_scratch_mount >> $seqres.full 2>&1 && echo "mount should have failed"
> +
> +echo "Check files"
> +md5sum $SCRATCH_MNT/f1 2>&1 | _filter_scratch

$SCRATCH_MNT should not be mounted at this point, so there's no point
checksuming $SCRATCH_MNT/f1 here.

> +
> +echo "Try to create more files"
> +$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f3 >> $seqres.full 2>&1

And no point creating new file under $SCRATCH_MNT

> +test -e $SCRATCH_MNT/f3 && echo "should not have been able to write f3"
> +
> +echo "Repair fs"
> +_scratch_unmount 2>&1 | _filter_scratch
> +$XFS_LOGPRINT_PROG -t $extra_log_options $device 2>&1 \
> +		| tee $tmp.logprint | grep -q "<CLEAN>"
> +if [ $? -ne 0 ]; then
> +	echo "Dirty log, zeroing..." >> $seqres.full
> +	_scratch_xfs_repair -L >> $seqres.full 2>&1
> +else
> +	_scratch_xfs_repair >> $seqres.full 2>&1
> +fi
> +_scratch_xfs_repair >> $seqres.full 2>&1
> +
> +echo "Try to create more files (again)"
> +_scratch_mount
> +$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f4 >> $seqres.full
> +
> +# success, all done
> +status=0
> +exit
> diff --git a/tests/xfs/883.out b/tests/xfs/883.out
> new file mode 100644
> index 0000000..6e75ac1
> --- /dev/null
> +++ b/tests/xfs/883.out
> @@ -0,0 +1,10 @@
> +QA output created by 883
> +Format and mount
> +Create some files
> +Corrupt fs
> +Check files
> +md5sum: SCRATCH_MNT/f1: No such file or directory

Yes, f1 is not accessible. Seems the .out file should be updated too.

> +Try to create more files
> +Repair fs
> +umount: SCRATCH_DEV: not mounted
> +Try to create more files (again)
> diff --git a/tests/xfs/884 b/tests/xfs/884
> new file mode 100755
> index 0000000..51071e0
> --- /dev/null
> +++ b/tests/xfs/884
> @@ -0,0 +1,91 @@
> +#! /bin/bash
> +# FS QA Test No. 884
> +#
> +# Link rrmapino into the rootdir on an rtrmap fs and see if repair fixes it.
> +#
> +#-----------------------------------------------------------------------
> +# Copyright (c) 2016, Oracle and/or its affiliates.  All Rights Reserved.
> +#
> +# This program is free software; you can redistribute it and/or
> +# modify it under the terms of the GNU General Public License as
> +# published by the Free Software Foundation.
> +#
> +# This program is distributed in the hope that it would be useful,
> +# but WITHOUT ANY WARRANTY; without even the implied warranty of
> +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> +# GNU General Public License for more details.
> +#
> +# You should have received a copy of the GNU General Public License
> +# along with this program; if not, write the Free Software Foundation,
> +# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
> +#-----------------------------------------------------------------------
> +
> +seq=`basename "$0"`
> +seqres="$RESULT_DIR/$seq"
> +echo "QA output created by $seq"
> +
> +here=`pwd`
> +tmp=/tmp/$$
> +status=1    # failure is the default!
> +trap "_cleanup; exit \$status" 0 1 2 3 15
> +
> +_cleanup()
> +{
> +	cd /
> +	rm -rf "$tmp".* $metadump_file

metadump_file not used.

> +}
> +
> +# get standard environment, filters and checks
> +. ./common/rc
> +. ./common/filter
> +
> +# real QA test starts here
> +_supported_os Linux
> +_supported_fs xfs
> +_require_realtime
> +_require_xfs_scratch_rmapbt
> +
> +rm -f "$seqres.full"
> +
> +echo "Format and mount"
> +_scratch_mkfs > "$seqres.full" 2>&1
> +_scratch_mount
> +
> +echo "Create some files"
> +$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f1 >> $seqres.full
> +$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f2 >> $seqres.full
> +echo garbage > $SCRATCH_MNT/f3
> +ln $SCRATCH_MNT/f3 $SCRATCH_MNT/f4
> +_scratch_unmount
> +
> +echo "Corrupt fs"
> +rrmapino=$($XFS_DB_PROG -c 'sb 0' -c 'p rrmapino' `_scratch_xfs_db_options` | awk '{print $3}')
> +$XFS_DB_PROG -x -c 'sb 0' -c 'addr rootino' \
> +	-c "write u3.sfdir3.list[3].inumber.i4 $rrmapino" `_scratch_xfs_db_options` >> $seqres.full
> +_scratch_mount
> +
> +echo "Check files"
> +md5sum $SCRATCH_MNT/f1 2>&1 | _filter_scratch
> +
> +echo "Try to create more files"
> +$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f5 >> $seqres.full 2>&1
> +
> +echo "Repair fs"
> +_scratch_unmount 2>&1 | _filter_scratch
> +$XFS_LOGPRINT_PROG -t $extra_log_options $device 2>&1 \

No extra_log_options defined.

> +		| tee $tmp.logprint | grep -q "<CLEAN>"
> +if [ $? -ne 0 ]; then
> +	echo "Dirty log, zeroing..." >> $seqres.full
> +	_scratch_xfs_repair -L >> $seqres.full 2>&1
> +else
> +	_scratch_xfs_repair >> $seqres.full 2>&1
> +fi
> +_scratch_xfs_repair >> $seqres.full 2>&1
> +
> +echo "Try to create more files (again)"
> +_scratch_mount
> +$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f4 >> $seqres.full
> +
> +# success, all done
> +status=0
> +exit
> diff --git a/tests/xfs/884.out b/tests/xfs/884.out
> new file mode 100644
> index 0000000..17a73ef
> --- /dev/null
> +++ b/tests/xfs/884.out
> @@ -0,0 +1,9 @@
> +QA output created by 884
> +Format and mount
> +Create some files
> +Corrupt fs
> +Check files
> +8f27047948255cb84872e2dd7c0bc56d  SCRATCH_MNT/f1
> +Try to create more files
> +Repair fs
> +Try to create more files (again)
> diff --git a/tests/xfs/885 b/tests/xfs/885
> new file mode 100755
> index 0000000..1839c11
> --- /dev/null
> +++ b/tests/xfs/885
> @@ -0,0 +1,95 @@
> +#! /bin/bash
> +# FS QA Test No. 885
> +#
> +# Set rrmapino to another inode on an rtrmap fs and see if repair fixes it.
> +#
> +#-----------------------------------------------------------------------
> +# Copyright (c) 2016, Oracle and/or its affiliates.  All Rights Reserved.
> +#
> +# This program is free software; you can redistribute it and/or
> +# modify it under the terms of the GNU General Public License as
> +# published by the Free Software Foundation.
> +#
> +# This program is distributed in the hope that it would be useful,
> +# but WITHOUT ANY WARRANTY; without even the implied warranty of
> +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> +# GNU General Public License for more details.
> +#
> +# You should have received a copy of the GNU General Public License
> +# along with this program; if not, write the Free Software Foundation,
> +# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
> +#-----------------------------------------------------------------------
> +
> +seq=`basename "$0"`
> +seqres="$RESULT_DIR/$seq"
> +echo "QA output created by $seq"
> +
> +here=`pwd`
> +tmp=/tmp/$$
> +status=1    # failure is the default!
> +trap "_cleanup; exit \$status" 0 1 2 3 15
> +
> +_cleanup()
> +{
> +	cd /
> +	rm -rf "$tmp".* $metadump_file

metadump_file not used.

> +}
> +
> +# get standard environment, filters and checks
> +. ./common/rc
> +. ./common/filter
> +
> +# real QA test starts here
> +_supported_os Linux
> +_supported_fs xfs
> +_require_realtime
> +_require_xfs_scratch_rmapbt
> +
> +rm -f "$seqres.full"
> +
> +echo "Format and mount"
> +_scratch_mkfs > "$seqres.full" 2>&1
> +_scratch_mount
> +
> +echo "Create some files"
> +$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f1 >> $seqres.full
> +$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f2 >> $seqres.full
> +echo garbage > $SCRATCH_MNT/f3
> +ino=$(stat -c '%i' $SCRATCH_MNT/f3)
> +_scratch_unmount
> +
> +echo "Corrupt fs"
> +rrmapino=$($XFS_DB_PROG -c 'sb 0' -c 'p rrmapino' `_scratch_xfs_db_options` | awk '{print $3}')
> +$XFS_DB_PROG -x -c "inode $rrmapino" \
> +	-c 'write core.format 2' -c 'write core.size 0' \
> +	-c 'write core.nblocks 0' -c 'sb 0' -c 'addr rootino' \
> +	-c "write u3.sfdir3.list[2].inumber.i4 $rrmapino" \
> +	-c 'sb 0' -c "write rrmapino $ino" `_scratch_xfs_db_options` >> $seqres.full
> +_scratch_mount >> $seqres.full 2>&1 && echo "mount should have failed"
> +
> +echo "Check files"
> +md5sum $SCRATCH_MNT/f1 2>&1 | _filter_scratch

Previous mount should have failed, so f1 is not accessible now.

> +
> +echo "Try to create more files"
> +$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f3 >> $seqres.full 2>&1
> +test -e $SCRATCH_MNT/f3 && echo "should not have been able to write f3"
> +
> +echo "Repair fs"
> +_scratch_unmount 2>&1 | _filter_scratch
> +$XFS_LOGPRINT_PROG -t $extra_log_options $device 2>&1 \

No extra_log_options defined.

> +		| tee $tmp.logprint | grep -q "<CLEAN>"
> +if [ $? -ne 0 ]; then
> +	echo "Dirty log, zeroing..." >> $seqres.full
> +	_scratch_xfs_repair -L >> $seqres.full 2>&1
> +else
> +	_scratch_xfs_repair >> $seqres.full 2>&1
> +fi
> +_scratch_xfs_repair >> $seqres.full 2>&1
> +
> +echo "Try to create more files (again)"
> +_scratch_mount
> +$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f4 >> $seqres.full
> +
> +# success, all done
> +status=0
> +exit
> diff --git a/tests/xfs/885.out b/tests/xfs/885.out
> new file mode 100644
> index 0000000..df04f79
> --- /dev/null
> +++ b/tests/xfs/885.out
> @@ -0,0 +1,10 @@
> +QA output created by 885
> +Format and mount
> +Create some files
> +Corrupt fs
> +Check files
> +md5sum: SCRATCH_MNT/f1: No such file or directory
> +Try to create more files
> +Repair fs
> +umount: SCRATCH_DEV: not mounted
> +Try to create more files (again)
> diff --git a/tests/xfs/886 b/tests/xfs/886
> new file mode 100755
> index 0000000..81e7e64
> --- /dev/null
> +++ b/tests/xfs/886
> @@ -0,0 +1,104 @@
> +#! /bin/bash
> +# FS QA Test No. 886
> +#
> +# Cross-link rrmapino to another inode on an rtrmap fs and see if repair fixes it.
> +#
> +#-----------------------------------------------------------------------
> +# Copyright (c) 2016, Oracle and/or its affiliates.  All Rights Reserved.
> +#
> +# This program is free software; you can redistribute it and/or
> +# modify it under the terms of the GNU General Public License as
> +# published by the Free Software Foundation.
> +#
> +# This program is distributed in the hope that it would be useful,
> +# but WITHOUT ANY WARRANTY; without even the implied warranty of
> +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> +# GNU General Public License for more details.
> +#
> +# You should have received a copy of the GNU General Public License
> +# along with this program; if not, write the Free Software Foundation,
> +# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
> +#-----------------------------------------------------------------------
> +
> +seq=`basename "$0"`
> +seqres="$RESULT_DIR/$seq"
> +echo "QA output created by $seq"
> +
> +here=`pwd`
> +tmp=/tmp/$$
> +status=1    # failure is the default!
> +trap "_cleanup; exit \$status" 0 1 2 3 15
> +
> +_cleanup()
> +{
> +	cd /
> +	rm -rf "$tmp".* $metadump_file

metadump_file not used.

> +}
> +
> +# get standard environment, filters and checks
> +. ./common/rc
> +. ./common/filter
> +
> +# real QA test starts here
> +_supported_os Linux
> +_supported_fs xfs
> +_require_realtime
> +_require_xfs_scratch_rmapbt
> +_require_test_program "punch-alternating"
> +
> +rm -f "$seqres.full"
> +
> +echo "Format and mount"
> +_scratch_mkfs | _filter_mkfs 2>$tmp.mkfs >/dev/null
> +. $tmp.mkfs
> +cat $tmp.mkfs > "$seqres.full" 2>&1
> +_scratch_mkfs > "$seqres.full" 2>&1
> +_scratch_mount
> +blksz="$(stat -f $SCRATCH_MNT -c '%S')"
> +
> +i_ptrs=$(( (isize - 176) / 56 ))
> +bt_recs=$(( (blksz - 56) / 32 ))
> +
> +blocks=$((i_ptrs * bt_recs + 1))
> +len=$((blocks * rtextsz))
> +
> +echo "Create some files"
> +$XFS_IO_PROG -f -R -c "falloc 0 $len" -c "pwrite -S 0x68 -b 1048576 0 $len" $SCRATCH_MNT/f1 >> $seqres.full
> +$XFS_IO_PROG -f -R -c "falloc 0 $len" -c "pwrite -S 0x68 -b 1048576 0 $len" $SCRATCH_MNT/f2 >> $seqres.full
> +./src/punch-alternating $SCRATCH_MNT/f1 >> "$seqres.full"
> +./src/punch-alternating $SCRATCH_MNT/f2 >> "$seqres.full"
> +echo garbage > $SCRATCH_MNT/f3
> +ino=$(stat -c '%i' $SCRATCH_MNT/f3)
> +_scratch_unmount
> +
> +echo "Corrupt fs"
> +fsbno=$($XFS_DB_PROG -c "inode $ino" -c 'bmap' `_scratch_xfs_db_options` | \
> +	sed -e 's/^.*startblock \([0-9]*\) .*$/\1/g')
> +
> +$XFS_DB_PROG -x -c 'sb 0' -c 'addr rrmapino' \
> +	-c "write u3.rtrmapbt.ptrs[1] $fsbno" -c 'p' `_scratch_xfs_db_options` >> $seqres.full
> +_scratch_mount
> +
> +echo "Try to create more files"
> +$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f5 >> $seqres.full 2>&1
> +test -e $SCRATCH_MNT/f5 && echo "should not have been able to write f5"
> +
> +echo "Repair fs"
> +_scratch_unmount 2>&1 | _filter_scratch
> +$XFS_LOGPRINT_PROG -t $extra_log_options $device 2>&1 \

extra_log_options :)

And the following "repair" tests have the same issue.

> +		| tee $tmp.logprint | grep -q "<CLEAN>"
> +if [ $? -ne 0 ]; then
> +	echo "Dirty log, zeroing..." >> $seqres.full
> +	_scratch_xfs_repair -L >> $seqres.full 2>&1
> +else
> +	_scratch_xfs_repair >> $seqres.full 2>&1
> +fi
> +_scratch_xfs_repair >> $seqres.full 2>&1
> +
> +echo "Try to create more files (again)"
> +_scratch_mount
> +$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f4 >> $seqres.full
> +
> +# success, all done
> +status=0
> +exit
> diff --git a/tests/xfs/886.out b/tests/xfs/886.out
> new file mode 100644
> index 0000000..7f00c5d
> --- /dev/null
> +++ b/tests/xfs/886.out
> @@ -0,0 +1,7 @@
> +QA output created by 886
> +Format and mount
> +Create some files
> +Corrupt fs
> +Try to create more files
> +Repair fs
> +Try to create more files (again)
> diff --git a/tests/xfs/887 b/tests/xfs/887
> new file mode 100755
> index 0000000..05d0b50
> --- /dev/null
> +++ b/tests/xfs/887
> @@ -0,0 +1,108 @@
> +#! /bin/bash
> +# FS QA Test No. 887
> +#
> +# Cross-link rrmapino to another inode on an rtrmap fs and see if repair fixes it.

This description is the same as xfs/886, needs update?

> +#
> +#-----------------------------------------------------------------------
> +# Copyright (c) 2016, Oracle and/or its affiliates.  All Rights Reserved.
> +#
> +# This program is free software; you can redistribute it and/or
> +# modify it under the terms of the GNU General Public License as
> +# published by the Free Software Foundation.
> +#
> +# This program is distributed in the hope that it would be useful,
> +# but WITHOUT ANY WARRANTY; without even the implied warranty of
> +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> +# GNU General Public License for more details.
> +#
> +# You should have received a copy of the GNU General Public License
> +# along with this program; if not, write the Free Software Foundation,
> +# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
> +#-----------------------------------------------------------------------
> +
> +seq=`basename "$0"`
> +seqres="$RESULT_DIR/$seq"
> +echo "QA output created by $seq"
> +
> +here=`pwd`
> +tmp=/tmp/$$
> +status=1    # failure is the default!
> +trap "_cleanup; exit \$status" 0 1 2 3 15
> +
> +_cleanup()
> +{
> +	cd /
> +	rm -rf "$tmp".* $metadump_file
> +}
> +
> +# get standard environment, filters and checks
> +. ./common/rc
> +. ./common/filter
> +
> +# real QA test starts here
> +_supported_os Linux
> +_supported_fs xfs
> +_require_realtime
> +_require_xfs_scratch_rmapbt
> +_require_test_program "punch-alternating"
> +
> +rm -f "$seqres.full"
> +
> +echo "Format and mount"
> +_scratch_mkfs | _filter_mkfs 2>$tmp.mkfs >/dev/null
> +. $tmp.mkfs
> +cat $tmp.mkfs > "$seqres.full" 2>&1
> +_scratch_mkfs > "$seqres.full" 2>&1
> +_scratch_mount
> +blksz="$(stat -f $SCRATCH_MNT -c '%S')"
> +
> +i_ptrs=$(( (isize - 176) / 56 ))
> +bt_recs=$(( (blksz - 56) / 32 ))
> +
> +blocks=$((i_ptrs * bt_recs + 1))
> +len=$((blocks * rtextsz))
> +
> +echo "Create some files"
> +$XFS_IO_PROG -f -R -c "falloc 0 $len" -c "pwrite -S 0x68 -b 1048576 0 $len" $SCRATCH_MNT/f1 >> $seqres.full
> +$XFS_IO_PROG -f -R -c "falloc 0 $len" -c "pwrite -S 0x68 -b 1048576 0 $len" $SCRATCH_MNT/f2 >> $seqres.full
> +./src/punch-alternating $SCRATCH_MNT/f1 >> "$seqres.full"
> +./src/punch-alternating $SCRATCH_MNT/f2 >> "$seqres.full"
> +echo garbage > $SCRATCH_MNT/f3
> +ino=$(stat -c '%i' $SCRATCH_MNT/f3)
> +_scratch_unmount
> +
> +echo "Corrupt fs"
> +$XFS_DB_PROG -c 'sb 0' -c 'addr rrmapino' \
> +	-c 'p u3.rtrmapbt.ptrs[1]' `_scratch_xfs_db_options` >> $seqres.full
> +
> +fsbno=$($XFS_DB_PROG -c 'sb 0' -c 'addr rrmapino' \
> +	-c 'p u3.rtrmapbt.ptrs[1]' `_scratch_xfs_db_options` | sed -e 's/^.*://g')
> +$XFS_DB_PROG -x -c "inode $ino" \
> +	-c "write u3.bmx[0].startblock $fsbno" `_scratch_xfs_db_options` >> $seqres.full
> +_scratch_mount
> +
> +od -tx1 -Ad -c $SCRATCH_MNT/f3 >> $seqres.full
> +
> +echo "Try to create more files"
> +$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f5 >> $seqres.full 2>&1
> +test ! -e $SCRATCH_MNT/f5 && echo "should have been able to write f5"
> +
> +echo "Repair fs"
> +_scratch_unmount 2>&1 | _filter_scratch
> +$XFS_LOGPRINT_PROG -t $extra_log_options $device 2>&1 \
> +		| tee $tmp.logprint | grep -q "<CLEAN>"
> +if [ $? -ne 0 ]; then
> +	echo "Dirty log, zeroing..." >> $seqres.full
> +	_scratch_xfs_repair -L >> $seqres.full 2>&1
> +else
> +	_scratch_xfs_repair >> $seqres.full 2>&1
> +fi
> +_scratch_xfs_repair >> $seqres.full 2>&1

I see this xfs_logprint & repair hunk repeated many times, make it a
helper?

> +
> +echo "Try to create more files (again)"
> +_scratch_mount
> +$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f4 >> $seqres.full
> +
> +# success, all done
> +status=0
> +exit
> diff --git a/tests/xfs/887.out b/tests/xfs/887.out
> new file mode 100644
> index 0000000..30cf032
> --- /dev/null
> +++ b/tests/xfs/887.out
> @@ -0,0 +1,7 @@
> +QA output created by 887
> +Format and mount
> +Create some files
> +Corrupt fs
> +Try to create more files
> +Repair fs
> +Try to create more files (again)
> diff --git a/tests/xfs/888 b/tests/xfs/888
> new file mode 100755
> index 0000000..dcc9fd8
> --- /dev/null
> +++ b/tests/xfs/888
> @@ -0,0 +1,81 @@
> +#! /bin/bash
> +# FS QA Test No. 888
> +#
> +# Basic rmap manipulation tests for realtime files.
> +#
> +#-----------------------------------------------------------------------
> +# Copyright (c) 2016, Oracle and/or its affiliates.  All Rights Reserved.
> +#
> +# This program is free software; you can redistribute it and/or
> +# modify it under the terms of the GNU General Public License as
> +# published by the Free Software Foundation.
> +#
> +# This program is distributed in the hope that it would be useful,
> +# but WITHOUT ANY WARRANTY; without even the implied warranty of
> +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> +# GNU General Public License for more details.
> +#
> +# You should have received a copy of the GNU General Public License
> +# along with this program; if not, write the Free Software Foundation,
> +# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
> +#-----------------------------------------------------------------------
> +
> +seq=`basename "$0"`
> +seqres="$RESULT_DIR/$seq"
> +echo "QA output created by $seq"
> +
> +here=`pwd`
> +tmp=/tmp/$$
> +status=1    # failure is the default!
> +trap "_cleanup; exit \$status" 0 1 2 3 15
> +
> +_cleanup()
> +{
> +	cd /
> +	rm -rf "$tmp".* $metadump_file
> +}
> +
> +# get standard environment, filters and checks
> +. ./common/rc
> +. ./common/filter
> +
> +# real QA test starts here
> +_supported_os Linux
> +_supported_fs xfs
> +_require_realtime
> +_require_xfs_scratch_rmapbt
> +_require_xfs_io_command "falloc"
> +_require_xfs_io_command "fpunch"
> +_require_xfs_io_command "fzero"
> +_require_xfs_io_command "fcollapse"
> +_require_xfs_io_command "finsert"
> +
> +rm -f "$seqres.full"
> +
> +echo "Format and mount"
> +_scratch_mkfs > "$seqres.full" 2>&1
> +_scratch_mount
> +blksz=65536
> +blocks=16
> +len=$((blocks * blksz))
> +
> +echo "Create some files"
> +$XFS_IO_PROG -f -R -c "falloc 0 $len" -c "pwrite -S 0x68 -b 1048576 0 $len" $SCRATCH_MNT/f1 >> $seqres.full
> +
> +echo "Manipulate file"
> +$XFS_IO_PROG -c "fpunch $blksz $blksz" \
> +	-c "fzero $((3 * blksz)) $blksz" \
> +	-c "pwrite -S 0x69 $((5 * blksz)) $blksz" \
> +	-c "fpunch $((7 * blksz)) $blksz" \
> +	-c "fsync" \
> +	-c "pwrite -S 0x70 $((7 * blksz)) $blksz" \
> +	-c "fcollapse $((9 * blksz)) $blksz" \
> +	-c "finsert $((10 * blksz)) $blksz" $SCRATCH_MNT/f1 >> $seqres.full
> +
> +echo "Check file"
> +md5sum $SCRATCH_MNT/f1 | _filter_scratch
> +od -tx1 -Ad -c $SCRATCH_MNT/f1 >> $seqres.full
> +
> +# success, all done
> +status=0
> +exit
> diff --git a/tests/xfs/888.out b/tests/xfs/888.out
> new file mode 100644
> index 0000000..2587697
> --- /dev/null
> +++ b/tests/xfs/888.out
> @@ -0,0 +1,6 @@
> +QA output created by 888
> +Format and mount
> +Create some files
> +Manipulate file
> +Check file
> +e45c5707fcf6817e914ffb6ce37a0ac7  SCRATCH_MNT/f1
> diff --git a/tests/xfs/group b/tests/xfs/group
> index 72580e9..1b0e22a 100644
> --- a/tests/xfs/group
> +++ b/tests/xfs/group
> @@ -313,3 +313,14 @@
>  875 auto quick clone fsr quota
>  876 auto quick rmap clone
>  877 auto quick rmap clone
> +878 auto quick rmap
> +879 auto quick rmap
> +880 auto quick rmap
> +881 auto quick rmap

I ran these tests on a test vm with 4 vcpus and 8G mem, seems 880 and
881 are not quick enough :)

xfs/880 39s ... 43s
xfs/881 40s ... 36s

Thansk,
Eryu

> +882 fuzzers rmap
> +883 auto quick rmap
> +884 auto quick rmap
> +885 auto quick rmap
> +886 auto quick rmap
> +887 auto quick rmap
> +888 auto quick rmap
> 

^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: [PATCH 09/13] xfs: test realtime rmapbt code
  2016-09-08 10:19   ` Eryu Guan
@ 2016-09-08 15:39     ` Darrick J. Wong
  0 siblings, 0 replies; 39+ messages in thread
From: Darrick J. Wong @ 2016-09-08 15:39 UTC (permalink / raw)
  To: Eryu Guan; +Cc: david, linux-xfs, fstests, xfs

On Thu, Sep 08, 2016 at 06:19:20PM +0800, Eryu Guan wrote:
> On Thu, Aug 25, 2016 at 04:29:17PM -0700, Darrick J. Wong wrote:
> > Test the realtime rmap btree code by exercising various IO patterns
> > on realtime files.
> > 
> > Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> > ---
> >  tests/xfs/878     |   91 +++++++++++++++++++++++++++++++++++++++++++
> >  tests/xfs/878.out |    9 ++++
> >  tests/xfs/879     |   67 ++++++++++++++++++++++++++++++++
> >  tests/xfs/879.out |    7 +++
> >  tests/xfs/880     |   86 +++++++++++++++++++++++++++++++++++++++++
> >  tests/xfs/880.out |    7 +++
> >  tests/xfs/881     |   95 +++++++++++++++++++++++++++++++++++++++++++++
> >  tests/xfs/881.out |    8 ++++
> >  tests/xfs/882     |  111 +++++++++++++++++++++++++++++++++++++++++++++++++++++
> >  tests/xfs/882.out |   11 +++++
> >  tests/xfs/883     |   90 +++++++++++++++++++++++++++++++++++++++++++
> >  tests/xfs/883.out |   10 +++++
> >  tests/xfs/884     |   91 +++++++++++++++++++++++++++++++++++++++++++
> >  tests/xfs/884.out |    9 ++++
> >  tests/xfs/885     |   95 +++++++++++++++++++++++++++++++++++++++++++++
> >  tests/xfs/885.out |   10 +++++
> >  tests/xfs/886     |  104 ++++++++++++++++++++++++++++++++++++++++++++++++++
> >  tests/xfs/886.out |    7 +++
> >  tests/xfs/887     |  108 ++++++++++++++++++++++++++++++++++++++++++++++++++++
> >  tests/xfs/887.out |    7 +++
> >  tests/xfs/888     |   81 +++++++++++++++++++++++++++++++++++++++
> >  tests/xfs/888.out |    6 +++
> >  tests/xfs/group   |   11 +++++
> >  23 files changed, 1121 insertions(+)
> >  create mode 100755 tests/xfs/878
> >  create mode 100644 tests/xfs/878.out
> >  create mode 100755 tests/xfs/879
> >  create mode 100644 tests/xfs/879.out
> >  create mode 100755 tests/xfs/880
> >  create mode 100644 tests/xfs/880.out
> >  create mode 100755 tests/xfs/881
> >  create mode 100644 tests/xfs/881.out
> >  create mode 100755 tests/xfs/882
> >  create mode 100644 tests/xfs/882.out
> >  create mode 100755 tests/xfs/883
> >  create mode 100644 tests/xfs/883.out
> >  create mode 100755 tests/xfs/884
> >  create mode 100644 tests/xfs/884.out
> >  create mode 100755 tests/xfs/885
> >  create mode 100644 tests/xfs/885.out
> >  create mode 100755 tests/xfs/886
> >  create mode 100644 tests/xfs/886.out
> >  create mode 100755 tests/xfs/887
> >  create mode 100644 tests/xfs/887.out
> >  create mode 100755 tests/xfs/888
> >  create mode 100644 tests/xfs/888.out
> > 
> > 
> > diff --git a/tests/xfs/878 b/tests/xfs/878
> > new file mode 100755
> > index 0000000..557e4ae
> > --- /dev/null
> > +++ b/tests/xfs/878
> > @@ -0,0 +1,91 @@
> > +#! /bin/bash
> > +# FS QA Test No. 878
> > +#
> > +# Set rrmapino to another inode on an non-rt rmap fs and see if repair fixes it.
> > +#
> > +#-----------------------------------------------------------------------
> > +# Copyright (c) 2016, Oracle and/or its affiliates.  All Rights Reserved.
> > +#
> > +# This program is free software; you can redistribute it and/or
> > +# modify it under the terms of the GNU General Public License as
> > +# published by the Free Software Foundation.
> > +#
> > +# This program is distributed in the hope that it would be useful,
> > +# but WITHOUT ANY WARRANTY; without even the implied warranty of
> > +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> > +# GNU General Public License for more details.
> > +#
> > +# You should have received a copy of the GNU General Public License
> > +# along with this program; if not, write the Free Software Foundation,
> > +# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
> > +#-----------------------------------------------------------------------
> > +
> > +seq=`basename "$0"`
> > +seqres="$RESULT_DIR/$seq"
> > +echo "QA output created by $seq"
> > +
> > +here=`pwd`
> > +tmp=/tmp/$$
> > +status=1    # failure is the default!
> > +trap "_cleanup; exit \$status" 0 1 2 3 15
> > +
> > +_cleanup()
> > +{
> > +	cd /
> > +	rm -rf "$tmp".* $metadump_file
> 
> $metadump_file is not used in this test.

Will remove those.

> > +}
> > +
> > +# get standard environment, filters and checks
> > +. ./common/rc
> > +. ./common/filter
> > +
> > +# real QA test starts here
> > +_supported_os Linux
> > +_supported_fs xfs
> > +_require_xfs_scratch_rmapbt
> > +
> > +rm -f "$seqres.full"
> > +
> > +unset SCRATCH_RTDEV
> > +
> > +echo "Format and mount"
> > +_scratch_mkfs > "$seqres.full" 2>&1
> > +_scratch_mount
> > +
> > +echo "Create some files"
> > +$XFS_IO_PROG -f -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f1 >> $seqres.full
> > +$XFS_IO_PROG -f -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f2 >> $seqres.full
> > +echo garbage > $SCRATCH_MNT/f3
> > +ino=$(stat -c '%i' $SCRATCH_MNT/f3)
> > +_scratch_unmount
> > +
> > +echo "Corrupt fs"
> > +$XFS_DB_PROG -x -c 'sb 0' \
> > +	-c "write rrmapino $ino" `_scratch_xfs_db_options` >> $seqres.full
> > +_scratch_mount
> > +
> > +echo "Check files"
> > +md5sum $SCRATCH_MNT/f1 2>&1 | _filter_scratch
> > +
> > +echo "Try to create more files"
> > +$XFS_IO_PROG -f -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f3 >> $seqres.full 2>&1
> > +
> > +echo "Repair fs"
> > +_scratch_unmount 2>&1 | _filter_scratch
> > +$XFS_LOGPRINT_PROG -t $extra_log_options $device 2>&1 \
> 
> Seems above line is copied & pasted from _check_xfs_filesystem(), but
> there's no $extra_log_options defined in this test.
> 
> > +		| tee $tmp.logprint | grep -q "<CLEAN>"
> > +if [ $? -ne 0 ]; then
> > +	echo "Dirty log, zeroing..." >> $seqres.full
> > +	_scratch_xfs_repair -L >> $seqres.full 2>&1
> > +else
> > +	_scratch_xfs_repair >> $seqres.full 2>&1
> > +fi
> > +_scratch_xfs_repair >> $seqres.full 2>&1

This whole stupid thing could be _repair_scratch_fs.  Sorry I forgot that.

> > +
> > +echo "Try to create more files (again)"
> > +_scratch_mount
> > +$XFS_IO_PROG -f -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f4 >> $seqres.full
> > +
> > +# success, all done
> > +status=0
> > +exit
> > diff --git a/tests/xfs/878.out b/tests/xfs/878.out
> > new file mode 100644
> > index 0000000..e134506
> > --- /dev/null
> > +++ b/tests/xfs/878.out
> > @@ -0,0 +1,9 @@
> > +QA output created by 878
> > +Format and mount
> > +Create some files
> > +Corrupt fs
> > +Check files
> > +8f27047948255cb84872e2dd7c0bc56d  SCRATCH_MNT/f1
> > +Try to create more files
> > +Repair fs
> > +Try to create more files (again)
> > diff --git a/tests/xfs/879 b/tests/xfs/879
> > new file mode 100755
> > index 0000000..247b3af
> > --- /dev/null
> > +++ b/tests/xfs/879
> > @@ -0,0 +1,67 @@
> > +#! /bin/bash
> > +# FS QA Test No. 879
> > +#
> > +# Ensure that we can create a few realtime files on a rmapbt filesystem.
> > +#
> > +#-----------------------------------------------------------------------
> > +# Copyright (c) 2016, Oracle and/or its affiliates.  All Rights Reserved.
> > +#
> > +# This program is free software; you can redistribute it and/or
> > +# modify it under the terms of the GNU General Public License as
> > +# published by the Free Software Foundation.
> > +#
> > +# This program is distributed in the hope that it would be useful,
> > +# but WITHOUT ANY WARRANTY; without even the implied warranty of
> > +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> > +# GNU General Public License for more details.
> > +#
> > +# You should have received a copy of the GNU General Public License
> > +# along with this program; if not, write the Free Software Foundation,
> > +# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
> > +#-----------------------------------------------------------------------
> > +
> > +seq=`basename "$0"`
> > +seqres="$RESULT_DIR/$seq"
> > +echo "QA output created by $seq"
> > +
> > +here=`pwd`
> > +tmp=/tmp/$$
> > +status=1    # failure is the default!
> > +trap "_cleanup; exit \$status" 0 1 2 3 15
> > +
> > +_cleanup()
> > +{
> > +	cd /
> > +	rm -rf "$tmp".*
> > +}
> > +
> > +# get standard environment, filters and checks
> > +. ./common/rc
> > +. ./common/filter
> > +
> > +# real QA test starts here
> > +_supported_os Linux
> > +_supported_fs xfs
> > +_require_realtime
> > +_require_xfs_scratch_rmapbt
> > +
> > +rm -f "$seqres.full"
> > +
> > +echo "Format and mount"
> > +_scratch_mkfs > "$seqres.full" 2>&1
> > +_scratch_mount
> > +
> > +echo "Create a few files"
> > +$XFS_IO_PROG -f -R -c 'pwrite -S 0x67 0 50000' -c fsync $SCRATCH_MNT/f1 >> $seqres.full
> > +$XFS_IO_PROG -f -R -c 'pwrite -S 0x67 0 50000' -c fsync $SCRATCH_MNT/f2 >> $seqres.full
> > +_scratch_cycle_mount
> > +
> > +echo "Grab contents"
> > +md5sum $SCRATCH_MNT/f1 $SCRATCH_MNT/f2 | _filter_scratch
> > +
> > +echo "Remove one file"
> > +rm -rf $SCRATCH_MNT/f2
> > +
> > +# success, all done
> > +status=0
> > +exit
> > diff --git a/tests/xfs/879.out b/tests/xfs/879.out
> > new file mode 100644
> > index 0000000..9dfe48b
> > --- /dev/null
> > +++ b/tests/xfs/879.out
> > @@ -0,0 +1,7 @@
> > +QA output created by 879
> > +Format and mount
> > +Create a few files
> > +Grab contents
> > +10abe2628d19eb1c2ebe18aad7b14820  SCRATCH_MNT/f1
> > +10abe2628d19eb1c2ebe18aad7b14820  SCRATCH_MNT/f2
> > +Remove one file
> > diff --git a/tests/xfs/880 b/tests/xfs/880
> > new file mode 100755
> > index 0000000..8cd509f
> > --- /dev/null
> > +++ b/tests/xfs/880
> > @@ -0,0 +1,86 @@
> > +#! /bin/bash
> > +# FS QA Test No. 880
> > +#
> > +# Exercise expanding and shrinking the realtime rmap btree.
> > +#
> > +#-----------------------------------------------------------------------
> > +# Copyright (c) 2016, Oracle and/or its affiliates.  All Rights Reserved.
> > +#
> > +# This program is free software; you can redistribute it and/or
> > +# modify it under the terms of the GNU General Public License as
> > +# published by the Free Software Foundation.
> > +#
> > +# This program is distributed in the hope that it would be useful,
> > +# but WITHOUT ANY WARRANTY; without even the implied warranty of
> > +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> > +# GNU General Public License for more details.
> > +#
> > +# You should have received a copy of the GNU General Public License
> > +# along with this program; if not, write the Free Software Foundation,
> > +# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
> > +#-----------------------------------------------------------------------
> > +
> > +seq=`basename "$0"`
> > +seqres="$RESULT_DIR/$seq"
> > +echo "QA output created by $seq"
> > +
> > +here=`pwd`
> > +tmp=/tmp/$$
> > +status=1    # failure is the default!
> > +trap "_cleanup; exit \$status" 0 1 2 3 15
> > +
> > +_cleanup()
> > +{
> > +	cd /
> > +	rm -rf "$tmp".*
> > +}
> > +
> > +# get standard environment, filters and checks
> > +. ./common/rc
> > +. ./common/filter
> > +
> > +# real QA test starts here
> > +_supported_os Linux
> > +_supported_fs xfs
> > +_require_realtime
> > +_require_xfs_scratch_rmapbt
> > +_require_test_program "punch-alternating"
> > +_require_xfs_io_command "falloc"
> > +
> > +rm -f "$seqres.full"
> > +
> > +echo "Format and mount"
> > +_scratch_mkfs | _filter_mkfs 2>$tmp.mkfs >/dev/null
> > +. $tmp.mkfs
> > +cat $tmp.mkfs > "$seqres.full" 2>&1
> > +_scratch_mount
> > +blksz="$(stat -f $SCRATCH_MNT -c '%S')"
> 
> You can use get_block_size() helper, and I know I've mentioned it before :)

There's a lot of these; I think I might just do a treewide replace patch for
the existing tests, then fix this here.

> > +
> > +echo "Create a three-level rtrmapbt"
> > +i_ptrs=$(( (isize - 176) / 56 ))
> > +bt_ptrs=$(( (blksz - 56) / 56 ))
> > +bt_recs=$(( (blksz - 56) / 32 ))
> > +
> > +blocks=$((i_ptrs * bt_ptrs * bt_recs))
> > +_require_fs_space $SCRATCH_MNT $(( (2 * blocks * blksz) * 5 / 4096 ))
> 
> Better to have some comments on the numbers and why require such a fs
> space, as you did in your last reply.

Ok.

> > +len=$((blocks * rtextsz))
> > +
> > +echo "Create big file"
> > +$XFS_IO_PROG -f -R -c "falloc 0 $len" -c "pwrite -S 0x68 -b 1048576 0 $len" $SCRATCH_MNT/f1 >> $seqres.full
> > +$XFS_IO_PROG -f -R -c "falloc 0 $len" -c "pwrite -S 0x68 -b 1048576 0 $len" $SCRATCH_MNT/f2 >> $seqres.full
> > +
> > +echo "Explode the rtrmapbt"
> > +./src/punch-alternating $SCRATCH_MNT/f1 >> "$seqres.full"
> > +./src/punch-alternating $SCRATCH_MNT/f2 >> "$seqres.full"
> > +_scratch_cycle_mount
> > +
> > +echo "Remove half the records"
> > +rm -rf $SCRATCH_MNT/f1
> > +_scratch_cycle_mount
> > +
> > +echo "Remove the rest of the records"
> > +rm -rf $SCRATCH_MNT/f2
> > +
> > +# success, all done
> > +status=0
> > +exit
> > diff --git a/tests/xfs/880.out b/tests/xfs/880.out
> > new file mode 100644
> > index 0000000..b87665b
> > --- /dev/null
> > +++ b/tests/xfs/880.out
> > @@ -0,0 +1,7 @@
> > +QA output created by 880
> > +Format and mount
> > +Create a three-level rtrmapbt
> > +Create big file
> > +Explode the rtrmapbt
> > +Remove half the records
> > +Remove the rest of the records
> > diff --git a/tests/xfs/881 b/tests/xfs/881
> > new file mode 100755
> > index 0000000..750a92a
> > --- /dev/null
> > +++ b/tests/xfs/881
> > @@ -0,0 +1,95 @@
> > +#! /bin/bash
> > +# FS QA Test No. 881
> > +#
> > +# Exercise metadump on realtime rmapbt preservation.
> > +#
> > +#-----------------------------------------------------------------------
> > +# Copyright (c) 2016, Oracle and/or its affiliates.  All Rights Reserved.
> > +#
> > +# This program is free software; you can redistribute it and/or
> > +# modify it under the terms of the GNU General Public License as
> > +# published by the Free Software Foundation.
> > +#
> > +# This program is distributed in the hope that it would be useful,
> > +# but WITHOUT ANY WARRANTY; without even the implied warranty of
> > +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> > +# GNU General Public License for more details.
> > +#
> > +# You should have received a copy of the GNU General Public License
> > +# along with this program; if not, write the Free Software Foundation,
> > +# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
> > +#-----------------------------------------------------------------------
> > +
> > +seq=`basename "$0"`
> > +seqres="$RESULT_DIR/$seq"
> > +echo "QA output created by $seq"
> > +
> > +here=`pwd`
> > +tmp=/tmp/$$
> > +status=1    # failure is the default!
> > +trap "_cleanup; exit \$status" 0 1 2 3 15
> > +
> > +_cleanup()
> > +{
> > +	cd /
> > +	rm -rf "$tmp".* $metadump_file
> > +}
> > +
> > +# get standard environment, filters and checks
> > +. ./common/rc
> > +. ./common/filter
> > +
> > +# real QA test starts here
> > +_supported_os Linux
> > +_supported_fs xfs
> > +_require_realtime
> > +_require_xfs_scratch_rmapbt
> > +_require_test_program "punch-alternating"
> > +_require_xfs_io_command "falloc"
> > +
> > +rm -f "$seqres.full"
> > +
> > +echo "Format and mount"
> > +_scratch_mkfs | _filter_mkfs 2>$tmp.mkfs >/dev/null
> > +. $tmp.mkfs
> > +cat $tmp.mkfs > "$seqres.full" 2>&1
> > +_scratch_mount
> > +blksz="$(stat -f $SCRATCH_MNT -c '%S')"
> > +
> > +metadump_file=$TEST_DIR/${seq}_metadump
> > +rm -rf $metadump_file
> > +
> > +echo "Create a three-level rtrmapbt"
> > +i_ptrs=$(( (isize - 176) / 56 ))
> > +bt_ptrs=$(( (blksz - 56) / 56 ))
> > +bt_recs=$(( (blksz - 56) / 32 ))
> > +
> > +blocks=$((i_ptrs * bt_ptrs * bt_recs))
> > +_require_fs_space $SCRATCH_MNT $(( (2 * blocks * blksz) * 5 / 4096 ))
> > +len=$((blocks * rtextsz))
> > +
> > +echo "Create big file"
> > +$XFS_IO_PROG -f -R -c "falloc 0 $len" -c "pwrite -S 0x68 -b 1048576 0 $len" $SCRATCH_MNT/f1 >> $seqres.full
> > +$XFS_IO_PROG -f -R -c "falloc 0 $len" -c "pwrite -S 0x68 -b 1048576 0 $len" $SCRATCH_MNT/f2 >> $seqres.full
> > +
> > +echo "Explode the rtrmapbt"
> > +./src/punch-alternating $SCRATCH_MNT/f1 >> "$seqres.full"
> > +./src/punch-alternating $SCRATCH_MNT/f2 >> "$seqres.full"
> > +_scratch_cycle_mount
> > +
> > +echo "Create metadump file"
> > +_scratch_unmount
> > +_scratch_metadump $metadump_file
> > +
> > +# Now restore the obfuscated one back and take a look around
> > +echo "Restore metadump"
> > +xfs_mdrestore $metadump_file $TEST_DIR/image
> > +SCRATCH_DEV=$TEST_DIR/image _scratch_mount
> > +SCRATCH_DEV=$TEST_DIR/image _scratch_unmount
> > +
> > +echo "Check restored fs"
> > +_check_generic_filesystem $metadump_file
> 
> _check_generic_filesystem runs "fsck -t $FSTYP $dev" but "fsck -t xfs"
> is a no-op, and $metadump_file is a metadump, not a fs image. Perhaps
> what you want to do is "_check_scratch_fs $TEST_DIR/image"?

Yep.

> > +
> > +# success, all done
> > +status=0
> > +exit
> > diff --git a/tests/xfs/881.out b/tests/xfs/881.out
> > new file mode 100644
> > index 0000000..6ad156c
> > --- /dev/null
> > +++ b/tests/xfs/881.out
> > @@ -0,0 +1,8 @@
> > +QA output created by 881
> > +Format and mount
> > +Create a three-level rtrmapbt
> > +Create big file
> > +Explode the rtrmapbt
> > +Create metadump file
> > +Restore metadump
> > +Check restored fs
> > diff --git a/tests/xfs/882 b/tests/xfs/882
> > new file mode 100755
> > index 0000000..3c44540
> > --- /dev/null
> > +++ b/tests/xfs/882
> > @@ -0,0 +1,111 @@
> > +#! /bin/bash
> > +# FS QA Test No. 882
> > +#
> > +# Corrupt the realtime rmapbt and see how the kernel and xfs_repair deal.
> > +#
> > +#-----------------------------------------------------------------------
> > +# Copyright (c) 2016, Oracle and/or its affiliates.  All Rights Reserved.
> > +#
> > +# This program is free software; you can redistribute it and/or
> > +# modify it under the terms of the GNU General Public License as
> > +# published by the Free Software Foundation.
> > +#
> > +# This program is distributed in the hope that it would be useful,
> > +# but WITHOUT ANY WARRANTY; without even the implied warranty of
> > +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> > +# GNU General Public License for more details.
> > +#
> > +# You should have received a copy of the GNU General Public License
> > +# along with this program; if not, write the Free Software Foundation,
> > +# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
> > +#-----------------------------------------------------------------------
> > +
> > +seq=`basename "$0"`
> > +seqres="$RESULT_DIR/$seq"
> > +echo "QA output created by $seq"
> > +
> > +here=`pwd`
> > +tmp=/tmp/$$
> > +status=1    # failure is the default!
> > +trap "_cleanup; exit \$status" 0 1 2 3 15
> > +
> > +_cleanup()
> > +{
> > +	cd /
> > +	rm -rf "$tmp".*
> > +}
> > +
> > +# get standard environment, filters and checks
> > +. ./common/rc
> > +. ./common/filter
> > +
> > +# real QA test starts here
> > +_supported_os Linux
> > +_supported_fs xfs
> > +_require_realtime
> > +_require_xfs_scratch_rmapbt
> > +_require_test_program "punch-alternating"
> > +_require_xfs_io_command "falloc"
> > +
> > +rm -f "$seqres.full"
> > +
> > +echo "+ create scratch fs"
> > +_scratch_mkfs | _filter_mkfs 2>$tmp.mkfs >/dev/null
> > +. $tmp.mkfs
> > +cat $tmp.mkfs > "$seqres.full" 2>&1
> > +
> > +echo "+ mount fs image"
> > +_scratch_mount
> > +blksz="$(stat -f $SCRATCH_MNT -c '%S')"
> > +
> > +i_ptrs=$(( (isize - 176) / 56 ))
> > +bt_ptrs=$(( (blksz - 56) / 56 ))
> > +bt_recs=$(( (blksz - 56) / 32 ))
> > +
> > +blocks=$((i_ptrs * bt_ptrs * bt_recs + 1))
> > +_require_fs_space $SCRATCH_MNT $(( (2 * blocks * blksz) * 5 / 4096 ))
> > +len=$((blocks * blksz))
> > +
> > +echo "+ make some files"
> > +$XFS_IO_PROG -f -R -c "falloc 0 $len" -c "pwrite -S 0x68 -b 1048576 0 $len" $SCRATCH_MNT/f1 >> $seqres.full
> > +$XFS_IO_PROG -f -R -c "falloc 0 $len" -c "pwrite -S 0x68 -b 1048576 0 $len" $SCRATCH_MNT/f2 >> $seqres.full
> > +./src/punch-alternating $SCRATCH_MNT/f1 >> "$seqres.full"
> > +./src/punch-alternating $SCRATCH_MNT/f2 >> "$seqres.full"
> > +_scratch_unmount
> > +
> > +echo "+ check fs"
> > +_scratch_xfs_repair -n >> $seqres.full 2>&1 || echo "xfs_repair should not fail"
> > +
> > +echo "+ corrupt image"
> > +$XFS_DB_PROG -x -c "sb" -c "addr rrmapino" -c "addr u3.rtrmapbt.ptrs[1]" \
> > +	-c "stack" -c "blocktrash -x 4096 -y 4096 -n 8 -3 -z" \
> > +	`_scratch_xfs_db_options` >> $seqres.full 2>&1
> > +
> > +echo "+ mount image"
> > +_scratch_mount
> > +
> > +echo "+ copy more"
> > +$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 1" $SCRATCH_MNT/e3 >> $seqres.full 2>&1
> > +test -s ${SCRATCH_MNT}/f3 && echo "should not be able to copy with busted rtrmap btree"
> > +_scratch_unmount
> > +
> > +echo "+ repair fs"
> > +$XFS_LOGPRINT_PROG -t $extra_log_options $device 2>&1 \
> 
> No $extra_log_options defined.
> 
> > +		| tee $tmp.logprint | grep -q "<CLEAN>"
> > +if [ $? -ne 0 ]; then
> > +	echo "Dirty log, zeroing..." >> $seqres.full
> > +	_scratch_xfs_repair -L >> $seqres.full 2>&1
> > +else
> > +	_scratch_xfs_repair >> $seqres.full 2>&1
> > +fi
> > +_scratch_xfs_repair >> $seqres.full 2>&1
> > +
> > +echo "+ mount image (2)"
> > +_scratch_mount
> > +
> > +echo "+ copy more (2)"
> > +$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 1" $SCRATCH_MNT/e4 >> $seqres.full
> > +
> > +# success, all done
> > +status=0
> > +exit
> > diff --git a/tests/xfs/882.out b/tests/xfs/882.out
> > new file mode 100644
> > index 0000000..5ebe620
> > --- /dev/null
> > +++ b/tests/xfs/882.out
> > @@ -0,0 +1,11 @@
> > +QA output created by 882
> > ++ create scratch fs
> > ++ mount fs image
> > ++ make some files
> > ++ check fs
> > ++ corrupt image
> > ++ mount image
> > ++ copy more
> > ++ repair fs
> > ++ mount image (2)
> > ++ copy more (2)
> > diff --git a/tests/xfs/883 b/tests/xfs/883
> > new file mode 100755
> > index 0000000..86dd047
> > --- /dev/null
> > +++ b/tests/xfs/883
> > @@ -0,0 +1,90 @@
> > +#! /bin/bash
> > +# FS QA Test No. 883
> > +#
> > +# Set rrmapino to zero on an rtrmap fs and see if repair fixes it.
> > +#
> > +#-----------------------------------------------------------------------
> > +# Copyright (c) 2016, Oracle and/or its affiliates.  All Rights Reserved.
> > +#
> > +# This program is free software; you can redistribute it and/or
> > +# modify it under the terms of the GNU General Public License as
> > +# published by the Free Software Foundation.
> > +#
> > +# This program is distributed in the hope that it would be useful,
> > +# but WITHOUT ANY WARRANTY; without even the implied warranty of
> > +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> > +# GNU General Public License for more details.
> > +#
> > +# You should have received a copy of the GNU General Public License
> > +# along with this program; if not, write the Free Software Foundation,
> > +# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
> > +#-----------------------------------------------------------------------
> > +
> > +seq=`basename "$0"`
> > +seqres="$RESULT_DIR/$seq"
> > +echo "QA output created by $seq"
> > +
> > +here=`pwd`
> > +tmp=/tmp/$$
> > +status=1    # failure is the default!
> > +trap "_cleanup; exit \$status" 0 1 2 3 15
> > +
> > +_cleanup()
> > +{
> > +	cd /
> > +	rm -rf "$tmp".* $metadump_file
> 
> $metadump_file is not used.
> 
> > +}
> > +
> > +# get standard environment, filters and checks
> > +. ./common/rc
> > +. ./common/filter
> > +
> > +# real QA test starts here
> > +_supported_os Linux
> > +_supported_fs xfs
> > +_require_realtime
> > +_require_xfs_scratch_rmapbt
> > +
> > +rm -f "$seqres.full"
> > +
> > +echo "Format and mount"
> > +_scratch_mkfs > "$seqres.full" 2>&1
> > +_scratch_mount
> > +
> > +echo "Create some files"
> > +$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f1 >> $seqres.full
> > +$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f2 >> $seqres.full
> > +_scratch_unmount
> > +
> > +echo "Corrupt fs"
> > +$XFS_DB_PROG -x -c 'sb 0' -c 'addr rrmapino' \
> > +	-c 'write core.nlinkv2 0' -c 'write core.mode 0' -c 'sb 0' \
> > +	-c 'write rrmapino 0' `_scratch_xfs_db_options` >> $seqres.full
> > +_scratch_mount >> $seqres.full 2>&1 && echo "mount should have failed"
> > +
> > +echo "Check files"
> > +md5sum $SCRATCH_MNT/f1 2>&1 | _filter_scratch
> 
> $SCRATCH_MNT should not be mounted at this point, so there's no point
> checksuming $SCRATCH_MNT/f1 here.
> 
> > +
> > +echo "Try to create more files"
> > +$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f3 >> $seqres.full 2>&1
> 
> And no point creating new file under $SCRATCH_MNT

Oh yeah.  I guess this is the trouble with xfstesting in a VM with ro rootfs.

> > +test -e $SCRATCH_MNT/f3 && echo "should not have been able to write f3"
> > +
> > +echo "Repair fs"
> > +_scratch_unmount 2>&1 | _filter_scratch
> > +$XFS_LOGPRINT_PROG -t $extra_log_options $device 2>&1 \
> > +		| tee $tmp.logprint | grep -q "<CLEAN>"
> > +if [ $? -ne 0 ]; then
> > +	echo "Dirty log, zeroing..." >> $seqres.full
> > +	_scratch_xfs_repair -L >> $seqres.full 2>&1
> > +else
> > +	_scratch_xfs_repair >> $seqres.full 2>&1
> > +fi
> > +_scratch_xfs_repair >> $seqres.full 2>&1
> > +
> > +echo "Try to create more files (again)"
> > +_scratch_mount
> > +$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f4 >> $seqres.full
> > +
> > +# success, all done
> > +status=0
> > +exit
> > diff --git a/tests/xfs/883.out b/tests/xfs/883.out
> > new file mode 100644
> > index 0000000..6e75ac1
> > --- /dev/null
> > +++ b/tests/xfs/883.out
> > @@ -0,0 +1,10 @@
> > +QA output created by 883
> > +Format and mount
> > +Create some files
> > +Corrupt fs
> > +Check files
> > +md5sum: SCRATCH_MNT/f1: No such file or directory
> 
> Yes, f1 is not accessible. Seems the .out file should be updated too.
> 
> > +Try to create more files
> > +Repair fs
> > +umount: SCRATCH_DEV: not mounted
> > +Try to create more files (again)
> > diff --git a/tests/xfs/884 b/tests/xfs/884
> > new file mode 100755
> > index 0000000..51071e0
> > --- /dev/null
> > +++ b/tests/xfs/884
> > @@ -0,0 +1,91 @@
> > +#! /bin/bash
> > +# FS QA Test No. 884
> > +#
> > +# Link rrmapino into the rootdir on an rtrmap fs and see if repair fixes it.
> > +#
> > +#-----------------------------------------------------------------------
> > +# Copyright (c) 2016, Oracle and/or its affiliates.  All Rights Reserved.
> > +#
> > +# This program is free software; you can redistribute it and/or
> > +# modify it under the terms of the GNU General Public License as
> > +# published by the Free Software Foundation.
> > +#
> > +# This program is distributed in the hope that it would be useful,
> > +# but WITHOUT ANY WARRANTY; without even the implied warranty of
> > +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> > +# GNU General Public License for more details.
> > +#
> > +# You should have received a copy of the GNU General Public License
> > +# along with this program; if not, write the Free Software Foundation,
> > +# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
> > +#-----------------------------------------------------------------------
> > +
> > +seq=`basename "$0"`
> > +seqres="$RESULT_DIR/$seq"
> > +echo "QA output created by $seq"
> > +
> > +here=`pwd`
> > +tmp=/tmp/$$
> > +status=1    # failure is the default!
> > +trap "_cleanup; exit \$status" 0 1 2 3 15
> > +
> > +_cleanup()
> > +{
> > +	cd /
> > +	rm -rf "$tmp".* $metadump_file
> 
> metadump_file not used.
> 
> > +}
> > +
> > +# get standard environment, filters and checks
> > +. ./common/rc
> > +. ./common/filter
> > +
> > +# real QA test starts here
> > +_supported_os Linux
> > +_supported_fs xfs
> > +_require_realtime
> > +_require_xfs_scratch_rmapbt
> > +
> > +rm -f "$seqres.full"
> > +
> > +echo "Format and mount"
> > +_scratch_mkfs > "$seqres.full" 2>&1
> > +_scratch_mount
> > +
> > +echo "Create some files"
> > +$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f1 >> $seqres.full
> > +$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f2 >> $seqres.full
> > +echo garbage > $SCRATCH_MNT/f3
> > +ln $SCRATCH_MNT/f3 $SCRATCH_MNT/f4
> > +_scratch_unmount
> > +
> > +echo "Corrupt fs"
> > +rrmapino=$($XFS_DB_PROG -c 'sb 0' -c 'p rrmapino' `_scratch_xfs_db_options` | awk '{print $3}')
> > +$XFS_DB_PROG -x -c 'sb 0' -c 'addr rootino' \
> > +	-c "write u3.sfdir3.list[3].inumber.i4 $rrmapino" `_scratch_xfs_db_options` >> $seqres.full
> > +_scratch_mount
> > +
> > +echo "Check files"
> > +md5sum $SCRATCH_MNT/f1 2>&1 | _filter_scratch
> > +
> > +echo "Try to create more files"
> > +$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f5 >> $seqres.full 2>&1
> > +
> > +echo "Repair fs"
> > +_scratch_unmount 2>&1 | _filter_scratch
> > +$XFS_LOGPRINT_PROG -t $extra_log_options $device 2>&1 \
> 
> No extra_log_options defined.
> 
> > +		| tee $tmp.logprint | grep -q "<CLEAN>"
> > +if [ $? -ne 0 ]; then
> > +	echo "Dirty log, zeroing..." >> $seqres.full
> > +	_scratch_xfs_repair -L >> $seqres.full 2>&1
> > +else
> > +	_scratch_xfs_repair >> $seqres.full 2>&1
> > +fi
> > +_scratch_xfs_repair >> $seqres.full 2>&1
> > +
> > +echo "Try to create more files (again)"
> > +_scratch_mount
> > +$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f4 >> $seqres.full
> > +
> > +# success, all done
> > +status=0
> > +exit
> > diff --git a/tests/xfs/884.out b/tests/xfs/884.out
> > new file mode 100644
> > index 0000000..17a73ef
> > --- /dev/null
> > +++ b/tests/xfs/884.out
> > @@ -0,0 +1,9 @@
> > +QA output created by 884
> > +Format and mount
> > +Create some files
> > +Corrupt fs
> > +Check files
> > +8f27047948255cb84872e2dd7c0bc56d  SCRATCH_MNT/f1
> > +Try to create more files
> > +Repair fs
> > +Try to create more files (again)
> > diff --git a/tests/xfs/885 b/tests/xfs/885
> > new file mode 100755
> > index 0000000..1839c11
> > --- /dev/null
> > +++ b/tests/xfs/885
> > @@ -0,0 +1,95 @@
> > +#! /bin/bash
> > +# FS QA Test No. 885
> > +#
> > +# Set rrmapino to another inode on an rtrmap fs and see if repair fixes it.
> > +#
> > +#-----------------------------------------------------------------------
> > +# Copyright (c) 2016, Oracle and/or its affiliates.  All Rights Reserved.
> > +#
> > +# This program is free software; you can redistribute it and/or
> > +# modify it under the terms of the GNU General Public License as
> > +# published by the Free Software Foundation.
> > +#
> > +# This program is distributed in the hope that it would be useful,
> > +# but WITHOUT ANY WARRANTY; without even the implied warranty of
> > +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> > +# GNU General Public License for more details.
> > +#
> > +# You should have received a copy of the GNU General Public License
> > +# along with this program; if not, write the Free Software Foundation,
> > +# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
> > +#-----------------------------------------------------------------------
> > +
> > +seq=`basename "$0"`
> > +seqres="$RESULT_DIR/$seq"
> > +echo "QA output created by $seq"
> > +
> > +here=`pwd`
> > +tmp=/tmp/$$
> > +status=1    # failure is the default!
> > +trap "_cleanup; exit \$status" 0 1 2 3 15
> > +
> > +_cleanup()
> > +{
> > +	cd /
> > +	rm -rf "$tmp".* $metadump_file
> 
> metadump_file not used.
> 
> > +}
> > +
> > +# get standard environment, filters and checks
> > +. ./common/rc
> > +. ./common/filter
> > +
> > +# real QA test starts here
> > +_supported_os Linux
> > +_supported_fs xfs
> > +_require_realtime
> > +_require_xfs_scratch_rmapbt
> > +
> > +rm -f "$seqres.full"
> > +
> > +echo "Format and mount"
> > +_scratch_mkfs > "$seqres.full" 2>&1
> > +_scratch_mount
> > +
> > +echo "Create some files"
> > +$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f1 >> $seqres.full
> > +$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f2 >> $seqres.full
> > +echo garbage > $SCRATCH_MNT/f3
> > +ino=$(stat -c '%i' $SCRATCH_MNT/f3)
> > +_scratch_unmount
> > +
> > +echo "Corrupt fs"
> > +rrmapino=$($XFS_DB_PROG -c 'sb 0' -c 'p rrmapino' `_scratch_xfs_db_options` | awk '{print $3}')
> > +$XFS_DB_PROG -x -c "inode $rrmapino" \
> > +	-c 'write core.format 2' -c 'write core.size 0' \
> > +	-c 'write core.nblocks 0' -c 'sb 0' -c 'addr rootino' \
> > +	-c "write u3.sfdir3.list[2].inumber.i4 $rrmapino" \
> > +	-c 'sb 0' -c "write rrmapino $ino" `_scratch_xfs_db_options` >> $seqres.full
> > +_scratch_mount >> $seqres.full 2>&1 && echo "mount should have failed"
> > +
> > +echo "Check files"
> > +md5sum $SCRATCH_MNT/f1 2>&1 | _filter_scratch
> 
> Previous mount should have failed, so f1 is not accessible now.
> 
> > +
> > +echo "Try to create more files"
> > +$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f3 >> $seqres.full 2>&1
> > +test -e $SCRATCH_MNT/f3 && echo "should not have been able to write f3"
> > +
> > +echo "Repair fs"
> > +_scratch_unmount 2>&1 | _filter_scratch
> > +$XFS_LOGPRINT_PROG -t $extra_log_options $device 2>&1 \
> 
> No extra_log_options defined.
> 
> > +		| tee $tmp.logprint | grep -q "<CLEAN>"
> > +if [ $? -ne 0 ]; then
> > +	echo "Dirty log, zeroing..." >> $seqres.full
> > +	_scratch_xfs_repair -L >> $seqres.full 2>&1
> > +else
> > +	_scratch_xfs_repair >> $seqres.full 2>&1
> > +fi
> > +_scratch_xfs_repair >> $seqres.full 2>&1
> > +
> > +echo "Try to create more files (again)"
> > +_scratch_mount
> > +$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f4 >> $seqres.full
> > +
> > +# success, all done
> > +status=0
> > +exit
> > diff --git a/tests/xfs/885.out b/tests/xfs/885.out
> > new file mode 100644
> > index 0000000..df04f79
> > --- /dev/null
> > +++ b/tests/xfs/885.out
> > @@ -0,0 +1,10 @@
> > +QA output created by 885
> > +Format and mount
> > +Create some files
> > +Corrupt fs
> > +Check files
> > +md5sum: SCRATCH_MNT/f1: No such file or directory
> > +Try to create more files
> > +Repair fs
> > +umount: SCRATCH_DEV: not mounted
> > +Try to create more files (again)
> > diff --git a/tests/xfs/886 b/tests/xfs/886
> > new file mode 100755
> > index 0000000..81e7e64
> > --- /dev/null
> > +++ b/tests/xfs/886
> > @@ -0,0 +1,104 @@
> > +#! /bin/bash
> > +# FS QA Test No. 886
> > +#
> > +# Cross-link rrmapino to another inode on an rtrmap fs and see if repair fixes it.
> > +#
> > +#-----------------------------------------------------------------------
> > +# Copyright (c) 2016, Oracle and/or its affiliates.  All Rights Reserved.
> > +#
> > +# This program is free software; you can redistribute it and/or
> > +# modify it under the terms of the GNU General Public License as
> > +# published by the Free Software Foundation.
> > +#
> > +# This program is distributed in the hope that it would be useful,
> > +# but WITHOUT ANY WARRANTY; without even the implied warranty of
> > +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> > +# GNU General Public License for more details.
> > +#
> > +# You should have received a copy of the GNU General Public License
> > +# along with this program; if not, write the Free Software Foundation,
> > +# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
> > +#-----------------------------------------------------------------------
> > +
> > +seq=`basename "$0"`
> > +seqres="$RESULT_DIR/$seq"
> > +echo "QA output created by $seq"
> > +
> > +here=`pwd`
> > +tmp=/tmp/$$
> > +status=1    # failure is the default!
> > +trap "_cleanup; exit \$status" 0 1 2 3 15
> > +
> > +_cleanup()
> > +{
> > +	cd /
> > +	rm -rf "$tmp".* $metadump_file
> 
> metadump_file not used.
> 
> > +}
> > +
> > +# get standard environment, filters and checks
> > +. ./common/rc
> > +. ./common/filter
> > +
> > +# real QA test starts here
> > +_supported_os Linux
> > +_supported_fs xfs
> > +_require_realtime
> > +_require_xfs_scratch_rmapbt
> > +_require_test_program "punch-alternating"
> > +
> > +rm -f "$seqres.full"
> > +
> > +echo "Format and mount"
> > +_scratch_mkfs | _filter_mkfs 2>$tmp.mkfs >/dev/null
> > +. $tmp.mkfs
> > +cat $tmp.mkfs > "$seqres.full" 2>&1
> > +_scratch_mkfs > "$seqres.full" 2>&1
> > +_scratch_mount
> > +blksz="$(stat -f $SCRATCH_MNT -c '%S')"
> > +
> > +i_ptrs=$(( (isize - 176) / 56 ))
> > +bt_recs=$(( (blksz - 56) / 32 ))
> > +
> > +blocks=$((i_ptrs * bt_recs + 1))
> > +len=$((blocks * rtextsz))
> > +
> > +echo "Create some files"
> > +$XFS_IO_PROG -f -R -c "falloc 0 $len" -c "pwrite -S 0x68 -b 1048576 0 $len" $SCRATCH_MNT/f1 >> $seqres.full
> > +$XFS_IO_PROG -f -R -c "falloc 0 $len" -c "pwrite -S 0x68 -b 1048576 0 $len" $SCRATCH_MNT/f2 >> $seqres.full
> > +./src/punch-alternating $SCRATCH_MNT/f1 >> "$seqres.full"
> > +./src/punch-alternating $SCRATCH_MNT/f2 >> "$seqres.full"
> > +echo garbage > $SCRATCH_MNT/f3
> > +ino=$(stat -c '%i' $SCRATCH_MNT/f3)
> > +_scratch_unmount
> > +
> > +echo "Corrupt fs"
> > +fsbno=$($XFS_DB_PROG -c "inode $ino" -c 'bmap' `_scratch_xfs_db_options` | \
> > +	sed -e 's/^.*startblock \([0-9]*\) .*$/\1/g')
> > +
> > +$XFS_DB_PROG -x -c 'sb 0' -c 'addr rrmapino' \
> > +	-c "write u3.rtrmapbt.ptrs[1] $fsbno" -c 'p' `_scratch_xfs_db_options` >> $seqres.full
> > +_scratch_mount
> > +
> > +echo "Try to create more files"
> > +$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f5 >> $seqres.full 2>&1
> > +test -e $SCRATCH_MNT/f5 && echo "should not have been able to write f5"
> > +
> > +echo "Repair fs"
> > +_scratch_unmount 2>&1 | _filter_scratch
> > +$XFS_LOGPRINT_PROG -t $extra_log_options $device 2>&1 \
> 
> extra_log_options :)
> 
> And the following "repair" tests have the same issue.
> 
> > +		| tee $tmp.logprint | grep -q "<CLEAN>"
> > +if [ $? -ne 0 ]; then
> > +	echo "Dirty log, zeroing..." >> $seqres.full
> > +	_scratch_xfs_repair -L >> $seqres.full 2>&1
> > +else
> > +	_scratch_xfs_repair >> $seqres.full 2>&1
> > +fi
> > +_scratch_xfs_repair >> $seqres.full 2>&1
> > +
> > +echo "Try to create more files (again)"
> > +_scratch_mount
> > +$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f4 >> $seqres.full
> > +
> > +# success, all done
> > +status=0
> > +exit
> > diff --git a/tests/xfs/886.out b/tests/xfs/886.out
> > new file mode 100644
> > index 0000000..7f00c5d
> > --- /dev/null
> > +++ b/tests/xfs/886.out
> > @@ -0,0 +1,7 @@
> > +QA output created by 886
> > +Format and mount
> > +Create some files
> > +Corrupt fs
> > +Try to create more files
> > +Repair fs
> > +Try to create more files (again)
> > diff --git a/tests/xfs/887 b/tests/xfs/887
> > new file mode 100755
> > index 0000000..05d0b50
> > --- /dev/null
> > +++ b/tests/xfs/887
> > @@ -0,0 +1,108 @@
> > +#! /bin/bash
> > +# FS QA Test No. 887
> > +#
> > +# Cross-link rrmapino to another inode on an rtrmap fs and see if repair fixes it.
> 
> This description is the same as xfs/886, needs update?

"Cross-link rrmapbt block into another file on an rtrmap fs and see if repair fixes it."

> > +#
> > +#-----------------------------------------------------------------------
> > +# Copyright (c) 2016, Oracle and/or its affiliates.  All Rights Reserved.
> > +#
> > +# This program is free software; you can redistribute it and/or
> > +# modify it under the terms of the GNU General Public License as
> > +# published by the Free Software Foundation.
> > +#
> > +# This program is distributed in the hope that it would be useful,
> > +# but WITHOUT ANY WARRANTY; without even the implied warranty of
> > +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> > +# GNU General Public License for more details.
> > +#
> > +# You should have received a copy of the GNU General Public License
> > +# along with this program; if not, write the Free Software Foundation,
> > +# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
> > +#-----------------------------------------------------------------------
> > +
> > +seq=`basename "$0"`
> > +seqres="$RESULT_DIR/$seq"
> > +echo "QA output created by $seq"
> > +
> > +here=`pwd`
> > +tmp=/tmp/$$
> > +status=1    # failure is the default!
> > +trap "_cleanup; exit \$status" 0 1 2 3 15
> > +
> > +_cleanup()
> > +{
> > +	cd /
> > +	rm -rf "$tmp".* $metadump_file
> > +}
> > +
> > +# get standard environment, filters and checks
> > +. ./common/rc
> > +. ./common/filter
> > +
> > +# real QA test starts here
> > +_supported_os Linux
> > +_supported_fs xfs
> > +_require_realtime
> > +_require_xfs_scratch_rmapbt
> > +_require_test_program "punch-alternating"
> > +
> > +rm -f "$seqres.full"
> > +
> > +echo "Format and mount"
> > +_scratch_mkfs | _filter_mkfs 2>$tmp.mkfs >/dev/null
> > +. $tmp.mkfs
> > +cat $tmp.mkfs > "$seqres.full" 2>&1
> > +_scratch_mkfs > "$seqres.full" 2>&1
> > +_scratch_mount
> > +blksz="$(stat -f $SCRATCH_MNT -c '%S')"
> > +
> > +i_ptrs=$(( (isize - 176) / 56 ))
> > +bt_recs=$(( (blksz - 56) / 32 ))
> > +
> > +blocks=$((i_ptrs * bt_recs + 1))
> > +len=$((blocks * rtextsz))
> > +
> > +echo "Create some files"
> > +$XFS_IO_PROG -f -R -c "falloc 0 $len" -c "pwrite -S 0x68 -b 1048576 0 $len" $SCRATCH_MNT/f1 >> $seqres.full
> > +$XFS_IO_PROG -f -R -c "falloc 0 $len" -c "pwrite -S 0x68 -b 1048576 0 $len" $SCRATCH_MNT/f2 >> $seqres.full
> > +./src/punch-alternating $SCRATCH_MNT/f1 >> "$seqres.full"
> > +./src/punch-alternating $SCRATCH_MNT/f2 >> "$seqres.full"
> > +echo garbage > $SCRATCH_MNT/f3
> > +ino=$(stat -c '%i' $SCRATCH_MNT/f3)
> > +_scratch_unmount
> > +
> > +echo "Corrupt fs"
> > +$XFS_DB_PROG -c 'sb 0' -c 'addr rrmapino' \
> > +	-c 'p u3.rtrmapbt.ptrs[1]' `_scratch_xfs_db_options` >> $seqres.full
> > +
> > +fsbno=$($XFS_DB_PROG -c 'sb 0' -c 'addr rrmapino' \
> > +	-c 'p u3.rtrmapbt.ptrs[1]' `_scratch_xfs_db_options` | sed -e 's/^.*://g')
> > +$XFS_DB_PROG -x -c "inode $ino" \
> > +	-c "write u3.bmx[0].startblock $fsbno" `_scratch_xfs_db_options` >> $seqres.full
> > +_scratch_mount
> > +
> > +od -tx1 -Ad -c $SCRATCH_MNT/f3 >> $seqres.full
> > +
> > +echo "Try to create more files"
> > +$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f5 >> $seqres.full 2>&1
> > +test ! -e $SCRATCH_MNT/f5 && echo "should have been able to write f5"
> > +
> > +echo "Repair fs"
> > +_scratch_unmount 2>&1 | _filter_scratch
> > +$XFS_LOGPRINT_PROG -t $extra_log_options $device 2>&1 \
> > +		| tee $tmp.logprint | grep -q "<CLEAN>"
> > +if [ $? -ne 0 ]; then
> > +	echo "Dirty log, zeroing..." >> $seqres.full
> > +	_scratch_xfs_repair -L >> $seqres.full 2>&1
> > +else
> > +	_scratch_xfs_repair >> $seqres.full 2>&1
> > +fi
> > +_scratch_xfs_repair >> $seqres.full 2>&1
> 
> I see this xfs_logprint & repair hunk repeated many times, make it a
> helper?
> 
> > +
> > +echo "Try to create more files (again)"
> > +_scratch_mount
> > +$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f4 >> $seqres.full
> > +
> > +# success, all done
> > +status=0
> > +exit
> > diff --git a/tests/xfs/887.out b/tests/xfs/887.out
> > new file mode 100644
> > index 0000000..30cf032
> > --- /dev/null
> > +++ b/tests/xfs/887.out
> > @@ -0,0 +1,7 @@
> > +QA output created by 887
> > +Format and mount
> > +Create some files
> > +Corrupt fs
> > +Try to create more files
> > +Repair fs
> > +Try to create more files (again)
> > diff --git a/tests/xfs/888 b/tests/xfs/888
> > new file mode 100755
> > index 0000000..dcc9fd8
> > --- /dev/null
> > +++ b/tests/xfs/888
> > @@ -0,0 +1,81 @@
> > +#! /bin/bash
> > +# FS QA Test No. 888
> > +#
> > +# Basic rmap manipulation tests for realtime files.
> > +#
> > +#-----------------------------------------------------------------------
> > +# Copyright (c) 2016, Oracle and/or its affiliates.  All Rights Reserved.
> > +#
> > +# This program is free software; you can redistribute it and/or
> > +# modify it under the terms of the GNU General Public License as
> > +# published by the Free Software Foundation.
> > +#
> > +# This program is distributed in the hope that it would be useful,
> > +# but WITHOUT ANY WARRANTY; without even the implied warranty of
> > +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> > +# GNU General Public License for more details.
> > +#
> > +# You should have received a copy of the GNU General Public License
> > +# along with this program; if not, write the Free Software Foundation,
> > +# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
> > +#-----------------------------------------------------------------------
> > +
> > +seq=`basename "$0"`
> > +seqres="$RESULT_DIR/$seq"
> > +echo "QA output created by $seq"
> > +
> > +here=`pwd`
> > +tmp=/tmp/$$
> > +status=1    # failure is the default!
> > +trap "_cleanup; exit \$status" 0 1 2 3 15
> > +
> > +_cleanup()
> > +{
> > +	cd /
> > +	rm -rf "$tmp".* $metadump_file
> > +}
> > +
> > +# get standard environment, filters and checks
> > +. ./common/rc
> > +. ./common/filter
> > +
> > +# real QA test starts here
> > +_supported_os Linux
> > +_supported_fs xfs
> > +_require_realtime
> > +_require_xfs_scratch_rmapbt
> > +_require_xfs_io_command "falloc"
> > +_require_xfs_io_command "fpunch"
> > +_require_xfs_io_command "fzero"
> > +_require_xfs_io_command "fcollapse"
> > +_require_xfs_io_command "finsert"
> > +
> > +rm -f "$seqres.full"
> > +
> > +echo "Format and mount"
> > +_scratch_mkfs > "$seqres.full" 2>&1
> > +_scratch_mount
> > +blksz=65536
> > +blocks=16
> > +len=$((blocks * blksz))
> > +
> > +echo "Create some files"
> > +$XFS_IO_PROG -f -R -c "falloc 0 $len" -c "pwrite -S 0x68 -b 1048576 0 $len" $SCRATCH_MNT/f1 >> $seqres.full
> > +
> > +echo "Manipulate file"
> > +$XFS_IO_PROG -c "fpunch $blksz $blksz" \
> > +	-c "fzero $((3 * blksz)) $blksz" \
> > +	-c "pwrite -S 0x69 $((5 * blksz)) $blksz" \
> > +	-c "fpunch $((7 * blksz)) $blksz" \
> > +	-c "fsync" \
> > +	-c "pwrite -S 0x70 $((7 * blksz)) $blksz" \
> > +	-c "fcollapse $((9 * blksz)) $blksz" \
> > +	-c "finsert $((10 * blksz)) $blksz" $SCRATCH_MNT/f1 >> $seqres.full
> > +
> > +echo "Check file"
> > +md5sum $SCRATCH_MNT/f1 | _filter_scratch
> > +od -tx1 -Ad -c $SCRATCH_MNT/f1 >> $seqres.full
> > +
> > +# success, all done
> > +status=0
> > +exit
> > diff --git a/tests/xfs/888.out b/tests/xfs/888.out
> > new file mode 100644
> > index 0000000..2587697
> > --- /dev/null
> > +++ b/tests/xfs/888.out
> > @@ -0,0 +1,6 @@
> > +QA output created by 888
> > +Format and mount
> > +Create some files
> > +Manipulate file
> > +Check file
> > +e45c5707fcf6817e914ffb6ce37a0ac7  SCRATCH_MNT/f1
> > diff --git a/tests/xfs/group b/tests/xfs/group
> > index 72580e9..1b0e22a 100644
> > --- a/tests/xfs/group
> > +++ b/tests/xfs/group
> > @@ -313,3 +313,14 @@
> >  875 auto quick clone fsr quota
> >  876 auto quick rmap clone
> >  877 auto quick rmap clone
> > +878 auto quick rmap
> > +879 auto quick rmap
> > +880 auto quick rmap
> > +881 auto quick rmap
> 
> I ran these tests on a test vm with 4 vcpus and 8G mem, seems 880 and
> 881 are not quick enough :)
> 
> xfs/880 39s ... 43s
> xfs/881 40s ... 36s

I suppose not.  Will kick them out of 'quick'.

--D

> 
> Thansk,
> Eryu
> 
> > +882 fuzzers rmap
> > +883 auto quick rmap
> > +884 auto quick rmap
> > +885 auto quick rmap
> > +886 auto quick rmap
> > +887 auto quick rmap
> > +888 auto quick rmap
> > 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 39+ messages in thread

end of thread, other threads:[~2016-09-08 15:40 UTC | newest]

Thread overview: 39+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-25 23:28 [PATCH v8 00/13] xfstests: fixes and new tests for rmap/reflink/fsmap Darrick J. Wong
2016-08-25 23:28 ` Darrick J. Wong
2016-08-25 23:28 ` [PATCH 01/13] tests/xfs: don't run tests if cowextsize isn't present Darrick J. Wong
2016-08-25 23:28   ` Darrick J. Wong
2016-08-25 23:28 ` [PATCH 02/13] xfs/122: decrease the log update done item sizes Darrick J. Wong
2016-08-25 23:28   ` Darrick J. Wong
2016-08-25 23:28 ` [PATCH 03/13] xfs/{130,235}: deal with an unreplayable dirty log Darrick J. Wong
2016-08-25 23:28   ` Darrick J. Wong
2016-08-25 23:28 ` [PATCH 04/13] generic/159, 160: deal with EACCESS -> EPERM transition Darrick J. Wong
2016-08-25 23:28   ` Darrick J. Wong
2016-08-25 23:28 ` [PATCH 05/13] xfs/122: test btree header block sizes Darrick J. Wong
2016-08-25 23:28   ` Darrick J. Wong
2016-08-25 23:28 ` [PATCH 06/13] xfs: fix $XFS_DB_PROG usage Darrick J. Wong
2016-08-25 23:28   ` Darrick J. Wong
2016-09-01  7:37   ` Eryu Guan
2016-09-01  7:37     ` Eryu Guan
2016-09-01 15:57     ` Darrick J. Wong
2016-09-01 15:57       ` Darrick J. Wong
2016-09-01 21:34   ` Dave Chinner
2016-09-01 21:34     ` Dave Chinner
2016-08-25 23:29 ` [PATCH 07/13] xfs: test swapext with reflink Darrick J. Wong
2016-08-25 23:29   ` Darrick J. Wong
2016-08-25 23:29 ` [PATCH 08/13] xfs: more rmapbt tests Darrick J. Wong
2016-08-25 23:29   ` Darrick J. Wong
2016-09-01  8:33   ` Eryu Guan
2016-09-01  8:33     ` Eryu Guan
2016-09-04 17:40     ` Darrick J. Wong
2016-09-04 17:40       ` Darrick J. Wong
2016-08-25 23:29 ` [PATCH 09/13] xfs: test realtime rmapbt code Darrick J. Wong
2016-08-25 23:29   ` Darrick J. Wong
2016-09-08 10:19   ` Eryu Guan
2016-09-08 15:39     ` Darrick J. Wong
2016-08-25 23:29 ` [PATCH 10/13] xfs: test getfsmap ioctl Darrick J. Wong
2016-08-25 23:29   ` Darrick J. Wong
2016-08-25 23:29 ` [PATCH 11/13] xfs: test getbmapx shared extent reporting Darrick J. Wong
2016-08-25 23:29   ` Darrick J. Wong
2016-08-25 23:29 ` [PATCH 12/13] xfs/122: track xfs_scrub_metadata Darrick J. Wong
2016-08-25 23:29 ` [PATCH 13/13] xfs/122: check the ag reservation counter ioctl Darrick J. Wong
2016-08-25 23:29   ` Darrick J. Wong

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.