All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v4.2 00/32] xfstests: test the nfs/cifs/btrfs/xfs reflink/dedupe ioctls
@ 2016-02-11 23:39 ` Darrick J. Wong
  0 siblings, 0 replies; 81+ messages in thread
From: Darrick J. Wong @ 2016-02-11 23:39 UTC (permalink / raw)
  To: david, darrick.wong; +Cc: linux-btrfs, fstests, xfs

Dave Chinner: I've renumbered the new tests and pushed to github[3] if
you'd like to pull.  See the pull request at the end of this message.

This is a patch set against the reflink/dedupe test cases in xfstests.
The first three patches fix errors in the existing reflink tests, some
of which are from Christoph Hellwig.

The next eight patches fix style errors, refactor commonly used code,
remove unnecessary clutter, and add missing _require* checks to the
existing reflink tests.

Patch 12 adds a test checking that unwritten extent conversion does
NOT happen after a directio write to an unwritten extent hits a disk
error.   Due to a bug in the VFS directio code, ext4 can disclose
stale disk contents if an aio dio write fails; XFS suffers this
problem for any failing dio write to an unwritten extent.  Christoph's
kernel patchset titled "vfs/xfs: directio updates to ease COW handling
V2" (and a separate ext4 warning cleanup) is needed to fix this.

Patches 13-31 add more reflink tests focusing on correct CoW behavior
particularly with the CoW extent size hint enabled.  It also provides
a few regression tests for bugs that have been hit while running XFS
reflink, a few tests of the quota accounting when various reflink
operations happen, and a few tests for get_bmapx to ensure that what
it reports is at least somewhat accurate.

Patch 25 adds a few basic reverse-mapping tests for XFS.

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].  All tests should pass on XFS, YMWV on
btrfs and ocfs2.

Comments and questions are, as always, welcome.

--D

[1] https://github.com/djwong/linux/tree/for-dave
[2] https://github.com/djwong/xfsprogs/tree/for-dave
[3] https://github.com/djwong/xfstests/tree/for-dave
[4] https://github.com/djwong/xfs-documentation/tree/for-dave
[5] https://github.com/djwong/man-pages/commits/for-mtk

---

The following changes since commit d98149c205559950c03d6b1d539e45fd35b5630e:

  Fix prerequisite packages to build fstests on Ubuntu (2016-02-08 09:27:15 +1100)

are available in the git repository at:

  https://github.com/djwong/xfstests for-dave

for you to fetch changes up to 6e560dc336d857bc589b1debbf610fd2a3344ccd:

  reflink: kick the slow tests out of the 'quick' group (2016-02-11 15:27:47 -0800)

----------------------------------------------------------------
Darrick J. Wong (32):
      generic/182: this is a dedupe test, check for dedupe
      xfstests: filter whitespace in 128 and 132
      xfstests: make _scratch_mkfs_blocksized usable
      reflink: remove redundant filesystem checks from the end of the tests
      reflink: remove unnecessary umounts from test code
      common/dmerror: add some more dmerror routines
      common: create _require_test_program to look for programs in src/
      common: provide a method to repair the scratch fs
      reflink: refactor mixed block creation code
      reflink: fix style problems in existing tests
      reflink: add _require_odirect to the directio tests
      dio: unwritten conversion bug tests
      reflink: test intersecting CoW and falloc/fpunch/fzero/fcollapse/finsert/ftrunc
      reflink: test CoW behavior with IO errors
      reflink: test CoW operations against the source file
      reflink: ensure that we can handle reflinking a lot of extents
      xfs: more reflink tests
      xfs/122: support refcount/rmap data structures
      xfs: test fragmentation characteristics of copy-on-write
      reflink: high offset reflink and dedupe tests
      reflink: test xfs cow behavior when the filesystem crashes
      reflink: test quota accounting
      reflink: test CoW across a mixed range of block types with cowextsize set
      xfs: test the automatic cowextsize extent garbage collector
      xfs: test rmapbt functionality
      reflink: test aio copy on write
      xfs: aio cow tests
      xfs: test xfs_getbmapx behavior with shared extents
      reflink: test reflink+cow+enospc all at the same time
      xfs: ensure that we don't crash when freeing the ag reservations on a ro mount
      xfs: test source CoW across mixed block types with cowextsz set
      reflink: kick the slow tests out of the 'quick' group

 .gitignore                  |   2 +
 common/dmerror              |  27 ++-
 common/rc                   | 117 +++++++++++
 common/reflink              | 202 +++++++++++++++---
 src/Makefile                |   2 +-
 src/aio-dio-regress/aiocp.c | 489 ++++++++++++++++++++++++++++++++++++++++++++
 src/punch-alternating.c     |  59 ++++++
 tests/btrfs/100             |   2 +-
 tests/btrfs/101             |   2 +-
 tests/generic/010           |   2 +-
 tests/generic/094           |   2 +-
 tests/generic/110           |   2 +-
 tests/generic/111           |   2 +-
 tests/generic/115           |   2 +-
 tests/generic/116           |  44 ++--
 tests/generic/118           |  42 ++--
 tests/generic/119           | 102 ++++-----
 tests/generic/121           |  44 ++--
 tests/generic/122           |  44 ++--
 tests/generic/134           |  78 +++----
 tests/generic/136           |  78 +++----
 tests/generic/137           |  44 ++--
 tests/generic/138           | 104 +++++-----
 tests/generic/139           |  99 ++++-----
 tests/generic/140           | 104 +++++-----
 tests/generic/142           |  37 ++--
 tests/generic/143           |  38 ++--
 tests/generic/144           | 124 +++++------
 tests/generic/145           | 150 +++++++-------
 tests/generic/146           | 132 ++++++------
 tests/generic/147           | 146 ++++++-------
 tests/generic/148           |  84 ++++----
 tests/generic/149           | 132 ++++++------
 tests/generic/150           |  23 ++-
 tests/generic/151           |  35 ++--
 tests/generic/152           |  39 ++--
 tests/generic/153           |  41 ++--
 tests/generic/154           |  43 ++--
 tests/generic/155           |  40 ++--
 tests/generic/156           |  43 ++--
 tests/generic/157           |  64 +++---
 tests/generic/157.out       |   1 -
 tests/generic/158           |  66 +++---
 tests/generic/158.out       |   1 -
 tests/generic/159           |  19 +-
 tests/generic/160           |  19 +-
 tests/generic/161           |  30 ++-
 tests/generic/161.out       |   2 -
 tests/generic/162           |  36 ++--
 tests/generic/162.out       |   2 -
 tests/generic/163           |  36 ++--
 tests/generic/163.out       |   2 -
 tests/generic/164           |  40 ++--
 tests/generic/164.out       |   2 -
 tests/generic/165           |  39 ++--
 tests/generic/165.out       |   2 -
 tests/generic/166           |  36 ++--
 tests/generic/166.out       |   2 -
 tests/generic/167           |  35 ++--
 tests/generic/167.out       |   2 -
 tests/generic/168           |  37 ++--
 tests/generic/168.out       |   2 -
 tests/generic/170           |  38 ++--
 tests/generic/170.out       |   2 -
 tests/generic/171           |  62 +++---
 tests/generic/171.out       |   1 -
 tests/generic/172           |  62 +++---
 tests/generic/172.out       |   1 -
 tests/generic/173           |  54 +++--
 tests/generic/173.out       |   1 -
 tests/generic/174           |  63 +++---
 tests/generic/174.out       |   1 -
 tests/generic/175           |  47 ++---
 tests/generic/175.out       |   5 +
 tests/generic/176           |  54 +++--
 tests/generic/176.out       |   5 +-
 tests/generic/178           |  31 +--
 tests/generic/179           |  50 ++---
 tests/generic/180           |  50 ++---
 tests/generic/181           |  38 ++--
 tests/generic/182           |  89 ++++----
 tests/generic/183           |  55 +++--
 tests/generic/183.out       |   1 -
 tests/generic/185           |  54 +++--
 tests/generic/185.out       |   1 -
 tests/generic/186           |  73 ++++---
 tests/generic/186.out       |   1 -
 tests/generic/187           |  74 +++----
 tests/generic/187.out       |   1 -
 tests/generic/188           |  47 ++---
 tests/generic/188.out       |   1 -
 tests/generic/189           |  46 ++---
 tests/generic/189.out       |   1 -
 tests/generic/190           |  47 ++---
 tests/generic/190.out       |   1 -
 tests/generic/191           |  46 ++---
 tests/generic/191.out       |   1 -
 tests/generic/194           |  52 ++---
 tests/generic/194.out       |   1 -
 tests/generic/195           |  51 ++---
 tests/generic/195.out       |   1 -
 tests/generic/196           |  49 ++---
 tests/generic/196.out       |   1 -
 tests/generic/197           |  48 ++---
 tests/generic/197.out       |   1 -
 tests/generic/199           |  70 ++-----
 tests/generic/199.out       |   5 +-
 tests/generic/200           |  70 ++-----
 tests/generic/200.out       |   5 +-
 tests/generic/201           |  42 ++--
 tests/generic/201.out       |   1 -
 tests/generic/202           |  41 ++--
 tests/generic/202.out       |   1 -
 tests/generic/203           |  42 ++--
 tests/generic/203.out       |   1 -
 tests/generic/205           |  51 +++--
 tests/generic/205.out       |   1 -
 tests/generic/206           |  52 +++--
 tests/generic/206.out       |   1 -
 tests/generic/216           |  51 +++--
 tests/generic/216.out       |   1 -
 tests/generic/217           |  52 +++--
 tests/generic/217.out       |   1 -
 tests/generic/218           |  43 ++--
 tests/generic/218.out       |   1 -
 tests/generic/220           |  44 ++--
 tests/generic/220.out       |   1 -
 tests/generic/222           |  51 +++--
 tests/generic/222.out       |   1 -
 tests/generic/225           |   2 +-
 tests/generic/227           |  52 +++--
 tests/generic/227.out       |   1 -
 tests/generic/229           |  77 ++++---
 tests/generic/229.out       |   1 -
 tests/generic/238           |  78 ++++---
 tests/generic/238.out       |   1 -
 tests/generic/242           |  51 +++--
 tests/generic/242.out       |   1 -
 tests/generic/243           |  52 +++--
 tests/generic/243.out       |   1 -
 tests/generic/250           | 100 +++++++++
 tests/generic/250.out       |  10 +
 tests/generic/252           | 103 ++++++++++
 tests/generic/252.out       |  10 +
 tests/generic/253           |  90 ++++++++
 tests/generic/253.out       |  12 ++
 tests/generic/254           |  90 ++++++++
 tests/generic/254.out       |  12 ++
 tests/generic/259           |  90 ++++++++
 tests/generic/259.out       |  12 ++
 tests/generic/261           |  90 ++++++++
 tests/generic/261.out       |  12 ++
 tests/generic/262           |  93 +++++++++
 tests/generic/262.out       |  12 ++
 tests/generic/264           |  90 ++++++++
 tests/generic/264.out       |  12 ++
 tests/generic/265           |  99 +++++++++
 tests/generic/265.out       |  11 +
 tests/generic/266           |  97 +++++++++
 tests/generic/266.out       |  11 +
 tests/generic/267           | 100 +++++++++
 tests/generic/267.out       |  10 +
 tests/generic/268           | 103 ++++++++++
 tests/generic/268.out       |  12 ++
 tests/generic/271           | 100 +++++++++
 tests/generic/271.out       |  11 +
 tests/generic/272           |  98 +++++++++
 tests/generic/272.out       |  11 +
 tests/generic/276           | 101 +++++++++
 tests/generic/276.out       |  11 +
 tests/generic/278           | 104 ++++++++++
 tests/generic/278.out       |  12 ++
 tests/generic/279           | 100 +++++++++
 tests/generic/279.out       |  11 +
 tests/generic/281           |  98 +++++++++
 tests/generic/281.out       |  11 +
 tests/generic/282           | 101 +++++++++
 tests/generic/282.out       |  10 +
 tests/generic/283           | 104 ++++++++++
 tests/generic/283.out       |  12 ++
 tests/generic/284           |  89 ++++++++
 tests/generic/284.out       |  12 ++
 tests/generic/285           |   2 +-
 tests/generic/286           |   2 +-
 tests/generic/287           |  90 ++++++++
 tests/generic/287.out       |  12 ++
 tests/generic/289           |  91 +++++++++
 tests/generic/289.out       |  12 ++
 tests/generic/290           |  92 +++++++++
 tests/generic/290.out       |  12 ++
 tests/generic/291           |  91 +++++++++
 tests/generic/291.out       |  12 ++
 tests/generic/292           |  92 +++++++++
 tests/generic/292.out       |  12 ++
 tests/generic/293           |  93 +++++++++
 tests/generic/293.out       |  12 ++
 tests/generic/295           |  94 +++++++++
 tests/generic/295.out       |  12 ++
 tests/generic/296           |  90 ++++++++
 tests/generic/296.out       |  12 ++
 tests/generic/297           |  99 +++++++++
 tests/generic/297.out       |   6 +
 tests/generic/298           |  99 +++++++++
 tests/generic/298.out       |   6 +
 tests/generic/301           | 100 +++++++++
 tests/generic/301.out       |  10 +
 tests/generic/302           | 101 +++++++++
 tests/generic/302.out       |  10 +
 tests/generic/303           |  98 +++++++++
 tests/generic/303.out       |  21 ++
 tests/generic/304           |  99 +++++++++
 tests/generic/304.out       |  22 ++
 tests/generic/305           | 100 +++++++++
 tests/generic/305.out       |  22 ++
 tests/generic/311           |   2 +-
 tests/generic/326           | 101 +++++++++
 tests/generic/326.out       |  22 ++
 tests/generic/327           |  87 ++++++++
 tests/generic/327.out       |  12 ++
 tests/generic/328           | 105 ++++++++++
 tests/generic/328.out       |  25 +++
 tests/generic/329           | 102 +++++++++
 tests/generic/329.out       |  12 ++
 tests/generic/330           |  93 +++++++++
 tests/generic/330.out       |  11 +
 tests/generic/331           | 104 ++++++++++
 tests/generic/331.out       |  12 ++
 tests/generic/332           |  94 +++++++++
 tests/generic/332.out       |  11 +
 tests/generic/333           |  99 +++++++++
 tests/generic/333.out       |   4 +
 tests/generic/334           |  98 +++++++++
 tests/generic/334.out       |   4 +
 tests/generic/group         |  71 +++++--
 tests/xfs/032               |   3 +-
 tests/xfs/044               |   2 +-
 tests/xfs/122               |   3 +
 tests/xfs/122.out           |   4 +
 tests/xfs/127               |  33 ++-
 tests/xfs/127.out           |   1 -
 tests/xfs/128               |  97 +++++----
 tests/xfs/128.out           |   9 +-
 tests/xfs/129               |  33 ++-
 tests/xfs/131               |  25 +--
 tests/xfs/131.out           |   1 -
 tests/xfs/132               |  53 ++---
 tests/xfs/132.out           |  40 ++--
 tests/xfs/139               |  35 ++--
 tests/xfs/139.out           |   1 -
 tests/xfs/140               |  41 ++--
 tests/xfs/140.out           |   1 -
 tests/xfs/169               |  86 ++++++++
 tests/xfs/169.out           |   7 +
 tests/xfs/179               | 118 +++++++++++
 tests/xfs/179.out           |  10 +
 tests/xfs/180               | 106 ++++++++++
 tests/xfs/180.out           |  11 +
 tests/xfs/182               | 107 ++++++++++
 tests/xfs/182.out           |  12 ++
 tests/xfs/184               | 105 ++++++++++
 tests/xfs/184.out           |  10 +
 tests/xfs/192               | 106 ++++++++++
 tests/xfs/192.out           |  10 +
 tests/xfs/193               | 102 +++++++++
 tests/xfs/193.out           |  10 +
 tests/xfs/198               | 103 ++++++++++
 tests/xfs/198.out           |  10 +
 tests/xfs/200               | 109 ++++++++++
 tests/xfs/200.out           |  10 +
 tests/xfs/204               | 110 ++++++++++
 tests/xfs/204.out           |  10 +
 tests/xfs/207               | 101 +++++++++
 tests/xfs/207.out           |  18 ++
 tests/xfs/208               | 138 +++++++++++++
 tests/xfs/208.out           |  13 ++
 tests/xfs/209               |  82 ++++++++
 tests/xfs/209.out           |  13 ++
 tests/xfs/210               | 108 ++++++++++
 tests/xfs/210.out           |  23 +++
 tests/xfs/211               | 107 ++++++++++
 tests/xfs/211.out           |  11 +
 tests/xfs/212               |  99 +++++++++
 tests/xfs/212.out           |  13 ++
 tests/xfs/213               | 105 ++++++++++
 tests/xfs/213.out           |  22 ++
 tests/xfs/214               | 106 ++++++++++
 tests/xfs/214.out           |  22 ++
 tests/xfs/215               | 102 +++++++++
 tests/xfs/215.out           |  13 ++
 tests/xfs/218               | 101 +++++++++
 tests/xfs/218.out           |  13 ++
 tests/xfs/219               | 102 +++++++++
 tests/xfs/219.out           |  13 ++
 tests/xfs/221               | 101 +++++++++
 tests/xfs/221.out           |  13 ++
 tests/xfs/223               | 104 ++++++++++
 tests/xfs/223.out           |  13 ++
 tests/xfs/224               | 103 ++++++++++
 tests/xfs/224.out           |  13 ++
 tests/xfs/225               | 102 +++++++++
 tests/xfs/225.out           |  13 ++
 tests/xfs/226               | 101 +++++++++
 tests/xfs/226.out           |  13 ++
 tests/xfs/228               | 110 ++++++++++
 tests/xfs/228.out           |  13 ++
 tests/xfs/230               | 110 ++++++++++
 tests/xfs/230.out           |  13 ++
 tests/xfs/231               | 130 ++++++++++++
 tests/xfs/231.out           |  16 ++
 tests/xfs/232               | 132 ++++++++++++
 tests/xfs/232.out           |  16 ++
 tests/xfs/233               |  73 +++++++
 tests/xfs/233.out           |   5 +
 tests/xfs/234               |  88 ++++++++
 tests/xfs/234.out           |   6 +
 tests/xfs/235               | 108 ++++++++++
 tests/xfs/235.out           |  14 ++
 tests/xfs/236               |  88 ++++++++
 tests/xfs/236.out           |   7 +
 tests/xfs/237               | 105 ++++++++++
 tests/xfs/237.out           |  12 ++
 tests/xfs/239               |  98 +++++++++
 tests/xfs/239.out           |  11 +
 tests/xfs/240               | 110 ++++++++++
 tests/xfs/240.out           |  12 ++
 tests/xfs/241               | 100 +++++++++
 tests/xfs/241.out           |  11 +
 tests/xfs/243               | 165 +++++++++++++++
 tests/xfs/243.out           |  26 +++
 tests/xfs/245               |  95 +++++++++
 tests/xfs/245.out           |  12 ++
 tests/xfs/246               |  65 ++++++
 tests/xfs/246.out           |   6 +
 tests/xfs/247               |  57 ++++++
 tests/xfs/247.out           |   2 +
 tests/xfs/248               |  91 +++++++++
 tests/xfs/248.out           |  12 ++
 tests/xfs/249               |  92 +++++++++
 tests/xfs/249.out           |  12 ++
 tests/xfs/251               |  93 +++++++++
 tests/xfs/251.out           |  12 ++
 tests/xfs/254               |  94 +++++++++
 tests/xfs/254.out           |  12 ++
 tests/xfs/255               |  93 +++++++++
 tests/xfs/255.out           |  12 ++
 tests/xfs/256               |  94 +++++++++
 tests/xfs/256.out           |  12 ++
 tests/xfs/257               |  95 +++++++++
 tests/xfs/257.out           |  12 ++
 tests/xfs/258               |  96 +++++++++
 tests/xfs/258.out           |  12 ++
 tests/xfs/group             |  56 ++++-
 352 files changed, 13925 insertions(+), 2729 deletions(-)
 create mode 100644 src/aio-dio-regress/aiocp.c
 create mode 100644 src/punch-alternating.c
 create mode 100755 tests/generic/250
 create mode 100644 tests/generic/250.out
 create mode 100755 tests/generic/252
 create mode 100644 tests/generic/252.out
 create mode 100755 tests/generic/253
 create mode 100644 tests/generic/253.out
 create mode 100755 tests/generic/254
 create mode 100644 tests/generic/254.out
 create mode 100755 tests/generic/259
 create mode 100644 tests/generic/259.out
 create mode 100755 tests/generic/261
 create mode 100644 tests/generic/261.out
 create mode 100755 tests/generic/262
 create mode 100644 tests/generic/262.out
 create mode 100755 tests/generic/264
 create mode 100644 tests/generic/264.out
 create mode 100755 tests/generic/265
 create mode 100644 tests/generic/265.out
 create mode 100755 tests/generic/266
 create mode 100644 tests/generic/266.out
 create mode 100755 tests/generic/267
 create mode 100644 tests/generic/267.out
 create mode 100755 tests/generic/268
 create mode 100644 tests/generic/268.out
 create mode 100755 tests/generic/271
 create mode 100644 tests/generic/271.out
 create mode 100755 tests/generic/272
 create mode 100644 tests/generic/272.out
 create mode 100755 tests/generic/276
 create mode 100644 tests/generic/276.out
 create mode 100755 tests/generic/278
 create mode 100644 tests/generic/278.out
 create mode 100755 tests/generic/279
 create mode 100644 tests/generic/279.out
 create mode 100755 tests/generic/281
 create mode 100644 tests/generic/281.out
 create mode 100755 tests/generic/282
 create mode 100644 tests/generic/282.out
 create mode 100755 tests/generic/283
 create mode 100644 tests/generic/283.out
 create mode 100755 tests/generic/284
 create mode 100644 tests/generic/284.out
 create mode 100755 tests/generic/287
 create mode 100644 tests/generic/287.out
 create mode 100755 tests/generic/289
 create mode 100644 tests/generic/289.out
 create mode 100755 tests/generic/290
 create mode 100644 tests/generic/290.out
 create mode 100755 tests/generic/291
 create mode 100644 tests/generic/291.out
 create mode 100755 tests/generic/292
 create mode 100644 tests/generic/292.out
 create mode 100755 tests/generic/293
 create mode 100644 tests/generic/293.out
 create mode 100755 tests/generic/295
 create mode 100644 tests/generic/295.out
 create mode 100755 tests/generic/296
 create mode 100644 tests/generic/296.out
 create mode 100755 tests/generic/297
 create mode 100644 tests/generic/297.out
 create mode 100755 tests/generic/298
 create mode 100644 tests/generic/298.out
 create mode 100755 tests/generic/301
 create mode 100644 tests/generic/301.out
 create mode 100755 tests/generic/302
 create mode 100644 tests/generic/302.out
 create mode 100755 tests/generic/303
 create mode 100644 tests/generic/303.out
 create mode 100755 tests/generic/304
 create mode 100644 tests/generic/304.out
 create mode 100755 tests/generic/305
 create mode 100644 tests/generic/305.out
 create mode 100755 tests/generic/326
 create mode 100644 tests/generic/326.out
 create mode 100755 tests/generic/327
 create mode 100644 tests/generic/327.out
 create mode 100755 tests/generic/328
 create mode 100644 tests/generic/328.out
 create mode 100755 tests/generic/329
 create mode 100644 tests/generic/329.out
 create mode 100755 tests/generic/330
 create mode 100644 tests/generic/330.out
 create mode 100755 tests/generic/331
 create mode 100644 tests/generic/331.out
 create mode 100755 tests/generic/332
 create mode 100644 tests/generic/332.out
 create mode 100755 tests/generic/333
 create mode 100644 tests/generic/333.out
 create mode 100755 tests/generic/334
 create mode 100644 tests/generic/334.out
 create mode 100755 tests/xfs/169
 create mode 100644 tests/xfs/169.out
 create mode 100755 tests/xfs/179
 create mode 100644 tests/xfs/179.out
 create mode 100755 tests/xfs/180
 create mode 100644 tests/xfs/180.out
 create mode 100755 tests/xfs/182
 create mode 100644 tests/xfs/182.out
 create mode 100755 tests/xfs/184
 create mode 100644 tests/xfs/184.out
 create mode 100755 tests/xfs/192
 create mode 100644 tests/xfs/192.out
 create mode 100755 tests/xfs/193
 create mode 100644 tests/xfs/193.out
 create mode 100755 tests/xfs/198
 create mode 100644 tests/xfs/198.out
 create mode 100755 tests/xfs/200
 create mode 100644 tests/xfs/200.out
 create mode 100755 tests/xfs/204
 create mode 100644 tests/xfs/204.out
 create mode 100755 tests/xfs/207
 create mode 100644 tests/xfs/207.out
 create mode 100755 tests/xfs/208
 create mode 100644 tests/xfs/208.out
 create mode 100755 tests/xfs/209
 create mode 100644 tests/xfs/209.out
 create mode 100755 tests/xfs/210
 create mode 100644 tests/xfs/210.out
 create mode 100755 tests/xfs/211
 create mode 100644 tests/xfs/211.out
 create mode 100755 tests/xfs/212
 create mode 100644 tests/xfs/212.out
 create mode 100755 tests/xfs/213
 create mode 100644 tests/xfs/213.out
 create mode 100755 tests/xfs/214
 create mode 100644 tests/xfs/214.out
 create mode 100755 tests/xfs/215
 create mode 100644 tests/xfs/215.out
 create mode 100755 tests/xfs/218
 create mode 100644 tests/xfs/218.out
 create mode 100755 tests/xfs/219
 create mode 100644 tests/xfs/219.out
 create mode 100755 tests/xfs/221
 create mode 100644 tests/xfs/221.out
 create mode 100755 tests/xfs/223
 create mode 100644 tests/xfs/223.out
 create mode 100755 tests/xfs/224
 create mode 100644 tests/xfs/224.out
 create mode 100755 tests/xfs/225
 create mode 100644 tests/xfs/225.out
 create mode 100755 tests/xfs/226
 create mode 100644 tests/xfs/226.out
 create mode 100755 tests/xfs/228
 create mode 100644 tests/xfs/228.out
 create mode 100755 tests/xfs/230
 create mode 100644 tests/xfs/230.out
 create mode 100755 tests/xfs/231
 create mode 100644 tests/xfs/231.out
 create mode 100755 tests/xfs/232
 create mode 100644 tests/xfs/232.out
 create mode 100755 tests/xfs/233
 create mode 100644 tests/xfs/233.out
 create mode 100755 tests/xfs/234
 create mode 100644 tests/xfs/234.out
 create mode 100755 tests/xfs/235
 create mode 100644 tests/xfs/235.out
 create mode 100755 tests/xfs/236
 create mode 100644 tests/xfs/236.out
 create mode 100755 tests/xfs/237
 create mode 100644 tests/xfs/237.out
 create mode 100755 tests/xfs/239
 create mode 100644 tests/xfs/239.out
 create mode 100755 tests/xfs/240
 create mode 100644 tests/xfs/240.out
 create mode 100755 tests/xfs/241
 create mode 100644 tests/xfs/241.out
 create mode 100755 tests/xfs/243
 create mode 100644 tests/xfs/243.out
 create mode 100755 tests/xfs/245
 create mode 100644 tests/xfs/245.out
 create mode 100755 tests/xfs/246
 create mode 100644 tests/xfs/246.out
 create mode 100755 tests/xfs/247
 create mode 100644 tests/xfs/247.out
 create mode 100755 tests/xfs/248
 create mode 100644 tests/xfs/248.out
 create mode 100755 tests/xfs/249
 create mode 100644 tests/xfs/249.out
 create mode 100755 tests/xfs/251
 create mode 100644 tests/xfs/251.out
 create mode 100755 tests/xfs/254
 create mode 100644 tests/xfs/254.out
 create mode 100755 tests/xfs/255
 create mode 100644 tests/xfs/255.out
 create mode 100755 tests/xfs/256
 create mode 100644 tests/xfs/256.out
 create mode 100755 tests/xfs/257
 create mode 100644 tests/xfs/257.out
 create mode 100755 tests/xfs/258
 create mode 100644 tests/xfs/258.out

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

* [PATCH v4.2 00/32] xfstests: test the nfs/cifs/btrfs/xfs reflink/dedupe ioctls
@ 2016-02-11 23:39 ` Darrick J. Wong
  0 siblings, 0 replies; 81+ messages in thread
From: Darrick J. Wong @ 2016-02-11 23:39 UTC (permalink / raw)
  To: david, darrick.wong; +Cc: fstests, linux-btrfs, xfs

Dave Chinner: I've renumbered the new tests and pushed to github[3] if
you'd like to pull.  See the pull request at the end of this message.

This is a patch set against the reflink/dedupe test cases in xfstests.
The first three patches fix errors in the existing reflink tests, some
of which are from Christoph Hellwig.

The next eight patches fix style errors, refactor commonly used code,
remove unnecessary clutter, and add missing _require* checks to the
existing reflink tests.

Patch 12 adds a test checking that unwritten extent conversion does
NOT happen after a directio write to an unwritten extent hits a disk
error.   Due to a bug in the VFS directio code, ext4 can disclose
stale disk contents if an aio dio write fails; XFS suffers this
problem for any failing dio write to an unwritten extent.  Christoph's
kernel patchset titled "vfs/xfs: directio updates to ease COW handling
V2" (and a separate ext4 warning cleanup) is needed to fix this.

Patches 13-31 add more reflink tests focusing on correct CoW behavior
particularly with the CoW extent size hint enabled.  It also provides
a few regression tests for bugs that have been hit while running XFS
reflink, a few tests of the quota accounting when various reflink
operations happen, and a few tests for get_bmapx to ensure that what
it reports is at least somewhat accurate.

Patch 25 adds a few basic reverse-mapping tests for XFS.

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].  All tests should pass on XFS, YMWV on
btrfs and ocfs2.

Comments and questions are, as always, welcome.

--D

[1] https://github.com/djwong/linux/tree/for-dave
[2] https://github.com/djwong/xfsprogs/tree/for-dave
[3] https://github.com/djwong/xfstests/tree/for-dave
[4] https://github.com/djwong/xfs-documentation/tree/for-dave
[5] https://github.com/djwong/man-pages/commits/for-mtk

---

The following changes since commit d98149c205559950c03d6b1d539e45fd35b5630e:

  Fix prerequisite packages to build fstests on Ubuntu (2016-02-08 09:27:15 +1100)

are available in the git repository at:

  https://github.com/djwong/xfstests for-dave

for you to fetch changes up to 6e560dc336d857bc589b1debbf610fd2a3344ccd:

  reflink: kick the slow tests out of the 'quick' group (2016-02-11 15:27:47 -0800)

----------------------------------------------------------------
Darrick J. Wong (32):
      generic/182: this is a dedupe test, check for dedupe
      xfstests: filter whitespace in 128 and 132
      xfstests: make _scratch_mkfs_blocksized usable
      reflink: remove redundant filesystem checks from the end of the tests
      reflink: remove unnecessary umounts from test code
      common/dmerror: add some more dmerror routines
      common: create _require_test_program to look for programs in src/
      common: provide a method to repair the scratch fs
      reflink: refactor mixed block creation code
      reflink: fix style problems in existing tests
      reflink: add _require_odirect to the directio tests
      dio: unwritten conversion bug tests
      reflink: test intersecting CoW and falloc/fpunch/fzero/fcollapse/finsert/ftrunc
      reflink: test CoW behavior with IO errors
      reflink: test CoW operations against the source file
      reflink: ensure that we can handle reflinking a lot of extents
      xfs: more reflink tests
      xfs/122: support refcount/rmap data structures
      xfs: test fragmentation characteristics of copy-on-write
      reflink: high offset reflink and dedupe tests
      reflink: test xfs cow behavior when the filesystem crashes
      reflink: test quota accounting
      reflink: test CoW across a mixed range of block types with cowextsize set
      xfs: test the automatic cowextsize extent garbage collector
      xfs: test rmapbt functionality
      reflink: test aio copy on write
      xfs: aio cow tests
      xfs: test xfs_getbmapx behavior with shared extents
      reflink: test reflink+cow+enospc all at the same time
      xfs: ensure that we don't crash when freeing the ag reservations on a ro mount
      xfs: test source CoW across mixed block types with cowextsz set
      reflink: kick the slow tests out of the 'quick' group

 .gitignore                  |   2 +
 common/dmerror              |  27 ++-
 common/rc                   | 117 +++++++++++
 common/reflink              | 202 +++++++++++++++---
 src/Makefile                |   2 +-
 src/aio-dio-regress/aiocp.c | 489 ++++++++++++++++++++++++++++++++++++++++++++
 src/punch-alternating.c     |  59 ++++++
 tests/btrfs/100             |   2 +-
 tests/btrfs/101             |   2 +-
 tests/generic/010           |   2 +-
 tests/generic/094           |   2 +-
 tests/generic/110           |   2 +-
 tests/generic/111           |   2 +-
 tests/generic/115           |   2 +-
 tests/generic/116           |  44 ++--
 tests/generic/118           |  42 ++--
 tests/generic/119           | 102 ++++-----
 tests/generic/121           |  44 ++--
 tests/generic/122           |  44 ++--
 tests/generic/134           |  78 +++----
 tests/generic/136           |  78 +++----
 tests/generic/137           |  44 ++--
 tests/generic/138           | 104 +++++-----
 tests/generic/139           |  99 ++++-----
 tests/generic/140           | 104 +++++-----
 tests/generic/142           |  37 ++--
 tests/generic/143           |  38 ++--
 tests/generic/144           | 124 +++++------
 tests/generic/145           | 150 +++++++-------
 tests/generic/146           | 132 ++++++------
 tests/generic/147           | 146 ++++++-------
 tests/generic/148           |  84 ++++----
 tests/generic/149           | 132 ++++++------
 tests/generic/150           |  23 ++-
 tests/generic/151           |  35 ++--
 tests/generic/152           |  39 ++--
 tests/generic/153           |  41 ++--
 tests/generic/154           |  43 ++--
 tests/generic/155           |  40 ++--
 tests/generic/156           |  43 ++--
 tests/generic/157           |  64 +++---
 tests/generic/157.out       |   1 -
 tests/generic/158           |  66 +++---
 tests/generic/158.out       |   1 -
 tests/generic/159           |  19 +-
 tests/generic/160           |  19 +-
 tests/generic/161           |  30 ++-
 tests/generic/161.out       |   2 -
 tests/generic/162           |  36 ++--
 tests/generic/162.out       |   2 -
 tests/generic/163           |  36 ++--
 tests/generic/163.out       |   2 -
 tests/generic/164           |  40 ++--
 tests/generic/164.out       |   2 -
 tests/generic/165           |  39 ++--
 tests/generic/165.out       |   2 -
 tests/generic/166           |  36 ++--
 tests/generic/166.out       |   2 -
 tests/generic/167           |  35 ++--
 tests/generic/167.out       |   2 -
 tests/generic/168           |  37 ++--
 tests/generic/168.out       |   2 -
 tests/generic/170           |  38 ++--
 tests/generic/170.out       |   2 -
 tests/generic/171           |  62 +++---
 tests/generic/171.out       |   1 -
 tests/generic/172           |  62 +++---
 tests/generic/172.out       |   1 -
 tests/generic/173           |  54 +++--
 tests/generic/173.out       |   1 -
 tests/generic/174           |  63 +++---
 tests/generic/174.out       |   1 -
 tests/generic/175           |  47 ++---
 tests/generic/175.out       |   5 +
 tests/generic/176           |  54 +++--
 tests/generic/176.out       |   5 +-
 tests/generic/178           |  31 +--
 tests/generic/179           |  50 ++---
 tests/generic/180           |  50 ++---
 tests/generic/181           |  38 ++--
 tests/generic/182           |  89 ++++----
 tests/generic/183           |  55 +++--
 tests/generic/183.out       |   1 -
 tests/generic/185           |  54 +++--
 tests/generic/185.out       |   1 -
 tests/generic/186           |  73 ++++---
 tests/generic/186.out       |   1 -
 tests/generic/187           |  74 +++----
 tests/generic/187.out       |   1 -
 tests/generic/188           |  47 ++---
 tests/generic/188.out       |   1 -
 tests/generic/189           |  46 ++---
 tests/generic/189.out       |   1 -
 tests/generic/190           |  47 ++---
 tests/generic/190.out       |   1 -
 tests/generic/191           |  46 ++---
 tests/generic/191.out       |   1 -
 tests/generic/194           |  52 ++---
 tests/generic/194.out       |   1 -
 tests/generic/195           |  51 ++---
 tests/generic/195.out       |   1 -
 tests/generic/196           |  49 ++---
 tests/generic/196.out       |   1 -
 tests/generic/197           |  48 ++---
 tests/generic/197.out       |   1 -
 tests/generic/199           |  70 ++-----
 tests/generic/199.out       |   5 +-
 tests/generic/200           |  70 ++-----
 tests/generic/200.out       |   5 +-
 tests/generic/201           |  42 ++--
 tests/generic/201.out       |   1 -
 tests/generic/202           |  41 ++--
 tests/generic/202.out       |   1 -
 tests/generic/203           |  42 ++--
 tests/generic/203.out       |   1 -
 tests/generic/205           |  51 +++--
 tests/generic/205.out       |   1 -
 tests/generic/206           |  52 +++--
 tests/generic/206.out       |   1 -
 tests/generic/216           |  51 +++--
 tests/generic/216.out       |   1 -
 tests/generic/217           |  52 +++--
 tests/generic/217.out       |   1 -
 tests/generic/218           |  43 ++--
 tests/generic/218.out       |   1 -
 tests/generic/220           |  44 ++--
 tests/generic/220.out       |   1 -
 tests/generic/222           |  51 +++--
 tests/generic/222.out       |   1 -
 tests/generic/225           |   2 +-
 tests/generic/227           |  52 +++--
 tests/generic/227.out       |   1 -
 tests/generic/229           |  77 ++++---
 tests/generic/229.out       |   1 -
 tests/generic/238           |  78 ++++---
 tests/generic/238.out       |   1 -
 tests/generic/242           |  51 +++--
 tests/generic/242.out       |   1 -
 tests/generic/243           |  52 +++--
 tests/generic/243.out       |   1 -
 tests/generic/250           | 100 +++++++++
 tests/generic/250.out       |  10 +
 tests/generic/252           | 103 ++++++++++
 tests/generic/252.out       |  10 +
 tests/generic/253           |  90 ++++++++
 tests/generic/253.out       |  12 ++
 tests/generic/254           |  90 ++++++++
 tests/generic/254.out       |  12 ++
 tests/generic/259           |  90 ++++++++
 tests/generic/259.out       |  12 ++
 tests/generic/261           |  90 ++++++++
 tests/generic/261.out       |  12 ++
 tests/generic/262           |  93 +++++++++
 tests/generic/262.out       |  12 ++
 tests/generic/264           |  90 ++++++++
 tests/generic/264.out       |  12 ++
 tests/generic/265           |  99 +++++++++
 tests/generic/265.out       |  11 +
 tests/generic/266           |  97 +++++++++
 tests/generic/266.out       |  11 +
 tests/generic/267           | 100 +++++++++
 tests/generic/267.out       |  10 +
 tests/generic/268           | 103 ++++++++++
 tests/generic/268.out       |  12 ++
 tests/generic/271           | 100 +++++++++
 tests/generic/271.out       |  11 +
 tests/generic/272           |  98 +++++++++
 tests/generic/272.out       |  11 +
 tests/generic/276           | 101 +++++++++
 tests/generic/276.out       |  11 +
 tests/generic/278           | 104 ++++++++++
 tests/generic/278.out       |  12 ++
 tests/generic/279           | 100 +++++++++
 tests/generic/279.out       |  11 +
 tests/generic/281           |  98 +++++++++
 tests/generic/281.out       |  11 +
 tests/generic/282           | 101 +++++++++
 tests/generic/282.out       |  10 +
 tests/generic/283           | 104 ++++++++++
 tests/generic/283.out       |  12 ++
 tests/generic/284           |  89 ++++++++
 tests/generic/284.out       |  12 ++
 tests/generic/285           |   2 +-
 tests/generic/286           |   2 +-
 tests/generic/287           |  90 ++++++++
 tests/generic/287.out       |  12 ++
 tests/generic/289           |  91 +++++++++
 tests/generic/289.out       |  12 ++
 tests/generic/290           |  92 +++++++++
 tests/generic/290.out       |  12 ++
 tests/generic/291           |  91 +++++++++
 tests/generic/291.out       |  12 ++
 tests/generic/292           |  92 +++++++++
 tests/generic/292.out       |  12 ++
 tests/generic/293           |  93 +++++++++
 tests/generic/293.out       |  12 ++
 tests/generic/295           |  94 +++++++++
 tests/generic/295.out       |  12 ++
 tests/generic/296           |  90 ++++++++
 tests/generic/296.out       |  12 ++
 tests/generic/297           |  99 +++++++++
 tests/generic/297.out       |   6 +
 tests/generic/298           |  99 +++++++++
 tests/generic/298.out       |   6 +
 tests/generic/301           | 100 +++++++++
 tests/generic/301.out       |  10 +
 tests/generic/302           | 101 +++++++++
 tests/generic/302.out       |  10 +
 tests/generic/303           |  98 +++++++++
 tests/generic/303.out       |  21 ++
 tests/generic/304           |  99 +++++++++
 tests/generic/304.out       |  22 ++
 tests/generic/305           | 100 +++++++++
 tests/generic/305.out       |  22 ++
 tests/generic/311           |   2 +-
 tests/generic/326           | 101 +++++++++
 tests/generic/326.out       |  22 ++
 tests/generic/327           |  87 ++++++++
 tests/generic/327.out       |  12 ++
 tests/generic/328           | 105 ++++++++++
 tests/generic/328.out       |  25 +++
 tests/generic/329           | 102 +++++++++
 tests/generic/329.out       |  12 ++
 tests/generic/330           |  93 +++++++++
 tests/generic/330.out       |  11 +
 tests/generic/331           | 104 ++++++++++
 tests/generic/331.out       |  12 ++
 tests/generic/332           |  94 +++++++++
 tests/generic/332.out       |  11 +
 tests/generic/333           |  99 +++++++++
 tests/generic/333.out       |   4 +
 tests/generic/334           |  98 +++++++++
 tests/generic/334.out       |   4 +
 tests/generic/group         |  71 +++++--
 tests/xfs/032               |   3 +-
 tests/xfs/044               |   2 +-
 tests/xfs/122               |   3 +
 tests/xfs/122.out           |   4 +
 tests/xfs/127               |  33 ++-
 tests/xfs/127.out           |   1 -
 tests/xfs/128               |  97 +++++----
 tests/xfs/128.out           |   9 +-
 tests/xfs/129               |  33 ++-
 tests/xfs/131               |  25 +--
 tests/xfs/131.out           |   1 -
 tests/xfs/132               |  53 ++---
 tests/xfs/132.out           |  40 ++--
 tests/xfs/139               |  35 ++--
 tests/xfs/139.out           |   1 -
 tests/xfs/140               |  41 ++--
 tests/xfs/140.out           |   1 -
 tests/xfs/169               |  86 ++++++++
 tests/xfs/169.out           |   7 +
 tests/xfs/179               | 118 +++++++++++
 tests/xfs/179.out           |  10 +
 tests/xfs/180               | 106 ++++++++++
 tests/xfs/180.out           |  11 +
 tests/xfs/182               | 107 ++++++++++
 tests/xfs/182.out           |  12 ++
 tests/xfs/184               | 105 ++++++++++
 tests/xfs/184.out           |  10 +
 tests/xfs/192               | 106 ++++++++++
 tests/xfs/192.out           |  10 +
 tests/xfs/193               | 102 +++++++++
 tests/xfs/193.out           |  10 +
 tests/xfs/198               | 103 ++++++++++
 tests/xfs/198.out           |  10 +
 tests/xfs/200               | 109 ++++++++++
 tests/xfs/200.out           |  10 +
 tests/xfs/204               | 110 ++++++++++
 tests/xfs/204.out           |  10 +
 tests/xfs/207               | 101 +++++++++
 tests/xfs/207.out           |  18 ++
 tests/xfs/208               | 138 +++++++++++++
 tests/xfs/208.out           |  13 ++
 tests/xfs/209               |  82 ++++++++
 tests/xfs/209.out           |  13 ++
 tests/xfs/210               | 108 ++++++++++
 tests/xfs/210.out           |  23 +++
 tests/xfs/211               | 107 ++++++++++
 tests/xfs/211.out           |  11 +
 tests/xfs/212               |  99 +++++++++
 tests/xfs/212.out           |  13 ++
 tests/xfs/213               | 105 ++++++++++
 tests/xfs/213.out           |  22 ++
 tests/xfs/214               | 106 ++++++++++
 tests/xfs/214.out           |  22 ++
 tests/xfs/215               | 102 +++++++++
 tests/xfs/215.out           |  13 ++
 tests/xfs/218               | 101 +++++++++
 tests/xfs/218.out           |  13 ++
 tests/xfs/219               | 102 +++++++++
 tests/xfs/219.out           |  13 ++
 tests/xfs/221               | 101 +++++++++
 tests/xfs/221.out           |  13 ++
 tests/xfs/223               | 104 ++++++++++
 tests/xfs/223.out           |  13 ++
 tests/xfs/224               | 103 ++++++++++
 tests/xfs/224.out           |  13 ++
 tests/xfs/225               | 102 +++++++++
 tests/xfs/225.out           |  13 ++
 tests/xfs/226               | 101 +++++++++
 tests/xfs/226.out           |  13 ++
 tests/xfs/228               | 110 ++++++++++
 tests/xfs/228.out           |  13 ++
 tests/xfs/230               | 110 ++++++++++
 tests/xfs/230.out           |  13 ++
 tests/xfs/231               | 130 ++++++++++++
 tests/xfs/231.out           |  16 ++
 tests/xfs/232               | 132 ++++++++++++
 tests/xfs/232.out           |  16 ++
 tests/xfs/233               |  73 +++++++
 tests/xfs/233.out           |   5 +
 tests/xfs/234               |  88 ++++++++
 tests/xfs/234.out           |   6 +
 tests/xfs/235               | 108 ++++++++++
 tests/xfs/235.out           |  14 ++
 tests/xfs/236               |  88 ++++++++
 tests/xfs/236.out           |   7 +
 tests/xfs/237               | 105 ++++++++++
 tests/xfs/237.out           |  12 ++
 tests/xfs/239               |  98 +++++++++
 tests/xfs/239.out           |  11 +
 tests/xfs/240               | 110 ++++++++++
 tests/xfs/240.out           |  12 ++
 tests/xfs/241               | 100 +++++++++
 tests/xfs/241.out           |  11 +
 tests/xfs/243               | 165 +++++++++++++++
 tests/xfs/243.out           |  26 +++
 tests/xfs/245               |  95 +++++++++
 tests/xfs/245.out           |  12 ++
 tests/xfs/246               |  65 ++++++
 tests/xfs/246.out           |   6 +
 tests/xfs/247               |  57 ++++++
 tests/xfs/247.out           |   2 +
 tests/xfs/248               |  91 +++++++++
 tests/xfs/248.out           |  12 ++
 tests/xfs/249               |  92 +++++++++
 tests/xfs/249.out           |  12 ++
 tests/xfs/251               |  93 +++++++++
 tests/xfs/251.out           |  12 ++
 tests/xfs/254               |  94 +++++++++
 tests/xfs/254.out           |  12 ++
 tests/xfs/255               |  93 +++++++++
 tests/xfs/255.out           |  12 ++
 tests/xfs/256               |  94 +++++++++
 tests/xfs/256.out           |  12 ++
 tests/xfs/257               |  95 +++++++++
 tests/xfs/257.out           |  12 ++
 tests/xfs/258               |  96 +++++++++
 tests/xfs/258.out           |  12 ++
 tests/xfs/group             |  56 ++++-
 352 files changed, 13925 insertions(+), 2729 deletions(-)
 create mode 100644 src/aio-dio-regress/aiocp.c
 create mode 100644 src/punch-alternating.c
 create mode 100755 tests/generic/250
 create mode 100644 tests/generic/250.out
 create mode 100755 tests/generic/252
 create mode 100644 tests/generic/252.out
 create mode 100755 tests/generic/253
 create mode 100644 tests/generic/253.out
 create mode 100755 tests/generic/254
 create mode 100644 tests/generic/254.out
 create mode 100755 tests/generic/259
 create mode 100644 tests/generic/259.out
 create mode 100755 tests/generic/261
 create mode 100644 tests/generic/261.out
 create mode 100755 tests/generic/262
 create mode 100644 tests/generic/262.out
 create mode 100755 tests/generic/264
 create mode 100644 tests/generic/264.out
 create mode 100755 tests/generic/265
 create mode 100644 tests/generic/265.out
 create mode 100755 tests/generic/266
 create mode 100644 tests/generic/266.out
 create mode 100755 tests/generic/267
 create mode 100644 tests/generic/267.out
 create mode 100755 tests/generic/268
 create mode 100644 tests/generic/268.out
 create mode 100755 tests/generic/271
 create mode 100644 tests/generic/271.out
 create mode 100755 tests/generic/272
 create mode 100644 tests/generic/272.out
 create mode 100755 tests/generic/276
 create mode 100644 tests/generic/276.out
 create mode 100755 tests/generic/278
 create mode 100644 tests/generic/278.out
 create mode 100755 tests/generic/279
 create mode 100644 tests/generic/279.out
 create mode 100755 tests/generic/281
 create mode 100644 tests/generic/281.out
 create mode 100755 tests/generic/282
 create mode 100644 tests/generic/282.out
 create mode 100755 tests/generic/283
 create mode 100644 tests/generic/283.out
 create mode 100755 tests/generic/284
 create mode 100644 tests/generic/284.out
 create mode 100755 tests/generic/287
 create mode 100644 tests/generic/287.out
 create mode 100755 tests/generic/289
 create mode 100644 tests/generic/289.out
 create mode 100755 tests/generic/290
 create mode 100644 tests/generic/290.out
 create mode 100755 tests/generic/291
 create mode 100644 tests/generic/291.out
 create mode 100755 tests/generic/292
 create mode 100644 tests/generic/292.out
 create mode 100755 tests/generic/293
 create mode 100644 tests/generic/293.out
 create mode 100755 tests/generic/295
 create mode 100644 tests/generic/295.out
 create mode 100755 tests/generic/296
 create mode 100644 tests/generic/296.out
 create mode 100755 tests/generic/297
 create mode 100644 tests/generic/297.out
 create mode 100755 tests/generic/298
 create mode 100644 tests/generic/298.out
 create mode 100755 tests/generic/301
 create mode 100644 tests/generic/301.out
 create mode 100755 tests/generic/302
 create mode 100644 tests/generic/302.out
 create mode 100755 tests/generic/303
 create mode 100644 tests/generic/303.out
 create mode 100755 tests/generic/304
 create mode 100644 tests/generic/304.out
 create mode 100755 tests/generic/305
 create mode 100644 tests/generic/305.out
 create mode 100755 tests/generic/326
 create mode 100644 tests/generic/326.out
 create mode 100755 tests/generic/327
 create mode 100644 tests/generic/327.out
 create mode 100755 tests/generic/328
 create mode 100644 tests/generic/328.out
 create mode 100755 tests/generic/329
 create mode 100644 tests/generic/329.out
 create mode 100755 tests/generic/330
 create mode 100644 tests/generic/330.out
 create mode 100755 tests/generic/331
 create mode 100644 tests/generic/331.out
 create mode 100755 tests/generic/332
 create mode 100644 tests/generic/332.out
 create mode 100755 tests/generic/333
 create mode 100644 tests/generic/333.out
 create mode 100755 tests/generic/334
 create mode 100644 tests/generic/334.out
 create mode 100755 tests/xfs/169
 create mode 100644 tests/xfs/169.out
 create mode 100755 tests/xfs/179
 create mode 100644 tests/xfs/179.out
 create mode 100755 tests/xfs/180
 create mode 100644 tests/xfs/180.out
 create mode 100755 tests/xfs/182
 create mode 100644 tests/xfs/182.out
 create mode 100755 tests/xfs/184
 create mode 100644 tests/xfs/184.out
 create mode 100755 tests/xfs/192
 create mode 100644 tests/xfs/192.out
 create mode 100755 tests/xfs/193
 create mode 100644 tests/xfs/193.out
 create mode 100755 tests/xfs/198
 create mode 100644 tests/xfs/198.out
 create mode 100755 tests/xfs/200
 create mode 100644 tests/xfs/200.out
 create mode 100755 tests/xfs/204
 create mode 100644 tests/xfs/204.out
 create mode 100755 tests/xfs/207
 create mode 100644 tests/xfs/207.out
 create mode 100755 tests/xfs/208
 create mode 100644 tests/xfs/208.out
 create mode 100755 tests/xfs/209
 create mode 100644 tests/xfs/209.out
 create mode 100755 tests/xfs/210
 create mode 100644 tests/xfs/210.out
 create mode 100755 tests/xfs/211
 create mode 100644 tests/xfs/211.out
 create mode 100755 tests/xfs/212
 create mode 100644 tests/xfs/212.out
 create mode 100755 tests/xfs/213
 create mode 100644 tests/xfs/213.out
 create mode 100755 tests/xfs/214
 create mode 100644 tests/xfs/214.out
 create mode 100755 tests/xfs/215
 create mode 100644 tests/xfs/215.out
 create mode 100755 tests/xfs/218
 create mode 100644 tests/xfs/218.out
 create mode 100755 tests/xfs/219
 create mode 100644 tests/xfs/219.out
 create mode 100755 tests/xfs/221
 create mode 100644 tests/xfs/221.out
 create mode 100755 tests/xfs/223
 create mode 100644 tests/xfs/223.out
 create mode 100755 tests/xfs/224
 create mode 100644 tests/xfs/224.out
 create mode 100755 tests/xfs/225
 create mode 100644 tests/xfs/225.out
 create mode 100755 tests/xfs/226
 create mode 100644 tests/xfs/226.out
 create mode 100755 tests/xfs/228
 create mode 100644 tests/xfs/228.out
 create mode 100755 tests/xfs/230
 create mode 100644 tests/xfs/230.out
 create mode 100755 tests/xfs/231
 create mode 100644 tests/xfs/231.out
 create mode 100755 tests/xfs/232
 create mode 100644 tests/xfs/232.out
 create mode 100755 tests/xfs/233
 create mode 100644 tests/xfs/233.out
 create mode 100755 tests/xfs/234
 create mode 100644 tests/xfs/234.out
 create mode 100755 tests/xfs/235
 create mode 100644 tests/xfs/235.out
 create mode 100755 tests/xfs/236
 create mode 100644 tests/xfs/236.out
 create mode 100755 tests/xfs/237
 create mode 100644 tests/xfs/237.out
 create mode 100755 tests/xfs/239
 create mode 100644 tests/xfs/239.out
 create mode 100755 tests/xfs/240
 create mode 100644 tests/xfs/240.out
 create mode 100755 tests/xfs/241
 create mode 100644 tests/xfs/241.out
 create mode 100755 tests/xfs/243
 create mode 100644 tests/xfs/243.out
 create mode 100755 tests/xfs/245
 create mode 100644 tests/xfs/245.out
 create mode 100755 tests/xfs/246
 create mode 100644 tests/xfs/246.out
 create mode 100755 tests/xfs/247
 create mode 100644 tests/xfs/247.out
 create mode 100755 tests/xfs/248
 create mode 100644 tests/xfs/248.out
 create mode 100755 tests/xfs/249
 create mode 100644 tests/xfs/249.out
 create mode 100755 tests/xfs/251
 create mode 100644 tests/xfs/251.out
 create mode 100755 tests/xfs/254
 create mode 100644 tests/xfs/254.out
 create mode 100755 tests/xfs/255
 create mode 100644 tests/xfs/255.out
 create mode 100755 tests/xfs/256
 create mode 100644 tests/xfs/256.out
 create mode 100755 tests/xfs/257
 create mode 100644 tests/xfs/257.out
 create mode 100755 tests/xfs/258
 create mode 100644 tests/xfs/258.out

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

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

* [PATCH 01/32] generic/182: this is a dedupe test, check for dedupe
  2016-02-11 23:39 ` Darrick J. Wong
@ 2016-02-11 23:39   ` Darrick J. Wong
  -1 siblings, 0 replies; 81+ messages in thread
From: Darrick J. Wong @ 2016-02-11 23:39 UTC (permalink / raw)
  To: david, darrick.wong; +Cc: linux-btrfs, Christoph Hellwig, fstests, xfs

Since this test examines dedupe behavior, the documentation should
say 'dedupe', not 'reflink'.  Furthermore, the feature checks must
look for working dedupe functionality, not reflink functionality.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
[hch@lst.de: add the test for dedupe support]
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 tests/generic/182 |    9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)


diff --git a/tests/generic/182 b/tests/generic/182
index bf5cd38..ef10af8 100755
--- a/tests/generic/182
+++ b/tests/generic/182
@@ -1,10 +1,10 @@
 #! /bin/bash
 # FS QA Test No. 182
 #
-# Test the convention that reflink with length == 0 means "to the end of fileA"
+# Test the convention that dedupe with length == 0 means "to the end of fileA"
 #   - Create a file.
-#   - Try to reflink "zero" bytes (which means reflink to EOF).
-#   - Check that the reflink happened.
+#   - Try to dedupe "zero" bytes (which means dedupe to EOF).
+#   - Check that the dedupe happened.
 #
 #-----------------------------------------------------------------------
 # Copyright (c) 2015, Oracle and/or its affiliates.  All Rights Reserved.
@@ -45,8 +45,7 @@ _cleanup()
 
 # real QA test starts here
 _supported_os Linux
-_require_test_reflink
-_require_cp_reflink
+_require_test_dedupe
 
 rm -f "$seqres.full"
 


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

* [PATCH 01/32] generic/182: this is a dedupe test, check for dedupe
@ 2016-02-11 23:39   ` Darrick J. Wong
  0 siblings, 0 replies; 81+ messages in thread
From: Darrick J. Wong @ 2016-02-11 23:39 UTC (permalink / raw)
  To: david, darrick.wong; +Cc: fstests, Christoph Hellwig, linux-btrfs, xfs

Since this test examines dedupe behavior, the documentation should
say 'dedupe', not 'reflink'.  Furthermore, the feature checks must
look for working dedupe functionality, not reflink functionality.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
[hch@lst.de: add the test for dedupe support]
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 tests/generic/182 |    9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)


diff --git a/tests/generic/182 b/tests/generic/182
index bf5cd38..ef10af8 100755
--- a/tests/generic/182
+++ b/tests/generic/182
@@ -1,10 +1,10 @@
 #! /bin/bash
 # FS QA Test No. 182
 #
-# Test the convention that reflink with length == 0 means "to the end of fileA"
+# Test the convention that dedupe with length == 0 means "to the end of fileA"
 #   - Create a file.
-#   - Try to reflink "zero" bytes (which means reflink to EOF).
-#   - Check that the reflink happened.
+#   - Try to dedupe "zero" bytes (which means dedupe to EOF).
+#   - Check that the dedupe happened.
 #
 #-----------------------------------------------------------------------
 # Copyright (c) 2015, Oracle and/or its affiliates.  All Rights Reserved.
@@ -45,8 +45,7 @@ _cleanup()
 
 # real QA test starts here
 _supported_os Linux
-_require_test_reflink
-_require_cp_reflink
+_require_test_dedupe
 
 rm -f "$seqres.full"
 

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

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

* [PATCH 02/32] xfstests: filter whitespace in 128 and 132
  2016-02-11 23:39 ` Darrick J. Wong
@ 2016-02-11 23:39   ` Darrick J. Wong
  -1 siblings, 0 replies; 81+ messages in thread
From: Darrick J. Wong @ 2016-02-11 23:39 UTC (permalink / raw)
  To: david, darrick.wong; +Cc: linux-btrfs, Christoph Hellwig, fstests, xfs

Seems either I have a different lsattr version, or different mount points
cause differences in the golden output.  Send the lsattr output through
the whitespaces filter so that it works everywhere.

The lsattr output /does/ change depending on mountpoints.  Ick.  I'd
actually changed it to the long format output because line length in
the short format changes every time the flags change.

Signed-off-by: Christoph Hellwig <hch@lst.de>
[darrick.wong@oracle.com: update changelog]
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 tests/xfs/128     |    2 +-
 tests/xfs/128.out |    8 ++++----
 tests/xfs/132     |   10 +++++-----
 tests/xfs/132.out |   40 ++++++++++++++++++++--------------------
 4 files changed, 30 insertions(+), 30 deletions(-)


diff --git a/tests/xfs/128 b/tests/xfs/128
index a96291a..c9547fb 100755
--- a/tests/xfs/128
+++ b/tests/xfs/128
@@ -97,7 +97,7 @@ c13=$(_md5_checksum "$testdir/file3")
 c14=$(_md5_checksum "$testdir/file4")
 
 echo "Defragment"
-lsattr -l "$testdir/" | _filter_scratch
+lsattr -l "$testdir/" | _filter_scratch | _filter_spaces
 xfs_fsr -v -d "$testdir/file1" >> "$seqres.full"
 xfs_fsr -v -d "$testdir/file2" >> "$seqres.full" # fsr probably breaks the link
 xfs_fsr -v -d "$testdir/file3" >> "$seqres.full" # fsr probably breaks the link
diff --git a/tests/xfs/128.out b/tests/xfs/128.out
index 7e72dcd..0ac06db 100644
--- a/tests/xfs/128.out
+++ b/tests/xfs/128.out
@@ -11,10 +11,10 @@ c650f1cf6c9f07b22e3e21ec7d49ded5  SCRATCH_MNT/test-128/file2
 56ed2f712c91e035adeeb26ed105a982  SCRATCH_MNT/test-128/file3
 b81534f439aac5c34ce3ed60a03eba70  SCRATCH_MNT/test-128/file4
 Defragment
-SCRATCH_MNT/test-128/file1          ---
-SCRATCH_MNT/test-128/file2          ---
-SCRATCH_MNT/test-128/file3          ---
-SCRATCH_MNT/test-128/file4          ---
+SCRATCH_MNT/test-128/file1 ---
+SCRATCH_MNT/test-128/file2 ---
+SCRATCH_MNT/test-128/file3 ---
+SCRATCH_MNT/test-128/file4 ---
 b81534f439aac5c34ce3ed60a03eba70  SCRATCH_MNT/test-128/file1
 c650f1cf6c9f07b22e3e21ec7d49ded5  SCRATCH_MNT/test-128/file2
 56ed2f712c91e035adeeb26ed105a982  SCRATCH_MNT/test-128/file3
diff --git a/tests/xfs/132 b/tests/xfs/132
index 79a6d57..9c57c3b 100755
--- a/tests/xfs/132
+++ b/tests/xfs/132
@@ -87,32 +87,32 @@ for i in `seq 2 $nr`; do
 done
 _test_remount
 free_blocks1=$(stat -f "$testdir" -c '%f')
-lsattr -l $testdir/ | _filter_test_dir
+lsattr -l $testdir/ | _filter_test_dir | _filter_spaces
 
 echo "funshare part of a file"
 "$XFS_IO_PROG" -f -c "falloc 0 $((sz / 2))" "$testdir/file2"
 _test_remount
-lsattr -l $testdir/ | _filter_test_dir
+lsattr -l $testdir/ | _filter_test_dir | _filter_spaces
 
 echo "funshare some of the copies"
 "$XFS_IO_PROG" -f -c "falloc 0 $sz" "$testdir/file2"
 "$XFS_IO_PROG" -f -c "falloc 0 $sz" "$testdir/file3"
 _test_remount
 free_blocks2=$(stat -f "$testdir" -c '%f')
-lsattr -l $testdir/ | _filter_test_dir
+lsattr -l $testdir/ | _filter_test_dir | _filter_spaces
 
 echo "funshare the rest of the files"
 "$XFS_IO_PROG" -f -c "falloc 0 $sz" "$testdir/file4"
 "$XFS_IO_PROG" -f -c "falloc 0 $sz" "$testdir/file1"
 _test_remount
 free_blocks3=$(stat -f "$testdir" -c '%f')
-lsattr -l $testdir/ | _filter_test_dir
+lsattr -l $testdir/ | _filter_test_dir | _filter_spaces
 
 echo "Rewrite the original file"
 _pwrite_byte 0x65 0 $sz "$testdir/file1" >> "$seqres.full"
 _test_remount
 free_blocks4=$(stat -f "$testdir" -c '%f')
-lsattr -l $testdir/ | _filter_test_dir
+lsattr -l $testdir/ | _filter_test_dir | _filter_spaces
 #echo $free_blocks0 $free_blocks1 $free_blocks2 $free_blocks3 $free_blocks4
 
 _within_tolerance "free blocks after reflinking" $free_blocks1 $((free_blocks0 - blks)) $margin -v
diff --git a/tests/xfs/132.out b/tests/xfs/132.out
index fd2b7bd..f32db7d 100644
--- a/tests/xfs/132.out
+++ b/tests/xfs/132.out
@@ -1,30 +1,30 @@
 QA output created by 132
 Create the original file blocks
 Create the reflink copies
-TEST_DIR/test-132/file1          ---
-TEST_DIR/test-132/file2          ---
-TEST_DIR/test-132/file3          ---
-TEST_DIR/test-132/file4          ---
+TEST_DIR/test-132/file1 ---
+TEST_DIR/test-132/file2 ---
+TEST_DIR/test-132/file3 ---
+TEST_DIR/test-132/file4 ---
 funshare part of a file
-TEST_DIR/test-132/file1          ---
-TEST_DIR/test-132/file2          ---
-TEST_DIR/test-132/file3          ---
-TEST_DIR/test-132/file4          ---
+TEST_DIR/test-132/file1 ---
+TEST_DIR/test-132/file2 ---
+TEST_DIR/test-132/file3 ---
+TEST_DIR/test-132/file4 ---
 funshare some of the copies
-TEST_DIR/test-132/file1          ---
-TEST_DIR/test-132/file2          No_COW
-TEST_DIR/test-132/file3          No_COW
-TEST_DIR/test-132/file4          ---
+TEST_DIR/test-132/file1 ---
+TEST_DIR/test-132/file2 No_COW
+TEST_DIR/test-132/file3 No_COW
+TEST_DIR/test-132/file4 ---
 funshare the rest of the files
-TEST_DIR/test-132/file1          No_COW
-TEST_DIR/test-132/file2          No_COW
-TEST_DIR/test-132/file3          No_COW
-TEST_DIR/test-132/file4          No_COW
+TEST_DIR/test-132/file1 No_COW
+TEST_DIR/test-132/file2 No_COW
+TEST_DIR/test-132/file3 No_COW
+TEST_DIR/test-132/file4 No_COW
 Rewrite the original file
-TEST_DIR/test-132/file1          No_COW
-TEST_DIR/test-132/file2          No_COW
-TEST_DIR/test-132/file3          No_COW
-TEST_DIR/test-132/file4          No_COW
+TEST_DIR/test-132/file1 No_COW
+TEST_DIR/test-132/file2 No_COW
+TEST_DIR/test-132/file3 No_COW
+TEST_DIR/test-132/file4 No_COW
 free blocks after reflinking is in range
 free blocks after nocow'ing some copies is in range
 free blocks after nocow'ing all copies is in range


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

* [PATCH 02/32] xfstests: filter whitespace in 128 and 132
@ 2016-02-11 23:39   ` Darrick J. Wong
  0 siblings, 0 replies; 81+ messages in thread
From: Darrick J. Wong @ 2016-02-11 23:39 UTC (permalink / raw)
  To: david, darrick.wong; +Cc: fstests, Christoph Hellwig, linux-btrfs, xfs

Seems either I have a different lsattr version, or different mount points
cause differences in the golden output.  Send the lsattr output through
the whitespaces filter so that it works everywhere.

The lsattr output /does/ change depending on mountpoints.  Ick.  I'd
actually changed it to the long format output because line length in
the short format changes every time the flags change.

Signed-off-by: Christoph Hellwig <hch@lst.de>
[darrick.wong@oracle.com: update changelog]
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 tests/xfs/128     |    2 +-
 tests/xfs/128.out |    8 ++++----
 tests/xfs/132     |   10 +++++-----
 tests/xfs/132.out |   40 ++++++++++++++++++++--------------------
 4 files changed, 30 insertions(+), 30 deletions(-)


diff --git a/tests/xfs/128 b/tests/xfs/128
index a96291a..c9547fb 100755
--- a/tests/xfs/128
+++ b/tests/xfs/128
@@ -97,7 +97,7 @@ c13=$(_md5_checksum "$testdir/file3")
 c14=$(_md5_checksum "$testdir/file4")
 
 echo "Defragment"
-lsattr -l "$testdir/" | _filter_scratch
+lsattr -l "$testdir/" | _filter_scratch | _filter_spaces
 xfs_fsr -v -d "$testdir/file1" >> "$seqres.full"
 xfs_fsr -v -d "$testdir/file2" >> "$seqres.full" # fsr probably breaks the link
 xfs_fsr -v -d "$testdir/file3" >> "$seqres.full" # fsr probably breaks the link
diff --git a/tests/xfs/128.out b/tests/xfs/128.out
index 7e72dcd..0ac06db 100644
--- a/tests/xfs/128.out
+++ b/tests/xfs/128.out
@@ -11,10 +11,10 @@ c650f1cf6c9f07b22e3e21ec7d49ded5  SCRATCH_MNT/test-128/file2
 56ed2f712c91e035adeeb26ed105a982  SCRATCH_MNT/test-128/file3
 b81534f439aac5c34ce3ed60a03eba70  SCRATCH_MNT/test-128/file4
 Defragment
-SCRATCH_MNT/test-128/file1          ---
-SCRATCH_MNT/test-128/file2          ---
-SCRATCH_MNT/test-128/file3          ---
-SCRATCH_MNT/test-128/file4          ---
+SCRATCH_MNT/test-128/file1 ---
+SCRATCH_MNT/test-128/file2 ---
+SCRATCH_MNT/test-128/file3 ---
+SCRATCH_MNT/test-128/file4 ---
 b81534f439aac5c34ce3ed60a03eba70  SCRATCH_MNT/test-128/file1
 c650f1cf6c9f07b22e3e21ec7d49ded5  SCRATCH_MNT/test-128/file2
 56ed2f712c91e035adeeb26ed105a982  SCRATCH_MNT/test-128/file3
diff --git a/tests/xfs/132 b/tests/xfs/132
index 79a6d57..9c57c3b 100755
--- a/tests/xfs/132
+++ b/tests/xfs/132
@@ -87,32 +87,32 @@ for i in `seq 2 $nr`; do
 done
 _test_remount
 free_blocks1=$(stat -f "$testdir" -c '%f')
-lsattr -l $testdir/ | _filter_test_dir
+lsattr -l $testdir/ | _filter_test_dir | _filter_spaces
 
 echo "funshare part of a file"
 "$XFS_IO_PROG" -f -c "falloc 0 $((sz / 2))" "$testdir/file2"
 _test_remount
-lsattr -l $testdir/ | _filter_test_dir
+lsattr -l $testdir/ | _filter_test_dir | _filter_spaces
 
 echo "funshare some of the copies"
 "$XFS_IO_PROG" -f -c "falloc 0 $sz" "$testdir/file2"
 "$XFS_IO_PROG" -f -c "falloc 0 $sz" "$testdir/file3"
 _test_remount
 free_blocks2=$(stat -f "$testdir" -c '%f')
-lsattr -l $testdir/ | _filter_test_dir
+lsattr -l $testdir/ | _filter_test_dir | _filter_spaces
 
 echo "funshare the rest of the files"
 "$XFS_IO_PROG" -f -c "falloc 0 $sz" "$testdir/file4"
 "$XFS_IO_PROG" -f -c "falloc 0 $sz" "$testdir/file1"
 _test_remount
 free_blocks3=$(stat -f "$testdir" -c '%f')
-lsattr -l $testdir/ | _filter_test_dir
+lsattr -l $testdir/ | _filter_test_dir | _filter_spaces
 
 echo "Rewrite the original file"
 _pwrite_byte 0x65 0 $sz "$testdir/file1" >> "$seqres.full"
 _test_remount
 free_blocks4=$(stat -f "$testdir" -c '%f')
-lsattr -l $testdir/ | _filter_test_dir
+lsattr -l $testdir/ | _filter_test_dir | _filter_spaces
 #echo $free_blocks0 $free_blocks1 $free_blocks2 $free_blocks3 $free_blocks4
 
 _within_tolerance "free blocks after reflinking" $free_blocks1 $((free_blocks0 - blks)) $margin -v
diff --git a/tests/xfs/132.out b/tests/xfs/132.out
index fd2b7bd..f32db7d 100644
--- a/tests/xfs/132.out
+++ b/tests/xfs/132.out
@@ -1,30 +1,30 @@
 QA output created by 132
 Create the original file blocks
 Create the reflink copies
-TEST_DIR/test-132/file1          ---
-TEST_DIR/test-132/file2          ---
-TEST_DIR/test-132/file3          ---
-TEST_DIR/test-132/file4          ---
+TEST_DIR/test-132/file1 ---
+TEST_DIR/test-132/file2 ---
+TEST_DIR/test-132/file3 ---
+TEST_DIR/test-132/file4 ---
 funshare part of a file
-TEST_DIR/test-132/file1          ---
-TEST_DIR/test-132/file2          ---
-TEST_DIR/test-132/file3          ---
-TEST_DIR/test-132/file4          ---
+TEST_DIR/test-132/file1 ---
+TEST_DIR/test-132/file2 ---
+TEST_DIR/test-132/file3 ---
+TEST_DIR/test-132/file4 ---
 funshare some of the copies
-TEST_DIR/test-132/file1          ---
-TEST_DIR/test-132/file2          No_COW
-TEST_DIR/test-132/file3          No_COW
-TEST_DIR/test-132/file4          ---
+TEST_DIR/test-132/file1 ---
+TEST_DIR/test-132/file2 No_COW
+TEST_DIR/test-132/file3 No_COW
+TEST_DIR/test-132/file4 ---
 funshare the rest of the files
-TEST_DIR/test-132/file1          No_COW
-TEST_DIR/test-132/file2          No_COW
-TEST_DIR/test-132/file3          No_COW
-TEST_DIR/test-132/file4          No_COW
+TEST_DIR/test-132/file1 No_COW
+TEST_DIR/test-132/file2 No_COW
+TEST_DIR/test-132/file3 No_COW
+TEST_DIR/test-132/file4 No_COW
 Rewrite the original file
-TEST_DIR/test-132/file1          No_COW
-TEST_DIR/test-132/file2          No_COW
-TEST_DIR/test-132/file3          No_COW
-TEST_DIR/test-132/file4          No_COW
+TEST_DIR/test-132/file1 No_COW
+TEST_DIR/test-132/file2 No_COW
+TEST_DIR/test-132/file3 No_COW
+TEST_DIR/test-132/file4 No_COW
 free blocks after reflinking is in range
 free blocks after nocow'ing some copies is in range
 free blocks after nocow'ing all copies is in range

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

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

* [PATCH 03/32] xfstests: make _scratch_mkfs_blocksized usable
  2016-02-11 23:39 ` Darrick J. Wong
@ 2016-02-11 23:39   ` Darrick J. Wong
  -1 siblings, 0 replies; 81+ messages in thread
From: Darrick J. Wong @ 2016-02-11 23:39 UTC (permalink / raw)
  To: david, darrick.wong; +Cc: linux-btrfs, Christoph Hellwig, fstests, xfs

The default mkfs.xfs options contain -b size=4096, so all tests
using _scratch_mkfs_blocksized won't actually run unless those
options are changed.  As we're trying to specificly test 1k
blocks we should always override the default option.

v2: Move the function to common/rc

Signed-off-by: Christoph Hellwig <hch@lst.de>
[darrick.wong@oracle.com: move function to common/rc]
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 common/rc      |   24 ++++++++++++++++++++++++
 common/reflink |   30 ------------------------------
 2 files changed, 24 insertions(+), 30 deletions(-)


diff --git a/common/rc b/common/rc
index b742785..84f794a 100644
--- a/common/rc
+++ b/common/rc
@@ -881,6 +881,30 @@ _scratch_mkfs_geom()
     _scratch_mkfs
 }
 
+# Create fs of certain blocksize on scratch device
+# _scratch_mkfs_blocksized blocksize
+_scratch_mkfs_blocksized()
+{
+    blocksize=$1
+
+    re='^[0-9]+$'
+    if ! [[ $blocksize =~ $re ]] ; then
+        _notrun "error: _scratch_mkfs_sized: block size \"$blocksize\" not an integer."
+    fi
+
+    case $FSTYP in
+    xfs)
+	_scratch_mkfs_xfs $MKFS_OPTIONS -b size=$blocksize
+	;;
+    ext2|ext3|ext4|ocfs2)
+	${MKFS_PROG}.$FSTYP -F $MKFS_OPTIONS -b $blocksize $SCRATCH_DEV
+	;;
+    *)
+	_notrun "Filesystem $FSTYP not supported in _scratch_mkfs_blocksized"
+	;;
+    esac
+}
+
 _scratch_resvblks()
 {
 	case $FSTYP in
diff --git a/common/reflink b/common/reflink
index 8638aba..3d6a8c1 100644
--- a/common/reflink
+++ b/common/reflink
@@ -187,33 +187,3 @@ _dedupe_range() {
 
 	"$XFS_IO_PROG" $xfs_io_args -f -c "dedupe $file1 $offset1 $offset2 $len" "$file2"
 }
-
-# Create fs of certain blocksize on scratch device
-# _scratch_mkfs_blocksized blocksize
-_scratch_mkfs_blocksized()
-{
-    blocksize=$1
-
-    re='^[0-9]+$'
-    if ! [[ $blocksize =~ $re ]] ; then
-        _notrun "error: _scratch_mkfs_sized: block size \"$blocksize\" not an integer."
-    fi
-
-    case $FSTYP in
-    xfs)
-	# don't override MKFS_OPTIONS that set a block size.
-	echo $MKFS_OPTIONS |egrep -q "b?size="
-	if [ $? -eq 0 ]; then
-		_scratch_mkfs_xfs
-	else
-		_scratch_mkfs_xfs -b size=$blocksize
-	fi
-	;;
-    ext2|ext3|ext4|ocfs2)
-	${MKFS_PROG}.$FSTYP -F $MKFS_OPTIONS -b $blocksize $SCRATCH_DEV
-	;;
-    *)
-	_notrun "Filesystem $FSTYP not supported in _scratch_mkfs_blocksized"
-	;;
-    esac
-}


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

* [PATCH 03/32] xfstests: make _scratch_mkfs_blocksized usable
@ 2016-02-11 23:39   ` Darrick J. Wong
  0 siblings, 0 replies; 81+ messages in thread
From: Darrick J. Wong @ 2016-02-11 23:39 UTC (permalink / raw)
  To: david, darrick.wong; +Cc: fstests, Christoph Hellwig, linux-btrfs, xfs

The default mkfs.xfs options contain -b size=4096, so all tests
using _scratch_mkfs_blocksized won't actually run unless those
options are changed.  As we're trying to specificly test 1k
blocks we should always override the default option.

v2: Move the function to common/rc

Signed-off-by: Christoph Hellwig <hch@lst.de>
[darrick.wong@oracle.com: move function to common/rc]
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 common/rc      |   24 ++++++++++++++++++++++++
 common/reflink |   30 ------------------------------
 2 files changed, 24 insertions(+), 30 deletions(-)


diff --git a/common/rc b/common/rc
index b742785..84f794a 100644
--- a/common/rc
+++ b/common/rc
@@ -881,6 +881,30 @@ _scratch_mkfs_geom()
     _scratch_mkfs
 }
 
+# Create fs of certain blocksize on scratch device
+# _scratch_mkfs_blocksized blocksize
+_scratch_mkfs_blocksized()
+{
+    blocksize=$1
+
+    re='^[0-9]+$'
+    if ! [[ $blocksize =~ $re ]] ; then
+        _notrun "error: _scratch_mkfs_sized: block size \"$blocksize\" not an integer."
+    fi
+
+    case $FSTYP in
+    xfs)
+	_scratch_mkfs_xfs $MKFS_OPTIONS -b size=$blocksize
+	;;
+    ext2|ext3|ext4|ocfs2)
+	${MKFS_PROG}.$FSTYP -F $MKFS_OPTIONS -b $blocksize $SCRATCH_DEV
+	;;
+    *)
+	_notrun "Filesystem $FSTYP not supported in _scratch_mkfs_blocksized"
+	;;
+    esac
+}
+
 _scratch_resvblks()
 {
 	case $FSTYP in
diff --git a/common/reflink b/common/reflink
index 8638aba..3d6a8c1 100644
--- a/common/reflink
+++ b/common/reflink
@@ -187,33 +187,3 @@ _dedupe_range() {
 
 	"$XFS_IO_PROG" $xfs_io_args -f -c "dedupe $file1 $offset1 $offset2 $len" "$file2"
 }
-
-# Create fs of certain blocksize on scratch device
-# _scratch_mkfs_blocksized blocksize
-_scratch_mkfs_blocksized()
-{
-    blocksize=$1
-
-    re='^[0-9]+$'
-    if ! [[ $blocksize =~ $re ]] ; then
-        _notrun "error: _scratch_mkfs_sized: block size \"$blocksize\" not an integer."
-    fi
-
-    case $FSTYP in
-    xfs)
-	# don't override MKFS_OPTIONS that set a block size.
-	echo $MKFS_OPTIONS |egrep -q "b?size="
-	if [ $? -eq 0 ]; then
-		_scratch_mkfs_xfs
-	else
-		_scratch_mkfs_xfs -b size=$blocksize
-	fi
-	;;
-    ext2|ext3|ext4|ocfs2)
-	${MKFS_PROG}.$FSTYP -F $MKFS_OPTIONS -b $blocksize $SCRATCH_DEV
-	;;
-    *)
-	_notrun "Filesystem $FSTYP not supported in _scratch_mkfs_blocksized"
-	;;
-    esac
-}

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

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

* [PATCH 04/32] reflink: remove redundant filesystem checks from the end of the tests
  2016-02-11 23:39 ` Darrick J. Wong
@ 2016-02-11 23:39   ` Darrick J. Wong
  -1 siblings, 0 replies; 81+ messages in thread
From: Darrick J. Wong @ 2016-02-11 23:39 UTC (permalink / raw)
  To: david, darrick.wong; +Cc: linux-btrfs, fstests, xfs

Turns out that check already runs _check_filesystems after each test,
so we don't need to do this at the end of each test.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 tests/generic/157 |    1 -
 tests/generic/158 |    1 -
 tests/generic/161 |    1 -
 tests/generic/162 |    1 -
 tests/generic/163 |    1 -
 tests/generic/164 |    1 -
 tests/generic/165 |    1 -
 tests/generic/166 |    1 -
 tests/generic/167 |    1 -
 tests/generic/168 |    1 -
 tests/generic/170 |    1 -
 tests/generic/171 |    1 -
 tests/generic/172 |    1 -
 tests/generic/173 |    1 -
 tests/generic/174 |    1 -
 tests/generic/175 |    1 -
 tests/generic/176 |    1 -
 tests/generic/183 |    1 -
 tests/generic/185 |    1 -
 tests/generic/186 |    1 -
 tests/generic/187 |    1 -
 tests/generic/188 |    1 -
 tests/generic/189 |    1 -
 tests/generic/190 |    1 -
 tests/generic/191 |    1 -
 tests/generic/194 |    1 -
 tests/generic/195 |    1 -
 tests/generic/196 |    1 -
 tests/generic/197 |    1 -
 tests/generic/199 |    1 -
 tests/generic/200 |    1 -
 tests/generic/201 |    1 -
 tests/generic/202 |    1 -
 tests/generic/203 |    1 -
 tests/generic/205 |    1 -
 tests/generic/206 |    1 -
 tests/generic/216 |    1 -
 tests/generic/217 |    1 -
 tests/generic/218 |    1 -
 tests/generic/220 |    1 -
 tests/generic/222 |    1 -
 tests/generic/227 |    1 -
 tests/generic/229 |    1 -
 tests/generic/238 |    1 -
 tests/generic/242 |    1 -
 tests/generic/243 |    1 -
 tests/xfs/127     |    1 -
 tests/xfs/128     |    1 -
 tests/xfs/131     |    1 -
 tests/xfs/139     |    1 -
 tests/xfs/140     |    1 -
 51 files changed, 51 deletions(-)


diff --git a/tests/generic/157 b/tests/generic/157
index 0150866..74314d8 100755
--- a/tests/generic/157
+++ b/tests/generic/157
@@ -123,7 +123,6 @@ _reflink_range "$testdir2/file1" 0 "$testdir2/file2" 0 $blksz >> "$seqres.full"
 
 echo "Check scratch fs"
 _scratch_unmount
-_check_scratch_fs
 
 # success, all done
 status=0
diff --git a/tests/generic/158 b/tests/generic/158
index 807c247..779d55e 100755
--- a/tests/generic/158
+++ b/tests/generic/158
@@ -124,7 +124,6 @@ _dedupe_range "$testdir2/file1" 0 "$testdir2/file2" 0 $blksz >> "$seqres.full"
 
 echo "Check scratch fs"
 _scratch_unmount
-_check_scratch_fs
 
 # success, all done
 status=0
diff --git a/tests/generic/161 b/tests/generic/161
index 7fb8963..b271936 100755
--- a/tests/generic/161
+++ b/tests/generic/161
@@ -71,7 +71,6 @@ wait
 
 echo "Check fs"
 umount "$SCRATCH_MNT"
-_check_scratch_fs
 
 echo "Done"
 # success, all done
diff --git a/tests/generic/162 b/tests/generic/162
index 2fb947a..30c761b 100755
--- a/tests/generic/162
+++ b/tests/generic/162
@@ -87,7 +87,6 @@ wait
 
 echo "Check fs"
 umount "$SCRATCH_MNT"
-_check_scratch_fs
 
 echo "Done"
 # success, all done
diff --git a/tests/generic/163 b/tests/generic/163
index 0186443..f2ea334 100755
--- a/tests/generic/163
+++ b/tests/generic/163
@@ -87,7 +87,6 @@ wait
 
 echo "Check fs"
 umount "$SCRATCH_MNT"
-_check_scratch_fs
 
 echo "Done"
 # success, all done
diff --git a/tests/generic/164 b/tests/generic/164
index 087c6ba..e97ac13 100755
--- a/tests/generic/164
+++ b/tests/generic/164
@@ -97,7 +97,6 @@ wait
 
 echo "Check fs"
 umount "$SCRATCH_MNT"
-_check_scratch_fs
 
 echo "Done"
 # success, all done
diff --git a/tests/generic/165 b/tests/generic/165
index 6bd15e1..b305079 100755
--- a/tests/generic/165
+++ b/tests/generic/165
@@ -97,7 +97,6 @@ wait
 
 echo "Check fs"
 umount "$SCRATCH_MNT"
-_check_scratch_fs
 
 echo "Done"
 # success, all done
diff --git a/tests/generic/166 b/tests/generic/166
index 6cfb821..2c2ff4e 100755
--- a/tests/generic/166
+++ b/tests/generic/166
@@ -84,7 +84,6 @@ wait
 
 echo "Check for damage"
 _scratch_unmount
-_check_scratch_fs
 
 echo "Done"
 
diff --git a/tests/generic/167 b/tests/generic/167
index fc5a86c..b80b481 100755
--- a/tests/generic/167
+++ b/tests/generic/167
@@ -84,7 +84,6 @@ wait
 
 echo "Check for damage"
 _scratch_unmount
-_check_scratch_fs
 
 echo "Done"
 
diff --git a/tests/generic/168 b/tests/generic/168
index ee3848d..0d620da 100755
--- a/tests/generic/168
+++ b/tests/generic/168
@@ -88,7 +88,6 @@ wait
 
 echo "Check for damage"
 umount "$SCRATCH_MNT"
-_check_scratch_fs
 
 echo "Done"
 
diff --git a/tests/generic/170 b/tests/generic/170
index 6d27810..78ed63d 100755
--- a/tests/generic/170
+++ b/tests/generic/170
@@ -88,7 +88,6 @@ wait
 
 echo "Check for damage"
 umount "$SCRATCH_MNT"
-_check_scratch_fs
 
 echo "Done"
 
diff --git a/tests/generic/171 b/tests/generic/171
index ec3729d..4b4f141 100755
--- a/tests/generic/171
+++ b/tests/generic/171
@@ -100,7 +100,6 @@ echo "${out}"
 
 echo "Check scratch fs"
 umount "$SCRATCH_MNT"
-_check_scratch_fs
 
 # success, all done
 status=0
diff --git a/tests/generic/172 b/tests/generic/172
index 1988c8d..98eb97f 100755
--- a/tests/generic/172
+++ b/tests/generic/172
@@ -100,7 +100,6 @@ echo "${out}"
 
 echo "Check scratch fs"
 umount "$SCRATCH_MNT"
-_check_scratch_fs
 
 # success, all done
 status=0
diff --git a/tests/generic/173 b/tests/generic/173
index 5bb9ce6..e26f5a9 100755
--- a/tests/generic/173
+++ b/tests/generic/173
@@ -102,7 +102,6 @@ fi
 
 echo "Check scratch fs"
 umount "$SCRATCH_MNT"
-_check_scratch_fs
 
 # success, all done
 status=0
diff --git a/tests/generic/174 b/tests/generic/174
index a8e0bb5..1749a1c 100755
--- a/tests/generic/174
+++ b/tests/generic/174
@@ -100,7 +100,6 @@ echo "${out}"
 
 echo "Check scratch fs"
 umount "$SCRATCH_MNT"
-_check_scratch_fs
 
 # success, all done
 status=0
diff --git a/tests/generic/175 b/tests/generic/175
index b37ff66..ac2f54f 100755
--- a/tests/generic/175
+++ b/tests/generic/175
@@ -92,7 +92,6 @@ _check_scratch_fs
 echo "Remove all files and recheck"
 _scratch_mount >> "$seqres.full" 2>&1
 umount "$SCRATCH_MNT"
-_check_scratch_fs
 
 # success, all done
 status=0
diff --git a/tests/generic/176 b/tests/generic/176
index 0ca0b17..e32f94f 100755
--- a/tests/generic/176
+++ b/tests/generic/176
@@ -74,7 +74,6 @@ done
 
 echo "Check scratch fs"
 umount "$SCRATCH_MNT"
-_check_scratch_fs
 
 # success, all done
 status=0
diff --git a/tests/generic/183 b/tests/generic/183
index 8141f38..27179fd 100755
--- a/tests/generic/183
+++ b/tests/generic/183
@@ -94,7 +94,6 @@ md5sum "$testdir/file3.chk" | _filter_scratch
 
 echo "Check for damage"
 umount "$SCRATCH_MNT"
-_check_scratch_fs
 
 # success, all done
 status=0
diff --git a/tests/generic/185 b/tests/generic/185
index 1d6dff2..368260d 100755
--- a/tests/generic/185
+++ b/tests/generic/185
@@ -94,7 +94,6 @@ md5sum "$testdir/file3.chk" | _filter_scratch
 
 echo "Check for damage"
 umount "$SCRATCH_MNT"
-_check_scratch_fs
 
 # success, all done
 status=0
diff --git a/tests/generic/186 b/tests/generic/186
index 9aac966..67e52b5 100755
--- a/tests/generic/186
+++ b/tests/generic/186
@@ -139,7 +139,6 @@ md5sum "$testdir/file3.chk" | _filter_scratch
 
 echo "Check for damage"
 umount "$SCRATCH_MNT"
-_check_scratch_fs
 
 # success, all done
 status=0
diff --git a/tests/generic/187 b/tests/generic/187
index b3f1542..c993394 100755
--- a/tests/generic/187
+++ b/tests/generic/187
@@ -139,7 +139,6 @@ md5sum "$testdir/file3.chk" | _filter_scratch
 
 echo "Check for damage"
 umount "$SCRATCH_MNT"
-_check_scratch_fs
 
 # success, all done
 status=0
diff --git a/tests/generic/188 b/tests/generic/188
index c67b847..9e63388 100755
--- a/tests/generic/188
+++ b/tests/generic/188
@@ -89,7 +89,6 @@ md5sum "$testdir/file3.chk" | _filter_scratch
 
 echo "Check for damage"
 umount "$SCRATCH_MNT"
-_check_scratch_fs
 
 # success, all done
 status=0
diff --git a/tests/generic/189 b/tests/generic/189
index 1954235..661129c 100755
--- a/tests/generic/189
+++ b/tests/generic/189
@@ -89,7 +89,6 @@ md5sum "$testdir/file3.chk" | _filter_scratch
 
 echo "Check for damage"
 umount "$SCRATCH_MNT"
-_check_scratch_fs
 
 # success, all done
 status=0
diff --git a/tests/generic/190 b/tests/generic/190
index d3d573b..4e272c2 100755
--- a/tests/generic/190
+++ b/tests/generic/190
@@ -89,7 +89,6 @@ md5sum "$testdir/file3.chk" | _filter_scratch
 
 echo "Check for damage"
 umount "$SCRATCH_MNT"
-_check_scratch_fs
 
 # success, all done
 status=0
diff --git a/tests/generic/191 b/tests/generic/191
index 8b19084..5aadded 100755
--- a/tests/generic/191
+++ b/tests/generic/191
@@ -89,7 +89,6 @@ md5sum "$testdir/file3.chk" | _filter_scratch
 
 echo "Check for damage"
 umount "$SCRATCH_MNT"
-_check_scratch_fs
 
 # success, all done
 status=0
diff --git a/tests/generic/194 b/tests/generic/194
index 1fc2cd7..a17debc 100755
--- a/tests/generic/194
+++ b/tests/generic/194
@@ -94,7 +94,6 @@ md5sum "$testdir/file3.chk" | _filter_scratch
 
 echo "Check for damage"
 umount "$SCRATCH_MNT"
-_check_scratch_fs
 
 # success, all done
 status=0
diff --git a/tests/generic/195 b/tests/generic/195
index 087275c..f49d0c2 100755
--- a/tests/generic/195
+++ b/tests/generic/195
@@ -94,7 +94,6 @@ md5sum "$testdir/file3.chk" | _filter_scratch
 
 echo "Check for damage"
 umount "$SCRATCH_MNT"
-_check_scratch_fs
 
 # success, all done
 status=0
diff --git a/tests/generic/196 b/tests/generic/196
index d815232..4da9c76 100755
--- a/tests/generic/196
+++ b/tests/generic/196
@@ -89,7 +89,6 @@ md5sum "$testdir/file3.chk" | _filter_scratch
 
 echo "Check for damage"
 umount "$SCRATCH_MNT"
-_check_scratch_fs
 
 # success, all done
 status=0
diff --git a/tests/generic/197 b/tests/generic/197
index 54005ae..54ee5ab 100755
--- a/tests/generic/197
+++ b/tests/generic/197
@@ -89,7 +89,6 @@ md5sum "$testdir/file3.chk" | _filter_scratch
 
 echo "Check for damage"
 umount "$SCRATCH_MNT"
-_check_scratch_fs
 
 # success, all done
 status=0
diff --git a/tests/generic/199 b/tests/generic/199
index eb567e4..5e4bca8 100755
--- a/tests/generic/199
+++ b/tests/generic/199
@@ -118,7 +118,6 @@ md5sum "$testdir/file3.chk" | _filter_scratch
 
 echo "Check for damage"
 umount "$SCRATCH_MNT"
-_check_scratch_fs
 
 # success, all done
 status=0
diff --git a/tests/generic/200 b/tests/generic/200
index 991fed0..f0521ae 100755
--- a/tests/generic/200
+++ b/tests/generic/200
@@ -118,7 +118,6 @@ md5sum "$testdir/file3.chk" | _filter_scratch
 
 echo "Check for damage"
 umount "$SCRATCH_MNT"
-_check_scratch_fs
 
 # success, all done
 status=0
diff --git a/tests/generic/201 b/tests/generic/201
index ffc1ce4..db77a5e 100755
--- a/tests/generic/201
+++ b/tests/generic/201
@@ -79,7 +79,6 @@ rm "$testdir/file3"
 
 echo "Check for damage"
 umount "$SCRATCH_MNT"
-_check_scratch_fs
 
 # success, all done
 status=0
diff --git a/tests/generic/202 b/tests/generic/202
index 375b65f..91f2d9b 100755
--- a/tests/generic/202
+++ b/tests/generic/202
@@ -79,7 +79,6 @@ md5sum "$testdir/file2.chk" | _filter_scratch
 
 echo "Check for damage"
 umount "$SCRATCH_MNT"
-_check_scratch_fs
 
 # success, all done
 status=0
diff --git a/tests/generic/203 b/tests/generic/203
index 549f2ba..86a672b 100755
--- a/tests/generic/203
+++ b/tests/generic/203
@@ -79,7 +79,6 @@ md5sum "$testdir/file2.chk" | _filter_scratch
 
 echo "Check for damage"
 umount "$SCRATCH_MNT"
-_check_scratch_fs
 
 # success, all done
 status=0
diff --git a/tests/generic/205 b/tests/generic/205
index 8f0ec45..8fed955 100755
--- a/tests/generic/205
+++ b/tests/generic/205
@@ -95,7 +95,6 @@ cmp -s "$testdir/file2" "$testdir/file2.chk" || _fail "file2 and file2.chk don't
 
 echo "Check for damage"
 umount "$SCRATCH_MNT"
-_check_scratch_fs
 
 # success, all done
 status=0
diff --git a/tests/generic/206 b/tests/generic/206
index f2c4ecc..10b5285 100755
--- a/tests/generic/206
+++ b/tests/generic/206
@@ -95,7 +95,6 @@ cmp -s "$testdir/file2" "$testdir/file2.chk" || _fail "file2 and file2.chk don't
 
 echo "Check for damage"
 umount "$SCRATCH_MNT"
-_check_scratch_fs
 
 # success, all done
 status=0
diff --git a/tests/generic/216 b/tests/generic/216
index 3789cb0..671f0c1 100755
--- a/tests/generic/216
+++ b/tests/generic/216
@@ -96,7 +96,6 @@ cmp -s "$testdir/file2" "$testdir/file2.chk" || _fail "file2 and file2.chk don't
 
 echo "Check for damage"
 umount "$SCRATCH_MNT"
-_check_scratch_fs
 
 # success, all done
 status=0
diff --git a/tests/generic/217 b/tests/generic/217
index 4ae603f..e4d40c7 100755
--- a/tests/generic/217
+++ b/tests/generic/217
@@ -96,7 +96,6 @@ cmp -s "$testdir/file2" "$testdir/file2.chk" || _fail "file2 and file2.chk don't
 
 echo "Check for damage"
 umount "$SCRATCH_MNT"
-_check_scratch_fs
 
 # success, all done
 status=0
diff --git a/tests/generic/218 b/tests/generic/218
index d63c06f..eb52fea 100755
--- a/tests/generic/218
+++ b/tests/generic/218
@@ -90,7 +90,6 @@ cmp -s "$testdir/file2" "$testdir/file2.chk" || _fail "file2 and file2.chk don't
 
 echo "Check for damage"
 umount "$SCRATCH_MNT"
-_check_scratch_fs
 
 # success, all done
 status=0
diff --git a/tests/generic/220 b/tests/generic/220
index ccdb32e..fb5ecda 100755
--- a/tests/generic/220
+++ b/tests/generic/220
@@ -90,7 +90,6 @@ cmp -s "$testdir/file2" "$testdir/file2.chk" || _fail "file2 and file2.chk don't
 
 echo "Check for damage"
 umount "$SCRATCH_MNT"
-_check_scratch_fs
 
 # success, all done
 status=0
diff --git a/tests/generic/222 b/tests/generic/222
index cb5a788..ab3f65f 100755
--- a/tests/generic/222
+++ b/tests/generic/222
@@ -96,7 +96,6 @@ cmp -s "$testdir/file2" "$testdir/file2.chk" || _fail "file2 and file2.chk don't
 
 echo "Check for damage"
 umount "$SCRATCH_MNT"
-_check_scratch_fs
 
 # success, all done
 status=0
diff --git a/tests/generic/227 b/tests/generic/227
index d200424..387c714 100755
--- a/tests/generic/227
+++ b/tests/generic/227
@@ -96,7 +96,6 @@ cmp -s "$testdir/file2" "$testdir/file2.chk" || _fail "file2 and file2.chk don't
 
 echo "Check for damage"
 umount "$SCRATCH_MNT"
-_check_scratch_fs
 
 # success, all done
 status=0
diff --git a/tests/generic/229 b/tests/generic/229
index cdaddaf..eb105a3 100755
--- a/tests/generic/229
+++ b/tests/generic/229
@@ -156,7 +156,6 @@ runtest delalloc regular "$testdir/d-r"
 
 echo "Check for damage"
 umount "$SCRATCH_MNT"
-_check_scratch_fs
 
 # success, all done
 status=0
diff --git a/tests/generic/238 b/tests/generic/238
index 98530e0..02057ad 100755
--- a/tests/generic/238
+++ b/tests/generic/238
@@ -156,7 +156,6 @@ runtest delalloc regular "$testdir/d-r"
 
 echo "Check for damage"
 umount "$SCRATCH_MNT"
-_check_scratch_fs
 
 # success, all done
 status=0
diff --git a/tests/generic/242 b/tests/generic/242
index a5a17c3..3023ac7 100755
--- a/tests/generic/242
+++ b/tests/generic/242
@@ -92,7 +92,6 @@ md5sum "$testdir/file2.chk" | _filter_scratch
 
 echo "Check for damage"
 umount "$SCRATCH_MNT"
-_check_scratch_fs
 
 # success, all done
 status=0
diff --git a/tests/generic/243 b/tests/generic/243
index b7ca466..e65347f 100755
--- a/tests/generic/243
+++ b/tests/generic/243
@@ -92,7 +92,6 @@ md5sum "$testdir/file2.chk" | _filter_scratch
 
 echo "Check for damage"
 umount "$SCRATCH_MNT"
-_check_scratch_fs
 
 # success, all done
 status=0
diff --git a/tests/xfs/127 b/tests/xfs/127
index c31cd17..63d5890 100755
--- a/tests/xfs/127
+++ b/tests/xfs/127
@@ -72,7 +72,6 @@ xfs_info "$SCRATCH_MNT" >> "$seqres.full"
 
 echo "Check scratch fs"
 umount "$SCRATCH_MNT"
-_check_scratch_fs
 
 # success, all done
 status=0
diff --git a/tests/xfs/128 b/tests/xfs/128
index c9547fb..2e1da3f 100755
--- a/tests/xfs/128
+++ b/tests/xfs/128
@@ -142,7 +142,6 @@ _within_tolerance "free blocks after all tests" $free_blocks3 $((free_blocks0 -
 
 echo "Check scratch fs"
 umount "$SCRATCH_MNT"
-_check_scratch_fs
 
 # success, all done
 status=0
diff --git a/tests/xfs/131 b/tests/xfs/131
index 8442821..adab31f 100755
--- a/tests/xfs/131
+++ b/tests/xfs/131
@@ -69,7 +69,6 @@ test -s "$testdir/file2" && _fail "Should not be able to reflink a realtime file
 
 echo "Check restored fs"
 umount "$SCRATCH_MNT"
-_check_scratch_fs
 
 # success, all done
 status=0
diff --git a/tests/xfs/139 b/tests/xfs/139
index 51c903e..feb55bd 100755
--- a/tests/xfs/139
+++ b/tests/xfs/139
@@ -75,7 +75,6 @@ md5sum "$testdir/file2" | _filter_scratch
 
 echo "Check scratch fs"
 umount "$SCRATCH_MNT"
-_check_scratch_fs
 
 # success, all done
 status=0
diff --git a/tests/xfs/140 b/tests/xfs/140
index 133bb72..309b284 100644
--- a/tests/xfs/140
+++ b/tests/xfs/140
@@ -82,7 +82,6 @@ cmp -s "$testdir/file2" "$testdir/file2.chk" || echo "file2 and file2.chk do not
 
 echo "Check scratch fs"
 umount "$SCRATCH_MNT"
-_check_scratch_fs
 
 # success, all done
 status=0


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

* [PATCH 04/32] reflink: remove redundant filesystem checks from the end of the tests
@ 2016-02-11 23:39   ` Darrick J. Wong
  0 siblings, 0 replies; 81+ messages in thread
From: Darrick J. Wong @ 2016-02-11 23:39 UTC (permalink / raw)
  To: david, darrick.wong; +Cc: fstests, linux-btrfs, xfs

Turns out that check already runs _check_filesystems after each test,
so we don't need to do this at the end of each test.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 tests/generic/157 |    1 -
 tests/generic/158 |    1 -
 tests/generic/161 |    1 -
 tests/generic/162 |    1 -
 tests/generic/163 |    1 -
 tests/generic/164 |    1 -
 tests/generic/165 |    1 -
 tests/generic/166 |    1 -
 tests/generic/167 |    1 -
 tests/generic/168 |    1 -
 tests/generic/170 |    1 -
 tests/generic/171 |    1 -
 tests/generic/172 |    1 -
 tests/generic/173 |    1 -
 tests/generic/174 |    1 -
 tests/generic/175 |    1 -
 tests/generic/176 |    1 -
 tests/generic/183 |    1 -
 tests/generic/185 |    1 -
 tests/generic/186 |    1 -
 tests/generic/187 |    1 -
 tests/generic/188 |    1 -
 tests/generic/189 |    1 -
 tests/generic/190 |    1 -
 tests/generic/191 |    1 -
 tests/generic/194 |    1 -
 tests/generic/195 |    1 -
 tests/generic/196 |    1 -
 tests/generic/197 |    1 -
 tests/generic/199 |    1 -
 tests/generic/200 |    1 -
 tests/generic/201 |    1 -
 tests/generic/202 |    1 -
 tests/generic/203 |    1 -
 tests/generic/205 |    1 -
 tests/generic/206 |    1 -
 tests/generic/216 |    1 -
 tests/generic/217 |    1 -
 tests/generic/218 |    1 -
 tests/generic/220 |    1 -
 tests/generic/222 |    1 -
 tests/generic/227 |    1 -
 tests/generic/229 |    1 -
 tests/generic/238 |    1 -
 tests/generic/242 |    1 -
 tests/generic/243 |    1 -
 tests/xfs/127     |    1 -
 tests/xfs/128     |    1 -
 tests/xfs/131     |    1 -
 tests/xfs/139     |    1 -
 tests/xfs/140     |    1 -
 51 files changed, 51 deletions(-)


diff --git a/tests/generic/157 b/tests/generic/157
index 0150866..74314d8 100755
--- a/tests/generic/157
+++ b/tests/generic/157
@@ -123,7 +123,6 @@ _reflink_range "$testdir2/file1" 0 "$testdir2/file2" 0 $blksz >> "$seqres.full"
 
 echo "Check scratch fs"
 _scratch_unmount
-_check_scratch_fs
 
 # success, all done
 status=0
diff --git a/tests/generic/158 b/tests/generic/158
index 807c247..779d55e 100755
--- a/tests/generic/158
+++ b/tests/generic/158
@@ -124,7 +124,6 @@ _dedupe_range "$testdir2/file1" 0 "$testdir2/file2" 0 $blksz >> "$seqres.full"
 
 echo "Check scratch fs"
 _scratch_unmount
-_check_scratch_fs
 
 # success, all done
 status=0
diff --git a/tests/generic/161 b/tests/generic/161
index 7fb8963..b271936 100755
--- a/tests/generic/161
+++ b/tests/generic/161
@@ -71,7 +71,6 @@ wait
 
 echo "Check fs"
 umount "$SCRATCH_MNT"
-_check_scratch_fs
 
 echo "Done"
 # success, all done
diff --git a/tests/generic/162 b/tests/generic/162
index 2fb947a..30c761b 100755
--- a/tests/generic/162
+++ b/tests/generic/162
@@ -87,7 +87,6 @@ wait
 
 echo "Check fs"
 umount "$SCRATCH_MNT"
-_check_scratch_fs
 
 echo "Done"
 # success, all done
diff --git a/tests/generic/163 b/tests/generic/163
index 0186443..f2ea334 100755
--- a/tests/generic/163
+++ b/tests/generic/163
@@ -87,7 +87,6 @@ wait
 
 echo "Check fs"
 umount "$SCRATCH_MNT"
-_check_scratch_fs
 
 echo "Done"
 # success, all done
diff --git a/tests/generic/164 b/tests/generic/164
index 087c6ba..e97ac13 100755
--- a/tests/generic/164
+++ b/tests/generic/164
@@ -97,7 +97,6 @@ wait
 
 echo "Check fs"
 umount "$SCRATCH_MNT"
-_check_scratch_fs
 
 echo "Done"
 # success, all done
diff --git a/tests/generic/165 b/tests/generic/165
index 6bd15e1..b305079 100755
--- a/tests/generic/165
+++ b/tests/generic/165
@@ -97,7 +97,6 @@ wait
 
 echo "Check fs"
 umount "$SCRATCH_MNT"
-_check_scratch_fs
 
 echo "Done"
 # success, all done
diff --git a/tests/generic/166 b/tests/generic/166
index 6cfb821..2c2ff4e 100755
--- a/tests/generic/166
+++ b/tests/generic/166
@@ -84,7 +84,6 @@ wait
 
 echo "Check for damage"
 _scratch_unmount
-_check_scratch_fs
 
 echo "Done"
 
diff --git a/tests/generic/167 b/tests/generic/167
index fc5a86c..b80b481 100755
--- a/tests/generic/167
+++ b/tests/generic/167
@@ -84,7 +84,6 @@ wait
 
 echo "Check for damage"
 _scratch_unmount
-_check_scratch_fs
 
 echo "Done"
 
diff --git a/tests/generic/168 b/tests/generic/168
index ee3848d..0d620da 100755
--- a/tests/generic/168
+++ b/tests/generic/168
@@ -88,7 +88,6 @@ wait
 
 echo "Check for damage"
 umount "$SCRATCH_MNT"
-_check_scratch_fs
 
 echo "Done"
 
diff --git a/tests/generic/170 b/tests/generic/170
index 6d27810..78ed63d 100755
--- a/tests/generic/170
+++ b/tests/generic/170
@@ -88,7 +88,6 @@ wait
 
 echo "Check for damage"
 umount "$SCRATCH_MNT"
-_check_scratch_fs
 
 echo "Done"
 
diff --git a/tests/generic/171 b/tests/generic/171
index ec3729d..4b4f141 100755
--- a/tests/generic/171
+++ b/tests/generic/171
@@ -100,7 +100,6 @@ echo "${out}"
 
 echo "Check scratch fs"
 umount "$SCRATCH_MNT"
-_check_scratch_fs
 
 # success, all done
 status=0
diff --git a/tests/generic/172 b/tests/generic/172
index 1988c8d..98eb97f 100755
--- a/tests/generic/172
+++ b/tests/generic/172
@@ -100,7 +100,6 @@ echo "${out}"
 
 echo "Check scratch fs"
 umount "$SCRATCH_MNT"
-_check_scratch_fs
 
 # success, all done
 status=0
diff --git a/tests/generic/173 b/tests/generic/173
index 5bb9ce6..e26f5a9 100755
--- a/tests/generic/173
+++ b/tests/generic/173
@@ -102,7 +102,6 @@ fi
 
 echo "Check scratch fs"
 umount "$SCRATCH_MNT"
-_check_scratch_fs
 
 # success, all done
 status=0
diff --git a/tests/generic/174 b/tests/generic/174
index a8e0bb5..1749a1c 100755
--- a/tests/generic/174
+++ b/tests/generic/174
@@ -100,7 +100,6 @@ echo "${out}"
 
 echo "Check scratch fs"
 umount "$SCRATCH_MNT"
-_check_scratch_fs
 
 # success, all done
 status=0
diff --git a/tests/generic/175 b/tests/generic/175
index b37ff66..ac2f54f 100755
--- a/tests/generic/175
+++ b/tests/generic/175
@@ -92,7 +92,6 @@ _check_scratch_fs
 echo "Remove all files and recheck"
 _scratch_mount >> "$seqres.full" 2>&1
 umount "$SCRATCH_MNT"
-_check_scratch_fs
 
 # success, all done
 status=0
diff --git a/tests/generic/176 b/tests/generic/176
index 0ca0b17..e32f94f 100755
--- a/tests/generic/176
+++ b/tests/generic/176
@@ -74,7 +74,6 @@ done
 
 echo "Check scratch fs"
 umount "$SCRATCH_MNT"
-_check_scratch_fs
 
 # success, all done
 status=0
diff --git a/tests/generic/183 b/tests/generic/183
index 8141f38..27179fd 100755
--- a/tests/generic/183
+++ b/tests/generic/183
@@ -94,7 +94,6 @@ md5sum "$testdir/file3.chk" | _filter_scratch
 
 echo "Check for damage"
 umount "$SCRATCH_MNT"
-_check_scratch_fs
 
 # success, all done
 status=0
diff --git a/tests/generic/185 b/tests/generic/185
index 1d6dff2..368260d 100755
--- a/tests/generic/185
+++ b/tests/generic/185
@@ -94,7 +94,6 @@ md5sum "$testdir/file3.chk" | _filter_scratch
 
 echo "Check for damage"
 umount "$SCRATCH_MNT"
-_check_scratch_fs
 
 # success, all done
 status=0
diff --git a/tests/generic/186 b/tests/generic/186
index 9aac966..67e52b5 100755
--- a/tests/generic/186
+++ b/tests/generic/186
@@ -139,7 +139,6 @@ md5sum "$testdir/file3.chk" | _filter_scratch
 
 echo "Check for damage"
 umount "$SCRATCH_MNT"
-_check_scratch_fs
 
 # success, all done
 status=0
diff --git a/tests/generic/187 b/tests/generic/187
index b3f1542..c993394 100755
--- a/tests/generic/187
+++ b/tests/generic/187
@@ -139,7 +139,6 @@ md5sum "$testdir/file3.chk" | _filter_scratch
 
 echo "Check for damage"
 umount "$SCRATCH_MNT"
-_check_scratch_fs
 
 # success, all done
 status=0
diff --git a/tests/generic/188 b/tests/generic/188
index c67b847..9e63388 100755
--- a/tests/generic/188
+++ b/tests/generic/188
@@ -89,7 +89,6 @@ md5sum "$testdir/file3.chk" | _filter_scratch
 
 echo "Check for damage"
 umount "$SCRATCH_MNT"
-_check_scratch_fs
 
 # success, all done
 status=0
diff --git a/tests/generic/189 b/tests/generic/189
index 1954235..661129c 100755
--- a/tests/generic/189
+++ b/tests/generic/189
@@ -89,7 +89,6 @@ md5sum "$testdir/file3.chk" | _filter_scratch
 
 echo "Check for damage"
 umount "$SCRATCH_MNT"
-_check_scratch_fs
 
 # success, all done
 status=0
diff --git a/tests/generic/190 b/tests/generic/190
index d3d573b..4e272c2 100755
--- a/tests/generic/190
+++ b/tests/generic/190
@@ -89,7 +89,6 @@ md5sum "$testdir/file3.chk" | _filter_scratch
 
 echo "Check for damage"
 umount "$SCRATCH_MNT"
-_check_scratch_fs
 
 # success, all done
 status=0
diff --git a/tests/generic/191 b/tests/generic/191
index 8b19084..5aadded 100755
--- a/tests/generic/191
+++ b/tests/generic/191
@@ -89,7 +89,6 @@ md5sum "$testdir/file3.chk" | _filter_scratch
 
 echo "Check for damage"
 umount "$SCRATCH_MNT"
-_check_scratch_fs
 
 # success, all done
 status=0
diff --git a/tests/generic/194 b/tests/generic/194
index 1fc2cd7..a17debc 100755
--- a/tests/generic/194
+++ b/tests/generic/194
@@ -94,7 +94,6 @@ md5sum "$testdir/file3.chk" | _filter_scratch
 
 echo "Check for damage"
 umount "$SCRATCH_MNT"
-_check_scratch_fs
 
 # success, all done
 status=0
diff --git a/tests/generic/195 b/tests/generic/195
index 087275c..f49d0c2 100755
--- a/tests/generic/195
+++ b/tests/generic/195
@@ -94,7 +94,6 @@ md5sum "$testdir/file3.chk" | _filter_scratch
 
 echo "Check for damage"
 umount "$SCRATCH_MNT"
-_check_scratch_fs
 
 # success, all done
 status=0
diff --git a/tests/generic/196 b/tests/generic/196
index d815232..4da9c76 100755
--- a/tests/generic/196
+++ b/tests/generic/196
@@ -89,7 +89,6 @@ md5sum "$testdir/file3.chk" | _filter_scratch
 
 echo "Check for damage"
 umount "$SCRATCH_MNT"
-_check_scratch_fs
 
 # success, all done
 status=0
diff --git a/tests/generic/197 b/tests/generic/197
index 54005ae..54ee5ab 100755
--- a/tests/generic/197
+++ b/tests/generic/197
@@ -89,7 +89,6 @@ md5sum "$testdir/file3.chk" | _filter_scratch
 
 echo "Check for damage"
 umount "$SCRATCH_MNT"
-_check_scratch_fs
 
 # success, all done
 status=0
diff --git a/tests/generic/199 b/tests/generic/199
index eb567e4..5e4bca8 100755
--- a/tests/generic/199
+++ b/tests/generic/199
@@ -118,7 +118,6 @@ md5sum "$testdir/file3.chk" | _filter_scratch
 
 echo "Check for damage"
 umount "$SCRATCH_MNT"
-_check_scratch_fs
 
 # success, all done
 status=0
diff --git a/tests/generic/200 b/tests/generic/200
index 991fed0..f0521ae 100755
--- a/tests/generic/200
+++ b/tests/generic/200
@@ -118,7 +118,6 @@ md5sum "$testdir/file3.chk" | _filter_scratch
 
 echo "Check for damage"
 umount "$SCRATCH_MNT"
-_check_scratch_fs
 
 # success, all done
 status=0
diff --git a/tests/generic/201 b/tests/generic/201
index ffc1ce4..db77a5e 100755
--- a/tests/generic/201
+++ b/tests/generic/201
@@ -79,7 +79,6 @@ rm "$testdir/file3"
 
 echo "Check for damage"
 umount "$SCRATCH_MNT"
-_check_scratch_fs
 
 # success, all done
 status=0
diff --git a/tests/generic/202 b/tests/generic/202
index 375b65f..91f2d9b 100755
--- a/tests/generic/202
+++ b/tests/generic/202
@@ -79,7 +79,6 @@ md5sum "$testdir/file2.chk" | _filter_scratch
 
 echo "Check for damage"
 umount "$SCRATCH_MNT"
-_check_scratch_fs
 
 # success, all done
 status=0
diff --git a/tests/generic/203 b/tests/generic/203
index 549f2ba..86a672b 100755
--- a/tests/generic/203
+++ b/tests/generic/203
@@ -79,7 +79,6 @@ md5sum "$testdir/file2.chk" | _filter_scratch
 
 echo "Check for damage"
 umount "$SCRATCH_MNT"
-_check_scratch_fs
 
 # success, all done
 status=0
diff --git a/tests/generic/205 b/tests/generic/205
index 8f0ec45..8fed955 100755
--- a/tests/generic/205
+++ b/tests/generic/205
@@ -95,7 +95,6 @@ cmp -s "$testdir/file2" "$testdir/file2.chk" || _fail "file2 and file2.chk don't
 
 echo "Check for damage"
 umount "$SCRATCH_MNT"
-_check_scratch_fs
 
 # success, all done
 status=0
diff --git a/tests/generic/206 b/tests/generic/206
index f2c4ecc..10b5285 100755
--- a/tests/generic/206
+++ b/tests/generic/206
@@ -95,7 +95,6 @@ cmp -s "$testdir/file2" "$testdir/file2.chk" || _fail "file2 and file2.chk don't
 
 echo "Check for damage"
 umount "$SCRATCH_MNT"
-_check_scratch_fs
 
 # success, all done
 status=0
diff --git a/tests/generic/216 b/tests/generic/216
index 3789cb0..671f0c1 100755
--- a/tests/generic/216
+++ b/tests/generic/216
@@ -96,7 +96,6 @@ cmp -s "$testdir/file2" "$testdir/file2.chk" || _fail "file2 and file2.chk don't
 
 echo "Check for damage"
 umount "$SCRATCH_MNT"
-_check_scratch_fs
 
 # success, all done
 status=0
diff --git a/tests/generic/217 b/tests/generic/217
index 4ae603f..e4d40c7 100755
--- a/tests/generic/217
+++ b/tests/generic/217
@@ -96,7 +96,6 @@ cmp -s "$testdir/file2" "$testdir/file2.chk" || _fail "file2 and file2.chk don't
 
 echo "Check for damage"
 umount "$SCRATCH_MNT"
-_check_scratch_fs
 
 # success, all done
 status=0
diff --git a/tests/generic/218 b/tests/generic/218
index d63c06f..eb52fea 100755
--- a/tests/generic/218
+++ b/tests/generic/218
@@ -90,7 +90,6 @@ cmp -s "$testdir/file2" "$testdir/file2.chk" || _fail "file2 and file2.chk don't
 
 echo "Check for damage"
 umount "$SCRATCH_MNT"
-_check_scratch_fs
 
 # success, all done
 status=0
diff --git a/tests/generic/220 b/tests/generic/220
index ccdb32e..fb5ecda 100755
--- a/tests/generic/220
+++ b/tests/generic/220
@@ -90,7 +90,6 @@ cmp -s "$testdir/file2" "$testdir/file2.chk" || _fail "file2 and file2.chk don't
 
 echo "Check for damage"
 umount "$SCRATCH_MNT"
-_check_scratch_fs
 
 # success, all done
 status=0
diff --git a/tests/generic/222 b/tests/generic/222
index cb5a788..ab3f65f 100755
--- a/tests/generic/222
+++ b/tests/generic/222
@@ -96,7 +96,6 @@ cmp -s "$testdir/file2" "$testdir/file2.chk" || _fail "file2 and file2.chk don't
 
 echo "Check for damage"
 umount "$SCRATCH_MNT"
-_check_scratch_fs
 
 # success, all done
 status=0
diff --git a/tests/generic/227 b/tests/generic/227
index d200424..387c714 100755
--- a/tests/generic/227
+++ b/tests/generic/227
@@ -96,7 +96,6 @@ cmp -s "$testdir/file2" "$testdir/file2.chk" || _fail "file2 and file2.chk don't
 
 echo "Check for damage"
 umount "$SCRATCH_MNT"
-_check_scratch_fs
 
 # success, all done
 status=0
diff --git a/tests/generic/229 b/tests/generic/229
index cdaddaf..eb105a3 100755
--- a/tests/generic/229
+++ b/tests/generic/229
@@ -156,7 +156,6 @@ runtest delalloc regular "$testdir/d-r"
 
 echo "Check for damage"
 umount "$SCRATCH_MNT"
-_check_scratch_fs
 
 # success, all done
 status=0
diff --git a/tests/generic/238 b/tests/generic/238
index 98530e0..02057ad 100755
--- a/tests/generic/238
+++ b/tests/generic/238
@@ -156,7 +156,6 @@ runtest delalloc regular "$testdir/d-r"
 
 echo "Check for damage"
 umount "$SCRATCH_MNT"
-_check_scratch_fs
 
 # success, all done
 status=0
diff --git a/tests/generic/242 b/tests/generic/242
index a5a17c3..3023ac7 100755
--- a/tests/generic/242
+++ b/tests/generic/242
@@ -92,7 +92,6 @@ md5sum "$testdir/file2.chk" | _filter_scratch
 
 echo "Check for damage"
 umount "$SCRATCH_MNT"
-_check_scratch_fs
 
 # success, all done
 status=0
diff --git a/tests/generic/243 b/tests/generic/243
index b7ca466..e65347f 100755
--- a/tests/generic/243
+++ b/tests/generic/243
@@ -92,7 +92,6 @@ md5sum "$testdir/file2.chk" | _filter_scratch
 
 echo "Check for damage"
 umount "$SCRATCH_MNT"
-_check_scratch_fs
 
 # success, all done
 status=0
diff --git a/tests/xfs/127 b/tests/xfs/127
index c31cd17..63d5890 100755
--- a/tests/xfs/127
+++ b/tests/xfs/127
@@ -72,7 +72,6 @@ xfs_info "$SCRATCH_MNT" >> "$seqres.full"
 
 echo "Check scratch fs"
 umount "$SCRATCH_MNT"
-_check_scratch_fs
 
 # success, all done
 status=0
diff --git a/tests/xfs/128 b/tests/xfs/128
index c9547fb..2e1da3f 100755
--- a/tests/xfs/128
+++ b/tests/xfs/128
@@ -142,7 +142,6 @@ _within_tolerance "free blocks after all tests" $free_blocks3 $((free_blocks0 -
 
 echo "Check scratch fs"
 umount "$SCRATCH_MNT"
-_check_scratch_fs
 
 # success, all done
 status=0
diff --git a/tests/xfs/131 b/tests/xfs/131
index 8442821..adab31f 100755
--- a/tests/xfs/131
+++ b/tests/xfs/131
@@ -69,7 +69,6 @@ test -s "$testdir/file2" && _fail "Should not be able to reflink a realtime file
 
 echo "Check restored fs"
 umount "$SCRATCH_MNT"
-_check_scratch_fs
 
 # success, all done
 status=0
diff --git a/tests/xfs/139 b/tests/xfs/139
index 51c903e..feb55bd 100755
--- a/tests/xfs/139
+++ b/tests/xfs/139
@@ -75,7 +75,6 @@ md5sum "$testdir/file2" | _filter_scratch
 
 echo "Check scratch fs"
 umount "$SCRATCH_MNT"
-_check_scratch_fs
 
 # success, all done
 status=0
diff --git a/tests/xfs/140 b/tests/xfs/140
index 133bb72..309b284 100644
--- a/tests/xfs/140
+++ b/tests/xfs/140
@@ -82,7 +82,6 @@ cmp -s "$testdir/file2" "$testdir/file2.chk" || echo "file2 and file2.chk do not
 
 echo "Check scratch fs"
 umount "$SCRATCH_MNT"
-_check_scratch_fs
 
 # success, all done
 status=0

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

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

* [PATCH 05/32] reflink: remove unnecessary umounts from test code
  2016-02-11 23:39 ` Darrick J. Wong
@ 2016-02-11 23:39   ` Darrick J. Wong
  -1 siblings, 0 replies; 81+ messages in thread
From: Darrick J. Wong @ 2016-02-11 23:39 UTC (permalink / raw)
  To: david, darrick.wong; +Cc: linux-btrfs, fstests, xfs

The test harness already takes care of this, so get rid of it.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 tests/generic/157     |    3 ---
 tests/generic/157.out |    1 -
 tests/generic/158     |    3 ---
 tests/generic/158.out |    1 -
 tests/generic/161     |    4 ----
 tests/generic/161.out |    2 --
 tests/generic/162     |    4 ----
 tests/generic/162.out |    2 --
 tests/generic/163     |    4 ----
 tests/generic/163.out |    2 --
 tests/generic/164     |    4 ----
 tests/generic/164.out |    2 --
 tests/generic/165     |    4 ----
 tests/generic/165.out |    2 --
 tests/generic/166     |    5 -----
 tests/generic/166.out |    2 --
 tests/generic/167     |    5 -----
 tests/generic/167.out |    2 --
 tests/generic/168     |    5 -----
 tests/generic/168.out |    2 --
 tests/generic/170     |    5 -----
 tests/generic/170.out |    2 --
 tests/generic/171     |    6 ------
 tests/generic/171.out |    1 -
 tests/generic/172     |    6 ------
 tests/generic/172.out |    1 -
 tests/generic/173     |    6 ------
 tests/generic/173.out |    1 -
 tests/generic/174     |    6 ------
 tests/generic/174.out |    1 -
 tests/generic/183     |    3 ---
 tests/generic/183.out |    1 -
 tests/generic/185     |    3 ---
 tests/generic/185.out |    1 -
 tests/generic/186     |    3 ---
 tests/generic/186.out |    1 -
 tests/generic/187     |    3 ---
 tests/generic/187.out |    1 -
 tests/generic/188     |    3 ---
 tests/generic/188.out |    1 -
 tests/generic/189     |    3 ---
 tests/generic/189.out |    1 -
 tests/generic/190     |    3 ---
 tests/generic/190.out |    1 -
 tests/generic/191     |    3 ---
 tests/generic/191.out |    1 -
 tests/generic/194     |    3 ---
 tests/generic/194.out |    1 -
 tests/generic/195     |    3 ---
 tests/generic/195.out |    1 -
 tests/generic/196     |    3 ---
 tests/generic/196.out |    1 -
 tests/generic/197     |    3 ---
 tests/generic/197.out |    1 -
 tests/generic/199     |    3 ---
 tests/generic/199.out |    1 -
 tests/generic/200     |    3 ---
 tests/generic/200.out |    1 -
 tests/generic/201     |    3 ---
 tests/generic/201.out |    1 -
 tests/generic/202     |    3 ---
 tests/generic/202.out |    1 -
 tests/generic/203     |    3 ---
 tests/generic/203.out |    1 -
 tests/generic/205     |    3 ---
 tests/generic/205.out |    1 -
 tests/generic/206     |    3 ---
 tests/generic/206.out |    1 -
 tests/generic/216     |    3 ---
 tests/generic/216.out |    1 -
 tests/generic/217     |    3 ---
 tests/generic/217.out |    1 -
 tests/generic/218     |    3 ---
 tests/generic/218.out |    1 -
 tests/generic/220     |    3 ---
 tests/generic/220.out |    1 -
 tests/generic/222     |    3 ---
 tests/generic/222.out |    1 -
 tests/generic/227     |    3 ---
 tests/generic/227.out |    1 -
 tests/generic/229     |    3 ---
 tests/generic/229.out |    1 -
 tests/generic/238     |    3 ---
 tests/generic/238.out |    1 -
 tests/generic/242     |    3 ---
 tests/generic/242.out |    1 -
 tests/generic/243     |    3 ---
 tests/generic/243.out |    1 -
 tests/xfs/127         |    3 ---
 tests/xfs/127.out     |    1 -
 tests/xfs/128         |    3 ---
 tests/xfs/128.out     |    1 -
 tests/xfs/131         |    3 ---
 tests/xfs/131.out     |    1 -
 tests/xfs/139         |    3 ---
 tests/xfs/139.out     |    1 -
 tests/xfs/140         |    3 ---
 tests/xfs/140.out     |    1 -
 98 files changed, 230 deletions(-)


diff --git a/tests/generic/157 b/tests/generic/157
index 74314d8..19a9a18 100755
--- a/tests/generic/157
+++ b/tests/generic/157
@@ -121,9 +121,6 @@ echo "Reflink two files"
 _reflink_range "$testdir1/file1" 0 "$testdir1/file2" 0 $blksz >> "$seqres.full"
 _reflink_range "$testdir2/file1" 0 "$testdir2/file2" 0 $blksz >> "$seqres.full"
 
-echo "Check scratch fs"
-_scratch_unmount
-
 # success, all done
 status=0
 exit
diff --git a/tests/generic/157.out b/tests/generic/157.out
index ac3c440..d4f64b4 100644
--- a/tests/generic/157.out
+++ b/tests/generic/157.out
@@ -22,4 +22,3 @@ XFS_IOC_CLONE_RANGE: Invalid argument
 Try to reflink an append-only file
 XFS_IOC_CLONE_RANGE: Bad file descriptor
 Reflink two files
-Check scratch fs
diff --git a/tests/generic/158 b/tests/generic/158
index 779d55e..4b51973 100755
--- a/tests/generic/158
+++ b/tests/generic/158
@@ -122,9 +122,6 @@ echo "Dedupe two files"
 _dedupe_range "$testdir1/file1" 0 "$testdir1/file2" 0 $blksz >> "$seqres.full"
 _dedupe_range "$testdir2/file1" 0 "$testdir2/file2" 0 $blksz >> "$seqres.full"
 
-echo "Check scratch fs"
-_scratch_unmount
-
 # success, all done
 status=0
 exit
diff --git a/tests/generic/158.out b/tests/generic/158.out
index dff3692..7f88403 100644
--- a/tests/generic/158.out
+++ b/tests/generic/158.out
@@ -21,4 +21,3 @@ Try to dedupe to a fifo
 dedupe: Invalid argument
 Try to dedupe an append-only file
 Dedupe two files
-Check scratch fs
diff --git a/tests/generic/161 b/tests/generic/161
index b271936..1d5364e 100755
--- a/tests/generic/161
+++ b/tests/generic/161
@@ -69,10 +69,6 @@ rm -rf "$testdir/file1" &
 _pwrite_byte 0x62 0 $((loops * blksz)) "$testdir/file1" >> "$seqres.full"
 wait
 
-echo "Check fs"
-umount "$SCRATCH_MNT"
-
-echo "Done"
 # success, all done
 status=0
 exit
diff --git a/tests/generic/161.out b/tests/generic/161.out
index 1db11c3..34cb6f2 100644
--- a/tests/generic/161.out
+++ b/tests/generic/161.out
@@ -2,5 +2,3 @@ QA output created by 161
 Format and mount
 Initialize files
 Delete while rewriting
-Check fs
-Done
diff --git a/tests/generic/162 b/tests/generic/162
index 30c761b..9044545 100755
--- a/tests/generic/162
+++ b/tests/generic/162
@@ -85,10 +85,6 @@ echo "Finished dedupeing"
 touch "$testdir/finished"
 wait
 
-echo "Check fs"
-umount "$SCRATCH_MNT"
-
-echo "Done"
 # success, all done
 status=0
 exit
diff --git a/tests/generic/162.out b/tests/generic/162.out
index 4481f8c..e57db12 100644
--- a/tests/generic/162.out
+++ b/tests/generic/162.out
@@ -3,5 +3,3 @@ Format and mount
 Initialize files
 Dedupe and rewrite the file!
 Finished dedupeing
-Check fs
-Done
diff --git a/tests/generic/163 b/tests/generic/163
index f2ea334..651d445 100755
--- a/tests/generic/163
+++ b/tests/generic/163
@@ -85,10 +85,6 @@ echo "Finished dedupeing"
 touch "$testdir/finished"
 wait
 
-echo "Check fs"
-umount "$SCRATCH_MNT"
-
-echo "Done"
 # success, all done
 status=0
 exit
diff --git a/tests/generic/163.out b/tests/generic/163.out
index 2d27d1b..604e53b 100644
--- a/tests/generic/163.out
+++ b/tests/generic/163.out
@@ -3,5 +3,3 @@ Format and mount
 Initialize files
 Dedupe and rewrite the file!
 Finished dedupeing
-Check fs
-Done
diff --git a/tests/generic/164 b/tests/generic/164
index e97ac13..6c19c7d 100755
--- a/tests/generic/164
+++ b/tests/generic/164
@@ -95,10 +95,6 @@ echo "Finished reflinking"
 touch "$testdir/finished"
 wait
 
-echo "Check fs"
-umount "$SCRATCH_MNT"
-
-echo "Done"
 # success, all done
 status=0
 exit
diff --git a/tests/generic/164.out b/tests/generic/164.out
index 0b4ed70..f4ff869 100644
--- a/tests/generic/164.out
+++ b/tests/generic/164.out
@@ -3,5 +3,3 @@ Format and mount
 Initialize files
 Reflink and reread the files!
 Finished reflinking
-Check fs
-Done
diff --git a/tests/generic/165 b/tests/generic/165
index b305079..2e380a9 100755
--- a/tests/generic/165
+++ b/tests/generic/165
@@ -95,10 +95,6 @@ echo "Finished reflinking"
 touch "$testdir/finished"
 wait
 
-echo "Check fs"
-umount "$SCRATCH_MNT"
-
-echo "Done"
 # success, all done
 status=0
 exit
diff --git a/tests/generic/165.out b/tests/generic/165.out
index a89071d..31e9bef 100644
--- a/tests/generic/165.out
+++ b/tests/generic/165.out
@@ -3,5 +3,3 @@ Format and mount
 Initialize files
 Reflink and dio reread the files!
 Finished reflinking
-Check fs
-Done
diff --git a/tests/generic/166 b/tests/generic/166
index 2c2ff4e..028ee11 100755
--- a/tests/generic/166
+++ b/tests/generic/166
@@ -82,11 +82,6 @@ done
 touch $testdir/finished
 wait
 
-echo "Check for damage"
-_scratch_unmount
-
-echo "Done"
-
 # success, all done
 status=0
 exit
diff --git a/tests/generic/166.out b/tests/generic/166.out
index a2ba34e..8cb81a0 100644
--- a/tests/generic/166.out
+++ b/tests/generic/166.out
@@ -2,5 +2,3 @@ QA output created by 166
 Format and mount
 Initialize file
 Snapshot a file undergoing directio rewrite
-Check for damage
-Done
diff --git a/tests/generic/167 b/tests/generic/167
index b80b481..a4bf4f4 100755
--- a/tests/generic/167
+++ b/tests/generic/167
@@ -82,11 +82,6 @@ done
 touch $testdir/finished
 wait
 
-echo "Check for damage"
-_scratch_unmount
-
-echo "Done"
-
 # success, all done
 status=0
 exit
diff --git a/tests/generic/167.out b/tests/generic/167.out
index 7cfb14e..a0e90b1 100644
--- a/tests/generic/167.out
+++ b/tests/generic/167.out
@@ -2,5 +2,3 @@ QA output created by 167
 Format and mount
 Initialize file
 Snapshot a file undergoing buffered rewrite
-Check for damage
-Done
diff --git a/tests/generic/168 b/tests/generic/168
index 0d620da..2ffc5b6 100755
--- a/tests/generic/168
+++ b/tests/generic/168
@@ -86,11 +86,6 @@ done
 touch "$testdir/finished"
 wait
 
-echo "Check for damage"
-umount "$SCRATCH_MNT"
-
-echo "Done"
-
 # success, all done
 status=0
 exit
diff --git a/tests/generic/168.out b/tests/generic/168.out
index d0dd08e..2687e7c 100644
--- a/tests/generic/168.out
+++ b/tests/generic/168.out
@@ -2,5 +2,3 @@ QA output created by 168
 Format and mount
 Initialize files
 Reflink and write the target
-Check for damage
-Done
diff --git a/tests/generic/170 b/tests/generic/170
index 78ed63d..2a81cad 100755
--- a/tests/generic/170
+++ b/tests/generic/170
@@ -86,11 +86,6 @@ done
 touch "$testdir/finished"
 wait
 
-echo "Check for damage"
-umount "$SCRATCH_MNT"
-
-echo "Done"
-
 # success, all done
 status=0
 exit
diff --git a/tests/generic/170.out b/tests/generic/170.out
index 103aaa5..debd6ca 100644
--- a/tests/generic/170.out
+++ b/tests/generic/170.out
@@ -2,5 +2,3 @@ QA output created by 170
 Format and mount
 Initialize files
 Reflink and dio write the target
-Check for damage
-Done
diff --git a/tests/generic/171 b/tests/generic/171
index 4b4f141..d865f64 100755
--- a/tests/generic/171
+++ b/tests/generic/171
@@ -95,12 +95,6 @@ echo "${out}" | grep -q "No space left on device" || echo "CoW should have faile
 echo "${out}" >> "$seqres.full" 2>&1
 echo "${out}"
 
-#filefrag -v $testdir/bigfile
-#filefrag -v $testdir/clonefile
-
-echo "Check scratch fs"
-umount "$SCRATCH_MNT"
-
 # success, all done
 status=0
 exit
diff --git a/tests/generic/171.out b/tests/generic/171.out
index c2b0ddd..a999eb0 100644
--- a/tests/generic/171.out
+++ b/tests/generic/171.out
@@ -7,4 +7,3 @@ CoW the big file
 pwrite64: No space left on device
 Remount and try CoW again
 pwrite64: No space left on device
-Check scratch fs
diff --git a/tests/generic/172 b/tests/generic/172
index 98eb97f..e6020f1 100755
--- a/tests/generic/172
+++ b/tests/generic/172
@@ -95,12 +95,6 @@ echo "${out}" | grep -q "No space left on device" || echo "CoW should have faile
 echo "${out}" >> "$seqres.full" 2>&1
 echo "${out}"
 
-#filefrag -v $testdir/bigfile
-#filefrag -v $testdir/clonefile
-
-echo "Check scratch fs"
-umount "$SCRATCH_MNT"
-
 # success, all done
 status=0
 exit
diff --git a/tests/generic/172.out b/tests/generic/172.out
index 3913dd7..4d3f710 100644
--- a/tests/generic/172.out
+++ b/tests/generic/172.out
@@ -7,4 +7,3 @@ CoW the big file
 pwrite64: No space left on device
 Remount and try CoW again
 pwrite64: No space left on device
-Check scratch fs
diff --git a/tests/generic/173 b/tests/generic/173
index e26f5a9..61c6b32 100755
--- a/tests/generic/173
+++ b/tests/generic/173
@@ -97,12 +97,6 @@ if [ "$err" -lt 128 ]; then
 	echo "mmap CoW should have failed with SIGBUS, got SIG$(kill -l $err)"
 fi
 
-#filefrag -v $testdir/bigfile
-#filefrag -v $testdir/clonefile
-
-echo "Check scratch fs"
-umount "$SCRATCH_MNT"
-
 # success, all done
 status=0
 exit
diff --git a/tests/generic/173.out b/tests/generic/173.out
index 49abb17..5235548 100644
--- a/tests/generic/173.out
+++ b/tests/generic/173.out
@@ -5,4 +5,3 @@ Create a big file and reflink it
 Allocate the rest of the space
 mmap CoW the big file
 Remount and try CoW again
-Check scratch fs
diff --git a/tests/generic/174 b/tests/generic/174
index 1749a1c..dd6fe5a 100755
--- a/tests/generic/174
+++ b/tests/generic/174
@@ -95,12 +95,6 @@ echo "${out}" | grep -q "No space left on device" || echo "CoW should have faile
 echo "${out}" >> "$seqres.full" 2>&1
 echo "${out}"
 
-#filefrag -v $testdir/bigfile
-#filefrag -v $testdir/clonefile
-
-echo "Check scratch fs"
-umount "$SCRATCH_MNT"
-
 # success, all done
 status=0
 exit
diff --git a/tests/generic/174.out b/tests/generic/174.out
index 702d067..1490ca4 100644
--- a/tests/generic/174.out
+++ b/tests/generic/174.out
@@ -7,4 +7,3 @@ CoW the big file
 pwrite64: No space left on device
 Remount and try CoW again
 pwrite64: No space left on device
-Check scratch fs
diff --git a/tests/generic/183 b/tests/generic/183
index 27179fd..c928acd 100755
--- a/tests/generic/183
+++ b/tests/generic/183
@@ -92,9 +92,6 @@ md5sum "$testdir/file2" | _filter_scratch
 md5sum "$testdir/file3" | _filter_scratch
 md5sum "$testdir/file3.chk" | _filter_scratch
 
-echo "Check for damage"
-umount "$SCRATCH_MNT"
-
 # success, all done
 status=0
 exit
diff --git a/tests/generic/183.out b/tests/generic/183.out
index e5d0322..b777908 100644
--- a/tests/generic/183.out
+++ b/tests/generic/183.out
@@ -12,4 +12,3 @@ bdbcf02ee0aa977795a79d25fcfdccb1  SCRATCH_MNT/test-183/file1
 b83f9394092e15bdcda585cd8e776dc6  SCRATCH_MNT/test-183/file2
 55968a95dfc0120df4e8485576514320  SCRATCH_MNT/test-183/file3
 55968a95dfc0120df4e8485576514320  SCRATCH_MNT/test-183/file3.chk
-Check for damage
diff --git a/tests/generic/185 b/tests/generic/185
index 368260d..fb05e6d 100755
--- a/tests/generic/185
+++ b/tests/generic/185
@@ -92,9 +92,6 @@ md5sum "$testdir/file2" | _filter_scratch
 md5sum "$testdir/file3" | _filter_scratch
 md5sum "$testdir/file3.chk" | _filter_scratch
 
-echo "Check for damage"
-umount "$SCRATCH_MNT"
-
 # success, all done
 status=0
 exit
diff --git a/tests/generic/185.out b/tests/generic/185.out
index e505c90..4d1839a 100644
--- a/tests/generic/185.out
+++ b/tests/generic/185.out
@@ -12,4 +12,3 @@ bdbcf02ee0aa977795a79d25fcfdccb1  SCRATCH_MNT/test-185/file1
 b83f9394092e15bdcda585cd8e776dc6  SCRATCH_MNT/test-185/file2
 55968a95dfc0120df4e8485576514320  SCRATCH_MNT/test-185/file3
 55968a95dfc0120df4e8485576514320  SCRATCH_MNT/test-185/file3.chk
-Check for damage
diff --git a/tests/generic/186 b/tests/generic/186
index 67e52b5..e495cbc 100755
--- a/tests/generic/186
+++ b/tests/generic/186
@@ -137,9 +137,6 @@ md5sum "$testdir/file2" | _filter_scratch
 md5sum "$testdir/file3" | _filter_scratch
 md5sum "$testdir/file3.chk" | _filter_scratch
 
-echo "Check for damage"
-umount "$SCRATCH_MNT"
-
 # success, all done
 status=0
 exit
diff --git a/tests/generic/186.out b/tests/generic/186.out
index adfae9c..961673a 100644
--- a/tests/generic/186.out
+++ b/tests/generic/186.out
@@ -12,4 +12,3 @@ Compare files
 35219c511215d00a857243965ea5ed9c  SCRATCH_MNT/test-186/file2
 1801718b8daeb8d3ad4900bd9137b3e8  SCRATCH_MNT/test-186/file3
 1801718b8daeb8d3ad4900bd9137b3e8  SCRATCH_MNT/test-186/file3.chk
-Check for damage
diff --git a/tests/generic/187 b/tests/generic/187
index c993394..e3461ab 100755
--- a/tests/generic/187
+++ b/tests/generic/187
@@ -137,9 +137,6 @@ md5sum "$testdir/file2" | _filter_scratch
 md5sum "$testdir/file3" | _filter_scratch
 md5sum "$testdir/file3.chk" | _filter_scratch
 
-echo "Check for damage"
-umount "$SCRATCH_MNT"
-
 # success, all done
 status=0
 exit
diff --git a/tests/generic/187.out b/tests/generic/187.out
index a3c05a5..8ad56f8 100644
--- a/tests/generic/187.out
+++ b/tests/generic/187.out
@@ -12,4 +12,3 @@ Compare files
 35219c511215d00a857243965ea5ed9c  SCRATCH_MNT/test-187/file2
 1801718b8daeb8d3ad4900bd9137b3e8  SCRATCH_MNT/test-187/file3
 1801718b8daeb8d3ad4900bd9137b3e8  SCRATCH_MNT/test-187/file3.chk
-Check for damage
diff --git a/tests/generic/188 b/tests/generic/188
index 9e63388..7596c4b 100755
--- a/tests/generic/188
+++ b/tests/generic/188
@@ -87,9 +87,6 @@ md5sum "$testdir/file1" | _filter_scratch
 md5sum "$testdir/file3" | _filter_scratch
 md5sum "$testdir/file3.chk" | _filter_scratch
 
-echo "Check for damage"
-umount "$SCRATCH_MNT"
-
 # success, all done
 status=0
 exit
diff --git a/tests/generic/188.out b/tests/generic/188.out
index 135e69c..904f383 100644
--- a/tests/generic/188.out
+++ b/tests/generic/188.out
@@ -10,4 +10,3 @@ Compare files
 bdbcf02ee0aa977795a79d25fcfdccb1  SCRATCH_MNT/test-188/file1
 09101629908f9bdd5d178e7ce20bb1bb  SCRATCH_MNT/test-188/file3
 09101629908f9bdd5d178e7ce20bb1bb  SCRATCH_MNT/test-188/file3.chk
-Check for damage
diff --git a/tests/generic/189 b/tests/generic/189
index 661129c..130dc58 100755
--- a/tests/generic/189
+++ b/tests/generic/189
@@ -87,9 +87,6 @@ md5sum "$testdir/file1" | _filter_scratch
 md5sum "$testdir/file3" | _filter_scratch
 md5sum "$testdir/file3.chk" | _filter_scratch
 
-echo "Check for damage"
-umount "$SCRATCH_MNT"
-
 # success, all done
 status=0
 exit
diff --git a/tests/generic/189.out b/tests/generic/189.out
index ce868bd..feff605 100644
--- a/tests/generic/189.out
+++ b/tests/generic/189.out
@@ -10,4 +10,3 @@ Compare files
 bdbcf02ee0aa977795a79d25fcfdccb1  SCRATCH_MNT/test-189/file1
 09101629908f9bdd5d178e7ce20bb1bb  SCRATCH_MNT/test-189/file3
 09101629908f9bdd5d178e7ce20bb1bb  SCRATCH_MNT/test-189/file3.chk
-Check for damage
diff --git a/tests/generic/190 b/tests/generic/190
index 4e272c2..0171475 100755
--- a/tests/generic/190
+++ b/tests/generic/190
@@ -87,9 +87,6 @@ md5sum "$testdir/file1" | _filter_scratch
 md5sum "$testdir/file3" | _filter_scratch
 md5sum "$testdir/file3.chk" | _filter_scratch
 
-echo "Check for damage"
-umount "$SCRATCH_MNT"
-
 # success, all done
 status=0
 exit
diff --git a/tests/generic/190.out b/tests/generic/190.out
index abe5d89..ad8ecb0 100644
--- a/tests/generic/190.out
+++ b/tests/generic/190.out
@@ -10,4 +10,3 @@ Compare files
 bdbcf02ee0aa977795a79d25fcfdccb1  SCRATCH_MNT/test-190/file1
 09101629908f9bdd5d178e7ce20bb1bb  SCRATCH_MNT/test-190/file3
 09101629908f9bdd5d178e7ce20bb1bb  SCRATCH_MNT/test-190/file3.chk
-Check for damage
diff --git a/tests/generic/191 b/tests/generic/191
index 5aadded..34d96f9 100755
--- a/tests/generic/191
+++ b/tests/generic/191
@@ -87,9 +87,6 @@ md5sum "$testdir/file1" | _filter_scratch
 md5sum "$testdir/file3" | _filter_scratch
 md5sum "$testdir/file3.chk" | _filter_scratch
 
-echo "Check for damage"
-umount "$SCRATCH_MNT"
-
 # success, all done
 status=0
 exit
diff --git a/tests/generic/191.out b/tests/generic/191.out
index 8116eab..1b5e175 100644
--- a/tests/generic/191.out
+++ b/tests/generic/191.out
@@ -10,4 +10,3 @@ Compare files
 bdbcf02ee0aa977795a79d25fcfdccb1  SCRATCH_MNT/test-191/file1
 09101629908f9bdd5d178e7ce20bb1bb  SCRATCH_MNT/test-191/file3
 09101629908f9bdd5d178e7ce20bb1bb  SCRATCH_MNT/test-191/file3.chk
-Check for damage
diff --git a/tests/generic/194 b/tests/generic/194
index a17debc..e9feaad 100755
--- a/tests/generic/194
+++ b/tests/generic/194
@@ -92,9 +92,6 @@ md5sum "$testdir/file1" | _filter_scratch
 md5sum "$testdir/file3" | _filter_scratch
 md5sum "$testdir/file3.chk" | _filter_scratch
 
-echo "Check for damage"
-umount "$SCRATCH_MNT"
-
 # success, all done
 status=0
 exit
diff --git a/tests/generic/194.out b/tests/generic/194.out
index fdfda23..d370b4c 100644
--- a/tests/generic/194.out
+++ b/tests/generic/194.out
@@ -10,4 +10,3 @@ Compare files
 bdbcf02ee0aa977795a79d25fcfdccb1  SCRATCH_MNT/test-194/file1
 55968a95dfc0120df4e8485576514320  SCRATCH_MNT/test-194/file3
 55968a95dfc0120df4e8485576514320  SCRATCH_MNT/test-194/file3.chk
-Check for damage
diff --git a/tests/generic/195 b/tests/generic/195
index f49d0c2..32548ba 100755
--- a/tests/generic/195
+++ b/tests/generic/195
@@ -92,9 +92,6 @@ md5sum "$testdir/file1" | _filter_scratch
 md5sum "$testdir/file3" | _filter_scratch
 md5sum "$testdir/file3.chk" | _filter_scratch
 
-echo "Check for damage"
-umount "$SCRATCH_MNT"
-
 # success, all done
 status=0
 exit
diff --git a/tests/generic/195.out b/tests/generic/195.out
index 9495058..8a6d760 100644
--- a/tests/generic/195.out
+++ b/tests/generic/195.out
@@ -10,4 +10,3 @@ Compare files
 bdbcf02ee0aa977795a79d25fcfdccb1  SCRATCH_MNT/test-195/file1
 55968a95dfc0120df4e8485576514320  SCRATCH_MNT/test-195/file3
 55968a95dfc0120df4e8485576514320  SCRATCH_MNT/test-195/file3.chk
-Check for damage
diff --git a/tests/generic/196 b/tests/generic/196
index 4da9c76..4ec2cff 100755
--- a/tests/generic/196
+++ b/tests/generic/196
@@ -87,9 +87,6 @@ md5sum "$testdir/file1" | _filter_scratch
 md5sum "$testdir/file3" | _filter_scratch
 md5sum "$testdir/file3.chk" | _filter_scratch
 
-echo "Check for damage"
-umount "$SCRATCH_MNT"
-
 # success, all done
 status=0
 exit
diff --git a/tests/generic/196.out b/tests/generic/196.out
index 6ee052b..545b72b 100644
--- a/tests/generic/196.out
+++ b/tests/generic/196.out
@@ -10,4 +10,3 @@ Compare files
 bdbcf02ee0aa977795a79d25fcfdccb1  SCRATCH_MNT/test-196/file1
 55968a95dfc0120df4e8485576514320  SCRATCH_MNT/test-196/file3
 55968a95dfc0120df4e8485576514320  SCRATCH_MNT/test-196/file3.chk
-Check for damage
diff --git a/tests/generic/197 b/tests/generic/197
index 54ee5ab..356a587 100755
--- a/tests/generic/197
+++ b/tests/generic/197
@@ -87,9 +87,6 @@ md5sum "$testdir/file1" | _filter_scratch
 md5sum "$testdir/file3" | _filter_scratch
 md5sum "$testdir/file3.chk" | _filter_scratch
 
-echo "Check for damage"
-umount "$SCRATCH_MNT"
-
 # success, all done
 status=0
 exit
diff --git a/tests/generic/197.out b/tests/generic/197.out
index bec294b..05edad9 100644
--- a/tests/generic/197.out
+++ b/tests/generic/197.out
@@ -10,4 +10,3 @@ Compare files
 bdbcf02ee0aa977795a79d25fcfdccb1  SCRATCH_MNT/test-197/file1
 55968a95dfc0120df4e8485576514320  SCRATCH_MNT/test-197/file3
 55968a95dfc0120df4e8485576514320  SCRATCH_MNT/test-197/file3.chk
-Check for damage
diff --git a/tests/generic/199 b/tests/generic/199
index 5e4bca8..03b8fda 100755
--- a/tests/generic/199
+++ b/tests/generic/199
@@ -116,9 +116,6 @@ md5sum "$testdir/file1" | _filter_scratch
 md5sum "$testdir/file3" | _filter_scratch
 md5sum "$testdir/file3.chk" | _filter_scratch
 
-echo "Check for damage"
-umount "$SCRATCH_MNT"
-
 # success, all done
 status=0
 exit
diff --git a/tests/generic/199.out b/tests/generic/199.out
index 752742d..b35c135 100644
--- a/tests/generic/199.out
+++ b/tests/generic/199.out
@@ -10,4 +10,3 @@ Compare files
 bdbcf02ee0aa977795a79d25fcfdccb1  SCRATCH_MNT/test-199/file1
 36f6b5317a9a921fc91175390ccf7f69  SCRATCH_MNT/test-199/file3
 36f6b5317a9a921fc91175390ccf7f69  SCRATCH_MNT/test-199/file3.chk
-Check for damage
diff --git a/tests/generic/200 b/tests/generic/200
index f0521ae..e71eedc 100755
--- a/tests/generic/200
+++ b/tests/generic/200
@@ -116,9 +116,6 @@ md5sum "$testdir/file1" | _filter_scratch
 md5sum "$testdir/file3" | _filter_scratch
 md5sum "$testdir/file3.chk" | _filter_scratch
 
-echo "Check for damage"
-umount "$SCRATCH_MNT"
-
 # success, all done
 status=0
 exit
diff --git a/tests/generic/200.out b/tests/generic/200.out
index e4ab7e0..140eff9 100644
--- a/tests/generic/200.out
+++ b/tests/generic/200.out
@@ -10,4 +10,3 @@ Compare files
 bdbcf02ee0aa977795a79d25fcfdccb1  SCRATCH_MNT/test-200/file1
 36f6b5317a9a921fc91175390ccf7f69  SCRATCH_MNT/test-200/file3
 36f6b5317a9a921fc91175390ccf7f69  SCRATCH_MNT/test-200/file3.chk
-Check for damage
diff --git a/tests/generic/201 b/tests/generic/201
index db77a5e..90087ef 100755
--- a/tests/generic/201
+++ b/tests/generic/201
@@ -77,9 +77,6 @@ echo "CoW and unmount"
 "$XFS_IO_PROG" -f -c "pwrite -S 0x63 -b $((blksz * nr / 2)) $((blksz * nr / 4)) $((blksz * nr / 2))" "$testdir/file3" >> "$seqres.full"
 rm "$testdir/file3"
 
-echo "Check for damage"
-umount "$SCRATCH_MNT"
-
 # success, all done
 status=0
 exit
diff --git a/tests/generic/201.out b/tests/generic/201.out
index 80629b6..52669d2 100644
--- a/tests/generic/201.out
+++ b/tests/generic/201.out
@@ -6,4 +6,3 @@ bdbcf02ee0aa977795a79d25fcfdccb1  SCRATCH_MNT/test-201/file1
 d3959a68638c50af07f0258e032cb554  SCRATCH_MNT/test-201/file3
 d3959a68638c50af07f0258e032cb554  SCRATCH_MNT/test-201/file3.chk
 CoW and unmount
-Check for damage
diff --git a/tests/generic/202 b/tests/generic/202
index 91f2d9b..e034e4e 100755
--- a/tests/generic/202
+++ b/tests/generic/202
@@ -77,9 +77,6 @@ md5sum "$testdir/file1" | _filter_scratch
 md5sum "$testdir/file2" | _filter_scratch
 md5sum "$testdir/file2.chk" | _filter_scratch
 
-echo "Check for damage"
-umount "$SCRATCH_MNT"
-
 # success, all done
 status=0
 exit
diff --git a/tests/generic/202.out b/tests/generic/202.out
index 8973abe..2dbd4b0 100644
--- a/tests/generic/202.out
+++ b/tests/generic/202.out
@@ -10,4 +10,3 @@ Compare files
 75f550706b7d54e6ae59a8220b532285  SCRATCH_MNT/test-202/file1
 7cd112044b63b2c979f45e7c1e7cc85f  SCRATCH_MNT/test-202/file2
 7cd112044b63b2c979f45e7c1e7cc85f  SCRATCH_MNT/test-202/file2.chk
-Check for damage
diff --git a/tests/generic/203 b/tests/generic/203
index 86a672b..2b6db7e 100755
--- a/tests/generic/203
+++ b/tests/generic/203
@@ -77,9 +77,6 @@ md5sum "$testdir/file1" | _filter_scratch
 md5sum "$testdir/file2" | _filter_scratch
 md5sum "$testdir/file2.chk" | _filter_scratch
 
-echo "Check for damage"
-umount "$SCRATCH_MNT"
-
 # success, all done
 status=0
 exit
diff --git a/tests/generic/203.out b/tests/generic/203.out
index 84ac0e8..ddde511 100644
--- a/tests/generic/203.out
+++ b/tests/generic/203.out
@@ -10,4 +10,3 @@ Compare files
 75f550706b7d54e6ae59a8220b532285  SCRATCH_MNT/test-203/file1
 227f44bb2dcf251ebf0217edaeb1e365  SCRATCH_MNT/test-203/file2
 227f44bb2dcf251ebf0217edaeb1e365  SCRATCH_MNT/test-203/file2.chk
-Check for damage
diff --git a/tests/generic/205 b/tests/generic/205
index 8fed955..8955e67 100755
--- a/tests/generic/205
+++ b/tests/generic/205
@@ -93,9 +93,6 @@ echo "Compare files"
 ! cmp -s "$testdir/file1" "$testdir/file2" || _fail "file1 and file2 don't match."
 cmp -s "$testdir/file2" "$testdir/file2.chk" || _fail "file2 and file2.chk don't match."
 
-echo "Check for damage"
-umount "$SCRATCH_MNT"
-
 # success, all done
 status=0
 exit
diff --git a/tests/generic/205.out b/tests/generic/205.out
index 1a22515..c65d1bd 100644
--- a/tests/generic/205.out
+++ b/tests/generic/205.out
@@ -4,4 +4,3 @@ Create the original files
 Compare files
 CoW and unmount
 Compare files
-Check for damage
diff --git a/tests/generic/206 b/tests/generic/206
index 10b5285..12ad745 100755
--- a/tests/generic/206
+++ b/tests/generic/206
@@ -93,9 +93,6 @@ echo "Compare files"
 ! cmp -s "$testdir/file1" "$testdir/file2" || _fail "file1 and file2 don't match."
 cmp -s "$testdir/file2" "$testdir/file2.chk" || _fail "file2 and file2.chk don't match."
 
-echo "Check for damage"
-umount "$SCRATCH_MNT"
-
 # success, all done
 status=0
 exit
diff --git a/tests/generic/206.out b/tests/generic/206.out
index 0b1ec60..38c7b09 100644
--- a/tests/generic/206.out
+++ b/tests/generic/206.out
@@ -4,4 +4,3 @@ Create the original files
 Compare files
 CoW and unmount
 Compare files
-Check for damage
diff --git a/tests/generic/216 b/tests/generic/216
index 671f0c1..3e0084e 100755
--- a/tests/generic/216
+++ b/tests/generic/216
@@ -94,9 +94,6 @@ echo "Compare files"
 ! cmp -s "$testdir/file1" "$testdir/file2" || _fail "file1 and file2 don't match."
 cmp -s "$testdir/file2" "$testdir/file2.chk" || _fail "file2 and file2.chk don't match."
 
-echo "Check for damage"
-umount "$SCRATCH_MNT"
-
 # success, all done
 status=0
 exit
diff --git a/tests/generic/216.out b/tests/generic/216.out
index 2d43c3a..85db001 100644
--- a/tests/generic/216.out
+++ b/tests/generic/216.out
@@ -4,4 +4,3 @@ Create the original files
 Compare files
 CoW and unmount
 Compare files
-Check for damage
diff --git a/tests/generic/217 b/tests/generic/217
index e4d40c7..3470d25 100755
--- a/tests/generic/217
+++ b/tests/generic/217
@@ -94,9 +94,6 @@ echo "Compare files"
 ! cmp -s "$testdir/file1" "$testdir/file2" || _fail "file1 and file2 don't match."
 cmp -s "$testdir/file2" "$testdir/file2.chk" || _fail "file2 and file2.chk don't match."
 
-echo "Check for damage"
-umount "$SCRATCH_MNT"
-
 # success, all done
 status=0
 exit
diff --git a/tests/generic/217.out b/tests/generic/217.out
index d8eb1be..bf8bb4f 100644
--- a/tests/generic/217.out
+++ b/tests/generic/217.out
@@ -4,4 +4,3 @@ Create the original files
 Compare files
 CoW and unmount
 Compare files
-Check for damage
diff --git a/tests/generic/218 b/tests/generic/218
index eb52fea..220cda3 100755
--- a/tests/generic/218
+++ b/tests/generic/218
@@ -88,9 +88,6 @@ echo "Compare files"
 ! cmp -s "$testdir/file1" "$testdir/file2" || _fail "file1 and file2 don't match."
 cmp -s "$testdir/file2" "$testdir/file2.chk" || _fail "file2 and file2.chk don't match."
 
-echo "Check for damage"
-umount "$SCRATCH_MNT"
-
 # success, all done
 status=0
 exit
diff --git a/tests/generic/218.out b/tests/generic/218.out
index 0173be0..0142747 100644
--- a/tests/generic/218.out
+++ b/tests/generic/218.out
@@ -4,4 +4,3 @@ Create the original files
 Compare files
 CoW and unmount
 Compare files
-Check for damage
diff --git a/tests/generic/220 b/tests/generic/220
index fb5ecda..151bf76 100755
--- a/tests/generic/220
+++ b/tests/generic/220
@@ -88,9 +88,6 @@ echo "Compare files"
 ! cmp -s "$testdir/file1" "$testdir/file2" || _fail "file1 and file2 don't match."
 cmp -s "$testdir/file2" "$testdir/file2.chk" || _fail "file2 and file2.chk don't match."
 
-echo "Check for damage"
-umount "$SCRATCH_MNT"
-
 # success, all done
 status=0
 exit
diff --git a/tests/generic/220.out b/tests/generic/220.out
index 9dcb9d6..a7123e1 100644
--- a/tests/generic/220.out
+++ b/tests/generic/220.out
@@ -4,4 +4,3 @@ Create the original files
 Compare files
 CoW and unmount
 Compare files
-Check for damage
diff --git a/tests/generic/222 b/tests/generic/222
index ab3f65f..c95a1d6 100755
--- a/tests/generic/222
+++ b/tests/generic/222
@@ -94,9 +94,6 @@ echo "Compare files"
 ! cmp -s "$testdir/file1" "$testdir/file2" || _fail "file1 and file2 don't match."
 cmp -s "$testdir/file2" "$testdir/file2.chk" || _fail "file2 and file2.chk don't match."
 
-echo "Check for damage"
-umount "$SCRATCH_MNT"
-
 # success, all done
 status=0
 exit
diff --git a/tests/generic/222.out b/tests/generic/222.out
index 47bad10..895b3a1 100644
--- a/tests/generic/222.out
+++ b/tests/generic/222.out
@@ -4,4 +4,3 @@ Create the original files
 Compare files
 CoW and unmount
 Compare files
-Check for damage
diff --git a/tests/generic/227 b/tests/generic/227
index 387c714..d62ab52 100755
--- a/tests/generic/227
+++ b/tests/generic/227
@@ -94,9 +94,6 @@ echo "Compare files"
 ! cmp -s "$testdir/file1" "$testdir/file2" || _fail "file1 and file2 don't match."
 cmp -s "$testdir/file2" "$testdir/file2.chk" || _fail "file2 and file2.chk don't match."
 
-echo "Check for damage"
-umount "$SCRATCH_MNT"
-
 # success, all done
 status=0
 exit
diff --git a/tests/generic/227.out b/tests/generic/227.out
index 69cb88f..bed3e48 100644
--- a/tests/generic/227.out
+++ b/tests/generic/227.out
@@ -4,4 +4,3 @@ Create the original files
 Compare files
 CoW and unmount
 Compare files
-Check for damage
diff --git a/tests/generic/229 b/tests/generic/229
index eb105a3..cc86b4e 100755
--- a/tests/generic/229
+++ b/tests/generic/229
@@ -154,9 +154,6 @@ runtest delalloc unwritten "$testdir/d-u"
 runtest delalloc hole "$testdir/d-h"
 runtest delalloc regular "$testdir/d-r"
 
-echo "Check for damage"
-umount "$SCRATCH_MNT"
-
 # success, all done
 status=0
 exit
diff --git a/tests/generic/229.out b/tests/generic/229.out
index 07750ac..4955ecd 100644
--- a/tests/generic/229.out
+++ b/tests/generic/229.out
@@ -80,4 +80,3 @@ Create the original files
 Compare files
 CoW and unmount
 Compare files
-Check for damage
diff --git a/tests/generic/238 b/tests/generic/238
index 02057ad..c726770 100755
--- a/tests/generic/238
+++ b/tests/generic/238
@@ -154,9 +154,6 @@ runtest delalloc unwritten "$testdir/d-u"
 runtest delalloc hole "$testdir/d-h"
 runtest delalloc regular "$testdir/d-r"
 
-echo "Check for damage"
-umount "$SCRATCH_MNT"
-
 # success, all done
 status=0
 exit
diff --git a/tests/generic/238.out b/tests/generic/238.out
index dcfcc8e..5f97fb1 100644
--- a/tests/generic/238.out
+++ b/tests/generic/238.out
@@ -80,4 +80,3 @@ Create the original files
 Compare files
 CoW and unmount
 Compare files
-Check for damage
diff --git a/tests/generic/242 b/tests/generic/242
index 3023ac7..1141aa4 100755
--- a/tests/generic/242
+++ b/tests/generic/242
@@ -90,9 +90,6 @@ md5sum "$testdir/file1" | _filter_scratch
 md5sum "$testdir/file2" | _filter_scratch
 md5sum "$testdir/file2.chk" | _filter_scratch
 
-echo "Check for damage"
-umount "$SCRATCH_MNT"
-
 # success, all done
 status=0
 exit
diff --git a/tests/generic/242.out b/tests/generic/242.out
index ef9a574..34dac8b 100644
--- a/tests/generic/242.out
+++ b/tests/generic/242.out
@@ -10,4 +10,3 @@ Compare files
 01768a16d33c9bd21dc67a7fac006ee1  SCRATCH_MNT/test-242/file1
 c835fd53fa27b72511b250d51595c053  SCRATCH_MNT/test-242/file2
 c835fd53fa27b72511b250d51595c053  SCRATCH_MNT/test-242/file2.chk
-Check for damage
diff --git a/tests/generic/243 b/tests/generic/243
index e65347f..a514591 100755
--- a/tests/generic/243
+++ b/tests/generic/243
@@ -90,9 +90,6 @@ md5sum "$testdir/file1" | _filter_scratch
 md5sum "$testdir/file2" | _filter_scratch
 md5sum "$testdir/file2.chk" | _filter_scratch
 
-echo "Check for damage"
-umount "$SCRATCH_MNT"
-
 # success, all done
 status=0
 exit
diff --git a/tests/generic/243.out b/tests/generic/243.out
index 8e13fab..d76ce6f 100644
--- a/tests/generic/243.out
+++ b/tests/generic/243.out
@@ -10,4 +10,3 @@ Compare files
 01768a16d33c9bd21dc67a7fac006ee1  SCRATCH_MNT/test-243/file1
 c835fd53fa27b72511b250d51595c053  SCRATCH_MNT/test-243/file2
 c835fd53fa27b72511b250d51595c053  SCRATCH_MNT/test-243/file2.chk
-Check for damage
diff --git a/tests/xfs/127 b/tests/xfs/127
index 63d5890..392e63c 100755
--- a/tests/xfs/127
+++ b/tests/xfs/127
@@ -70,9 +70,6 @@ _cp_reflink "$testdir/original" "$testdir/copy3"
 
 xfs_info "$SCRATCH_MNT" >> "$seqres.full"
 
-echo "Check scratch fs"
-umount "$SCRATCH_MNT"
-
 # success, all done
 status=0
 exit
diff --git a/tests/xfs/127.out b/tests/xfs/127.out
index e4e76e2..317fbdc 100644
--- a/tests/xfs/127.out
+++ b/tests/xfs/127.out
@@ -3,4 +3,3 @@ Format and mount
 Create the original file and reflink to copy1, copy2
 Grow fs
 Create more reflink copies
-Check scratch fs
diff --git a/tests/xfs/128 b/tests/xfs/128
index 2e1da3f..f230adf 100755
--- a/tests/xfs/128
+++ b/tests/xfs/128
@@ -140,9 +140,6 @@ _within_tolerance "free blocks after CoW some reflink copies" $free_blocks2 $((f
 _within_tolerance "free blocks after defragging all reflink copies" $free_blocks3 $((free_blocks2 - (blks * 2 * blksz_factor))) $margin -v
 _within_tolerance "free blocks after all tests" $free_blocks3 $((free_blocks0 - (blks * 3 * blksz_factor))) $margin -v
 
-echo "Check scratch fs"
-umount "$SCRATCH_MNT"
-
 # success, all done
 status=0
 exit
diff --git a/tests/xfs/128.out b/tests/xfs/128.out
index 0ac06db..9c80746 100644
--- a/tests/xfs/128.out
+++ b/tests/xfs/128.out
@@ -24,4 +24,3 @@ free blocks after creating some reflink copies is in range
 free blocks after CoW some reflink copies is in range
 free blocks after defragging all reflink copies is in range
 free blocks after all tests is in range
-Check scratch fs
diff --git a/tests/xfs/131 b/tests/xfs/131
index adab31f..f553a44 100755
--- a/tests/xfs/131
+++ b/tests/xfs/131
@@ -67,9 +67,6 @@ _cp_reflink "$testdir/file1" "$testdir/file2" 2>&1 | _filter_scratch
 
 test -s "$testdir/file2" && _fail "Should not be able to reflink a realtime file."
 
-echo "Check restored fs"
-umount "$SCRATCH_MNT"
-
 # success, all done
 status=0
 exit
diff --git a/tests/xfs/131.out b/tests/xfs/131.out
index 7b700c9..3c0186f 100644
--- a/tests/xfs/131.out
+++ b/tests/xfs/131.out
@@ -3,4 +3,3 @@ Format and mount scratch device
 Create the original file blocks
 Reflink every block
 cp: failed to clone 'SCRATCH_MNT/test-131/file2' from 'SCRATCH_MNT/test-131/file1': Invalid argument
-Check restored fs
diff --git a/tests/xfs/139 b/tests/xfs/139
index feb55bd..55dd7d0 100755
--- a/tests/xfs/139
+++ b/tests/xfs/139
@@ -73,9 +73,6 @@ md5sum "$testdir/file1" | _filter_scratch
 md5sum "$testdir/file2" | _filter_scratch
 #filefrag -v "$testdir/file1" "$testdir/file2"
 
-echo "Check scratch fs"
-umount "$SCRATCH_MNT"
-
 # success, all done
 status=0
 exit
diff --git a/tests/xfs/139.out b/tests/xfs/139.out
index 090e3af..dc6a31e 100644
--- a/tests/xfs/139.out
+++ b/tests/xfs/139.out
@@ -5,4 +5,3 @@ CoW every other block
 Compare files
 673c759fb131ccf3336c4f8c549a497e  SCRATCH_MNT/test-139/file1
 dc802351f6717547cbf4c951b294f952  SCRATCH_MNT/test-139/file2
-Check scratch fs
diff --git a/tests/xfs/140 b/tests/xfs/140
index 309b284..a379ca7 100644
--- a/tests/xfs/140
+++ b/tests/xfs/140
@@ -80,9 +80,6 @@ echo "Compare files"
 ! cmp -s "$testdir/file1" "$testdir/file2" || echo "file1 and file2 must not match"
 cmp -s "$testdir/file2" "$testdir/file2.chk" || echo "file2 and file2.chk do not match"
 
-echo "Check scratch fs"
-umount "$SCRATCH_MNT"
-
 # success, all done
 status=0
 exit
diff --git a/tests/xfs/140.out b/tests/xfs/140.out
index 5d00ea2..4d9e6a1 100644
--- a/tests/xfs/140.out
+++ b/tests/xfs/140.out
@@ -4,4 +4,3 @@ Create the original files
 Compare files
 CoW every other block
 Compare files
-Check scratch fs


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

* [PATCH 05/32] reflink: remove unnecessary umounts from test code
@ 2016-02-11 23:39   ` Darrick J. Wong
  0 siblings, 0 replies; 81+ messages in thread
From: Darrick J. Wong @ 2016-02-11 23:39 UTC (permalink / raw)
  To: david, darrick.wong; +Cc: fstests, linux-btrfs, xfs

The test harness already takes care of this, so get rid of it.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 tests/generic/157     |    3 ---
 tests/generic/157.out |    1 -
 tests/generic/158     |    3 ---
 tests/generic/158.out |    1 -
 tests/generic/161     |    4 ----
 tests/generic/161.out |    2 --
 tests/generic/162     |    4 ----
 tests/generic/162.out |    2 --
 tests/generic/163     |    4 ----
 tests/generic/163.out |    2 --
 tests/generic/164     |    4 ----
 tests/generic/164.out |    2 --
 tests/generic/165     |    4 ----
 tests/generic/165.out |    2 --
 tests/generic/166     |    5 -----
 tests/generic/166.out |    2 --
 tests/generic/167     |    5 -----
 tests/generic/167.out |    2 --
 tests/generic/168     |    5 -----
 tests/generic/168.out |    2 --
 tests/generic/170     |    5 -----
 tests/generic/170.out |    2 --
 tests/generic/171     |    6 ------
 tests/generic/171.out |    1 -
 tests/generic/172     |    6 ------
 tests/generic/172.out |    1 -
 tests/generic/173     |    6 ------
 tests/generic/173.out |    1 -
 tests/generic/174     |    6 ------
 tests/generic/174.out |    1 -
 tests/generic/183     |    3 ---
 tests/generic/183.out |    1 -
 tests/generic/185     |    3 ---
 tests/generic/185.out |    1 -
 tests/generic/186     |    3 ---
 tests/generic/186.out |    1 -
 tests/generic/187     |    3 ---
 tests/generic/187.out |    1 -
 tests/generic/188     |    3 ---
 tests/generic/188.out |    1 -
 tests/generic/189     |    3 ---
 tests/generic/189.out |    1 -
 tests/generic/190     |    3 ---
 tests/generic/190.out |    1 -
 tests/generic/191     |    3 ---
 tests/generic/191.out |    1 -
 tests/generic/194     |    3 ---
 tests/generic/194.out |    1 -
 tests/generic/195     |    3 ---
 tests/generic/195.out |    1 -
 tests/generic/196     |    3 ---
 tests/generic/196.out |    1 -
 tests/generic/197     |    3 ---
 tests/generic/197.out |    1 -
 tests/generic/199     |    3 ---
 tests/generic/199.out |    1 -
 tests/generic/200     |    3 ---
 tests/generic/200.out |    1 -
 tests/generic/201     |    3 ---
 tests/generic/201.out |    1 -
 tests/generic/202     |    3 ---
 tests/generic/202.out |    1 -
 tests/generic/203     |    3 ---
 tests/generic/203.out |    1 -
 tests/generic/205     |    3 ---
 tests/generic/205.out |    1 -
 tests/generic/206     |    3 ---
 tests/generic/206.out |    1 -
 tests/generic/216     |    3 ---
 tests/generic/216.out |    1 -
 tests/generic/217     |    3 ---
 tests/generic/217.out |    1 -
 tests/generic/218     |    3 ---
 tests/generic/218.out |    1 -
 tests/generic/220     |    3 ---
 tests/generic/220.out |    1 -
 tests/generic/222     |    3 ---
 tests/generic/222.out |    1 -
 tests/generic/227     |    3 ---
 tests/generic/227.out |    1 -
 tests/generic/229     |    3 ---
 tests/generic/229.out |    1 -
 tests/generic/238     |    3 ---
 tests/generic/238.out |    1 -
 tests/generic/242     |    3 ---
 tests/generic/242.out |    1 -
 tests/generic/243     |    3 ---
 tests/generic/243.out |    1 -
 tests/xfs/127         |    3 ---
 tests/xfs/127.out     |    1 -
 tests/xfs/128         |    3 ---
 tests/xfs/128.out     |    1 -
 tests/xfs/131         |    3 ---
 tests/xfs/131.out     |    1 -
 tests/xfs/139         |    3 ---
 tests/xfs/139.out     |    1 -
 tests/xfs/140         |    3 ---
 tests/xfs/140.out     |    1 -
 98 files changed, 230 deletions(-)


diff --git a/tests/generic/157 b/tests/generic/157
index 74314d8..19a9a18 100755
--- a/tests/generic/157
+++ b/tests/generic/157
@@ -121,9 +121,6 @@ echo "Reflink two files"
 _reflink_range "$testdir1/file1" 0 "$testdir1/file2" 0 $blksz >> "$seqres.full"
 _reflink_range "$testdir2/file1" 0 "$testdir2/file2" 0 $blksz >> "$seqres.full"
 
-echo "Check scratch fs"
-_scratch_unmount
-
 # success, all done
 status=0
 exit
diff --git a/tests/generic/157.out b/tests/generic/157.out
index ac3c440..d4f64b4 100644
--- a/tests/generic/157.out
+++ b/tests/generic/157.out
@@ -22,4 +22,3 @@ XFS_IOC_CLONE_RANGE: Invalid argument
 Try to reflink an append-only file
 XFS_IOC_CLONE_RANGE: Bad file descriptor
 Reflink two files
-Check scratch fs
diff --git a/tests/generic/158 b/tests/generic/158
index 779d55e..4b51973 100755
--- a/tests/generic/158
+++ b/tests/generic/158
@@ -122,9 +122,6 @@ echo "Dedupe two files"
 _dedupe_range "$testdir1/file1" 0 "$testdir1/file2" 0 $blksz >> "$seqres.full"
 _dedupe_range "$testdir2/file1" 0 "$testdir2/file2" 0 $blksz >> "$seqres.full"
 
-echo "Check scratch fs"
-_scratch_unmount
-
 # success, all done
 status=0
 exit
diff --git a/tests/generic/158.out b/tests/generic/158.out
index dff3692..7f88403 100644
--- a/tests/generic/158.out
+++ b/tests/generic/158.out
@@ -21,4 +21,3 @@ Try to dedupe to a fifo
 dedupe: Invalid argument
 Try to dedupe an append-only file
 Dedupe two files
-Check scratch fs
diff --git a/tests/generic/161 b/tests/generic/161
index b271936..1d5364e 100755
--- a/tests/generic/161
+++ b/tests/generic/161
@@ -69,10 +69,6 @@ rm -rf "$testdir/file1" &
 _pwrite_byte 0x62 0 $((loops * blksz)) "$testdir/file1" >> "$seqres.full"
 wait
 
-echo "Check fs"
-umount "$SCRATCH_MNT"
-
-echo "Done"
 # success, all done
 status=0
 exit
diff --git a/tests/generic/161.out b/tests/generic/161.out
index 1db11c3..34cb6f2 100644
--- a/tests/generic/161.out
+++ b/tests/generic/161.out
@@ -2,5 +2,3 @@ QA output created by 161
 Format and mount
 Initialize files
 Delete while rewriting
-Check fs
-Done
diff --git a/tests/generic/162 b/tests/generic/162
index 30c761b..9044545 100755
--- a/tests/generic/162
+++ b/tests/generic/162
@@ -85,10 +85,6 @@ echo "Finished dedupeing"
 touch "$testdir/finished"
 wait
 
-echo "Check fs"
-umount "$SCRATCH_MNT"
-
-echo "Done"
 # success, all done
 status=0
 exit
diff --git a/tests/generic/162.out b/tests/generic/162.out
index 4481f8c..e57db12 100644
--- a/tests/generic/162.out
+++ b/tests/generic/162.out
@@ -3,5 +3,3 @@ Format and mount
 Initialize files
 Dedupe and rewrite the file!
 Finished dedupeing
-Check fs
-Done
diff --git a/tests/generic/163 b/tests/generic/163
index f2ea334..651d445 100755
--- a/tests/generic/163
+++ b/tests/generic/163
@@ -85,10 +85,6 @@ echo "Finished dedupeing"
 touch "$testdir/finished"
 wait
 
-echo "Check fs"
-umount "$SCRATCH_MNT"
-
-echo "Done"
 # success, all done
 status=0
 exit
diff --git a/tests/generic/163.out b/tests/generic/163.out
index 2d27d1b..604e53b 100644
--- a/tests/generic/163.out
+++ b/tests/generic/163.out
@@ -3,5 +3,3 @@ Format and mount
 Initialize files
 Dedupe and rewrite the file!
 Finished dedupeing
-Check fs
-Done
diff --git a/tests/generic/164 b/tests/generic/164
index e97ac13..6c19c7d 100755
--- a/tests/generic/164
+++ b/tests/generic/164
@@ -95,10 +95,6 @@ echo "Finished reflinking"
 touch "$testdir/finished"
 wait
 
-echo "Check fs"
-umount "$SCRATCH_MNT"
-
-echo "Done"
 # success, all done
 status=0
 exit
diff --git a/tests/generic/164.out b/tests/generic/164.out
index 0b4ed70..f4ff869 100644
--- a/tests/generic/164.out
+++ b/tests/generic/164.out
@@ -3,5 +3,3 @@ Format and mount
 Initialize files
 Reflink and reread the files!
 Finished reflinking
-Check fs
-Done
diff --git a/tests/generic/165 b/tests/generic/165
index b305079..2e380a9 100755
--- a/tests/generic/165
+++ b/tests/generic/165
@@ -95,10 +95,6 @@ echo "Finished reflinking"
 touch "$testdir/finished"
 wait
 
-echo "Check fs"
-umount "$SCRATCH_MNT"
-
-echo "Done"
 # success, all done
 status=0
 exit
diff --git a/tests/generic/165.out b/tests/generic/165.out
index a89071d..31e9bef 100644
--- a/tests/generic/165.out
+++ b/tests/generic/165.out
@@ -3,5 +3,3 @@ Format and mount
 Initialize files
 Reflink and dio reread the files!
 Finished reflinking
-Check fs
-Done
diff --git a/tests/generic/166 b/tests/generic/166
index 2c2ff4e..028ee11 100755
--- a/tests/generic/166
+++ b/tests/generic/166
@@ -82,11 +82,6 @@ done
 touch $testdir/finished
 wait
 
-echo "Check for damage"
-_scratch_unmount
-
-echo "Done"
-
 # success, all done
 status=0
 exit
diff --git a/tests/generic/166.out b/tests/generic/166.out
index a2ba34e..8cb81a0 100644
--- a/tests/generic/166.out
+++ b/tests/generic/166.out
@@ -2,5 +2,3 @@ QA output created by 166
 Format and mount
 Initialize file
 Snapshot a file undergoing directio rewrite
-Check for damage
-Done
diff --git a/tests/generic/167 b/tests/generic/167
index b80b481..a4bf4f4 100755
--- a/tests/generic/167
+++ b/tests/generic/167
@@ -82,11 +82,6 @@ done
 touch $testdir/finished
 wait
 
-echo "Check for damage"
-_scratch_unmount
-
-echo "Done"
-
 # success, all done
 status=0
 exit
diff --git a/tests/generic/167.out b/tests/generic/167.out
index 7cfb14e..a0e90b1 100644
--- a/tests/generic/167.out
+++ b/tests/generic/167.out
@@ -2,5 +2,3 @@ QA output created by 167
 Format and mount
 Initialize file
 Snapshot a file undergoing buffered rewrite
-Check for damage
-Done
diff --git a/tests/generic/168 b/tests/generic/168
index 0d620da..2ffc5b6 100755
--- a/tests/generic/168
+++ b/tests/generic/168
@@ -86,11 +86,6 @@ done
 touch "$testdir/finished"
 wait
 
-echo "Check for damage"
-umount "$SCRATCH_MNT"
-
-echo "Done"
-
 # success, all done
 status=0
 exit
diff --git a/tests/generic/168.out b/tests/generic/168.out
index d0dd08e..2687e7c 100644
--- a/tests/generic/168.out
+++ b/tests/generic/168.out
@@ -2,5 +2,3 @@ QA output created by 168
 Format and mount
 Initialize files
 Reflink and write the target
-Check for damage
-Done
diff --git a/tests/generic/170 b/tests/generic/170
index 78ed63d..2a81cad 100755
--- a/tests/generic/170
+++ b/tests/generic/170
@@ -86,11 +86,6 @@ done
 touch "$testdir/finished"
 wait
 
-echo "Check for damage"
-umount "$SCRATCH_MNT"
-
-echo "Done"
-
 # success, all done
 status=0
 exit
diff --git a/tests/generic/170.out b/tests/generic/170.out
index 103aaa5..debd6ca 100644
--- a/tests/generic/170.out
+++ b/tests/generic/170.out
@@ -2,5 +2,3 @@ QA output created by 170
 Format and mount
 Initialize files
 Reflink and dio write the target
-Check for damage
-Done
diff --git a/tests/generic/171 b/tests/generic/171
index 4b4f141..d865f64 100755
--- a/tests/generic/171
+++ b/tests/generic/171
@@ -95,12 +95,6 @@ echo "${out}" | grep -q "No space left on device" || echo "CoW should have faile
 echo "${out}" >> "$seqres.full" 2>&1
 echo "${out}"
 
-#filefrag -v $testdir/bigfile
-#filefrag -v $testdir/clonefile
-
-echo "Check scratch fs"
-umount "$SCRATCH_MNT"
-
 # success, all done
 status=0
 exit
diff --git a/tests/generic/171.out b/tests/generic/171.out
index c2b0ddd..a999eb0 100644
--- a/tests/generic/171.out
+++ b/tests/generic/171.out
@@ -7,4 +7,3 @@ CoW the big file
 pwrite64: No space left on device
 Remount and try CoW again
 pwrite64: No space left on device
-Check scratch fs
diff --git a/tests/generic/172 b/tests/generic/172
index 98eb97f..e6020f1 100755
--- a/tests/generic/172
+++ b/tests/generic/172
@@ -95,12 +95,6 @@ echo "${out}" | grep -q "No space left on device" || echo "CoW should have faile
 echo "${out}" >> "$seqres.full" 2>&1
 echo "${out}"
 
-#filefrag -v $testdir/bigfile
-#filefrag -v $testdir/clonefile
-
-echo "Check scratch fs"
-umount "$SCRATCH_MNT"
-
 # success, all done
 status=0
 exit
diff --git a/tests/generic/172.out b/tests/generic/172.out
index 3913dd7..4d3f710 100644
--- a/tests/generic/172.out
+++ b/tests/generic/172.out
@@ -7,4 +7,3 @@ CoW the big file
 pwrite64: No space left on device
 Remount and try CoW again
 pwrite64: No space left on device
-Check scratch fs
diff --git a/tests/generic/173 b/tests/generic/173
index e26f5a9..61c6b32 100755
--- a/tests/generic/173
+++ b/tests/generic/173
@@ -97,12 +97,6 @@ if [ "$err" -lt 128 ]; then
 	echo "mmap CoW should have failed with SIGBUS, got SIG$(kill -l $err)"
 fi
 
-#filefrag -v $testdir/bigfile
-#filefrag -v $testdir/clonefile
-
-echo "Check scratch fs"
-umount "$SCRATCH_MNT"
-
 # success, all done
 status=0
 exit
diff --git a/tests/generic/173.out b/tests/generic/173.out
index 49abb17..5235548 100644
--- a/tests/generic/173.out
+++ b/tests/generic/173.out
@@ -5,4 +5,3 @@ Create a big file and reflink it
 Allocate the rest of the space
 mmap CoW the big file
 Remount and try CoW again
-Check scratch fs
diff --git a/tests/generic/174 b/tests/generic/174
index 1749a1c..dd6fe5a 100755
--- a/tests/generic/174
+++ b/tests/generic/174
@@ -95,12 +95,6 @@ echo "${out}" | grep -q "No space left on device" || echo "CoW should have faile
 echo "${out}" >> "$seqres.full" 2>&1
 echo "${out}"
 
-#filefrag -v $testdir/bigfile
-#filefrag -v $testdir/clonefile
-
-echo "Check scratch fs"
-umount "$SCRATCH_MNT"
-
 # success, all done
 status=0
 exit
diff --git a/tests/generic/174.out b/tests/generic/174.out
index 702d067..1490ca4 100644
--- a/tests/generic/174.out
+++ b/tests/generic/174.out
@@ -7,4 +7,3 @@ CoW the big file
 pwrite64: No space left on device
 Remount and try CoW again
 pwrite64: No space left on device
-Check scratch fs
diff --git a/tests/generic/183 b/tests/generic/183
index 27179fd..c928acd 100755
--- a/tests/generic/183
+++ b/tests/generic/183
@@ -92,9 +92,6 @@ md5sum "$testdir/file2" | _filter_scratch
 md5sum "$testdir/file3" | _filter_scratch
 md5sum "$testdir/file3.chk" | _filter_scratch
 
-echo "Check for damage"
-umount "$SCRATCH_MNT"
-
 # success, all done
 status=0
 exit
diff --git a/tests/generic/183.out b/tests/generic/183.out
index e5d0322..b777908 100644
--- a/tests/generic/183.out
+++ b/tests/generic/183.out
@@ -12,4 +12,3 @@ bdbcf02ee0aa977795a79d25fcfdccb1  SCRATCH_MNT/test-183/file1
 b83f9394092e15bdcda585cd8e776dc6  SCRATCH_MNT/test-183/file2
 55968a95dfc0120df4e8485576514320  SCRATCH_MNT/test-183/file3
 55968a95dfc0120df4e8485576514320  SCRATCH_MNT/test-183/file3.chk
-Check for damage
diff --git a/tests/generic/185 b/tests/generic/185
index 368260d..fb05e6d 100755
--- a/tests/generic/185
+++ b/tests/generic/185
@@ -92,9 +92,6 @@ md5sum "$testdir/file2" | _filter_scratch
 md5sum "$testdir/file3" | _filter_scratch
 md5sum "$testdir/file3.chk" | _filter_scratch
 
-echo "Check for damage"
-umount "$SCRATCH_MNT"
-
 # success, all done
 status=0
 exit
diff --git a/tests/generic/185.out b/tests/generic/185.out
index e505c90..4d1839a 100644
--- a/tests/generic/185.out
+++ b/tests/generic/185.out
@@ -12,4 +12,3 @@ bdbcf02ee0aa977795a79d25fcfdccb1  SCRATCH_MNT/test-185/file1
 b83f9394092e15bdcda585cd8e776dc6  SCRATCH_MNT/test-185/file2
 55968a95dfc0120df4e8485576514320  SCRATCH_MNT/test-185/file3
 55968a95dfc0120df4e8485576514320  SCRATCH_MNT/test-185/file3.chk
-Check for damage
diff --git a/tests/generic/186 b/tests/generic/186
index 67e52b5..e495cbc 100755
--- a/tests/generic/186
+++ b/tests/generic/186
@@ -137,9 +137,6 @@ md5sum "$testdir/file2" | _filter_scratch
 md5sum "$testdir/file3" | _filter_scratch
 md5sum "$testdir/file3.chk" | _filter_scratch
 
-echo "Check for damage"
-umount "$SCRATCH_MNT"
-
 # success, all done
 status=0
 exit
diff --git a/tests/generic/186.out b/tests/generic/186.out
index adfae9c..961673a 100644
--- a/tests/generic/186.out
+++ b/tests/generic/186.out
@@ -12,4 +12,3 @@ Compare files
 35219c511215d00a857243965ea5ed9c  SCRATCH_MNT/test-186/file2
 1801718b8daeb8d3ad4900bd9137b3e8  SCRATCH_MNT/test-186/file3
 1801718b8daeb8d3ad4900bd9137b3e8  SCRATCH_MNT/test-186/file3.chk
-Check for damage
diff --git a/tests/generic/187 b/tests/generic/187
index c993394..e3461ab 100755
--- a/tests/generic/187
+++ b/tests/generic/187
@@ -137,9 +137,6 @@ md5sum "$testdir/file2" | _filter_scratch
 md5sum "$testdir/file3" | _filter_scratch
 md5sum "$testdir/file3.chk" | _filter_scratch
 
-echo "Check for damage"
-umount "$SCRATCH_MNT"
-
 # success, all done
 status=0
 exit
diff --git a/tests/generic/187.out b/tests/generic/187.out
index a3c05a5..8ad56f8 100644
--- a/tests/generic/187.out
+++ b/tests/generic/187.out
@@ -12,4 +12,3 @@ Compare files
 35219c511215d00a857243965ea5ed9c  SCRATCH_MNT/test-187/file2
 1801718b8daeb8d3ad4900bd9137b3e8  SCRATCH_MNT/test-187/file3
 1801718b8daeb8d3ad4900bd9137b3e8  SCRATCH_MNT/test-187/file3.chk
-Check for damage
diff --git a/tests/generic/188 b/tests/generic/188
index 9e63388..7596c4b 100755
--- a/tests/generic/188
+++ b/tests/generic/188
@@ -87,9 +87,6 @@ md5sum "$testdir/file1" | _filter_scratch
 md5sum "$testdir/file3" | _filter_scratch
 md5sum "$testdir/file3.chk" | _filter_scratch
 
-echo "Check for damage"
-umount "$SCRATCH_MNT"
-
 # success, all done
 status=0
 exit
diff --git a/tests/generic/188.out b/tests/generic/188.out
index 135e69c..904f383 100644
--- a/tests/generic/188.out
+++ b/tests/generic/188.out
@@ -10,4 +10,3 @@ Compare files
 bdbcf02ee0aa977795a79d25fcfdccb1  SCRATCH_MNT/test-188/file1
 09101629908f9bdd5d178e7ce20bb1bb  SCRATCH_MNT/test-188/file3
 09101629908f9bdd5d178e7ce20bb1bb  SCRATCH_MNT/test-188/file3.chk
-Check for damage
diff --git a/tests/generic/189 b/tests/generic/189
index 661129c..130dc58 100755
--- a/tests/generic/189
+++ b/tests/generic/189
@@ -87,9 +87,6 @@ md5sum "$testdir/file1" | _filter_scratch
 md5sum "$testdir/file3" | _filter_scratch
 md5sum "$testdir/file3.chk" | _filter_scratch
 
-echo "Check for damage"
-umount "$SCRATCH_MNT"
-
 # success, all done
 status=0
 exit
diff --git a/tests/generic/189.out b/tests/generic/189.out
index ce868bd..feff605 100644
--- a/tests/generic/189.out
+++ b/tests/generic/189.out
@@ -10,4 +10,3 @@ Compare files
 bdbcf02ee0aa977795a79d25fcfdccb1  SCRATCH_MNT/test-189/file1
 09101629908f9bdd5d178e7ce20bb1bb  SCRATCH_MNT/test-189/file3
 09101629908f9bdd5d178e7ce20bb1bb  SCRATCH_MNT/test-189/file3.chk
-Check for damage
diff --git a/tests/generic/190 b/tests/generic/190
index 4e272c2..0171475 100755
--- a/tests/generic/190
+++ b/tests/generic/190
@@ -87,9 +87,6 @@ md5sum "$testdir/file1" | _filter_scratch
 md5sum "$testdir/file3" | _filter_scratch
 md5sum "$testdir/file3.chk" | _filter_scratch
 
-echo "Check for damage"
-umount "$SCRATCH_MNT"
-
 # success, all done
 status=0
 exit
diff --git a/tests/generic/190.out b/tests/generic/190.out
index abe5d89..ad8ecb0 100644
--- a/tests/generic/190.out
+++ b/tests/generic/190.out
@@ -10,4 +10,3 @@ Compare files
 bdbcf02ee0aa977795a79d25fcfdccb1  SCRATCH_MNT/test-190/file1
 09101629908f9bdd5d178e7ce20bb1bb  SCRATCH_MNT/test-190/file3
 09101629908f9bdd5d178e7ce20bb1bb  SCRATCH_MNT/test-190/file3.chk
-Check for damage
diff --git a/tests/generic/191 b/tests/generic/191
index 5aadded..34d96f9 100755
--- a/tests/generic/191
+++ b/tests/generic/191
@@ -87,9 +87,6 @@ md5sum "$testdir/file1" | _filter_scratch
 md5sum "$testdir/file3" | _filter_scratch
 md5sum "$testdir/file3.chk" | _filter_scratch
 
-echo "Check for damage"
-umount "$SCRATCH_MNT"
-
 # success, all done
 status=0
 exit
diff --git a/tests/generic/191.out b/tests/generic/191.out
index 8116eab..1b5e175 100644
--- a/tests/generic/191.out
+++ b/tests/generic/191.out
@@ -10,4 +10,3 @@ Compare files
 bdbcf02ee0aa977795a79d25fcfdccb1  SCRATCH_MNT/test-191/file1
 09101629908f9bdd5d178e7ce20bb1bb  SCRATCH_MNT/test-191/file3
 09101629908f9bdd5d178e7ce20bb1bb  SCRATCH_MNT/test-191/file3.chk
-Check for damage
diff --git a/tests/generic/194 b/tests/generic/194
index a17debc..e9feaad 100755
--- a/tests/generic/194
+++ b/tests/generic/194
@@ -92,9 +92,6 @@ md5sum "$testdir/file1" | _filter_scratch
 md5sum "$testdir/file3" | _filter_scratch
 md5sum "$testdir/file3.chk" | _filter_scratch
 
-echo "Check for damage"
-umount "$SCRATCH_MNT"
-
 # success, all done
 status=0
 exit
diff --git a/tests/generic/194.out b/tests/generic/194.out
index fdfda23..d370b4c 100644
--- a/tests/generic/194.out
+++ b/tests/generic/194.out
@@ -10,4 +10,3 @@ Compare files
 bdbcf02ee0aa977795a79d25fcfdccb1  SCRATCH_MNT/test-194/file1
 55968a95dfc0120df4e8485576514320  SCRATCH_MNT/test-194/file3
 55968a95dfc0120df4e8485576514320  SCRATCH_MNT/test-194/file3.chk
-Check for damage
diff --git a/tests/generic/195 b/tests/generic/195
index f49d0c2..32548ba 100755
--- a/tests/generic/195
+++ b/tests/generic/195
@@ -92,9 +92,6 @@ md5sum "$testdir/file1" | _filter_scratch
 md5sum "$testdir/file3" | _filter_scratch
 md5sum "$testdir/file3.chk" | _filter_scratch
 
-echo "Check for damage"
-umount "$SCRATCH_MNT"
-
 # success, all done
 status=0
 exit
diff --git a/tests/generic/195.out b/tests/generic/195.out
index 9495058..8a6d760 100644
--- a/tests/generic/195.out
+++ b/tests/generic/195.out
@@ -10,4 +10,3 @@ Compare files
 bdbcf02ee0aa977795a79d25fcfdccb1  SCRATCH_MNT/test-195/file1
 55968a95dfc0120df4e8485576514320  SCRATCH_MNT/test-195/file3
 55968a95dfc0120df4e8485576514320  SCRATCH_MNT/test-195/file3.chk
-Check for damage
diff --git a/tests/generic/196 b/tests/generic/196
index 4da9c76..4ec2cff 100755
--- a/tests/generic/196
+++ b/tests/generic/196
@@ -87,9 +87,6 @@ md5sum "$testdir/file1" | _filter_scratch
 md5sum "$testdir/file3" | _filter_scratch
 md5sum "$testdir/file3.chk" | _filter_scratch
 
-echo "Check for damage"
-umount "$SCRATCH_MNT"
-
 # success, all done
 status=0
 exit
diff --git a/tests/generic/196.out b/tests/generic/196.out
index 6ee052b..545b72b 100644
--- a/tests/generic/196.out
+++ b/tests/generic/196.out
@@ -10,4 +10,3 @@ Compare files
 bdbcf02ee0aa977795a79d25fcfdccb1  SCRATCH_MNT/test-196/file1
 55968a95dfc0120df4e8485576514320  SCRATCH_MNT/test-196/file3
 55968a95dfc0120df4e8485576514320  SCRATCH_MNT/test-196/file3.chk
-Check for damage
diff --git a/tests/generic/197 b/tests/generic/197
index 54ee5ab..356a587 100755
--- a/tests/generic/197
+++ b/tests/generic/197
@@ -87,9 +87,6 @@ md5sum "$testdir/file1" | _filter_scratch
 md5sum "$testdir/file3" | _filter_scratch
 md5sum "$testdir/file3.chk" | _filter_scratch
 
-echo "Check for damage"
-umount "$SCRATCH_MNT"
-
 # success, all done
 status=0
 exit
diff --git a/tests/generic/197.out b/tests/generic/197.out
index bec294b..05edad9 100644
--- a/tests/generic/197.out
+++ b/tests/generic/197.out
@@ -10,4 +10,3 @@ Compare files
 bdbcf02ee0aa977795a79d25fcfdccb1  SCRATCH_MNT/test-197/file1
 55968a95dfc0120df4e8485576514320  SCRATCH_MNT/test-197/file3
 55968a95dfc0120df4e8485576514320  SCRATCH_MNT/test-197/file3.chk
-Check for damage
diff --git a/tests/generic/199 b/tests/generic/199
index 5e4bca8..03b8fda 100755
--- a/tests/generic/199
+++ b/tests/generic/199
@@ -116,9 +116,6 @@ md5sum "$testdir/file1" | _filter_scratch
 md5sum "$testdir/file3" | _filter_scratch
 md5sum "$testdir/file3.chk" | _filter_scratch
 
-echo "Check for damage"
-umount "$SCRATCH_MNT"
-
 # success, all done
 status=0
 exit
diff --git a/tests/generic/199.out b/tests/generic/199.out
index 752742d..b35c135 100644
--- a/tests/generic/199.out
+++ b/tests/generic/199.out
@@ -10,4 +10,3 @@ Compare files
 bdbcf02ee0aa977795a79d25fcfdccb1  SCRATCH_MNT/test-199/file1
 36f6b5317a9a921fc91175390ccf7f69  SCRATCH_MNT/test-199/file3
 36f6b5317a9a921fc91175390ccf7f69  SCRATCH_MNT/test-199/file3.chk
-Check for damage
diff --git a/tests/generic/200 b/tests/generic/200
index f0521ae..e71eedc 100755
--- a/tests/generic/200
+++ b/tests/generic/200
@@ -116,9 +116,6 @@ md5sum "$testdir/file1" | _filter_scratch
 md5sum "$testdir/file3" | _filter_scratch
 md5sum "$testdir/file3.chk" | _filter_scratch
 
-echo "Check for damage"
-umount "$SCRATCH_MNT"
-
 # success, all done
 status=0
 exit
diff --git a/tests/generic/200.out b/tests/generic/200.out
index e4ab7e0..140eff9 100644
--- a/tests/generic/200.out
+++ b/tests/generic/200.out
@@ -10,4 +10,3 @@ Compare files
 bdbcf02ee0aa977795a79d25fcfdccb1  SCRATCH_MNT/test-200/file1
 36f6b5317a9a921fc91175390ccf7f69  SCRATCH_MNT/test-200/file3
 36f6b5317a9a921fc91175390ccf7f69  SCRATCH_MNT/test-200/file3.chk
-Check for damage
diff --git a/tests/generic/201 b/tests/generic/201
index db77a5e..90087ef 100755
--- a/tests/generic/201
+++ b/tests/generic/201
@@ -77,9 +77,6 @@ echo "CoW and unmount"
 "$XFS_IO_PROG" -f -c "pwrite -S 0x63 -b $((blksz * nr / 2)) $((blksz * nr / 4)) $((blksz * nr / 2))" "$testdir/file3" >> "$seqres.full"
 rm "$testdir/file3"
 
-echo "Check for damage"
-umount "$SCRATCH_MNT"
-
 # success, all done
 status=0
 exit
diff --git a/tests/generic/201.out b/tests/generic/201.out
index 80629b6..52669d2 100644
--- a/tests/generic/201.out
+++ b/tests/generic/201.out
@@ -6,4 +6,3 @@ bdbcf02ee0aa977795a79d25fcfdccb1  SCRATCH_MNT/test-201/file1
 d3959a68638c50af07f0258e032cb554  SCRATCH_MNT/test-201/file3
 d3959a68638c50af07f0258e032cb554  SCRATCH_MNT/test-201/file3.chk
 CoW and unmount
-Check for damage
diff --git a/tests/generic/202 b/tests/generic/202
index 91f2d9b..e034e4e 100755
--- a/tests/generic/202
+++ b/tests/generic/202
@@ -77,9 +77,6 @@ md5sum "$testdir/file1" | _filter_scratch
 md5sum "$testdir/file2" | _filter_scratch
 md5sum "$testdir/file2.chk" | _filter_scratch
 
-echo "Check for damage"
-umount "$SCRATCH_MNT"
-
 # success, all done
 status=0
 exit
diff --git a/tests/generic/202.out b/tests/generic/202.out
index 8973abe..2dbd4b0 100644
--- a/tests/generic/202.out
+++ b/tests/generic/202.out
@@ -10,4 +10,3 @@ Compare files
 75f550706b7d54e6ae59a8220b532285  SCRATCH_MNT/test-202/file1
 7cd112044b63b2c979f45e7c1e7cc85f  SCRATCH_MNT/test-202/file2
 7cd112044b63b2c979f45e7c1e7cc85f  SCRATCH_MNT/test-202/file2.chk
-Check for damage
diff --git a/tests/generic/203 b/tests/generic/203
index 86a672b..2b6db7e 100755
--- a/tests/generic/203
+++ b/tests/generic/203
@@ -77,9 +77,6 @@ md5sum "$testdir/file1" | _filter_scratch
 md5sum "$testdir/file2" | _filter_scratch
 md5sum "$testdir/file2.chk" | _filter_scratch
 
-echo "Check for damage"
-umount "$SCRATCH_MNT"
-
 # success, all done
 status=0
 exit
diff --git a/tests/generic/203.out b/tests/generic/203.out
index 84ac0e8..ddde511 100644
--- a/tests/generic/203.out
+++ b/tests/generic/203.out
@@ -10,4 +10,3 @@ Compare files
 75f550706b7d54e6ae59a8220b532285  SCRATCH_MNT/test-203/file1
 227f44bb2dcf251ebf0217edaeb1e365  SCRATCH_MNT/test-203/file2
 227f44bb2dcf251ebf0217edaeb1e365  SCRATCH_MNT/test-203/file2.chk
-Check for damage
diff --git a/tests/generic/205 b/tests/generic/205
index 8fed955..8955e67 100755
--- a/tests/generic/205
+++ b/tests/generic/205
@@ -93,9 +93,6 @@ echo "Compare files"
 ! cmp -s "$testdir/file1" "$testdir/file2" || _fail "file1 and file2 don't match."
 cmp -s "$testdir/file2" "$testdir/file2.chk" || _fail "file2 and file2.chk don't match."
 
-echo "Check for damage"
-umount "$SCRATCH_MNT"
-
 # success, all done
 status=0
 exit
diff --git a/tests/generic/205.out b/tests/generic/205.out
index 1a22515..c65d1bd 100644
--- a/tests/generic/205.out
+++ b/tests/generic/205.out
@@ -4,4 +4,3 @@ Create the original files
 Compare files
 CoW and unmount
 Compare files
-Check for damage
diff --git a/tests/generic/206 b/tests/generic/206
index 10b5285..12ad745 100755
--- a/tests/generic/206
+++ b/tests/generic/206
@@ -93,9 +93,6 @@ echo "Compare files"
 ! cmp -s "$testdir/file1" "$testdir/file2" || _fail "file1 and file2 don't match."
 cmp -s "$testdir/file2" "$testdir/file2.chk" || _fail "file2 and file2.chk don't match."
 
-echo "Check for damage"
-umount "$SCRATCH_MNT"
-
 # success, all done
 status=0
 exit
diff --git a/tests/generic/206.out b/tests/generic/206.out
index 0b1ec60..38c7b09 100644
--- a/tests/generic/206.out
+++ b/tests/generic/206.out
@@ -4,4 +4,3 @@ Create the original files
 Compare files
 CoW and unmount
 Compare files
-Check for damage
diff --git a/tests/generic/216 b/tests/generic/216
index 671f0c1..3e0084e 100755
--- a/tests/generic/216
+++ b/tests/generic/216
@@ -94,9 +94,6 @@ echo "Compare files"
 ! cmp -s "$testdir/file1" "$testdir/file2" || _fail "file1 and file2 don't match."
 cmp -s "$testdir/file2" "$testdir/file2.chk" || _fail "file2 and file2.chk don't match."
 
-echo "Check for damage"
-umount "$SCRATCH_MNT"
-
 # success, all done
 status=0
 exit
diff --git a/tests/generic/216.out b/tests/generic/216.out
index 2d43c3a..85db001 100644
--- a/tests/generic/216.out
+++ b/tests/generic/216.out
@@ -4,4 +4,3 @@ Create the original files
 Compare files
 CoW and unmount
 Compare files
-Check for damage
diff --git a/tests/generic/217 b/tests/generic/217
index e4d40c7..3470d25 100755
--- a/tests/generic/217
+++ b/tests/generic/217
@@ -94,9 +94,6 @@ echo "Compare files"
 ! cmp -s "$testdir/file1" "$testdir/file2" || _fail "file1 and file2 don't match."
 cmp -s "$testdir/file2" "$testdir/file2.chk" || _fail "file2 and file2.chk don't match."
 
-echo "Check for damage"
-umount "$SCRATCH_MNT"
-
 # success, all done
 status=0
 exit
diff --git a/tests/generic/217.out b/tests/generic/217.out
index d8eb1be..bf8bb4f 100644
--- a/tests/generic/217.out
+++ b/tests/generic/217.out
@@ -4,4 +4,3 @@ Create the original files
 Compare files
 CoW and unmount
 Compare files
-Check for damage
diff --git a/tests/generic/218 b/tests/generic/218
index eb52fea..220cda3 100755
--- a/tests/generic/218
+++ b/tests/generic/218
@@ -88,9 +88,6 @@ echo "Compare files"
 ! cmp -s "$testdir/file1" "$testdir/file2" || _fail "file1 and file2 don't match."
 cmp -s "$testdir/file2" "$testdir/file2.chk" || _fail "file2 and file2.chk don't match."
 
-echo "Check for damage"
-umount "$SCRATCH_MNT"
-
 # success, all done
 status=0
 exit
diff --git a/tests/generic/218.out b/tests/generic/218.out
index 0173be0..0142747 100644
--- a/tests/generic/218.out
+++ b/tests/generic/218.out
@@ -4,4 +4,3 @@ Create the original files
 Compare files
 CoW and unmount
 Compare files
-Check for damage
diff --git a/tests/generic/220 b/tests/generic/220
index fb5ecda..151bf76 100755
--- a/tests/generic/220
+++ b/tests/generic/220
@@ -88,9 +88,6 @@ echo "Compare files"
 ! cmp -s "$testdir/file1" "$testdir/file2" || _fail "file1 and file2 don't match."
 cmp -s "$testdir/file2" "$testdir/file2.chk" || _fail "file2 and file2.chk don't match."
 
-echo "Check for damage"
-umount "$SCRATCH_MNT"
-
 # success, all done
 status=0
 exit
diff --git a/tests/generic/220.out b/tests/generic/220.out
index 9dcb9d6..a7123e1 100644
--- a/tests/generic/220.out
+++ b/tests/generic/220.out
@@ -4,4 +4,3 @@ Create the original files
 Compare files
 CoW and unmount
 Compare files
-Check for damage
diff --git a/tests/generic/222 b/tests/generic/222
index ab3f65f..c95a1d6 100755
--- a/tests/generic/222
+++ b/tests/generic/222
@@ -94,9 +94,6 @@ echo "Compare files"
 ! cmp -s "$testdir/file1" "$testdir/file2" || _fail "file1 and file2 don't match."
 cmp -s "$testdir/file2" "$testdir/file2.chk" || _fail "file2 and file2.chk don't match."
 
-echo "Check for damage"
-umount "$SCRATCH_MNT"
-
 # success, all done
 status=0
 exit
diff --git a/tests/generic/222.out b/tests/generic/222.out
index 47bad10..895b3a1 100644
--- a/tests/generic/222.out
+++ b/tests/generic/222.out
@@ -4,4 +4,3 @@ Create the original files
 Compare files
 CoW and unmount
 Compare files
-Check for damage
diff --git a/tests/generic/227 b/tests/generic/227
index 387c714..d62ab52 100755
--- a/tests/generic/227
+++ b/tests/generic/227
@@ -94,9 +94,6 @@ echo "Compare files"
 ! cmp -s "$testdir/file1" "$testdir/file2" || _fail "file1 and file2 don't match."
 cmp -s "$testdir/file2" "$testdir/file2.chk" || _fail "file2 and file2.chk don't match."
 
-echo "Check for damage"
-umount "$SCRATCH_MNT"
-
 # success, all done
 status=0
 exit
diff --git a/tests/generic/227.out b/tests/generic/227.out
index 69cb88f..bed3e48 100644
--- a/tests/generic/227.out
+++ b/tests/generic/227.out
@@ -4,4 +4,3 @@ Create the original files
 Compare files
 CoW and unmount
 Compare files
-Check for damage
diff --git a/tests/generic/229 b/tests/generic/229
index eb105a3..cc86b4e 100755
--- a/tests/generic/229
+++ b/tests/generic/229
@@ -154,9 +154,6 @@ runtest delalloc unwritten "$testdir/d-u"
 runtest delalloc hole "$testdir/d-h"
 runtest delalloc regular "$testdir/d-r"
 
-echo "Check for damage"
-umount "$SCRATCH_MNT"
-
 # success, all done
 status=0
 exit
diff --git a/tests/generic/229.out b/tests/generic/229.out
index 07750ac..4955ecd 100644
--- a/tests/generic/229.out
+++ b/tests/generic/229.out
@@ -80,4 +80,3 @@ Create the original files
 Compare files
 CoW and unmount
 Compare files
-Check for damage
diff --git a/tests/generic/238 b/tests/generic/238
index 02057ad..c726770 100755
--- a/tests/generic/238
+++ b/tests/generic/238
@@ -154,9 +154,6 @@ runtest delalloc unwritten "$testdir/d-u"
 runtest delalloc hole "$testdir/d-h"
 runtest delalloc regular "$testdir/d-r"
 
-echo "Check for damage"
-umount "$SCRATCH_MNT"
-
 # success, all done
 status=0
 exit
diff --git a/tests/generic/238.out b/tests/generic/238.out
index dcfcc8e..5f97fb1 100644
--- a/tests/generic/238.out
+++ b/tests/generic/238.out
@@ -80,4 +80,3 @@ Create the original files
 Compare files
 CoW and unmount
 Compare files
-Check for damage
diff --git a/tests/generic/242 b/tests/generic/242
index 3023ac7..1141aa4 100755
--- a/tests/generic/242
+++ b/tests/generic/242
@@ -90,9 +90,6 @@ md5sum "$testdir/file1" | _filter_scratch
 md5sum "$testdir/file2" | _filter_scratch
 md5sum "$testdir/file2.chk" | _filter_scratch
 
-echo "Check for damage"
-umount "$SCRATCH_MNT"
-
 # success, all done
 status=0
 exit
diff --git a/tests/generic/242.out b/tests/generic/242.out
index ef9a574..34dac8b 100644
--- a/tests/generic/242.out
+++ b/tests/generic/242.out
@@ -10,4 +10,3 @@ Compare files
 01768a16d33c9bd21dc67a7fac006ee1  SCRATCH_MNT/test-242/file1
 c835fd53fa27b72511b250d51595c053  SCRATCH_MNT/test-242/file2
 c835fd53fa27b72511b250d51595c053  SCRATCH_MNT/test-242/file2.chk
-Check for damage
diff --git a/tests/generic/243 b/tests/generic/243
index e65347f..a514591 100755
--- a/tests/generic/243
+++ b/tests/generic/243
@@ -90,9 +90,6 @@ md5sum "$testdir/file1" | _filter_scratch
 md5sum "$testdir/file2" | _filter_scratch
 md5sum "$testdir/file2.chk" | _filter_scratch
 
-echo "Check for damage"
-umount "$SCRATCH_MNT"
-
 # success, all done
 status=0
 exit
diff --git a/tests/generic/243.out b/tests/generic/243.out
index 8e13fab..d76ce6f 100644
--- a/tests/generic/243.out
+++ b/tests/generic/243.out
@@ -10,4 +10,3 @@ Compare files
 01768a16d33c9bd21dc67a7fac006ee1  SCRATCH_MNT/test-243/file1
 c835fd53fa27b72511b250d51595c053  SCRATCH_MNT/test-243/file2
 c835fd53fa27b72511b250d51595c053  SCRATCH_MNT/test-243/file2.chk
-Check for damage
diff --git a/tests/xfs/127 b/tests/xfs/127
index 63d5890..392e63c 100755
--- a/tests/xfs/127
+++ b/tests/xfs/127
@@ -70,9 +70,6 @@ _cp_reflink "$testdir/original" "$testdir/copy3"
 
 xfs_info "$SCRATCH_MNT" >> "$seqres.full"
 
-echo "Check scratch fs"
-umount "$SCRATCH_MNT"
-
 # success, all done
 status=0
 exit
diff --git a/tests/xfs/127.out b/tests/xfs/127.out
index e4e76e2..317fbdc 100644
--- a/tests/xfs/127.out
+++ b/tests/xfs/127.out
@@ -3,4 +3,3 @@ Format and mount
 Create the original file and reflink to copy1, copy2
 Grow fs
 Create more reflink copies
-Check scratch fs
diff --git a/tests/xfs/128 b/tests/xfs/128
index 2e1da3f..f230adf 100755
--- a/tests/xfs/128
+++ b/tests/xfs/128
@@ -140,9 +140,6 @@ _within_tolerance "free blocks after CoW some reflink copies" $free_blocks2 $((f
 _within_tolerance "free blocks after defragging all reflink copies" $free_blocks3 $((free_blocks2 - (blks * 2 * blksz_factor))) $margin -v
 _within_tolerance "free blocks after all tests" $free_blocks3 $((free_blocks0 - (blks * 3 * blksz_factor))) $margin -v
 
-echo "Check scratch fs"
-umount "$SCRATCH_MNT"
-
 # success, all done
 status=0
 exit
diff --git a/tests/xfs/128.out b/tests/xfs/128.out
index 0ac06db..9c80746 100644
--- a/tests/xfs/128.out
+++ b/tests/xfs/128.out
@@ -24,4 +24,3 @@ free blocks after creating some reflink copies is in range
 free blocks after CoW some reflink copies is in range
 free blocks after defragging all reflink copies is in range
 free blocks after all tests is in range
-Check scratch fs
diff --git a/tests/xfs/131 b/tests/xfs/131
index adab31f..f553a44 100755
--- a/tests/xfs/131
+++ b/tests/xfs/131
@@ -67,9 +67,6 @@ _cp_reflink "$testdir/file1" "$testdir/file2" 2>&1 | _filter_scratch
 
 test -s "$testdir/file2" && _fail "Should not be able to reflink a realtime file."
 
-echo "Check restored fs"
-umount "$SCRATCH_MNT"
-
 # success, all done
 status=0
 exit
diff --git a/tests/xfs/131.out b/tests/xfs/131.out
index 7b700c9..3c0186f 100644
--- a/tests/xfs/131.out
+++ b/tests/xfs/131.out
@@ -3,4 +3,3 @@ Format and mount scratch device
 Create the original file blocks
 Reflink every block
 cp: failed to clone 'SCRATCH_MNT/test-131/file2' from 'SCRATCH_MNT/test-131/file1': Invalid argument
-Check restored fs
diff --git a/tests/xfs/139 b/tests/xfs/139
index feb55bd..55dd7d0 100755
--- a/tests/xfs/139
+++ b/tests/xfs/139
@@ -73,9 +73,6 @@ md5sum "$testdir/file1" | _filter_scratch
 md5sum "$testdir/file2" | _filter_scratch
 #filefrag -v "$testdir/file1" "$testdir/file2"
 
-echo "Check scratch fs"
-umount "$SCRATCH_MNT"
-
 # success, all done
 status=0
 exit
diff --git a/tests/xfs/139.out b/tests/xfs/139.out
index 090e3af..dc6a31e 100644
--- a/tests/xfs/139.out
+++ b/tests/xfs/139.out
@@ -5,4 +5,3 @@ CoW every other block
 Compare files
 673c759fb131ccf3336c4f8c549a497e  SCRATCH_MNT/test-139/file1
 dc802351f6717547cbf4c951b294f952  SCRATCH_MNT/test-139/file2
-Check scratch fs
diff --git a/tests/xfs/140 b/tests/xfs/140
index 309b284..a379ca7 100644
--- a/tests/xfs/140
+++ b/tests/xfs/140
@@ -80,9 +80,6 @@ echo "Compare files"
 ! cmp -s "$testdir/file1" "$testdir/file2" || echo "file1 and file2 must not match"
 cmp -s "$testdir/file2" "$testdir/file2.chk" || echo "file2 and file2.chk do not match"
 
-echo "Check scratch fs"
-umount "$SCRATCH_MNT"
-
 # success, all done
 status=0
 exit
diff --git a/tests/xfs/140.out b/tests/xfs/140.out
index 5d00ea2..4d9e6a1 100644
--- a/tests/xfs/140.out
+++ b/tests/xfs/140.out
@@ -4,4 +4,3 @@ Create the original files
 Compare files
 CoW every other block
 Compare files
-Check scratch fs

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

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

* [PATCH 06/32] common/dmerror: add some more dmerror routines
  2016-02-11 23:39 ` Darrick J. Wong
@ 2016-02-11 23:39   ` Darrick J. Wong
  -1 siblings, 0 replies; 81+ messages in thread
From: Darrick J. Wong @ 2016-02-11 23:39 UTC (permalink / raw)
  To: david, darrick.wong; +Cc: linux-btrfs, fstests, xfs

Add functions to the dmerror routine so that we can load both the
error table and the linear table.  This will help us with EIO testing
of copy-on-write.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 common/dmerror  |   27 +++++++++++++++++++++++++--
 tests/btrfs/100 |    2 +-
 tests/btrfs/101 |    2 +-
 3 files changed, 27 insertions(+), 4 deletions(-)


diff --git a/common/dmerror b/common/dmerror
index 3900a4e..004530d 100644
--- a/common/dmerror
+++ b/common/dmerror
@@ -46,15 +46,23 @@ _dmerror_mount()
 	_mount -t $FSTYP `_dmerror_mount_options $*`
 }
 
+_dmerror_unmount()
+{
+	umount $SCRATCH_MNT
+}
+
 _dmerror_cleanup()
 {
 	$UMOUNT_PROG $SCRATCH_MNT > /dev/null 2>&1
 	$DMSETUP_PROG remove error-test > /dev/null 2>&1
 }
 
-_dmerror_load_table()
+_dmerror_load_error_table()
 {
-	$DMSETUP_PROG suspend error-test
+	suspend_opt="--nolockfs"
+	[ $# -gt 1 ] && [ $2 -eq 1 ] && suspend_opt=""
+
+	$DMSETUP_PROG suspend $suspend_opt error-test
 	[ $? -ne 0 ] && _fail  "dmsetup suspend failed"
 
 	$DMSETUP_PROG load error-test --table "$DMERROR_TABLE"
@@ -63,3 +71,18 @@ _dmerror_load_table()
 	$DMSETUP_PROG resume error-test
 	[ $? -ne 0 ] && _fail  "dmsetup resume failed"
 }
+
+_dmerror_load_working_table()
+{
+	suspend_opt="--nolockfs"
+	[ $# -gt 1 ] && [ $2 -eq 1 ] && suspend_opt=""
+
+	$DMSETUP_PROG suspend $suspend_opt error-test
+	[ $? -ne 0 ] && _fail  "dmsetup suspend failed"
+
+	$DMSETUP_PROG load error-test --table "$DMLINEAR_TABLE"
+	[ $? -ne 0 ] && _fail "dmsetup failed to load error table"
+
+	$DMSETUP_PROG resume error-test
+	[ $? -ne 0 ] && _fail  "dmsetup resume failed"
+}
diff --git a/tests/btrfs/100 b/tests/btrfs/100
index 080d0ae..cd385e1 100755
--- a/tests/btrfs/100
+++ b/tests/btrfs/100
@@ -69,7 +69,7 @@ run_check $FSSTRESS_PROG -d $SCRATCH_MNT -n 200 -p 8 $FSSTRESS_AVOID -x \
 							"$snapshot_cmd" -X 50
 
 # now load the error into the DMERROR_DEV
-_dmerror_load_table
+_dmerror_load_error_table
 
 _run_btrfs_util_prog replace start -B $error_devid $dev2 $SCRATCH_MNT
 
diff --git a/tests/btrfs/101 b/tests/btrfs/101
index 0824de1..8d7af85 100755
--- a/tests/btrfs/101
+++ b/tests/btrfs/101
@@ -70,7 +70,7 @@ run_check $FSSTRESS_PROG -d $SCRATCH_MNT -n 200 -p 8 $FSSTRESS_AVOID -x \
 							"$snapshot_cmd" -X 50
 
 # now load the error into the DMERROR_DEV
-_dmerror_load_table
+_dmerror_load_error_table
 
 _run_btrfs_util_prog device delete $error_devid $SCRATCH_MNT
 


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

* [PATCH 06/32] common/dmerror: add some more dmerror routines
@ 2016-02-11 23:39   ` Darrick J. Wong
  0 siblings, 0 replies; 81+ messages in thread
From: Darrick J. Wong @ 2016-02-11 23:39 UTC (permalink / raw)
  To: david, darrick.wong; +Cc: fstests, linux-btrfs, xfs

Add functions to the dmerror routine so that we can load both the
error table and the linear table.  This will help us with EIO testing
of copy-on-write.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 common/dmerror  |   27 +++++++++++++++++++++++++--
 tests/btrfs/100 |    2 +-
 tests/btrfs/101 |    2 +-
 3 files changed, 27 insertions(+), 4 deletions(-)


diff --git a/common/dmerror b/common/dmerror
index 3900a4e..004530d 100644
--- a/common/dmerror
+++ b/common/dmerror
@@ -46,15 +46,23 @@ _dmerror_mount()
 	_mount -t $FSTYP `_dmerror_mount_options $*`
 }
 
+_dmerror_unmount()
+{
+	umount $SCRATCH_MNT
+}
+
 _dmerror_cleanup()
 {
 	$UMOUNT_PROG $SCRATCH_MNT > /dev/null 2>&1
 	$DMSETUP_PROG remove error-test > /dev/null 2>&1
 }
 
-_dmerror_load_table()
+_dmerror_load_error_table()
 {
-	$DMSETUP_PROG suspend error-test
+	suspend_opt="--nolockfs"
+	[ $# -gt 1 ] && [ $2 -eq 1 ] && suspend_opt=""
+
+	$DMSETUP_PROG suspend $suspend_opt error-test
 	[ $? -ne 0 ] && _fail  "dmsetup suspend failed"
 
 	$DMSETUP_PROG load error-test --table "$DMERROR_TABLE"
@@ -63,3 +71,18 @@ _dmerror_load_table()
 	$DMSETUP_PROG resume error-test
 	[ $? -ne 0 ] && _fail  "dmsetup resume failed"
 }
+
+_dmerror_load_working_table()
+{
+	suspend_opt="--nolockfs"
+	[ $# -gt 1 ] && [ $2 -eq 1 ] && suspend_opt=""
+
+	$DMSETUP_PROG suspend $suspend_opt error-test
+	[ $? -ne 0 ] && _fail  "dmsetup suspend failed"
+
+	$DMSETUP_PROG load error-test --table "$DMLINEAR_TABLE"
+	[ $? -ne 0 ] && _fail "dmsetup failed to load error table"
+
+	$DMSETUP_PROG resume error-test
+	[ $? -ne 0 ] && _fail  "dmsetup resume failed"
+}
diff --git a/tests/btrfs/100 b/tests/btrfs/100
index 080d0ae..cd385e1 100755
--- a/tests/btrfs/100
+++ b/tests/btrfs/100
@@ -69,7 +69,7 @@ run_check $FSSTRESS_PROG -d $SCRATCH_MNT -n 200 -p 8 $FSSTRESS_AVOID -x \
 							"$snapshot_cmd" -X 50
 
 # now load the error into the DMERROR_DEV
-_dmerror_load_table
+_dmerror_load_error_table
 
 _run_btrfs_util_prog replace start -B $error_devid $dev2 $SCRATCH_MNT
 
diff --git a/tests/btrfs/101 b/tests/btrfs/101
index 0824de1..8d7af85 100755
--- a/tests/btrfs/101
+++ b/tests/btrfs/101
@@ -70,7 +70,7 @@ run_check $FSSTRESS_PROG -d $SCRATCH_MNT -n 200 -p 8 $FSSTRESS_AVOID -x \
 							"$snapshot_cmd" -X 50
 
 # now load the error into the DMERROR_DEV
-_dmerror_load_table
+_dmerror_load_error_table
 
 _run_btrfs_util_prog device delete $error_devid $SCRATCH_MNT
 

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

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

* [PATCH 07/32] common: create _require_test_program to look for programs in src/
  2016-02-11 23:39 ` Darrick J. Wong
@ 2016-02-11 23:40   ` Darrick J. Wong
  -1 siblings, 0 replies; 81+ messages in thread
From: Darrick J. Wong @ 2016-02-11 23:40 UTC (permalink / raw)
  To: david, darrick.wong; +Cc: linux-btrfs, fstests, xfs

Create a helper that looks for a test program in src/ and fails the
test if it doesn't exist.  Refactor the existing testcases to use it.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 common/rc         |    9 +++++++++
 tests/generic/010 |    2 +-
 tests/generic/094 |    2 +-
 tests/generic/225 |    2 +-
 tests/generic/285 |    2 +-
 tests/generic/286 |    2 +-
 tests/generic/311 |    2 +-
 tests/xfs/032     |    3 +--
 tests/xfs/044     |    2 +-
 9 files changed, 17 insertions(+), 9 deletions(-)


diff --git a/common/rc b/common/rc
index 84f794a..63eb90b 100644
--- a/common/rc
+++ b/common/rc
@@ -1684,6 +1684,15 @@ _require_aiodio()
     _require_odirect
 }
 
+# this test requires that a test program exists under src/
+# $1 - command (require)
+#
+_require_test_program()
+{
+    SRC_TEST=src/$1
+    [ -x $SRC_TEST ] || _notrun "$SRC_TEST not built"
+}
+
 # run an aio-dio program
 # $1 - command
 _run_aiodio()
diff --git a/tests/generic/010 b/tests/generic/010
index ea8ea50..1c9d8f7 100755
--- a/tests/generic/010
+++ b/tests/generic/010
@@ -51,7 +51,7 @@ _filter_dbtest()
 . ./common/rc
 . ./common/filter
 
-[ -x $here/src/dbtest ] || _notrun "dbtest was not built for this platform"
+_require_test_program "dbtest"
 
 # real QA test starts here
 _supported_fs generic
diff --git a/tests/generic/094 b/tests/generic/094
index 4e4b668..a51738a 100644
--- a/tests/generic/094
+++ b/tests/generic/094
@@ -53,7 +53,7 @@ _scratch_mount > /dev/null 2>&1
 rm -f $seqres.full
 fiemapfile=$SCRATCH_MNT/$seq.fiemap
 
-[ -x $here/src/fiemap-tester ] || _notrun "fiemap-tester not built"
+_require_test_program "fiemap-tester"
 
 seed=`date +%s`
 
diff --git a/tests/generic/225 b/tests/generic/225
index 6134c8c..c8e0f64 100755
--- a/tests/generic/225
+++ b/tests/generic/225
@@ -53,7 +53,7 @@ rm -f $seqres.full
 fiemapfile=$SCRATCH_MNT/$seq.fiemap
 fiemaplog=$SCRATCH_MNT/$seq.log
 
-[ -x $here/src/fiemap-tester ] || _notrun "fiemap-tester not built"
+_require_test_program "fiemap-tester"
 
 seed=`date +%s`
 
diff --git a/tests/generic/285 b/tests/generic/285
index d6275b5..16e70b1 100755
--- a/tests/generic/285
+++ b/tests/generic/285
@@ -45,7 +45,7 @@ _require_seek_data_hole
 
 BASE_TEST_FILE=$TEST_DIR/seek_sanity_testfile
 
-[ -x $here/src/seek_sanity_test ] || _notrun "seek_sanitfy_tester not built"
+_require_test_program "seek_sanity_test"
 
 # Disable extent zeroing for ext4 as that change where holes are created
 if [ "$FSTYP" = "ext4" ]; then
diff --git a/tests/generic/286 b/tests/generic/286
index f6bf356..f88f079 100755
--- a/tests/generic/286
+++ b/tests/generic/286
@@ -44,7 +44,7 @@ _require_seek_data_hole
 src=$TEST_DIR/seek_copy_testfile
 dest=$TEST_DIR/seek_copy_testfile.dest
 
-[ -x $here/src/seek_copy_test ] || _notrun "seek_copy_test not built"
+_require_test_program "seek_copy_test"
 
 _cleanup()
 {
diff --git a/tests/generic/311 b/tests/generic/311
index f552011..69bc1bf 100755
--- a/tests/generic/311
+++ b/tests/generic/311
@@ -62,7 +62,7 @@ _require_metadata_journaling $SCRATCH_DEV
 # the test system supports fallocate() for allocation
 _require_xfs_io_command "falloc"
 
-[ -x $here/src/fsync-tester ] || _notrun "fsync-tester not built"
+_require_test_program "fsync-tester"
 
 rm -f $seqres.full
 SEED=1
diff --git a/tests/xfs/032 b/tests/xfs/032
index 063f272..6216379 100755
--- a/tests/xfs/032
+++ b/tests/xfs/032
@@ -40,8 +40,7 @@ _supported_fs xfs
 _supported_os IRIX Linux
 
 _require_scratch
-
-[ $here/src/feature ] || _notrun "src/feature not built, skipping this test"
+_require_test_program "feature"
 
 [ "$USE_EXTERNAL" = yes ] && _notrun "Cannot xfs_copy with external devices"
 [ -n "$XFS_COPY_PROG" ] || _notrun "xfs_copy binary not yet installed"
diff --git a/tests/xfs/044 b/tests/xfs/044
index 2ffd74f..ea58c07 100755
--- a/tests/xfs/044
+++ b/tests/xfs/044
@@ -124,7 +124,7 @@ _filter_mkfs <$tmp.mkfs0 2>$tmp.mkfs1
 [ $lversion -ne 1 ] && \
     _notrun "Cannot run this test yet using MKFS_OPTIONS specified"
 
-[ $here/src/loggen ] || _notrun "loggen not built, skipping test"
+_require_test_program "loggen"
 
 _check_mount
 _check_require_logdev


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

* [PATCH 07/32] common: create _require_test_program to look for programs in src/
@ 2016-02-11 23:40   ` Darrick J. Wong
  0 siblings, 0 replies; 81+ messages in thread
From: Darrick J. Wong @ 2016-02-11 23:40 UTC (permalink / raw)
  To: david, darrick.wong; +Cc: fstests, linux-btrfs, xfs

Create a helper that looks for a test program in src/ and fails the
test if it doesn't exist.  Refactor the existing testcases to use it.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 common/rc         |    9 +++++++++
 tests/generic/010 |    2 +-
 tests/generic/094 |    2 +-
 tests/generic/225 |    2 +-
 tests/generic/285 |    2 +-
 tests/generic/286 |    2 +-
 tests/generic/311 |    2 +-
 tests/xfs/032     |    3 +--
 tests/xfs/044     |    2 +-
 9 files changed, 17 insertions(+), 9 deletions(-)


diff --git a/common/rc b/common/rc
index 84f794a..63eb90b 100644
--- a/common/rc
+++ b/common/rc
@@ -1684,6 +1684,15 @@ _require_aiodio()
     _require_odirect
 }
 
+# this test requires that a test program exists under src/
+# $1 - command (require)
+#
+_require_test_program()
+{
+    SRC_TEST=src/$1
+    [ -x $SRC_TEST ] || _notrun "$SRC_TEST not built"
+}
+
 # run an aio-dio program
 # $1 - command
 _run_aiodio()
diff --git a/tests/generic/010 b/tests/generic/010
index ea8ea50..1c9d8f7 100755
--- a/tests/generic/010
+++ b/tests/generic/010
@@ -51,7 +51,7 @@ _filter_dbtest()
 . ./common/rc
 . ./common/filter
 
-[ -x $here/src/dbtest ] || _notrun "dbtest was not built for this platform"
+_require_test_program "dbtest"
 
 # real QA test starts here
 _supported_fs generic
diff --git a/tests/generic/094 b/tests/generic/094
index 4e4b668..a51738a 100644
--- a/tests/generic/094
+++ b/tests/generic/094
@@ -53,7 +53,7 @@ _scratch_mount > /dev/null 2>&1
 rm -f $seqres.full
 fiemapfile=$SCRATCH_MNT/$seq.fiemap
 
-[ -x $here/src/fiemap-tester ] || _notrun "fiemap-tester not built"
+_require_test_program "fiemap-tester"
 
 seed=`date +%s`
 
diff --git a/tests/generic/225 b/tests/generic/225
index 6134c8c..c8e0f64 100755
--- a/tests/generic/225
+++ b/tests/generic/225
@@ -53,7 +53,7 @@ rm -f $seqres.full
 fiemapfile=$SCRATCH_MNT/$seq.fiemap
 fiemaplog=$SCRATCH_MNT/$seq.log
 
-[ -x $here/src/fiemap-tester ] || _notrun "fiemap-tester not built"
+_require_test_program "fiemap-tester"
 
 seed=`date +%s`
 
diff --git a/tests/generic/285 b/tests/generic/285
index d6275b5..16e70b1 100755
--- a/tests/generic/285
+++ b/tests/generic/285
@@ -45,7 +45,7 @@ _require_seek_data_hole
 
 BASE_TEST_FILE=$TEST_DIR/seek_sanity_testfile
 
-[ -x $here/src/seek_sanity_test ] || _notrun "seek_sanitfy_tester not built"
+_require_test_program "seek_sanity_test"
 
 # Disable extent zeroing for ext4 as that change where holes are created
 if [ "$FSTYP" = "ext4" ]; then
diff --git a/tests/generic/286 b/tests/generic/286
index f6bf356..f88f079 100755
--- a/tests/generic/286
+++ b/tests/generic/286
@@ -44,7 +44,7 @@ _require_seek_data_hole
 src=$TEST_DIR/seek_copy_testfile
 dest=$TEST_DIR/seek_copy_testfile.dest
 
-[ -x $here/src/seek_copy_test ] || _notrun "seek_copy_test not built"
+_require_test_program "seek_copy_test"
 
 _cleanup()
 {
diff --git a/tests/generic/311 b/tests/generic/311
index f552011..69bc1bf 100755
--- a/tests/generic/311
+++ b/tests/generic/311
@@ -62,7 +62,7 @@ _require_metadata_journaling $SCRATCH_DEV
 # the test system supports fallocate() for allocation
 _require_xfs_io_command "falloc"
 
-[ -x $here/src/fsync-tester ] || _notrun "fsync-tester not built"
+_require_test_program "fsync-tester"
 
 rm -f $seqres.full
 SEED=1
diff --git a/tests/xfs/032 b/tests/xfs/032
index 063f272..6216379 100755
--- a/tests/xfs/032
+++ b/tests/xfs/032
@@ -40,8 +40,7 @@ _supported_fs xfs
 _supported_os IRIX Linux
 
 _require_scratch
-
-[ $here/src/feature ] || _notrun "src/feature not built, skipping this test"
+_require_test_program "feature"
 
 [ "$USE_EXTERNAL" = yes ] && _notrun "Cannot xfs_copy with external devices"
 [ -n "$XFS_COPY_PROG" ] || _notrun "xfs_copy binary not yet installed"
diff --git a/tests/xfs/044 b/tests/xfs/044
index 2ffd74f..ea58c07 100755
--- a/tests/xfs/044
+++ b/tests/xfs/044
@@ -124,7 +124,7 @@ _filter_mkfs <$tmp.mkfs0 2>$tmp.mkfs1
 [ $lversion -ne 1 ] && \
     _notrun "Cannot run this test yet using MKFS_OPTIONS specified"
 
-[ $here/src/loggen ] || _notrun "loggen not built, skipping test"
+_require_test_program "loggen"
 
 _check_mount
 _check_require_logdev

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

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

* [PATCH 08/32] common: provide a method to repair the scratch fs
  2016-02-11 23:39 ` Darrick J. Wong
@ 2016-02-11 23:40   ` Darrick J. Wong
  -1 siblings, 0 replies; 81+ messages in thread
From: Darrick J. Wong @ 2016-02-11 23:40 UTC (permalink / raw)
  To: david, darrick.wong; +Cc: linux-btrfs, fstests, xfs

Create a wrapper function that repairs any damage to the scratch
filesystem and returns a standard result.  We will use this to clean
up after IO error testing and other weird corruption tests.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 common/rc |   43 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 43 insertions(+)


diff --git a/common/rc b/common/rc
index 63eb90b..e05df74 100644
--- a/common/rc
+++ b/common/rc
@@ -953,6 +953,49 @@ _scratch_xfs_repair()
     $XFS_REPAIR_PROG $SCRATCH_OPTIONS $* $SCRATCH_DEV
 }
 
+# Repair scratch filesystem.  Returns 0 if the FS is good to go (either no
+# errors found or errors were fixed) and nonzero otherwise; also spits out
+# a complaint on stderr if fsck didn't tell us that the FS is good to go.
+_repair_scratch_fs()
+{
+    case $FSTYP in
+    xfs)
+        _scratch_xfs_repair "$@" 2>&1
+	res=$?
+	if [ "$res" -eq 2 ]; then
+		echo "xfs_repair returns $res; replay log?"
+		_scratch_mount
+		res=$?
+		if [ "$res" -gt 0 ]; then
+			echo "mount returns $res; zap log?"
+			_scratch_xfs_repair -L 2>&1
+			echo "log zap returns $?"
+		else
+			umount "$SCRATCH_MNT"
+		fi
+		_scratch_xfs_repair "$@" 2>&1
+		res=$?
+	fi
+	test $res -ne 0 && >&2 echo "xfs_repair failed, err=$res"
+	return $res
+        ;;
+    *)
+        # Let's hope fsck -y suffices...
+        fsck -t $FSTYP -y $SCRATCH_DEV 2>&1
+	res=$?
+	case $res in
+	0|1|2)
+		res=0
+		;;
+	*)
+		>&2 echo "fsck.$FSTYP failed, err=$res"
+		;;
+	esac
+	return $res
+        ;;
+    esac
+}
+
 _get_pids_by_name()
 {
     if [ $# -ne 1 ]


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

* [PATCH 08/32] common: provide a method to repair the scratch fs
@ 2016-02-11 23:40   ` Darrick J. Wong
  0 siblings, 0 replies; 81+ messages in thread
From: Darrick J. Wong @ 2016-02-11 23:40 UTC (permalink / raw)
  To: david, darrick.wong; +Cc: fstests, linux-btrfs, xfs

Create a wrapper function that repairs any damage to the scratch
filesystem and returns a standard result.  We will use this to clean
up after IO error testing and other weird corruption tests.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 common/rc |   43 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 43 insertions(+)


diff --git a/common/rc b/common/rc
index 63eb90b..e05df74 100644
--- a/common/rc
+++ b/common/rc
@@ -953,6 +953,49 @@ _scratch_xfs_repair()
     $XFS_REPAIR_PROG $SCRATCH_OPTIONS $* $SCRATCH_DEV
 }
 
+# Repair scratch filesystem.  Returns 0 if the FS is good to go (either no
+# errors found or errors were fixed) and nonzero otherwise; also spits out
+# a complaint on stderr if fsck didn't tell us that the FS is good to go.
+_repair_scratch_fs()
+{
+    case $FSTYP in
+    xfs)
+        _scratch_xfs_repair "$@" 2>&1
+	res=$?
+	if [ "$res" -eq 2 ]; then
+		echo "xfs_repair returns $res; replay log?"
+		_scratch_mount
+		res=$?
+		if [ "$res" -gt 0 ]; then
+			echo "mount returns $res; zap log?"
+			_scratch_xfs_repair -L 2>&1
+			echo "log zap returns $?"
+		else
+			umount "$SCRATCH_MNT"
+		fi
+		_scratch_xfs_repair "$@" 2>&1
+		res=$?
+	fi
+	test $res -ne 0 && >&2 echo "xfs_repair failed, err=$res"
+	return $res
+        ;;
+    *)
+        # Let's hope fsck -y suffices...
+        fsck -t $FSTYP -y $SCRATCH_DEV 2>&1
+	res=$?
+	case $res in
+	0|1|2)
+		res=0
+		;;
+	*)
+		>&2 echo "fsck.$FSTYP failed, err=$res"
+		;;
+	esac
+	return $res
+        ;;
+    esac
+}
+
 _get_pids_by_name()
 {
     if [ $# -ne 1 ]

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

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

* [PATCH 09/32] reflink: refactor mixed block creation code
  2016-02-11 23:39 ` Darrick J. Wong
@ 2016-02-11 23:40   ` Darrick J. Wong
  -1 siblings, 0 replies; 81+ messages in thread
From: Darrick J. Wong @ 2016-02-11 23:40 UTC (permalink / raw)
  To: david, darrick.wong; +Cc: linux-btrfs, fstests, xfs

Refactor the code that creates files with mixed block types that we feed
into CoW tests to make sure that we can tiptoe around that kind of stuff.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 common/reflink        |  108 +++++++++++++++++++++++++++++++++++++++++++++++++
 tests/generic/188     |    8 ----
 tests/generic/189     |    8 ----
 tests/generic/190     |    8 ----
 tests/generic/191     |    8 ----
 tests/generic/194     |   13 +-----
 tests/generic/195     |   13 +-----
 tests/generic/196     |    8 ----
 tests/generic/197     |    8 ----
 tests/generic/199     |   31 +-------------
 tests/generic/199.out |    4 +-
 tests/generic/200     |   31 +-------------
 tests/generic/200.out |    4 +-
 13 files changed, 126 insertions(+), 126 deletions(-)


diff --git a/common/reflink b/common/reflink
index 3d6a8c1..b92f664 100644
--- a/common/reflink
+++ b/common/reflink
@@ -187,3 +187,111 @@ _dedupe_range() {
 
 	"$XFS_IO_PROG" $xfs_io_args -f -c "dedupe $file1 $offset1 $offset2 $len" "$file2"
 }
+
+# Create a file of interleaved unwritten and reflinked blocks
+_weave_reflink_unwritten() {
+	blksz=$1
+	nr=$2
+	sfile=$3
+	dfile=$4
+
+	_pwrite_byte 0x61 0 $((blksz * nr)) $sfile
+	$XFS_IO_PROG -f -c "falloc 0 $((blksz * nr))" $dfile
+	_pwrite_byte 0x00 0 $((blksz * nr)) $dfile.chk
+	seq 0 2 $((nr - 1)) | while read i; do
+		_reflink_range $sfile $((blksz * i)) $dfile $((blksz * i)) $blksz
+		_pwrite_byte 0x61 $((blksz * i)) $blksz $dfile.chk
+	done
+}
+
+# Create a file of interleaved holes and reflinked blocks
+_weave_reflink_holes() {
+	blksz=$1
+	nr=$2
+	sfile=$3
+	dfile=$4
+
+	_pwrite_byte 0x61 0 $((blksz * nr)) $sfile
+	$XFS_IO_PROG -f -c "truncate $((blksz * nr))" $dfile
+	_pwrite_byte 0x00 0 $((blksz * nr)) $dfile.chk
+	seq 0 2 $((nr - 1)) | while read i; do
+		_reflink_range $sfile $((blksz * i)) $dfile $((blksz * i)) $blksz
+		_pwrite_byte 0x61 $((blksz * i)) $blksz $dfile.chk
+	done
+}
+
+# For a file created with _weave_reflink_holes, fill the holes with delalloc
+# extents
+_weave_reflink_holes_delalloc() {
+	blksz=$1
+	nr=$2
+	dfile=$3
+
+	seq 1 2 $((nr - 1)) | while read i; do
+		_pwrite_byte 0x62 $((blksz * i)) $blksz $dfile
+		_pwrite_byte 0x62 $((blksz * i)) $blksz $dfile.chk
+	done
+}
+
+# Create a file of interleaved regular blocks and reflinked blocks
+_weave_reflink_regular() {
+	blksz=$1
+	nr=$2
+	sfile=$3
+	dfile=$4
+
+	_pwrite_byte 0x61 0 $((blksz * nr)) $sfile
+	_pwrite_byte 0x62 0 $((blksz * nr)) $dfile
+	_pwrite_byte 0x62 0 $((blksz * nr)) $dfile.chk
+	seq 0 2 $((nr - 1)) | while read i; do
+		_reflink_range $sfile $((blksz * i)) $dfile $((blksz * i)) $blksz
+		_pwrite_byte 0x61 $((blksz * i)) $blksz $dfile.chk
+	done
+}
+
+# Create a file of interleaved holes, unwritten blocks, regular blocks, and
+# reflinked blocks
+_weave_reflink_rainbow() {
+	blksz=$1
+	nr=$2
+	sfile=$3
+	dfile=$4
+
+	_pwrite_byte 0x61 0 $((blksz * nr)) $sfile
+	$XFS_IO_PROG -f -c "truncate $((blksz * nr))" $dfile
+	_pwrite_byte 0x00 0 $((blksz * nr)) $dfile.chk
+	# 0 blocks are reflinked
+	seq 0 5 $((nr - 1)) | while read i; do
+		_reflink_range $sfile $((blksz * i)) $dfile $((blksz * i)) $blksz
+		_pwrite_byte 0x61 $((blksz * i)) $blksz $dfile.chk
+	done
+	# 1 blocks are unwritten
+	seq 1 5 $((nr - 1)) | while read i; do
+		$XFS_IO_PROG -f -c "falloc $((blksz * i)) $blksz" $dfile
+		_pwrite_byte 0x00 $((blksz * i)) $blksz $dfile.chk
+	done
+	# 2 blocks are holes
+	seq 2 5 $((nr - 1)) | while read i; do
+		_pwrite_byte 0x00 $((blksz * i)) $blksz $dfile.chk
+	done
+	# 3 blocks are regular
+	seq 3 5 $((nr - 1)) | while read i; do
+		_pwrite_byte 0x71 $((blksz * i)) $blksz $dfile
+		_pwrite_byte 0x71 $((blksz * i)) $blksz $dfile.chk
+	done
+	# 4 blocks will be delalloc later
+}
+
+# For a file created with _weave_reflink_rainbow, fill the holes with delalloc
+# extents
+_weave_reflink_rainbow_delalloc() {
+	blksz=$1
+	nr=$2
+	dfile=$3
+
+	# 4 blocks are delalloc (do later)
+	seq 4 5 $((nr - 1)) | while read i; do
+		_pwrite_byte 0x62 $((blksz * i)) $blksz $dfile
+		_pwrite_byte 0x62 $((blksz * i)) $blksz $dfile.chk
+	done
+}
diff --git a/tests/generic/188 b/tests/generic/188
index 7596c4b..86980cc 100755
--- a/tests/generic/188
+++ b/tests/generic/188
@@ -63,13 +63,7 @@ mkdir $testdir
 echo "Create the original files"
 blksz=65536
 nr=64
-_pwrite_byte 0x61 0 $((blksz * nr)) "$testdir/file1" >> "$seqres.full"
-$XFS_IO_PROG -f -c "falloc 0 $((blksz * nr))" "$testdir/file3" >> "$seqres.full"
-_pwrite_byte 0x00 0 $((blksz * nr)) "$testdir/file3.chk" >> "$seqres.full"
-seq 0 2 $((nr-1)) | while read f; do
-	_reflink_range "$testdir/file1" $((blksz * f)) "$testdir/file3" $((blksz * f)) $blksz >> "$seqres.full"
-	_pwrite_byte 0x61 $((blksz * f)) $blksz "$testdir/file3.chk" >> "$seqres.full"
-done
+_weave_reflink_unwritten $blksz $nr $testdir/file1 $testdir/file3 >> $seqres.full
 _scratch_remount
 
 echo "Compare files"
diff --git a/tests/generic/189 b/tests/generic/189
index 130dc58..8f5a338 100755
--- a/tests/generic/189
+++ b/tests/generic/189
@@ -63,13 +63,7 @@ mkdir $testdir
 echo "Create the original files"
 blksz=65536
 nr=64
-_pwrite_byte 0x61 0 $((blksz * nr)) "$testdir/file1" >> "$seqres.full"
-$XFS_IO_PROG -f -c "falloc 0 $((blksz * nr))" "$testdir/file3" >> "$seqres.full"
-_pwrite_byte 0x00 0 $((blksz * nr)) "$testdir/file3.chk" >> "$seqres.full"
-seq 0 2 $((nr-1)) | while read f; do
-	_reflink_range "$testdir/file1" $((blksz * f)) "$testdir/file3" $((blksz * f)) $blksz >> "$seqres.full"
-	_pwrite_byte 0x61 $((blksz * f)) $blksz "$testdir/file3.chk" >> "$seqres.full"
-done
+_weave_reflink_unwritten $blksz $nr $testdir/file1 $testdir/file3 >> $seqres.full
 _scratch_remount
 
 echo "Compare files"
diff --git a/tests/generic/190 b/tests/generic/190
index 0171475..8edfeb7 100755
--- a/tests/generic/190
+++ b/tests/generic/190
@@ -63,13 +63,7 @@ mkdir $testdir
 echo "Create the original files"
 blksz=65536
 nr=64
-_pwrite_byte 0x61 0 $((blksz * nr)) "$testdir/file1" >> "$seqres.full"
-$XFS_IO_PROG -f -c "truncate $((blksz * nr))" "$testdir/file3" >> "$seqres.full"
-_pwrite_byte 0x00 0 $((blksz * nr)) "$testdir/file3.chk" >> "$seqres.full"
-seq 0 2 $((nr-1)) | while read f; do
-	_reflink_range "$testdir/file1" $((blksz * f)) "$testdir/file3" $((blksz * f)) $blksz >> "$seqres.full"
-	_pwrite_byte 0x61 $((blksz * f)) $blksz "$testdir/file3.chk" >> "$seqres.full"
-done
+_weave_reflink_holes $blksz $nr $testdir/file1 $testdir/file3 >> $seqres.full
 _scratch_remount
 
 echo "Compare files"
diff --git a/tests/generic/191 b/tests/generic/191
index 34d96f9..dd97baa 100755
--- a/tests/generic/191
+++ b/tests/generic/191
@@ -63,13 +63,7 @@ mkdir $testdir
 echo "Create the original files"
 blksz=65536
 nr=64
-_pwrite_byte 0x61 0 $((blksz * nr)) "$testdir/file1" >> "$seqres.full"
-$XFS_IO_PROG -f -c "truncate $((blksz * nr))" "$testdir/file3" >> "$seqres.full"
-_pwrite_byte 0x00 0 $((blksz * nr)) "$testdir/file3.chk" >> "$seqres.full"
-seq 0 2 $((nr-1)) | while read f; do
-	_reflink_range "$testdir/file1" $((blksz * f)) "$testdir/file3" $((blksz * f)) $blksz >> "$seqres.full"
-	_pwrite_byte 0x61 $((blksz * f)) $blksz "$testdir/file3.chk" >> "$seqres.full"
-done
+_weave_reflink_holes $blksz $nr $testdir/file1 $testdir/file3 >> $seqres.full
 _scratch_remount
 
 echo "Compare files"
diff --git a/tests/generic/194 b/tests/generic/194
index e9feaad..82b3100 100755
--- a/tests/generic/194
+++ b/tests/generic/194
@@ -64,13 +64,7 @@ mkdir $testdir
 echo "Create the original files"
 blksz=65536
 nr=64
-_pwrite_byte 0x61 0 $((blksz * nr)) "$testdir/file1" >> "$seqres.full"
-$XFS_IO_PROG -f -c "truncate $((blksz * nr))" "$testdir/file3" >> "$seqres.full"
-_pwrite_byte 0x00 0 $((blksz * nr)) "$testdir/file3.chk" >> "$seqres.full"
-seq 0 2 $((nr-1)) | while read f; do
-	_reflink_range "$testdir/file1" $((blksz * f)) "$testdir/file3" $((blksz * f)) $blksz >> "$seqres.full"
-	_pwrite_byte 0x61 $((blksz * f)) $blksz "$testdir/file3.chk" >> "$seqres.full"
-done
+_weave_reflink_holes $blksz $nr $testdir/file1 $testdir/file3 >> $seqres.full
 _scratch_remount
 
 echo "Compare files"
@@ -79,10 +73,7 @@ md5sum "$testdir/file3" | _filter_scratch
 md5sum "$testdir/file3.chk" | _filter_scratch
 
 echo "directio CoW across the transition"
-seq 1 2 $((nr-1)) | while read f; do
-	_pwrite_byte 0x62 $((blksz * f)) $blksz "$testdir/file3" >> "$seqres.full"
-	_pwrite_byte 0x62 $((blksz * f)) $blksz "$testdir/file3.chk" >> "$seqres.full"
-done
+_weave_reflink_holes_delalloc $blksz $nr $testdir/file3 >> $seqres.full
 "$XFS_IO_PROG" -d -f -c "pwrite -S 0x63 -b $((blksz * nr / 2)) $((blksz * nr / 4)) $((blksz * nr / 2))" "$testdir/file3" >> "$seqres.full"
 _pwrite_byte 0x63 $((blksz * nr / 4)) $((blksz * nr / 2)) "$testdir/file3.chk" >> "$seqres.full"
 _scratch_remount
diff --git a/tests/generic/195 b/tests/generic/195
index 32548ba..ce4c0a9 100755
--- a/tests/generic/195
+++ b/tests/generic/195
@@ -64,13 +64,7 @@ mkdir $testdir
 echo "Create the original files"
 blksz=65536
 nr=64
-_pwrite_byte 0x61 0 $((blksz * nr)) "$testdir/file1" >> "$seqres.full"
-$XFS_IO_PROG -f -c "truncate $((blksz * nr))" "$testdir/file3" >> "$seqres.full"
-_pwrite_byte 0x00 0 $((blksz * nr)) "$testdir/file3.chk" >> "$seqres.full"
-seq 0 2 $((nr-1)) | while read f; do
-	_reflink_range "$testdir/file1" $((blksz * f)) "$testdir/file3" $((blksz * f)) $blksz >> "$seqres.full"
-	_pwrite_byte 0x61 $((blksz * f)) $blksz "$testdir/file3.chk" >> "$seqres.full"
-done
+_weave_reflink_holes $blksz $nr $testdir/file1 $testdir/file3 >> $seqres.full
 _scratch_remount
 
 echo "Compare files"
@@ -79,10 +73,7 @@ md5sum "$testdir/file3" | _filter_scratch
 md5sum "$testdir/file3.chk" | _filter_scratch
 
 echo "CoW across the transition"
-seq 1 2 $((nr-1)) | while read f; do
-	_pwrite_byte 0x62 $((blksz * f)) $blksz "$testdir/file3" >> "$seqres.full"
-	_pwrite_byte 0x62 $((blksz * f)) $blksz "$testdir/file3.chk" >> "$seqres.full"
-done
+_weave_reflink_holes_delalloc $blksz $nr $testdir/file3 >> $seqres.full
 "$XFS_IO_PROG" -f -c "pwrite -S 0x63 -b $((blksz * nr / 2)) $((blksz * nr / 4)) $((blksz * nr / 2))" "$testdir/file3" >> "$seqres.full"
 _pwrite_byte 0x63 $((blksz * nr / 4)) $((blksz * nr / 2)) "$testdir/file3.chk" >> "$seqres.full"
 _scratch_remount
diff --git a/tests/generic/196 b/tests/generic/196
index 4ec2cff..a7a0035 100755
--- a/tests/generic/196
+++ b/tests/generic/196
@@ -63,13 +63,7 @@ mkdir $testdir
 echo "Create the original files"
 blksz=65536
 nr=64
-_pwrite_byte 0x61 0 $((blksz * nr)) "$testdir/file1" >> "$seqres.full"
-_pwrite_byte 0x62 0 $((blksz * nr)) "$testdir/file3" >> "$seqres.full"
-_pwrite_byte 0x62 0 $((blksz * nr)) "$testdir/file3.chk" >> "$seqres.full"
-seq 0 2 $((nr-1)) | while read f; do
-	_reflink_range "$testdir/file1" $((blksz * f)) "$testdir/file3" $((blksz * f)) $blksz >> "$seqres.full"
-	_pwrite_byte 0x61 $((blksz * f)) $blksz "$testdir/file3.chk" >> "$seqres.full"
-done
+_weave_reflink_regular $blksz $nr $testdir/file1 $testdir/file3 >> $seqres.full
 _scratch_remount
 
 echo "Compare files"
diff --git a/tests/generic/197 b/tests/generic/197
index 356a587..84a14ff 100755
--- a/tests/generic/197
+++ b/tests/generic/197
@@ -63,13 +63,7 @@ mkdir $testdir
 echo "Create the original files"
 blksz=65536
 nr=64
-_pwrite_byte 0x61 0 $((blksz * nr)) "$testdir/file1" >> "$seqres.full"
-_pwrite_byte 0x62 0 $((blksz * nr)) "$testdir/file3" >> "$seqres.full"
-_pwrite_byte 0x62 0 $((blksz * nr)) "$testdir/file3.chk" >> "$seqres.full"
-seq 0 2 $((nr-1)) | while read f; do
-	_reflink_range "$testdir/file1" $((blksz * f)) "$testdir/file3" $((blksz * f)) $blksz >> "$seqres.full"
-	_pwrite_byte 0x61 $((blksz * f)) $blksz "$testdir/file3.chk" >> "$seqres.full"
-done
+_weave_reflink_regular $blksz $nr $testdir/file1 $testdir/file3 >> $seqres.full
 _scratch_remount
 
 echo "Compare files"
diff --git a/tests/generic/199 b/tests/generic/199
index 03b8fda..6a65533 100755
--- a/tests/generic/199
+++ b/tests/generic/199
@@ -69,30 +69,7 @@ mkdir $testdir
 echo "Create the original files"
 blksz=65536
 nr=64
-_pwrite_byte 0x61 0 $((blksz * nr)) "$testdir/file1" >> "$seqres.full"
-$XFS_IO_PROG -f -c "truncate $((blksz * nr))" "$testdir/file3" >> "$seqres.full"
-# 0 blocks are reflinked
-seq 0 5 $nr | while read f; do
-	_reflink_range "$testdir/file1" $((blksz * f)) "$testdir/file3" $((blksz * f)) $blksz >> "$seqres.full"
-	_pwrite_byte 0x61 $((blksz * f)) $blksz "$testdir/file3.chk" >> "$seqres.full"
-done
-sync
-# 1 blocks are unwritten
-seq 1 5 $nr | while read f; do
-	$XFS_IO_PROG -f -c "falloc $((blksz * f)) $blksz" "$testdir/file3" >> "$seqres.full"
-	_pwrite_byte 0x00 $((blksz * f)) $blksz "$testdir/file3.chk" >> "$seqres.full"
-done
-sync
-# 2 blocks are holes
-seq 2 5 $nr | while read f; do
-	_pwrite_byte 0x00 $((blksz * f)) $blksz "$testdir/file3.chk" >> "$seqres.full"
-done
-# 3 blocks are regular
-seq 3 5 $nr | while read f; do
-	_pwrite_byte 0x71 $((blksz * f)) $blksz "$testdir/file3" >> "$seqres.full"
-	_pwrite_byte 0x71 $((blksz * f)) $blksz "$testdir/file3.chk" >> "$seqres.full"
-done
-sync
+_weave_reflink_rainbow $blksz $nr $testdir/file1 $testdir/file3 >> $seqres.full
 _scratch_remount
 
 echo "Compare files"
@@ -101,11 +78,7 @@ md5sum "$testdir/file3" | _filter_scratch
 md5sum "$testdir/file3.chk" | _filter_scratch
 
 echo "directio CoW across the transition"
-# 4 blocks are delalloc (do later)
-seq 4 5 $nr | while read f; do
-	_pwrite_byte 0x62 $((blksz * f)) $blksz "$testdir/file3" >> "$seqres.full"
-	_pwrite_byte 0x62 $((blksz * f)) $blksz "$testdir/file3.chk" >> "$seqres.full"
-done
+_weave_reflink_rainbow_delalloc $blksz $nr $testdir/file3 >> $seqres.full
 # now cow
 "$XFS_IO_PROG" -d -f -c "pwrite -S 0x63 -b $((blksz * nr / 2)) $((blksz * nr / 4)) $((blksz * nr / 2))" "$testdir/file3" >> "$seqres.full"
 _pwrite_byte 0x63 $((blksz * nr / 4)) $((blksz * nr / 2)) "$testdir/file3.chk" >> "$seqres.full"
diff --git a/tests/generic/199.out b/tests/generic/199.out
index b35c135..a1016ac 100644
--- a/tests/generic/199.out
+++ b/tests/generic/199.out
@@ -8,5 +8,5 @@ bdbcf02ee0aa977795a79d25fcfdccb1  SCRATCH_MNT/test-199/file1
 directio CoW across the transition
 Compare files
 bdbcf02ee0aa977795a79d25fcfdccb1  SCRATCH_MNT/test-199/file1
-36f6b5317a9a921fc91175390ccf7f69  SCRATCH_MNT/test-199/file3
-36f6b5317a9a921fc91175390ccf7f69  SCRATCH_MNT/test-199/file3.chk
+26aa3a0749b867ec58363c8539ee5471  SCRATCH_MNT/test-199/file3
+26aa3a0749b867ec58363c8539ee5471  SCRATCH_MNT/test-199/file3.chk
diff --git a/tests/generic/200 b/tests/generic/200
index e71eedc..541d16d 100755
--- a/tests/generic/200
+++ b/tests/generic/200
@@ -69,30 +69,7 @@ mkdir $testdir
 echo "Create the original files"
 blksz=65536
 nr=64
-_pwrite_byte 0x61 0 $((blksz * nr)) "$testdir/file1" >> "$seqres.full"
-$XFS_IO_PROG -f -c "truncate $((blksz * nr))" "$testdir/file3" >> "$seqres.full"
-# 0 blocks are reflinked
-seq 0 5 $nr | while read f; do
-	_reflink_range "$testdir/file1" $((blksz * f)) "$testdir/file3" $((blksz * f)) $blksz >> "$seqres.full"
-	_pwrite_byte 0x61 $((blksz * f)) $blksz "$testdir/file3.chk" >> "$seqres.full"
-done
-sync
-# 1 blocks are unwritten
-seq 1 5 $nr | while read f; do
-	$XFS_IO_PROG -f -c "falloc $((blksz * f)) $blksz" "$testdir/file3" >> "$seqres.full"
-	_pwrite_byte 0x00 $((blksz * f)) $blksz "$testdir/file3.chk" >> "$seqres.full"
-done
-sync
-# 2 blocks are holes
-seq 2 5 $nr | while read f; do
-	_pwrite_byte 0x00 $((blksz * f)) $blksz "$testdir/file3.chk" >> "$seqres.full"
-done
-# 3 blocks are regular
-seq 3 5 $nr | while read f; do
-	_pwrite_byte 0x71 $((blksz * f)) $blksz "$testdir/file3" >> "$seqres.full"
-	_pwrite_byte 0x71 $((blksz * f)) $blksz "$testdir/file3.chk" >> "$seqres.full"
-done
-sync
+_weave_reflink_rainbow $blksz $nr $testdir/file1 $testdir/file3 >> $seqres.full
 _scratch_remount
 
 echo "Compare files"
@@ -101,11 +78,7 @@ md5sum "$testdir/file3" | _filter_scratch
 md5sum "$testdir/file3.chk" | _filter_scratch
 
 echo "directio CoW across the transition"
-# 4 blocks are delalloc (do later)
-seq 4 5 $nr | while read f; do
-	_pwrite_byte 0x62 $((blksz * f)) $blksz "$testdir/file3" >> "$seqres.full"
-	_pwrite_byte 0x62 $((blksz * f)) $blksz "$testdir/file3.chk" >> "$seqres.full"
-done
+_weave_reflink_rainbow_delalloc $blksz $nr $testdir/file3 >> $seqres.full
 # now cow
 "$XFS_IO_PROG" -f -c "pwrite -S 0x63 -b $((blksz * nr / 2)) $((blksz * nr / 4)) $((blksz * nr / 2))" "$testdir/file3" >> "$seqres.full"
 _pwrite_byte 0x63 $((blksz * nr / 4)) $((blksz * nr / 2)) "$testdir/file3.chk" >> "$seqres.full"
diff --git a/tests/generic/200.out b/tests/generic/200.out
index 140eff9..76c01c7 100644
--- a/tests/generic/200.out
+++ b/tests/generic/200.out
@@ -8,5 +8,5 @@ bdbcf02ee0aa977795a79d25fcfdccb1  SCRATCH_MNT/test-200/file1
 directio CoW across the transition
 Compare files
 bdbcf02ee0aa977795a79d25fcfdccb1  SCRATCH_MNT/test-200/file1
-36f6b5317a9a921fc91175390ccf7f69  SCRATCH_MNT/test-200/file3
-36f6b5317a9a921fc91175390ccf7f69  SCRATCH_MNT/test-200/file3.chk
+26aa3a0749b867ec58363c8539ee5471  SCRATCH_MNT/test-200/file3
+26aa3a0749b867ec58363c8539ee5471  SCRATCH_MNT/test-200/file3.chk


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

* [PATCH 09/32] reflink: refactor mixed block creation code
@ 2016-02-11 23:40   ` Darrick J. Wong
  0 siblings, 0 replies; 81+ messages in thread
From: Darrick J. Wong @ 2016-02-11 23:40 UTC (permalink / raw)
  To: david, darrick.wong; +Cc: fstests, linux-btrfs, xfs

Refactor the code that creates files with mixed block types that we feed
into CoW tests to make sure that we can tiptoe around that kind of stuff.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 common/reflink        |  108 +++++++++++++++++++++++++++++++++++++++++++++++++
 tests/generic/188     |    8 ----
 tests/generic/189     |    8 ----
 tests/generic/190     |    8 ----
 tests/generic/191     |    8 ----
 tests/generic/194     |   13 +-----
 tests/generic/195     |   13 +-----
 tests/generic/196     |    8 ----
 tests/generic/197     |    8 ----
 tests/generic/199     |   31 +-------------
 tests/generic/199.out |    4 +-
 tests/generic/200     |   31 +-------------
 tests/generic/200.out |    4 +-
 13 files changed, 126 insertions(+), 126 deletions(-)


diff --git a/common/reflink b/common/reflink
index 3d6a8c1..b92f664 100644
--- a/common/reflink
+++ b/common/reflink
@@ -187,3 +187,111 @@ _dedupe_range() {
 
 	"$XFS_IO_PROG" $xfs_io_args -f -c "dedupe $file1 $offset1 $offset2 $len" "$file2"
 }
+
+# Create a file of interleaved unwritten and reflinked blocks
+_weave_reflink_unwritten() {
+	blksz=$1
+	nr=$2
+	sfile=$3
+	dfile=$4
+
+	_pwrite_byte 0x61 0 $((blksz * nr)) $sfile
+	$XFS_IO_PROG -f -c "falloc 0 $((blksz * nr))" $dfile
+	_pwrite_byte 0x00 0 $((blksz * nr)) $dfile.chk
+	seq 0 2 $((nr - 1)) | while read i; do
+		_reflink_range $sfile $((blksz * i)) $dfile $((blksz * i)) $blksz
+		_pwrite_byte 0x61 $((blksz * i)) $blksz $dfile.chk
+	done
+}
+
+# Create a file of interleaved holes and reflinked blocks
+_weave_reflink_holes() {
+	blksz=$1
+	nr=$2
+	sfile=$3
+	dfile=$4
+
+	_pwrite_byte 0x61 0 $((blksz * nr)) $sfile
+	$XFS_IO_PROG -f -c "truncate $((blksz * nr))" $dfile
+	_pwrite_byte 0x00 0 $((blksz * nr)) $dfile.chk
+	seq 0 2 $((nr - 1)) | while read i; do
+		_reflink_range $sfile $((blksz * i)) $dfile $((blksz * i)) $blksz
+		_pwrite_byte 0x61 $((blksz * i)) $blksz $dfile.chk
+	done
+}
+
+# For a file created with _weave_reflink_holes, fill the holes with delalloc
+# extents
+_weave_reflink_holes_delalloc() {
+	blksz=$1
+	nr=$2
+	dfile=$3
+
+	seq 1 2 $((nr - 1)) | while read i; do
+		_pwrite_byte 0x62 $((blksz * i)) $blksz $dfile
+		_pwrite_byte 0x62 $((blksz * i)) $blksz $dfile.chk
+	done
+}
+
+# Create a file of interleaved regular blocks and reflinked blocks
+_weave_reflink_regular() {
+	blksz=$1
+	nr=$2
+	sfile=$3
+	dfile=$4
+
+	_pwrite_byte 0x61 0 $((blksz * nr)) $sfile
+	_pwrite_byte 0x62 0 $((blksz * nr)) $dfile
+	_pwrite_byte 0x62 0 $((blksz * nr)) $dfile.chk
+	seq 0 2 $((nr - 1)) | while read i; do
+		_reflink_range $sfile $((blksz * i)) $dfile $((blksz * i)) $blksz
+		_pwrite_byte 0x61 $((blksz * i)) $blksz $dfile.chk
+	done
+}
+
+# Create a file of interleaved holes, unwritten blocks, regular blocks, and
+# reflinked blocks
+_weave_reflink_rainbow() {
+	blksz=$1
+	nr=$2
+	sfile=$3
+	dfile=$4
+
+	_pwrite_byte 0x61 0 $((blksz * nr)) $sfile
+	$XFS_IO_PROG -f -c "truncate $((blksz * nr))" $dfile
+	_pwrite_byte 0x00 0 $((blksz * nr)) $dfile.chk
+	# 0 blocks are reflinked
+	seq 0 5 $((nr - 1)) | while read i; do
+		_reflink_range $sfile $((blksz * i)) $dfile $((blksz * i)) $blksz
+		_pwrite_byte 0x61 $((blksz * i)) $blksz $dfile.chk
+	done
+	# 1 blocks are unwritten
+	seq 1 5 $((nr - 1)) | while read i; do
+		$XFS_IO_PROG -f -c "falloc $((blksz * i)) $blksz" $dfile
+		_pwrite_byte 0x00 $((blksz * i)) $blksz $dfile.chk
+	done
+	# 2 blocks are holes
+	seq 2 5 $((nr - 1)) | while read i; do
+		_pwrite_byte 0x00 $((blksz * i)) $blksz $dfile.chk
+	done
+	# 3 blocks are regular
+	seq 3 5 $((nr - 1)) | while read i; do
+		_pwrite_byte 0x71 $((blksz * i)) $blksz $dfile
+		_pwrite_byte 0x71 $((blksz * i)) $blksz $dfile.chk
+	done
+	# 4 blocks will be delalloc later
+}
+
+# For a file created with _weave_reflink_rainbow, fill the holes with delalloc
+# extents
+_weave_reflink_rainbow_delalloc() {
+	blksz=$1
+	nr=$2
+	dfile=$3
+
+	# 4 blocks are delalloc (do later)
+	seq 4 5 $((nr - 1)) | while read i; do
+		_pwrite_byte 0x62 $((blksz * i)) $blksz $dfile
+		_pwrite_byte 0x62 $((blksz * i)) $blksz $dfile.chk
+	done
+}
diff --git a/tests/generic/188 b/tests/generic/188
index 7596c4b..86980cc 100755
--- a/tests/generic/188
+++ b/tests/generic/188
@@ -63,13 +63,7 @@ mkdir $testdir
 echo "Create the original files"
 blksz=65536
 nr=64
-_pwrite_byte 0x61 0 $((blksz * nr)) "$testdir/file1" >> "$seqres.full"
-$XFS_IO_PROG -f -c "falloc 0 $((blksz * nr))" "$testdir/file3" >> "$seqres.full"
-_pwrite_byte 0x00 0 $((blksz * nr)) "$testdir/file3.chk" >> "$seqres.full"
-seq 0 2 $((nr-1)) | while read f; do
-	_reflink_range "$testdir/file1" $((blksz * f)) "$testdir/file3" $((blksz * f)) $blksz >> "$seqres.full"
-	_pwrite_byte 0x61 $((blksz * f)) $blksz "$testdir/file3.chk" >> "$seqres.full"
-done
+_weave_reflink_unwritten $blksz $nr $testdir/file1 $testdir/file3 >> $seqres.full
 _scratch_remount
 
 echo "Compare files"
diff --git a/tests/generic/189 b/tests/generic/189
index 130dc58..8f5a338 100755
--- a/tests/generic/189
+++ b/tests/generic/189
@@ -63,13 +63,7 @@ mkdir $testdir
 echo "Create the original files"
 blksz=65536
 nr=64
-_pwrite_byte 0x61 0 $((blksz * nr)) "$testdir/file1" >> "$seqres.full"
-$XFS_IO_PROG -f -c "falloc 0 $((blksz * nr))" "$testdir/file3" >> "$seqres.full"
-_pwrite_byte 0x00 0 $((blksz * nr)) "$testdir/file3.chk" >> "$seqres.full"
-seq 0 2 $((nr-1)) | while read f; do
-	_reflink_range "$testdir/file1" $((blksz * f)) "$testdir/file3" $((blksz * f)) $blksz >> "$seqres.full"
-	_pwrite_byte 0x61 $((blksz * f)) $blksz "$testdir/file3.chk" >> "$seqres.full"
-done
+_weave_reflink_unwritten $blksz $nr $testdir/file1 $testdir/file3 >> $seqres.full
 _scratch_remount
 
 echo "Compare files"
diff --git a/tests/generic/190 b/tests/generic/190
index 0171475..8edfeb7 100755
--- a/tests/generic/190
+++ b/tests/generic/190
@@ -63,13 +63,7 @@ mkdir $testdir
 echo "Create the original files"
 blksz=65536
 nr=64
-_pwrite_byte 0x61 0 $((blksz * nr)) "$testdir/file1" >> "$seqres.full"
-$XFS_IO_PROG -f -c "truncate $((blksz * nr))" "$testdir/file3" >> "$seqres.full"
-_pwrite_byte 0x00 0 $((blksz * nr)) "$testdir/file3.chk" >> "$seqres.full"
-seq 0 2 $((nr-1)) | while read f; do
-	_reflink_range "$testdir/file1" $((blksz * f)) "$testdir/file3" $((blksz * f)) $blksz >> "$seqres.full"
-	_pwrite_byte 0x61 $((blksz * f)) $blksz "$testdir/file3.chk" >> "$seqres.full"
-done
+_weave_reflink_holes $blksz $nr $testdir/file1 $testdir/file3 >> $seqres.full
 _scratch_remount
 
 echo "Compare files"
diff --git a/tests/generic/191 b/tests/generic/191
index 34d96f9..dd97baa 100755
--- a/tests/generic/191
+++ b/tests/generic/191
@@ -63,13 +63,7 @@ mkdir $testdir
 echo "Create the original files"
 blksz=65536
 nr=64
-_pwrite_byte 0x61 0 $((blksz * nr)) "$testdir/file1" >> "$seqres.full"
-$XFS_IO_PROG -f -c "truncate $((blksz * nr))" "$testdir/file3" >> "$seqres.full"
-_pwrite_byte 0x00 0 $((blksz * nr)) "$testdir/file3.chk" >> "$seqres.full"
-seq 0 2 $((nr-1)) | while read f; do
-	_reflink_range "$testdir/file1" $((blksz * f)) "$testdir/file3" $((blksz * f)) $blksz >> "$seqres.full"
-	_pwrite_byte 0x61 $((blksz * f)) $blksz "$testdir/file3.chk" >> "$seqres.full"
-done
+_weave_reflink_holes $blksz $nr $testdir/file1 $testdir/file3 >> $seqres.full
 _scratch_remount
 
 echo "Compare files"
diff --git a/tests/generic/194 b/tests/generic/194
index e9feaad..82b3100 100755
--- a/tests/generic/194
+++ b/tests/generic/194
@@ -64,13 +64,7 @@ mkdir $testdir
 echo "Create the original files"
 blksz=65536
 nr=64
-_pwrite_byte 0x61 0 $((blksz * nr)) "$testdir/file1" >> "$seqres.full"
-$XFS_IO_PROG -f -c "truncate $((blksz * nr))" "$testdir/file3" >> "$seqres.full"
-_pwrite_byte 0x00 0 $((blksz * nr)) "$testdir/file3.chk" >> "$seqres.full"
-seq 0 2 $((nr-1)) | while read f; do
-	_reflink_range "$testdir/file1" $((blksz * f)) "$testdir/file3" $((blksz * f)) $blksz >> "$seqres.full"
-	_pwrite_byte 0x61 $((blksz * f)) $blksz "$testdir/file3.chk" >> "$seqres.full"
-done
+_weave_reflink_holes $blksz $nr $testdir/file1 $testdir/file3 >> $seqres.full
 _scratch_remount
 
 echo "Compare files"
@@ -79,10 +73,7 @@ md5sum "$testdir/file3" | _filter_scratch
 md5sum "$testdir/file3.chk" | _filter_scratch
 
 echo "directio CoW across the transition"
-seq 1 2 $((nr-1)) | while read f; do
-	_pwrite_byte 0x62 $((blksz * f)) $blksz "$testdir/file3" >> "$seqres.full"
-	_pwrite_byte 0x62 $((blksz * f)) $blksz "$testdir/file3.chk" >> "$seqres.full"
-done
+_weave_reflink_holes_delalloc $blksz $nr $testdir/file3 >> $seqres.full
 "$XFS_IO_PROG" -d -f -c "pwrite -S 0x63 -b $((blksz * nr / 2)) $((blksz * nr / 4)) $((blksz * nr / 2))" "$testdir/file3" >> "$seqres.full"
 _pwrite_byte 0x63 $((blksz * nr / 4)) $((blksz * nr / 2)) "$testdir/file3.chk" >> "$seqres.full"
 _scratch_remount
diff --git a/tests/generic/195 b/tests/generic/195
index 32548ba..ce4c0a9 100755
--- a/tests/generic/195
+++ b/tests/generic/195
@@ -64,13 +64,7 @@ mkdir $testdir
 echo "Create the original files"
 blksz=65536
 nr=64
-_pwrite_byte 0x61 0 $((blksz * nr)) "$testdir/file1" >> "$seqres.full"
-$XFS_IO_PROG -f -c "truncate $((blksz * nr))" "$testdir/file3" >> "$seqres.full"
-_pwrite_byte 0x00 0 $((blksz * nr)) "$testdir/file3.chk" >> "$seqres.full"
-seq 0 2 $((nr-1)) | while read f; do
-	_reflink_range "$testdir/file1" $((blksz * f)) "$testdir/file3" $((blksz * f)) $blksz >> "$seqres.full"
-	_pwrite_byte 0x61 $((blksz * f)) $blksz "$testdir/file3.chk" >> "$seqres.full"
-done
+_weave_reflink_holes $blksz $nr $testdir/file1 $testdir/file3 >> $seqres.full
 _scratch_remount
 
 echo "Compare files"
@@ -79,10 +73,7 @@ md5sum "$testdir/file3" | _filter_scratch
 md5sum "$testdir/file3.chk" | _filter_scratch
 
 echo "CoW across the transition"
-seq 1 2 $((nr-1)) | while read f; do
-	_pwrite_byte 0x62 $((blksz * f)) $blksz "$testdir/file3" >> "$seqres.full"
-	_pwrite_byte 0x62 $((blksz * f)) $blksz "$testdir/file3.chk" >> "$seqres.full"
-done
+_weave_reflink_holes_delalloc $blksz $nr $testdir/file3 >> $seqres.full
 "$XFS_IO_PROG" -f -c "pwrite -S 0x63 -b $((blksz * nr / 2)) $((blksz * nr / 4)) $((blksz * nr / 2))" "$testdir/file3" >> "$seqres.full"
 _pwrite_byte 0x63 $((blksz * nr / 4)) $((blksz * nr / 2)) "$testdir/file3.chk" >> "$seqres.full"
 _scratch_remount
diff --git a/tests/generic/196 b/tests/generic/196
index 4ec2cff..a7a0035 100755
--- a/tests/generic/196
+++ b/tests/generic/196
@@ -63,13 +63,7 @@ mkdir $testdir
 echo "Create the original files"
 blksz=65536
 nr=64
-_pwrite_byte 0x61 0 $((blksz * nr)) "$testdir/file1" >> "$seqres.full"
-_pwrite_byte 0x62 0 $((blksz * nr)) "$testdir/file3" >> "$seqres.full"
-_pwrite_byte 0x62 0 $((blksz * nr)) "$testdir/file3.chk" >> "$seqres.full"
-seq 0 2 $((nr-1)) | while read f; do
-	_reflink_range "$testdir/file1" $((blksz * f)) "$testdir/file3" $((blksz * f)) $blksz >> "$seqres.full"
-	_pwrite_byte 0x61 $((blksz * f)) $blksz "$testdir/file3.chk" >> "$seqres.full"
-done
+_weave_reflink_regular $blksz $nr $testdir/file1 $testdir/file3 >> $seqres.full
 _scratch_remount
 
 echo "Compare files"
diff --git a/tests/generic/197 b/tests/generic/197
index 356a587..84a14ff 100755
--- a/tests/generic/197
+++ b/tests/generic/197
@@ -63,13 +63,7 @@ mkdir $testdir
 echo "Create the original files"
 blksz=65536
 nr=64
-_pwrite_byte 0x61 0 $((blksz * nr)) "$testdir/file1" >> "$seqres.full"
-_pwrite_byte 0x62 0 $((blksz * nr)) "$testdir/file3" >> "$seqres.full"
-_pwrite_byte 0x62 0 $((blksz * nr)) "$testdir/file3.chk" >> "$seqres.full"
-seq 0 2 $((nr-1)) | while read f; do
-	_reflink_range "$testdir/file1" $((blksz * f)) "$testdir/file3" $((blksz * f)) $blksz >> "$seqres.full"
-	_pwrite_byte 0x61 $((blksz * f)) $blksz "$testdir/file3.chk" >> "$seqres.full"
-done
+_weave_reflink_regular $blksz $nr $testdir/file1 $testdir/file3 >> $seqres.full
 _scratch_remount
 
 echo "Compare files"
diff --git a/tests/generic/199 b/tests/generic/199
index 03b8fda..6a65533 100755
--- a/tests/generic/199
+++ b/tests/generic/199
@@ -69,30 +69,7 @@ mkdir $testdir
 echo "Create the original files"
 blksz=65536
 nr=64
-_pwrite_byte 0x61 0 $((blksz * nr)) "$testdir/file1" >> "$seqres.full"
-$XFS_IO_PROG -f -c "truncate $((blksz * nr))" "$testdir/file3" >> "$seqres.full"
-# 0 blocks are reflinked
-seq 0 5 $nr | while read f; do
-	_reflink_range "$testdir/file1" $((blksz * f)) "$testdir/file3" $((blksz * f)) $blksz >> "$seqres.full"
-	_pwrite_byte 0x61 $((blksz * f)) $blksz "$testdir/file3.chk" >> "$seqres.full"
-done
-sync
-# 1 blocks are unwritten
-seq 1 5 $nr | while read f; do
-	$XFS_IO_PROG -f -c "falloc $((blksz * f)) $blksz" "$testdir/file3" >> "$seqres.full"
-	_pwrite_byte 0x00 $((blksz * f)) $blksz "$testdir/file3.chk" >> "$seqres.full"
-done
-sync
-# 2 blocks are holes
-seq 2 5 $nr | while read f; do
-	_pwrite_byte 0x00 $((blksz * f)) $blksz "$testdir/file3.chk" >> "$seqres.full"
-done
-# 3 blocks are regular
-seq 3 5 $nr | while read f; do
-	_pwrite_byte 0x71 $((blksz * f)) $blksz "$testdir/file3" >> "$seqres.full"
-	_pwrite_byte 0x71 $((blksz * f)) $blksz "$testdir/file3.chk" >> "$seqres.full"
-done
-sync
+_weave_reflink_rainbow $blksz $nr $testdir/file1 $testdir/file3 >> $seqres.full
 _scratch_remount
 
 echo "Compare files"
@@ -101,11 +78,7 @@ md5sum "$testdir/file3" | _filter_scratch
 md5sum "$testdir/file3.chk" | _filter_scratch
 
 echo "directio CoW across the transition"
-# 4 blocks are delalloc (do later)
-seq 4 5 $nr | while read f; do
-	_pwrite_byte 0x62 $((blksz * f)) $blksz "$testdir/file3" >> "$seqres.full"
-	_pwrite_byte 0x62 $((blksz * f)) $blksz "$testdir/file3.chk" >> "$seqres.full"
-done
+_weave_reflink_rainbow_delalloc $blksz $nr $testdir/file3 >> $seqres.full
 # now cow
 "$XFS_IO_PROG" -d -f -c "pwrite -S 0x63 -b $((blksz * nr / 2)) $((blksz * nr / 4)) $((blksz * nr / 2))" "$testdir/file3" >> "$seqres.full"
 _pwrite_byte 0x63 $((blksz * nr / 4)) $((blksz * nr / 2)) "$testdir/file3.chk" >> "$seqres.full"
diff --git a/tests/generic/199.out b/tests/generic/199.out
index b35c135..a1016ac 100644
--- a/tests/generic/199.out
+++ b/tests/generic/199.out
@@ -8,5 +8,5 @@ bdbcf02ee0aa977795a79d25fcfdccb1  SCRATCH_MNT/test-199/file1
 directio CoW across the transition
 Compare files
 bdbcf02ee0aa977795a79d25fcfdccb1  SCRATCH_MNT/test-199/file1
-36f6b5317a9a921fc91175390ccf7f69  SCRATCH_MNT/test-199/file3
-36f6b5317a9a921fc91175390ccf7f69  SCRATCH_MNT/test-199/file3.chk
+26aa3a0749b867ec58363c8539ee5471  SCRATCH_MNT/test-199/file3
+26aa3a0749b867ec58363c8539ee5471  SCRATCH_MNT/test-199/file3.chk
diff --git a/tests/generic/200 b/tests/generic/200
index e71eedc..541d16d 100755
--- a/tests/generic/200
+++ b/tests/generic/200
@@ -69,30 +69,7 @@ mkdir $testdir
 echo "Create the original files"
 blksz=65536
 nr=64
-_pwrite_byte 0x61 0 $((blksz * nr)) "$testdir/file1" >> "$seqres.full"
-$XFS_IO_PROG -f -c "truncate $((blksz * nr))" "$testdir/file3" >> "$seqres.full"
-# 0 blocks are reflinked
-seq 0 5 $nr | while read f; do
-	_reflink_range "$testdir/file1" $((blksz * f)) "$testdir/file3" $((blksz * f)) $blksz >> "$seqres.full"
-	_pwrite_byte 0x61 $((blksz * f)) $blksz "$testdir/file3.chk" >> "$seqres.full"
-done
-sync
-# 1 blocks are unwritten
-seq 1 5 $nr | while read f; do
-	$XFS_IO_PROG -f -c "falloc $((blksz * f)) $blksz" "$testdir/file3" >> "$seqres.full"
-	_pwrite_byte 0x00 $((blksz * f)) $blksz "$testdir/file3.chk" >> "$seqres.full"
-done
-sync
-# 2 blocks are holes
-seq 2 5 $nr | while read f; do
-	_pwrite_byte 0x00 $((blksz * f)) $blksz "$testdir/file3.chk" >> "$seqres.full"
-done
-# 3 blocks are regular
-seq 3 5 $nr | while read f; do
-	_pwrite_byte 0x71 $((blksz * f)) $blksz "$testdir/file3" >> "$seqres.full"
-	_pwrite_byte 0x71 $((blksz * f)) $blksz "$testdir/file3.chk" >> "$seqres.full"
-done
-sync
+_weave_reflink_rainbow $blksz $nr $testdir/file1 $testdir/file3 >> $seqres.full
 _scratch_remount
 
 echo "Compare files"
@@ -101,11 +78,7 @@ md5sum "$testdir/file3" | _filter_scratch
 md5sum "$testdir/file3.chk" | _filter_scratch
 
 echo "directio CoW across the transition"
-# 4 blocks are delalloc (do later)
-seq 4 5 $nr | while read f; do
-	_pwrite_byte 0x62 $((blksz * f)) $blksz "$testdir/file3" >> "$seqres.full"
-	_pwrite_byte 0x62 $((blksz * f)) $blksz "$testdir/file3.chk" >> "$seqres.full"
-done
+_weave_reflink_rainbow_delalloc $blksz $nr $testdir/file3 >> $seqres.full
 # now cow
 "$XFS_IO_PROG" -f -c "pwrite -S 0x63 -b $((blksz * nr / 2)) $((blksz * nr / 4)) $((blksz * nr / 2))" "$testdir/file3" >> "$seqres.full"
 _pwrite_byte 0x63 $((blksz * nr / 4)) $((blksz * nr / 2)) "$testdir/file3.chk" >> "$seqres.full"
diff --git a/tests/generic/200.out b/tests/generic/200.out
index 140eff9..76c01c7 100644
--- a/tests/generic/200.out
+++ b/tests/generic/200.out
@@ -8,5 +8,5 @@ bdbcf02ee0aa977795a79d25fcfdccb1  SCRATCH_MNT/test-200/file1
 directio CoW across the transition
 Compare files
 bdbcf02ee0aa977795a79d25fcfdccb1  SCRATCH_MNT/test-200/file1
-36f6b5317a9a921fc91175390ccf7f69  SCRATCH_MNT/test-200/file3
-36f6b5317a9a921fc91175390ccf7f69  SCRATCH_MNT/test-200/file3.chk
+26aa3a0749b867ec58363c8539ee5471  SCRATCH_MNT/test-200/file3
+26aa3a0749b867ec58363c8539ee5471  SCRATCH_MNT/test-200/file3.chk

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

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

* [PATCH 10/32] reflink: fix style problems in existing tests
  2016-02-11 23:39 ` Darrick J. Wong
                   ` (9 preceding siblings ...)
  (?)
@ 2016-02-11 23:40 ` Darrick J. Wong
  -1 siblings, 0 replies; 81+ messages in thread
From: Darrick J. Wong @ 2016-02-11 23:40 UTC (permalink / raw)
  To: david, darrick.wong; +Cc: fstests, linux-btrfs, xfs

Fix style problems such as unnecessary use of quotes, add helper
variables to reduce visual clutter, and other minor fixes to make the
first batch of tests more closely resemble the second round tests.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 tests/generic/110 |    2 -
 tests/generic/111 |    2 -
 tests/generic/115 |    2 -
 tests/generic/116 |   44 ++++++++--------
 tests/generic/118 |   42 +++++++--------
 tests/generic/119 |  102 ++++++++++++++++++------------------
 tests/generic/121 |   44 ++++++++--------
 tests/generic/122 |   44 ++++++++--------
 tests/generic/134 |   78 ++++++++++++++--------------
 tests/generic/136 |   78 ++++++++++++++--------------
 tests/generic/137 |   44 ++++++++--------
 tests/generic/138 |  104 ++++++++++++++++++-------------------
 tests/generic/139 |   98 +++++++++++++++++------------------
 tests/generic/140 |  104 ++++++++++++++++++-------------------
 tests/generic/142 |   37 +++++++------
 tests/generic/143 |   37 +++++++------
 tests/generic/144 |  124 ++++++++++++++++++++++----------------------
 tests/generic/145 |  150 +++++++++++++++++++++++++++--------------------------
 tests/generic/146 |  132 +++++++++++++++++++++++------------------------
 tests/generic/147 |  146 ++++++++++++++++++++++++++--------------------------
 tests/generic/148 |   84 +++++++++++++++---------------
 tests/generic/149 |  132 +++++++++++++++++++++++------------------------
 tests/generic/150 |   23 ++++----
 tests/generic/151 |   35 ++++++------
 tests/generic/152 |   39 +++++++-------
 tests/generic/153 |   41 +++++++-------
 tests/generic/154 |   43 ++++++++-------
 tests/generic/155 |   39 +++++++-------
 tests/generic/156 |   43 ++++++++-------
 tests/generic/157 |   60 +++++++++++----------
 tests/generic/158 |   62 +++++++++++-----------
 tests/generic/159 |   19 ++++---
 tests/generic/160 |   19 ++++---
 tests/generic/161 |   25 ++++-----
 tests/generic/162 |   31 +++++------
 tests/generic/163 |   31 +++++------
 tests/generic/164 |   35 ++++++------
 tests/generic/165 |   33 ++++++------
 tests/generic/166 |   25 ++++-----
 tests/generic/167 |   25 ++++-----
 tests/generic/168 |   31 +++++------
 tests/generic/170 |   31 +++++------
 tests/generic/171 |   55 ++++++++++---------
 tests/generic/172 |   55 ++++++++++---------
 tests/generic/173 |   47 ++++++++---------
 tests/generic/174 |   55 ++++++++++---------
 tests/generic/178 |   31 ++++++-----
 tests/generic/179 |   50 +++++++++---------
 tests/generic/180 |   50 +++++++++---------
 tests/generic/181 |   38 +++++++------
 tests/generic/182 |   80 ++++++++++++++--------------
 tests/generic/183 |   50 +++++++++---------
 tests/generic/185 |   50 +++++++++---------
 tests/generic/186 |   69 +++++++++++++-----------
 tests/generic/187 |   69 +++++++++++++-----------
 tests/generic/188 |   34 ++++++------
 tests/generic/189 |   34 ++++++------
 tests/generic/190 |   34 ++++++------
 tests/generic/191 |   34 ++++++------
 tests/generic/194 |   34 ++++++------
 tests/generic/195 |   34 ++++++------
 tests/generic/196 |   34 ++++++------
 tests/generic/197 |   34 ++++++------
 tests/generic/199 |   34 ++++++------
 tests/generic/200 |   34 ++++++------
 tests/generic/201 |   38 +++++++------
 tests/generic/202 |   37 ++++++-------
 tests/generic/203 |   37 ++++++-------
 tests/generic/205 |   47 ++++++++---------
 tests/generic/206 |   47 ++++++++---------
 tests/generic/216 |   47 ++++++++---------
 tests/generic/217 |   47 ++++++++---------
 tests/generic/218 |   39 +++++++-------
 tests/generic/220 |   39 +++++++-------
 tests/generic/222 |   47 ++++++++---------
 tests/generic/227 |   47 ++++++++---------
 tests/generic/229 |   73 +++++++++++++-------------
 tests/generic/238 |   73 +++++++++++++-------------
 tests/generic/242 |   47 ++++++++---------
 tests/generic/243 |   47 ++++++++---------
 tests/xfs/127     |   29 +++++-----
 tests/xfs/128     |   93 ++++++++++++++++-----------------
 tests/xfs/129     |   33 ++++++------
 tests/xfs/131     |   21 ++++---
 tests/xfs/132     |   43 ++++++++-------
 tests/xfs/139     |   31 +++++------
 tests/xfs/140     |   37 ++++++-------
 87 files changed, 2187 insertions(+), 2171 deletions(-)


diff --git a/tests/generic/110 b/tests/generic/110
index a43f02d..1fcdb56 100755
--- a/tests/generic/110
+++ b/tests/generic/110
@@ -37,7 +37,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _cleanup()
 {
     cd /
-    rm -f $tmp.* "$testdir"
+    rm -f $tmp.* $testdir
 }
 
 # get standard environment, filters and checks
diff --git a/tests/generic/111 b/tests/generic/111
index ef9c424..dce9c84 100755
--- a/tests/generic/111
+++ b/tests/generic/111
@@ -37,7 +37,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _cleanup()
 {
     cd /
-    rm -f $tmp.* "$testdir"
+    rm -f $tmp.* $testdir
 }
 
 # get standard environment, filters and checks
diff --git a/tests/generic/115 b/tests/generic/115
index 578d5bd..43ce59c 100755
--- a/tests/generic/115
+++ b/tests/generic/115
@@ -35,7 +35,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _cleanup()
 {
     cd /
-    rm -f $tmp.* "$testdir"
+    rm -f $tmp.* $testdir
 }
 
 # get standard environment, filters and checks
diff --git a/tests/generic/116 b/tests/generic/116
index 5c361e2..18f8073 100755
--- a/tests/generic/116
+++ b/tests/generic/116
@@ -22,8 +22,8 @@
 # Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 #-----------------------------------------------------------------------
 
-seq=`basename "$0"`
-seqres="$RESULT_DIR/$seq"
+seq=`basename $0`
+seqres=$RESULT_DIR/$seq
 echo "QA output created by $seq"
 
 here=`pwd`
@@ -34,7 +34,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _cleanup()
 {
     cd /
-    rm -rf "$tmp".* "$testdir"
+    rm -rf $tmp.* $testdir
 }
 
 # get standard environment, filters and checks
@@ -46,44 +46,44 @@ _cleanup()
 _supported_os Linux
 _require_test_reflink
 
-rm -f "$seqres.full"
+rm -f $seqres.full
 
-testdir="$TEST_DIR/test-$seq"
-rm -rf "$testdir"
-mkdir "$testdir"
+testdir=$TEST_DIR/test-$seq
+rm -rf $testdir
+mkdir $testdir
 
 echo "Create the original files"
 blksz=65536
-_pwrite_byte 0x61 $((blksz * 2)) $((blksz * 6)) "$testdir/file1" >> "$seqres.full"
-_pwrite_byte 0x61 $((blksz * 2)) $((blksz * 6)) "$testdir/file2" >> "$seqres.full"
+_pwrite_byte 0x61 $((blksz * 2)) $((blksz * 6)) $testdir/file1 >> $seqres.full
+_pwrite_byte 0x61 $((blksz * 2)) $((blksz * 6)) $testdir/file2 >> $seqres.full
 _test_remount
 
-md5sum "$testdir/file1" | _filter_test_dir
-md5sum "$testdir/file2" | _filter_test_dir
+md5sum $testdir/file1 | _filter_test_dir
+md5sum $testdir/file2 | _filter_test_dir
 
-_compare_range "$testdir/file1" 0 "$testdir/file2" 0 $((blksz * 8)) \
+_compare_range $testdir/file1 0 $testdir/file2 0 $((blksz * 8)) \
        || echo "Files do not match"
 
 echo "Reflink the middle blocks together"
-free_before="$(stat -f -c '%a' "$testdir")"
-_reflink_range "$testdir/file1" $((blksz * 4)) "$testdir/file2" \
-		$((blksz * 4)) $((blksz * 2)) >> "$seqres.full"
+free_before=$(stat -f -c '%a' $testdir)
+_reflink_range $testdir/file1 $((blksz * 4)) $testdir/file2 \
+		$((blksz * 4)) $((blksz * 2)) >> $seqres.full
 _test_remount
-free_after="$(stat -f -c '%a' "$testdir")"
-echo "freesp changed by $free_before -> $free_after" >> "$seqres.full"
+free_after=$(stat -f -c '%a' $testdir)
+echo "freesp changed by $free_before -> $free_after" >> $seqres.full
 
 echo "Compare sections"
-md5sum "$testdir/file1" | _filter_test_dir
-md5sum "$testdir/file2" | _filter_test_dir
+md5sum $testdir/file1 | _filter_test_dir
+md5sum $testdir/file2 | _filter_test_dir
 
-_compare_range "$testdir/file1" 0 "$testdir/file2" 0 $((blksz * 4)) \
+_compare_range $testdir/file1 0 $testdir/file2 0 $((blksz * 4)) \
        || echo "Start sections do not match"
 
-_compare_range "$testdir/file1" $((blksz * 4)) "$testdir/file2" \
+_compare_range $testdir/file1 $((blksz * 4)) $testdir/file2 \
 		$((blksz * 4)) $((blksz * 2)) \
        || echo "Middle sections do not match"
 
-_compare_range "$testdir/file1" $((blksz * 6)) "$testdir/file2" \
+_compare_range $testdir/file1 $((blksz * 6)) $testdir/file2 \
 		$((blksz * 6)) $((blksz * 2)) \
        || echo "End sections do not match"
 
diff --git a/tests/generic/118 b/tests/generic/118
index 41e525c..6b6478b 100755
--- a/tests/generic/118
+++ b/tests/generic/118
@@ -23,7 +23,7 @@
 # Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 #-----------------------------------------------------------------------
 
-seq=`basename "$0"`
+seq=`basename $0`
 seqres=$RESULT_DIR/$seq
 echo "QA output created by $seq"
 
@@ -35,7 +35,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _cleanup()
 {
     cd /
-    rm -rf "$tmp".* "$testdir"
+    rm -rf $tmp.* $testdir
 }
 
 # get standard environment, filters and checks
@@ -47,44 +47,44 @@ _cleanup()
 _supported_os Linux
 _require_test_reflink
 
-rm -f "$seqres.full"
+rm -f $seqres.full
 
-testdir="$TEST_DIR/test-$seq"
-rm -rf "$testdir"
-mkdir "$testdir"
+testdir=$TEST_DIR/test-$seq
+rm -rf $testdir
+mkdir $testdir
 
 echo "Create the original files"
 blksz=65536
-_pwrite_byte 0x61 $((blksz * 2)) $((blksz * 6)) "$testdir/file1" >> "$seqres.full"
-_pwrite_byte 0x62 $((blksz * 2)) $((blksz * 6)) "$testdir/file2" >> "$seqres.full"
+_pwrite_byte 0x61 $((blksz * 2)) $((blksz * 6)) $testdir/file1 >> $seqres.full
+_pwrite_byte 0x62 $((blksz * 2)) $((blksz * 6)) $testdir/file2 >> $seqres.full
 _test_remount
 
-md5sum "$testdir/file1" | _filter_test_dir
-md5sum "$testdir/file2" | _filter_test_dir
+md5sum $testdir/file1 | _filter_test_dir
+md5sum $testdir/file2 | _filter_test_dir
 
-_compare_range "$testdir/file1" 0 "$testdir/file2" 0 $((blksz * 8)) \
+_compare_range $testdir/file1 0 $testdir/file2 0 $((blksz * 8)) \
        || echo "Files do not match (intentional)"
 
 echo "Reflink the middle blocks together"
-free_before="$(stat -f -c '%a' "$testdir")"
-_reflink_range "$testdir/file1" $((blksz * 4)) "$testdir/file2" \
-		$((blksz * 4)) $((blksz * 2)) >> "$seqres.full"
+free_before=$(stat -f -c '%a' $testdir)
+_reflink_range $testdir/file1 $((blksz * 4)) $testdir/file2 \
+		$((blksz * 4)) $((blksz * 2)) >> $seqres.full
 _test_remount
-free_after="$(stat -f -c '%a' "$testdir")"
-echo "freesp changed by $free_before -> $free_after" >> "$seqres.full"
+free_after=$(stat -f -c '%a' $testdir)
+echo "freesp changed by $free_before -> $free_after" >> $seqres.full
 
 echo "Compare sections"
-md5sum "$testdir/file1" | _filter_test_dir
-md5sum "$testdir/file2" | _filter_test_dir
+md5sum $testdir/file1 | _filter_test_dir
+md5sum $testdir/file2 | _filter_test_dir
 
-_compare_range "$testdir/file1" 0 "$testdir/file2" 0 $((blksz * 4)) \
+_compare_range $testdir/file1 0 $testdir/file2 0 $((blksz * 4)) \
        || echo "Start sections do not match (intentional)"
 
-_compare_range "$testdir/file1" $((blksz * 4)) "$testdir/file2" \
+_compare_range $testdir/file1 $((blksz * 4)) $testdir/file2 \
 		$((blksz * 4)) $((blksz * 2)) \
        || echo "Middle sections do not match"
 
-_compare_range "$testdir/file1" $((blksz * 6)) "$testdir/file2" \
+_compare_range $testdir/file1 $((blksz * 6)) $testdir/file2 \
 		$((blksz * 6)) $((blksz * 2)) \
        || echo "End sections do not match (intentional)"
 
diff --git a/tests/generic/119 b/tests/generic/119
index 27e7604..1a7d26e 100755
--- a/tests/generic/119
+++ b/tests/generic/119
@@ -24,8 +24,8 @@
 # Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 #-----------------------------------------------------------------------
 
-seq=`basename "$0"`
-seqres="$RESULT_DIR/$seq"
+seq=`basename $0`
+seqres=$RESULT_DIR/$seq
 echo "QA output created by $seq"
 
 here=`pwd`
@@ -36,7 +36,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _cleanup()
 {
     cd /
-    rm -rf "$tmp".* "$testdir"
+    rm -rf $tmp.* $testdir
 }
 
 # get standard environment, filters and checks
@@ -48,7 +48,7 @@ _cleanup()
 _supported_os Linux
 _require_test_reflink
 
-rm -f "$seqres.full"
+rm -f $seqres.full
 
 testdir=$TEST_DIR/test-$seq
 rm -rf $testdir
@@ -56,112 +56,112 @@ mkdir $testdir
 
 echo "Create the original files"
 blksz=65536
-_pwrite_byte 0x61 0 $((blksz * 8)) "$testdir/file1" >> "$seqres.full"
-_pwrite_byte 0x62 0 $((blksz * 8)) "$testdir/file2" >> "$seqres.full"
-_pwrite_byte 0x63 0 $((blksz * 8)) "$testdir/file3" >> "$seqres.full"
-_pwrite_byte 0x64 0 $((blksz * 8)) "$testdir/file4" >> "$seqres.full"
+_pwrite_byte 0x61 0 $((blksz * 8)) $testdir/file1 >> $seqres.full
+_pwrite_byte 0x62 0 $((blksz * 8)) $testdir/file2 >> $seqres.full
+_pwrite_byte 0x63 0 $((blksz * 8)) $testdir/file3 >> $seqres.full
+_pwrite_byte 0x64 0 $((blksz * 8)) $testdir/file4 >> $seqres.full
 _test_remount
 
-md5sum "$testdir/file1" | _filter_test_dir
-md5sum "$testdir/file2" | _filter_test_dir
-md5sum "$testdir/file3" | _filter_test_dir
-md5sum "$testdir/file4" | _filter_test_dir
+md5sum $testdir/file1 | _filter_test_dir
+md5sum $testdir/file2 | _filter_test_dir
+md5sum $testdir/file3 | _filter_test_dir
+md5sum $testdir/file4 | _filter_test_dir
 
-_compare_range "$testdir/file1" 0 "$testdir/file2" 0 $((blksz * 8)) \
+_compare_range $testdir/file1 0 $testdir/file2 0 $((blksz * 8)) \
        || echo "Files 1-2 do not match (intentional)"
 
-_compare_range "$testdir/file1" 0 "$testdir/file3" 0 $((blksz * 8)) \
+_compare_range $testdir/file1 0 $testdir/file3 0 $((blksz * 8)) \
        || echo "Files 1-3 do not match (intentional)"
 
-_compare_range "$testdir/file1" 0 "$testdir/file4" 0 $((blksz * 8)) \
+_compare_range $testdir/file1 0 $testdir/file4 0 $((blksz * 8)) \
        || echo "Files 1-4 do not match (intentional)"
 
 echo "Reflink the first four blocks together, 1-2 3-4"
-free_before="$(stat -f -c '%a' "$testdir")"
-_reflink_range "$testdir/file1" 0 "$testdir/file2" 0 $((blksz * 4)) >> "$seqres.full"
-_reflink_range "$testdir/file3" 0 "$testdir/file4" 0 $((blksz * 4)) >> "$seqres.full"
+free_before=$(stat -f -c '%a' $testdir)
+_reflink_range $testdir/file1 0 $testdir/file2 0 $((blksz * 4)) >> $seqres.full
+_reflink_range $testdir/file3 0 $testdir/file4 0 $((blksz * 4)) >> $seqres.full
 _test_remount
-free_after="$(stat -f -c '%a' "$testdir")"
-echo "freesp changed by $free_before -> $free_after" >> "$seqres.full"
+free_after=$(stat -f -c '%a' $testdir)
+echo "freesp changed by $free_before -> $free_after" >> $seqres.full
 
 echo "Compare sections"
-md5sum "$testdir/file1" | _filter_test_dir
-md5sum "$testdir/file2" | _filter_test_dir
-md5sum "$testdir/file3" | _filter_test_dir
-md5sum "$testdir/file4" | _filter_test_dir
+md5sum $testdir/file1 | _filter_test_dir
+md5sum $testdir/file2 | _filter_test_dir
+md5sum $testdir/file3 | _filter_test_dir
+md5sum $testdir/file4 | _filter_test_dir
 
-_compare_range "$testdir/file1" 0 "$testdir/file2" 0 $((blksz * 4)) \
+_compare_range $testdir/file1 0 $testdir/file2 0 $((blksz * 4)) \
        || echo "Sections of file 1-2 do not match"
 
-_compare_range "$testdir/file1" 0 "$testdir/file3" 0 $((blksz * 4)) \
+_compare_range $testdir/file1 0 $testdir/file3 0 $((blksz * 4)) \
        || echo "Sections of file 1-3 do not match (intentional)"
 
-_compare_range "$testdir/file1" 0 "$testdir/file4" 0 $((blksz * 4)) \
+_compare_range $testdir/file1 0 $testdir/file4 0 $((blksz * 4)) \
        || echo "Sections of file 1-4 do not match (intentional)"
 
-_compare_range "$testdir/file2" 0 "$testdir/file3" 0 $((blksz * 4)) \
+_compare_range $testdir/file2 0 $testdir/file3 0 $((blksz * 4)) \
        || echo "Sections of file 2-3 do not match (intentional)"
 
-_compare_range "$testdir/file2" 0 "$testdir/file4" 0 $((blksz * 4)) \
+_compare_range $testdir/file2 0 $testdir/file4 0 $((blksz * 4)) \
        || echo "Sections of file 2-4 do not match (intentional)"
 
-_compare_range "$testdir/file3" 0 "$testdir/file4" 0 $((blksz * 4)) \
+_compare_range $testdir/file3 0 $testdir/file4 0 $((blksz * 4)) \
        || echo "Sections of file 3-4 do not match"
 
 echo "Reflink the first two blocks together, 1-3 1-4"
-free_before="$(stat -f -c '%a' $testdir)"
-_reflink_range "$testdir/file1" 0 "$testdir/file3" 0 $((blksz * 2)) >> "$seqres.full"
-_reflink_range "$testdir/file1" 0 "$testdir/file4" 0 $((blksz * 2)) >> "$seqres.full"
+free_before=$(stat -f -c '%a' $testdir)
+_reflink_range $testdir/file1 0 $testdir/file3 0 $((blksz * 2)) >> $seqres.full
+_reflink_range $testdir/file1 0 $testdir/file4 0 $((blksz * 2)) >> $seqres.full
 _test_remount
-free_after="$(stat -f -c '%a' $testdir)"
-echo "freesp changed by $free_before -> $free_after" >> "$seqres.full"
+free_after=$(stat -f -c '%a' $testdir)
+echo "freesp changed by $free_before -> $free_after" >> $seqres.full
 
 echo "Compare sections"
-md5sum "$testdir/file1" | _filter_test_dir
-md5sum "$testdir/file2" | _filter_test_dir
-md5sum "$testdir/file3" | _filter_test_dir
-md5sum "$testdir/file4" | _filter_test_dir
+md5sum $testdir/file1 | _filter_test_dir
+md5sum $testdir/file2 | _filter_test_dir
+md5sum $testdir/file3 | _filter_test_dir
+md5sum $testdir/file4 | _filter_test_dir
 
-_compare_range "$testdir/file1" 0 "$testdir/file2" 0 $((blksz * 2)) \
+_compare_range $testdir/file1 0 $testdir/file2 0 $((blksz * 2)) \
        || echo "Sections of files 1-2 do not match"
 
-_compare_range "$testdir/file1" 0 "$testdir/file3" 0 $((blksz * 2)) \
+_compare_range $testdir/file1 0 $testdir/file3 0 $((blksz * 2)) \
        || echo "Sections of files 1-3 do not match"
 
-_compare_range "$testdir/file1" 0 "$testdir/file4" 0 $((blksz * 2)) \
+_compare_range $testdir/file1 0 $testdir/file4 0 $((blksz * 2)) \
        || echo "Sections of files 1-4 do not match"
 
-_compare_range "$testdir/file2" 0 "$testdir/file3" 0 $((blksz * 2)) \
+_compare_range $testdir/file2 0 $testdir/file3 0 $((blksz * 2)) \
        || echo "Sections of files 2-3 do not match"
 
-_compare_range "$testdir/file2" 0 "$testdir/file4" 0 $((blksz * 2)) \
+_compare_range $testdir/file2 0 $testdir/file4 0 $((blksz * 2)) \
        || echo "Sections of files 2-4 do not match"
 
-_compare_range "$testdir/file3" 0 "$testdir/file4" 0 $((blksz * 2)) \
+_compare_range $testdir/file3 0 $testdir/file4 0 $((blksz * 2)) \
        || echo "Sections of files 3-4 do not match"
 
 echo "Compare previously reflinked sections"
-_compare_range "$testdir/file1" $((blksz * 2)) "$testdir/file2" \
+_compare_range $testdir/file1 $((blksz * 2)) $testdir/file2 \
 		$((blksz * 2)) $((blksz * 2)) \
        || echo "Sections of file 1-2 do not match"
 
-_compare_range "$testdir/file1" $((blksz * 2)) "$testdir/file3" \
+_compare_range $testdir/file1 $((blksz * 2)) $testdir/file3 \
 		$((blksz * 2)) $((blksz * 2)) \
        || echo "Sections of file 1-3 do not match (intentional)"
 
-_compare_range "$testdir/file1" $((blksz * 2)) "$testdir/file4" \
+_compare_range $testdir/file1 $((blksz * 2)) $testdir/file4 \
 		$((blksz * 2)) $((blksz * 2)) \
        || echo "Sections of file 1-4 do not match (intentional)"
 
-_compare_range "$testdir/file2" $((blksz * 2)) "$testdir/file3" \
+_compare_range $testdir/file2 $((blksz * 2)) $testdir/file3 \
 		$((blksz * 2)) $((blksz * 2)) \
        || echo "Sections of file 2-3 do not match (intentional)"
 
-_compare_range "$testdir/file2" $((blksz * 2)) "$testdir/file4" \
+_compare_range $testdir/file2 $((blksz * 2)) $testdir/file4 \
 		$((blksz * 2)) $((blksz * 2)) \
        || echo "Sections of file 2-4 do not match (intentional)"
 
-_compare_range "$testdir/file3" $((blksz * 2)) "$testdir/file4" \
+_compare_range $testdir/file3 $((blksz * 2)) $testdir/file4 \
 		$((blksz * 2)) $((blksz * 2)) \
        || echo "Sections of file 3-4 do not match"
 
diff --git a/tests/generic/121 b/tests/generic/121
index 0e15e8d..7d6f982 100755
--- a/tests/generic/121
+++ b/tests/generic/121
@@ -22,8 +22,8 @@
 # Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 #-----------------------------------------------------------------------
 
-seq=`basename "$0"`
-seqres="$RESULT_DIR/$seq"
+seq=`basename $0`
+seqres=$RESULT_DIR/$seq
 echo "QA output created by $seq"
 
 here=`pwd`
@@ -34,7 +34,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _cleanup()
 {
     cd /
-    rm -rf "$tmp".* "$testdir"
+    rm -rf $tmp.* $testdir
 }
 
 # get standard environment, filters and checks
@@ -46,44 +46,44 @@ _cleanup()
 _supported_os Linux
 _require_test_dedupe
 
-rm -f "$seqres.full"
+rm -f $seqres.full
 
-testdir="$TEST_DIR/test-$seq"
-rm -rf "$testdir"
-mkdir "$testdir"
+testdir=$TEST_DIR/test-$seq
+rm -rf $testdir
+mkdir $testdir
 
 echo "Create the original files"
 blksz=65536
-_pwrite_byte 0x61 $((blksz * 2)) $((blksz * 6)) "$testdir/file1" >> "$seqres.full"
-_pwrite_byte 0x61 $((blksz * 2)) $((blksz * 6)) "$testdir/file2" >> "$seqres.full"
+_pwrite_byte 0x61 $((blksz * 2)) $((blksz * 6)) $testdir/file1 >> $seqres.full
+_pwrite_byte 0x61 $((blksz * 2)) $((blksz * 6)) $testdir/file2 >> $seqres.full
 _test_remount
 
-md5sum "$testdir/file1" | _filter_test_dir
-md5sum "$testdir/file2" | _filter_test_dir
+md5sum $testdir/file1 | _filter_test_dir
+md5sum $testdir/file2 | _filter_test_dir
 
-_compare_range "$testdir/file1" 0 "$testdir/file2" 0 $((blksz * 8)) \
+_compare_range $testdir/file1 0 $testdir/file2 0 $((blksz * 8)) \
        || echo "Files 1-2 do not match (intentional)"
 
 echo "Dedupe the middle blocks together"
-free_before="$(stat -f -c '%a' "$testdir")"
-_dedupe_range "$testdir/file1" $((blksz * 4)) "$testdir/file2" \
-		$((blksz * 4)) $((blksz * 2)) >> "$seqres.full"
+free_before=$(stat -f -c '%a' $testdir)
+_dedupe_range $testdir/file1 $((blksz * 4)) $testdir/file2 \
+		$((blksz * 4)) $((blksz * 2)) >> $seqres.full
 _test_remount
-free_after="$(stat -f -c '%a' "$testdir")"
-echo "freesp changed by $free_before -> $free_after" >> "$seqres.full"
+free_after=$(stat -f -c '%a' $testdir)
+echo "freesp changed by $free_before -> $free_after" >> $seqres.full
 
 echo "Compare sections"
-md5sum "$testdir/file1" | _filter_test_dir
-md5sum "$testdir/file2" | _filter_test_dir
+md5sum $testdir/file1 | _filter_test_dir
+md5sum $testdir/file2 | _filter_test_dir
 
-_compare_range "$testdir/file1" 0 "$testdir/file2" 0 $((blksz * 4)) \
+_compare_range $testdir/file1 0 $testdir/file2 0 $((blksz * 4)) \
        || echo "Start sections do not match"
 
-_compare_range "$testdir/file1" $((blksz * 4)) "$testdir/file2" \
+_compare_range $testdir/file1 $((blksz * 4)) $testdir/file2 \
 		$((blksz * 4)) $((blksz * 2)) \
        || echo "Middle sections do not match"
 
-_compare_range "$testdir/file1" $((blksz * 6)) "$testdir/file2" \
+_compare_range $testdir/file1 $((blksz * 6)) $testdir/file2 \
 		$((blksz * 6)) $((blksz * 2)) \
        || echo "End sections do not match"
 
diff --git a/tests/generic/122 b/tests/generic/122
index e7585f7..d5cc3a2 100755
--- a/tests/generic/122
+++ b/tests/generic/122
@@ -22,8 +22,8 @@
 # Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 #-----------------------------------------------------------------------
 
-seq=`basename "$0"`
-seqres="$RESULT_DIR/$seq"
+seq=`basename $0`
+seqres=$RESULT_DIR/$seq
 echo "QA output created by $seq"
 
 here=`pwd`
@@ -34,7 +34,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _cleanup()
 {
     cd /
-    rm -rf "$tmp".* "$testdir"
+    rm -rf $tmp.* $testdir
 }
 
 # get standard environment, filters and checks
@@ -46,44 +46,44 @@ _cleanup()
 _supported_os Linux
 _require_test_dedupe
 
-rm -f "$seqres.full"
+rm -f $seqres.full
 
-testdir="$TEST_DIR/test-$seq"
-rm -rf "$testdir"
-mkdir "$testdir"
+testdir=$TEST_DIR/test-$seq
+rm -rf $testdir
+mkdir $testdir
 
 echo "Create the original files"
 blksz=65536
-_pwrite_byte 0x61 $((blksz * 2)) $((blksz * 6)) "$testdir/file1" >> "$seqres.full"
-_pwrite_byte 0x62 $((blksz * 2)) $((blksz * 6)) "$testdir/file2" >> "$seqres.full"
+_pwrite_byte 0x61 $((blksz * 2)) $((blksz * 6)) $testdir/file1 >> $seqres.full
+_pwrite_byte 0x62 $((blksz * 2)) $((blksz * 6)) $testdir/file2 >> $seqres.full
 _test_remount
 
-md5sum "$testdir/file1" | _filter_test_dir
-md5sum "$testdir/file2" | _filter_test_dir
+md5sum $testdir/file1 | _filter_test_dir
+md5sum $testdir/file2 | _filter_test_dir
 
-_compare_range "$testdir/file1" 0 "$testdir/file2" 0 "$((blksz * 8))" \
+_compare_range $testdir/file1 0 $testdir/file2 0 "$((blksz * 8))" \
        || echo "Files 1-2 do not match (intentional)"
 
 echo "(Fail to) dedupe the middle blocks together"
-free_before="$(stat -f -c '%a' "$testdir")"
-_dedupe_range "$testdir/file1" $((blksz * 4)) "$testdir/file2" \
-		$((blksz * 4)) $((blksz * 2)) >> "$seqres.full"
+free_before=$(stat -f -c '%a' $testdir)
+_dedupe_range $testdir/file1 $((blksz * 4)) $testdir/file2 \
+		$((blksz * 4)) $((blksz * 2)) >> $seqres.full
 _test_remount
-free_after="$(stat -f -c '%a' "$testdir")"
-echo "freesp changed by $free_before -> $free_after" >> "$seqres.full"
+free_after=$(stat -f -c '%a' $testdir)
+echo "freesp changed by $free_before -> $free_after" >> $seqres.full
 
 echo "Compare sections"
-md5sum "$testdir/file1" | _filter_test_dir
-md5sum "$testdir/file2" | _filter_test_dir
+md5sum $testdir/file1 | _filter_test_dir
+md5sum $testdir/file2 | _filter_test_dir
 
-_compare_range "$testdir/file1" 0 "$testdir/file2" 0 $((blksz * 4)) \
+_compare_range $testdir/file1 0 $testdir/file2 0 $((blksz * 4)) \
        || echo "Start sections do not match (intentional)"
 
-_compare_range "$testdir/file1" $((blksz * 4)) "$testdir/file2" \
+_compare_range $testdir/file1 $((blksz * 4)) $testdir/file2 \
 		$((blksz * 4)) $((blksz * 2)) \
        || echo "Middle sections do not match (intentional)"
 
-_compare_range "$testdir/file1" $((blksz * 6)) "$testdir/file2" \
+_compare_range $testdir/file1 $((blksz * 6)) $testdir/file2 \
 		$((blksz * 6)) $((blksz * 2)) \
        || echo "End sections do not match (intentional)"
 
diff --git a/tests/generic/134 b/tests/generic/134
index 1dda839..b1b1fa7 100755
--- a/tests/generic/134
+++ b/tests/generic/134
@@ -26,8 +26,8 @@
 # Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 #-----------------------------------------------------------------------
 
-seq=`basename "$0"`
-seqres="$RESULT_DIR/$seq"
+seq=`basename $0`
+seqres=$RESULT_DIR/$seq
 echo "QA output created by $seq"
 
 here=`pwd`
@@ -38,7 +38,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _cleanup()
 {
     cd /
-    rm -rf "$tmp".* "$testdir"
+    rm -rf $tmp.* $testdir
 }
 
 # get standard environment, filters and checks
@@ -50,46 +50,46 @@ _cleanup()
 _supported_os Linux
 _require_test_reflink
 
-rm -f "$seqres.full"
+rm -f $seqres.full
 
-testdir="$TEST_DIR/test-$seq"
-rm -rf "$testdir"
-mkdir "$testdir"
+testdir=$TEST_DIR/test-$seq
+rm -rf $testdir
+mkdir $testdir
 
 echo "Create the original files"
 blksz=65536
-_pwrite_byte 0x61 0 $((blksz + 37)) "$testdir/file1" >> "$seqres.full"
-_pwrite_byte 0x61 0 $((blksz + 37)) "$testdir/file2" >> "$seqres.full"
-_pwrite_byte 0x62 0 $((blksz + 37)) "$testdir/file3" >> "$seqres.full"
-_pwrite_byte 0x62 0 $((blksz + 37)) "$testdir/file4" >> "$seqres.full"
+_pwrite_byte 0x61 0 $((blksz + 37)) $testdir/file1 >> $seqres.full
+_pwrite_byte 0x61 0 $((blksz + 37)) $testdir/file2 >> $seqres.full
+_pwrite_byte 0x62 0 $((blksz + 37)) $testdir/file3 >> $seqres.full
+_pwrite_byte 0x62 0 $((blksz + 37)) $testdir/file4 >> $seqres.full
 _test_remount
 
-md5sum "$testdir/file1" | _filter_test_dir
-md5sum "$testdir/file2" | _filter_test_dir
-md5sum "$testdir/file3" | _filter_test_dir
-md5sum "$testdir/file4" | _filter_test_dir
+md5sum $testdir/file1 | _filter_test_dir
+md5sum $testdir/file2 | _filter_test_dir
+md5sum $testdir/file3 | _filter_test_dir
+md5sum $testdir/file4 | _filter_test_dir
 
 c1="$(_md5_checksum $testdir/file1)"
 c2="$(_md5_checksum $testdir/file2)"
 c3="$(_md5_checksum $testdir/file3)"
 c4="$(_md5_checksum $testdir/file4)"
 
-test "${c1}" = "${c2}" || echo "file1 and file2 should match"
-test "${c1}" != "${c3}" || echo "file1 and file3 should not match"
-test "${c1}" != "${c4}" || echo "file1 and file4 should not match"
-test "${c2}" != "${c3}" || echo "file2 and file3 should not match"
-test "${c2}" != "${c4}" || echo "file2 and file4 should not match"
-test "${c3}" = "${c4}" || echo "file3 and file4 should match"
+test ${c1} = ${c2} || echo "file1 and file2 should match"
+test ${c1} != ${c3} || echo "file1 and file3 should not match"
+test ${c1} != ${c4} || echo "file1 and file4 should not match"
+test ${c2} != ${c3} || echo "file2 and file3 should not match"
+test ${c2} != ${c4} || echo "file2 and file4 should not match"
+test ${c3} = ${c4} || echo "file3 and file4 should match"
 
 echo "Reflink the last blocks together, 1-2 1-3"
-_reflink_range "$testdir/file1" $blksz "$testdir/file2" $blksz 37 >> "$seqres.full"
-_reflink_range "$testdir/file1" $blksz "$testdir/file3" $blksz 37 >> "$seqres.full"
+_reflink_range $testdir/file1 $blksz $testdir/file2 $blksz 37 >> $seqres.full
+_reflink_range $testdir/file1 $blksz $testdir/file3 $blksz 37 >> $seqres.full
 _test_remount
 
-md5sum "$testdir/file1" | _filter_test_dir
-md5sum "$testdir/file2" | _filter_test_dir
-md5sum "$testdir/file3" | _filter_test_dir
-md5sum "$testdir/file4" | _filter_test_dir
+md5sum $testdir/file1 | _filter_test_dir
+md5sum $testdir/file2 | _filter_test_dir
+md5sum $testdir/file3 | _filter_test_dir
+md5sum $testdir/file4 | _filter_test_dir
 
 c1="$(_md5_checksum $testdir/file1)"
 c2="$(_md5_checksum $testdir/file2)"
@@ -97,30 +97,30 @@ c3="$(_md5_checksum $testdir/file3)"
 c4="$(_md5_checksum $testdir/file4)"
 
 echo "Compare files"
-test "${c1}" = "${c2}" || echo "file1 and file2 should match"
-test "${c1}" != "${c3}" || echo "file1 and file3 should not match"
-test "${c1}" != "${c4}" || echo "file1 and file4 should not match"
-test "${c2}" != "${c3}" || echo "file2 and file3 should not match"
-test "${c2}" != "${c4}" || echo "file2 and file4 should not match"
-test "${c3}" != "${c4}" || echo "file3 and file4 should match"
+test ${c1} = ${c2} || echo "file1 and file2 should match"
+test ${c1} != ${c3} || echo "file1 and file3 should not match"
+test ${c1} != ${c4} || echo "file1 and file4 should not match"
+test ${c2} != ${c3} || echo "file2 and file3 should not match"
+test ${c2} != ${c4} || echo "file2 and file4 should not match"
+test ${c3} != ${c4} || echo "file3 and file4 should match"
 
 echo "Compare sections"
-_compare_range "$testdir/file1" $blksz "$testdir/file2" $blksz 37 \
+_compare_range $testdir/file1 $blksz $testdir/file2 $blksz 37 \
        || echo "End sections of files 1-2 do not match"
 
-_compare_range "$testdir/file1" $blksz "$testdir/file3" $blksz 37 \
+_compare_range $testdir/file1 $blksz $testdir/file3 $blksz 37 \
        || echo "End sections of files 1-3 do not match"
 
-_compare_range "$testdir/file1" $blksz "$testdir/file4" $blksz 37 \
+_compare_range $testdir/file1 $blksz $testdir/file4 $blksz 37 \
        || echo "End sections of files 1-4 do not match (intentional)"
 
-_compare_range "$testdir/file2" $blksz "$testdir/file3" $blksz 37 \
+_compare_range $testdir/file2 $blksz $testdir/file3 $blksz 37 \
        || echo "End sections of files 2-3 do not match"
 
-_compare_range "$testdir/file2" $blksz "$testdir/file4" $blksz 37 \
+_compare_range $testdir/file2 $blksz $testdir/file4 $blksz 37 \
        || echo "End sections of files 2-4 do not match (intentional)"
 
-_compare_range "$testdir/file3" $blksz "$testdir/file4" $blksz 37 \
+_compare_range $testdir/file3 $blksz $testdir/file4 $blksz 37 \
        || echo "End sections of files 3-4 do not match (intentional)"
 
 # success, all done
diff --git a/tests/generic/136 b/tests/generic/136
index 6bd6b14..bc69fa7 100755
--- a/tests/generic/136
+++ b/tests/generic/136
@@ -26,8 +26,8 @@
 # Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 #-----------------------------------------------------------------------
 
-seq=`basename "$0"`
-seqres="$RESULT_DIR/$seq"
+seq=`basename $0`
+seqres=$RESULT_DIR/$seq
 echo "QA output created by $seq"
 
 here=`pwd`
@@ -38,7 +38,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _cleanup()
 {
     cd /
-    rm -rf "$tmp".* "$testdir"
+    rm -rf $tmp.* $testdir
 }
 
 # get standard environment, filters and checks
@@ -50,48 +50,48 @@ _cleanup()
 _supported_os Linux
 _require_test_dedupe
 
-rm -f "$seqres.full"
+rm -f $seqres.full
 
-testdir="$TEST_DIR/test-$seq"
-rm -rf "$testdir"
-mkdir "$testdir"
+testdir=$TEST_DIR/test-$seq
+rm -rf $testdir
+mkdir $testdir
 
 echo "Create the original files"
 blksz=65536
-_pwrite_byte 0x61 0 $((blksz + 37)) "$testdir/file1" >> "$seqres.full"
-_pwrite_byte 0x61 0 $((blksz + 37)) "$testdir/file2" >> "$seqres.full"
-_pwrite_byte 0x62 0 $((blksz + 37)) "$testdir/file3" >> "$seqres.full"
-_pwrite_byte 0x62 0 $((blksz + 37)) "$testdir/file4" >> "$seqres.full"
+_pwrite_byte 0x61 0 $((blksz + 37)) $testdir/file1 >> $seqres.full
+_pwrite_byte 0x61 0 $((blksz + 37)) $testdir/file2 >> $seqres.full
+_pwrite_byte 0x62 0 $((blksz + 37)) $testdir/file3 >> $seqres.full
+_pwrite_byte 0x62 0 $((blksz + 37)) $testdir/file4 >> $seqres.full
 _test_remount
 
-md5sum "$testdir/file1" | _filter_test_dir
-md5sum "$testdir/file2" | _filter_test_dir
-md5sum "$testdir/file3" | _filter_test_dir
-md5sum "$testdir/file4" | _filter_test_dir
+md5sum $testdir/file1 | _filter_test_dir
+md5sum $testdir/file2 | _filter_test_dir
+md5sum $testdir/file3 | _filter_test_dir
+md5sum $testdir/file4 | _filter_test_dir
 
 c1="$(_md5_checksum $testdir/file1)"
 c2="$(_md5_checksum $testdir/file2)"
 c3="$(_md5_checksum $testdir/file3)"
 c4="$(_md5_checksum $testdir/file4)"
 
-test "${c1}" = "${c2}" || echo "file1 and file2 should match"
-test "${c1}" != "${c3}" || echo "file1 and file3 should not match"
-test "${c1}" != "${c4}" || echo "file1 and file4 should not match"
-test "${c2}" != "${c3}" || echo "file2 and file3 should not match"
-test "${c2}" != "${c4}" || echo "file2 and file4 should not match"
-test "${c3}" = "${c4}" || echo "file3 and file4 should match"
+test ${c1} = ${c2} || echo "file1 and file2 should match"
+test ${c1} != ${c3} || echo "file1 and file3 should not match"
+test ${c1} != ${c4} || echo "file1 and file4 should not match"
+test ${c2} != ${c3} || echo "file2 and file3 should not match"
+test ${c2} != ${c4} || echo "file2 and file4 should not match"
+test ${c3} = ${c4} || echo "file3 and file4 should match"
 
 echo "Dedupe the last blocks together"
 echo "1->2"
-_dedupe_range "$testdir/file1" $blksz "$testdir/file2" $blksz 37 >> "$seqres.full"
+_dedupe_range $testdir/file1 $blksz $testdir/file2 $blksz 37 >> $seqres.full
 echo "1->3"
-_dedupe_range "$testdir/file1" $blksz "$testdir/file3" $blksz 37 >> "$seqres.full"
+_dedupe_range $testdir/file1 $blksz $testdir/file3 $blksz 37 >> $seqres.full
 _test_remount
 
-md5sum "$testdir/file1" | _filter_test_dir
-md5sum "$testdir/file2" | _filter_test_dir
-md5sum "$testdir/file3" | _filter_test_dir
-md5sum "$testdir/file4" | _filter_test_dir
+md5sum $testdir/file1 | _filter_test_dir
+md5sum $testdir/file2 | _filter_test_dir
+md5sum $testdir/file3 | _filter_test_dir
+md5sum $testdir/file4 | _filter_test_dir
 
 c1="$(_md5_checksum $testdir/file1)"
 c2="$(_md5_checksum $testdir/file2)"
@@ -99,30 +99,30 @@ c3="$(_md5_checksum $testdir/file3)"
 c4="$(_md5_checksum $testdir/file4)"
 
 echo "Compare files"
-test "${c1}" = "${c2}" || echo "file1 and file2 should match"
-test "${c1}" != "${c3}" || echo "file1 and file3 should not match"
-test "${c1}" != "${c4}" || echo "file1 and file4 should not match"
-test "${c2}" != "${c3}" || echo "file2 and file3 should not match"
-test "${c2}" != "${c4}" || echo "file2 and file4 should not match"
-test "${c3}" = "${c4}" || echo "file3 and file4 should match"
+test ${c1} = ${c2} || echo "file1 and file2 should match"
+test ${c1} != ${c3} || echo "file1 and file3 should not match"
+test ${c1} != ${c4} || echo "file1 and file4 should not match"
+test ${c2} != ${c3} || echo "file2 and file3 should not match"
+test ${c2} != ${c4} || echo "file2 and file4 should not match"
+test ${c3} = ${c4} || echo "file3 and file4 should match"
 
 echo "Compare sections"
-_compare_range "$testdir/file1" $blksz "$testdir/file2" $blksz 37 \
+_compare_range $testdir/file1 $blksz $testdir/file2 $blksz 37 \
        || echo "End sections of files 1-2 do not match"
 
-_compare_range "$testdir/file1" $blksz "$testdir/file3" $blksz 37 \
+_compare_range $testdir/file1 $blksz $testdir/file3 $blksz 37 \
        || echo "End sections of files 1-3 do not match (intentional)"
 
-_compare_range "$testdir/file1" $blksz "$testdir/file4" $blksz 37 \
+_compare_range $testdir/file1 $blksz $testdir/file4 $blksz 37 \
        || echo "End sections of files 1-4 do not match (intentional)"
 
-_compare_range "$testdir/file2" $blksz "$testdir/file3" $blksz 37 \
+_compare_range $testdir/file2 $blksz $testdir/file3 $blksz 37 \
        || echo "End sections of files 2-3 do not match (intentional)"
 
-_compare_range "$testdir/file2" $blksz "$testdir/file4" $blksz 37 \
+_compare_range $testdir/file2 $blksz $testdir/file4 $blksz 37 \
        || echo "End sections of files 2-4 do not match (intentional)"
 
-_compare_range "$testdir/file3" $blksz "$testdir/file4" $blksz 37 \
+_compare_range $testdir/file3 $blksz $testdir/file4 $blksz 37 \
        || echo "End sections of files 3-4 do not match"
 
 # success, all done
diff --git a/tests/generic/137 b/tests/generic/137
index dcfd90d..19a7ab4 100755
--- a/tests/generic/137
+++ b/tests/generic/137
@@ -26,8 +26,8 @@
 # Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 #-----------------------------------------------------------------------
 
-seq=`basename "$0"`
-seqres="$RESULT_DIR/$seq"
+seq=`basename $0`
+seqres=$RESULT_DIR/$seq
 echo "QA output created by $seq"
 
 here=`pwd`
@@ -38,7 +38,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _cleanup()
 {
     cd /
-    rm -rf "$tmp".* "$testdir"
+    rm -rf $tmp.* $testdir
 }
 
 # get standard environment, filters and checks
@@ -52,57 +52,57 @@ _require_test_reflink
 _require_test_dedupe
 _require_xfs_io_command "falloc"
 
-rm -f "$seqres.full"
+rm -f $seqres.full
 
-testdir="$TEST_DIR/test-$seq"
-rm -rf "$testdir"
-mkdir "$testdir"
+testdir=$TEST_DIR/test-$seq
+rm -rf $testdir
+mkdir $testdir
 
 echo "Create the original file blocks"
 blksz=65536
-_pwrite_byte 0x61 0 $blksz "$testdir/file1" >> "$seqres.full"
-_pwrite_byte 0x62 $blksz $((blksz * 2)) "$testdir/file1" >> "$seqres.full"
+_pwrite_byte 0x61 0 $blksz $testdir/file1 >> $seqres.full
+_pwrite_byte 0x62 $blksz $((blksz * 2)) $testdir/file1 >> $seqres.full
 
 nr_blks=1024
 
 echo "fallocate half the file"
-"$XFS_IO_PROG" -f -c "falloc $((nr_blks * blksz / 2)) $((nr_blks * blksz / 2))" "$testdir/file1" >> "$seqres.full"
+$XFS_IO_PROG -f -c "falloc $((nr_blks * blksz / 2)) $((nr_blks * blksz / 2))" $testdir/file1 >> $seqres.full
 
 echo "Reflink block zero to the threes"
 seq 1 $((nr_blks / 3)) | while read nr; do
-	_reflink_range "$testdir/file1" 0 "$testdir/file1" $((nr * 3 * blksz)) \
-			$blksz >> "$seqres.full"
+	_reflink_range $testdir/file1 0 $testdir/file1 $((nr * 3 * blksz)) \
+			$blksz >> $seqres.full
 done
 
 echo "Reflink block one to the fives"
 seq 1 $((nr_blks / 5)) | while read nr; do
-	_reflink_range "$testdir/file1" $blksz "$testdir/file1" \
-			$((nr * 5 * blksz)) $blksz >> "$seqres.full"
+	_reflink_range $testdir/file1 $blksz $testdir/file1 \
+			$((nr * 5 * blksz)) $blksz >> $seqres.full
 done
 
 echo "Dedupe block two to the sevens"
 seq 1 $((nr_blks / 7)) | while read nr; do
-	_dedupe_range "$testdir/file1" $((blksz * 2)) "$testdir/file1" \
-			$((nr * 7 * blksz)) $blksz >> "$seqres.full" 2>&1
+	_dedupe_range $testdir/file1 $((blksz * 2)) $testdir/file1 \
+			$((nr * 7 * blksz)) $blksz >> $seqres.full 2>&1
 done
 
 _test_remount
 
 echo "Check block mappings"
-md5sum "$testdir/file1" | _filter_test_dir
+md5sum $testdir/file1 | _filter_test_dir
 
 crcZ=$(_md5_range_checksum /dev/zero 0 $blksz)
-crc0=$(_md5_range_checksum "$testdir/file1" 0 $blksz)
-crc1=$(_md5_range_checksum "$testdir/file1" $blksz $blksz)
-crc2=$(_md5_range_checksum "$testdir/file1" $((blksz * 2)) $blksz)
+crc0=$(_md5_range_checksum $testdir/file1 0 $blksz)
+crc1=$(_md5_range_checksum $testdir/file1 $blksz $blksz)
+crc2=$(_md5_range_checksum $testdir/file1 $((blksz * 2)) $blksz)
 
 check_block() {
-	lblk="$1"
+	lblk=$1
 	rem7=$((lblk % 7))
 	rem5=$((lblk % 5))
 	rem3=$((lblk % 3))
 
-	crc=$(_md5_range_checksum "$testdir/file1" $((lblk * blksz)) $blksz)
+	crc=$(_md5_range_checksum $testdir/file1 $((lblk * blksz)) $blksz)
 
 	if [ $rem7 -eq 0 ]; then
 		if [ $rem5 -eq 0 ]; then
diff --git a/tests/generic/138 b/tests/generic/138
index 59d23e9..c8b4255 100755
--- a/tests/generic/138
+++ b/tests/generic/138
@@ -23,8 +23,8 @@
 # Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 #-----------------------------------------------------------------------
 
-seq=`basename "$0"`
-seqres="$RESULT_DIR/$seq"
+seq=`basename $0`
+seqres=$RESULT_DIR/$seq
 echo "QA output created by $seq"
 
 here=`pwd`
@@ -35,7 +35,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _cleanup()
 {
     cd /
-    rm -rf "$tmp".* "$testdir"
+    rm -rf $tmp.* $testdir
 }
 
 # get standard environment, filters and checks
@@ -48,103 +48,103 @@ _supported_os Linux
 _require_test_reflink
 _require_cp_reflink
 
-rm -f "$seqres.full"
+rm -f $seqres.full
 
-testdir="$TEST_DIR/test-$seq"
-rm -rf "$testdir"
-mkdir "$testdir"
+testdir=$TEST_DIR/test-$seq
+rm -rf $testdir
+mkdir $testdir
 
 echo "Create the original files"
 blksz=65536
-_pwrite_byte 0x61 0 $((blksz * 48 - 3)) "$testdir/file1" >> "$seqres.full"
-_cp_reflink "$testdir/file1" "$testdir/file2" >> "$seqres.full"
-_pwrite_byte 0x61 0 $((blksz * 48 - 3)) "$testdir/file3" >> "$seqres.full"
+_pwrite_byte 0x61 0 $((blksz * 48 - 3)) $testdir/file1 >> $seqres.full
+_cp_reflink $testdir/file1 $testdir/file2 >> $seqres.full
+_pwrite_byte 0x61 0 $((blksz * 48 - 3)) $testdir/file3 >> $seqres.full
 _test_remount
 
 echo "Compare files"
-md5sum "$testdir/file1" | _filter_test_dir
-md5sum "$testdir/file2" | _filter_test_dir
-md5sum "$testdir/file3" | _filter_test_dir
+md5sum $testdir/file1 | _filter_test_dir
+md5sum $testdir/file2 | _filter_test_dir
+md5sum $testdir/file3 | _filter_test_dir
 
-cmp -s "$testdir/file1" "$testdir/file2" || echo "Files 1-2 do not match"
-cmp -s "$testdir/file1" "$testdir/file3" || echo "Files 1-3 do not match"
-cmp -s "$testdir/file2" "$testdir/file3" || echo "Files 2-3 do not match"
+cmp -s $testdir/file1 $testdir/file2 || echo "Files 1-2 do not match"
+cmp -s $testdir/file1 $testdir/file3 || echo "Files 1-3 do not match"
+cmp -s $testdir/file2 $testdir/file3 || echo "Files 2-3 do not match"
 
 echo "pagecache CoW the second file"
-_pwrite_byte 0x62 0 17 "$testdir/file2" >> "$seqres.full"
-_pwrite_byte 0x62 0 17 "$testdir/file3" >> "$seqres.full"
+_pwrite_byte 0x62 0 17 $testdir/file2 >> $seqres.full
+_pwrite_byte 0x62 0 17 $testdir/file3 >> $seqres.full
 
-_pwrite_byte 0x62 $((blksz * 16 - 34)) 17 "$testdir/file2" >> "$seqres.full"
-_pwrite_byte 0x62 $((blksz * 16 - 34)) 17 "$testdir/file3" >> "$seqres.full"
+_pwrite_byte 0x62 $((blksz * 16 - 34)) 17 $testdir/file2 >> $seqres.full
+_pwrite_byte 0x62 $((blksz * 16 - 34)) 17 $testdir/file3 >> $seqres.full
 
-_pwrite_byte 0x62 $((blksz * 48 - 8)) 17 "$testdir/file2" >> "$seqres.full"
-_pwrite_byte 0x62 $((blksz * 48 - 8)) 17 "$testdir/file3" >> "$seqres.full"
+_pwrite_byte 0x62 $((blksz * 48 - 8)) 17 $testdir/file2 >> $seqres.full
+_pwrite_byte 0x62 $((blksz * 48 - 8)) 17 $testdir/file3 >> $seqres.full
 _test_remount
 
 echo "Compare files"
-md5sum "$testdir/file1" | _filter_test_dir
-md5sum "$testdir/file2" | _filter_test_dir
-md5sum "$testdir/file3" | _filter_test_dir
+md5sum $testdir/file1 | _filter_test_dir
+md5sum $testdir/file2 | _filter_test_dir
+md5sum $testdir/file3 | _filter_test_dir
 
-cmp -s "$testdir/file1" "$testdir/file2" || echo "Files 1-2 do not match (intentional)"
-cmp -s "$testdir/file1" "$testdir/file3" || echo "Files 1-3 do not match (intentional)"
-cmp -s "$testdir/file2" "$testdir/file3" || echo "Files 2-3 do not match"
+cmp -s $testdir/file1 $testdir/file2 || echo "Files 1-2 do not match (intentional)"
+cmp -s $testdir/file1 $testdir/file3 || echo "Files 1-3 do not match (intentional)"
+cmp -s $testdir/file2 $testdir/file3 || echo "Files 2-3 do not match"
 
 echo "Compare the CoW'd section to the before file"
-_compare_range "$testdir/file1" 0 "$testdir/file2" 0 17 \
+_compare_range $testdir/file1 0 $testdir/file2 0 17 \
        || echo "Start sections do not match (intentional)"
 
-_compare_range  "$testdir/file1" $((blksz * 16 - 34)) \
-		"$testdir/file2" $((blksz * 16 - 34)) 17 \
+_compare_range  $testdir/file1 $((blksz * 16 - 34)) \
+		$testdir/file2 $((blksz * 16 - 34)) 17 \
        || echo "Middle sections do not match (intentional)"
 
-_compare_range  "$testdir/file1" $((blksz * 48 - 8)) \
-		"$testdir/file2" $((blksz * 48 - 8)) 17 \
+_compare_range  $testdir/file1 $((blksz * 48 - 8)) \
+		$testdir/file2 $((blksz * 48 - 8)) 17 \
        || echo "End sections do not match (intentional)"
 
 echo "Compare the CoW'd section to the after file"
-_compare_range "$testdir/file2" 0 "$testdir/file3" 0 17 \
+_compare_range $testdir/file2 0 $testdir/file3 0 17 \
        || echo "Start sections do not match"
 
-_compare_range  "$testdir/file2" $((blksz * 16 - 34)) \
-		"$testdir/file3" $((blksz * 16 - 34)) 17 \
+_compare_range  $testdir/file2 $((blksz * 16 - 34)) \
+		$testdir/file3 $((blksz * 16 - 34)) 17 \
        || echo "Middle sections do not match"
 
-_compare_range  "$testdir/file2" $((blksz * 48 - 8)) \
-		"$testdir/file3" $((blksz * 48 - 8)) 17 \
+_compare_range  $testdir/file2 $((blksz * 48 - 8)) \
+		$testdir/file3 $((blksz * 48 - 8)) 17 \
        || echo "End sections do not match"
 
 echo "Compare the not CoW'd sections"
-_compare_range "$testdir/file1" 18 "$testdir/file2" 18 17 \
+_compare_range $testdir/file1 18 $testdir/file2 18 17 \
        || echo "Start sections of 1-2 do not match"
 
-_compare_range "$testdir/file2" 18 "$testdir/file3" 18 17 \
+_compare_range $testdir/file2 18 $testdir/file3 18 17 \
        || echo "Start sections of 2-3 do not match"
 
 
-_compare_range  "$testdir/file1" $((blksz * 16 - 17)) \
-		"$testdir/file2" $((blksz * 16 - 17)) 82 \
+_compare_range  $testdir/file1 $((blksz * 16 - 17)) \
+		$testdir/file2 $((blksz * 16 - 17)) 82 \
        || echo "Middle sections of 1-2 do not match"
 
-_compare_range  "$testdir/file2" $((blksz * 16 - 17)) \
-		"$testdir/file3" $((blksz * 16 - 17)) 82 \
+_compare_range  $testdir/file2 $((blksz * 16 - 17)) \
+		$testdir/file3 $((blksz * 16 - 17)) 82 \
        || echo "Middle sections of 2-3 do not match"
 
-_compare_range  "$testdir/file1" $((blksz * 48 - 108)) \
-		"$testdir/file2" $((blksz * 48 - 108)) 100 \
+_compare_range  $testdir/file1 $((blksz * 48 - 108)) \
+		$testdir/file2 $((blksz * 48 - 108)) 100 \
        || echo "End sections of 1-2 do not match"
 
-_compare_range  "$testdir/file2" $((blksz * 48 - 108)) \
-		"$testdir/file3" $((blksz * 48 - 108)) 100 \
+_compare_range  $testdir/file2 $((blksz * 48 - 108)) \
+		$testdir/file3 $((blksz * 48 - 108)) 100 \
        || echo "End sections of 2-3 do not match"
 
 
-_compare_range  "$testdir/file1" $((blksz * 14)) \
-		"$testdir/file2" $((blksz * 14)) $blksz \
+_compare_range  $testdir/file1 $((blksz * 14)) \
+		$testdir/file2 $((blksz * 14)) $blksz \
        || echo "Untouched sections of 1-2 do not match"
 
-_compare_range  "$testdir/file2" $((blksz * 14)) \
-		"$testdir/file3" $((blksz * 14)) $blksz \
+_compare_range  $testdir/file2 $((blksz * 14)) \
+		$testdir/file3 $((blksz * 14)) $blksz \
        || echo "Untouched sections of 2-3 do not match"
 
 # success, all done
diff --git a/tests/generic/139 b/tests/generic/139
index 59e5bff..5e7b631 100755
--- a/tests/generic/139
+++ b/tests/generic/139
@@ -23,8 +23,8 @@
 # Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 #-----------------------------------------------------------------------
 
-seq=`basename "$0"`
-seqres="$RESULT_DIR/$seq"
+seq=`basename $0`
+seqres=$RESULT_DIR/$seq
 echo "QA output created by $seq"
 
 here=`pwd`
@@ -35,7 +35,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _cleanup()
 {
     cd /
-    rm -rf "$tmp".* "$testdir"
+    rm -rf $tmp.* $testdir
 }
 
 # get standard environment, filters and checks
@@ -48,7 +48,7 @@ _supported_os Linux
 _require_test_reflink
 _require_cp_reflink
 
-rm -f "$seqres.full"
+rm -f $seqres.full
 
 testdir=$TEST_DIR/test-$seq
 rm -rf $testdir
@@ -56,94 +56,94 @@ mkdir $testdir
 
 echo "Create the original files"
 blksz=65536
-_pwrite_byte 0x61 0 $((blksz * 48 - 3)) "$testdir/file1" >> "$seqres.full"
-_cp_reflink "$testdir/file1" "$testdir/file2" >> "$seqres.full"
-_pwrite_byte 0x61 0 $((blksz * 48 - 3)) "$testdir/file3" >> "$seqres.full"
+_pwrite_byte 0x61 0 $((blksz * 48 - 3)) $testdir/file1 >> $seqres.full
+_cp_reflink $testdir/file1 $testdir/file2 >> $seqres.full
+_pwrite_byte 0x61 0 $((blksz * 48 - 3)) $testdir/file3 >> $seqres.full
 _test_remount
 
 echo "Compare files"
-md5sum "$testdir/file1" | _filter_test_dir
-md5sum "$testdir/file2" | _filter_test_dir
-md5sum "$testdir/file3" | _filter_test_dir
+md5sum $testdir/file1 | _filter_test_dir
+md5sum $testdir/file2 | _filter_test_dir
+md5sum $testdir/file3 | _filter_test_dir
 
-cmp -s "$testdir/file1" "$testdir/file2" || echo "Files 1-2 should match"
-cmp -s "$testdir/file1" "$testdir/file3" || echo "Files 1-3 should match"
-cmp -s "$testdir/file2" "$testdir/file3" || echo "Files 2-3 should match"
+cmp -s $testdir/file1 $testdir/file2 || echo "Files 1-2 should match"
+cmp -s $testdir/file1 $testdir/file3 || echo "Files 1-3 should match"
+cmp -s $testdir/file2 $testdir/file3 || echo "Files 2-3 should match"
 
 echo "directio CoW the second file"
-_pwrite_byte 0x62 0 $blksz "$testdir/file2" -d >> "$seqres.full"
-_pwrite_byte 0x62 0 $blksz "$testdir/file3" -d >> "$seqres.full"
+_pwrite_byte 0x62 0 $blksz $testdir/file2 -d >> $seqres.full
+_pwrite_byte 0x62 0 $blksz $testdir/file3 -d >> $seqres.full
 
-_pwrite_byte 0x62 $((blksz * 16 - 512)) 512 "$testdir/file2" -d >> "$seqres.full"
-_pwrite_byte 0x62 $((blksz * 16 - 512)) 512 "$testdir/file3" -d >> "$seqres.full"
+_pwrite_byte 0x62 $((blksz * 16 - 512)) 512 $testdir/file2 -d >> $seqres.full
+_pwrite_byte 0x62 $((blksz * 16 - 512)) 512 $testdir/file3 -d >> $seqres.full
 
-_pwrite_byte 0x62 $((blksz * 48)) $blksz "$testdir/file2" -d >> "$seqres.full"
-_pwrite_byte 0x62 $((blksz * 48)) $blksz "$testdir/file3" -d >> "$seqres.full"
+_pwrite_byte 0x62 $((blksz * 48)) $blksz $testdir/file2 -d >> $seqres.full
+_pwrite_byte 0x62 $((blksz * 48)) $blksz $testdir/file3 -d >> $seqres.full
 _test_remount
 
 echo "Compare files"
-md5sum "$testdir/file1" | _filter_test_dir
-md5sum "$testdir/file2" | _filter_test_dir
-md5sum "$testdir/file3" | _filter_test_dir
+md5sum $testdir/file1 | _filter_test_dir
+md5sum $testdir/file2 | _filter_test_dir
+md5sum $testdir/file3 | _filter_test_dir
 
-cmp -s "$testdir/file1" "$testdir/file2" || echo "Files 1-2 should not match (intentional)"
-cmp -s "$testdir/file1" "$testdir/file3" || echo "Files 1-3 should not match (intentional)"
-cmp -s "$testdir/file2" "$testdir/file3" || echo "Files 2-3 should match"
+cmp -s $testdir/file1 $testdir/file2 || echo "Files 1-2 should not match (intentional)"
+cmp -s $testdir/file1 $testdir/file3 || echo "Files 1-3 should not match (intentional)"
+cmp -s $testdir/file2 $testdir/file3 || echo "Files 2-3 should match"
 
 echo "Compare the CoW'd section to the before file"
-_compare_range "$testdir/file1" 0 "$testdir/file2" 0 $blksz \
+_compare_range $testdir/file1 0 $testdir/file2 0 $blksz \
        || echo "Start sections do not match (intentional)"
 
-_compare_range  "$testdir/file1" $((blksz * 16 - 512)) \
-		"$testdir/file2" $((blksz * 16 - 512)) 512 \
+_compare_range  $testdir/file1 $((blksz * 16 - 512)) \
+		$testdir/file2 $((blksz * 16 - 512)) 512 \
        || echo "Middle sections do not match (intentional)"
 
-_compare_range  "$testdir/file1" $((blksz * 48 - 512)) \
-		"$testdir/file2" $((blksz * 48 - 512)) $blksz \
+_compare_range  $testdir/file1 $((blksz * 48 - 512)) \
+		$testdir/file2 $((blksz * 48 - 512)) $blksz \
        || echo "End sections do not match (intentional)"
 
 echo "Compare the CoW'd section to the after file"
-_compare_range "$testdir/file2" 0 "$testdir/file3" 0 $blksz \
+_compare_range $testdir/file2 0 $testdir/file3 0 $blksz \
        || echo "Start sections do not match"
 
-_compare_range  "$testdir/file2" $((blksz * 16 - 512)) \
-		"$testdir/file3" $((blksz * 16 - 512)) 512 \
+_compare_range  $testdir/file2 $((blksz * 16 - 512)) \
+		$testdir/file3 $((blksz * 16 - 512)) 512 \
        || echo "Middle sections do not match"
 
-_compare_range  "$testdir/file2" $((blksz * 48 - 512)) \
-		"$testdir/file3" $((blksz * 48 - 512)) $blksz \
+_compare_range  $testdir/file2 $((blksz * 48 - 512)) \
+		$testdir/file3 $((blksz * 48 - 512)) $blksz \
        || echo "End sections do not match"
 
 echo "Compare the not CoW'd sections"
-_compare_range "$testdir/file1" $blksz "$testdir/file2" $blksz 512 \
+_compare_range $testdir/file1 $blksz $testdir/file2 $blksz 512 \
        || echo "Start sections of 1-2 do not match"
-_compare_range "$testdir/file2" $blksz "$testdir/file3" $blksz 512 \
+_compare_range $testdir/file2 $blksz $testdir/file3 $blksz 512 \
        || echo "Start sections of 2-3 do not match"
 
 
-_compare_range  "$testdir/file1" $((blksz * 16 - 1024)) \
-		"$testdir/file2" $((blksz * 16 - 1024)) 512 \
+_compare_range  $testdir/file1 $((blksz * 16 - 1024)) \
+		$testdir/file2 $((blksz * 16 - 1024)) 512 \
        || echo "Middle sections of 1-2 do not match"
 
-_compare_range  "$testdir/file2" $((blksz * 16 - 1024)) \
-		"$testdir/file3" $((blksz * 16 - 1024)) 512 \
+_compare_range  $testdir/file2 $((blksz * 16 - 1024)) \
+		$testdir/file3 $((blksz * 16 - 1024)) 512 \
        || echo "Middle sections of 2-3 do not match"
 
-_compare_range  "$testdir/file1" $((blksz * 48 - 1024)) \
-		"$testdir/file2" $((blksz * 48 - 1024)) 512 \
+_compare_range  $testdir/file1 $((blksz * 48 - 1024)) \
+		$testdir/file2 $((blksz * 48 - 1024)) 512 \
        || echo "End sections of 1-2 do not match"
 
-_compare_range  "$testdir/file2" $((blksz * 48 - 1024)) \
-		"$testdir/file3" $((blksz * 48 - 1024)) 512 \
+_compare_range  $testdir/file2 $((blksz * 48 - 1024)) \
+		$testdir/file3 $((blksz * 48 - 1024)) 512 \
        || echo "End sections of 2-3 do not match"
 
 
-_compare_range  "$testdir/file1" $((blksz * 16)) \
-		"$testdir/file2" $((blksz * 16)) 512 \
+_compare_range  $testdir/file1 $((blksz * 16)) \
+		$testdir/file2 $((blksz * 16)) 512 \
        || echo "Untouched sections of 1-2 do not match"
 
-_compare_range  "$testdir/file2" $((blksz * 16)) \
-		"$testdir/file3" $((blksz * 16)) 512 \
+_compare_range  $testdir/file2 $((blksz * 16)) \
+		$testdir/file3 $((blksz * 16)) 512 \
        || echo "Untouched sections of 2-3 do not match"
 
 # success, all done
diff --git a/tests/generic/140 b/tests/generic/140
index e8e7655..5bcd4ef 100755
--- a/tests/generic/140
+++ b/tests/generic/140
@@ -23,8 +23,8 @@
 # Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 #-----------------------------------------------------------------------
 
-seq=`basename "$0"`
-seqres="$RESULT_DIR/$seq"
+seq=`basename $0`
+seqres=$RESULT_DIR/$seq
 echo "QA output created by $seq"
 
 here=`pwd`
@@ -35,7 +35,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _cleanup()
 {
     cd /
-    rm -rf "$tmp".* "$testdir"
+    rm -rf $tmp.* $testdir
 }
 
 # get standard environment, filters and checks
@@ -48,103 +48,103 @@ _supported_os Linux
 _require_test_reflink
 _require_cp_reflink
 
-rm -f "$seqres.full"
+rm -f $seqres.full
 
-testdir="$TEST_DIR/test-$seq"
-rm -rf "$testdir"
-mkdir "$testdir"
+testdir=$TEST_DIR/test-$seq
+rm -rf $testdir
+mkdir $testdir
 
 echo "Create the original files"
 blksz=65536
-_pwrite_byte 0x61 0 $((blksz * 48 - 3)) "$testdir/file1" >> "$seqres.full"
-_cp_reflink "$testdir/file1" "$testdir/file2" >> "$seqres.full"
-_pwrite_byte 0x61 0 $((blksz * 48 - 3)) "$testdir/file3" >> "$seqres.full"
+_pwrite_byte 0x61 0 $((blksz * 48 - 3)) $testdir/file1 >> $seqres.full
+_cp_reflink $testdir/file1 $testdir/file2 >> $seqres.full
+_pwrite_byte 0x61 0 $((blksz * 48 - 3)) $testdir/file3 >> $seqres.full
 _test_remount
 
 echo "Compare files"
-md5sum "$testdir/file1" | _filter_test_dir
-md5sum "$testdir/file2" | _filter_test_dir
-md5sum "$testdir/file3" | _filter_test_dir
+md5sum $testdir/file1 | _filter_test_dir
+md5sum $testdir/file2 | _filter_test_dir
+md5sum $testdir/file3 | _filter_test_dir
 
-cmp -s "$testdir/file1" "$testdir/file2" || echo "Files 1-2 do not match"
-cmp -s "$testdir/file1" "$testdir/file3" || echo "Files 1-3 do not match"
-cmp -s "$testdir/file2" "$testdir/file3" || echo "Files 2-3 do not match"
+cmp -s $testdir/file1 $testdir/file2 || echo "Files 1-2 do not match"
+cmp -s $testdir/file1 $testdir/file3 || echo "Files 1-3 do not match"
+cmp -s $testdir/file2 $testdir/file3 || echo "Files 2-3 do not match"
 
 echo "mmap CoW the second file"
-_mwrite_byte 0x62 0 17 $((blksz * 48 - 3)) "$testdir/file2" >> "$seqres.full"
-_mwrite_byte 0x62 0 17 $((blksz * 48 - 3)) "$testdir/file3" >> "$seqres.full"
+_mwrite_byte 0x62 0 17 $((blksz * 48 - 3)) $testdir/file2 >> $seqres.full
+_mwrite_byte 0x62 0 17 $((blksz * 48 - 3)) $testdir/file3 >> $seqres.full
 
-_mwrite_byte 0x62 $((blksz * 16 - 34)) 17 $((blksz * 48 - 3)) "$testdir/file2" >> "$seqres.full"
-_mwrite_byte 0x62 $((blksz * 16 - 34)) 17 $((blksz * 48 - 3)) "$testdir/file3" >> "$seqres.full"
+_mwrite_byte 0x62 $((blksz * 16 - 34)) 17 $((blksz * 48 - 3)) $testdir/file2 >> $seqres.full
+_mwrite_byte 0x62 $((blksz * 16 - 34)) 17 $((blksz * 48 - 3)) $testdir/file3 >> $seqres.full
 
-_mwrite_byte 0x62 $((blksz * 48 - 20)) 17 $((blksz * 48 - 3)) "$testdir/file2" >> "$seqres.full"
-_mwrite_byte 0x62 $((blksz * 48 - 20)) 17 $((blksz * 48 - 3)) "$testdir/file3" >> "$seqres.full"
+_mwrite_byte 0x62 $((blksz * 48 - 20)) 17 $((blksz * 48 - 3)) $testdir/file2 >> $seqres.full
+_mwrite_byte 0x62 $((blksz * 48 - 20)) 17 $((blksz * 48 - 3)) $testdir/file3 >> $seqres.full
 _test_remount
 
 echo "Compare files"
-md5sum "$testdir/file1" | _filter_test_dir
-md5sum "$testdir/file2" | _filter_test_dir
-md5sum "$testdir/file3" | _filter_test_dir
+md5sum $testdir/file1 | _filter_test_dir
+md5sum $testdir/file2 | _filter_test_dir
+md5sum $testdir/file3 | _filter_test_dir
 
-cmp -s "$testdir/file1" "$testdir/file2" || echo "Files 1-2 do not match (intentional)"
-cmp -s "$testdir/file1" "$testdir/file3" || echo "Files 1-3 do not match (intentional)"
-cmp -s "$testdir/file2" "$testdir/file3" || echo "Files 2-3 do not match"
+cmp -s $testdir/file1 $testdir/file2 || echo "Files 1-2 do not match (intentional)"
+cmp -s $testdir/file1 $testdir/file3 || echo "Files 1-3 do not match (intentional)"
+cmp -s $testdir/file2 $testdir/file3 || echo "Files 2-3 do not match"
 
 echo "Compare the CoW'd section to the before file"
-_compare_range "$testdir/file1" 0 "$testdir/file2" 0 17 \
+_compare_range $testdir/file1 0 $testdir/file2 0 17 \
        || echo "Start sections do not match (intentional)"
 
-_compare_range  "$testdir/file1" $((blksz * 16 - 34)) \
-		"$testdir/file2" $((blksz * 16 - 34)) 17 \
+_compare_range  $testdir/file1 $((blksz * 16 - 34)) \
+		$testdir/file2 $((blksz * 16 - 34)) 17 \
        || echo "Middle sections do not match (intentional)"
 
-_compare_range  "$testdir/file1" $((blksz * 48 - 20)) \
-		"$testdir/file2" $((blksz * 48 - 20)) 17 \
+_compare_range  $testdir/file1 $((blksz * 48 - 20)) \
+		$testdir/file2 $((blksz * 48 - 20)) 17 \
        || echo "End sections do not match (intentional)"
 
 echo "Compare the CoW'd section to the after file"
-_compare_range "$testdir/file2" 0 "$testdir/file3" 0 17 \
+_compare_range $testdir/file2 0 $testdir/file3 0 17 \
        || echo "Start sections do not match"
 
-_compare_range  "$testdir/file2" $((blksz * 16 - 34)) \
-		"$testdir/file3" $((blksz * 16 - 34)) 17 \
+_compare_range  $testdir/file2 $((blksz * 16 - 34)) \
+		$testdir/file3 $((blksz * 16 - 34)) 17 \
        || echo "Middle sections do not match"
 
-_compare_range  "$testdir/file2" $((blksz * 48 - 20)) \
-		"$testdir/file3" $((blksz * 48 - 20)) 17 \
+_compare_range  $testdir/file2 $((blksz * 48 - 20)) \
+		$testdir/file3 $((blksz * 48 - 20)) 17 \
        || echo "End sections do not match"
 
 echo "Compare the not CoW'd sections"
-_compare_range "$testdir/file1" 18 "$testdir/file2" 18 17 \
+_compare_range $testdir/file1 18 $testdir/file2 18 17 \
        || echo "Start sections of 1-2 do not match"
 
-_compare_range "$testdir/file2" 18 "$testdir/file3" 18 17 \
+_compare_range $testdir/file2 18 $testdir/file3 18 17 \
        || echo "Start sections of 2-3 do not match"
 
 
-_compare_range  "$testdir/file1" $((blksz * 16 - 17)) \
-		"$testdir/file2" $((blksz * 16 - 17)) 82 \
+_compare_range  $testdir/file1 $((blksz * 16 - 17)) \
+		$testdir/file2 $((blksz * 16 - 17)) 82 \
        || echo "Middle sections of 1-2 do not match"
 
-_compare_range  "$testdir/file2" $((blksz * 16 - 17)) \
-		"$testdir/file3" $((blksz * 16 - 17)) 82 \
+_compare_range  $testdir/file2 $((blksz * 16 - 17)) \
+		$testdir/file3 $((blksz * 16 - 17)) 82 \
        || echo "Middle sections of 2-3 do not match"
 
-_compare_range  "$testdir/file1" $((blksz * 48 - 120)) \
-		"$testdir/file2" $((blksz * 48 - 120)) 100 \
+_compare_range  $testdir/file1 $((blksz * 48 - 120)) \
+		$testdir/file2 $((blksz * 48 - 120)) 100 \
        || echo "End sections of 1-2 do not match"
 
-_compare_range  "$testdir/file2" $((blksz * 48 - 120)) \
-		"$testdir/file3" $((blksz * 48 - 120)) 100 \
+_compare_range  $testdir/file2 $((blksz * 48 - 120)) \
+		$testdir/file3 $((blksz * 48 - 120)) 100 \
        || echo "End sections of 2-3 do not match"
 
 
-_compare_range  "$testdir/file1" $((blksz * 14)) \
-		"$testdir/file2" $((blksz * 14)) $blksz \
+_compare_range  $testdir/file1 $((blksz * 14)) \
+		$testdir/file2 $((blksz * 14)) $blksz \
        || echo "Untouched sections of 1-2 do not match"
 
-_compare_range  "$testdir/file2" $((blksz * 14)) \
-		"$testdir/file3" $((blksz * 14)) $blksz \
+_compare_range  $testdir/file2 $((blksz * 14)) \
+		$testdir/file3 $((blksz * 14)) $blksz \
        || echo "Untouched sections of 2-3 do not match"
 
 # success, all done
diff --git a/tests/generic/142 b/tests/generic/142
index 2ac4d10..e9a2d5e 100755
--- a/tests/generic/142
+++ b/tests/generic/142
@@ -25,8 +25,8 @@
 # Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 #-----------------------------------------------------------------------
 
-seq=`basename "$0"`
-seqres="$RESULT_DIR/$seq"
+seq=`basename $0`
+seqres=$RESULT_DIR/$seq
 echo "QA output created by $seq"
 
 here=`pwd`
@@ -37,7 +37,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _cleanup()
 {
     cd /
-    rm -rf "$tmp".* "$testdir"
+    rm -rf $tmp.* $testdir
 }
 
 # get standard environment, filters and checks
@@ -50,41 +50,42 @@ _supported_os Linux
 _require_test_reflink
 _require_cp_reflink
 
-rm -f "$seqres.full"
+rm -f $seqres.full
 
-testdir="$TEST_DIR/test-$seq"
-rm -rf "$testdir"
-mkdir "$testdir"
+testdir=$TEST_DIR/test-$seq
+rm -rf $testdir
+mkdir $testdir
 
 echo "Create the original file blocks"
 blksz=65536
 nr=9
-_pwrite_byte 0x61 0 $((blksz * 256)) "$testdir/file1" >> "$seqres.full"
+filesize=$((blksz * nr))
+_pwrite_byte 0x61 0 $((blksz * 256)) $testdir/file1 >> $seqres.full
 _test_remount
 
-md5sum "$testdir/file1" | _filter_test_dir
-csum="$(_md5_checksum "$testdir/file1")"
+md5sum $testdir/file1 | _filter_test_dir
+csum=$(_md5_checksum $testdir/file1)
 
 echo "Create the reflink copies"
 seq 2 $nr | while read i; do
-	_cp_reflink "$testdir/file1" "$testdir/file$i"
+	_cp_reflink $testdir/file1 $testdir/file$i
 done
 _test_remount
 
 echo "Rewrite the copies"
 seq 2 $nr | while read i; do
-	_pwrite_byte 0x62 0 $((blksz * 256)) "$testdir/file$i" >> "$seqres.full"
+	_pwrite_byte 0x62 0 $((blksz * 256)) $testdir/file$i >> $seqres.full
 done
 _test_remount
 
 echo "Examine original file"
-md5sum "$testdir/file1" | _filter_test_dir
-md5sum "$testdir/file2" | _filter_test_dir
+md5sum $testdir/file1 | _filter_test_dir
+md5sum $testdir/file2 | _filter_test_dir
 
-mod_csum="$(_md5_checksum "$testdir/file2")"
-new_csum="$(_md5_checksum "$testdir/file1")"
-test "${csum}" != "${mod_csum}" || echo "checksums do not match"
-test "${csum}" = "${new_csum}" || echo "checksums do not match"
+mod_csum=$(_md5_checksum $testdir/file2)
+new_csum=$(_md5_checksum $testdir/file1)
+test ${csum} != ${mod_csum} || echo "checksums do not match"
+test ${csum} = ${new_csum} || echo "checksums do not match"
 
 # success, all done
 status=0
diff --git a/tests/generic/143 b/tests/generic/143
index c0bc672..586cf5c 100755
--- a/tests/generic/143
+++ b/tests/generic/143
@@ -25,8 +25,8 @@
 # Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 #-----------------------------------------------------------------------
 
-seq=`basename "$0"`
-seqres="$RESULT_DIR/$seq"
+seq=`basename $0`
+seqres=$RESULT_DIR/$seq
 echo "QA output created by $seq"
 
 here=`pwd`
@@ -37,7 +37,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _cleanup()
 {
     cd /
-    rm -rf "$tmp".* "$testdir"
+    rm -rf $tmp.* $testdir
 }
 
 # get standard environment, filters and checks
@@ -50,41 +50,42 @@ _supported_os Linux
 _require_test_reflink
 _require_cp_reflink
 
-rm -f "$seqres.full"
+rm -f $seqres.full
 
-testdir="$TEST_DIR/test-$seq"
-rm -rf "$testdir"
-mkdir "$testdir"
+testdir=$TEST_DIR/test-$seq
+rm -rf $testdir
+mkdir $testdir
 
 echo "Create the original file blocks"
 blksz=65536
 nr=9
-_pwrite_byte 0x61 0 $((blksz * 256)) "$testdir/file1" >> "$seqres.full"
+filesize=$((blksz * nr))
+_pwrite_byte 0x61 0 $((blksz * 256)) $testdir/file1 >> $seqres.full
 _test_remount
 
-md5sum "$testdir/file1" | _filter_test_dir
-csum="$(_md5_checksum "$testdir/file1")"
+md5sum $testdir/file1 | _filter_test_dir
+csum=$(_md5_checksum $testdir/file1)
 
 echo "Create the reflink copies"
 seq 2 $nr | while read i; do
-	_cp_reflink "$testdir/file1" "$testdir/file$i"
+	_cp_reflink $testdir/file1 $testdir/file$i
 done
 _test_remount
 
 echo "Rewrite the copies"
 seq 2 $nr | while read i; do
-	_pwrite_byte 0x62 0 $((blksz * 256)) "$testdir/file$i" -d >> "$seqres.full"
+	_pwrite_byte 0x62 0 $((blksz * 256)) $testdir/file$i -d >> $seqres.full
 done
 _test_remount
 
 echo "Examine original file"
-md5sum "$testdir/file1" | _filter_test_dir
-md5sum "$testdir/file2" | _filter_test_dir
+md5sum $testdir/file1 | _filter_test_dir
+md5sum $testdir/file2 | _filter_test_dir
 
-mod_csum="$(_md5_checksum "$testdir/file2")"
-new_csum="$(_md5_checksum "$testdir/file1")"
-test "${csum}" != "${mod_csum}" || echo "checksums do not match"
-test "${csum}" = "${new_csum}" || echo "checksums do not match"
+mod_csum=$(_md5_checksum $testdir/file2)
+new_csum=$(_md5_checksum $testdir/file1)
+test ${csum} != ${mod_csum} || echo "checksums do not match"
+test ${csum} = ${new_csum} || echo "checksums do not match"
 
 # success, all done
 status=0
diff --git a/tests/generic/144 b/tests/generic/144
index 631fa33..71020ab 100755
--- a/tests/generic/144
+++ b/tests/generic/144
@@ -23,8 +23,8 @@
 # Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 #-----------------------------------------------------------------------
 
-seq=`basename "$0"`
-seqres="$RESULT_DIR/$seq"
+seq=`basename $0`
+seqres=$RESULT_DIR/$seq
 echo "QA output created by $seq"
 
 here=`pwd`
@@ -35,7 +35,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _cleanup()
 {
     cd /
-    rm -rf "$tmp".* "$testdir"
+    rm -rf $tmp.* $testdir
 }
 
 # get standard environment, filters and checks
@@ -50,92 +50,92 @@ _require_cp_reflink
 _require_xfs_io_command "falloc"
 _require_xfs_io_command "truncate"
 
-rm -f "$seqres.full"
+rm -f $seqres.full
 
-testdir="$TEST_DIR/test-$seq"
-rm -rf "$testdir"
-mkdir "$testdir"
+testdir=$TEST_DIR/test-$seq
+rm -rf $testdir
+mkdir $testdir
 
 echo "Create the original files"
 blksz=65536
-_pwrite_byte 0x61 0 $((blksz * 5 + 37)) "$testdir/file1" >> "$seqres.full"
+_pwrite_byte 0x61 0 $((blksz * 5 + 37)) $testdir/file1 >> $seqres.full
 
-_reflink_range "$testdir/file1" $blksz "$testdir/file2" $blksz \
-		$((blksz * 4 + 37)) >> "$seqres.full"
+_reflink_range $testdir/file1 $blksz $testdir/file2 $blksz \
+		$((blksz * 4 + 37)) >> $seqres.full
 
-"$XFS_IO_PROG" -f -c "truncate $((blksz * 5 + 37))" "$testdir/file3" >> "$seqres.full"
-_reflink_range "$testdir/file1" 0 "$testdir/file3" 0 $blksz >> "$seqres.full"
+$XFS_IO_PROG -f -c "truncate $((blksz * 5 + 37))" $testdir/file3 >> $seqres.full
+_reflink_range $testdir/file1 0 $testdir/file3 0 $blksz >> $seqres.full
 
-"$XFS_IO_PROG" -f -c "truncate $((blksz * 5 + 37))" "$testdir/file4" >> "$seqres.full"
-_reflink_range "$testdir/file1" $blksz "$testdir/file4" $blksz $blksz >> "$seqres.full"
-_reflink_range "$testdir/file1" $((blksz * 3)) "$testdir/file4" $((blksz * 3)) \
-		$blksz >> "$seqres.full"
+$XFS_IO_PROG -f -c "truncate $((blksz * 5 + 37))" $testdir/file4 >> $seqres.full
+_reflink_range $testdir/file1 $blksz $testdir/file4 $blksz $blksz >> $seqres.full
+_reflink_range $testdir/file1 $((blksz * 3)) $testdir/file4 $((blksz * 3)) \
+		$blksz >> $seqres.full
 
-_cp_reflink "$testdir/file1" "$testdir/file5"
+_cp_reflink $testdir/file1 $testdir/file5
 _test_remount
 
 echo "Compare sections"
-md5sum "$testdir/file1" | _filter_test_dir
-md5sum "$testdir/file2" | _filter_test_dir
-md5sum "$testdir/file3" | _filter_test_dir
-md5sum "$testdir/file4" | _filter_test_dir
-md5sum "$testdir/file5" | _filter_test_dir
+md5sum $testdir/file1 | _filter_test_dir
+md5sum $testdir/file2 | _filter_test_dir
+md5sum $testdir/file3 | _filter_test_dir
+md5sum $testdir/file4 | _filter_test_dir
+md5sum $testdir/file5 | _filter_test_dir
 
-_compare_range "$testdir/file1" $blksz "$testdir/file2" $blksz \
+_compare_range $testdir/file1 $blksz $testdir/file2 $blksz \
 		$((blksz * 4 + 37)) \
 	|| echo "shared parts of files 1-2 changed"
 
-_compare_range "$testdir/file1" 0 "$testdir/file3" 0 $blksz \
+_compare_range $testdir/file1 0 $testdir/file3 0 $blksz \
 	|| echo "shared parts of files 1-3 changed"
 
-_compare_range "$testdir/file1" $blksz "$testdir/file4" $blksz $blksz \
+_compare_range $testdir/file1 $blksz $testdir/file4 $blksz $blksz \
 	|| echo "shared parts of files 1-4 changed"
 
-_compare_range "$testdir/file1" 0 "$testdir/file5" 0 $((blksz * 5 + 37)) \
+_compare_range $testdir/file1 0 $testdir/file5 0 $((blksz * 5 + 37)) \
 	|| echo "shared parts of files 1-5 changed"
 
 echo "Compare files"
-c1="$(_md5_checksum "$testdir/file1")"
-c2="$(_md5_checksum "$testdir/file2")"
-c3="$(_md5_checksum "$testdir/file3")"
-c4="$(_md5_checksum "$testdir/file4")"
-c5="$(_md5_checksum "$testdir/file5")"
-
-test "${c1}" != "${c2}" || echo "file1 and file2 should not match"
-test "${c1}" != "${c3}" || echo "file1 and file3 should not match"
-test "${c1}" != "${c4}" || echo "file1 and file4 should not match"
-test "${c1}"  = "${c5}" || echo "file1 and file5 should match"
-test "${c2}" != "${c3}" || echo "file2 and file3 should not match"
-test "${c2}" != "${c4}" || echo "file2 and file4 should not match"
-test "${c2}" != "${c5}" || echo "file2 and file5 should not match"
-test "${c3}" != "${c4}" || echo "file3 and file4 should not match"
-test "${c3}" != "${c5}" || echo "file3 and file5 should not match"
-test "${c4}" != "${c5}" || echo "file4 and file5 should not match"
+c1=$(_md5_checksum $testdir/file1)
+c2=$(_md5_checksum $testdir/file2)
+c3=$(_md5_checksum $testdir/file3)
+c4=$(_md5_checksum $testdir/file4)
+c5=$(_md5_checksum $testdir/file5)
+
+test ${c1} != ${c2} || echo "file1 and file2 should not match"
+test ${c1} != ${c3} || echo "file1 and file3 should not match"
+test ${c1} != ${c4} || echo "file1 and file4 should not match"
+test ${c1}  = ${c5} || echo "file1 and file5 should match"
+test ${c2} != ${c3} || echo "file2 and file3 should not match"
+test ${c2} != ${c4} || echo "file2 and file4 should not match"
+test ${c2} != ${c5} || echo "file2 and file5 should not match"
+test ${c3} != ${c4} || echo "file3 and file4 should not match"
+test ${c3} != ${c5} || echo "file3 and file5 should not match"
+test ${c4} != ${c5} || echo "file4 and file5 should not match"
 
 echo "falloc everything"
-"$XFS_IO_PROG" -f -c "falloc 0 $((blksz * 5))" "$testdir/file2" >> "$seqres.full"
-"$XFS_IO_PROG" -f -c "falloc 0 $((blksz * 5))" "$testdir/file3" >> "$seqres.full"
-"$XFS_IO_PROG" -f -c "falloc 0 $((blksz * 5))" "$testdir/file4" >> "$seqres.full"
+$XFS_IO_PROG -f -c "falloc 0 $((blksz * 5))" $testdir/file2 >> $seqres.full
+$XFS_IO_PROG -f -c "falloc 0 $((blksz * 5))" $testdir/file3 >> $seqres.full
+$XFS_IO_PROG -f -c "falloc 0 $((blksz * 5))" $testdir/file4 >> $seqres.full
 _test_remount
 
 echo "Compare files"
-md5sum "$testdir/file1" | _filter_test_dir
-md5sum "$testdir/file2" | _filter_test_dir
-md5sum "$testdir/file3" | _filter_test_dir
-md5sum "$testdir/file4" | _filter_test_dir
-md5sum "$testdir/file5" | _filter_test_dir
-
-d1="$(_md5_checksum "$testdir/file1")"
-d2="$(_md5_checksum "$testdir/file2")"
-d3="$(_md5_checksum "$testdir/file3")"
-d4="$(_md5_checksum "$testdir/file4")"
-d5="$(_md5_checksum "$testdir/file5")"
-
-test "${c1}" = "${d1}" || echo "file1 should not change"
-test "${c2}" = "${d2}" || echo "file2 should not change"
-test "${c3}" = "${d3}" || echo "file3 should not change"
-test "${c4}" = "${d4}" || echo "file4 should not change"
-test "${c5}" = "${d5}" || echo "file2 should not change"
+md5sum $testdir/file1 | _filter_test_dir
+md5sum $testdir/file2 | _filter_test_dir
+md5sum $testdir/file3 | _filter_test_dir
+md5sum $testdir/file4 | _filter_test_dir
+md5sum $testdir/file5 | _filter_test_dir
+
+d1=$(_md5_checksum $testdir/file1)
+d2=$(_md5_checksum $testdir/file2)
+d3=$(_md5_checksum $testdir/file3)
+d4=$(_md5_checksum $testdir/file4)
+d5=$(_md5_checksum $testdir/file5)
+
+test ${c1} = ${d1} || echo "file1 should not change"
+test ${c2} = ${d2} || echo "file2 should not change"
+test ${c3} = ${d3} || echo "file3 should not change"
+test ${c4} = ${d4} || echo "file4 should not change"
+test ${c5} = ${d5} || echo "file2 should not change"
 
 # success, all done
 status=0
diff --git a/tests/generic/145 b/tests/generic/145
index 2b8d74f..dac2b27 100755
--- a/tests/generic/145
+++ b/tests/generic/145
@@ -24,8 +24,8 @@
 # Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 #-----------------------------------------------------------------------
 
-seq=`basename "$0"`
-seqres="$RESULT_DIR/$seq"
+seq=`basename $0`
+seqres=$RESULT_DIR/$seq
 echo "QA output created by $seq"
 
 here=`pwd`
@@ -36,7 +36,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _cleanup()
 {
     cd /
-    rm -rf "$tmp".* "$testdir"
+    rm -rf $tmp.* $testdir
 }
 
 # get standard environment, filters and checks
@@ -51,91 +51,91 @@ _require_cp_reflink
 _require_xfs_io_command "falloc"
 _require_xfs_io_command "fcollapse"
 
-rm -f "$seqres.full"
+rm -f $seqres.full
 
-testdir="$TEST_DIR/test-$seq"
-rm -rf "$testdir"
-mkdir "$testdir"
+testdir=$TEST_DIR/test-$seq
+rm -rf $testdir
+mkdir $testdir
 
 echo "Create the original files"
 blksz=65536
-_pwrite_byte 0x61 0 $blksz "$testdir/file1" >> "$seqres.full"
-_pwrite_byte 0x62 $blksz $blksz "$testdir/file1" >> "$seqres.full"
-_pwrite_byte 0x63 $((blksz * 2)) $blksz "$testdir/file1" >> "$seqres.full"
-
-_cp_reflink "$testdir/file1" "$testdir/file2"
-_cp_reflink "$testdir/file1" "$testdir/file3"
-_cp_reflink "$testdir/file1" "$testdir/file4"
-
-"$XFS_IO_PROG" -f -c "falloc 0 $((blksz * 4))" "$testdir/file1"
-"$XFS_IO_PROG" -f -c "falloc 0 $((blksz * 4))" "$testdir/file2"
-"$XFS_IO_PROG" -f -c "falloc 0 $((blksz * 4))" "$testdir/file3"
-"$XFS_IO_PROG" -f -c "falloc 0 $((blksz * 4))" "$testdir/file4"
-
-_pwrite_byte 0x62 0 $blksz "$testdir/file2.chk" >> "$seqres.full"
-_pwrite_byte 0x63 $blksz $blksz "$testdir/file2.chk" >> "$seqres.full"
-_pwrite_byte 0x00 $((blksz * 2)) $blksz "$testdir/file2.chk" >> "$seqres.full"
-
-_pwrite_byte 0x61 0 $blksz "$testdir/file3.chk" >> "$seqres.full"
-_pwrite_byte 0x63 $blksz $blksz "$testdir/file3.chk" >> "$seqres.full"
-_pwrite_byte 0x00 $((blksz * 2)) $blksz "$testdir/file3.chk" >> "$seqres.full"
-
-_pwrite_byte 0x61 0 $blksz "$testdir/file4.chk" >> "$seqres.full"
-_pwrite_byte 0x62 $blksz $blksz "$testdir/file4.chk" >> "$seqres.full"
-_pwrite_byte 0x00 $((blksz * 2)) $blksz "$testdir/file4.chk" >> "$seqres.full"
+_pwrite_byte 0x61 0 $blksz $testdir/file1 >> $seqres.full
+_pwrite_byte 0x62 $blksz $blksz $testdir/file1 >> $seqres.full
+_pwrite_byte 0x63 $((blksz * 2)) $blksz $testdir/file1 >> $seqres.full
+
+_cp_reflink $testdir/file1 $testdir/file2
+_cp_reflink $testdir/file1 $testdir/file3
+_cp_reflink $testdir/file1 $testdir/file4
+
+$XFS_IO_PROG -f -c "falloc 0 $((blksz * 4))" $testdir/file1
+$XFS_IO_PROG -f -c "falloc 0 $((blksz * 4))" $testdir/file2
+$XFS_IO_PROG -f -c "falloc 0 $((blksz * 4))" $testdir/file3
+$XFS_IO_PROG -f -c "falloc 0 $((blksz * 4))" $testdir/file4
+
+_pwrite_byte 0x62 0 $blksz $testdir/file2.chk >> $seqres.full
+_pwrite_byte 0x63 $blksz $blksz $testdir/file2.chk >> $seqres.full
+_pwrite_byte 0x00 $((blksz * 2)) $blksz $testdir/file2.chk >> $seqres.full
+
+_pwrite_byte 0x61 0 $blksz $testdir/file3.chk >> $seqres.full
+_pwrite_byte 0x63 $blksz $blksz $testdir/file3.chk >> $seqres.full
+_pwrite_byte 0x00 $((blksz * 2)) $blksz $testdir/file3.chk >> $seqres.full
+
+_pwrite_byte 0x61 0 $blksz $testdir/file4.chk >> $seqres.full
+_pwrite_byte 0x62 $blksz $blksz $testdir/file4.chk >> $seqres.full
+_pwrite_byte 0x00 $((blksz * 2)) $blksz $testdir/file4.chk >> $seqres.full
 _test_remount
 
-md5sum "$testdir/file1" | _filter_test_dir
-md5sum "$testdir/file2" | _filter_test_dir
-md5sum "$testdir/file3" | _filter_test_dir
-md5sum "$testdir/file4" | _filter_test_dir
-md5sum "$testdir/file2.chk" | _filter_test_dir
-md5sum "$testdir/file3.chk" | _filter_test_dir
-md5sum "$testdir/file4.chk" | _filter_test_dir
-
-c1="$(_md5_checksum "$testdir/file1")"
-c2="$(_md5_checksum "$testdir/file2")"
-c3="$(_md5_checksum "$testdir/file3")"
-c4="$(_md5_checksum "$testdir/file4")"
-
-test "${c1}" = "${c2}" || echo "file1 and file2 should match"
-test "${c1}" = "${c3}" || echo "file1 and file3 should match"
-test "${c1}" = "${c4}" || echo "file1 and file4 should match"
-test "${c2}" = "${c3}" || echo "file2 and file3 should match"
-test "${c2}" = "${c4}" || echo "file2 and file4 should match"
-test "${c3}" = "${c4}" || echo "file3 and file4 should match"
+md5sum $testdir/file1 | _filter_test_dir
+md5sum $testdir/file2 | _filter_test_dir
+md5sum $testdir/file3 | _filter_test_dir
+md5sum $testdir/file4 | _filter_test_dir
+md5sum $testdir/file2.chk | _filter_test_dir
+md5sum $testdir/file3.chk | _filter_test_dir
+md5sum $testdir/file4.chk | _filter_test_dir
+
+c1=$(_md5_checksum $testdir/file1)
+c2=$(_md5_checksum $testdir/file2)
+c3=$(_md5_checksum $testdir/file3)
+c4=$(_md5_checksum $testdir/file4)
+
+test ${c1} = ${c2} || echo "file1 and file2 should match"
+test ${c1} = ${c3} || echo "file1 and file3 should match"
+test ${c1} = ${c4} || echo "file1 and file4 should match"
+test ${c2} = ${c3} || echo "file2 and file3 should match"
+test ${c2} = ${c4} || echo "file2 and file4 should match"
+test ${c3} = ${c4} || echo "file3 and file4 should match"
 
 echo "fcollapse files"
-"$XFS_IO_PROG" -f -c "fcollapse 0 $blksz" "$testdir/file2"
-"$XFS_IO_PROG" -f -c "fcollapse $blksz $blksz" "$testdir/file3"
-"$XFS_IO_PROG" -f -c "fcollapse $((blksz * 2)) $blksz" "$testdir/file4"
+$XFS_IO_PROG -f -c "fcollapse 0 $blksz" $testdir/file2
+$XFS_IO_PROG -f -c "fcollapse $blksz $blksz" $testdir/file3
+$XFS_IO_PROG -f -c "fcollapse $((blksz * 2)) $blksz" $testdir/file4
 _test_remount
 
 echo "Compare files"
-md5sum "$testdir/file1" | _filter_test_dir
-md5sum "$testdir/file2" | _filter_test_dir
-md5sum "$testdir/file3" | _filter_test_dir
-md5sum "$testdir/file4" | _filter_test_dir
-md5sum "$testdir/file2.chk" | _filter_test_dir
-md5sum "$testdir/file3.chk" | _filter_test_dir
-md5sum "$testdir/file4.chk" | _filter_test_dir
-
-c1="$(_md5_checksum "$testdir/file1")"
-c2="$(_md5_checksum "$testdir/file2")"
-c3="$(_md5_checksum "$testdir/file3")"
-c4="$(_md5_checksum "$testdir/file4")"
-
-test "${c1}" != "${c2}" || echo "file1 and file2 should not match"
-test "${c1}" != "${c3}" || echo "file1 and file3 should not match"
-test "${c1}" != "${c4}" || echo "file1 and file4 should not match"
-test "${c2}" != "${c3}" || echo "file2 and file3 should not match"
-test "${c2}" != "${c4}" || echo "file2 and file4 should not match"
-test "${c3}" != "${c4}" || echo "file3 and file4 should not match"
+md5sum $testdir/file1 | _filter_test_dir
+md5sum $testdir/file2 | _filter_test_dir
+md5sum $testdir/file3 | _filter_test_dir
+md5sum $testdir/file4 | _filter_test_dir
+md5sum $testdir/file2.chk | _filter_test_dir
+md5sum $testdir/file3.chk | _filter_test_dir
+md5sum $testdir/file4.chk | _filter_test_dir
+
+c1=$(_md5_checksum $testdir/file1)
+c2=$(_md5_checksum $testdir/file2)
+c3=$(_md5_checksum $testdir/file3)
+c4=$(_md5_checksum $testdir/file4)
+
+test ${c1} != ${c2} || echo "file1 and file2 should not match"
+test ${c1} != ${c3} || echo "file1 and file3 should not match"
+test ${c1} != ${c4} || echo "file1 and file4 should not match"
+test ${c2} != ${c3} || echo "file2 and file3 should not match"
+test ${c2} != ${c4} || echo "file2 and file4 should not match"
+test ${c3} != ${c4} || echo "file3 and file4 should not match"
 
 echo "Compare against check files"
-cmp -s "$testdir/file2" "$testdir/file2.chk" || echo "file2 and file2.chk do not match"
-cmp -s "$testdir/file3" "$testdir/file3.chk" || echo "file3 and file3.chk do not match"
-cmp -s "$testdir/file4" "$testdir/file4.chk" || echo "file4 and file4.chk do not match"
+cmp -s $testdir/file2 $testdir/file2.chk || echo "file2 and file2.chk do not match"
+cmp -s $testdir/file3 $testdir/file3.chk || echo "file3 and file3.chk do not match"
+cmp -s $testdir/file4 $testdir/file4.chk || echo "file4 and file4.chk do not match"
 
 # success, all done
 status=0
diff --git a/tests/generic/146 b/tests/generic/146
index 17dc306..98f0621 100755
--- a/tests/generic/146
+++ b/tests/generic/146
@@ -24,8 +24,8 @@
 # Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 #-----------------------------------------------------------------------
 
-seq=`basename "$0"`
-seqres="$RESULT_DIR/$seq"
+seq=`basename $0`
+seqres=$RESULT_DIR/$seq
 echo "QA output created by $seq"
 
 here=`pwd`
@@ -36,7 +36,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _cleanup()
 {
     cd /
-    rm -rf "$tmp".* "$testdir"
+    rm -rf $tmp.* $testdir
 }
 
 # get standard environment, filters and checks
@@ -50,86 +50,86 @@ _require_test_reflink
 _require_cp_reflink
 _require_xfs_io_command "fpunch"
 
-rm -f "$seqres.full"
+rm -f $seqres.full
 
-testdir="$TEST_DIR/test-$seq"
-rm -rf "$testdir"
-mkdir "$testdir"
+testdir=$TEST_DIR/test-$seq
+rm -rf $testdir
+mkdir $testdir
 
 echo "Create the original files"
 blksz=65536
-_pwrite_byte 0x61 0 $blksz "$testdir/file1" >> "$seqres.full"
-_pwrite_byte 0x62 $blksz $blksz "$testdir/file1" >> "$seqres.full"
-_pwrite_byte 0x63 $((blksz * 2)) $blksz "$testdir/file1" >> "$seqres.full"
+_pwrite_byte 0x61 0 $blksz $testdir/file1 >> $seqres.full
+_pwrite_byte 0x62 $blksz $blksz $testdir/file1 >> $seqres.full
+_pwrite_byte 0x63 $((blksz * 2)) $blksz $testdir/file1 >> $seqres.full
 
-_cp_reflink "$testdir/file1" "$testdir/file2"
-_cp_reflink "$testdir/file1" "$testdir/file3"
-_cp_reflink "$testdir/file1" "$testdir/file4"
+_cp_reflink $testdir/file1 $testdir/file2
+_cp_reflink $testdir/file1 $testdir/file3
+_cp_reflink $testdir/file1 $testdir/file4
 
-_pwrite_byte 0x00 0 $blksz "$testdir/file2.chk" >> "$seqres.full"
-_pwrite_byte 0x62 $blksz $blksz "$testdir/file2.chk" >> "$seqres.full"
-_pwrite_byte 0x63 $((blksz * 2)) $blksz "$testdir/file2.chk" >> "$seqres.full"
+_pwrite_byte 0x00 0 $blksz $testdir/file2.chk >> $seqres.full
+_pwrite_byte 0x62 $blksz $blksz $testdir/file2.chk >> $seqres.full
+_pwrite_byte 0x63 $((blksz * 2)) $blksz $testdir/file2.chk >> $seqres.full
 
-_pwrite_byte 0x61 0 $blksz "$testdir/file3.chk" >> "$seqres.full"
-_pwrite_byte 0x00 $blksz $blksz "$testdir/file3.chk" >> "$seqres.full"
-_pwrite_byte 0x63 $((blksz * 2)) $blksz "$testdir/file3.chk" >> "$seqres.full"
+_pwrite_byte 0x61 0 $blksz $testdir/file3.chk >> $seqres.full
+_pwrite_byte 0x00 $blksz $blksz $testdir/file3.chk >> $seqres.full
+_pwrite_byte 0x63 $((blksz * 2)) $blksz $testdir/file3.chk >> $seqres.full
 
-_pwrite_byte 0x61 0 $blksz "$testdir/file4.chk" >> "$seqres.full"
-_pwrite_byte 0x62 $blksz $blksz "$testdir/file4.chk" >> "$seqres.full"
-_pwrite_byte 0x00 $((blksz * 2)) $blksz "$testdir/file4.chk" >> "$seqres.full"
+_pwrite_byte 0x61 0 $blksz $testdir/file4.chk >> $seqres.full
+_pwrite_byte 0x62 $blksz $blksz $testdir/file4.chk >> $seqres.full
+_pwrite_byte 0x00 $((blksz * 2)) $blksz $testdir/file4.chk >> $seqres.full
 _test_remount
 
-md5sum "$testdir/file1" | _filter_test_dir
-md5sum "$testdir/file2" | _filter_test_dir
-md5sum "$testdir/file3" | _filter_test_dir
-md5sum "$testdir/file4" | _filter_test_dir
-md5sum "$testdir/file2.chk" | _filter_test_dir
-md5sum "$testdir/file3.chk" | _filter_test_dir
-md5sum "$testdir/file4.chk" | _filter_test_dir
-
-c1="$(_md5_checksum "$testdir/file1")"
-c2="$(_md5_checksum "$testdir/file2")"
-c3="$(_md5_checksum "$testdir/file3")"
-c4="$(_md5_checksum "$testdir/file4")"
-
-test "${c1}" = "${c2}" || echo "file1 and file2 should match"
-test "${c1}" = "${c3}" || echo "file1 and file3 should match"
-test "${c1}" = "${c4}" || echo "file1 and file4 should match"
-test "${c2}" = "${c3}" || echo "file2 and file3 should match"
-test "${c2}" = "${c4}" || echo "file2 and file4 should match"
-test "${c3}" = "${c4}" || echo "file3 and file4 should match"
+md5sum $testdir/file1 | _filter_test_dir
+md5sum $testdir/file2 | _filter_test_dir
+md5sum $testdir/file3 | _filter_test_dir
+md5sum $testdir/file4 | _filter_test_dir
+md5sum $testdir/file2.chk | _filter_test_dir
+md5sum $testdir/file3.chk | _filter_test_dir
+md5sum $testdir/file4.chk | _filter_test_dir
+
+c1=$(_md5_checksum $testdir/file1)
+c2=$(_md5_checksum $testdir/file2)
+c3=$(_md5_checksum $testdir/file3)
+c4=$(_md5_checksum $testdir/file4)
+
+test ${c1} = ${c2} || echo "file1 and file2 should match"
+test ${c1} = ${c3} || echo "file1 and file3 should match"
+test ${c1} = ${c4} || echo "file1 and file4 should match"
+test ${c2} = ${c3} || echo "file2 and file3 should match"
+test ${c2} = ${c4} || echo "file2 and file4 should match"
+test ${c3} = ${c4} || echo "file3 and file4 should match"
 
 echo "fpunch files"
-"$XFS_IO_PROG" -f -c "fpunch 0 $blksz" "$testdir/file2"
-"$XFS_IO_PROG" -f -c "fpunch $blksz $blksz" "$testdir/file3"
-"$XFS_IO_PROG" -f -c "fpunch $((blksz * 2)) $blksz" "$testdir/file4"
+$XFS_IO_PROG -f -c "fpunch 0 $blksz" $testdir/file2
+$XFS_IO_PROG -f -c "fpunch $blksz $blksz" $testdir/file3
+$XFS_IO_PROG -f -c "fpunch $((blksz * 2)) $blksz" $testdir/file4
 _test_remount
 
 echo "Compare files"
-md5sum "$testdir/file1" | _filter_test_dir
-md5sum "$testdir/file2" | _filter_test_dir
-md5sum "$testdir/file3" | _filter_test_dir
-md5sum "$testdir/file4" | _filter_test_dir
-md5sum "$testdir/file2.chk" | _filter_test_dir
-md5sum "$testdir/file3.chk" | _filter_test_dir
-md5sum "$testdir/file4.chk" | _filter_test_dir
-
-c1="$(_md5_checksum "$testdir/file1")"
-c2="$(_md5_checksum "$testdir/file2")"
-c3="$(_md5_checksum "$testdir/file3")"
-c4="$(_md5_checksum "$testdir/file4")"
-
-test "${c1}" != "${c2}" || echo "file1 and file2 should not match"
-test "${c1}" != "${c3}" || echo "file1 and file3 should not match"
-test "${c1}" != "${c4}" || echo "file1 and file4 should not match"
-test "${c2}" != "${c3}" || echo "file2 and file3 should not match"
-test "${c2}" != "${c4}" || echo "file2 and file4 should not match"
-test "${c3}" != "${c4}" || echo "file3 and file4 should not match"
+md5sum $testdir/file1 | _filter_test_dir
+md5sum $testdir/file2 | _filter_test_dir
+md5sum $testdir/file3 | _filter_test_dir
+md5sum $testdir/file4 | _filter_test_dir
+md5sum $testdir/file2.chk | _filter_test_dir
+md5sum $testdir/file3.chk | _filter_test_dir
+md5sum $testdir/file4.chk | _filter_test_dir
+
+c1=$(_md5_checksum $testdir/file1)
+c2=$(_md5_checksum $testdir/file2)
+c3=$(_md5_checksum $testdir/file3)
+c4=$(_md5_checksum $testdir/file4)
+
+test ${c1} != ${c2} || echo "file1 and file2 should not match"
+test ${c1} != ${c3} || echo "file1 and file3 should not match"
+test ${c1} != ${c4} || echo "file1 and file4 should not match"
+test ${c2} != ${c3} || echo "file2 and file3 should not match"
+test ${c2} != ${c4} || echo "file2 and file4 should not match"
+test ${c3} != ${c4} || echo "file3 and file4 should not match"
 
 echo "Compare against check files"
-cmp -s "$testdir/file2" "$testdir/file2.chk" || echo "file2 and file2.chk do not match"
-cmp -s "$testdir/file3" "$testdir/file3.chk" || echo "file3 and file3.chk do not match"
-cmp -s "$testdir/file4" "$testdir/file4.chk" || echo "file4 and file4.chk do not match"
+cmp -s $testdir/file2 $testdir/file2.chk || echo "file2 and file2.chk do not match"
+cmp -s $testdir/file3 $testdir/file3.chk || echo "file3 and file3.chk do not match"
+cmp -s $testdir/file4 $testdir/file4.chk || echo "file4 and file4.chk do not match"
 
 # success, all done
 status=0
diff --git a/tests/generic/147 b/tests/generic/147
index b160131..8706f83 100755
--- a/tests/generic/147
+++ b/tests/generic/147
@@ -24,8 +24,8 @@
 # Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 #-----------------------------------------------------------------------
 
-seq=`basename "$0"`
-seqres="$RESULT_DIR/$seq"
+seq=`basename $0`
+seqres=$RESULT_DIR/$seq
 echo "QA output created by $seq"
 
 here=`pwd`
@@ -36,7 +36,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _cleanup()
 {
     cd /
-    rm -rf "$tmp".* "$testdir"
+    rm -rf $tmp.* $testdir
 }
 
 # get standard environment, filters and checks
@@ -50,89 +50,89 @@ _require_test_reflink
 _require_cp_reflink
 _require_xfs_io_command "finsert"
 
-rm -f "$seqres.full"
+rm -f $seqres.full
 
-testdir="$TEST_DIR/test-$seq"
-rm -rf "$testdir"
-mkdir "$testdir"
+testdir=$TEST_DIR/test-$seq
+rm -rf $testdir
+mkdir $testdir
 
 echo "Create the original files"
 blksz=65536
-_pwrite_byte 0x61 0 $blksz "$testdir/file1" >> "$seqres.full"
-_pwrite_byte 0x62 $blksz $blksz "$testdir/file1" >> "$seqres.full"
-_pwrite_byte 0x63 $((blksz * 2)) $blksz "$testdir/file1" >> "$seqres.full"
-
-_cp_reflink "$testdir/file1" "$testdir/file2"
-_cp_reflink "$testdir/file1" "$testdir/file3"
-_cp_reflink "$testdir/file1" "$testdir/file4"
-
-_pwrite_byte 0x00 0 $blksz "$testdir/file2.chk" >> "$seqres.full"
-_pwrite_byte 0x61 $blksz $blksz "$testdir/file2.chk" >> "$seqres.full"
-_pwrite_byte 0x62 $((blksz * 2)) $blksz "$testdir/file2.chk" >> "$seqres.full"
-_pwrite_byte 0x63 $((blksz * 3)) $blksz "$testdir/file2.chk" >> "$seqres.full"
-
-_pwrite_byte 0x61 0 $blksz "$testdir/file3.chk" >> "$seqres.full"
-_pwrite_byte 0x00 $blksz $blksz "$testdir/file3.chk" >> "$seqres.full"
-_pwrite_byte 0x62 $((blksz * 2)) $blksz "$testdir/file3.chk" >> "$seqres.full"
-_pwrite_byte 0x63 $((blksz * 3)) $blksz "$testdir/file3.chk" >> "$seqres.full"
-
-_pwrite_byte 0x61 0 $blksz "$testdir/file4.chk" >> "$seqres.full"
-_pwrite_byte 0x62 $blksz $blksz "$testdir/file4.chk" >> "$seqres.full"
-_pwrite_byte 0x00 $((blksz * 2)) $blksz "$testdir/file4.chk" >> "$seqres.full"
-_pwrite_byte 0x63 $((blksz * 3)) $blksz "$testdir/file4.chk" >> "$seqres.full"
+_pwrite_byte 0x61 0 $blksz $testdir/file1 >> $seqres.full
+_pwrite_byte 0x62 $blksz $blksz $testdir/file1 >> $seqres.full
+_pwrite_byte 0x63 $((blksz * 2)) $blksz $testdir/file1 >> $seqres.full
+
+_cp_reflink $testdir/file1 $testdir/file2
+_cp_reflink $testdir/file1 $testdir/file3
+_cp_reflink $testdir/file1 $testdir/file4
+
+_pwrite_byte 0x00 0 $blksz $testdir/file2.chk >> $seqres.full
+_pwrite_byte 0x61 $blksz $blksz $testdir/file2.chk >> $seqres.full
+_pwrite_byte 0x62 $((blksz * 2)) $blksz $testdir/file2.chk >> $seqres.full
+_pwrite_byte 0x63 $((blksz * 3)) $blksz $testdir/file2.chk >> $seqres.full
+
+_pwrite_byte 0x61 0 $blksz $testdir/file3.chk >> $seqres.full
+_pwrite_byte 0x00 $blksz $blksz $testdir/file3.chk >> $seqres.full
+_pwrite_byte 0x62 $((blksz * 2)) $blksz $testdir/file3.chk >> $seqres.full
+_pwrite_byte 0x63 $((blksz * 3)) $blksz $testdir/file3.chk >> $seqres.full
+
+_pwrite_byte 0x61 0 $blksz $testdir/file4.chk >> $seqres.full
+_pwrite_byte 0x62 $blksz $blksz $testdir/file4.chk >> $seqres.full
+_pwrite_byte 0x00 $((blksz * 2)) $blksz $testdir/file4.chk >> $seqres.full
+_pwrite_byte 0x63 $((blksz * 3)) $blksz $testdir/file4.chk >> $seqres.full
 _test_remount
 
-md5sum "$testdir/file1" | _filter_test_dir
-md5sum "$testdir/file2" | _filter_test_dir
-md5sum "$testdir/file3" | _filter_test_dir
-md5sum "$testdir/file4" | _filter_test_dir
-md5sum "$testdir/file2.chk" | _filter_test_dir
-md5sum "$testdir/file3.chk" | _filter_test_dir
-md5sum "$testdir/file4.chk" | _filter_test_dir
-
-c1="$(_md5_checksum "$testdir/file1")"
-c2="$(_md5_checksum "$testdir/file2")"
-c3="$(_md5_checksum "$testdir/file3")"
-c4="$(_md5_checksum "$testdir/file4")"
-
-test "${c1}" = "${c2}" || echo "file1 and file2 should match"
-test "${c1}" = "${c3}" || echo "file1 and file3 should match"
-test "${c1}" = "${c4}" || echo "file1 and file4 should match"
-test "${c2}" = "${c3}" || echo "file2 and file3 should match"
-test "${c2}" = "${c4}" || echo "file2 and file4 should match"
-test "${c3}" = "${c4}" || echo "file3 and file4 should match"
+md5sum $testdir/file1 | _filter_test_dir
+md5sum $testdir/file2 | _filter_test_dir
+md5sum $testdir/file3 | _filter_test_dir
+md5sum $testdir/file4 | _filter_test_dir
+md5sum $testdir/file2.chk | _filter_test_dir
+md5sum $testdir/file3.chk | _filter_test_dir
+md5sum $testdir/file4.chk | _filter_test_dir
+
+c1=$(_md5_checksum $testdir/file1)
+c2=$(_md5_checksum $testdir/file2)
+c3=$(_md5_checksum $testdir/file3)
+c4=$(_md5_checksum $testdir/file4)
+
+test ${c1} = ${c2} || echo "file1 and file2 should match"
+test ${c1} = ${c3} || echo "file1 and file3 should match"
+test ${c1} = ${c4} || echo "file1 and file4 should match"
+test ${c2} = ${c3} || echo "file2 and file3 should match"
+test ${c2} = ${c4} || echo "file2 and file4 should match"
+test ${c3} = ${c4} || echo "file3 and file4 should match"
 
 echo "finsert files"
-"$XFS_IO_PROG" -f -c "finsert 0 $blksz" "$testdir/file2"
-"$XFS_IO_PROG" -f -c "finsert $blksz $blksz" "$testdir/file3"
-"$XFS_IO_PROG" -f -c "finsert $((blksz * 2)) $blksz" "$testdir/file4"
+$XFS_IO_PROG -f -c "finsert 0 $blksz" $testdir/file2
+$XFS_IO_PROG -f -c "finsert $blksz $blksz" $testdir/file3
+$XFS_IO_PROG -f -c "finsert $((blksz * 2)) $blksz" $testdir/file4
 _test_remount
 
 echo "Compare files"
-md5sum "$testdir/file1" | _filter_test_dir
-md5sum "$testdir/file2" | _filter_test_dir
-md5sum "$testdir/file3" | _filter_test_dir
-md5sum "$testdir/file4" | _filter_test_dir
-md5sum "$testdir/file2.chk" | _filter_test_dir
-md5sum "$testdir/file3.chk" | _filter_test_dir
-md5sum "$testdir/file4.chk" | _filter_test_dir
-
-c1="$(_md5_checksum "$testdir/file1")"
-c2="$(_md5_checksum "$testdir/file2")"
-c3="$(_md5_checksum "$testdir/file3")"
-c4="$(_md5_checksum "$testdir/file4")"
-
-test "${c1}" != "${c2}" || echo "file1 and file2 should not match"
-test "${c1}" != "${c3}" || echo "file1 and file3 should not match"
-test "${c1}" != "${c4}" || echo "file1 and file4 should not match"
-test "${c2}" != "${c3}" || echo "file2 and file3 should not match"
-test "${c2}" != "${c4}" || echo "file2 and file4 should not match"
-test "${c3}" != "${c4}" || echo "file3 and file4 should not match"
+md5sum $testdir/file1 | _filter_test_dir
+md5sum $testdir/file2 | _filter_test_dir
+md5sum $testdir/file3 | _filter_test_dir
+md5sum $testdir/file4 | _filter_test_dir
+md5sum $testdir/file2.chk | _filter_test_dir
+md5sum $testdir/file3.chk | _filter_test_dir
+md5sum $testdir/file4.chk | _filter_test_dir
+
+c1=$(_md5_checksum $testdir/file1)
+c2=$(_md5_checksum $testdir/file2)
+c3=$(_md5_checksum $testdir/file3)
+c4=$(_md5_checksum $testdir/file4)
+
+test ${c1} != ${c2} || echo "file1 and file2 should not match"
+test ${c1} != ${c3} || echo "file1 and file3 should not match"
+test ${c1} != ${c4} || echo "file1 and file4 should not match"
+test ${c2} != ${c3} || echo "file2 and file3 should not match"
+test ${c2} != ${c4} || echo "file2 and file4 should not match"
+test ${c3} != ${c4} || echo "file3 and file4 should not match"
 
 echo "Compare against check files"
-cmp -s "$testdir/file2" "$testdir/file2.chk" || echo "file2 and file2.chk do not match"
-cmp -s "$testdir/file3" "$testdir/file3.chk" || echo "file3 and file3.chk do not match"
-cmp -s "$testdir/file4" "$testdir/file4.chk" || echo "file4 and file4.chk do not match"
+cmp -s $testdir/file2 $testdir/file2.chk || echo "file2 and file2.chk do not match"
+cmp -s $testdir/file3 $testdir/file3.chk || echo "file3 and file3.chk do not match"
+cmp -s $testdir/file4 $testdir/file4.chk || echo "file4 and file4.chk do not match"
 
 # success, all done
 status=0
diff --git a/tests/generic/148 b/tests/generic/148
index cf5567b..af60ab8 100755
--- a/tests/generic/148
+++ b/tests/generic/148
@@ -25,8 +25,8 @@
 # Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 #-----------------------------------------------------------------------
 
-seq=`basename "$0"`
-seqres="$RESULT_DIR/$seq"
+seq=`basename $0`
+seqres=$RESULT_DIR/$seq
 echo "QA output created by $seq"
 
 here=`pwd`
@@ -37,7 +37,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _cleanup()
 {
     cd /
-    rm -rf "$tmp".* "$testdir"
+    rm -rf $tmp.* $testdir
 }
 
 # get standard environment, filters and checks
@@ -51,65 +51,65 @@ _require_test_reflink
 _require_cp_reflink
 _require_xfs_io_command "truncate"
 
-rm -f "$seqres.full"
+rm -f $seqres.full
 
-testdir="$TEST_DIR/test-$seq"
-rm -rf "$testdir"
-mkdir "$testdir"
+testdir=$TEST_DIR/test-$seq
+rm -rf $testdir
+mkdir $testdir
 
 echo "Create the original files"
 blksz=65536
-_pwrite_byte 0x61 0 $blksz "$testdir/file1" >> "$seqres.full"
-_pwrite_byte 0x62 $blksz 37 "$testdir/file1" >> "$seqres.full"
+_pwrite_byte 0x61 0 $blksz $testdir/file1 >> $seqres.full
+_pwrite_byte 0x62 $blksz 37 $testdir/file1 >> $seqres.full
 
-_cp_reflink "$testdir/file1" "$testdir/file2"
-_cp_reflink "$testdir/file1" "$testdir/file3"
+_cp_reflink $testdir/file1 $testdir/file2
+_cp_reflink $testdir/file1 $testdir/file3
 
-_pwrite_byte 0x61 0 $blksz "$testdir/file2.chk" >> "$seqres.full"
-_pwrite_byte 0x62 $blksz 34 "$testdir/file2.chk" >> "$seqres.full"
+_pwrite_byte 0x61 0 $blksz $testdir/file2.chk >> $seqres.full
+_pwrite_byte 0x62 $blksz 34 $testdir/file2.chk >> $seqres.full
 
-_pwrite_byte 0x61 0 $blksz "$testdir/file3.chk" >> "$seqres.full"
-_pwrite_byte 0x62 $blksz 37 "$testdir/file3.chk" >> "$seqres.full"
-_pwrite_byte 0x00 $((blksz + 37)) 3 "$testdir/file3.chk" >> "$seqres.full"
+_pwrite_byte 0x61 0 $blksz $testdir/file3.chk >> $seqres.full
+_pwrite_byte 0x62 $blksz 37 $testdir/file3.chk >> $seqres.full
+_pwrite_byte 0x00 $((blksz + 37)) 3 $testdir/file3.chk >> $seqres.full
 _test_remount
 
-md5sum "$testdir/file1" | _filter_test_dir
-md5sum "$testdir/file2" | _filter_test_dir
-md5sum "$testdir/file3" | _filter_test_dir
-md5sum "$testdir/file2.chk" | _filter_test_dir
-md5sum "$testdir/file3.chk" | _filter_test_dir
+md5sum $testdir/file1 | _filter_test_dir
+md5sum $testdir/file2 | _filter_test_dir
+md5sum $testdir/file3 | _filter_test_dir
+md5sum $testdir/file2.chk | _filter_test_dir
+md5sum $testdir/file3.chk | _filter_test_dir
 
-c1="$(_md5_checksum "$testdir/file1")"
-c2="$(_md5_checksum "$testdir/file2")"
-c3="$(_md5_checksum "$testdir/file3")"
+c1=$(_md5_checksum $testdir/file1)
+c2=$(_md5_checksum $testdir/file2)
+c3=$(_md5_checksum $testdir/file3)
 
-test "${c1}" = "${c2}" || echo "file1 and file2 should match"
-test "${c1}" = "${c3}" || echo "file1 and file3 should match"
-test "${c2}" = "${c3}" || echo "file2 and file3 should match"
+test ${c1} = ${c2} || echo "file1 and file2 should match"
+test ${c1} = ${c3} || echo "file1 and file3 should match"
+test ${c2} = ${c3} || echo "file2 and file3 should match"
 
 echo "truncate files"
-"$XFS_IO_PROG" -f -c "truncate $((blksz + 34))" "$testdir/file2"
-"$XFS_IO_PROG" -f -c "truncate $((blksz + 40))" "$testdir/file3"
+$XFS_IO_PROG -f -c "truncate $((blksz + 34))" $testdir/file2
+$XFS_IO_PROG -f -c "truncate $((blksz + 40))" $testdir/file3
 _test_remount
 
 echo "Compare files"
-md5sum "$testdir/file1" | _filter_test_dir
-md5sum "$testdir/file2" | _filter_test_dir
-md5sum "$testdir/file3" | _filter_test_dir
-md5sum "$testdir/file2.chk" | _filter_test_dir
-md5sum "$testdir/file3.chk" | _filter_test_dir
+md5sum $testdir/file1 | _filter_test_dir
+md5sum $testdir/file2 | _filter_test_dir
+md5sum $testdir/file3 | _filter_test_dir
+md5sum $testdir/file2.chk | _filter_test_dir
+md5sum $testdir/file3.chk | _filter_test_dir
 
-c1="$(_md5_checksum "$testdir/file1")"
-c2="$(_md5_checksum "$testdir/file2")"
-c3="$(_md5_checksum "$testdir/file3")"
+c1=$(_md5_checksum $testdir/file1)
+c2=$(_md5_checksum $testdir/file2)
+c3=$(_md5_checksum $testdir/file3)
 
-test "${c1}" != "${c2}" || echo "file1 and file2 should not match"
-test "${c1}" != "${c3}" || echo "file1 and file3 should not match"
-test "${c2}" != "${c3}" || echo "file2 and file3 should not match"
+test ${c1} != ${c2} || echo "file1 and file2 should not match"
+test ${c1} != ${c3} || echo "file1 and file3 should not match"
+test ${c2} != ${c3} || echo "file2 and file3 should not match"
 
 echo "Compare against check files"
-cmp -s "$testdir/file2" "$testdir/file2.chk" || echo "file2 and file2.chk do not match"
-cmp -s "$testdir/file3" "$testdir/file3.chk" || echo "file3 and file3.chk do not match"
+cmp -s $testdir/file2 $testdir/file2.chk || echo "file2 and file2.chk do not match"
+cmp -s $testdir/file3 $testdir/file3.chk || echo "file3 and file3.chk do not match"
 
 # success, all done
 status=0
diff --git a/tests/generic/149 b/tests/generic/149
index 7d3189e..b5f9f4a 100755
--- a/tests/generic/149
+++ b/tests/generic/149
@@ -24,8 +24,8 @@
 # Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 #-----------------------------------------------------------------------
 
-seq=`basename "$0"`
-seqres="$RESULT_DIR/$seq"
+seq=`basename $0`
+seqres=$RESULT_DIR/$seq
 echo "QA output created by $seq"
 
 here=`pwd`
@@ -36,7 +36,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _cleanup()
 {
     cd /
-    rm -rf "$tmp".* "$testdir"
+    rm -rf $tmp.* $testdir
 }
 
 # get standard environment, filters and checks
@@ -50,86 +50,86 @@ _require_test_reflink
 _require_cp_reflink
 _require_xfs_io_command "fzero"
 
-rm -f "$seqres.full"
+rm -f $seqres.full
 
-testdir="$TEST_DIR/test-$seq"
-rm -rf "$testdir"
-mkdir "$testdir"
+testdir=$TEST_DIR/test-$seq
+rm -rf $testdir
+mkdir $testdir
 
 echo "Create the original files"
 blksz=65536
-_pwrite_byte 0x61 0 $blksz "$testdir/file1" >> "$seqres.full"
-_pwrite_byte 0x62 $blksz $blksz "$testdir/file1" >> "$seqres.full"
-_pwrite_byte 0x63 $((blksz * 2)) $blksz "$testdir/file1" >> "$seqres.full"
+_pwrite_byte 0x61 0 $blksz $testdir/file1 >> $seqres.full
+_pwrite_byte 0x62 $blksz $blksz $testdir/file1 >> $seqres.full
+_pwrite_byte 0x63 $((blksz * 2)) $blksz $testdir/file1 >> $seqres.full
 
-_cp_reflink "$testdir/file1" "$testdir/file2"
-_cp_reflink "$testdir/file1" "$testdir/file3"
-_cp_reflink "$testdir/file1" "$testdir/file4"
+_cp_reflink $testdir/file1 $testdir/file2
+_cp_reflink $testdir/file1 $testdir/file3
+_cp_reflink $testdir/file1 $testdir/file4
 
-_pwrite_byte 0x00 0 $blksz "$testdir/file2.chk" >> "$seqres.full"
-_pwrite_byte 0x62 $blksz $blksz "$testdir/file2.chk" >> "$seqres.full"
-_pwrite_byte 0x63 $((blksz * 2)) $blksz "$testdir/file2.chk" >> "$seqres.full"
+_pwrite_byte 0x00 0 $blksz $testdir/file2.chk >> $seqres.full
+_pwrite_byte 0x62 $blksz $blksz $testdir/file2.chk >> $seqres.full
+_pwrite_byte 0x63 $((blksz * 2)) $blksz $testdir/file2.chk >> $seqres.full
 
-_pwrite_byte 0x61 0 $blksz "$testdir/file3.chk" >> "$seqres.full"
-_pwrite_byte 0x00 $blksz $blksz "$testdir/file3.chk" >> "$seqres.full"
-_pwrite_byte 0x63 $((blksz * 2)) $blksz "$testdir/file3.chk" >> "$seqres.full"
+_pwrite_byte 0x61 0 $blksz $testdir/file3.chk >> $seqres.full
+_pwrite_byte 0x00 $blksz $blksz $testdir/file3.chk >> $seqres.full
+_pwrite_byte 0x63 $((blksz * 2)) $blksz $testdir/file3.chk >> $seqres.full
 
-_pwrite_byte 0x61 0 $blksz "$testdir/file4.chk" >> "$seqres.full"
-_pwrite_byte 0x62 $blksz $blksz "$testdir/file4.chk" >> "$seqres.full"
-_pwrite_byte 0x00 $((blksz * 2)) $blksz "$testdir/file4.chk" >> "$seqres.full"
+_pwrite_byte 0x61 0 $blksz $testdir/file4.chk >> $seqres.full
+_pwrite_byte 0x62 $blksz $blksz $testdir/file4.chk >> $seqres.full
+_pwrite_byte 0x00 $((blksz * 2)) $blksz $testdir/file4.chk >> $seqres.full
 _test_remount
 
-md5sum "$testdir/file1" | _filter_test_dir
-md5sum "$testdir/file2" | _filter_test_dir
-md5sum "$testdir/file3" | _filter_test_dir
-md5sum "$testdir/file4" | _filter_test_dir
-md5sum "$testdir/file2.chk" | _filter_test_dir
-md5sum "$testdir/file3.chk" | _filter_test_dir
-md5sum "$testdir/file4.chk" | _filter_test_dir
-
-c1="$(_md5_checksum "$testdir/file1")"
-c2="$(_md5_checksum "$testdir/file2")"
-c3="$(_md5_checksum "$testdir/file3")"
-c4="$(_md5_checksum "$testdir/file4")"
-
-test "${c1}" = "${c2}" || echo "file1 and file2 should match"
-test "${c1}" = "${c3}" || echo "file1 and file3 should match"
-test "${c1}" = "${c4}" || echo "file1 and file4 should match"
-test "${c2}" = "${c3}" || echo "file2 and file3 should match"
-test "${c2}" = "${c4}" || echo "file2 and file4 should match"
-test "${c3}" = "${c4}" || echo "file3 and file4 should match"
+md5sum $testdir/file1 | _filter_test_dir
+md5sum $testdir/file2 | _filter_test_dir
+md5sum $testdir/file3 | _filter_test_dir
+md5sum $testdir/file4 | _filter_test_dir
+md5sum $testdir/file2.chk | _filter_test_dir
+md5sum $testdir/file3.chk | _filter_test_dir
+md5sum $testdir/file4.chk | _filter_test_dir
+
+c1=$(_md5_checksum $testdir/file1)
+c2=$(_md5_checksum $testdir/file2)
+c3=$(_md5_checksum $testdir/file3)
+c4=$(_md5_checksum $testdir/file4)
+
+test ${c1} = ${c2} || echo "file1 and file2 should match"
+test ${c1} = ${c3} || echo "file1 and file3 should match"
+test ${c1} = ${c4} || echo "file1 and file4 should match"
+test ${c2} = ${c3} || echo "file2 and file3 should match"
+test ${c2} = ${c4} || echo "file2 and file4 should match"
+test ${c3} = ${c4} || echo "file3 and file4 should match"
 
 echo "fzero files"
-"$XFS_IO_PROG" -f -c "fzero 0 $blksz" "$testdir/file2"
-"$XFS_IO_PROG" -f -c "fzero $blksz $blksz" "$testdir/file3"
-"$XFS_IO_PROG" -f -c "fzero $((blksz * 2)) $blksz" "$testdir/file4"
+$XFS_IO_PROG -f -c "fzero 0 $blksz" $testdir/file2
+$XFS_IO_PROG -f -c "fzero $blksz $blksz" $testdir/file3
+$XFS_IO_PROG -f -c "fzero $((blksz * 2)) $blksz" $testdir/file4
 _test_remount
 
 echo "Compare files"
-md5sum "$testdir/file1" | _filter_test_dir
-md5sum "$testdir/file2" | _filter_test_dir
-md5sum "$testdir/file3" | _filter_test_dir
-md5sum "$testdir/file4" | _filter_test_dir
-md5sum "$testdir/file2.chk" | _filter_test_dir
-md5sum "$testdir/file3.chk" | _filter_test_dir
-md5sum "$testdir/file4.chk" | _filter_test_dir
-
-c1="$(_md5_checksum "$testdir/file1")"
-c2="$(_md5_checksum "$testdir/file2")"
-c3="$(_md5_checksum "$testdir/file3")"
-c4="$(_md5_checksum "$testdir/file4")"
-
-test "${c1}" != "${c2}" || echo "file1 and file2 should not match"
-test "${c1}" != "${c3}" || echo "file1 and file3 should not match"
-test "${c1}" != "${c4}" || echo "file1 and file4 should not match"
-test "${c2}" != "${c3}" || echo "file2 and file3 should not match"
-test "${c2}" != "${c4}" || echo "file2 and file4 should not match"
-test "${c3}" != "${c4}" || echo "file3 and file4 should not match"
+md5sum $testdir/file1 | _filter_test_dir
+md5sum $testdir/file2 | _filter_test_dir
+md5sum $testdir/file3 | _filter_test_dir
+md5sum $testdir/file4 | _filter_test_dir
+md5sum $testdir/file2.chk | _filter_test_dir
+md5sum $testdir/file3.chk | _filter_test_dir
+md5sum $testdir/file4.chk | _filter_test_dir
+
+c1=$(_md5_checksum $testdir/file1)
+c2=$(_md5_checksum $testdir/file2)
+c3=$(_md5_checksum $testdir/file3)
+c4=$(_md5_checksum $testdir/file4)
+
+test ${c1} != ${c2} || echo "file1 and file2 should not match"
+test ${c1} != ${c3} || echo "file1 and file3 should not match"
+test ${c1} != ${c4} || echo "file1 and file4 should not match"
+test ${c2} != ${c3} || echo "file2 and file3 should not match"
+test ${c2} != ${c4} || echo "file2 and file4 should not match"
+test ${c3} != ${c4} || echo "file3 and file4 should not match"
 
 echo "Compare against check files"
-cmp -s "$testdir/file2" "$testdir/file2.chk" || echo "file2 and file2.chk do not match"
-cmp -s "$testdir/file3" "$testdir/file3.chk" || echo "file3 and file3.chk do not match"
-cmp -s "$testdir/file4" "$testdir/file4.chk" || echo "file4 and file4.chk do not match"
+cmp -s $testdir/file2 $testdir/file2.chk || echo "file2 and file2.chk do not match"
+cmp -s $testdir/file3 $testdir/file3.chk || echo "file3 and file3.chk do not match"
+cmp -s $testdir/file4 $testdir/file4.chk || echo "file4 and file4.chk do not match"
 
 # success, all done
 status=0
diff --git a/tests/generic/150 b/tests/generic/150
index 90ac46b..88814b1 100755
--- a/tests/generic/150
+++ b/tests/generic/150
@@ -23,8 +23,8 @@
 # Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 #-----------------------------------------------------------------------
 
-seq=`basename "$0"`
-seqres="$RESULT_DIR/$seq"
+seq=`basename $0`
+seqres=$RESULT_DIR/$seq
 echo "QA output created by $seq"
 
 here=`pwd`
@@ -35,7 +35,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _cleanup()
 {
     cd /
-    rm -rf "$tmp".* "$testdir"
+    rm -rf $tmp.* $testdir
 }
 
 # get standard environment, filters and checks
@@ -48,11 +48,11 @@ _supported_os Linux
 _require_test_reflink
 _require_cp_reflink
 
-rm -f "$seqres.full"
+rm -f $seqres.full
 
-testdir="$TEST_DIR/test-$seq"
-rm -rf "$testdir"
-mkdir "$testdir"
+testdir=$TEST_DIR/test-$seq
+rm -rf $testdir
+mkdir $testdir
 
 echo "Create the original file blocks"
 blksz="$(stat -f $testdir -c '%S')"
@@ -60,16 +60,17 @@ blks=2000
 margin='15%'
 sz=$((blksz * blks))
 nr=7
-_pwrite_byte 0x61 0 $sz "$testdir/file1" >> "$seqres.full"
+filesize=$((blksz * nr))
+_pwrite_byte 0x61 0 $sz $testdir/file1 >> $seqres.full
 sync
-free_blocks0=$(stat -f "$testdir" -c '%f')
+free_blocks0=$(stat -f $testdir -c '%f')
 
 echo "Create the reflink copies"
 for i in `seq 2 $nr`; do
-	_cp_reflink "$testdir/file1" "$testdir/file.$i"
+	_cp_reflink $testdir/file1 $testdir/file.$i
 done
 _test_remount
-free_blocks1=$(stat -f "$testdir" -c '%f')
+free_blocks1=$(stat -f $testdir -c '%f')
 
 _within_tolerance "free blocks after reflink" $free_blocks1 $free_blocks0 $margin -v
 
diff --git a/tests/generic/151 b/tests/generic/151
index c67a12c..207378c 100755
--- a/tests/generic/151
+++ b/tests/generic/151
@@ -27,8 +27,8 @@
 # Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 #-----------------------------------------------------------------------
 
-seq=`basename "$0"`
-seqres="$RESULT_DIR/$seq"
+seq=`basename $0`
+seqres=$RESULT_DIR/$seq
 echo "QA output created by $seq"
 
 here=`pwd`
@@ -39,7 +39,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _cleanup()
 {
     cd /
-    rm -rf "$tmp".* "$testdir"
+    rm -rf $tmp.* $testdir
 }
 
 # get standard environment, filters and checks
@@ -52,39 +52,40 @@ _supported_os Linux
 _require_test_reflink
 _require_cp_reflink
 
-rm -f "$seqres.full"
+rm -f $seqres.full
 
-testdir="$TEST_DIR/test-$seq"
-rm -rf "$testdir"
-mkdir "$testdir"
+testdir=$TEST_DIR/test-$seq
+rm -rf $testdir
+mkdir $testdir
 
 echo "Create the original file blocks"
-blksz="$(stat -f "$testdir" -c '%S')"
+blksz="$(stat -f $testdir -c '%S')"
 blks=2000
 margin='15%'
 sz=$((blksz * blks))
-free_blocks0=$(stat -f "$testdir" -c '%f')
+free_blocks0=$(stat -f $testdir -c '%f')
 nr=7
-_pwrite_byte 0x61 0 $sz "$testdir/file1" >> "$seqres.full"
+filesize=$((blksz * nr))
+_pwrite_byte 0x61 0 $sz $testdir/file1 >> $seqres.full
 sync
 
 echo "Create the reflink copies"
 for i in `seq 2 $nr`; do
-	_cp_reflink "$testdir/file1" "$testdir/file.$i"
+	_cp_reflink $testdir/file1 $testdir/file.$i
 done
-_cp_reflink "$testdir/file1" "$testdir/survivor"
+_cp_reflink $testdir/file1 $testdir/survivor
 _test_remount
-free_blocks1=$(stat -f "$testdir" -c '%f')
+free_blocks1=$(stat -f $testdir -c '%f')
 
 echo "Delete most of the files"
-rm -rf "$testdir"/file*
+rm -rf $testdir/file*
 _test_remount
-free_blocks2=$(stat -f "$testdir" -c '%f')
+free_blocks2=$(stat -f $testdir -c '%f')
 
 echo "Delete all the files"
-rm -rf "$testdir"/*
+rm -rf $testdir/*
 _test_remount
-free_blocks3=$(stat -f "$testdir" -c '%f')
+free_blocks3=$(stat -f $testdir -c '%f')
 #echo $free_blocks0 $free_blocks1 $free_blocks2 $free_blocks3
 
 _within_tolerance "free blocks after reflink" $free_blocks1 $((free_blocks0 - blks)) $margin -v
diff --git a/tests/generic/152 b/tests/generic/152
index cdb2bf9..b221f8f 100755
--- a/tests/generic/152
+++ b/tests/generic/152
@@ -27,8 +27,8 @@
 # Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 #-----------------------------------------------------------------------
 
-seq=`basename "$0"`
-seqres="$RESULT_DIR/$seq"
+seq=`basename $0`
+seqres=$RESULT_DIR/$seq
 echo "QA output created by $seq"
 
 here=`pwd`
@@ -39,7 +39,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _cleanup()
 {
     cd /
-    rm -rf "$tmp".* "$testdir"
+    rm -rf $tmp.* $testdir
 }
 
 # get standard environment, filters and checks
@@ -53,43 +53,44 @@ _require_test_reflink
 _require_cp_reflink
 _require_xfs_io_command "fpunch"
 
-rm -f "$seqres.full"
+rm -f $seqres.full
 
-testdir="$TEST_DIR/test-$seq"
-rm -rf "$testdir"
-mkdir "$testdir"
+testdir=$TEST_DIR/test-$seq
+rm -rf $testdir
+mkdir $testdir
 
 echo "Create the original file blocks"
-blksz="$(stat -f "$testdir" -c '%S')"
+blksz="$(stat -f $testdir -c '%S')"
 blks=2000
 margin='15%'
 sz=$((blksz * blks))
-free_blocks0=$(stat -f "$testdir" -c '%f')
+free_blocks0=$(stat -f $testdir -c '%f')
 nr=4
-_pwrite_byte 0x61 0 $sz "$testdir/file1" >> "$seqres.full"
+filesize=$((blksz * nr))
+_pwrite_byte 0x61 0 $sz $testdir/file1 >> $seqres.full
 sync
 
 echo "Create the reflink copies"
 for i in `seq 2 $nr`; do
-	_cp_reflink "$testdir/file1" "$testdir/file$i"
+	_cp_reflink $testdir/file1 $testdir/file$i
 done
 _test_remount
-free_blocks1=$(stat -f "$testdir" -c '%f')
+free_blocks1=$(stat -f $testdir -c '%f')
 
 echo "Punch most of the blocks"
-"$XFS_IO_PROG" -f -c "fpunch 0 $sz" "$testdir/file2"
-"$XFS_IO_PROG" -f -c "fpunch 0 $((sz / 2))" "$testdir/file3"
-"$XFS_IO_PROG" -f -c "fpunch $((sz / 2)) $((sz / 2))" "$testdir/file4"
+$XFS_IO_PROG -f -c "fpunch 0 $sz" $testdir/file2
+$XFS_IO_PROG -f -c "fpunch 0 $((sz / 2))" $testdir/file3
+$XFS_IO_PROG -f -c "fpunch $((sz / 2)) $((sz / 2))" $testdir/file4
 _test_remount
-free_blocks2=$(stat -f "$testdir" -c '%f')
+free_blocks2=$(stat -f $testdir -c '%f')
 
 echo "Punch all the files"
 for i in `seq 2 $nr`; do
-	"$XFS_IO_PROG" -f -c "fpunch 0 $sz" "$testdir/file$i"
+	$XFS_IO_PROG -f -c "fpunch 0 $sz" $testdir/file$i
 done
-"$XFS_IO_PROG" -f -c "fpunch 0 $sz" "$testdir/file1"
+$XFS_IO_PROG -f -c "fpunch 0 $sz" $testdir/file1
 _test_remount
-free_blocks3=$(stat -f "$testdir" -c '%f')
+free_blocks3=$(stat -f $testdir -c '%f')
 #echo $free_blocks0 $free_blocks1 $free_blocks2 $free_blocks3
 
 _within_tolerance "free blocks after reflink" $free_blocks1 $((free_blocks0 - blks)) $margin -v
diff --git a/tests/generic/153 b/tests/generic/153
index b2f4022..550aa95 100755
--- a/tests/generic/153
+++ b/tests/generic/153
@@ -27,8 +27,8 @@
 # Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 #-----------------------------------------------------------------------
 
-seq=`basename "$0"`
-seqres="$RESULT_DIR/$seq"
+seq=`basename $0`
+seqres=$RESULT_DIR/$seq
 echo "QA output created by $seq"
 
 here=`pwd`
@@ -39,7 +39,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _cleanup()
 {
     cd /
-    rm -rf "$tmp".* "$testdir"
+    rm -rf $tmp.* $testdir
 }
 
 # get standard environment, filters and checks
@@ -53,42 +53,43 @@ _require_test_reflink
 _require_cp_reflink
 _require_xfs_io_command "fcollapse"
 
-rm -f "$seqres.full"
+rm -f $seqres.full
 
-testdir="$TEST_DIR/test-$seq"
-rm -rf "$testdir"
-mkdir "$testdir"
+testdir=$TEST_DIR/test-$seq
+rm -rf $testdir
+mkdir $testdir
 
 echo "Create the original file blocks"
-blksz="$(stat -f "$testdir" -c '%S')"
+blksz="$(stat -f $testdir -c '%S')"
 blks=2000
 margin='15%'
 sz=$((blksz * blks))
-free_blocks0=$(stat -f "$testdir" -c '%f')
+free_blocks0=$(stat -f $testdir -c '%f')
 nr=4
-_pwrite_byte 0x61 0 $sz "$testdir/file1" >> "$seqres.full"
+filesize=$((blksz * nr))
+_pwrite_byte 0x61 0 $sz $testdir/file1 >> $seqres.full
 _test_remount
 
 echo "Create the reflink copies"
 for i in `seq 2 $nr`; do
-	_cp_reflink "$testdir/file1" "$testdir/file$i"
+	_cp_reflink $testdir/file1 $testdir/file$i
 done
 _test_remount
-free_blocks1=$(stat -f "$testdir" -c '%f')
+free_blocks1=$(stat -f $testdir -c '%f')
 
 echo "Collapse most of the blocks"
-"$XFS_IO_PROG" -f -c "fcollapse 0 $(((blks - 1) * blksz))" $testdir/file2
-"$XFS_IO_PROG" -f -c "fcollapse 0 $((sz / 2))" $testdir/file3
-"$XFS_IO_PROG" -f -c "fcollapse $((sz / 2)) $(( ((blks / 2) - 1) * blksz))" $testdir/file4
+$XFS_IO_PROG -f -c "fcollapse 0 $(((blks - 1) * blksz))" $testdir/file2
+$XFS_IO_PROG -f -c "fcollapse 0 $((sz / 2))" $testdir/file3
+$XFS_IO_PROG -f -c "fcollapse $((sz / 2)) $(( ((blks / 2) - 1) * blksz))" $testdir/file4
 _test_remount
-free_blocks2=$(stat -f "$testdir" -c '%f')
+free_blocks2=$(stat -f $testdir -c '%f')
 
 echo "Collpase nearly all the files"
-"$XFS_IO_PROG" -f -c "fcollapse 0 $(( ((blks / 2) - 1) * blksz))" $testdir/file3
-"$XFS_IO_PROG" -f -c "fcollapse 0 $((sz / 2))" $testdir/file4
-"$XFS_IO_PROG" -f -c "fcollapse 0 $(( (blks - 1) * blksz))" $testdir/file1
+$XFS_IO_PROG -f -c "fcollapse 0 $(( ((blks / 2) - 1) * blksz))" $testdir/file3
+$XFS_IO_PROG -f -c "fcollapse 0 $((sz / 2))" $testdir/file4
+$XFS_IO_PROG -f -c "fcollapse 0 $(( (blks - 1) * blksz))" $testdir/file1
 _test_remount
-free_blocks3=$(stat -f "$testdir" -c '%f')
+free_blocks3=$(stat -f $testdir -c '%f')
 #echo $free_blocks0 $free_blocks1 $free_blocks2 $free_blocks3
 
 _within_tolerance "free blocks after reflink" $free_blocks1 $((free_blocks0 - blks)) $margin -v
diff --git a/tests/generic/154 b/tests/generic/154
index 579f78b..c0c3142 100755
--- a/tests/generic/154
+++ b/tests/generic/154
@@ -28,7 +28,7 @@
 #-----------------------------------------------------------------------
 
 seq=`basename $0`
-seqres="$RESULT_DIR/$seq"
+seqres=$RESULT_DIR/$seq
 echo "QA output created by $seq"
 
 here=`pwd`
@@ -39,7 +39,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _cleanup()
 {
     cd /
-    rm -rf "$tmp".* "$testdir"
+    rm -rf $tmp.* $testdir
 }
 
 # get standard environment, filters and checks
@@ -52,47 +52,48 @@ _supported_os Linux
 _require_test_reflink
 _require_cp_reflink
 
-rm -f "$seqres.full"
+rm -f $seqres.full
 
-testdir="$TEST_DIR/test-$seq"
-rm -rf "$testdir"
-mkdir "$testdir"
+testdir=$TEST_DIR/test-$seq
+rm -rf $testdir
+mkdir $testdir
 
 echo "Create the original file blocks"
-blksz="$(stat -f "$testdir" -c '%S')"
+blksz="$(stat -f $testdir -c '%S')"
 blks=2000
 margin='15%'
-free_blocks0=$(stat -f "$testdir" -c '%f')
+free_blocks0=$(stat -f $testdir -c '%f')
 nr=4
+filesize=$((blksz * nr))
 sz=$((blks * blksz))
-_pwrite_byte 0x61 0 $sz "$testdir/file1" >> "$seqres.full"
+_pwrite_byte 0x61 0 $sz $testdir/file1 >> $seqres.full
 _test_remount
 
 echo "Create the reflink copies"
 for i in `seq 2 $nr`; do
-	_cp_reflink "$testdir/file1" "$testdir/file$i"
+	_cp_reflink $testdir/file1 $testdir/file$i
 done
 _test_remount
-free_blocks1=$(stat -f "$testdir" -c '%f')
+free_blocks1=$(stat -f $testdir -c '%f')
 
 echo "Rewrite some of the blocks"
-_pwrite_byte 0x62 0 $sz "$testdir/file2" >> "$seqres.full"
-_pwrite_byte 0x63 0 $((sz / 2)) "$testdir/file3" >> "$seqres.full"
-_pwrite_byte 0x64 $((sz / 2)) $((sz / 2)) "$testdir/file4" >> "$seqres.full"
+_pwrite_byte 0x62 0 $sz $testdir/file2 >> $seqres.full
+_pwrite_byte 0x63 0 $((sz / 2)) $testdir/file3 >> $seqres.full
+_pwrite_byte 0x64 $((sz / 2)) $((sz / 2)) $testdir/file4 >> $seqres.full
 _test_remount
-free_blocks2=$(stat -f "$testdir" -c '%f')
+free_blocks2=$(stat -f $testdir -c '%f')
 
 echo "Rewrite all the files"
-_pwrite_byte 0x62 0 $sz "$testdir/file2" >> "$seqres.full"
-_pwrite_byte 0x63 0 $sz "$testdir/file3" >> "$seqres.full"
-_pwrite_byte 0x64 0 $sz "$testdir/file4" >> "$seqres.full"
+_pwrite_byte 0x62 0 $sz $testdir/file2 >> $seqres.full
+_pwrite_byte 0x63 0 $sz $testdir/file3 >> $seqres.full
+_pwrite_byte 0x64 0 $sz $testdir/file4 >> $seqres.full
 _test_remount
-free_blocks3=$(stat -f "$testdir" -c '%f')
+free_blocks3=$(stat -f $testdir -c '%f')
 
 echo "Rewrite the original file"
-_pwrite_byte 0x65 0 $sz "$testdir/file1" >> "$seqres.full"
+_pwrite_byte 0x65 0 $sz $testdir/file1 >> $seqres.full
 _test_remount
-free_blocks4=$(stat -f "$testdir" -c '%f')
+free_blocks4=$(stat -f $testdir -c '%f')
 #echo $free_blocks0 $free_blocks1 $free_blocks2 $free_blocks3 $free_blocks4
 
 _within_tolerance "free blocks after reflinking" $free_blocks1 $((free_blocks0 - blks)) $margin -v
diff --git a/tests/generic/155 b/tests/generic/155
index 56d2912..c6416a1 100755
--- a/tests/generic/155
+++ b/tests/generic/155
@@ -30,8 +30,8 @@
 # Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 #-----------------------------------------------------------------------
 
-seq=`basename "$0"`
-seqres="$RESULT_DIR/$seq"
+seq=`basename $0`
+seqres=$RESULT_DIR/$seq
 echo "QA output created by $seq"
 
 here=`pwd`
@@ -42,7 +42,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _cleanup()
 {
     cd /
-    rm -rf "$tmp".* "$testdir"
+    rm -rf $tmp.* $testdir
 }
 
 # get standard environment, filters and checks
@@ -56,47 +56,48 @@ _require_test_reflink
 _require_cp_reflink
 _require_xfs_io_command "fzero"
 
-rm -f "$seqres.full"
+rm -f $seqres.full
 
 testdir=$TEST_DIR/test-$seq
 rm -rf $testdir
 mkdir $testdir
 
 echo "Create the original file blocks"
-blksz="$(stat -f "$testdir" -c '%S')"
+blksz="$(stat -f $testdir -c '%S')"
 blks=2000
 margin='15%'
 sz=$((blksz * blks))
-free_blocks0=$(stat -f "$testdir" -c '%f')
+free_blocks0=$(stat -f $testdir -c '%f')
 nr=4
-_pwrite_byte 0x61 0 $sz "$testdir/file1" >> "$seqres.full"
+filesize=$((blksz * nr))
+_pwrite_byte 0x61 0 $sz $testdir/file1 >> $seqres.full
 _test_remount
 
 echo "Create the reflink copies"
 for i in `seq 2 $nr`; do
-	_cp_reflink "$testdir/file1" "$testdir/file$i"
+	_cp_reflink $testdir/file1 $testdir/file$i
 done
 _test_remount
-free_blocks1=$(stat -f "$testdir" -c '%f')
+free_blocks1=$(stat -f $testdir -c '%f')
 
 echo "Rewrite some of the blocks"
-"$XFS_IO_PROG" -f -c "fzero 0 $sz" "$testdir/file2" >> "$seqres.full"
-_pwrite_byte 0x63 0 $((sz / 2)) "$testdir/file3" -d >> "$seqres.full"
-_mwrite_byte 0x64 $((sz / 2)) $((sz / 2)) $sz "$testdir/file4" >> "$seqres.full"
+$XFS_IO_PROG -f -c "fzero 0 $sz" $testdir/file2 >> $seqres.full
+_pwrite_byte 0x63 0 $((sz / 2)) $testdir/file3 -d >> $seqres.full
+_mwrite_byte 0x64 $((sz / 2)) $((sz / 2)) $sz $testdir/file4 >> $seqres.full
 _test_remount
-free_blocks2=$(stat -f "$testdir" -c '%f')
+free_blocks2=$(stat -f $testdir -c '%f')
 
 echo "Rewrite all the files"
-_pwrite_byte 0x62 0 $sz "$testdir/file2" -d >> "$seqres.full"
-_mwrite_byte 0x63 0 $sz $sz "$testdir/file3" >> "$seqres.full"
-"$XFS_IO_PROG" -f -c "fzero 0 $sz" $testdir/file4 >> "$seqres.full"
+_pwrite_byte 0x62 0 $sz $testdir/file2 -d >> $seqres.full
+_mwrite_byte 0x63 0 $sz $sz $testdir/file3 >> $seqres.full
+$XFS_IO_PROG -f -c "fzero 0 $sz" $testdir/file4 >> $seqres.full
 _test_remount
-free_blocks3=$(stat -f "$testdir" -c '%f')
+free_blocks3=$(stat -f $testdir -c '%f')
 
 echo "Rewrite the original file"
-_pwrite_byte 0x65 0 $sz "$testdir/file1" >> "$seqres.full"
+_pwrite_byte 0x65 0 $sz $testdir/file1 >> $seqres.full
 _test_remount
-free_blocks4=$(stat -f "$testdir" -c '%f')
+free_blocks4=$(stat -f $testdir -c '%f')
 #echo $free_blocks0 $free_blocks1 $free_blocks2 $free_blocks3 $free_blocks4
 
 _within_tolerance "free blocks after reflinking" $free_blocks1 $((free_blocks0 - blks)) $margin -v
diff --git a/tests/generic/156 b/tests/generic/156
index 9fea988..de2d9b1 100755
--- a/tests/generic/156
+++ b/tests/generic/156
@@ -33,8 +33,8 @@
 # Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 #-----------------------------------------------------------------------
 
-seq=`basename "$0"`
-seqres="$RESULT_DIR/$seq"
+seq=`basename $0`
+seqres=$RESULT_DIR/$seq
 echo "QA output created by $seq"
 
 here=`pwd`
@@ -45,7 +45,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _cleanup()
 {
     cd /
-    rm -rf "$tmp".* "$testdir"
+    rm -rf $tmp.* $testdir
 }
 
 # get standard environment, filters and checks
@@ -64,49 +64,50 @@ _require_test_reflink
 _require_cp_reflink
 _require_xfs_io_command "falloc"
 
-rm -f "$seqres.full"
+rm -f $seqres.full
 
-testdir="$TEST_DIR/test-$seq"
-rm -rf "$testdir"
-mkdir "$testdir"
+testdir=$TEST_DIR/test-$seq
+rm -rf $testdir
+mkdir $testdir
 
 echo "Create the original file blocks"
-blksz="$(stat -f "$testdir" -c '%S')"
+blksz="$(stat -f $testdir -c '%S')"
 blks=2000
 margin='15%'
 sz=$((blksz * blks))
-free_blocks0=$(stat -f "$testdir" -c '%f')
+free_blocks0=$(stat -f $testdir -c '%f')
 nr=4
-_pwrite_byte 0x61 0 $sz "$testdir/file1" >> "$seqres.full"
+filesize=$((blksz * nr))
+_pwrite_byte 0x61 0 $sz $testdir/file1 >> $seqres.full
 _test_remount
 
 echo "Create the reflink copies"
 for i in `seq 2 $nr`; do
-	_cp_reflink "$testdir/file1" "$testdir/file$i"
+	_cp_reflink $testdir/file1 $testdir/file$i
 done
 _test_remount
-free_blocks1=$(stat -f "$testdir" -c '%f')
+free_blocks1=$(stat -f $testdir -c '%f')
 
 echo "funshare part of a file"
-"$XFS_IO_PROG" -f -c "falloc 0 $((sz / 2))" "$testdir/file2"
+$XFS_IO_PROG -f -c "falloc 0 $((sz / 2))" $testdir/file2
 _test_remount
 
 echo "funshare some of the copies"
-"$XFS_IO_PROG" -f -c "falloc 0 $sz" "$testdir/file2"
-"$XFS_IO_PROG" -f -c "falloc 0 $sz" "$testdir/file3"
+$XFS_IO_PROG -f -c "falloc 0 $sz" $testdir/file2
+$XFS_IO_PROG -f -c "falloc 0 $sz" $testdir/file3
 _test_remount
-free_blocks2=$(stat -f "$testdir" -c '%f')
+free_blocks2=$(stat -f $testdir -c '%f')
 
 echo "funshare the rest of the files"
-"$XFS_IO_PROG" -f -c "falloc 0 $sz" "$testdir/file4"
-"$XFS_IO_PROG" -f -c "falloc 0 $sz" "$testdir/file1"
+$XFS_IO_PROG -f -c "falloc 0 $sz" $testdir/file4
+$XFS_IO_PROG -f -c "falloc 0 $sz" $testdir/file1
 _test_remount
-free_blocks3=$(stat -f "$testdir" -c '%f')
+free_blocks3=$(stat -f $testdir -c '%f')
 
 echo "Rewrite the original file"
-_pwrite_byte 0x65 0 $sz "$testdir/file1" >> "$seqres.full"
+_pwrite_byte 0x65 0 $sz $testdir/file1 >> $seqres.full
 _test_remount
-free_blocks4=$(stat -f "$testdir" -c '%f')
+free_blocks4=$(stat -f $testdir -c '%f')
 #echo $free_blocks0 $free_blocks1 $free_blocks2 $free_blocks3 $free_blocks4
 
 _within_tolerance "free blocks after reflinking" $free_blocks1 $((free_blocks0 - blks)) $margin -v
diff --git a/tests/generic/157 b/tests/generic/157
index 19a9a18..fe294c8 100755
--- a/tests/generic/157
+++ b/tests/generic/157
@@ -20,8 +20,8 @@
 # Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 #-----------------------------------------------------------------------
 
-seq=`basename "$0"`
-seqres="$RESULT_DIR/$seq"
+seq=`basename $0`
+seqres=$RESULT_DIR/$seq
 echo "QA output created by $seq"
 
 here=`pwd`
@@ -32,7 +32,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _cleanup()
 {
     cd /
-    rm -rf "$tmp".* "$testdir1"
+    rm -rf $tmp.* $testdir1
 }
 
 # get standard environment, filters and checks
@@ -46,19 +46,18 @@ _supported_os Linux
 _require_test_reflink
 _require_scratch_reflink
 
-rm -f "$seqres.full"
+rm -f $seqres.full
 
 echo "Format and mount"
-_scratch_mkfs > "$seqres.full" 2>&1
-_scratch_mount >> "$seqres.full" 2>&1
+_scratch_mkfs > $seqres.full 2>&1
+_scratch_mount >> $seqres.full 2>&1
 
 testdir1="$TEST_DIR/test-$seq"
-rm -rf "$testdir1"
-mkdir "$testdir1"
+rm -rf $testdir1
+mkdir $testdir1
 
 testdir2=$SCRATCH_MNT/test-$seq
-rm -rf "$testdir2"
-mkdir "$testdir2"
+mkdir $testdir2
 
 echo "Create the original files"
 blksz="$(stat -f $testdir1 -c '%S')"
@@ -67,16 +66,17 @@ margin='7%'
 sz=$((blksz * blks))
 free_blocks0=$(stat -f $testdir1 -c '%f')
 nr=4
-_pwrite_byte 0x61 0 $sz "$testdir1/file1" >> "$seqres.full"
-_pwrite_byte 0x61 0 $sz "$testdir1/file2" >> "$seqres.full"
-_pwrite_byte 0x61 0 $sz "$testdir2/file1" >> "$seqres.full"
-_pwrite_byte 0x61 0 $sz "$testdir2/file2" >> "$seqres.full"
-mkdir "$testdir1/dir1"
+filesize=$((blksz * nr))
+_pwrite_byte 0x61 0 $sz $testdir1/file1 >> $seqres.full
+_pwrite_byte 0x61 0 $sz $testdir1/file2 >> $seqres.full
+_pwrite_byte 0x61 0 $sz $testdir2/file1 >> $seqres.full
+_pwrite_byte 0x61 0 $sz $testdir2/file2 >> $seqres.full
+mkdir $testdir1/dir1
 seq 1 $((2 * blksz / 250)) | while read f; do
-	touch "$testdir1/dir1/$f"
+	touch $testdir1/dir1/$f
 done
-mknod "$testdir1/dev1" c 1 3
-mkfifo "$testdir1/fifo1"
+mknod $testdir1/dev1 c 1 3
+mkfifo $testdir1/fifo1
 sync
 
 _filter_enotty() {
@@ -88,38 +88,38 @@ _filter_einval() {
 }
 
 echo "Try cross-device reflink"
-_reflink_range "$testdir1/file1" 0 "$testdir2/file1" 0 $blksz
+_reflink_range $testdir1/file1 0 $testdir2/file1 0 $blksz
 
 echo "Try unaligned reflink"
-_reflink_range "$testdir1/file1" 37 "$testdir1/file1" 59 23
+_reflink_range $testdir1/file1 37 $testdir1/file1 59 23
 
 echo "Try overlapping reflink"
-_reflink_range "$testdir1/file1" 0 "$testdir1/file1" 1 $((blksz * 2))
+_reflink_range $testdir1/file1 0 $testdir1/file1 1 $((blksz * 2))
 
 echo "Try reflink past EOF"
-_reflink_range "$testdir1/file1" $(( (blks + 10) * blksz)) "$testdir1/file1" 0 $blksz
+_reflink_range $testdir1/file1 $(( (blks + 10) * blksz)) $testdir1/file1 0 $blksz
 
 echo "Try to reflink a dir"
-_reflink_range "$testdir1/dir1" 0 "$testdir1/file2" 0 $blksz
+_reflink_range $testdir1/dir1 0 $testdir1/file2 0 $blksz
 
 echo "Try to reflink a device"
-_reflink_range "$testdir1/dev1" 0 "$testdir1/file2" 0 $blksz
+_reflink_range $testdir1/dev1 0 $testdir1/file2 0 $blksz
 
 echo "Try to reflink to a dir"
-_reflink_range "$testdir1/file1" 0 "$testdir1/dir1" 0 $blksz 2>&1 | _filter_test_dir
+_reflink_range $testdir1/file1 0 $testdir1/dir1 0 $blksz 2>&1 | _filter_test_dir
 
 echo "Try to reflink to a device"
-_reflink_range "$testdir1/file1" 0 "$testdir1/dev1" 0 $blksz 2>&1 | _filter_enotty
+_reflink_range $testdir1/file1 0 $testdir1/dev1 0 $blksz 2>&1 | _filter_enotty
 
 echo "Try to reflink to a fifo"
-_reflink_range "$testdir1/file1" 0 "$testdir1/fifo1" 0 $blksz -n 2>&1 | _filter_enotty
+_reflink_range $testdir1/file1 0 $testdir1/fifo1 0 $blksz -n 2>&1 | _filter_enotty
 
 echo "Try to reflink an append-only file"
-_reflink_range "$testdir1/file1" 0 "$testdir1/file3" 0 $blksz -a 2>&1 | _filter_einval
+_reflink_range $testdir1/file1 0 $testdir1/file3 0 $blksz -a 2>&1 | _filter_einval
 
 echo "Reflink two files"
-_reflink_range "$testdir1/file1" 0 "$testdir1/file2" 0 $blksz >> "$seqres.full"
-_reflink_range "$testdir2/file1" 0 "$testdir2/file2" 0 $blksz >> "$seqres.full"
+_reflink_range $testdir1/file1 0 $testdir1/file2 0 $blksz >> $seqres.full
+_reflink_range $testdir2/file1 0 $testdir2/file2 0 $blksz >> $seqres.full
 
 # success, all done
 status=0
diff --git a/tests/generic/158 b/tests/generic/158
index 4b51973..0da5daa 100755
--- a/tests/generic/158
+++ b/tests/generic/158
@@ -20,8 +20,8 @@
 # Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 #-----------------------------------------------------------------------
 
-seq=`basename "$0"`
-seqres="$RESULT_DIR/$seq"
+seq=`basename $0`
+seqres=$RESULT_DIR/$seq
 echo "QA output created by $seq"
 
 here=`pwd`
@@ -32,7 +32,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _cleanup()
 {
     cd /
-    rm -rf "$tmp".* "$testdir1"
+    rm -rf $tmp.* $testdir1
 }
 
 # get standard environment, filters and checks
@@ -46,19 +46,18 @@ _supported_os Linux
 _require_test_dedupe
 _require_scratch_dedupe
 
-rm -f "$seqres.full"
+rm -f $seqres.full
 
 echo "Format and mount"
-_scratch_mkfs > "$seqres.full" 2>&1
-_scratch_mount >> "$seqres.full" 2>&1
+_scratch_mkfs > $seqres.full 2>&1
+_scratch_mount >> $seqres.full 2>&1
 
 testdir1="$TEST_DIR/test-$seq"
-rm -rf "$testdir1"
-mkdir "$testdir1"
+rm -rf $testdir1
+mkdir $testdir1
 
 testdir2=$SCRATCH_MNT/test-$seq
-rm -rf "$testdir2"
-mkdir "$testdir2"
+mkdir $testdir2
 
 echo "Create the original files"
 blksz="$(stat -f $testdir1 -c '%S')"
@@ -67,17 +66,18 @@ margin='7%'
 sz=$((blksz * blks))
 free_blocks0=$(stat -f $testdir1 -c '%f')
 nr=4
-_pwrite_byte 0x61 0 $sz "$testdir1/file1" >> "$seqres.full"
-_pwrite_byte 0x61 0 $sz "$testdir1/file2" >> "$seqres.full"
-_pwrite_byte 0x61 0 $sz "$testdir1/file3" >> "$seqres.full"
-_pwrite_byte 0x61 0 $sz "$testdir2/file1" >> "$seqres.full"
-_pwrite_byte 0x61 0 $sz "$testdir2/file2" >> "$seqres.full"
-mkdir "$testdir1/dir1"
+filesize=$((blksz * nr))
+_pwrite_byte 0x61 0 $sz $testdir1/file1 >> $seqres.full
+_pwrite_byte 0x61 0 $sz $testdir1/file2 >> $seqres.full
+_pwrite_byte 0x61 0 $sz $testdir1/file3 >> $seqres.full
+_pwrite_byte 0x61 0 $sz $testdir2/file1 >> $seqres.full
+_pwrite_byte 0x61 0 $sz $testdir2/file2 >> $seqres.full
+mkdir $testdir1/dir1
 seq 1 $((2 * blksz / 250)) | while read f; do
-	touch "$testdir1/dir1/$f"
+	touch $testdir1/dir1/$f
 done
-mknod "$testdir1/dev1" c 1 3
-mkfifo "$testdir1/fifo1"
+mknod $testdir1/dev1 c 1 3
+mkfifo $testdir1/fifo1
 sync
 
 _filter_enotty() {
@@ -89,38 +89,38 @@ _filter_eperm() {
 }
 
 echo "Try cross-device dedupe"
-_dedupe_range "$testdir1/file1" 0 "$testdir2/file1" 0 $blksz
+_dedupe_range $testdir1/file1 0 $testdir2/file1 0 $blksz
 
 echo "Try unaligned dedupe"
-_dedupe_range "$testdir1/file1" 37 "$testdir1/file1" 59 23
+_dedupe_range $testdir1/file1 37 $testdir1/file1 59 23
 
 echo "Try overlapping dedupe"
-_dedupe_range "$testdir1/file1" 0 "$testdir1/file1" 1 $((blksz * 2))
+_dedupe_range $testdir1/file1 0 $testdir1/file1 1 $((blksz * 2))
 
 echo "Try dedupe past EOF"
-_dedupe_range "$testdir1/file1" $(( (blks + 10) * blksz)) "$testdir1/file1" 0 $blksz
+_dedupe_range $testdir1/file1 $(( (blks + 10) * blksz)) $testdir1/file1 0 $blksz
 
 echo "Try to dedupe a dir"
-_dedupe_range "$testdir1/dir1" 0 "$testdir1/file2" 0 $blksz
+_dedupe_range $testdir1/dir1 0 $testdir1/file2 0 $blksz
 
 echo "Try to dedupe a device"
-_dedupe_range "$testdir1/dev1" 0 "$testdir1/file2" 0 $blksz 2>&1 | _filter_enotty
+_dedupe_range $testdir1/dev1 0 $testdir1/file2 0 $blksz 2>&1 | _filter_enotty
 
 echo "Try to dedupe to a dir"
-_dedupe_range "$testdir1/file1" 0 "$testdir1/dir1" 0 $blksz 2>&1 | _filter_test_dir
+_dedupe_range $testdir1/file1 0 $testdir1/dir1 0 $blksz 2>&1 | _filter_test_dir
 
 echo "Try to dedupe to a device"
-_dedupe_range "$testdir1/file1" 0 "$testdir1/dev1" 0 $blksz 2>&1 | _filter_eperm
+_dedupe_range $testdir1/file1 0 $testdir1/dev1 0 $blksz 2>&1 | _filter_eperm
 
 echo "Try to dedupe to a fifo"
-_dedupe_range "$testdir1/file1" 0 "$testdir1/fifo1" 0 $blksz -n 2>&1 | _filter_eperm
+_dedupe_range $testdir1/file1 0 $testdir1/fifo1 0 $blksz -n 2>&1 | _filter_eperm
 
 echo "Try to dedupe an append-only file"
-_dedupe_range "$testdir1/file1" 0 "$testdir1/file3" 0 $blksz -a >> "$seqres.full"
+_dedupe_range $testdir1/file1 0 $testdir1/file3 0 $blksz -a >> $seqres.full
 
 echo "Dedupe two files"
-_dedupe_range "$testdir1/file1" 0 "$testdir1/file2" 0 $blksz >> "$seqres.full"
-_dedupe_range "$testdir2/file1" 0 "$testdir2/file2" 0 $blksz >> "$seqres.full"
+_dedupe_range $testdir1/file1 0 $testdir1/file2 0 $blksz >> $seqres.full
+_dedupe_range $testdir2/file1 0 $testdir2/file2 0 $blksz >> $seqres.full
 
 # success, all done
 status=0
diff --git a/tests/generic/159 b/tests/generic/159
index 88a0c7e..8898d58 100755
--- a/tests/generic/159
+++ b/tests/generic/159
@@ -20,8 +20,8 @@
 # Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 #-----------------------------------------------------------------------
 
-seq=`basename "$0"`
-seqres="$RESULT_DIR/$seq"
+seq=`basename $0`
+seqres=$RESULT_DIR/$seq
 echo "QA output created by $seq"
 
 here=`pwd`
@@ -32,7 +32,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _cleanup()
 {
     cd /
-    rm -rf "$tmp".* "$testdir1"
+    rm -rf $tmp.* $testdir1
 }
 
 # get standard environment, filters and checks
@@ -46,12 +46,12 @@ _supported_os Linux
 _require_test_lsattr
 _require_test_reflink
 
-rm -f "$seqres.full"
+rm -f $seqres.full
 
 echo "Format and mount"
 testdir1="$TEST_DIR/test-$seq"
-rm -rf "$testdir1"
-mkdir "$testdir1"
+rm -rf $testdir1
+mkdir $testdir1
 
 echo "Create the original files"
 blksz="$(stat -f $testdir1 -c '%S')"
@@ -60,13 +60,14 @@ margin='7%'
 sz=$((blksz * blks))
 free_blocks0=$(stat -f $testdir1 -c '%f')
 nr=4
-_pwrite_byte 0x61 0 $sz "$testdir1/file1" >> "$seqres.full"
-_pwrite_byte 0x61 0 $sz "$testdir1/file2" >> "$seqres.full"
+filesize=$((blksz * nr))
+_pwrite_byte 0x61 0 $sz $testdir1/file1 >> $seqres.full
+_pwrite_byte 0x61 0 $sz $testdir1/file2 >> $seqres.full
 sync
 
 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 | _filter_test_dir
 $CHATTR_PROG -i $testdir1/file1 $testdir1/file2
 
 # success, all done
diff --git a/tests/generic/160 b/tests/generic/160
index 83325d5..3a91dc8 100755
--- a/tests/generic/160
+++ b/tests/generic/160
@@ -20,8 +20,8 @@
 # Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 #-----------------------------------------------------------------------
 
-seq=`basename "$0"`
-seqres="$RESULT_DIR/$seq"
+seq=`basename $0`
+seqres=$RESULT_DIR/$seq
 echo "QA output created by $seq"
 
 here=`pwd`
@@ -32,7 +32,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _cleanup()
 {
     cd /
-    rm -rf "$tmp".* "$testdir1"
+    rm -rf $tmp.* $testdir1
 }
 
 # get standard environment, filters and checks
@@ -46,12 +46,12 @@ _supported_os Linux
 _require_test_lsattr
 _require_test_dedupe
 
-rm -f "$seqres.full"
+rm -f $seqres.full
 
 echo "Format and mount"
 testdir1="$TEST_DIR/test-$seq"
-rm -rf "$testdir1"
-mkdir "$testdir1"
+rm -rf $testdir1
+mkdir $testdir1
 
 echo "Create the original files"
 blksz="$(stat -f $testdir1 -c '%S')"
@@ -60,13 +60,14 @@ margin='7%'
 sz=$((blksz * blks))
 free_blocks0=$(stat -f $testdir1 -c '%f')
 nr=4
-_pwrite_byte 0x61 0 $sz "$testdir1/file1" >> "$seqres.full"
-_pwrite_byte 0x61 0 $sz "$testdir1/file2" >> "$seqres.full"
+filesize=$((blksz * nr))
+_pwrite_byte 0x61 0 $sz $testdir1/file1 >> $seqres.full
+_pwrite_byte 0x61 0 $sz $testdir1/file2 >> $seqres.full
 sync
 
 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 | _filter_test_dir
 $CHATTR_PROG -i $testdir1/file1 $testdir1/file2
 
 # success, all done
diff --git a/tests/generic/161 b/tests/generic/161
index 1d5364e..7776b83 100755
--- a/tests/generic/161
+++ b/tests/generic/161
@@ -21,8 +21,8 @@
 #-----------------------------------------------------------------------
 #
 
-seq=`basename "$0"`
-seqres="$RESULT_DIR/$seq"
+seq=`basename $0`
+seqres=$RESULT_DIR/$seq
 echo "QA output created by $seq"
 
 here=`pwd`
@@ -33,7 +33,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 7 15
 _cleanup()
 {
     cd /
-    rm -rf "$tmp".*
+    rm -rf $tmp.*
     wait
 }
 
@@ -48,25 +48,24 @@ _require_scratch_reflink
 _require_cp_reflink
 
 echo "Format and mount"
-_scratch_mkfs > "$seqres.full" 2>&1
-_scratch_mount >> "$seqres.full" 2>&1
+_scratch_mkfs > $seqres.full 2>&1
+_scratch_mount >> $seqres.full 2>&1
 
-testdir="$SCRATCH_MNT/test-$seq"
-rm -rf "$testdir"
-mkdir "$testdir"
+testdir=$SCRATCH_MNT/test-$seq
+mkdir $testdir
 
 loops=4096
 blksz=65536
 
 echo "Initialize files"
-echo > "$seqres.full"
-_pwrite_byte 0x61 0 $((loops * blksz)) "$testdir/file1" >> "$seqres.full"
-_cp_reflink "$testdir/file1" "$testdir/file2"
+echo > $seqres.full
+_pwrite_byte 0x61 0 $((loops * blksz)) $testdir/file1 >> $seqres.full
+_cp_reflink $testdir/file1 $testdir/file2
 _scratch_remount
 
 echo "Delete while rewriting"
-rm -rf "$testdir/file1" &
-_pwrite_byte 0x62 0 $((loops * blksz)) "$testdir/file1" >> "$seqres.full"
+rm -rf $testdir/file1 &
+_pwrite_byte 0x62 0 $((loops * blksz)) $testdir/file1 >> $seqres.full
 wait
 
 # success, all done
diff --git a/tests/generic/162 b/tests/generic/162
index 9044545..6d5bb7a 100755
--- a/tests/generic/162
+++ b/tests/generic/162
@@ -21,8 +21,8 @@
 #-----------------------------------------------------------------------
 #
 
-seq=`basename "$0"`
-seqres="$RESULT_DIR/$seq"
+seq=`basename $0`
+seqres=$RESULT_DIR/$seq
 echo "QA output created by $seq"
 
 here=`pwd`
@@ -33,7 +33,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 7 15
 _cleanup()
 {
     cd /
-    rm -rf "$tmp".*
+    rm -rf $tmp.*
     wait
 }
 
@@ -47,27 +47,26 @@ _supported_os Linux
 _require_scratch_dedupe
 
 echo "Format and mount"
-_scratch_mkfs > "$seqres.full" 2>&1
-_scratch_mount >> "$seqres.full" 2>&1
+_scratch_mkfs > $seqres.full 2>&1
+_scratch_mount >> $seqres.full 2>&1
 
-testdir="$SCRATCH_MNT/test-$seq"
-rm -rf "$testdir"
-mkdir "$testdir"
+testdir=$SCRATCH_MNT/test-$seq
+mkdir $testdir
 
 loops=512
 nr_loops=$((loops - 1))
 blksz=65536
 
 echo "Initialize files"
-echo > "$seqres.full"
-_pwrite_byte 0x61 0 $((loops * blksz)) "$testdir/file1" >> "$seqres.full"
-_pwrite_byte 0x61 0 $((loops * blksz)) "$testdir/file2" >> "$seqres.full"
+echo > $seqres.full
+_pwrite_byte 0x61 0 $((loops * blksz)) $testdir/file1 >> $seqres.full
+_pwrite_byte 0x61 0 $((loops * blksz)) $testdir/file2 >> $seqres.full
 _scratch_remount
 
 overwrite() {
-	while [ ! -e "$testdir/finished" ]; do
+	while [ ! -e $testdir/finished ]; do
 		seq $nr_loops -1 0 | while read i; do
-			_pwrite_byte 0x61 $((i * blksz)) $blksz "$testdir/file2" >> "$seqres.full"
+			_pwrite_byte 0x61 $((i * blksz)) $blksz $testdir/file2 >> $seqres.full
 		done
 	done
 }
@@ -76,13 +75,13 @@ echo "Dedupe and rewrite the file!"
 overwrite &
 for i in `seq 1 2`; do
 	seq $nr_loops -1 0 | while read i; do
-		_dedupe_range   "$testdir/file1" $((i * blksz)) \
-				"$testdir/file2" $((i * blksz)) $blksz >> "$seqres.full"
+		_dedupe_range   $testdir/file1 $((i * blksz)) \
+				$testdir/file2 $((i * blksz)) $blksz >> $seqres.full
 		[ $? -ne 0 ] && break
 	done
 done
 echo "Finished dedupeing"
-touch "$testdir/finished"
+touch $testdir/finished
 wait
 
 # success, all done
diff --git a/tests/generic/163 b/tests/generic/163
index 651d445..b9b0cd7 100755
--- a/tests/generic/163
+++ b/tests/generic/163
@@ -21,8 +21,8 @@
 #-----------------------------------------------------------------------
 #
 
-seq=`basename "$0"`
-seqres="$RESULT_DIR/$seq"
+seq=`basename $0`
+seqres=$RESULT_DIR/$seq
 echo "QA output created by $seq"
 
 here=`pwd`
@@ -33,7 +33,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 7 15
 _cleanup()
 {
     cd /
-    rm -rf "$tmp".*
+    rm -rf $tmp.*
     wait
 }
 
@@ -47,27 +47,26 @@ _supported_os Linux
 _require_scratch_dedupe
 
 echo "Format and mount"
-_scratch_mkfs > "$seqres.full" 2>&1
-_scratch_mount >> "$seqres.full" 2>&1
+_scratch_mkfs > $seqres.full 2>&1
+_scratch_mount >> $seqres.full 2>&1
 
-testdir="$SCRATCH_MNT/test-$seq"
-rm -rf "$testdir"
-mkdir "$testdir"
+testdir=$SCRATCH_MNT/test-$seq
+mkdir $testdir
 
 loops=512
 nr_loops=$((loops - 1))
 blksz=65536
 
 echo "Initialize files"
-echo > "$seqres.full"
-_pwrite_byte 0x61 0 $((loops * blksz)) "$testdir/file1" >> "$seqres.full"
-_pwrite_byte 0x61 0 $((loops * blksz)) "$testdir/file2" >> "$seqres.full"
+echo > $seqres.full
+_pwrite_byte 0x61 0 $((loops * blksz)) $testdir/file1 >> $seqres.full
+_pwrite_byte 0x61 0 $((loops * blksz)) $testdir/file2 >> $seqres.full
 _scratch_remount
 
 overwrite() {
-	while [ ! -e "$testdir/finished" ]; do
+	while [ ! -e $testdir/finished ]; do
 		seq $nr_loops -1 0 | while read i; do
-			_pwrite_byte 0x61 $((i * blksz)) $blksz "$testdir/file1" >> "$seqres.full"
+			_pwrite_byte 0x61 $((i * blksz)) $blksz $testdir/file1 >> $seqres.full
 		done
 	done
 }
@@ -76,13 +75,13 @@ echo "Dedupe and rewrite the file!"
 overwrite &
 for i in `seq 1 2`; do
 	seq $nr_loops -1 0 | while read i; do
-		_dedupe_range   "$testdir/file1" $((i * blksz)) \
-				"$testdir/file2" $((i * blksz)) $blksz >> "$seqres.full"
+		_dedupe_range   $testdir/file1 $((i * blksz)) \
+				$testdir/file2 $((i * blksz)) $blksz >> $seqres.full
 		[ $? -ne 0 ] && break
 	done
 done
 echo "Finished dedupeing"
-touch "$testdir/finished"
+touch $testdir/finished
 wait
 
 # success, all done
diff --git a/tests/generic/164 b/tests/generic/164
index 6c19c7d..6c12724 100755
--- a/tests/generic/164
+++ b/tests/generic/164
@@ -22,7 +22,7 @@
 #-----------------------------------------------------------------------
 #
 
-seq=`basename "$0"`
+seq=`basename $0`
 seqres=$RESULT_DIR/$seq
 echo "QA output created by $seq"
 
@@ -34,7 +34,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 7 15
 _cleanup()
 {
     cd /
-    rm -rf "$tmp".*
+    rm -rf $tmp.*
     wait
 }
 
@@ -49,22 +49,21 @@ _require_scratch_reflink
 _require_cp_reflink
 
 echo "Format and mount"
-_scratch_mkfs > "$seqres.full" 2>&1
-_scratch_mount >> "$seqres.full" 2>&1
+_scratch_mkfs > $seqres.full 2>&1
+_scratch_mount >> $seqres.full 2>&1
 
-testdir="$SCRATCH_MNT/test-$seq"
-rm -rf "$testdir"
-mkdir "$testdir"
+testdir=$SCRATCH_MNT/test-$seq
+mkdir $testdir
 
 loops=512
 nr_loops=$((loops - 1))
 blksz=65536
 
 echo "Initialize files"
-echo > "$seqres.full"
-_pwrite_byte 0x61 0 $((loops * blksz)) "$testdir/file1" >> "$seqres.full"
-_pwrite_byte 0x62 0 $((loops * blksz)) "$testdir/file2" >> "$seqres.full"
-_cp_reflink "$testdir/file1" "$testdir/file3"
+echo > $seqres.full
+_pwrite_byte 0x61 0 $((loops * blksz)) $testdir/file1 >> $seqres.full
+_pwrite_byte 0x62 0 $((loops * blksz)) $testdir/file2 >> $seqres.full
+_cp_reflink $testdir/file1 $testdir/file3
 _scratch_remount
 
 fbytes() {
@@ -72,8 +71,8 @@ fbytes() {
 }
 
 reader() {
-	while [ ! -e "$testdir/finished" ]; do
-		_read_range "$testdir/file3" 0 $((loops * blksz)) | fbytes
+	while [ ! -e $testdir/finished ]; do
+		_read_range $testdir/file3 0 $((loops * blksz)) | fbytes
 	done
 }
 
@@ -81,18 +80,18 @@ echo "Reflink and reread the files!"
 reader &
 for i in `seq 1 2`; do
 	seq $nr_loops -1 0 | while read i; do
-		_reflink_range  "$testdir/file1" $((i * blksz)) \
-				"$testdir/file3" $((i * blksz)) $blksz >> "$seqres.full"
+		_reflink_range  $testdir/file1 $((i * blksz)) \
+				$testdir/file3 $((i * blksz)) $blksz >> $seqres.full
 		[ $? -ne 0 ] && break
 	done
 	seq $nr_loops -1 0 | while read i; do
-		_reflink_range  "$testdir/file2" $((i * blksz)) \
-				"$testdir/file3" $((i * blksz)) $blksz >> "$seqres.full"
+		_reflink_range  $testdir/file2 $((i * blksz)) \
+				$testdir/file3 $((i * blksz)) $blksz >> $seqres.full
 		[ $? -ne 0 ] && break
 	done
 done
 echo "Finished reflinking"
-touch "$testdir/finished"
+touch $testdir/finished
 wait
 
 # success, all done
diff --git a/tests/generic/165 b/tests/generic/165
index 2e380a9..e4c9a9d 100755
--- a/tests/generic/165
+++ b/tests/generic/165
@@ -22,7 +22,7 @@
 #-----------------------------------------------------------------------
 #
 
-seq=`basename "$0"`
+seq=`basename $0`
 seqres=$RESULT_DIR/$seq
 echo "QA output created by $seq"
 
@@ -34,7 +34,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 7 15
 _cleanup()
 {
     cd /
-    rm -rf "$tmp".*
+    rm -rf $tmp.*
     wait
 }
 
@@ -49,21 +49,20 @@ _require_scratch_reflink
 _require_cp_reflink
 
 echo "Format and mount"
-_scratch_mkfs > "$seqres.full" 2>&1
-_scratch_mount >> "$seqres.full" 2>&1
+_scratch_mkfs > $seqres.full 2>&1
+_scratch_mount >> $seqres.full 2>&1
 
-testdir="$SCRATCH_MNT/test-$seq"
-rm -rf "$testdir"
-mkdir "$testdir"
+testdir=$SCRATCH_MNT/test-$seq
+mkdir $testdir
 
 loops=512
 nr_loops=$((loops - 1))
 blksz=65536
 
 echo "Initialize files"
-echo > "$seqres.full"
-_pwrite_byte 0x61 0 $((loops * blksz)) "$testdir/file1" >> "$seqres.full"
-_pwrite_byte 0x62 0 $((loops * blksz)) "$testdir/file2" >> "$seqres.full"
+echo > $seqres.full
+_pwrite_byte 0x61 0 $((loops * blksz)) $testdir/file1 >> $seqres.full
+_pwrite_byte 0x62 0 $((loops * blksz)) $testdir/file2 >> $seqres.full
 _cp_reflink $testdir/file1 $testdir/file3
 _scratch_remount
 
@@ -72,8 +71,8 @@ fbytes() {
 }
 
 reader() {
-	while [ ! -e "$testdir/finished" ]; do
-		_read_range "$testdir/file3" 0 $((loops * blksz)) -d | fbytes
+	while [ ! -e $testdir/finished ]; do
+		_read_range $testdir/file3 0 $((loops * blksz)) -d | fbytes
 	done
 }
 
@@ -81,18 +80,18 @@ echo "Reflink and dio reread the files!"
 reader &
 for i in `seq 1 2`; do
 	seq $nr_loops -1 0 | while read i; do
-		_reflink_range  "$testdir/file1" $((i * blksz)) \
-				"$testdir/file3" $((i * blksz)) $blksz >> "$seqres.full"
+		_reflink_range  $testdir/file1 $((i * blksz)) \
+				$testdir/file3 $((i * blksz)) $blksz >> $seqres.full
 		[ $? -ne 0 ] && break
 	done
 	seq $nr_loops -1 0 | while read i; do
-		_reflink_range  "$testdir/file2" $((i * blksz)) \
-				"$testdir/file3" $((i * blksz)) $blksz >> "$seqres.full"
+		_reflink_range  $testdir/file2 $((i * blksz)) \
+				$testdir/file3 $((i * blksz)) $blksz >> $seqres.full
 		[ $? -ne 0 ] && break
 	done
 done
 echo "Finished reflinking"
-touch "$testdir/finished"
+touch $testdir/finished
 wait
 
 # success, all done
diff --git a/tests/generic/166 b/tests/generic/166
index 028ee11..9be753d 100755
--- a/tests/generic/166
+++ b/tests/generic/166
@@ -22,8 +22,8 @@
 #-----------------------------------------------------------------------
 #
 
-seq=`basename "$0"`
-seqres="$RESULT_DIR/$seq"
+seq=`basename $0`
+seqres=$RESULT_DIR/$seq
 echo "QA output created by $seq"
 
 here=`pwd`
@@ -34,7 +34,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 7 15
 _cleanup()
 {
     cd /
-    rm -rf "$tmp".*
+    rm -rf $tmp.*
     wait
 }
 
@@ -49,27 +49,26 @@ _require_scratch_reflink
 _require_cp_reflink
 
 echo "Format and mount"
-_scratch_mkfs > "$seqres.full" 2>&1
-_scratch_mount >> "$seqres.full" 2>&1
+_scratch_mkfs > $seqres.full 2>&1
+_scratch_mount >> $seqres.full 2>&1
 
-testdir="$SCRATCH_MNT/test-$seq"
-rm -rf "$testdir"
-mkdir "$testdir"
+testdir=$SCRATCH_MNT/test-$seq
+mkdir $testdir
 
 loops=1024
 nr_loops=$((loops - 1))
 blksz=65536
 
 echo "Initialize file"
-echo > "$seqres.full"
-_pwrite_byte 0x61 0 $((loops * blksz)) "$testdir/file1" >> "$seqres.full"
+echo > $seqres.full
+_pwrite_byte 0x61 0 $((loops * blksz)) $testdir/file1 >> $seqres.full
 _scratch_remount
 
 # Snapshot creator...
 snappy() {
 	n=0
-	while [ ! -e "$testdir/finished" ]; do
-		_cp_reflink "$testdir/file1" "$testdir/snap_$n" || break
+	while [ ! -e $testdir/finished ]; do
+		_cp_reflink $testdir/file1 $testdir/snap_$n || break
 		n=$((n + 1))
 	done
 }
@@ -77,7 +76,7 @@ snappy() {
 echo "Snapshot a file undergoing directio rewrite"
 snappy &
 seq $nr_loops -1 0 | while read i; do
-	_pwrite_byte 0x63 $((i * blksz)) $blksz -d "$testdir/file1" >> "$seqres.full"
+	_pwrite_byte 0x63 $((i * blksz)) $blksz -d $testdir/file1 >> $seqres.full
 done
 touch $testdir/finished
 wait
diff --git a/tests/generic/167 b/tests/generic/167
index a4bf4f4..ef8e75b 100755
--- a/tests/generic/167
+++ b/tests/generic/167
@@ -22,8 +22,8 @@
 #-----------------------------------------------------------------------
 #
 
-seq=`basename "$0"`
-seqres="$RESULT_DIR/$seq"
+seq=`basename $0`
+seqres=$RESULT_DIR/$seq
 echo "QA output created by $seq"
 
 here=`pwd`
@@ -34,7 +34,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 7 15
 _cleanup()
 {
     cd /
-    rm -rf "$tmp".*
+    rm -rf $tmp.*
     wait
 }
 
@@ -49,27 +49,26 @@ _require_scratch_reflink
 _require_cp_reflink
 
 echo "Format and mount"
-_scratch_mkfs > "$seqres.full" 2>&1
-_scratch_mount >> "$seqres.full" 2>&1
+_scratch_mkfs > $seqres.full 2>&1
+_scratch_mount >> $seqres.full 2>&1
 
-testdir="$SCRATCH_MNT/test-$seq"
-rm -rf "$testdir"
-mkdir "$testdir"
+testdir=$SCRATCH_MNT/test-$seq
+mkdir $testdir
 
 loops=1024
 nr_loops=$((loops - 1))
 blksz=65536
 
 echo "Initialize file"
-echo > "$seqres.full"
-_pwrite_byte 0x61 0 $((loops * blksz)) "$testdir/file1" >> "$seqres.full"
+echo > $seqres.full
+_pwrite_byte 0x61 0 $((loops * blksz)) $testdir/file1 >> $seqres.full
 _scratch_remount
 
 # Snapshot creator...
 snappy() {
 	n=0
-	while [ ! -e "$testdir/finished" ]; do
-		_cp_reflink "$testdir/file1" "$testdir/snap_$n" || break
+	while [ ! -e $testdir/finished ]; do
+		_cp_reflink $testdir/file1 $testdir/snap_$n || break
 		n=$((n + 1))
 	done
 }
@@ -77,7 +76,7 @@ snappy() {
 echo "Snapshot a file undergoing buffered rewrite"
 snappy &
 seq $nr_loops -1 0 | while read i; do
-	_pwrite_byte 0x63 $((i * blksz)) $blksz "$testdir/file1" >> "$seqres.full"
+	_pwrite_byte 0x63 $((i * blksz)) $blksz $testdir/file1 >> $seqres.full
 done
 touch $testdir/finished
 wait
diff --git a/tests/generic/168 b/tests/generic/168
index 2ffc5b6..bb4a5a1 100755
--- a/tests/generic/168
+++ b/tests/generic/168
@@ -22,8 +22,8 @@
 #-----------------------------------------------------------------------
 #
 
-seq=`basename "$0"`
-seqres="$RESULT_DIR/$seq"
+seq=`basename $0`
+seqres=$RESULT_DIR/$seq
 echo "QA output created by $seq"
 
 here=`pwd`
@@ -34,7 +34,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 7 15
 _cleanup()
 {
     cd /
-    rm -rf "$tmp".*
+    rm -rf $tmp.*
     wait
 }
 
@@ -48,28 +48,27 @@ _supported_os Linux
 _require_scratch_reflink
 
 echo "Format and mount"
-_scratch_mkfs > "$seqres.full" 2>&1
-_scratch_mount >> "$seqres.full" 2>&1
+_scratch_mkfs > $seqres.full 2>&1
+_scratch_mount >> $seqres.full 2>&1
 
-testdir="$SCRATCH_MNT/test-$seq"
-rm -rf "$testdir"
-mkdir "$testdir"
+testdir=$SCRATCH_MNT/test-$seq
+mkdir $testdir
 
 loops=1024
 nr_loops=$((loops - 1))
 blksz=65536
 
 echo "Initialize files"
-echo > "$seqres.full"
-_pwrite_byte 0x61 0 $((loops * blksz)) "$testdir/file1" >> "$seqres.full"
-_pwrite_byte 0x62 0 $((loops * blksz)) "$testdir/file2" >> "$seqres.full"
+echo > $seqres.full
+_pwrite_byte 0x61 0 $((loops * blksz)) $testdir/file1 >> $seqres.full
+_pwrite_byte 0x62 0 $((loops * blksz)) $testdir/file2 >> $seqres.full
 _scratch_remount
 
 # Direct I/O overwriter...
 overwrite() {
-	while [ ! -e "$testdir/finished" ]; do
+	while [ ! -e $testdir/finished ]; do
 		seq $nr_loops -1 0 | while read i; do
-			_pwrite_byte 0x63 $((i * blksz)) $blksz "$testdir/file2" >> "$seqres.full"
+			_pwrite_byte 0x63 $((i * blksz)) $blksz $testdir/file2 >> $seqres.full
 		done
 	done
 }
@@ -78,12 +77,12 @@ echo "Reflink and write the target"
 overwrite &
 seq 1 10 | while read j; do
 	seq 0 $nr_loops | while read i; do
-		_reflink_range  "$testdir/file1" $((i * blksz)) \
-				"$testdir/file2" $((i * blksz)) $blksz >> "$seqres.full"
+		_reflink_range  $testdir/file1 $((i * blksz)) \
+				$testdir/file2 $((i * blksz)) $blksz >> $seqres.full
 		[ $? -ne 0 ] && exit
 	done
 done
-touch "$testdir/finished"
+touch $testdir/finished
 wait
 
 # success, all done
diff --git a/tests/generic/170 b/tests/generic/170
index 2a81cad..dbf1564 100755
--- a/tests/generic/170
+++ b/tests/generic/170
@@ -22,8 +22,8 @@
 #-----------------------------------------------------------------------
 #
 
-seq=`basename "$0"`
-seqres="$RESULT_DIR/$seq"
+seq=`basename $0`
+seqres=$RESULT_DIR/$seq
 echo "QA output created by $seq"
 
 here=`pwd`
@@ -34,7 +34,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 7 15
 _cleanup()
 {
     cd /
-    rm -rf "$tmp".*
+    rm -rf $tmp.*
     wait
 }
 
@@ -48,28 +48,27 @@ _supported_os Linux
 _require_scratch_reflink
 
 echo "Format and mount"
-_scratch_mkfs > "$seqres.full" 2>&1
-_scratch_mount >> "$seqres.full" 2>&1
+_scratch_mkfs > $seqres.full 2>&1
+_scratch_mount >> $seqres.full 2>&1
 
-testdir="$SCRATCH_MNT/test-$seq"
-rm -rf "$testdir"
-mkdir "$testdir"
+testdir=$SCRATCH_MNT/test-$seq
+mkdir $testdir
 
 loops=1024
 nr_loops=$((loops - 1))
 blksz=65536
 
 echo "Initialize files"
-echo > "$seqres.full"
-_pwrite_byte 0x61 0 $((loops * blksz)) "$testdir/file1" >> "$seqres.full"
-_pwrite_byte 0x62 0 $((loops * blksz)) "$testdir/file2" >> "$seqres.full"
+echo > $seqres.full
+_pwrite_byte 0x61 0 $((loops * blksz)) $testdir/file1 >> $seqres.full
+_pwrite_byte 0x62 0 $((loops * blksz)) $testdir/file2 >> $seqres.full
 _scratch_remount
 
 # Direct I/O overwriter...
 overwrite() {
-	while [ ! -e "$testdir/finished" ]; do
+	while [ ! -e $testdir/finished ]; do
 		seq $nr_loops -1 0 | while read i; do
-			_pwrite_byte 0x63 $((i * blksz)) $blksz -d "$testdir/file2" >> "$seqres.full"
+			_pwrite_byte 0x63 $((i * blksz)) $blksz -d $testdir/file2 >> $seqres.full
 		done
 	done
 }
@@ -78,12 +77,12 @@ echo "Reflink and dio write the target"
 overwrite &
 seq 1 10 | while read j; do
 	seq 0 $nr_loops | while read i; do
-		_reflink_range  "$testdir/file1" $((i * blksz)) \
-				"$testdir/file2" $((i * blksz)) $blksz >> "$seqres.full"
+		_reflink_range  $testdir/file1 $((i * blksz)) \
+				$testdir/file2 $((i * blksz)) $blksz >> $seqres.full
 		[ $? -ne 0 ] && exit
 	done
 done
-touch "$testdir/finished"
+touch $testdir/finished
 wait
 
 # success, all done
diff --git a/tests/generic/171 b/tests/generic/171
index d865f64..8a3f246 100755
--- a/tests/generic/171
+++ b/tests/generic/171
@@ -21,8 +21,8 @@
 # Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 #-----------------------------------------------------------------------
 
-seq=`basename "$0"`
-seqres="$RESULT_DIR/$seq"
+seq=`basename $0`
+seqres=$RESULT_DIR/$seq
 echo "QA output created by $seq"
 
 here=`pwd`
@@ -33,7 +33,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _cleanup()
 {
     cd /
-    rm -rf "$tmp".* "$testdir1"
+    rm -rf $tmp.* $testdir1
 }
 
 # get standard environment, filters and checks
@@ -47,53 +47,52 @@ _supported_os Linux
 _require_scratch_reflink
 _require_cp_reflink
 
-rm -f "$seqres.full"
+rm -f $seqres.full
 
 echo "Format and mount"
-_scratch_mkfs > "$seqres.full" 2>&1
-_scratch_mount >> "$seqres.full" 2>&1
+_scratch_mkfs > $seqres.full 2>&1
+_scratch_mount >> $seqres.full 2>&1
 
-testdir="$SCRATCH_MNT/test-$seq"
-rm -rf "$testdir"
-mkdir "$testdir"
+testdir=$SCRATCH_MNT/test-$seq
+mkdir $testdir
 
 echo "Reformat with appropriate size"
-blksz="$(stat -f "$testdir" -c '%S')"
+blksz="$(stat -f $testdir -c '%S')"
 nr_blks=10240
-umount "$SCRATCH_MNT"
+umount $SCRATCH_MNT
 sz_bytes=$((nr_blks * 8 * blksz))
 if [ $sz_bytes -lt $((32 * 1048576)) ]; then
 	sz_bytes=$((32 * 1048576))
 fi
-_scratch_mkfs_sized $sz_bytes >> "$seqres.full" 2>&1
-_scratch_mount >> "$seqres.full" 2>&1
-rm -rf "$testdir"
-mkdir "$testdir"
+_scratch_mkfs_sized $sz_bytes >> $seqres.full 2>&1
+_scratch_mount >> $seqres.full 2>&1
+rm -rf $testdir
+mkdir $testdir
 
 echo "Create a big file and reflink it"
-_pwrite_byte 0x61 0 $((blksz * nr_blks)) "$testdir/bigfile" >> "$seqres.full" 2>&1
-_cp_reflink "$testdir/bigfile" "$testdir/clonefile"
+_pwrite_byte 0x61 0 $((blksz * nr_blks)) $testdir/bigfile >> $seqres.full 2>&1
+_cp_reflink $testdir/bigfile $testdir/clonefile
 sync
 
 echo "Allocate the rest of the space"
-nr_free="$(stat -f -c '%f' "$testdir")"
-touch "$testdir/file0" "$testdir/file1"
-_pwrite_byte 0x61 0 $((blksz * nr_free)) "$testdir/eat_my_space" >> "$seqres.full" 2>&1
+nr_free=$(stat -f -c '%f' $testdir)
+touch $testdir/file0 $testdir/file1
+_pwrite_byte 0x61 0 $((blksz * nr_free)) $testdir/eat_my_space >> $seqres.full 2>&1
 sync
 
 echo "CoW the big file"
-out="$(_pwrite_byte 0x62 0 $((blksz * nr_blks)) "$testdir/bigfile" 2>&1)"
-echo "${out}" | grep -q "No space left on device" || echo "CoW should have failed with ENOSPC"
-echo "${out}" >> "$seqres.full" 2>&1
-echo "${out}"
+out="$(_pwrite_byte 0x62 0 $((blksz * nr_blks)) $testdir/bigfile 2>&1)"
+echo ${out} | grep -q "No space left on device" || echo "CoW should have failed with ENOSPC"
+echo ${out} >> $seqres.full 2>&1
+echo ${out}
 
 echo "Remount and try CoW again"
 _scratch_remount
 
-out="$(_pwrite_byte 0x62 0 $((blksz * nr_blks)) "$testdir/bigfile" 2>&1)"
-echo "${out}" | grep -q "No space left on device" || echo "CoW should have failed with ENOSPC"
-echo "${out}" >> "$seqres.full" 2>&1
-echo "${out}"
+out="$(_pwrite_byte 0x62 0 $((blksz * nr_blks)) $testdir/bigfile 2>&1)"
+echo ${out} | grep -q "No space left on device" || echo "CoW should have failed with ENOSPC"
+echo ${out} >> $seqres.full 2>&1
+echo ${out}
 
 # success, all done
 status=0
diff --git a/tests/generic/172 b/tests/generic/172
index e6020f1..3e32644 100755
--- a/tests/generic/172
+++ b/tests/generic/172
@@ -21,8 +21,8 @@
 # Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 #-----------------------------------------------------------------------
 
-seq=`basename "$0"`
-seqres="$RESULT_DIR/$seq"
+seq=`basename $0`
+seqres=$RESULT_DIR/$seq
 echo "QA output created by $seq"
 
 here=`pwd`
@@ -33,7 +33,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _cleanup()
 {
     cd /
-    rm -rf "$tmp".* "$testdir1"
+    rm -rf $tmp.* $testdir1
 }
 
 # get standard environment, filters and checks
@@ -47,53 +47,52 @@ _supported_os Linux
 _require_scratch_reflink
 _require_cp_reflink
 
-rm -f "$seqres.full"
+rm -f $seqres.full
 
 echo "Format and mount"
-_scratch_mkfs > "$seqres.full" 2>&1
-_scratch_mount >> "$seqres.full" 2>&1
+_scratch_mkfs > $seqres.full 2>&1
+_scratch_mount >> $seqres.full 2>&1
 
-testdir="$SCRATCH_MNT/test-$seq"
-rm -rf "$testdir"
-mkdir "$testdir"
+testdir=$SCRATCH_MNT/test-$seq
+mkdir $testdir
 
 echo "Reformat with appropriate size"
-blksz="$(stat -f "$testdir" -c '%S')"
+blksz="$(stat -f $testdir -c '%S')"
 nr_blks=10240
-umount "$SCRATCH_MNT"
+umount $SCRATCH_MNT
 sz_bytes=$((nr_blks * 3 / 2 * blksz))
 if [ $sz_bytes -lt $((32 * 1048576)) ]; then
 	sz_bytes=$((32 * 1048576))
 fi
-_scratch_mkfs_sized $sz_bytes >> "$seqres.full" 2>&1
-_scratch_mount >> "$seqres.full" 2>&1
-rm -rf "$testdir"
-mkdir "$testdir"
+_scratch_mkfs_sized $sz_bytes >> $seqres.full 2>&1
+_scratch_mount >> $seqres.full 2>&1
+rm -rf $testdir
+mkdir $testdir
 
 echo "Create a big file and reflink it"
-_pwrite_byte 0x61 0 $((blksz * nr_blks)) "$testdir/bigfile" >> "$seqres.full" 2>&1
-_cp_reflink "$testdir/bigfile" "$testdir/clonefile"
+_pwrite_byte 0x61 0 $((blksz * nr_blks)) $testdir/bigfile >> $seqres.full 2>&1
+_cp_reflink $testdir/bigfile $testdir/clonefile
 sync
 
 echo "Allocate the rest of the space"
-nr_free="$(stat -f -c '%f' "$testdir")"
-touch "$testdir/file0" "$testdir/file1"
-_pwrite_byte 0x61 0 $((blksz * nr_free)) "$testdir/eat_my_space" >> "$seqres.full" 2>&1
+nr_free=$(stat -f -c '%f' $testdir)
+touch $testdir/file0 $testdir/file1
+_pwrite_byte 0x61 0 $((blksz * nr_free)) $testdir/eat_my_space >> $seqres.full 2>&1
 sync
 
 echo "CoW the big file"
-out="$(_pwrite_byte 0x62 0 $((blksz * nr_blks)) "$testdir/bigfile" 2>&1)"
-echo "${out}" | grep -q "No space left on device" || echo "CoW should have failed with ENOSPC"
-echo "${out}" >> "$seqres.full" 2>&1
-echo "${out}"
+out="$(_pwrite_byte 0x62 0 $((blksz * nr_blks)) $testdir/bigfile 2>&1)"
+echo ${out} | grep -q "No space left on device" || echo "CoW should have failed with ENOSPC"
+echo ${out} >> $seqres.full 2>&1
+echo ${out}
 
 echo "Remount and try CoW again"
 _scratch_remount
 
-out="$(_pwrite_byte 0x62 0 $((blksz * nr_blks)) "$testdir/bigfile" 2>&1)"
-echo "${out}" | grep -q "No space left on device" || echo "CoW should have failed with ENOSPC"
-echo "${out}" >> "$seqres.full" 2>&1
-echo "${out}"
+out="$(_pwrite_byte 0x62 0 $((blksz * nr_blks)) $testdir/bigfile 2>&1)"
+echo ${out} | grep -q "No space left on device" || echo "CoW should have failed with ENOSPC"
+echo ${out} >> $seqres.full 2>&1
+echo ${out}
 
 # success, all done
 status=0
diff --git a/tests/generic/173 b/tests/generic/173
index 61c6b32..fe085a6 100755
--- a/tests/generic/173
+++ b/tests/generic/173
@@ -21,8 +21,8 @@
 # Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 #-----------------------------------------------------------------------
 
-seq=`basename "$0"`
-seqres="$RESULT_DIR/$seq"
+seq=`basename $0`
+seqres=$RESULT_DIR/$seq
 echo "QA output created by $seq"
 
 here=`pwd`
@@ -33,7 +33,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _cleanup()
 {
     cd /
-    rm -rf "$tmp".* "$testdir1"
+    rm -rf $tmp.* $testdir1
 }
 
 # get standard environment, filters and checks
@@ -47,53 +47,52 @@ _supported_os Linux
 _require_scratch_reflink
 _require_cp_reflink
 
-rm -f "$seqres.full"
+rm -f $seqres.full
 
 echo "Format and mount"
-_scratch_mkfs > "$seqres.full" 2>&1
-_scratch_mount >> "$seqres.full" 2>&1
+_scratch_mkfs > $seqres.full 2>&1
+_scratch_mount >> $seqres.full 2>&1
 
-testdir="$SCRATCH_MNT/test-$seq"
-rm -rf "$testdir"
-mkdir "$testdir"
+testdir=$SCRATCH_MNT/test-$seq
+mkdir $testdir
 
 echo "Reformat with appropriate size"
-blksz="$(stat -f "$testdir" -c '%S')"
+blksz="$(stat -f $testdir -c '%S')"
 nr_blks=10240
-umount "$SCRATCH_MNT"
+umount $SCRATCH_MNT
 sz_bytes=$((nr_blks * 8 * blksz))
 if [ $sz_bytes -lt $((32 * 1048576)) ]; then
 	sz_bytes=$((32 * 1048576))
 fi
-_scratch_mkfs_sized $sz_bytes >> "$seqres.full" 2>&1
-_scratch_mount >> "$seqres.full" 2>&1
-rm -rf "$testdir"
-mkdir "$testdir"
+_scratch_mkfs_sized $sz_bytes >> $seqres.full 2>&1
+_scratch_mount >> $seqres.full 2>&1
+rm -rf $testdir
+mkdir $testdir
 
 echo "Create a big file and reflink it"
-_pwrite_byte 0x61 0 $((blksz * nr_blks)) "$testdir/bigfile" >> "$seqres.full" 2>&1
-_cp_reflink "$testdir/bigfile" "$testdir/clonefile"
+_pwrite_byte 0x61 0 $((blksz * nr_blks)) $testdir/bigfile >> $seqres.full 2>&1
+_cp_reflink $testdir/bigfile $testdir/clonefile
 sync
 
 echo "Allocate the rest of the space"
-nr_free="$(stat -f -c '%f' "$testdir")"
-touch "$testdir/file0" "$testdir/file1"
-_pwrite_byte 0x61 0 $((blksz * nr_free)) "$testdir/eat_my_space" >> "$seqres.full" 2>&1
+nr_free=$(stat -f -c '%f' $testdir)
+touch $testdir/file0 $testdir/file1
+_pwrite_byte 0x61 0 $((blksz * nr_free)) $testdir/eat_my_space >> $seqres.full 2>&1
 sync
 
 echo "mmap CoW the big file"
-out="$(_mwrite_byte 0x62 0 $((blksz * nr_blks)) $((blksz * nr_blks)) "$testdir/bigfile" 2>&1)"
+out="$(_mwrite_byte 0x62 0 $((blksz * nr_blks)) $((blksz * nr_blks)) $testdir/bigfile 2>&1)"
 err="$?"
-if [ "$err" -lt 128 ]; then
+if [ $err -lt 128 ]; then
 	echo "mmap CoW should have failed with SIGBUS, got SIG$(kill -l $err)"
 fi
 
 echo "Remount and try CoW again"
 _scratch_remount
 
-out="$(_mwrite_byte 0x62 0 $((blksz * nr_blks)) $((blksz * nr_blks)) "$testdir/bigfile" 2>&1)"
+out="$(_mwrite_byte 0x62 0 $((blksz * nr_blks)) $((blksz * nr_blks)) $testdir/bigfile 2>&1)"
 err="$?"
-if [ "$err" -lt 128 ]; then
+if [ $err -lt 128 ]; then
 	echo "mmap CoW should have failed with SIGBUS, got SIG$(kill -l $err)"
 fi
 
diff --git a/tests/generic/174 b/tests/generic/174
index dd6fe5a..cec2f05 100755
--- a/tests/generic/174
+++ b/tests/generic/174
@@ -21,8 +21,8 @@
 # Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 #-----------------------------------------------------------------------
 
-seq=`basename "$0"`
-seqres="$RESULT_DIR/$seq"
+seq=`basename $0`
+seqres=$RESULT_DIR/$seq
 echo "QA output created by $seq"
 
 here=`pwd`
@@ -33,7 +33,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _cleanup()
 {
     cd /
-    rm -rf "$tmp".* "$testdir1"
+    rm -rf $tmp.* $testdir1
 }
 
 # get standard environment, filters and checks
@@ -47,53 +47,52 @@ _supported_os Linux
 _require_scratch_reflink
 _require_cp_reflink
 
-rm -f "$seqres.full"
+rm -f $seqres.full
 
 echo "Format and mount"
-_scratch_mkfs > "$seqres.full" 2>&1
-_scratch_mount >> "$seqres.full" 2>&1
+_scratch_mkfs > $seqres.full 2>&1
+_scratch_mount >> $seqres.full 2>&1
 
-testdir="$SCRATCH_MNT/test-$seq"
-rm -rf "$testdir"
-mkdir "$testdir"
+testdir=$SCRATCH_MNT/test-$seq
+mkdir $testdir
 
 echo "Reformat with appropriate size"
-blksz="$(stat -f "$testdir" -c '%S')"
+blksz="$(stat -f $testdir -c '%S')"
 nr_blks=10240
-umount "$SCRATCH_MNT"
+umount $SCRATCH_MNT
 sz_bytes=$((nr_blks * 8 * blksz))
 if [ $sz_bytes -lt $((32 * 1048576)) ]; then
 	sz_bytes=$((32 * 1048576))
 fi
-_scratch_mkfs_sized $sz_bytes >> "$seqres.full" 2>&1
-_scratch_mount >> "$seqres.full" 2>&1
-rm -rf "$testdir"
-mkdir "$testdir"
+_scratch_mkfs_sized $sz_bytes >> $seqres.full 2>&1
+_scratch_mount >> $seqres.full 2>&1
+rm -rf $testdir
+mkdir $testdir
 
 echo "Create a big file and reflink it"
-_pwrite_byte 0x61 0 $((blksz * nr_blks)) "$testdir/bigfile" >> "$seqres.full" 2>&1
-_cp_reflink "$testdir/bigfile" "$testdir/clonefile"
+_pwrite_byte 0x61 0 $((blksz * nr_blks)) $testdir/bigfile >> $seqres.full 2>&1
+_cp_reflink $testdir/bigfile $testdir/clonefile
 sync
 
 echo "Allocate the rest of the space"
-nr_free="$(stat -f -c '%f' "$testdir")"
-touch "$testdir/file0" "$testdir/file1"
-_pwrite_byte 0x61 0 $((blksz * nr_free)) "$testdir/eat_my_space" >> "$seqres.full" 2>&1
+nr_free=$(stat -f -c '%f' $testdir)
+touch $testdir/file0 $testdir/file1
+_pwrite_byte 0x61 0 $((blksz * nr_free)) $testdir/eat_my_space >> $seqres.full 2>&1
 sync
 
 echo "CoW the big file"
-out="$(_pwrite_byte 0x62 0 $((blksz * nr_blks)) "$testdir/bigfile" -d 2>&1)"
-echo "${out}" | grep -q "No space left on device" || echo "CoW should have failed with ENOSPC"
-echo "${out}" >> "$seqres.full" 2>&1
-echo "${out}"
+out="$(_pwrite_byte 0x62 0 $((blksz * nr_blks)) $testdir/bigfile -d 2>&1)"
+echo ${out} | grep -q "No space left on device" || echo "CoW should have failed with ENOSPC"
+echo ${out} >> $seqres.full 2>&1
+echo ${out}
 
 echo "Remount and try CoW again"
 _scratch_remount
 
-out="$(_pwrite_byte 0x62 0 $((blksz * nr_blks)) "$testdir/bigfile" -d 2>&1)"
-echo "${out}" | grep -q "No space left on device" || echo "CoW should have failed with ENOSPC"
-echo "${out}" >> "$seqres.full" 2>&1
-echo "${out}"
+out="$(_pwrite_byte 0x62 0 $((blksz * nr_blks)) $testdir/bigfile -d 2>&1)"
+echo ${out} | grep -q "No space left on device" || echo "CoW should have failed with ENOSPC"
+echo ${out} >> $seqres.full 2>&1
+echo ${out}
 
 # success, all done
 status=0
diff --git a/tests/generic/178 b/tests/generic/178
index f1bc963..68432e7 100755
--- a/tests/generic/178
+++ b/tests/generic/178
@@ -20,8 +20,8 @@
 # Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 #-----------------------------------------------------------------------
 
-seq=`basename "$0"`
-seqres="$RESULT_DIR/$seq"
+seq=`basename $0`
+seqres=$RESULT_DIR/$seq
 echo "QA output created by $seq"
 
 here=`pwd`
@@ -32,7 +32,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _cleanup()
 {
     cd /
-    rm -rf "$tmp".* "$testdir"
+    rm -rf $tmp.* $testdir
 }
 
 # get standard environment, filters and checks
@@ -46,31 +46,32 @@ _require_test_reflink
 _require_cp_reflink
 _require_xfs_io_command "fpunch"
 
-rm -f "$seqres.full"
+rm -f $seqres.full
 
-testdir="$TEST_DIR/test-$seq"
-rm -rf "$testdir"
-mkdir "$testdir"
+testdir=$TEST_DIR/test-$seq
+rm -rf $testdir
+mkdir $testdir
 
 echo "Create the original files"
 blksz=65536
 nr=512
-_pwrite_byte 0x61 0 $((blksz * nr)) "$testdir/file1" >> "$seqres.full"
+filesize=$((blksz * nr))
+_pwrite_byte 0x61 0 $filesize $testdir/file1 >> $seqres.full
 
-_cp_reflink "$testdir/file1" "$testdir/file2"
+_cp_reflink $testdir/file1 $testdir/file2
 _test_remount
 
-md5sum "$testdir/file1" | _filter_test_dir
-md5sum "$testdir/file2" | _filter_test_dir
+md5sum $testdir/file1 | _filter_test_dir
+md5sum $testdir/file2 | _filter_test_dir
 
 echo "Write and punch"
-_pwrite_byte 0x62 0 $((blksz * 256)) "$testdir/file2" >> "$seqres.full"
-"$XFS_IO_PROG" -f -c "fpunch $blksz $((blksz * 254))" "$testdir/file2"
+_pwrite_byte 0x62 0 $((blksz * 256)) $testdir/file2 >> $seqres.full
+$XFS_IO_PROG -f -c "fpunch $blksz $((blksz * 254))" $testdir/file2
 _test_remount
 
 echo "Compare results"
-md5sum "$testdir/file1" | _filter_test_dir
-md5sum "$testdir/file2" | _filter_test_dir
+md5sum $testdir/file1 | _filter_test_dir
+md5sum $testdir/file2 | _filter_test_dir
 
 # success, all done
 status=0
diff --git a/tests/generic/179 b/tests/generic/179
index 8e1e059..27c25e7 100755
--- a/tests/generic/179
+++ b/tests/generic/179
@@ -23,8 +23,8 @@
 # Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 #-----------------------------------------------------------------------
 
-seq=`basename "$0"`
-seqres="$RESULT_DIR/$seq"
+seq=`basename $0`
+seqres=$RESULT_DIR/$seq
 echo "QA output created by $seq"
 
 here=`pwd`
@@ -35,7 +35,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _cleanup()
 {
     cd /
-    rm -rf "$tmp".* "$testdir"
+    rm -rf $tmp.* $testdir
 }
 
 # get standard environment, filters and checks
@@ -49,47 +49,47 @@ _require_test_reflink
 _require_cp_reflink
 _require_xfs_io_command "fpunch"
 
-rm -f "$seqres.full"
+rm -f $seqres.full
 
-testdir="$TEST_DIR/test-$seq"
-rm -rf "$testdir"
-mkdir "$testdir"
+testdir=$TEST_DIR/test-$seq
+rm -rf $testdir
+mkdir $testdir
 
 echo "Create the original files"
 blksz=65536
-_pwrite_byte 0x61 0 $((blksz * 3)) "$testdir/file1" >> "$seqres.full"
+_pwrite_byte 0x61 0 $((blksz * 3)) $testdir/file1 >> $seqres.full
 
-_cp_reflink "$testdir/file1" "$testdir/file2"
+_cp_reflink $testdir/file1 $testdir/file2
 
-_pwrite_byte 0x61 0 $((blksz * 3)) "$testdir/file2.chk" >> "$seqres.full"
-_pwrite_byte 0x00 $((blksz - 17)) $((blksz + 17)) "$testdir/file2.chk" >> "$seqres.full"
+_pwrite_byte 0x61 0 $((blksz * 3)) $testdir/file2.chk >> $seqres.full
+_pwrite_byte 0x00 $((blksz - 17)) $((blksz + 17)) $testdir/file2.chk >> $seqres.full
 _test_remount
 
-md5sum "$testdir/file1" | _filter_test_dir
-md5sum "$testdir/file2" | _filter_test_dir
-md5sum "$testdir/file2.chk" | _filter_test_dir
+md5sum $testdir/file1 | _filter_test_dir
+md5sum $testdir/file2 | _filter_test_dir
+md5sum $testdir/file2.chk | _filter_test_dir
 
-c1="$(_md5_checksum "$testdir/file1")"
-c2="$(_md5_checksum "$testdir/file2")"
+c1=$(_md5_checksum $testdir/file1)
+c2=$(_md5_checksum $testdir/file2)
 
-test "${c1}" = "${c2}" || echo "file1 and file2 should match"
+test ${c1} = ${c2} || echo "file1 and file2 should match"
 
 echo "fpunch files"
-"$XFS_IO_PROG" -f -c "fpunch $((blksz - 17)) $((blksz + 17))" "$testdir/file2"
+$XFS_IO_PROG -f -c "fpunch $((blksz - 17)) $((blksz + 17))" $testdir/file2
 _test_remount
 
 echo "Compare files"
-md5sum "$testdir/file1" | _filter_test_dir
-md5sum "$testdir/file2" | _filter_test_dir
-md5sum "$testdir/file2.chk" | _filter_test_dir
+md5sum $testdir/file1 | _filter_test_dir
+md5sum $testdir/file2 | _filter_test_dir
+md5sum $testdir/file2.chk | _filter_test_dir
 
-c1="$(_md5_checksum "$testdir/file1")"
-c2="$(_md5_checksum "$testdir/file2")"
+c1=$(_md5_checksum $testdir/file1)
+c2=$(_md5_checksum $testdir/file2)
 
-test "${c1}" != "${c2}" || echo "file1 and file2 should not match"
+test ${c1} != ${c2} || echo "file1 and file2 should not match"
 
 echo "Compare against check files"
-cmp -s "$testdir/file2" "$testdir/file2.chk" || echo "file2 and file2.chk do not match"
+cmp -s $testdir/file2 $testdir/file2.chk || echo "file2 and file2.chk do not match"
 
 # success, all done
 status=0
diff --git a/tests/generic/180 b/tests/generic/180
index dc6cbbb..a0f30a2 100755
--- a/tests/generic/180
+++ b/tests/generic/180
@@ -23,8 +23,8 @@
 # Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 #-----------------------------------------------------------------------
 
-seq=`basename "$0"`
-seqres="$RESULT_DIR/$seq"
+seq=`basename $0`
+seqres=$RESULT_DIR/$seq
 echo "QA output created by $seq"
 
 here=`pwd`
@@ -35,7 +35,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _cleanup()
 {
     cd /
-    rm -rf "$tmp".* "$testdir"
+    rm -rf $tmp.* $testdir
 }
 
 # get standard environment, filters and checks
@@ -49,47 +49,47 @@ _require_test_reflink
 _require_cp_reflink
 _require_xfs_io_command "fzero"
 
-rm -f "$seqres.full"
+rm -f $seqres.full
 
-testdir="$TEST_DIR/test-$seq"
-rm -rf "$testdir"
-mkdir "$testdir"
+testdir=$TEST_DIR/test-$seq
+rm -rf $testdir
+mkdir $testdir
 
 echo "Create the original files"
 blksz=65536
-_pwrite_byte 0x61 0 $((blksz * 3)) "$testdir/file1" >> "$seqres.full"
+_pwrite_byte 0x61 0 $((blksz * 3)) $testdir/file1 >> $seqres.full
 
-_cp_reflink "$testdir/file1" "$testdir/file2"
+_cp_reflink $testdir/file1 $testdir/file2
 
-_pwrite_byte 0x61 0 $((blksz * 3)) "$testdir/file2.chk" >> "$seqres.full"
-_pwrite_byte 0x00 $((blksz - 17)) $((blksz + 17)) "$testdir/file2.chk" >> "$seqres.full"
+_pwrite_byte 0x61 0 $((blksz * 3)) $testdir/file2.chk >> $seqres.full
+_pwrite_byte 0x00 $((blksz - 17)) $((blksz + 17)) $testdir/file2.chk >> $seqres.full
 _test_remount
 
-md5sum "$testdir/file1" | _filter_test_dir
-md5sum "$testdir/file2" | _filter_test_dir
-md5sum "$testdir/file2.chk" | _filter_test_dir
+md5sum $testdir/file1 | _filter_test_dir
+md5sum $testdir/file2 | _filter_test_dir
+md5sum $testdir/file2.chk | _filter_test_dir
 
-c1="$(_md5_checksum "$testdir/file1")"
-c2="$(_md5_checksum "$testdir/file2")"
+c1=$(_md5_checksum $testdir/file1)
+c2=$(_md5_checksum $testdir/file2)
 
-test "${c1}" = "${c2}" || echo "file1 and file2 should match"
+test ${c1} = ${c2} || echo "file1 and file2 should match"
 
 echo "fzero files"
-"$XFS_IO_PROG" -f -c "fzero $((blksz - 17)) $((blksz + 17))" "$testdir/file2"
+$XFS_IO_PROG -f -c "fzero $((blksz - 17)) $((blksz + 17))" $testdir/file2
 _test_remount
 
 echo "Compare files"
-md5sum "$testdir/file1" | _filter_test_dir
-md5sum "$testdir/file2" | _filter_test_dir
-md5sum "$testdir/file2.chk" | _filter_test_dir
+md5sum $testdir/file1 | _filter_test_dir
+md5sum $testdir/file2 | _filter_test_dir
+md5sum $testdir/file2.chk | _filter_test_dir
 
-c1="$(_md5_checksum "$testdir/file1")"
-c2="$(_md5_checksum "$testdir/file2")"
+c1=$(_md5_checksum $testdir/file1)
+c2=$(_md5_checksum $testdir/file2)
 
-test "${c1}" != "${c2}" || echo "file1 and file2 should not match"
+test ${c1} != ${c2} || echo "file1 and file2 should not match"
 
 echo "Compare against check files"
-cmp -s "$testdir/file2" "$testdir/file2.chk" || echo "file2 and file2.chk do not match"
+cmp -s $testdir/file2 $testdir/file2.chk || echo "file2 and file2.chk do not match"
 
 # success, all done
 status=0
diff --git a/tests/generic/181 b/tests/generic/181
index cb6639f..9c640e4 100755
--- a/tests/generic/181
+++ b/tests/generic/181
@@ -23,8 +23,8 @@
 # Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 #-----------------------------------------------------------------------
 
-seq=`basename "$0"`
-seqres="$RESULT_DIR/$seq"
+seq=`basename $0`
+seqres=$RESULT_DIR/$seq
 echo "QA output created by $seq"
 
 here=`pwd`
@@ -35,7 +35,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _cleanup()
 {
     cd /
-    rm -rf "$tmp".* "$testdir"
+    rm -rf $tmp.* $testdir
 }
 
 # get standard environment, filters and checks
@@ -48,32 +48,32 @@ _supported_os Linux
 _require_test_reflink
 _require_cp_reflink
 
-rm -f "$seqres.full"
+rm -f $seqres.full
 
-testdir="$TEST_DIR/test-$seq"
-rm -rf "$testdir"
-mkdir "$testdir"
+testdir=$TEST_DIR/test-$seq
+rm -rf $testdir
+mkdir $testdir
 
 echo "Create the original files"
 blksz=65536
-_pwrite_byte 0x61 0 $((blksz * 256)) "$testdir/file1" >> "$seqres.full"
-_pwrite_byte 0x62 0 $((blksz * 256)) "$testdir/file2" >> "$seqres.full"
-_pwrite_byte 0x62 0 $((blksz * 2)) "$testdir/file2.chk" >> "$seqres.full"
-_pwrite_byte 0x61 $((blksz * 2)) $((blksz * 255)) "$testdir/file2.chk" >> "$seqres.full"
-_reflink_range "$testdir/file1" $blksz "$testdir/file2" $((blksz * 2)) 0 >> "$seqres.full"
+_pwrite_byte 0x61 0 $((blksz * 256)) $testdir/file1 >> $seqres.full
+_pwrite_byte 0x62 0 $((blksz * 256)) $testdir/file2 >> $seqres.full
+_pwrite_byte 0x62 0 $((blksz * 2)) $testdir/file2.chk >> $seqres.full
+_pwrite_byte 0x61 $((blksz * 2)) $((blksz * 255)) $testdir/file2.chk >> $seqres.full
+_reflink_range $testdir/file1 $blksz $testdir/file2 $((blksz * 2)) 0 >> $seqres.full
 _test_remount
 
-md5sum "$testdir/file1" | _filter_test_dir
-md5sum "$testdir/file2" | _filter_test_dir
-md5sum "$testdir/file2.chk" | _filter_test_dir
+md5sum $testdir/file1 | _filter_test_dir
+md5sum $testdir/file2 | _filter_test_dir
+md5sum $testdir/file2.chk | _filter_test_dir
 
-c1="$(_md5_checksum "$testdir/file1")"
-c2="$(_md5_checksum "$testdir/file2")"
+c1=$(_md5_checksum $testdir/file1)
+c2=$(_md5_checksum $testdir/file2)
 
-test "${c1}" != "${c2}" || echo "file1 and file2 should not match"
+test ${c1} != ${c2} || echo "file1 and file2 should not match"
 
 echo "Compare against check files"
-cmp -s "$testdir/file2" "$testdir/file2.chk" || echo "file2 and file2.chk do not match"
+cmp -s $testdir/file2 $testdir/file2.chk || echo "file2 and file2.chk do not match"
 
 # success, all done
 status=0
diff --git a/tests/generic/182 b/tests/generic/182
index ef10af8..fddacc4 100755
--- a/tests/generic/182
+++ b/tests/generic/182
@@ -23,8 +23,8 @@
 # Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 #-----------------------------------------------------------------------
 
-seq=`basename "$0"`
-seqres="$RESULT_DIR/$seq"
+seq=`basename $0`
+seqres=$RESULT_DIR/$seq
 echo "QA output created by $seq"
 
 here=`pwd`
@@ -35,7 +35,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _cleanup()
 {
     cd /
-    rm -rf "$tmp".* "$testdir"
+    rm -rf $tmp.* $testdir
 }
 
 # get standard environment, filters and checks
@@ -47,69 +47,69 @@ _cleanup()
 _supported_os Linux
 _require_test_dedupe
 
-rm -f "$seqres.full"
+rm -f $seqres.full
 
-testdir="$TEST_DIR/test-$seq"
-rm -rf "$testdir"
-mkdir "$testdir"
+testdir=$TEST_DIR/test-$seq
+rm -rf $testdir
+mkdir $testdir
 
 echo "Create the original files"
 blksz=65536
-_pwrite_byte 0x61 0 $((blksz * 256)) "$testdir/file1" >> "$seqres.full"
-_pwrite_byte 0x62 0 $((blksz * 257)) "$testdir/file2" >> "$seqres.full"
-_pwrite_byte 0x62 0 $((blksz * 257)) "$testdir/file2.chk" >> "$seqres.full"
-_dedupe_range "$testdir/file1" $blksz "$testdir/file2" $((blksz * 2)) 0 >> "$seqres.full"
+_pwrite_byte 0x61 0 $((blksz * 256)) $testdir/file1 >> $seqres.full
+_pwrite_byte 0x62 0 $((blksz * 257)) $testdir/file2 >> $seqres.full
+_pwrite_byte 0x62 0 $((blksz * 257)) $testdir/file2.chk >> $seqres.full
+_dedupe_range $testdir/file1 $blksz $testdir/file2 $((blksz * 2)) 0 >> $seqres.full
 _test_remount
 
-md5sum "$testdir/file1" | _filter_test_dir
-md5sum "$testdir/file2" | _filter_test_dir
-md5sum "$testdir/file2.chk" | _filter_test_dir
+md5sum $testdir/file1 | _filter_test_dir
+md5sum $testdir/file2 | _filter_test_dir
+md5sum $testdir/file2.chk | _filter_test_dir
 
-c1="$(_md5_checksum "$testdir/file1")"
-c2="$(_md5_checksum "$testdir/file2")"
+c1=$(_md5_checksum $testdir/file1)
+c2=$(_md5_checksum $testdir/file2)
 
-test "${c1}" != "${c2}" || echo "file1 and file2 should not match"
+test ${c1} != ${c2} || echo "file1 and file2 should not match"
 
 echo "Compare against check files"
-cmp -s "$testdir/file2" "$testdir/file2.chk" || echo "file2 and file2.chk do not match"
+cmp -s $testdir/file2 $testdir/file2.chk || echo "file2 and file2.chk do not match"
 
 echo "Make the original file almost dedup-able"
-_pwrite_byte 0x61 0 $((blksz * 256)) "$testdir/file1" >> "$seqres.full"
-_pwrite_byte 0x61 0 $((blksz * 256)) "$testdir/file2" >> "$seqres.full"
-_pwrite_byte 0x61 0 $((blksz * 256)) "$testdir/file2.chk" >> "$seqres.full"
-_dedupe_range "$testdir/file1" $blksz "$testdir/file2" $((blksz * 2)) 0 >> "$seqres.full"
+_pwrite_byte 0x61 0 $((blksz * 256)) $testdir/file1 >> $seqres.full
+_pwrite_byte 0x61 0 $((blksz * 256)) $testdir/file2 >> $seqres.full
+_pwrite_byte 0x61 0 $((blksz * 256)) $testdir/file2.chk >> $seqres.full
+_dedupe_range $testdir/file1 $blksz $testdir/file2 $((blksz * 2)) 0 >> $seqres.full
 _test_remount
 
-md5sum "$testdir/file1" | _filter_test_dir
-md5sum "$testdir/file2" | _filter_test_dir
-md5sum "$testdir/file2.chk" | _filter_test_dir
+md5sum $testdir/file1 | _filter_test_dir
+md5sum $testdir/file2 | _filter_test_dir
+md5sum $testdir/file2.chk | _filter_test_dir
 
-c1="$(_md5_checksum "$testdir/file1")"
-c2="$(_md5_checksum "$testdir/file2")"
+c1=$(_md5_checksum $testdir/file1)
+c2=$(_md5_checksum $testdir/file2)
 
-test "${c1}" != "${c2}" || echo "file1 and file2 should not match"
+test ${c1} != ${c2} || echo "file1 and file2 should not match"
 
 echo "Compare against check files"
-cmp -s "$testdir/file2" "$testdir/file2.chk" || echo "file2 and file2.chk do not match"
+cmp -s $testdir/file2 $testdir/file2.chk || echo "file2 and file2.chk do not match"
 
 echo "Make the original file dedup-able"
-_pwrite_byte 0x61 0 $((blksz * 256)) "$testdir/file1" >> "$seqres.full"
-_pwrite_byte 0x61 0 $((blksz * 257)) "$testdir/file2" >> "$seqres.full"
-_pwrite_byte 0x61 0 $((blksz * 257)) "$testdir/file2.chk" >> "$seqres.full"
-_dedupe_range "$testdir/file1" $blksz "$testdir/file2" $((blksz * 2)) 0 >> "$seqres.full"
+_pwrite_byte 0x61 0 $((blksz * 256)) $testdir/file1 >> $seqres.full
+_pwrite_byte 0x61 0 $((blksz * 257)) $testdir/file2 >> $seqres.full
+_pwrite_byte 0x61 0 $((blksz * 257)) $testdir/file2.chk >> $seqres.full
+_dedupe_range $testdir/file1 $blksz $testdir/file2 $((blksz * 2)) 0 >> $seqres.full
 _test_remount
 
-md5sum "$testdir/file1" | _filter_test_dir
-md5sum "$testdir/file2" | _filter_test_dir
-md5sum "$testdir/file2.chk" | _filter_test_dir
+md5sum $testdir/file1 | _filter_test_dir
+md5sum $testdir/file2 | _filter_test_dir
+md5sum $testdir/file2.chk | _filter_test_dir
 
-c1="$(_md5_checksum "$testdir/file1")"
-c2="$(_md5_checksum "$testdir/file2")"
+c1=$(_md5_checksum $testdir/file1)
+c2=$(_md5_checksum $testdir/file2)
 
-test "${c1}" = "${c2}" || echo "file1 and file2 should match"
+test ${c1} = ${c2} || echo "file1 and file2 should match"
 
 echo "Compare against check files"
-cmp -s "$testdir/file2" "$testdir/file2.chk" || echo "file2 and file2.chk do not match"
+cmp -s $testdir/file2 $testdir/file2.chk || echo "file2 and file2.chk do not match"
 
 # success, all done
 status=0
diff --git a/tests/generic/183 b/tests/generic/183
index c928acd..0f35da2 100755
--- a/tests/generic/183
+++ b/tests/generic/183
@@ -26,8 +26,8 @@
 # Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 #-----------------------------------------------------------------------
 
-seq=`basename "$0"`
-seqres="$RESULT_DIR/$seq"
+seq=`basename $0`
+seqres=$RESULT_DIR/$seq
 echo "QA output created by $seq"
 
 here=`pwd`
@@ -38,7 +38,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _cleanup()
 {
     cd /
-    rm -rf "$tmp".* "$testdir"
+    rm -rf $tmp.* $testdir
 }
 
 # get standard environment, filters and checks
@@ -50,47 +50,49 @@ _cleanup()
 _supported_os Linux
 _require_scratch_reflink
 
-rm -f "$seqres.full"
+rm -f $seqres.full
 
 echo "Format and mount"
-_scratch_mkfs > "$seqres.full" 2>&1
-_scratch_mount >> "$seqres.full" 2>&1
+_scratch_mkfs > $seqres.full 2>&1
+_scratch_mount >> $seqres.full 2>&1
 
-testdir="$SCRATCH_MNT/test-$seq"
-rm -rf $testdir
+testdir=$SCRATCH_MNT/test-$seq
 mkdir $testdir
 
 echo "Create the original files"
 blksz=65536
 nr=64
-_pwrite_byte 0x61 0 $((blksz * nr)) "$testdir/file1" >> "$seqres.full"
-_pwrite_byte 0x62 0 $((blksz * nr)) "$testdir/file2" >> "$seqres.full"
+filesize=$((blksz * nr))
+_pwrite_byte 0x61 0 $filesize $testdir/file1 >> $seqres.full
+_pwrite_byte 0x62 0 $filesize $testdir/file2 >> $seqres.full
 seq 0 2 $((nr-1)) | while read f; do
-	_reflink_range "$testdir/file1" $((blksz * f)) "$testdir/file3" $((blksz * f)) $blksz >> "$seqres.full"
-	_pwrite_byte 0x61 $((blksz * f)) $blksz "$testdir/file3.chk" >> "$seqres.full"
+	_reflink_range $testdir/file1 $((blksz * f)) $testdir/file3 $((blksz * f)) $blksz >> $seqres.full
+	_pwrite_byte 0x61 $((blksz * f)) $blksz $testdir/file3.chk >> $seqres.full
 done
 seq 1 2 $((nr-1)) | while read f; do
-	_reflink_range "$testdir/file2" $((blksz * f)) "$testdir/file3" $((blksz * f)) $blksz >> "$seqres.full"
-	_pwrite_byte 0x62 $((blksz * f)) $blksz "$testdir/file3.chk" >> "$seqres.full"
+	_reflink_range $testdir/file2 $((blksz * f)) $testdir/file3 $((blksz * f)) $blksz >> $seqres.full
+	_pwrite_byte 0x62 $((blksz * f)) $blksz $testdir/file3.chk >> $seqres.full
 done
 _scratch_remount
 
 echo "Compare files"
-md5sum "$testdir/file1" | _filter_scratch
-md5sum "$testdir/file2" | _filter_scratch
-md5sum "$testdir/file3" | _filter_scratch
-md5sum "$testdir/file3.chk" | _filter_scratch
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file2 | _filter_scratch
+md5sum $testdir/file3 | _filter_scratch
+md5sum $testdir/file3.chk | _filter_scratch
 
 echo "directio CoW across the transition"
-"$XFS_IO_PROG" -d -f -c "pwrite -S 0x63 -b $((blksz * nr / 2)) $((blksz * nr / 4)) $((blksz * nr / 2))" "$testdir/file3" >> "$seqres.full"
-_pwrite_byte 0x63 $((blksz * nr / 4)) $((blksz * nr / 2)) "$testdir/file3.chk" >> "$seqres.full"
+cowoff=$((filesize / 4))
+cowsz=$((filesize / 2))
+$XFS_IO_PROG -d -f -c "pwrite -S 0x63 -b $cowsz $cowoff $cowsz" $testdir/file3 >> $seqres.full
+_pwrite_byte 0x63 $cowoff $cowsz $testdir/file3.chk >> $seqres.full
 _scratch_remount
 
 echo "Compare files"
-md5sum "$testdir/file1" | _filter_scratch
-md5sum "$testdir/file2" | _filter_scratch
-md5sum "$testdir/file3" | _filter_scratch
-md5sum "$testdir/file3.chk" | _filter_scratch
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file2 | _filter_scratch
+md5sum $testdir/file3 | _filter_scratch
+md5sum $testdir/file3.chk | _filter_scratch
 
 # success, all done
 status=0
diff --git a/tests/generic/185 b/tests/generic/185
index fb05e6d..28826d0 100755
--- a/tests/generic/185
+++ b/tests/generic/185
@@ -26,8 +26,8 @@
 # Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 #-----------------------------------------------------------------------
 
-seq=`basename "$0"`
-seqres="$RESULT_DIR/$seq"
+seq=`basename $0`
+seqres=$RESULT_DIR/$seq
 echo "QA output created by $seq"
 
 here=`pwd`
@@ -38,7 +38,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _cleanup()
 {
     cd /
-    rm -rf "$tmp".* "$testdir"
+    rm -rf $tmp.* $testdir
 }
 
 # get standard environment, filters and checks
@@ -50,47 +50,49 @@ _cleanup()
 _supported_os Linux
 _require_scratch_reflink
 
-rm -f "$seqres.full"
+rm -f $seqres.full
 
 echo "Format and mount"
-_scratch_mkfs > "$seqres.full" 2>&1
-_scratch_mount >> "$seqres.full" 2>&1
+_scratch_mkfs > $seqres.full 2>&1
+_scratch_mount >> $seqres.full 2>&1
 
-testdir="$SCRATCH_MNT/test-$seq"
-rm -rf $testdir
+testdir=$SCRATCH_MNT/test-$seq
 mkdir $testdir
 
 echo "Create the original files"
 blksz=65536
 nr=64
-_pwrite_byte 0x61 0 $((blksz * nr)) "$testdir/file1" >> "$seqres.full"
-_pwrite_byte 0x62 0 $((blksz * nr)) "$testdir/file2" >> "$seqres.full"
+filesize=$((blksz * nr))
+_pwrite_byte 0x61 0 $filesize $testdir/file1 >> $seqres.full
+_pwrite_byte 0x62 0 $filesize $testdir/file2 >> $seqres.full
 seq 0 2 $((nr-1)) | while read f; do
-	_reflink_range "$testdir/file1" $((blksz * f)) "$testdir/file3" $((blksz * f)) $blksz >> "$seqres.full"
-	_pwrite_byte 0x61 $((blksz * f)) $blksz "$testdir/file3.chk" >> "$seqres.full"
+	_reflink_range $testdir/file1 $((blksz * f)) $testdir/file3 $((blksz * f)) $blksz >> $seqres.full
+	_pwrite_byte 0x61 $((blksz * f)) $blksz $testdir/file3.chk >> $seqres.full
 done
 seq 1 2 $((nr-1)) | while read f; do
-	_reflink_range "$testdir/file2" $((blksz * f)) "$testdir/file3" $((blksz * f)) $blksz >> "$seqres.full"
-	_pwrite_byte 0x62 $((blksz * f)) $blksz "$testdir/file3.chk" >> "$seqres.full"
+	_reflink_range $testdir/file2 $((blksz * f)) $testdir/file3 $((blksz * f)) $blksz >> $seqres.full
+	_pwrite_byte 0x62 $((blksz * f)) $blksz $testdir/file3.chk >> $seqres.full
 done
 _scratch_remount
 
 echo "Compare files"
-md5sum "$testdir/file1" | _filter_scratch
-md5sum "$testdir/file2" | _filter_scratch
-md5sum "$testdir/file3" | _filter_scratch
-md5sum "$testdir/file3.chk" | _filter_scratch
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file2 | _filter_scratch
+md5sum $testdir/file3 | _filter_scratch
+md5sum $testdir/file3.chk | _filter_scratch
 
 echo "CoW across the transition"
-_pwrite_byte 0x63 $((blksz * nr / 4)) $((blksz * nr / 2)) "$testdir/file3" >> "$seqres.full"
-_pwrite_byte 0x63 $((blksz * nr / 4)) $((blksz * nr / 2)) "$testdir/file3.chk" >> "$seqres.full"
+cowoff=$((filesize / 4))
+cowsz=$((filesize / 2))
+_pwrite_byte 0x63 $cowoff $cowsz $testdir/file3 >> $seqres.full
+_pwrite_byte 0x63 $cowoff $cowsz $testdir/file3.chk >> $seqres.full
 _scratch_remount
 
 echo "Compare files"
-md5sum "$testdir/file1" | _filter_scratch
-md5sum "$testdir/file2" | _filter_scratch
-md5sum "$testdir/file3" | _filter_scratch
-md5sum "$testdir/file3.chk" | _filter_scratch
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file2 | _filter_scratch
+md5sum $testdir/file3 | _filter_scratch
+md5sum $testdir/file3.chk | _filter_scratch
 
 # success, all done
 status=0
diff --git a/tests/generic/186 b/tests/generic/186
index e495cbc..9839a22 100755
--- a/tests/generic/186
+++ b/tests/generic/186
@@ -28,8 +28,8 @@
 # Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 #-----------------------------------------------------------------------
 
-seq=`basename "$0"`
-seqres="$RESULT_DIR/$seq"
+seq=`basename $0`
+seqres=$RESULT_DIR/$seq
 echo "QA output created by $seq"
 
 here=`pwd`
@@ -40,7 +40,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _cleanup()
 {
     cd /
-#    rm -rf "$tmp".* "$testdir"
+#    rm -rf $tmp.* $testdir
 }
 
 # get standard environment, filters and checks
@@ -54,88 +54,91 @@ _require_scratch_reflink
 _require_cp_reflink
 _require_xfs_io_command "falloc"
 _require_xfs_io_command "fpunch"
-test "$FSTYP" = "btrfs" && _notrun "Can't fragment free space on btrfs."
+test $FSTYP = "btrfs" && _notrun "Can't fragment free space on btrfs."
 
-rm -f "$seqres.full"
+rm -f $seqres.full
 
 _fragment_freesp()
 {
-	file="$1"
+	file=$1
 
 	# consume nearly all available space (leave ~1MB)
 	avail=`_get_available_space $SCRATCH_MNT`
 	echo "$avail bytes left"
 	filesize=$((avail - 1048576))
-	$XFS_IO_PROG -fc "truncate $filesize" "$file"
+	$XFS_IO_PROG -fc "truncate $filesize" $file
 
 	chunks=20
 	chunksizemb=$((filesize / chunks / 1048576))
 	seq 1 $chunks | while read f; do
 		echo "$((f * chunksizemb)) file size $f / 20"
-		$XFS_IO_PROG -fc "falloc -k $(( (f - 1) * chunksizemb))m ${chunksizemb}m" "$file"
+		$XFS_IO_PROG -fc "falloc -k $(( (f - 1) * chunksizemb))m ${chunksizemb}m" $file
 	done
 
 	chunks=100
 	chunksizemb=$((filesize / chunks / 1048576))
 	seq 80 $chunks | while read f; do
 		echo "$((f * chunksizemb)) file size $f / $chunks"
-		$XFS_IO_PROG -fc "falloc -k $(( (f - 1) * chunksizemb))m ${chunksizemb}m" "$file"
+		$XFS_IO_PROG -fc "falloc -k $(( (f - 1) * chunksizemb))m ${chunksizemb}m" $file
 	done
 
 	filesizemb=$((filesize / 1048576))
-	$XFS_IO_PROG -fc "falloc -k 0 ${filesizemb}m" "$file"
+	$XFS_IO_PROG -fc "falloc -k 0 ${filesizemb}m" $file
 
 	# Try again anyway
 	avail=`_get_available_space $SCRATCH_MNT`
-	$XFS_IO_PROG -fc "pwrite -S 0x65 0 $avail" "${file}.${i}"
+	$XFS_IO_PROG -fc "pwrite -S 0x65 0 $avail" ${file}.${i}
 
 	# Punch out whatever we need
 	seq 1 $((nr * 4)) | while read f; do
-		$XFS_IO_PROG -f -c "fpunch $((f * 2 * blksz)) $blksz" "$file"
+		$XFS_IO_PROG -f -c "fpunch $((f * 2 * blksz)) $blksz" $file
 	done
 }
 
 echo "Format and mount"
-_scratch_mkfs > "$seqres.full" 2>&1
-_scratch_mount >> "$seqres.full" 2>&1
+_scratch_mkfs > $seqres.full 2>&1
+_scratch_mount >> $seqres.full 2>&1
 
-testdir="$SCRATCH_MNT/test-$seq"
-rm -rf $testdir
+testdir=$SCRATCH_MNT/test-$seq
 mkdir $testdir
 
 echo "Create the original files"
 blksz=65536
 nr=1024
-_pwrite_byte 0x61 0 $((blksz * nr)) "$testdir/file1" >> "$seqres.full"
-_pwrite_byte 0x62 0 $((blksz * nr)) "$testdir/file2" >> "$seqres.full"
+filesize=$((blksz * nr))
+_pwrite_byte 0x61 0 $filesize $testdir/file1 >> $seqres.full
+_pwrite_byte 0x62 0 $filesize $testdir/file2 >> $seqres.full
 seq 0 2 $((nr-1)) | while read f; do
-	_reflink_range "$testdir/file1" $((blksz * f)) "$testdir/file3" $((blksz * f)) $blksz >> "$seqres.full"
-	_pwrite_byte 0x61 $((blksz * f)) $blksz "$testdir/file3.chk" >> "$seqres.full"
+	_reflink_range $testdir/file1 $((blksz * f)) $testdir/file3 $((blksz * f)) $blksz >> $seqres.full
+	_pwrite_byte 0x61 $((blksz * f)) $blksz $testdir/file3.chk >> $seqres.full
 done
 seq 1 2 $((nr-1)) | while read f; do
-	_reflink_range "$testdir/file2" $((blksz * f)) "$testdir/file3" $((blksz * f)) $blksz >> "$seqres.full"
-	_pwrite_byte 0x62 $((blksz * f)) $blksz "$testdir/file3.chk" >> "$seqres.full"
+	_reflink_range $testdir/file2 $((blksz * f)) $testdir/file3 $((blksz * f)) $blksz >> $seqres.full
+	_pwrite_byte 0x62 $((blksz * f)) $blksz $testdir/file3.chk >> $seqres.full
 done
 _scratch_remount
-_fragment_freesp "$testdir/bigfile" >> "$seqres.full" 2>&1
+_fragment_freesp $testdir/bigfile >> $seqres.full 2>&1
+filesize=$((blksz * nr))
 _scratch_remount
 
 echo "Compare files"
-md5sum "$testdir/file1" | _filter_scratch
-md5sum "$testdir/file2" | _filter_scratch
-md5sum "$testdir/file3" | _filter_scratch
-md5sum "$testdir/file3.chk" | _filter_scratch
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file2 | _filter_scratch
+md5sum $testdir/file3 | _filter_scratch
+md5sum $testdir/file3.chk | _filter_scratch
 
 echo "CoW with multiple extents?"
-"$XFS_IO_PROG" -f -c "pwrite -S 0x63 -b $((blksz * nr / 2)) $((blksz * nr / 4)) $((blksz * nr / 2))" "$testdir/file3" >> "$seqres.full"
-_pwrite_byte 0x63 $((blksz * nr / 4)) $((blksz * nr / 2)) "$testdir/file3.chk" >> "$seqres.full"
+cowoff=$((filesize / 4))
+cowsz=$((filesize / 2))
+$XFS_IO_PROG -f -c "pwrite -S 0x63 -b $cowsz $cowoff $cowsz" $testdir/file3 >> $seqres.full
+_pwrite_byte 0x63 $cowoff $cowsz $testdir/file3.chk >> $seqres.full
 _scratch_remount
 
 echo "Compare files"
-md5sum "$testdir/file1" | _filter_scratch
-md5sum "$testdir/file2" | _filter_scratch
-md5sum "$testdir/file3" | _filter_scratch
-md5sum "$testdir/file3.chk" | _filter_scratch
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file2 | _filter_scratch
+md5sum $testdir/file3 | _filter_scratch
+md5sum $testdir/file3.chk | _filter_scratch
 
 # success, all done
 status=0
diff --git a/tests/generic/187 b/tests/generic/187
index e3461ab..b8fade2 100755
--- a/tests/generic/187
+++ b/tests/generic/187
@@ -28,8 +28,8 @@
 # Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 #-----------------------------------------------------------------------
 
-seq=`basename "$0"`
-seqres="$RESULT_DIR/$seq"
+seq=`basename $0`
+seqres=$RESULT_DIR/$seq
 echo "QA output created by $seq"
 
 here=`pwd`
@@ -40,7 +40,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _cleanup()
 {
     cd /
-#    rm -rf "$tmp".* "$testdir"
+#    rm -rf $tmp.* $testdir
 }
 
 # get standard environment, filters and checks
@@ -54,88 +54,91 @@ _require_scratch_reflink
 _require_cp_reflink
 _require_xfs_io_command "falloc"
 _require_xfs_io_command "fpunch"
-test "$FSTYP" = "btrfs" && _notrun "Can't fragment free space on btrfs."
+test $FSTYP = "btrfs" && _notrun "Can't fragment free space on btrfs."
 
-rm -f "$seqres.full"
+rm -f $seqres.full
 
 _fragment_freesp()
 {
-	file="$1"
+	file=$1
 
 	# consume nearly all available space (leave ~1MB)
 	avail=`_get_available_space $SCRATCH_MNT`
 	echo "$avail bytes left"
 	filesize=$((avail - 1048576))
-	$XFS_IO_PROG -fc "truncate $filesize" "$file"
+	$XFS_IO_PROG -fc "truncate $filesize" $file
 
 	chunks=20
 	chunksizemb=$((filesize / chunks / 1048576))
 	seq 1 $chunks | while read f; do
 		echo "$((f * chunksizemb)) file size $f / 20"
-		$XFS_IO_PROG -fc "falloc -k $(( (f - 1) * chunksizemb))m ${chunksizemb}m" "$file"
+		$XFS_IO_PROG -fc "falloc -k $(( (f - 1) * chunksizemb))m ${chunksizemb}m" $file
 	done
 
 	chunks=100
 	chunksizemb=$((filesize / chunks / 1048576))
 	seq 80 $chunks | while read f; do
 		echo "$((f * chunksizemb)) file size $f / $chunks"
-		$XFS_IO_PROG -fc "falloc -k $(( (f - 1) * chunksizemb))m ${chunksizemb}m" "$file"
+		$XFS_IO_PROG -fc "falloc -k $(( (f - 1) * chunksizemb))m ${chunksizemb}m" $file
 	done
 
 	filesizemb=$((filesize / 1048576))
-	$XFS_IO_PROG -fc "falloc -k 0 ${filesizemb}m" "$file"
+	$XFS_IO_PROG -fc "falloc -k 0 ${filesizemb}m" $file
 
 	# Try again anyway
 	avail=`_get_available_space $SCRATCH_MNT`
-	$XFS_IO_PROG -fc "pwrite -S 0x65 0 $avail" "${file}.${i}"
+	$XFS_IO_PROG -fc "pwrite -S 0x65 0 $avail" ${file}.${i}
 
 	# Punch out whatever we need
 	seq 1 $((nr * 4)) | while read f; do
-		$XFS_IO_PROG -f -c "fpunch $((f * 2 * blksz)) $blksz" "$file"
+		$XFS_IO_PROG -f -c "fpunch $((f * 2 * blksz)) $blksz" $file
 	done
 }
 
 echo "Format and mount"
-_scratch_mkfs > "$seqres.full" 2>&1
-_scratch_mount >> "$seqres.full" 2>&1
+_scratch_mkfs > $seqres.full 2>&1
+_scratch_mount >> $seqres.full 2>&1
 
-testdir="$SCRATCH_MNT/test-$seq"
-rm -rf $testdir
+testdir=$SCRATCH_MNT/test-$seq
 mkdir $testdir
 
 echo "Create the original files"
 blksz=65536
 nr=1024
-_pwrite_byte 0x61 0 $((blksz * nr)) "$testdir/file1" >> "$seqres.full"
-_pwrite_byte 0x62 0 $((blksz * nr)) "$testdir/file2" >> "$seqres.full"
+filesize=$((blksz * nr))
+_pwrite_byte 0x61 0 $filesize $testdir/file1 >> $seqres.full
+_pwrite_byte 0x62 0 $filesize $testdir/file2 >> $seqres.full
 seq 0 2 $((nr-1)) | while read f; do
-	_reflink_range "$testdir/file1" $((blksz * f)) "$testdir/file3" $((blksz * f)) $blksz >> "$seqres.full"
-	_pwrite_byte 0x61 $((blksz * f)) $blksz "$testdir/file3.chk" >> "$seqres.full"
+	_reflink_range $testdir/file1 $((blksz * f)) $testdir/file3 $((blksz * f)) $blksz >> $seqres.full
+	_pwrite_byte 0x61 $((blksz * f)) $blksz $testdir/file3.chk >> $seqres.full
 done
 seq 1 2 $((nr-1)) | while read f; do
-	_reflink_range "$testdir/file2" $((blksz * f)) "$testdir/file3" $((blksz * f)) $blksz >> "$seqres.full"
-	_pwrite_byte 0x62 $((blksz * f)) $blksz "$testdir/file3.chk" >> "$seqres.full"
+	_reflink_range $testdir/file2 $((blksz * f)) $testdir/file3 $((blksz * f)) $blksz >> $seqres.full
+	_pwrite_byte 0x62 $((blksz * f)) $blksz $testdir/file3.chk >> $seqres.full
 done
 _scratch_remount
-_fragment_freesp "$testdir/bigfile" >> "$seqres.full" 2>&1
+_fragment_freesp $testdir/bigfile >> $seqres.full 2>&1
+filesize=$((blksz * nr))
 _scratch_remount
 
 echo "Compare files"
-md5sum "$testdir/file1" | _filter_scratch
-md5sum "$testdir/file2" | _filter_scratch
-md5sum "$testdir/file3" | _filter_scratch
-md5sum "$testdir/file3.chk" | _filter_scratch
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file2 | _filter_scratch
+md5sum $testdir/file3 | _filter_scratch
+md5sum $testdir/file3.chk | _filter_scratch
 
 echo "CoW with multiple extents?"
-"$XFS_IO_PROG" -d -f -c "pwrite -S 0x63 -b $((blksz * nr / 2)) $((blksz * nr / 4)) $((blksz * nr / 2))" "$testdir/file3" >> "$seqres.full"
-_pwrite_byte 0x63 $((blksz * nr / 4)) $((blksz * nr / 2)) "$testdir/file3.chk" >> "$seqres.full"
+cowoff=$((filesize / 4))
+cowsz=$((filesize / 2))
+$XFS_IO_PROG -d -f -c "pwrite -S 0x63 -b $cowsz $cowoff $cowsz" $testdir/file3 >> $seqres.full
+_pwrite_byte 0x63 $cowoff $cowsz $testdir/file3.chk >> $seqres.full
 _scratch_remount
 
 echo "Compare files"
-md5sum "$testdir/file1" | _filter_scratch
-md5sum "$testdir/file2" | _filter_scratch
-md5sum "$testdir/file3" | _filter_scratch
-md5sum "$testdir/file3.chk" | _filter_scratch
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file2 | _filter_scratch
+md5sum $testdir/file3 | _filter_scratch
+md5sum $testdir/file3.chk | _filter_scratch
 
 # success, all done
 status=0
diff --git a/tests/generic/188 b/tests/generic/188
index 86980cc..7be1080 100755
--- a/tests/generic/188
+++ b/tests/generic/188
@@ -25,8 +25,8 @@
 # Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 #-----------------------------------------------------------------------
 
-seq=`basename "$0"`
-seqres="$RESULT_DIR/$seq"
+seq=`basename $0`
+seqres=$RESULT_DIR/$seq
 echo "QA output created by $seq"
 
 here=`pwd`
@@ -37,7 +37,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _cleanup()
 {
     cd /
-    rm -rf "$tmp".* "$testdir"
+    rm -rf $tmp.* $testdir
 }
 
 # get standard environment, filters and checks
@@ -50,36 +50,38 @@ _supported_os Linux
 _require_scratch_reflink
 _require_xfs_io_command "falloc"
 
-rm -f "$seqres.full"
+rm -f $seqres.full
 
 echo "Format and mount"
-_scratch_mkfs > "$seqres.full" 2>&1
-_scratch_mount >> "$seqres.full" 2>&1
+_scratch_mkfs > $seqres.full 2>&1
+_scratch_mount >> $seqres.full 2>&1
 
-testdir="$SCRATCH_MNT/test-$seq"
-rm -rf $testdir
+testdir=$SCRATCH_MNT/test-$seq
 mkdir $testdir
 
 echo "Create the original files"
 blksz=65536
 nr=64
+filesize=$((blksz * nr))
 _weave_reflink_unwritten $blksz $nr $testdir/file1 $testdir/file3 >> $seqres.full
 _scratch_remount
 
 echo "Compare files"
-md5sum "$testdir/file1" | _filter_scratch
-md5sum "$testdir/file3" | _filter_scratch
-md5sum "$testdir/file3.chk" | _filter_scratch
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file3 | _filter_scratch
+md5sum $testdir/file3.chk | _filter_scratch
 
 echo "directio CoW across the transition"
-"$XFS_IO_PROG" -d -f -c "pwrite -S 0x63 -b $((blksz * nr / 2)) $((blksz * nr / 4)) $((blksz * nr / 2))" "$testdir/file3" >> "$seqres.full"
-_pwrite_byte 0x63 $((blksz * nr / 4)) $((blksz * nr / 2)) "$testdir/file3.chk" >> "$seqres.full"
+cowoff=$((filesize / 4))
+cowsz=$((filesize / 2))
+$XFS_IO_PROG -d -f -c "pwrite -S 0x63 -b $cowsz $cowoff $cowsz" $testdir/file3 >> $seqres.full
+_pwrite_byte 0x63 $cowoff $cowsz $testdir/file3.chk >> $seqres.full
 _scratch_remount
 
 echo "Compare files"
-md5sum "$testdir/file1" | _filter_scratch
-md5sum "$testdir/file3" | _filter_scratch
-md5sum "$testdir/file3.chk" | _filter_scratch
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file3 | _filter_scratch
+md5sum $testdir/file3.chk | _filter_scratch
 
 # success, all done
 status=0
diff --git a/tests/generic/189 b/tests/generic/189
index 8f5a338..5b409be 100755
--- a/tests/generic/189
+++ b/tests/generic/189
@@ -25,8 +25,8 @@
 # Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 #-----------------------------------------------------------------------
 
-seq=`basename "$0"`
-seqres="$RESULT_DIR/$seq"
+seq=`basename $0`
+seqres=$RESULT_DIR/$seq
 echo "QA output created by $seq"
 
 here=`pwd`
@@ -37,7 +37,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _cleanup()
 {
     cd /
-    rm -rf "$tmp".* "$testdir"
+    rm -rf $tmp.* $testdir
 }
 
 # get standard environment, filters and checks
@@ -50,36 +50,38 @@ _supported_os Linux
 _require_scratch_reflink
 _require_xfs_io_command "falloc"
 
-rm -f "$seqres.full"
+rm -f $seqres.full
 
 echo "Format and mount"
-_scratch_mkfs > "$seqres.full" 2>&1
-_scratch_mount >> "$seqres.full" 2>&1
+_scratch_mkfs > $seqres.full 2>&1
+_scratch_mount >> $seqres.full 2>&1
 
-testdir="$SCRATCH_MNT/test-$seq"
-rm -rf $testdir
+testdir=$SCRATCH_MNT/test-$seq
 mkdir $testdir
 
 echo "Create the original files"
 blksz=65536
 nr=64
+filesize=$((blksz * nr))
 _weave_reflink_unwritten $blksz $nr $testdir/file1 $testdir/file3 >> $seqres.full
 _scratch_remount
 
 echo "Compare files"
-md5sum "$testdir/file1" | _filter_scratch
-md5sum "$testdir/file3" | _filter_scratch
-md5sum "$testdir/file3.chk" | _filter_scratch
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file3 | _filter_scratch
+md5sum $testdir/file3.chk | _filter_scratch
 
 echo "CoW across the transition"
-"$XFS_IO_PROG" -f -c "pwrite -S 0x63 -b $((blksz * nr / 2)) $((blksz * nr / 4)) $((blksz * nr / 2))" "$testdir/file3" >> "$seqres.full"
-_pwrite_byte 0x63 $((blksz * nr / 4)) $((blksz * nr / 2)) "$testdir/file3.chk" >> "$seqres.full"
+cowoff=$((filesize / 4))
+cowsz=$((filesize / 2))
+$XFS_IO_PROG -f -c "pwrite -S 0x63 -b $cowsz $cowoff $cowsz" $testdir/file3 >> $seqres.full
+_pwrite_byte 0x63 $cowoff $cowsz $testdir/file3.chk >> $seqres.full
 _scratch_remount
 
 echo "Compare files"
-md5sum "$testdir/file1" | _filter_scratch
-md5sum "$testdir/file3" | _filter_scratch
-md5sum "$testdir/file3.chk" | _filter_scratch
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file3 | _filter_scratch
+md5sum $testdir/file3.chk | _filter_scratch
 
 # success, all done
 status=0
diff --git a/tests/generic/190 b/tests/generic/190
index 8edfeb7..a5c2137 100755
--- a/tests/generic/190
+++ b/tests/generic/190
@@ -25,8 +25,8 @@
 # Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 #-----------------------------------------------------------------------
 
-seq=`basename "$0"`
-seqres="$RESULT_DIR/$seq"
+seq=`basename $0`
+seqres=$RESULT_DIR/$seq
 echo "QA output created by $seq"
 
 here=`pwd`
@@ -37,7 +37,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _cleanup()
 {
     cd /
-    rm -rf "$tmp".* "$testdir"
+    rm -rf $tmp.* $testdir
 }
 
 # get standard environment, filters and checks
@@ -50,36 +50,38 @@ _supported_os Linux
 _require_scratch_reflink
 _require_xfs_io_command "falloc"
 
-rm -f "$seqres.full"
+rm -f $seqres.full
 
 echo "Format and mount"
-_scratch_mkfs > "$seqres.full" 2>&1
-_scratch_mount >> "$seqres.full" 2>&1
+_scratch_mkfs > $seqres.full 2>&1
+_scratch_mount >> $seqres.full 2>&1
 
-testdir="$SCRATCH_MNT/test-$seq"
-rm -rf $testdir
+testdir=$SCRATCH_MNT/test-$seq
 mkdir $testdir
 
 echo "Create the original files"
 blksz=65536
 nr=64
+filesize=$((blksz * nr))
 _weave_reflink_holes $blksz $nr $testdir/file1 $testdir/file3 >> $seqres.full
 _scratch_remount
 
 echo "Compare files"
-md5sum "$testdir/file1" | _filter_scratch
-md5sum "$testdir/file3" | _filter_scratch
-md5sum "$testdir/file3.chk" | _filter_scratch
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file3 | _filter_scratch
+md5sum $testdir/file3.chk | _filter_scratch
 
 echo "directio CoW across the transition"
-"$XFS_IO_PROG" -d -f -c "pwrite -S 0x63 -b $((blksz * nr / 2)) $((blksz * nr / 4)) $((blksz * nr / 2))" "$testdir/file3" >> "$seqres.full"
-_pwrite_byte 0x63 $((blksz * nr / 4)) $((blksz * nr / 2)) "$testdir/file3.chk" >> "$seqres.full"
+cowoff=$((filesize / 4))
+cowsz=$((filesize / 2))
+$XFS_IO_PROG -d -f -c "pwrite -S 0x63 -b $cowsz $cowoff $cowsz" $testdir/file3 >> $seqres.full
+_pwrite_byte 0x63 $cowoff $cowsz $testdir/file3.chk >> $seqres.full
 _scratch_remount
 
 echo "Compare files"
-md5sum "$testdir/file1" | _filter_scratch
-md5sum "$testdir/file3" | _filter_scratch
-md5sum "$testdir/file3.chk" | _filter_scratch
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file3 | _filter_scratch
+md5sum $testdir/file3.chk | _filter_scratch
 
 # success, all done
 status=0
diff --git a/tests/generic/191 b/tests/generic/191
index dd97baa..cfedcde 100755
--- a/tests/generic/191
+++ b/tests/generic/191
@@ -25,8 +25,8 @@
 # Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 #-----------------------------------------------------------------------
 
-seq=`basename "$0"`
-seqres="$RESULT_DIR/$seq"
+seq=`basename $0`
+seqres=$RESULT_DIR/$seq
 echo "QA output created by $seq"
 
 here=`pwd`
@@ -37,7 +37,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _cleanup()
 {
     cd /
-    rm -rf "$tmp".* "$testdir"
+    rm -rf $tmp.* $testdir
 }
 
 # get standard environment, filters and checks
@@ -50,36 +50,38 @@ _supported_os Linux
 _require_scratch_reflink
 _require_xfs_io_command "falloc"
 
-rm -f "$seqres.full"
+rm -f $seqres.full
 
 echo "Format and mount"
-_scratch_mkfs > "$seqres.full" 2>&1
-_scratch_mount >> "$seqres.full" 2>&1
+_scratch_mkfs > $seqres.full 2>&1
+_scratch_mount >> $seqres.full 2>&1
 
-testdir="$SCRATCH_MNT/test-$seq"
-rm -rf $testdir
+testdir=$SCRATCH_MNT/test-$seq
 mkdir $testdir
 
 echo "Create the original files"
 blksz=65536
 nr=64
+filesize=$((blksz * nr))
 _weave_reflink_holes $blksz $nr $testdir/file1 $testdir/file3 >> $seqres.full
 _scratch_remount
 
 echo "Compare files"
-md5sum "$testdir/file1" | _filter_scratch
-md5sum "$testdir/file3" | _filter_scratch
-md5sum "$testdir/file3.chk" | _filter_scratch
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file3 | _filter_scratch
+md5sum $testdir/file3.chk | _filter_scratch
 
 echo "CoW across the transition"
-"$XFS_IO_PROG" -f -c "pwrite -S 0x63 -b $((blksz * nr / 2)) $((blksz * nr / 4)) $((blksz * nr / 2))" "$testdir/file3" >> "$seqres.full"
-_pwrite_byte 0x63 $((blksz * nr / 4)) $((blksz * nr / 2)) "$testdir/file3.chk" >> "$seqres.full"
+cowoff=$((filesize / 4))
+cowsz=$((filesize / 2))
+$XFS_IO_PROG -f -c "pwrite -S 0x63 -b $cowsz $cowoff $cowsz" $testdir/file3 >> $seqres.full
+_pwrite_byte 0x63 $cowoff $cowsz $testdir/file3.chk >> $seqres.full
 _scratch_remount
 
 echo "Compare files"
-md5sum "$testdir/file1" | _filter_scratch
-md5sum "$testdir/file3" | _filter_scratch
-md5sum "$testdir/file3.chk" | _filter_scratch
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file3 | _filter_scratch
+md5sum $testdir/file3.chk | _filter_scratch
 
 # success, all done
 status=0
diff --git a/tests/generic/194 b/tests/generic/194
index 82b3100..69a3e6c 100755
--- a/tests/generic/194
+++ b/tests/generic/194
@@ -26,8 +26,8 @@
 # Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 #-----------------------------------------------------------------------
 
-seq=`basename "$0"`
-seqres="$RESULT_DIR/$seq"
+seq=`basename $0`
+seqres=$RESULT_DIR/$seq
 echo "QA output created by $seq"
 
 here=`pwd`
@@ -38,7 +38,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _cleanup()
 {
     cd /
-    rm -rf "$tmp".* "$testdir"
+    rm -rf $tmp.* $testdir
 }
 
 # get standard environment, filters and checks
@@ -51,37 +51,39 @@ _supported_os Linux
 _require_scratch_reflink
 _require_xfs_io_command "falloc"
 
-rm -f "$seqres.full"
+rm -f $seqres.full
 
 echo "Format and mount"
-_scratch_mkfs > "$seqres.full" 2>&1
-_scratch_mount >> "$seqres.full" 2>&1
+_scratch_mkfs > $seqres.full 2>&1
+_scratch_mount >> $seqres.full 2>&1
 
-testdir="$SCRATCH_MNT/test-$seq"
-rm -rf $testdir
+testdir=$SCRATCH_MNT/test-$seq
 mkdir $testdir
 
 echo "Create the original files"
 blksz=65536
 nr=64
+filesize=$((blksz * nr))
 _weave_reflink_holes $blksz $nr $testdir/file1 $testdir/file3 >> $seqres.full
 _scratch_remount
 
 echo "Compare files"
-md5sum "$testdir/file1" | _filter_scratch
-md5sum "$testdir/file3" | _filter_scratch
-md5sum "$testdir/file3.chk" | _filter_scratch
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file3 | _filter_scratch
+md5sum $testdir/file3.chk | _filter_scratch
 
 echo "directio CoW across the transition"
+cowoff=$((filesize / 4))
+cowsz=$((filesize / 2))
 _weave_reflink_holes_delalloc $blksz $nr $testdir/file3 >> $seqres.full
-"$XFS_IO_PROG" -d -f -c "pwrite -S 0x63 -b $((blksz * nr / 2)) $((blksz * nr / 4)) $((blksz * nr / 2))" "$testdir/file3" >> "$seqres.full"
-_pwrite_byte 0x63 $((blksz * nr / 4)) $((blksz * nr / 2)) "$testdir/file3.chk" >> "$seqres.full"
+$XFS_IO_PROG -d -f -c "pwrite -S 0x63 -b $cowsz $cowoff $cowsz" $testdir/file3 >> $seqres.full
+_pwrite_byte 0x63 $cowoff $cowsz $testdir/file3.chk >> $seqres.full
 _scratch_remount
 
 echo "Compare files"
-md5sum "$testdir/file1" | _filter_scratch
-md5sum "$testdir/file3" | _filter_scratch
-md5sum "$testdir/file3.chk" | _filter_scratch
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file3 | _filter_scratch
+md5sum $testdir/file3.chk | _filter_scratch
 
 # success, all done
 status=0
diff --git a/tests/generic/195 b/tests/generic/195
index ce4c0a9..51f10f3 100755
--- a/tests/generic/195
+++ b/tests/generic/195
@@ -26,8 +26,8 @@
 # Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 #-----------------------------------------------------------------------
 
-seq=`basename "$0"`
-seqres="$RESULT_DIR/$seq"
+seq=`basename $0`
+seqres=$RESULT_DIR/$seq
 echo "QA output created by $seq"
 
 here=`pwd`
@@ -38,7 +38,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _cleanup()
 {
     cd /
-    rm -rf "$tmp".* "$testdir"
+    rm -rf $tmp.* $testdir
 }
 
 # get standard environment, filters and checks
@@ -51,37 +51,39 @@ _supported_os Linux
 _require_scratch_reflink
 _require_xfs_io_command "falloc"
 
-rm -f "$seqres.full"
+rm -f $seqres.full
 
 echo "Format and mount"
-_scratch_mkfs > "$seqres.full" 2>&1
-_scratch_mount >> "$seqres.full" 2>&1
+_scratch_mkfs > $seqres.full 2>&1
+_scratch_mount >> $seqres.full 2>&1
 
-testdir="$SCRATCH_MNT/test-$seq"
-rm -rf $testdir
+testdir=$SCRATCH_MNT/test-$seq
 mkdir $testdir
 
 echo "Create the original files"
 blksz=65536
 nr=64
+filesize=$((blksz * nr))
 _weave_reflink_holes $blksz $nr $testdir/file1 $testdir/file3 >> $seqres.full
 _scratch_remount
 
 echo "Compare files"
-md5sum "$testdir/file1" | _filter_scratch
-md5sum "$testdir/file3" | _filter_scratch
-md5sum "$testdir/file3.chk" | _filter_scratch
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file3 | _filter_scratch
+md5sum $testdir/file3.chk | _filter_scratch
 
 echo "CoW across the transition"
+cowoff=$((filesize / 4))
+cowsz=$((filesize / 2))
 _weave_reflink_holes_delalloc $blksz $nr $testdir/file3 >> $seqres.full
-"$XFS_IO_PROG" -f -c "pwrite -S 0x63 -b $((blksz * nr / 2)) $((blksz * nr / 4)) $((blksz * nr / 2))" "$testdir/file3" >> "$seqres.full"
-_pwrite_byte 0x63 $((blksz * nr / 4)) $((blksz * nr / 2)) "$testdir/file3.chk" >> "$seqres.full"
+$XFS_IO_PROG -f -c "pwrite -S 0x63 -b $cowsz $cowoff $cowsz" $testdir/file3 >> $seqres.full
+_pwrite_byte 0x63 $cowoff $cowsz $testdir/file3.chk >> $seqres.full
 _scratch_remount
 
 echo "Compare files"
-md5sum "$testdir/file1" | _filter_scratch
-md5sum "$testdir/file3" | _filter_scratch
-md5sum "$testdir/file3.chk" | _filter_scratch
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file3 | _filter_scratch
+md5sum $testdir/file3.chk | _filter_scratch
 
 # success, all done
 status=0
diff --git a/tests/generic/196 b/tests/generic/196
index a7a0035..951079c 100755
--- a/tests/generic/196
+++ b/tests/generic/196
@@ -25,8 +25,8 @@
 # Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 #-----------------------------------------------------------------------
 
-seq=`basename "$0"`
-seqres="$RESULT_DIR/$seq"
+seq=`basename $0`
+seqres=$RESULT_DIR/$seq
 echo "QA output created by $seq"
 
 here=`pwd`
@@ -37,7 +37,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _cleanup()
 {
     cd /
-    rm -rf "$tmp".* "$testdir"
+    rm -rf $tmp.* $testdir
 }
 
 # get standard environment, filters and checks
@@ -50,36 +50,38 @@ _supported_os Linux
 _require_scratch_reflink
 _require_xfs_io_command "falloc"
 
-rm -f "$seqres.full"
+rm -f $seqres.full
 
 echo "Format and mount"
-_scratch_mkfs > "$seqres.full" 2>&1
-_scratch_mount >> "$seqres.full" 2>&1
+_scratch_mkfs > $seqres.full 2>&1
+_scratch_mount >> $seqres.full 2>&1
 
-testdir="$SCRATCH_MNT/test-$seq"
-rm -rf $testdir
+testdir=$SCRATCH_MNT/test-$seq
 mkdir $testdir
 
 echo "Create the original files"
 blksz=65536
 nr=64
+filesize=$((blksz * nr))
 _weave_reflink_regular $blksz $nr $testdir/file1 $testdir/file3 >> $seqres.full
 _scratch_remount
 
 echo "Compare files"
-md5sum "$testdir/file1" | _filter_scratch
-md5sum "$testdir/file3" | _filter_scratch
-md5sum "$testdir/file3.chk" | _filter_scratch
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file3 | _filter_scratch
+md5sum $testdir/file3.chk | _filter_scratch
 
 echo "directio CoW across the transition"
-"$XFS_IO_PROG" -d -f -c "pwrite -S 0x63 -b $((blksz * nr / 2)) $((blksz * nr / 4)) $((blksz * nr / 2))" "$testdir/file3" >> "$seqres.full"
-_pwrite_byte 0x63 $((blksz * nr / 4)) $((blksz * nr / 2)) "$testdir/file3.chk" >> "$seqres.full"
+cowoff=$((filesize / 4))
+cowsz=$((filesize / 2))
+$XFS_IO_PROG -d -f -c "pwrite -S 0x63 -b $cowsz $cowoff $cowsz" $testdir/file3 >> $seqres.full
+_pwrite_byte 0x63 $cowoff $cowsz $testdir/file3.chk >> $seqres.full
 _scratch_remount
 
 echo "Compare files"
-md5sum "$testdir/file1" | _filter_scratch
-md5sum "$testdir/file3" | _filter_scratch
-md5sum "$testdir/file3.chk" | _filter_scratch
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file3 | _filter_scratch
+md5sum $testdir/file3.chk | _filter_scratch
 
 # success, all done
 status=0
diff --git a/tests/generic/197 b/tests/generic/197
index 84a14ff..cfdbf1b 100755
--- a/tests/generic/197
+++ b/tests/generic/197
@@ -25,8 +25,8 @@
 # Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 #-----------------------------------------------------------------------
 
-seq=`basename "$0"`
-seqres="$RESULT_DIR/$seq"
+seq=`basename $0`
+seqres=$RESULT_DIR/$seq
 echo "QA output created by $seq"
 
 here=`pwd`
@@ -37,7 +37,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _cleanup()
 {
     cd /
-    rm -rf "$tmp".* "$testdir"
+    rm -rf $tmp.* $testdir
 }
 
 # get standard environment, filters and checks
@@ -50,36 +50,38 @@ _supported_os Linux
 _require_scratch_reflink
 _require_xfs_io_command "falloc"
 
-rm -f "$seqres.full"
+rm -f $seqres.full
 
 echo "Format and mount"
-_scratch_mkfs > "$seqres.full" 2>&1
-_scratch_mount >> "$seqres.full" 2>&1
+_scratch_mkfs > $seqres.full 2>&1
+_scratch_mount >> $seqres.full 2>&1
 
-testdir="$SCRATCH_MNT/test-$seq"
-rm -rf $testdir
+testdir=$SCRATCH_MNT/test-$seq
 mkdir $testdir
 
 echo "Create the original files"
 blksz=65536
 nr=64
+filesize=$((blksz * nr))
 _weave_reflink_regular $blksz $nr $testdir/file1 $testdir/file3 >> $seqres.full
 _scratch_remount
 
 echo "Compare files"
-md5sum "$testdir/file1" | _filter_scratch
-md5sum "$testdir/file3" | _filter_scratch
-md5sum "$testdir/file3.chk" | _filter_scratch
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file3 | _filter_scratch
+md5sum $testdir/file3.chk | _filter_scratch
 
 echo "CoW across the transition"
-"$XFS_IO_PROG" -f -c "pwrite -S 0x63 -b $((blksz * nr / 2)) $((blksz * nr / 4)) $((blksz * nr / 2))" "$testdir/file3" >> "$seqres.full"
-_pwrite_byte 0x63 $((blksz * nr / 4)) $((blksz * nr / 2)) "$testdir/file3.chk" >> "$seqres.full"
+cowoff=$((filesize / 4))
+cowsz=$((filesize / 2))
+$XFS_IO_PROG -f -c "pwrite -S 0x63 -b $cowsz $cowoff $cowsz" $testdir/file3 >> $seqres.full
+_pwrite_byte 0x63 $cowoff $cowsz $testdir/file3.chk >> $seqres.full
 _scratch_remount
 
 echo "Compare files"
-md5sum "$testdir/file1" | _filter_scratch
-md5sum "$testdir/file3" | _filter_scratch
-md5sum "$testdir/file3.chk" | _filter_scratch
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file3 | _filter_scratch
+md5sum $testdir/file3.chk | _filter_scratch
 
 # success, all done
 status=0
diff --git a/tests/generic/199 b/tests/generic/199
index 6a65533..f457245 100755
--- a/tests/generic/199
+++ b/tests/generic/199
@@ -29,8 +29,8 @@
 # Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 #-----------------------------------------------------------------------
 
-seq=`basename "$0"`
-seqres="$RESULT_DIR/$seq"
+seq=`basename $0`
+seqres=$RESULT_DIR/$seq
 echo "QA output created by $seq"
 
 here=`pwd`
@@ -41,7 +41,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _cleanup()
 {
     cd /
-    rm -rf "$tmp".* "$testdir"
+    rm -rf $tmp.* $testdir
 }
 
 # get standard environment, filters and checks
@@ -56,38 +56,40 @@ _require_xfs_io_command "falloc"
 _require_xfs_io_command "fpunch"
 _require_cp_reflink
 
-rm -f "$seqres.full"
+rm -f $seqres.full
 
 echo "Format and mount"
-_scratch_mkfs > "$seqres.full" 2>&1
-_scratch_mount >> "$seqres.full" 2>&1
+_scratch_mkfs > $seqres.full 2>&1
+_scratch_mount >> $seqres.full 2>&1
 
-testdir="$SCRATCH_MNT/test-$seq"
-rm -rf $testdir
+testdir=$SCRATCH_MNT/test-$seq
 mkdir $testdir
 
 echo "Create the original files"
 blksz=65536
 nr=64
+filesize=$((blksz * nr))
 _weave_reflink_rainbow $blksz $nr $testdir/file1 $testdir/file3 >> $seqres.full
 _scratch_remount
 
 echo "Compare files"
-md5sum "$testdir/file1" | _filter_scratch
-md5sum "$testdir/file3" | _filter_scratch
-md5sum "$testdir/file3.chk" | _filter_scratch
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file3 | _filter_scratch
+md5sum $testdir/file3.chk | _filter_scratch
 
 echo "directio CoW across the transition"
+cowoff=$((filesize / 4))
+cowsz=$((filesize / 2))
 _weave_reflink_rainbow_delalloc $blksz $nr $testdir/file3 >> $seqres.full
 # now cow
-"$XFS_IO_PROG" -d -f -c "pwrite -S 0x63 -b $((blksz * nr / 2)) $((blksz * nr / 4)) $((blksz * nr / 2))" "$testdir/file3" >> "$seqres.full"
-_pwrite_byte 0x63 $((blksz * nr / 4)) $((blksz * nr / 2)) "$testdir/file3.chk" >> "$seqres.full"
+$XFS_IO_PROG -d -f -c "pwrite -S 0x63 -b $cowsz $cowoff $cowsz" $testdir/file3 >> $seqres.full
+_pwrite_byte 0x63 $cowoff $cowsz $testdir/file3.chk >> $seqres.full
 _scratch_remount
 
 echo "Compare files"
-md5sum "$testdir/file1" | _filter_scratch
-md5sum "$testdir/file3" | _filter_scratch
-md5sum "$testdir/file3.chk" | _filter_scratch
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file3 | _filter_scratch
+md5sum $testdir/file3.chk | _filter_scratch
 
 # success, all done
 status=0
diff --git a/tests/generic/200 b/tests/generic/200
index 541d16d..ffb5869 100755
--- a/tests/generic/200
+++ b/tests/generic/200
@@ -29,8 +29,8 @@
 # Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 #-----------------------------------------------------------------------
 
-seq=`basename "$0"`
-seqres="$RESULT_DIR/$seq"
+seq=`basename $0`
+seqres=$RESULT_DIR/$seq
 echo "QA output created by $seq"
 
 here=`pwd`
@@ -41,7 +41,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _cleanup()
 {
     cd /
-    rm -rf "$tmp".* "$testdir"
+    rm -rf $tmp.* $testdir
 }
 
 # get standard environment, filters and checks
@@ -56,38 +56,40 @@ _require_xfs_io_command "falloc"
 _require_xfs_io_command "fpunch"
 _require_cp_reflink
 
-rm -f "$seqres.full"
+rm -f $seqres.full
 
 echo "Format and mount"
-_scratch_mkfs > "$seqres.full" 2>&1
-_scratch_mount >> "$seqres.full" 2>&1
+_scratch_mkfs > $seqres.full 2>&1
+_scratch_mount >> $seqres.full 2>&1
 
-testdir="$SCRATCH_MNT/test-$seq"
-rm -rf $testdir
+testdir=$SCRATCH_MNT/test-$seq
 mkdir $testdir
 
 echo "Create the original files"
 blksz=65536
 nr=64
+filesize=$((blksz * nr))
 _weave_reflink_rainbow $blksz $nr $testdir/file1 $testdir/file3 >> $seqres.full
 _scratch_remount
 
 echo "Compare files"
-md5sum "$testdir/file1" | _filter_scratch
-md5sum "$testdir/file3" | _filter_scratch
-md5sum "$testdir/file3.chk" | _filter_scratch
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file3 | _filter_scratch
+md5sum $testdir/file3.chk | _filter_scratch
 
 echo "directio CoW across the transition"
+cowoff=$((filesize / 4))
+cowsz=$((filesize / 2))
 _weave_reflink_rainbow_delalloc $blksz $nr $testdir/file3 >> $seqres.full
 # now cow
-"$XFS_IO_PROG" -f -c "pwrite -S 0x63 -b $((blksz * nr / 2)) $((blksz * nr / 4)) $((blksz * nr / 2))" "$testdir/file3" >> "$seqres.full"
-_pwrite_byte 0x63 $((blksz * nr / 4)) $((blksz * nr / 2)) "$testdir/file3.chk" >> "$seqres.full"
+$XFS_IO_PROG -f -c "pwrite -S 0x63 -b $cowsz $cowoff $cowsz" $testdir/file3 >> $seqres.full
+_pwrite_byte 0x63 $cowoff $cowsz $testdir/file3.chk >> $seqres.full
 _scratch_remount
 
 echo "Compare files"
-md5sum "$testdir/file1" | _filter_scratch
-md5sum "$testdir/file3" | _filter_scratch
-md5sum "$testdir/file3.chk" | _filter_scratch
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file3 | _filter_scratch
+md5sum $testdir/file3.chk | _filter_scratch
 
 # success, all done
 status=0
diff --git a/tests/generic/201 b/tests/generic/201
index 90087ef..634dec9 100755
--- a/tests/generic/201
+++ b/tests/generic/201
@@ -21,8 +21,8 @@
 # Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 #-----------------------------------------------------------------------
 
-seq=`basename "$0"`
-seqres="$RESULT_DIR/$seq"
+seq=`basename $0`
+seqres=$RESULT_DIR/$seq
 echo "QA output created by $seq"
 
 here=`pwd`
@@ -33,7 +33,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _cleanup()
 {
     cd /
-    rm -rf "$tmp".* "$testdir"
+    rm -rf $tmp.* $testdir
 }
 
 # get standard environment, filters and checks
@@ -46,36 +46,38 @@ _supported_os Linux
 _require_scratch_reflink
 _require_xfs_io_command "falloc"
 
-rm -f "$seqres.full"
+rm -f $seqres.full
 
 echo "Format and mount"
-_scratch_mkfs > "$seqres.full" 2>&1
-_scratch_mount >> "$seqres.full" 2>&1
+_scratch_mkfs > $seqres.full 2>&1
+_scratch_mount >> $seqres.full 2>&1
 
-testdir="$SCRATCH_MNT/test-$seq"
-rm -rf $testdir
+testdir=$SCRATCH_MNT/test-$seq
 mkdir $testdir
 
 echo "Create the original files"
 blksz=65536
 nr=64
-_pwrite_byte 0x61 0 $((blksz * nr)) "$testdir/file1" >> "$seqres.full"
-_pwrite_byte 0x62 0 $((blksz * nr)) "$testdir/file3" >> "$seqres.full"
-_pwrite_byte 0x62 0 $((blksz * nr)) "$testdir/file3.chk" >> "$seqres.full"
+filesize=$((blksz * nr))
+_pwrite_byte 0x61 0 $filesize $testdir/file1 >> $seqres.full
+_pwrite_byte 0x62 0 $filesize $testdir/file3 >> $seqres.full
+_pwrite_byte 0x62 0 $filesize $testdir/file3.chk >> $seqres.full
 seq 0 2 $((nr-1)) | while read f; do
-	_reflink_range "$testdir/file1" $((blksz * f)) "$testdir/file3" $((blksz * f)) $blksz >> "$seqres.full"
-	_pwrite_byte 0x61 $((blksz * f)) $blksz "$testdir/file3.chk" >> "$seqres.full"
+	_reflink_range $testdir/file1 $((blksz * f)) $testdir/file3 $((blksz * f)) $blksz >> $seqres.full
+	_pwrite_byte 0x61 $((blksz * f)) $blksz $testdir/file3.chk >> $seqres.full
 done
 _scratch_remount
 
 echo "Compare files"
-md5sum "$testdir/file1" | _filter_scratch
-md5sum "$testdir/file3" | _filter_scratch
-md5sum "$testdir/file3.chk" | _filter_scratch
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file3 | _filter_scratch
+md5sum $testdir/file3.chk | _filter_scratch
 
 echo "CoW and unmount"
-"$XFS_IO_PROG" -f -c "pwrite -S 0x63 -b $((blksz * nr / 2)) $((blksz * nr / 4)) $((blksz * nr / 2))" "$testdir/file3" >> "$seqres.full"
-rm "$testdir/file3"
+cowoff=$((filesize / 4))
+cowsz=$((filesize / 2))
+$XFS_IO_PROG -f -c "pwrite -S 0x63 -b $cowsz $cowoff $cowsz" $testdir/file3 >> $seqres.full
+rm $testdir/file3
 
 # success, all done
 status=0
diff --git a/tests/generic/202 b/tests/generic/202
index e034e4e..a7f4004 100755
--- a/tests/generic/202
+++ b/tests/generic/202
@@ -20,8 +20,8 @@
 # Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 #-----------------------------------------------------------------------
 
-seq=`basename "$0"`
-seqres="$RESULT_DIR/$seq"
+seq=`basename $0`
+seqres=$RESULT_DIR/$seq
 echo "QA output created by $seq"
 
 here=`pwd`
@@ -32,7 +32,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _cleanup()
 {
     cd /
-    rm -rf "$tmp".* "$testdir"
+    rm -rf $tmp.* $testdir
 }
 
 # get standard environment, filters and checks
@@ -45,37 +45,36 @@ _supported_os Linux
 _require_scratch_reflink
 _require_cp_reflink
 
-rm -f "$seqres.full"
+rm -f $seqres.full
 
 echo "Format and mount"
-_scratch_mkfs > "$seqres.full" 2>&1
-_scratch_mount >> "$seqres.full" 2>&1
+_scratch_mkfs > $seqres.full 2>&1
+_scratch_mount >> $seqres.full 2>&1
 
-testdir="$SCRATCH_MNT/test-$seq"
-rm -rf $testdir
+testdir=$SCRATCH_MNT/test-$seq
 mkdir $testdir
 
 echo "Create the original files"
 blksz=65536
-_pwrite_byte 0x61 0 $((blksz + 17)) "$testdir/file1" >> "$seqres.full"
-_cp_reflink "$testdir/file1" "$testdir/file2"
-_pwrite_byte 0x61 0 $((blksz + 17)) "$testdir/file2.chk" >> "$seqres.full"
+_pwrite_byte 0x61 0 $((blksz + 17)) $testdir/file1 >> $seqres.full
+_cp_reflink $testdir/file1 $testdir/file2
+_pwrite_byte 0x61 0 $((blksz + 17)) $testdir/file2.chk >> $seqres.full
 _scratch_remount
 
 echo "Compare files"
-md5sum "$testdir/file1" | _filter_scratch
-md5sum "$testdir/file2" | _filter_scratch
-md5sum "$testdir/file2.chk" | _filter_scratch
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file2 | _filter_scratch
+md5sum $testdir/file2.chk | _filter_scratch
 
 echo "CoW and unmount"
-"$XFS_IO_PROG" -f -c "pwrite -S 0x63 $((blksz + 17)) 17" "$testdir/file2" >> "$seqres.full"
-"$XFS_IO_PROG" -f -c "pwrite -S 0x63 $((blksz + 17)) 17" "$testdir/file2.chk" >> "$seqres.full"
+$XFS_IO_PROG -f -c "pwrite -S 0x63 $((blksz + 17)) 17" $testdir/file2 >> $seqres.full
+$XFS_IO_PROG -f -c "pwrite -S 0x63 $((blksz + 17)) 17" $testdir/file2.chk >> $seqres.full
 _scratch_remount
 
 echo "Compare files"
-md5sum "$testdir/file1" | _filter_scratch
-md5sum "$testdir/file2" | _filter_scratch
-md5sum "$testdir/file2.chk" | _filter_scratch
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file2 | _filter_scratch
+md5sum $testdir/file2.chk | _filter_scratch
 
 # success, all done
 status=0
diff --git a/tests/generic/203 b/tests/generic/203
index 2b6db7e..5d9bfc4 100755
--- a/tests/generic/203
+++ b/tests/generic/203
@@ -20,8 +20,8 @@
 # Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 #-----------------------------------------------------------------------
 
-seq=`basename "$0"`
-seqres="$RESULT_DIR/$seq"
+seq=`basename $0`
+seqres=$RESULT_DIR/$seq
 echo "QA output created by $seq"
 
 here=`pwd`
@@ -32,7 +32,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _cleanup()
 {
     cd /
-    rm -rf "$tmp".* "$testdir"
+    rm -rf $tmp.* $testdir
 }
 
 # get standard environment, filters and checks
@@ -45,37 +45,36 @@ _supported_os Linux
 _require_scratch_reflink
 _require_cp_reflink
 
-rm -f "$seqres.full"
+rm -f $seqres.full
 
 echo "Format and mount"
-_scratch_mkfs > "$seqres.full" 2>&1
-_scratch_mount >> "$seqres.full" 2>&1
+_scratch_mkfs > $seqres.full 2>&1
+_scratch_mount >> $seqres.full 2>&1
 
-testdir="$SCRATCH_MNT/test-$seq"
-rm -rf $testdir
+testdir=$SCRATCH_MNT/test-$seq
 mkdir $testdir
 
 echo "Create the original files"
 blksz=65536
-_pwrite_byte 0x61 0 $((blksz + 17)) "$testdir/file1" >> "$seqres.full"
-_cp_reflink "$testdir/file1" "$testdir/file2"
-_pwrite_byte 0x61 0 $((blksz + 17)) "$testdir/file2.chk" >> "$seqres.full"
+_pwrite_byte 0x61 0 $((blksz + 17)) $testdir/file1 >> $seqres.full
+_cp_reflink $testdir/file1 $testdir/file2
+_pwrite_byte 0x61 0 $((blksz + 17)) $testdir/file2.chk >> $seqres.full
 _scratch_remount
 
 echo "Compare files"
-md5sum "$testdir/file1" | _filter_scratch
-md5sum "$testdir/file2" | _filter_scratch
-md5sum "$testdir/file2.chk" | _filter_scratch
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file2 | _filter_scratch
+md5sum $testdir/file2.chk | _filter_scratch
 
 echo "CoW and unmount"
-"$XFS_IO_PROG" -d -f -c "pwrite -S 0x63 $blksz $blksz" "$testdir/file2" >> "$seqres.full"
-"$XFS_IO_PROG" -f -c "pwrite -S 0x63 $blksz $blksz" "$testdir/file2.chk" >> "$seqres.full"
+$XFS_IO_PROG -d -f -c "pwrite -S 0x63 $blksz $blksz" $testdir/file2 >> $seqres.full
+$XFS_IO_PROG -f -c "pwrite -S 0x63 $blksz $blksz" $testdir/file2.chk >> $seqres.full
 _scratch_remount
 
 echo "Compare files"
-md5sum "$testdir/file1" | _filter_scratch
-md5sum "$testdir/file2" | _filter_scratch
-md5sum "$testdir/file2.chk" | _filter_scratch
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file2 | _filter_scratch
+md5sum $testdir/file2.chk | _filter_scratch
 
 # success, all done
 status=0
diff --git a/tests/generic/205 b/tests/generic/205
index 8955e67..683849e 100755
--- a/tests/generic/205
+++ b/tests/generic/205
@@ -24,8 +24,8 @@
 # Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 #-----------------------------------------------------------------------
 
-seq=`basename "$0"`
-seqres="$RESULT_DIR/$seq"
+seq=`basename $0`
+seqres=$RESULT_DIR/$seq
 echo "QA output created by $seq"
 
 here=`pwd`
@@ -36,7 +36,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _cleanup()
 {
     cd /
-    rm -rf "$tmp".* "$testdir"
+    rm -rf $tmp.* $testdir
 }
 
 # get standard environment, filters and checks
@@ -48,50 +48,49 @@ _cleanup()
 _supported_os Linux
 _require_scratch_reflink
 
-rm -f "$seqres.full"
+rm -f $seqres.full
 
 pagesz=$(getconf PAGE_SIZE)
 blksz=$((pagesz / 4))
 
 echo "Format and mount"
-_scratch_mkfs_blocksized $blksz > "$seqres.full" 2>&1
-_scratch_mount >> "$seqres.full" 2>&1
+_scratch_mkfs_blocksized $blksz > $seqres.full 2>&1
+_scratch_mount >> $seqres.full 2>&1
 
-testdir="$SCRATCH_MNT/test-$seq"
-rm -rf $testdir
+testdir=$SCRATCH_MNT/test-$seq
 mkdir $testdir
 
 real_blksz=$(stat -f -c '%S' $testdir)
-test "$real_blksz" != "$blksz" && _notrun "Failed to format with small blocksize."
+test $real_blksz != $blksz && _notrun "Failed to format with small blocksize."
 
 echo "Create the original files"
-_pwrite_byte 0x61 0 $pagesz "$testdir/file1" >> "$seqres.full"
+_pwrite_byte 0x61 0 $pagesz $testdir/file1 >> $seqres.full
 
-"$XFS_IO_PROG" -f -c "truncate $pagesz" "$testdir/file2" >> "$seqres.full"
-"$XFS_IO_PROG" -f -c "truncate $pagesz" "$testdir/file2.chk" >> "$seqres.full"
+$XFS_IO_PROG -f -c "truncate $pagesz" $testdir/file2 >> $seqres.full
+$XFS_IO_PROG -f -c "truncate $pagesz" $testdir/file2.chk >> $seqres.full
 
-_pwrite_byte 0x61 $blksz $blksz "$testdir/file2" >> "$seqres.full"
-_pwrite_byte 0x61 $blksz $blksz "$testdir/file2.chk" >> "$seqres.full"
+_pwrite_byte 0x61 $blksz $blksz $testdir/file2 >> $seqres.full
+_pwrite_byte 0x61 $blksz $blksz $testdir/file2.chk >> $seqres.full
 
-_pwrite_byte 0x61 $((blksz * 3)) $blksz "$testdir/file2" >> "$seqres.full"
-_pwrite_byte 0x61 $((blksz * 3)) $blksz "$testdir/file2.chk" >> "$seqres.full"
+_pwrite_byte 0x61 $((blksz * 3)) $blksz $testdir/file2 >> $seqres.full
+_pwrite_byte 0x61 $((blksz * 3)) $blksz $testdir/file2.chk >> $seqres.full
 
-_reflink_range "$testdir/file1" $blksz "$testdir/file2" $((blksz * 2)) $blksz >> "$seqres.full"
-_pwrite_byte 0x61 $((blksz * 2)) $blksz "$testdir/file2.chk" >> "$seqres.full"
+_reflink_range $testdir/file1 $blksz $testdir/file2 $((blksz * 2)) $blksz >> $seqres.full
+_pwrite_byte 0x61 $((blksz * 2)) $blksz $testdir/file2.chk >> $seqres.full
 _scratch_remount
 
 echo "Compare files"
-! cmp -s "$testdir/file1" "$testdir/file2" || _fail "file1 and file2 don't match."
-cmp -s "$testdir/file2" "$testdir/file2.chk" || _fail "file2 and file2.chk don't match."
+! cmp -s $testdir/file1 $testdir/file2 || _fail "file1 and file2 don't match."
+cmp -s $testdir/file2 $testdir/file2.chk || _fail "file2 and file2.chk don't match."
 
 echo "CoW and unmount"
-"$XFS_IO_PROG" -f -c "pwrite -S 0x63 $((blksz + 17)) $((blksz * 3 - 34))" "$testdir/file2" >> "$seqres.full"
-"$XFS_IO_PROG" -f -c "pwrite -S 0x63 $((blksz + 17)) $((blksz * 3 - 34))" "$testdir/file2.chk" >> "$seqres.full"
+$XFS_IO_PROG -f -c "pwrite -S 0x63 $((blksz + 17)) $((blksz * 3 - 34))" $testdir/file2 >> $seqres.full
+$XFS_IO_PROG -f -c "pwrite -S 0x63 $((blksz + 17)) $((blksz * 3 - 34))" $testdir/file2.chk >> $seqres.full
 _scratch_remount
 
 echo "Compare files"
-! cmp -s "$testdir/file1" "$testdir/file2" || _fail "file1 and file2 don't match."
-cmp -s "$testdir/file2" "$testdir/file2.chk" || _fail "file2 and file2.chk don't match."
+! cmp -s $testdir/file1 $testdir/file2 || _fail "file1 and file2 don't match."
+cmp -s $testdir/file2 $testdir/file2.chk || _fail "file2 and file2.chk don't match."
 
 # success, all done
 status=0
diff --git a/tests/generic/206 b/tests/generic/206
index 12ad745..4054626 100755
--- a/tests/generic/206
+++ b/tests/generic/206
@@ -24,8 +24,8 @@
 # Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 #-----------------------------------------------------------------------
 
-seq=`basename "$0"`
-seqres="$RESULT_DIR/$seq"
+seq=`basename $0`
+seqres=$RESULT_DIR/$seq
 echo "QA output created by $seq"
 
 here=`pwd`
@@ -36,7 +36,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _cleanup()
 {
     cd /
-    rm -rf "$tmp".* "$testdir"
+    rm -rf $tmp.* $testdir
 }
 
 # get standard environment, filters and checks
@@ -48,50 +48,49 @@ _cleanup()
 _supported_os Linux
 _require_scratch_reflink
 
-rm -f "$seqres.full"
+rm -f $seqres.full
 
 pagesz=$(getconf PAGE_SIZE)
 blksz=$((pagesz / 4))
 
 echo "Format and mount"
-_scratch_mkfs_blocksized $blksz > "$seqres.full" 2>&1
-_scratch_mount >> "$seqres.full" 2>&1
+_scratch_mkfs_blocksized $blksz > $seqres.full 2>&1
+_scratch_mount >> $seqres.full 2>&1
 
-testdir="$SCRATCH_MNT/test-$seq"
-rm -rf $testdir
+testdir=$SCRATCH_MNT/test-$seq
 mkdir $testdir
 
 real_blksz=$(stat -f -c '%S' $testdir)
-test "$real_blksz" != "$blksz" && _notrun "Failed to format with small blocksize."
+test $real_blksz != $blksz && _notrun "Failed to format with small blocksize."
 
 echo "Create the original files"
-_pwrite_byte 0x61 0 $pagesz "$testdir/file1" >> "$seqres.full"
+_pwrite_byte 0x61 0 $pagesz $testdir/file1 >> $seqres.full
 
-"$XFS_IO_PROG" -f -c "truncate $pagesz" "$testdir/file2" >> "$seqres.full"
-"$XFS_IO_PROG" -f -c "truncate $pagesz" "$testdir/file2.chk" >> "$seqres.full"
+$XFS_IO_PROG -f -c "truncate $pagesz" $testdir/file2 >> $seqres.full
+$XFS_IO_PROG -f -c "truncate $pagesz" $testdir/file2.chk >> $seqres.full
 
-_pwrite_byte 0x61 $blksz $blksz "$testdir/file2" >> "$seqres.full"
-_pwrite_byte 0x61 $blksz $blksz "$testdir/file2.chk" >> "$seqres.full"
+_pwrite_byte 0x61 $blksz $blksz $testdir/file2 >> $seqres.full
+_pwrite_byte 0x61 $blksz $blksz $testdir/file2.chk >> $seqres.full
 
-_pwrite_byte 0x61 $((blksz * 3)) $blksz "$testdir/file2" >> "$seqres.full"
-_pwrite_byte 0x61 $((blksz * 3)) $blksz "$testdir/file2.chk" >> "$seqres.full"
+_pwrite_byte 0x61 $((blksz * 3)) $blksz $testdir/file2 >> $seqres.full
+_pwrite_byte 0x61 $((blksz * 3)) $blksz $testdir/file2.chk >> $seqres.full
 
-_reflink_range "$testdir/file1" $blksz "$testdir/file2" $((blksz * 2)) $blksz >> "$seqres.full"
-_pwrite_byte 0x61 $((blksz * 2)) $blksz "$testdir/file2.chk" >> "$seqres.full"
+_reflink_range $testdir/file1 $blksz $testdir/file2 $((blksz * 2)) $blksz >> $seqres.full
+_pwrite_byte 0x61 $((blksz * 2)) $blksz $testdir/file2.chk >> $seqres.full
 _scratch_remount
 
 echo "Compare files"
-! cmp -s "$testdir/file1" "$testdir/file2" || _fail "file1 and file2 don't match."
-cmp -s "$testdir/file2" "$testdir/file2.chk" || _fail "file2 and file2.chk don't match."
+! cmp -s $testdir/file1 $testdir/file2 || _fail "file1 and file2 don't match."
+cmp -s $testdir/file2 $testdir/file2.chk || _fail "file2 and file2.chk don't match."
 
 echo "CoW and unmount"
-"$XFS_IO_PROG" -d -f -c "pwrite -S 0x63 $blksz $((blksz * 3))" "$testdir/file2" >> "$seqres.full"
-"$XFS_IO_PROG" -f -c "pwrite -S 0x63 $blksz $((blksz * 3))" "$testdir/file2.chk" >> "$seqres.full"
+$XFS_IO_PROG -d -f -c "pwrite -S 0x63 $blksz $((blksz * 3))" $testdir/file2 >> $seqres.full
+$XFS_IO_PROG -f -c "pwrite -S 0x63 $blksz $((blksz * 3))" $testdir/file2.chk >> $seqres.full
 _scratch_remount
 
 echo "Compare files"
-! cmp -s "$testdir/file1" "$testdir/file2" || _fail "file1 and file2 don't match."
-cmp -s "$testdir/file2" "$testdir/file2.chk" || _fail "file2 and file2.chk don't match."
+! cmp -s $testdir/file1 $testdir/file2 || _fail "file1 and file2 don't match."
+cmp -s $testdir/file2 $testdir/file2.chk || _fail "file2 and file2.chk don't match."
 
 # success, all done
 status=0
diff --git a/tests/generic/216 b/tests/generic/216
index 3e0084e..d9f7e21 100755
--- a/tests/generic/216
+++ b/tests/generic/216
@@ -24,8 +24,8 @@
 # Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 #-----------------------------------------------------------------------
 
-seq=`basename "$0"`
-seqres="$RESULT_DIR/$seq"
+seq=`basename $0`
+seqres=$RESULT_DIR/$seq
 echo "QA output created by $seq"
 
 here=`pwd`
@@ -36,7 +36,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _cleanup()
 {
     cd /
-    rm -rf "$tmp".* "$testdir"
+    rm -rf $tmp.* $testdir
 }
 
 # get standard environment, filters and checks
@@ -49,50 +49,49 @@ _supported_os Linux
 _require_scratch_reflink
 _require_xfs_io_command "falloc"
 
-rm -f "$seqres.full"
+rm -f $seqres.full
 
 pagesz=$(getconf PAGE_SIZE)
 blksz=$((pagesz / 4))
 
 echo "Format and mount"
-_scratch_mkfs_blocksized $blksz > "$seqres.full" 2>&1
-_scratch_mount >> "$seqres.full" 2>&1
+_scratch_mkfs_blocksized $blksz > $seqres.full 2>&1
+_scratch_mount >> $seqres.full 2>&1
 
-testdir="$SCRATCH_MNT/test-$seq"
-rm -rf $testdir
+testdir=$SCRATCH_MNT/test-$seq
 mkdir $testdir
 
 real_blksz=$(stat -f -c '%S' $testdir)
-test "$real_blksz" != "$blksz" && _notrun "Failed to format with small blocksize."
+test $real_blksz != $blksz && _notrun "Failed to format with small blocksize."
 
 echo "Create the original files"
-_pwrite_byte 0x61 0 $pagesz "$testdir/file1" >> "$seqres.full"
+_pwrite_byte 0x61 0 $pagesz $testdir/file1 >> $seqres.full
 
-"$XFS_IO_PROG" -f -c "truncate $pagesz" "$testdir/file2" >> "$seqres.full"
-"$XFS_IO_PROG" -f -c "truncate $pagesz" "$testdir/file2.chk" >> "$seqres.full"
+$XFS_IO_PROG -f -c "truncate $pagesz" $testdir/file2 >> $seqres.full
+$XFS_IO_PROG -f -c "truncate $pagesz" $testdir/file2.chk >> $seqres.full
 
-"$XFS_IO_PROG" -f -c "falloc -k $blksz $blksz" "$testdir/file2" >> "$seqres.full"
-_pwrite_byte 0x00 $blksz $blksz "$testdir/file2.chk" >> "$seqres.full"
+$XFS_IO_PROG -f -c "falloc -k $blksz $blksz" $testdir/file2 >> $seqres.full
+_pwrite_byte 0x00 $blksz $blksz $testdir/file2.chk >> $seqres.full
 
-"$XFS_IO_PROG" -f -c "falloc -k $((blksz * 3)) $blksz" "$testdir/file2" >> "$seqres.full"
-_pwrite_byte 0x00 $((blksz * 3)) $blksz "$testdir/file2.chk" >> "$seqres.full"
+$XFS_IO_PROG -f -c "falloc -k $((blksz * 3)) $blksz" $testdir/file2 >> $seqres.full
+_pwrite_byte 0x00 $((blksz * 3)) $blksz $testdir/file2.chk >> $seqres.full
 
-_reflink_range "$testdir/file1" $blksz "$testdir/file2" $((blksz * 2)) $blksz >> "$seqres.full"
-_pwrite_byte 0x61 $((blksz * 2)) $blksz "$testdir/file2.chk" >> "$seqres.full"
+_reflink_range $testdir/file1 $blksz $testdir/file2 $((blksz * 2)) $blksz >> $seqres.full
+_pwrite_byte 0x61 $((blksz * 2)) $blksz $testdir/file2.chk >> $seqres.full
 _scratch_remount
 
 echo "Compare files"
-! cmp -s "$testdir/file1" "$testdir/file2" || _fail "file1 and file2 don't match."
-cmp -s "$testdir/file2" "$testdir/file2.chk" || _fail "file2 and file2.chk don't match."
+! cmp -s $testdir/file1 $testdir/file2 || _fail "file1 and file2 don't match."
+cmp -s $testdir/file2 $testdir/file2.chk || _fail "file2 and file2.chk don't match."
 
 echo "CoW and unmount"
-"$XFS_IO_PROG" -f -c "pwrite -S 0x63 $((blksz + 17)) $((blksz * 3 - 34))" "$testdir/file2" >> "$seqres.full"
-"$XFS_IO_PROG" -f -c "pwrite -S 0x63 $((blksz + 17)) $((blksz * 3 - 34))" "$testdir/file2.chk" >> "$seqres.full"
+$XFS_IO_PROG -f -c "pwrite -S 0x63 $((blksz + 17)) $((blksz * 3 - 34))" $testdir/file2 >> $seqres.full
+$XFS_IO_PROG -f -c "pwrite -S 0x63 $((blksz + 17)) $((blksz * 3 - 34))" $testdir/file2.chk >> $seqres.full
 _scratch_remount
 
 echo "Compare files"
-! cmp -s "$testdir/file1" "$testdir/file2" || _fail "file1 and file2 don't match."
-cmp -s "$testdir/file2" "$testdir/file2.chk" || _fail "file2 and file2.chk don't match."
+! cmp -s $testdir/file1 $testdir/file2 || _fail "file1 and file2 don't match."
+cmp -s $testdir/file2 $testdir/file2.chk || _fail "file2 and file2.chk don't match."
 
 # success, all done
 status=0
diff --git a/tests/generic/217 b/tests/generic/217
index 3470d25..b1bd635 100755
--- a/tests/generic/217
+++ b/tests/generic/217
@@ -24,8 +24,8 @@
 # Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 #-----------------------------------------------------------------------
 
-seq=`basename "$0"`
-seqres="$RESULT_DIR/$seq"
+seq=`basename $0`
+seqres=$RESULT_DIR/$seq
 echo "QA output created by $seq"
 
 here=`pwd`
@@ -36,7 +36,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _cleanup()
 {
     cd /
-    rm -rf "$tmp".* "$testdir"
+    rm -rf $tmp.* $testdir
 }
 
 # get standard environment, filters and checks
@@ -49,50 +49,49 @@ _supported_os Linux
 _require_scratch_reflink
 _require_xfs_io_command "falloc"
 
-rm -f "$seqres.full"
+rm -f $seqres.full
 
 pagesz=$(getconf PAGE_SIZE)
 blksz=$((pagesz / 4))
 
 echo "Format and mount"
-_scratch_mkfs_blocksized $blksz > "$seqres.full" 2>&1
-_scratch_mount >> "$seqres.full" 2>&1
+_scratch_mkfs_blocksized $blksz > $seqres.full 2>&1
+_scratch_mount >> $seqres.full 2>&1
 
-testdir="$SCRATCH_MNT/test-$seq"
-rm -rf $testdir
+testdir=$SCRATCH_MNT/test-$seq
 mkdir $testdir
 
 real_blksz=$(stat -f -c '%S' $testdir)
-test "$real_blksz" != "$blksz" && _notrun "Failed to format with small blocksize."
+test $real_blksz != $blksz && _notrun "Failed to format with small blocksize."
 
 echo "Create the original files"
-_pwrite_byte 0x61 0 $pagesz "$testdir/file1" >> "$seqres.full"
+_pwrite_byte 0x61 0 $pagesz $testdir/file1 >> $seqres.full
 
-"$XFS_IO_PROG" -f -c "truncate $pagesz" "$testdir/file2" >> "$seqres.full"
-"$XFS_IO_PROG" -f -c "truncate $pagesz" "$testdir/file2.chk" >> "$seqres.full"
+$XFS_IO_PROG -f -c "truncate $pagesz" $testdir/file2 >> $seqres.full
+$XFS_IO_PROG -f -c "truncate $pagesz" $testdir/file2.chk >> $seqres.full
 
-"$XFS_IO_PROG" -f -c "falloc -k $blksz $blksz" "$testdir/file2" >> "$seqres.full"
-_pwrite_byte 0x00 $blksz $blksz "$testdir/file2.chk" >> "$seqres.full"
+$XFS_IO_PROG -f -c "falloc -k $blksz $blksz" $testdir/file2 >> $seqres.full
+_pwrite_byte 0x00 $blksz $blksz $testdir/file2.chk >> $seqres.full
 
-"$XFS_IO_PROG" -f -c "falloc -k $((blksz * 3)) $blksz" "$testdir/file2" >> "$seqres.full"
-_pwrite_byte 0x00 $((blksz * 3)) $blksz "$testdir/file2.chk" >> "$seqres.full"
+$XFS_IO_PROG -f -c "falloc -k $((blksz * 3)) $blksz" $testdir/file2 >> $seqres.full
+_pwrite_byte 0x00 $((blksz * 3)) $blksz $testdir/file2.chk >> $seqres.full
 
-_reflink_range "$testdir/file1" $blksz "$testdir/file2" $((blksz * 2)) $blksz >> "$seqres.full"
-_pwrite_byte 0x61 $((blksz * 2)) $blksz "$testdir/file2.chk" >> "$seqres.full"
+_reflink_range $testdir/file1 $blksz $testdir/file2 $((blksz * 2)) $blksz >> $seqres.full
+_pwrite_byte 0x61 $((blksz * 2)) $blksz $testdir/file2.chk >> $seqres.full
 _scratch_remount
 
 echo "Compare files"
-! cmp -s "$testdir/file1" "$testdir/file2" || _fail "file1 and file2 don't match."
-cmp -s "$testdir/file2" "$testdir/file2.chk" || _fail "file2 and file2.chk don't match."
+! cmp -s $testdir/file1 $testdir/file2 || _fail "file1 and file2 don't match."
+cmp -s $testdir/file2 $testdir/file2.chk || _fail "file2 and file2.chk don't match."
 
 echo "CoW and unmount"
-"$XFS_IO_PROG" -d -f -c "pwrite -S 0x63 $blksz $((blksz * 3))" "$testdir/file2" >> "$seqres.full"
-"$XFS_IO_PROG" -f -c "pwrite -S 0x63 $blksz $((blksz * 3))" "$testdir/file2.chk" >> "$seqres.full"
+$XFS_IO_PROG -d -f -c "pwrite -S 0x63 $blksz $((blksz * 3))" $testdir/file2 >> $seqres.full
+$XFS_IO_PROG -f -c "pwrite -S 0x63 $blksz $((blksz * 3))" $testdir/file2.chk >> $seqres.full
 _scratch_remount
 
 echo "Compare files"
-! cmp -s "$testdir/file1" "$testdir/file2" || _fail "file1 and file2 don't match."
-cmp -s "$testdir/file2" "$testdir/file2.chk" || _fail "file2 and file2.chk don't match."
+! cmp -s $testdir/file1 $testdir/file2 || _fail "file1 and file2 don't match."
+cmp -s $testdir/file2 $testdir/file2.chk || _fail "file2 and file2.chk don't match."
 
 # success, all done
 status=0
diff --git a/tests/generic/218 b/tests/generic/218
index 220cda3..ecc009a 100755
--- a/tests/generic/218
+++ b/tests/generic/218
@@ -24,8 +24,8 @@
 # Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 #-----------------------------------------------------------------------
 
-seq=`basename "$0"`
-seqres="$RESULT_DIR/$seq"
+seq=`basename $0`
+seqres=$RESULT_DIR/$seq
 echo "QA output created by $seq"
 
 here=`pwd`
@@ -36,7 +36,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _cleanup()
 {
     cd /
-    rm -rf "$tmp".* "$testdir"
+    rm -rf $tmp.* $testdir
 }
 
 # get standard environment, filters and checks
@@ -49,44 +49,43 @@ _supported_os Linux
 _require_scratch_reflink
 _require_xfs_io_command "falloc"
 
-rm -f "$seqres.full"
+rm -f $seqres.full
 
 pagesz=$(getconf PAGE_SIZE)
 blksz=$((pagesz / 4))
 
 echo "Format and mount"
-_scratch_mkfs_blocksized $blksz > "$seqres.full" 2>&1
-_scratch_mount >> "$seqres.full" 2>&1
+_scratch_mkfs_blocksized $blksz > $seqres.full 2>&1
+_scratch_mount >> $seqres.full 2>&1
 
-testdir="$SCRATCH_MNT/test-$seq"
-rm -rf $testdir
+testdir=$SCRATCH_MNT/test-$seq
 mkdir $testdir
 
 real_blksz=$(stat -f -c '%S' $testdir)
-test "$real_blksz" != "$blksz" && _notrun "Failed to format with small blocksize."
+test $real_blksz != $blksz && _notrun "Failed to format with small blocksize."
 
 echo "Create the original files"
-_pwrite_byte 0x61 0 $pagesz "$testdir/file1" >> "$seqres.full"
+_pwrite_byte 0x61 0 $pagesz $testdir/file1 >> $seqres.full
 
-"$XFS_IO_PROG" -f -c "truncate $pagesz" "$testdir/file2" >> "$seqres.full"
-"$XFS_IO_PROG" -f -c "truncate $pagesz" "$testdir/file2.chk" >> "$seqres.full"
+$XFS_IO_PROG -f -c "truncate $pagesz" $testdir/file2 >> $seqres.full
+$XFS_IO_PROG -f -c "truncate $pagesz" $testdir/file2.chk >> $seqres.full
 
-_reflink_range "$testdir/file1" $blksz "$testdir/file2" $((blksz * 2)) $blksz >> "$seqres.full"
-_pwrite_byte 0x61 $((blksz * 2)) $blksz "$testdir/file2.chk" >> "$seqres.full"
+_reflink_range $testdir/file1 $blksz $testdir/file2 $((blksz * 2)) $blksz >> $seqres.full
+_pwrite_byte 0x61 $((blksz * 2)) $blksz $testdir/file2.chk >> $seqres.full
 _scratch_remount
 
 echo "Compare files"
-! cmp -s "$testdir/file1" "$testdir/file2" || _fail "file1 and file2 don't match."
-cmp -s "$testdir/file2" "$testdir/file2.chk" || _fail "file2 and file2.chk don't match."
+! cmp -s $testdir/file1 $testdir/file2 || _fail "file1 and file2 don't match."
+cmp -s $testdir/file2 $testdir/file2.chk || _fail "file2 and file2.chk don't match."
 
 echo "CoW and unmount"
-"$XFS_IO_PROG" -f -c "pwrite -S 0x63 $((blksz + 17)) $((blksz * 3 - 34))" "$testdir/file2" >> "$seqres.full"
-"$XFS_IO_PROG" -f -c "pwrite -S 0x63 $((blksz + 17)) $((blksz * 3 - 34))" "$testdir/file2.chk" >> "$seqres.full"
+$XFS_IO_PROG -f -c "pwrite -S 0x63 $((blksz + 17)) $((blksz * 3 - 34))" $testdir/file2 >> $seqres.full
+$XFS_IO_PROG -f -c "pwrite -S 0x63 $((blksz + 17)) $((blksz * 3 - 34))" $testdir/file2.chk >> $seqres.full
 _scratch_remount
 
 echo "Compare files"
-! cmp -s "$testdir/file1" "$testdir/file2" || _fail "file1 and file2 don't match."
-cmp -s "$testdir/file2" "$testdir/file2.chk" || _fail "file2 and file2.chk don't match."
+! cmp -s $testdir/file1 $testdir/file2 || _fail "file1 and file2 don't match."
+cmp -s $testdir/file2 $testdir/file2.chk || _fail "file2 and file2.chk don't match."
 
 # success, all done
 status=0
diff --git a/tests/generic/220 b/tests/generic/220
index 151bf76..edb8432 100755
--- a/tests/generic/220
+++ b/tests/generic/220
@@ -24,8 +24,8 @@
 # Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 #-----------------------------------------------------------------------
 
-seq=`basename "$0"`
-seqres="$RESULT_DIR/$seq"
+seq=`basename $0`
+seqres=$RESULT_DIR/$seq
 echo "QA output created by $seq"
 
 here=`pwd`
@@ -36,7 +36,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _cleanup()
 {
     cd /
-    rm -rf "$tmp".* "$testdir"
+    rm -rf $tmp.* $testdir
 }
 
 # get standard environment, filters and checks
@@ -49,44 +49,43 @@ _supported_os Linux
 _require_scratch_reflink
 _require_xfs_io_command "falloc"
 
-rm -f "$seqres.full"
+rm -f $seqres.full
 
 pagesz=$(getconf PAGE_SIZE)
 blksz=$((pagesz / 4))
 
 echo "Format and mount"
-_scratch_mkfs_blocksized $blksz > "$seqres.full" 2>&1
-_scratch_mount >> "$seqres.full" 2>&1
+_scratch_mkfs_blocksized $blksz > $seqres.full 2>&1
+_scratch_mount >> $seqres.full 2>&1
 
-testdir="$SCRATCH_MNT/test-$seq"
-rm -rf $testdir
+testdir=$SCRATCH_MNT/test-$seq
 mkdir $testdir
 
 real_blksz=$(stat -f -c '%S' $testdir)
-test "$real_blksz" != "$blksz" && _notrun "Failed to format with small blocksize."
+test $real_blksz != $blksz && _notrun "Failed to format with small blocksize."
 
 echo "Create the original files"
-_pwrite_byte 0x61 0 $pagesz "$testdir/file1" >> "$seqres.full"
+_pwrite_byte 0x61 0 $pagesz $testdir/file1 >> $seqres.full
 
-"$XFS_IO_PROG" -f -c "truncate $pagesz" "$testdir/file2" >> "$seqres.full"
-"$XFS_IO_PROG" -f -c "truncate $pagesz" "$testdir/file2.chk" >> "$seqres.full"
+$XFS_IO_PROG -f -c "truncate $pagesz" $testdir/file2 >> $seqres.full
+$XFS_IO_PROG -f -c "truncate $pagesz" $testdir/file2.chk >> $seqres.full
 
-_reflink_range "$testdir/file1" $blksz "$testdir/file2" $((blksz * 2)) $blksz >> "$seqres.full"
-_pwrite_byte 0x61 $((blksz * 2)) $blksz "$testdir/file2.chk" >> "$seqres.full"
+_reflink_range $testdir/file1 $blksz $testdir/file2 $((blksz * 2)) $blksz >> $seqres.full
+_pwrite_byte 0x61 $((blksz * 2)) $blksz $testdir/file2.chk >> $seqres.full
 _scratch_remount
 
 echo "Compare files"
-! cmp -s "$testdir/file1" "$testdir/file2" || _fail "file1 and file2 don't match."
-cmp -s "$testdir/file2" "$testdir/file2.chk" || _fail "file2 and file2.chk don't match."
+! cmp -s $testdir/file1 $testdir/file2 || _fail "file1 and file2 don't match."
+cmp -s $testdir/file2 $testdir/file2.chk || _fail "file2 and file2.chk don't match."
 
 echo "CoW and unmount"
-"$XFS_IO_PROG" -d -f -c "pwrite -S 0x63 $blksz $((blksz * 3))" "$testdir/file2" >> "$seqres.full"
-"$XFS_IO_PROG" -f -c "pwrite -S 0x63 $blksz $((blksz * 3))" "$testdir/file2.chk" >> "$seqres.full"
+$XFS_IO_PROG -d -f -c "pwrite -S 0x63 $blksz $((blksz * 3))" $testdir/file2 >> $seqres.full
+$XFS_IO_PROG -f -c "pwrite -S 0x63 $blksz $((blksz * 3))" $testdir/file2.chk >> $seqres.full
 _scratch_remount
 
 echo "Compare files"
-! cmp -s "$testdir/file1" "$testdir/file2" || _fail "file1 and file2 don't match."
-cmp -s "$testdir/file2" "$testdir/file2.chk" || _fail "file2 and file2.chk don't match."
+! cmp -s $testdir/file1 $testdir/file2 || _fail "file1 and file2 don't match."
+cmp -s $testdir/file2 $testdir/file2.chk || _fail "file2 and file2.chk don't match."
 
 # success, all done
 status=0
diff --git a/tests/generic/222 b/tests/generic/222
index c95a1d6..58ca8f5 100755
--- a/tests/generic/222
+++ b/tests/generic/222
@@ -24,8 +24,8 @@
 # Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 #-----------------------------------------------------------------------
 
-seq=`basename "$0"`
-seqres="$RESULT_DIR/$seq"
+seq=`basename $0`
+seqres=$RESULT_DIR/$seq
 echo "QA output created by $seq"
 
 here=`pwd`
@@ -36,7 +36,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _cleanup()
 {
     cd /
-    rm -rf "$tmp".* "$testdir"
+    rm -rf $tmp.* $testdir
 }
 
 # get standard environment, filters and checks
@@ -49,50 +49,49 @@ _supported_os Linux
 _require_scratch_reflink
 _require_xfs_io_command "falloc"
 
-rm -f "$seqres.full"
+rm -f $seqres.full
 
 pagesz=$(getconf PAGE_SIZE)
 blksz=$((pagesz / 4))
 
 echo "Format and mount"
-_scratch_mkfs_blocksized $blksz > "$seqres.full" 2>&1
-_scratch_mount >> "$seqres.full" 2>&1
+_scratch_mkfs_blocksized $blksz > $seqres.full 2>&1
+_scratch_mount >> $seqres.full 2>&1
 
-testdir="$SCRATCH_MNT/test-$seq"
-rm -rf $testdir
+testdir=$SCRATCH_MNT/test-$seq
 mkdir $testdir
 
 real_blksz=$(stat -f -c '%S' $testdir)
-test "$real_blksz" != "$blksz" && _notrun "Failed to format with small blocksize."
+test $real_blksz != $blksz && _notrun "Failed to format with small blocksize."
 
 echo "Create the original files"
-_pwrite_byte 0x61 0 $pagesz "$testdir/file1" >> "$seqres.full"
+_pwrite_byte 0x61 0 $pagesz $testdir/file1 >> $seqres.full
 
-"$XFS_IO_PROG" -f -c "truncate $pagesz" "$testdir/file2" >> "$seqres.full"
-"$XFS_IO_PROG" -f -c "truncate $pagesz" "$testdir/file2.chk" >> "$seqres.full"
+$XFS_IO_PROG -f -c "truncate $pagesz" $testdir/file2 >> $seqres.full
+$XFS_IO_PROG -f -c "truncate $pagesz" $testdir/file2.chk >> $seqres.full
 
-_reflink_range "$testdir/file1" $blksz "$testdir/file2" $((blksz * 2)) $blksz >> "$seqres.full"
-_pwrite_byte 0x61 $((blksz * 2)) $blksz "$testdir/file2.chk" >> "$seqres.full"
+_reflink_range $testdir/file1 $blksz $testdir/file2 $((blksz * 2)) $blksz >> $seqres.full
+_pwrite_byte 0x61 $((blksz * 2)) $blksz $testdir/file2.chk >> $seqres.full
 _scratch_remount
 
 echo "Compare files"
-! cmp -s "$testdir/file1" "$testdir/file2" || _fail "file1 and file2 don't match."
-cmp -s "$testdir/file2" "$testdir/file2.chk" || _fail "file2 and file2.chk don't match."
+! cmp -s $testdir/file1 $testdir/file2 || _fail "file1 and file2 don't match."
+cmp -s $testdir/file2 $testdir/file2.chk || _fail "file2 and file2.chk don't match."
 
 echo "CoW and unmount"
-_pwrite_byte 0x61 $blksz $blksz "$testdir/file2" >> "$seqres.full"
-_pwrite_byte 0x61 $blksz $blksz "$testdir/file2.chk" >> "$seqres.full"
+_pwrite_byte 0x61 $blksz $blksz $testdir/file2 >> $seqres.full
+_pwrite_byte 0x61 $blksz $blksz $testdir/file2.chk >> $seqres.full
 
-_pwrite_byte 0x61 $((blksz * 3)) $blksz "$testdir/file2" >> "$seqres.full"
-_pwrite_byte 0x61 $((blksz * 3)) $blksz "$testdir/file2.chk" >> "$seqres.full"
+_pwrite_byte 0x61 $((blksz * 3)) $blksz $testdir/file2 >> $seqres.full
+_pwrite_byte 0x61 $((blksz * 3)) $blksz $testdir/file2.chk >> $seqres.full
 
-"$XFS_IO_PROG" -f -c "pwrite -S 0x63 $((blksz + 17)) $((blksz * 3 - 34))" "$testdir/file2" >> "$seqres.full"
-"$XFS_IO_PROG" -f -c "pwrite -S 0x63 $((blksz + 17)) $((blksz * 3 - 34))" "$testdir/file2.chk" >> "$seqres.full"
+$XFS_IO_PROG -f -c "pwrite -S 0x63 $((blksz + 17)) $((blksz * 3 - 34))" $testdir/file2 >> $seqres.full
+$XFS_IO_PROG -f -c "pwrite -S 0x63 $((blksz + 17)) $((blksz * 3 - 34))" $testdir/file2.chk >> $seqres.full
 _scratch_remount
 
 echo "Compare files"
-! cmp -s "$testdir/file1" "$testdir/file2" || _fail "file1 and file2 don't match."
-cmp -s "$testdir/file2" "$testdir/file2.chk" || _fail "file2 and file2.chk don't match."
+! cmp -s $testdir/file1 $testdir/file2 || _fail "file1 and file2 don't match."
+cmp -s $testdir/file2 $testdir/file2.chk || _fail "file2 and file2.chk don't match."
 
 # success, all done
 status=0
diff --git a/tests/generic/227 b/tests/generic/227
index d62ab52..abaf8f7 100755
--- a/tests/generic/227
+++ b/tests/generic/227
@@ -24,8 +24,8 @@
 # Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 #-----------------------------------------------------------------------
 
-seq=`basename "$0"`
-seqres="$RESULT_DIR/$seq"
+seq=`basename $0`
+seqres=$RESULT_DIR/$seq
 echo "QA output created by $seq"
 
 here=`pwd`
@@ -36,7 +36,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _cleanup()
 {
     cd /
-    rm -rf "$tmp".* "$testdir"
+    rm -rf $tmp.* $testdir
 }
 
 # get standard environment, filters and checks
@@ -49,50 +49,49 @@ _supported_os Linux
 _require_scratch_reflink
 _require_xfs_io_command "falloc"
 
-rm -f "$seqres.full"
+rm -f $seqres.full
 
 pagesz=$(getconf PAGE_SIZE)
 blksz=$((pagesz / 4))
 
 echo "Format and mount"
-_scratch_mkfs_blocksized $blksz > "$seqres.full" 2>&1
-_scratch_mount >> "$seqres.full" 2>&1
+_scratch_mkfs_blocksized $blksz > $seqres.full 2>&1
+_scratch_mount >> $seqres.full 2>&1
 
-testdir="$SCRATCH_MNT/test-$seq"
-rm -rf $testdir
+testdir=$SCRATCH_MNT/test-$seq
 mkdir $testdir
 
 real_blksz=$(stat -f -c '%S' $testdir)
-test "$real_blksz" != "$blksz" && _notrun "Failed to format with small blocksize."
+test $real_blksz != $blksz && _notrun "Failed to format with small blocksize."
 
 echo "Create the original files"
-_pwrite_byte 0x61 0 $pagesz "$testdir/file1" >> "$seqres.full"
+_pwrite_byte 0x61 0 $pagesz $testdir/file1 >> $seqres.full
 
-"$XFS_IO_PROG" -f -c "truncate $pagesz" "$testdir/file2" >> "$seqres.full"
-"$XFS_IO_PROG" -f -c "truncate $pagesz" "$testdir/file2.chk" >> "$seqres.full"
+$XFS_IO_PROG -f -c "truncate $pagesz" $testdir/file2 >> $seqres.full
+$XFS_IO_PROG -f -c "truncate $pagesz" $testdir/file2.chk >> $seqres.full
 
-_reflink_range "$testdir/file1" $blksz "$testdir/file2" $((blksz * 2)) $blksz >> "$seqres.full"
-_pwrite_byte 0x61 $((blksz * 2)) $blksz "$testdir/file2.chk" >> "$seqres.full"
+_reflink_range $testdir/file1 $blksz $testdir/file2 $((blksz * 2)) $blksz >> $seqres.full
+_pwrite_byte 0x61 $((blksz * 2)) $blksz $testdir/file2.chk >> $seqres.full
 _scratch_remount
 
 echo "Compare files"
-! cmp -s "$testdir/file1" "$testdir/file2" || _fail "file1 and file2 don't match."
-cmp -s "$testdir/file2" "$testdir/file2.chk" || _fail "file2 and file2.chk don't match."
+! cmp -s $testdir/file1 $testdir/file2 || _fail "file1 and file2 don't match."
+cmp -s $testdir/file2 $testdir/file2.chk || _fail "file2 and file2.chk don't match."
 
 echo "CoW and unmount"
-_pwrite_byte 0x61 $blksz $blksz "$testdir/file2" >> "$seqres.full"
-_pwrite_byte 0x61 $blksz $blksz "$testdir/file2.chk" >> "$seqres.full"
+_pwrite_byte 0x61 $blksz $blksz $testdir/file2 >> $seqres.full
+_pwrite_byte 0x61 $blksz $blksz $testdir/file2.chk >> $seqres.full
 
-_pwrite_byte 0x61 $((blksz * 3)) $blksz "$testdir/file2" >> "$seqres.full"
-_pwrite_byte 0x61 $((blksz * 3)) $blksz "$testdir/file2.chk" >> "$seqres.full"
+_pwrite_byte 0x61 $((blksz * 3)) $blksz $testdir/file2 >> $seqres.full
+_pwrite_byte 0x61 $((blksz * 3)) $blksz $testdir/file2.chk >> $seqres.full
 
-"$XFS_IO_PROG" -d -f -c "pwrite -S 0x63 $blksz $((blksz * 3))" "$testdir/file2" >> "$seqres.full"
-"$XFS_IO_PROG" -f -c "pwrite -S 0x63 $blksz $((blksz * 3))" "$testdir/file2.chk" >> "$seqres.full"
+$XFS_IO_PROG -d -f -c "pwrite -S 0x63 $blksz $((blksz * 3))" $testdir/file2 >> $seqres.full
+$XFS_IO_PROG -f -c "pwrite -S 0x63 $blksz $((blksz * 3))" $testdir/file2.chk >> $seqres.full
 _scratch_remount
 
 echo "Compare files"
-! cmp -s "$testdir/file1" "$testdir/file2" || _fail "file1 and file2 don't match."
-cmp -s "$testdir/file2" "$testdir/file2.chk" || _fail "file2 and file2.chk don't match."
+! cmp -s $testdir/file1 $testdir/file2 || _fail "file1 and file2 don't match."
+cmp -s $testdir/file2 $testdir/file2.chk || _fail "file2 and file2.chk don't match."
 
 # success, all done
 status=0
diff --git a/tests/generic/229 b/tests/generic/229
index cc86b4e..b6359e8 100755
--- a/tests/generic/229
+++ b/tests/generic/229
@@ -24,8 +24,8 @@
 # Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 #-----------------------------------------------------------------------
 
-seq=`basename "$0"`
-seqres="$RESULT_DIR/$seq"
+seq=`basename $0`
+seqres=$RESULT_DIR/$seq
 echo "QA output created by $seq"
 
 here=`pwd`
@@ -36,7 +36,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _cleanup()
 {
     cd /
-    rm -rf "$tmp".* "$testdir"
+    rm -rf $tmp.* $testdir
 }
 
 # get standard environment, filters and checks
@@ -49,21 +49,20 @@ _supported_os Linux
 _require_scratch_reflink
 _require_xfs_io_command "falloc"
 
-rm -f "$seqres.full"
+rm -f $seqres.full
 
 pagesz=$(getconf PAGE_SIZE)
 blksz=$((pagesz / 4))
 
 echo "Format and mount"
-_scratch_mkfs_blocksized $blksz > "$seqres.full" 2>&1
-_scratch_mount >> "$seqres.full" 2>&1
+_scratch_mkfs_blocksized $blksz > $seqres.full 2>&1
+_scratch_mount >> $seqres.full 2>&1
 
-testdir="$SCRATCH_MNT/test-$seq"
-rm -rf $testdir
+testdir=$SCRATCH_MNT/test-$seq
 mkdir $testdir
 
 real_blksz=$(stat -f -c '%S' $testdir)
-test "$real_blksz" != "$blksz" && _notrun "Failed to format with small blocksize."
+test $real_blksz != $blksz && _notrun "Failed to format with small blocksize."
 
 runtest() {
 	echo "runtest $1 $2"
@@ -72,20 +71,20 @@ runtest() {
 	dir=$3
 
 	echo "Create the original files"
-	mkdir -p "$dir"
-	_pwrite_byte 0x61 0 $pagesz "$dir/file1" >> "$seqres.full"
+	mkdir -p $dir
+	_pwrite_byte 0x61 0 $pagesz $dir/file1 >> $seqres.full
 
-	"$XFS_IO_PROG" -f -c "truncate $pagesz" "$dir/file2" >> "$seqres.full"
-	"$XFS_IO_PROG" -f -c "truncate $pagesz" "$dir/file2.chk" >> "$seqres.full"
+	$XFS_IO_PROG -f -c "truncate $pagesz" $dir/file2 >> $seqres.full
+	$XFS_IO_PROG -f -c "truncate $pagesz" $dir/file2.chk >> $seqres.full
 
-	case "$b2" in
+	case $b2 in
 	"regular")
-		_pwrite_byte 0x61 $blksz $blksz "$dir/file2" >> "$seqres.full"
-		_pwrite_byte 0x61 $blksz $blksz "$dir/file2.chk" >> "$seqres.full"
+		_pwrite_byte 0x61 $blksz $blksz $dir/file2 >> $seqres.full
+		_pwrite_byte 0x61 $blksz $blksz $dir/file2.chk >> $seqres.full
 		;;
 	"unwritten")
-		"$XFS_IO_PROG" -f -c "falloc -k $blksz $blksz" "$dir/file2" >> "$seqres.full"
-		_pwrite_byte 0x00 $blksz $blksz "$dir/file2.chk" >> "$seqres.full"
+		$XFS_IO_PROG -f -c "falloc -k $blksz $blksz" $dir/file2 >> $seqres.full
+		_pwrite_byte 0x00 $blksz $blksz $dir/file2.chk >> $seqres.full
 		;;
 	"hole")
 		;;
@@ -93,45 +92,45 @@ runtest() {
 
 
 
-	case "$b4" in
+	case $b4 in
 	"regular")
-		_pwrite_byte 0x61 $((blksz * 3)) $blksz "$dir/file2" >> "$seqres.full"
-		_pwrite_byte 0x61 $((blksz * 3)) $blksz "$dir/file2.chk" >> "$seqres.full"
+		_pwrite_byte 0x61 $((blksz * 3)) $blksz $dir/file2 >> $seqres.full
+		_pwrite_byte 0x61 $((blksz * 3)) $blksz $dir/file2.chk >> $seqres.full
 		;;
 	"unwritten")
-		"$XFS_IO_PROG" -f -c "falloc -k $((blksz * 3)) $blksz" "$dir/file2" >> "$seqres.full"
-		_pwrite_byte 0x00 $((blksz * 3)) $blksz "$dir/file2.chk" >> "$seqres.full"
+		$XFS_IO_PROG -f -c "falloc -k $((blksz * 3)) $blksz" $dir/file2 >> $seqres.full
+		_pwrite_byte 0x00 $((blksz * 3)) $blksz $dir/file2.chk >> $seqres.full
 		;;
 	"hole")
 		;;
 	esac
 
-	_reflink_range "$dir/file1" $blksz "$dir/file2" $((blksz * 2)) $blksz >> "$seqres.full"
-	_pwrite_byte 0x61 $((blksz * 2)) $blksz "$dir/file2.chk" >> "$seqres.full"
+	_reflink_range $dir/file1 $blksz $dir/file2 $((blksz * 2)) $blksz >> $seqres.full
+	_pwrite_byte 0x61 $((blksz * 2)) $blksz $dir/file2.chk >> $seqres.full
 	_scratch_remount
 
 	echo "Compare files"
-	! cmp -s "$dir/file1" "$dir/file2" || _fail "file1 and file2 don't match."
-	cmp -s "$dir/file2" "$dir/file2.chk" || _fail "file2 and file2.chk don't match."
+	! cmp -s $dir/file1 $dir/file2 || _fail "file1 and file2 don't match."
+	cmp -s $dir/file2 $dir/file2.chk || _fail "file2 and file2.chk don't match."
 
 	echo "CoW and unmount"
-	if [ "$b2" = "delalloc" ]; then
-		_pwrite_byte 0x61 $blksz $blksz "$dir/file2" >> "$seqres.full"
-		_pwrite_byte 0x61 $blksz $blksz "$dir/file2.chk" >> "$seqres.full"
+	if [ $b2 = "delalloc" ]; then
+		_pwrite_byte 0x61 $blksz $blksz $dir/file2 >> $seqres.full
+		_pwrite_byte 0x61 $blksz $blksz $dir/file2.chk >> $seqres.full
 	fi
 
-	if [ "$b4" = "delalloc" ]; then
-		_pwrite_byte 0x61 $((blksz * 3)) $blksz "$dir/file2" >> "$seqres.full"
-		_pwrite_byte 0x61 $((blksz * 3)) $blksz "$dir/file2.chk" >> "$seqres.full"
+	if [ $b4 = "delalloc" ]; then
+		_pwrite_byte 0x61 $((blksz * 3)) $blksz $dir/file2 >> $seqres.full
+		_pwrite_byte 0x61 $((blksz * 3)) $blksz $dir/file2.chk >> $seqres.full
 	fi
 
-	"$XFS_IO_PROG" -f -c "pwrite -S 0x63 $((blksz + 17)) $((blksz * 3 - 34))" "$dir/file2" >> "$seqres.full"
-	"$XFS_IO_PROG" -f -c "pwrite -S 0x63 $((blksz + 17)) $((blksz * 3 - 34))" "$dir/file2.chk" >> "$seqres.full"
+	$XFS_IO_PROG -f -c "pwrite -S 0x63 $((blksz + 17)) $((blksz * 3 - 34))" $dir/file2 >> $seqres.full
+	$XFS_IO_PROG -f -c "pwrite -S 0x63 $((blksz + 17)) $((blksz * 3 - 34))" $dir/file2.chk >> $seqres.full
 	_scratch_remount
 
 	echo "Compare files"
-	! cmp -s "$dir/file1" "$dir/file2" || _fail "file1 and file2 don't match."
-	cmp -s "$dir/file2" "$dir/file2.chk" || _fail "file2 and file2.chk don't match."
+	! cmp -s $dir/file1 $dir/file2 || _fail "file1 and file2 don't match."
+	cmp -s $dir/file2 $dir/file2.chk || _fail "file2 and file2.chk don't match."
 }
 
 runtest regular delalloc "$testdir/r-d"
diff --git a/tests/generic/238 b/tests/generic/238
index c726770..ce7408c 100755
--- a/tests/generic/238
+++ b/tests/generic/238
@@ -24,8 +24,8 @@
 # Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 #-----------------------------------------------------------------------
 
-seq=`basename "$0"`
-seqres="$RESULT_DIR/$seq"
+seq=`basename $0`
+seqres=$RESULT_DIR/$seq
 echo "QA output created by $seq"
 
 here=`pwd`
@@ -36,7 +36,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _cleanup()
 {
     cd /
-    rm -rf "$tmp".* "$testdir"
+    rm -rf $tmp.* $testdir
 }
 
 # get standard environment, filters and checks
@@ -49,21 +49,20 @@ _supported_os Linux
 _require_scratch_reflink
 _require_xfs_io_command "falloc"
 
-rm -f "$seqres.full"
+rm -f $seqres.full
 
 pagesz=$(getconf PAGE_SIZE)
 blksz=$((pagesz / 4))
 
 echo "Format and mount"
-_scratch_mkfs_blocksized $blksz > "$seqres.full" 2>&1
-_scratch_mount >> "$seqres.full" 2>&1
+_scratch_mkfs_blocksized $blksz > $seqres.full 2>&1
+_scratch_mount >> $seqres.full 2>&1
 
-testdir="$SCRATCH_MNT/test-$seq"
-rm -rf $testdir
+testdir=$SCRATCH_MNT/test-$seq
 mkdir $testdir
 
 real_blksz=$(stat -f -c '%S' $testdir)
-test "$real_blksz" != "$blksz" && _notrun "Failed to format with small blocksize."
+test $real_blksz != $blksz && _notrun "Failed to format with small blocksize."
 
 runtest() {
 	echo "runtest $1 $2"
@@ -72,20 +71,20 @@ runtest() {
 	dir=$3
 
 	echo "Create the original files"
-	mkdir -p "$dir"
-	_pwrite_byte 0x61 0 $pagesz "$dir/file1" >> "$seqres.full"
+	mkdir -p $dir
+	_pwrite_byte 0x61 0 $pagesz $dir/file1 >> $seqres.full
 
-	"$XFS_IO_PROG" -f -c "truncate $pagesz" "$dir/file2" >> "$seqres.full"
-	"$XFS_IO_PROG" -f -c "truncate $pagesz" "$dir/file2.chk" >> "$seqres.full"
+	$XFS_IO_PROG -f -c "truncate $pagesz" $dir/file2 >> $seqres.full
+	$XFS_IO_PROG -f -c "truncate $pagesz" $dir/file2.chk >> $seqres.full
 
-	case "$b2" in
+	case $b2 in
 	"regular")
-		_pwrite_byte 0x61 $blksz $blksz "$dir/file2" >> "$seqres.full"
-		_pwrite_byte 0x61 $blksz $blksz "$dir/file2.chk" >> "$seqres.full"
+		_pwrite_byte 0x61 $blksz $blksz $dir/file2 >> $seqres.full
+		_pwrite_byte 0x61 $blksz $blksz $dir/file2.chk >> $seqres.full
 		;;
 	"unwritten")
-		"$XFS_IO_PROG" -f -c "falloc -k $blksz $blksz" "$dir/file2" >> "$seqres.full"
-		_pwrite_byte 0x00 $blksz $blksz "$dir/file2.chk" >> "$seqres.full"
+		$XFS_IO_PROG -f -c "falloc -k $blksz $blksz" $dir/file2 >> $seqres.full
+		_pwrite_byte 0x00 $blksz $blksz $dir/file2.chk >> $seqres.full
 		;;
 	"hole")
 		;;
@@ -93,45 +92,45 @@ runtest() {
 
 
 
-	case "$b4" in
+	case $b4 in
 	"regular")
-		_pwrite_byte 0x61 $((blksz * 3)) $blksz "$dir/file2" >> "$seqres.full"
-		_pwrite_byte 0x61 $((blksz * 3)) $blksz "$dir/file2.chk" >> "$seqres.full"
+		_pwrite_byte 0x61 $((blksz * 3)) $blksz $dir/file2 >> $seqres.full
+		_pwrite_byte 0x61 $((blksz * 3)) $blksz $dir/file2.chk >> $seqres.full
 		;;
 	"unwritten")
-		"$XFS_IO_PROG" -f -c "falloc -k $((blksz * 3)) $blksz" "$dir/file2" >> "$seqres.full"
-		_pwrite_byte 0x00 $((blksz * 3)) $blksz "$dir/file2.chk" >> "$seqres.full"
+		$XFS_IO_PROG -f -c "falloc -k $((blksz * 3)) $blksz" $dir/file2 >> $seqres.full
+		_pwrite_byte 0x00 $((blksz * 3)) $blksz $dir/file2.chk >> $seqres.full
 		;;
 	"hole")
 		;;
 	esac
 
-	_reflink_range "$dir/file1" $blksz "$dir/file2" $((blksz * 2)) $blksz >> "$seqres.full"
-	_pwrite_byte 0x61 $((blksz * 2)) $blksz "$dir/file2.chk" >> "$seqres.full"
+	_reflink_range $dir/file1 $blksz $dir/file2 $((blksz * 2)) $blksz >> $seqres.full
+	_pwrite_byte 0x61 $((blksz * 2)) $blksz $dir/file2.chk >> $seqres.full
 	_scratch_remount
 
 	echo "Compare files"
-	! cmp -s "$dir/file1" "$dir/file2" || _fail "file1 and file2 don't match."
-	cmp -s "$dir/file2" "$dir/file2.chk" || _fail "file2 and file2.chk don't match."
+	! cmp -s $dir/file1 $dir/file2 || _fail "file1 and file2 don't match."
+	cmp -s $dir/file2 $dir/file2.chk || _fail "file2 and file2.chk don't match."
 
 	echo "CoW and unmount"
-	if [ "$b2" = "delalloc" ]; then
-		_pwrite_byte 0x61 $blksz $blksz "$dir/file2" >> "$seqres.full"
-		_pwrite_byte 0x61 $blksz $blksz "$dir/file2.chk" >> "$seqres.full"
+	if [ $b2 = "delalloc" ]; then
+		_pwrite_byte 0x61 $blksz $blksz $dir/file2 >> $seqres.full
+		_pwrite_byte 0x61 $blksz $blksz $dir/file2.chk >> $seqres.full
 	fi
 
-	if [ "$b4" = "delalloc" ]; then
-		_pwrite_byte 0x61 $((blksz * 3)) $blksz "$dir/file2" >> "$seqres.full"
-		_pwrite_byte 0x61 $((blksz * 3)) $blksz "$dir/file2.chk" >> "$seqres.full"
+	if [ $b4 = "delalloc" ]; then
+		_pwrite_byte 0x61 $((blksz * 3)) $blksz $dir/file2 >> $seqres.full
+		_pwrite_byte 0x61 $((blksz * 3)) $blksz $dir/file2.chk >> $seqres.full
 	fi
 
-	"$XFS_IO_PROG" -d -f -c "pwrite -S 0x63 $blksz $((blksz * 3))" "$dir/file2" >> "$seqres.full"
-	"$XFS_IO_PROG" -f -c "pwrite -S 0x63 $blksz $((blksz * 3))" "$dir/file2.chk" >> "$seqres.full"
+	$XFS_IO_PROG -d -f -c "pwrite -S 0x63 $blksz $((blksz * 3))" $dir/file2 >> $seqres.full
+	$XFS_IO_PROG -f -c "pwrite -S 0x63 $blksz $((blksz * 3))" $dir/file2.chk >> $seqres.full
 	_scratch_remount
 
 	echo "Compare files"
-	! cmp -s "$dir/file1" "$dir/file2" || _fail "file1 and file2 don't match."
-	cmp -s "$dir/file2" "$dir/file2.chk" || _fail "file2 and file2.chk don't match."
+	! cmp -s $dir/file1 $dir/file2 || _fail "file1 and file2 don't match."
+	cmp -s $dir/file2 $dir/file2.chk || _fail "file2 and file2.chk don't match."
 }
 
 runtest regular delalloc "$testdir/r-d"
diff --git a/tests/generic/242 b/tests/generic/242
index 1141aa4..1f174df 100755
--- a/tests/generic/242
+++ b/tests/generic/242
@@ -23,8 +23,8 @@
 # Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 #-----------------------------------------------------------------------
 
-seq=`basename "$0"`
-seqres="$RESULT_DIR/$seq"
+seq=`basename $0`
+seqres=$RESULT_DIR/$seq
 echo "QA output created by $seq"
 
 here=`pwd`
@@ -35,7 +35,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _cleanup()
 {
     cd /
-    rm -rf "$tmp".* "$testdir"
+    rm -rf $tmp.* $testdir
 }
 
 # get standard environment, filters and checks
@@ -48,47 +48,48 @@ _supported_os Linux
 _require_scratch_reflink
 _require_cp_reflink
 
-rm -f "$seqres.full"
+rm -f $seqres.full
 
 
 echo "Format and mount"
-_scratch_mkfs > "$seqres.full" 2>&1
-_scratch_mount >> "$seqres.full" 2>&1
+_scratch_mkfs > $seqres.full 2>&1
+_scratch_mount >> $seqres.full 2>&1
 
-testdir="$SCRATCH_MNT/test-$seq"
-rm -rf $testdir
+testdir=$SCRATCH_MNT/test-$seq
 mkdir $testdir
 
 blksz=65536
 nr=6400
-bsz=1280
+filesize=$((blksz * nr))
+bufnr=1280
+bufsize=$((blksz * bufnr))
 
-free_blocks=$(stat -f -c '%a' "$testdir")
-real_blksz=$(stat -f -c '%S' "$testdir")
-space_needed=$(((blksz * nr * 3) * 5 / 4))
+free_blocks=$(stat -f -c '%a' $testdir)
+real_blksz=$(stat -f -c '%S' $testdir)
+space_needed=$(((filesize * 3) * 5 / 4))
 space_avail=$((free_blocks * real_blksz))
 test $space_needed -gt $space_avail && _notrun "Not enough space. $space_avail < $space_needed"
 
 echo "Create the original files"
-"$XFS_IO_PROG" -f -c "pwrite -S 0x61 -b $((blksz * bsz)) 0 $((blksz * nr))" "$testdir/file1" >> "$seqres.full"
-_cp_reflink "$testdir/file1" "$testdir/file2" >> "$seqres.full"
-"$XFS_IO_PROG" -f -c "pwrite -S 0x61 -b $((blksz * bsz)) 0 $((blksz * nr))" "$testdir/file2.chk" >> "$seqres.full"
+$XFS_IO_PROG -f -c "pwrite -S 0x61 -b $bufsize 0 $filesize" $testdir/file1 >> $seqres.full
+_cp_reflink $testdir/file1 $testdir/file2 >> $seqres.full
+$XFS_IO_PROG -f -c "pwrite -S 0x61 -b $bufsize 0 $filesize" $testdir/file2.chk >> $seqres.full
 _scratch_remount
 
 echo "Compare files"
-md5sum "$testdir/file1" | _filter_scratch
-md5sum "$testdir/file2" | _filter_scratch
-md5sum "$testdir/file2.chk" | _filter_scratch
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file2 | _filter_scratch
+md5sum $testdir/file2.chk | _filter_scratch
 
 echo "CoW and unmount"
-"$XFS_IO_PROG" -f -c "pwrite -S 0x63 -b $((blksz * bsz)) 0 $((blksz * nr))" "$testdir/file2" >> "$seqres.full"
-"$XFS_IO_PROG" -f -c "pwrite -S 0x63 -b $((blksz * bsz)) 0 $((blksz * nr))" "$testdir/file2.chk" >> "$seqres.full"
+$XFS_IO_PROG -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" $testdir/file2 >> $seqres.full
+$XFS_IO_PROG -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" $testdir/file2.chk >> $seqres.full
 _scratch_remount
 
 echo "Compare files"
-md5sum "$testdir/file1" | _filter_scratch
-md5sum "$testdir/file2" | _filter_scratch
-md5sum "$testdir/file2.chk" | _filter_scratch
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file2 | _filter_scratch
+md5sum $testdir/file2.chk | _filter_scratch
 
 # success, all done
 status=0
diff --git a/tests/generic/243 b/tests/generic/243
index a514591..127070e 100755
--- a/tests/generic/243
+++ b/tests/generic/243
@@ -23,8 +23,8 @@
 # Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 #-----------------------------------------------------------------------
 
-seq=`basename "$0"`
-seqres="$RESULT_DIR/$seq"
+seq=`basename $0`
+seqres=$RESULT_DIR/$seq
 echo "QA output created by $seq"
 
 here=`pwd`
@@ -35,7 +35,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _cleanup()
 {
     cd /
-    rm -rf "$tmp".* "$testdir"
+    rm -rf $tmp.* $testdir
 }
 
 # get standard environment, filters and checks
@@ -48,47 +48,48 @@ _supported_os Linux
 _require_scratch_reflink
 _require_cp_reflink
 
-rm -f "$seqres.full"
+rm -f $seqres.full
 
 
 echo "Format and mount"
-_scratch_mkfs > "$seqres.full" 2>&1
-_scratch_mount >> "$seqres.full" 2>&1
+_scratch_mkfs > $seqres.full 2>&1
+_scratch_mount >> $seqres.full 2>&1
 
-testdir="$SCRATCH_MNT/test-$seq"
-rm -rf $testdir
+testdir=$SCRATCH_MNT/test-$seq
 mkdir $testdir
 
 blksz=65536
 nr=6400
-bsz=1280
+filesize=$((blksz * nr))
+bufnr=1280
+bufsize=$((blksz * bufnr))
 
-free_blocks=$(stat -f -c '%a' "$testdir")
-real_blksz=$(stat -f -c '%S' "$testdir")
-space_needed=$(((blksz * nr * 3) * 5 / 4))
+free_blocks=$(stat -f -c '%a' $testdir)
+real_blksz=$(stat -f -c '%S' $testdir)
+space_needed=$(((filesize * 3) * 5 / 4))
 space_avail=$((free_blocks * real_blksz))
 test $space_needed -gt $space_avail && _notrun "Not enough space. $space_avail < $space_needed"
 
 echo "Create the original files"
-"$XFS_IO_PROG" -f -c "pwrite -S 0x61 -b $((blksz * bsz)) 0 $((blksz * nr))" "$testdir/file1" >> "$seqres.full"
-_cp_reflink "$testdir/file1" "$testdir/file2" >> "$seqres.full"
-"$XFS_IO_PROG" -f -c "pwrite -S 0x61 -b $((blksz * bsz)) 0 $((blksz * nr))" "$testdir/file2.chk" >> "$seqres.full"
+$XFS_IO_PROG -f -c "pwrite -S 0x61 -b $bufsize 0 $filesize" $testdir/file1 >> $seqres.full
+_cp_reflink $testdir/file1 $testdir/file2 >> $seqres.full
+$XFS_IO_PROG -f -c "pwrite -S 0x61 -b $bufsize 0 $filesize" $testdir/file2.chk >> $seqres.full
 _scratch_remount
 
 echo "Compare files"
-md5sum "$testdir/file1" | _filter_scratch
-md5sum "$testdir/file2" | _filter_scratch
-md5sum "$testdir/file2.chk" | _filter_scratch
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file2 | _filter_scratch
+md5sum $testdir/file2.chk | _filter_scratch
 
 echo "CoW and unmount"
-"$XFS_IO_PROG" -d -f -c "pwrite -S 0x63 -b $((blksz * bsz)) 0 $((blksz * nr))" "$testdir/file2" >> "$seqres.full"
-"$XFS_IO_PROG" -f -c "pwrite -S 0x63 -b $((blksz * bsz)) 0 $((blksz * nr))" "$testdir/file2.chk" >> "$seqres.full"
+$XFS_IO_PROG -d -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" $testdir/file2 >> $seqres.full
+$XFS_IO_PROG -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" $testdir/file2.chk >> $seqres.full
 _scratch_remount
 
 echo "Compare files"
-md5sum "$testdir/file1" | _filter_scratch
-md5sum "$testdir/file2" | _filter_scratch
-md5sum "$testdir/file2.chk" | _filter_scratch
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file2 | _filter_scratch
+md5sum $testdir/file2.chk | _filter_scratch
 
 # success, all done
 status=0
diff --git a/tests/xfs/127 b/tests/xfs/127
index 392e63c..67a8c96 100755
--- a/tests/xfs/127
+++ b/tests/xfs/127
@@ -21,8 +21,8 @@
 #-----------------------------------------------------------------------
 #
 
-seq=`basename "$0"`
-seqres="$RESULT_DIR/$seq"
+seq=`basename $0`
+seqres=$RESULT_DIR/$seq
 echo "QA output created by $seq"
 
 here=`pwd`
@@ -33,7 +33,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _cleanup()
 {
     cd /
-    rm -f "$tmp".*
+    rm -f $tmp.*
 }
 
 # get standard environment, filters and checks
@@ -48,27 +48,26 @@ _require_scratch_reflink
 _require_cp_reflink
 
 echo "Format and mount"
-_scratch_mkfs -d size=$((2 * 4096 * 4096)) -l size=4194304 > "$seqres.full" 2>&1
-_scratch_mount >> "$seqres.full" 2>&1
+_scratch_mkfs -d size=$((2 * 4096 * 4096)) -l size=4194304 > $seqres.full 2>&1
+_scratch_mount >> $seqres.full 2>&1
 
-testdir="$SCRATCH_MNT/test-$seq"
-rm -rf "$testdir"
-mkdir "$testdir"
+testdir=$SCRATCH_MNT/test-$seq
+mkdir $testdir
 
 echo "Create the original file and reflink to copy1, copy2"
-blksz="$(stat -f "$testdir" -c '%S')"
-_pwrite_byte 0x61 0 $((blksz * 14 + 71)) "$testdir/original" >> "$seqres.full"
-_cp_reflink "$testdir/original" "$testdir/copy1"
-_cp_reflink "$testdir/copy1" "$testdir/copy2"
+blksz="$(stat -f $testdir -c '%S')"
+_pwrite_byte 0x61 0 $((blksz * 14 + 71)) $testdir/original >> $seqres.full
+_cp_reflink $testdir/original $testdir/copy1
+_cp_reflink $testdir/copy1 $testdir/copy2
 
 echo "Grow fs"
-"$XFS_GROWFS_PROG" "$SCRATCH_MNT" 2>&1 |  _filter_growfs >> "$seqres.full"
+$XFS_GROWFS_PROG $SCRATCH_MNT 2>&1 |  _filter_growfs >> $seqres.full
 _scratch_remount
 
 echo "Create more reflink copies"
-_cp_reflink "$testdir/original" "$testdir/copy3"
+_cp_reflink $testdir/original $testdir/copy3
 
-xfs_info "$SCRATCH_MNT" >> "$seqres.full"
+xfs_info $SCRATCH_MNT >> $seqres.full
 
 # success, all done
 status=0
diff --git a/tests/xfs/128 b/tests/xfs/128
index f230adf..56778fc 100755
--- a/tests/xfs/128
+++ b/tests/xfs/128
@@ -21,8 +21,8 @@
 #-----------------------------------------------------------------------
 #
 
-seq=`basename "$0"`
-seqres="$RESULT_DIR/$seq"
+seq=`basename $0`
+seqres=$RESULT_DIR/$seq
 echo "QA output created by $seq"
 
 here=`pwd`
@@ -33,7 +33,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _cleanup()
 {
     cd /
-    rm -f "$tmp".*
+    rm -f $tmp.*
 }
 
 # get standard environment, filters and checks
@@ -49,13 +49,12 @@ _require_scratch_reflink
 _require_cp_reflink
 
 echo "Format and mount"
-_scratch_mkfs > "$seqres.full" 2>&1
-_scratch_mount >> "$seqres.full" 2>&1
+_scratch_mkfs > $seqres.full 2>&1
+_scratch_mount >> $seqres.full 2>&1
 
-testdir="$SCRATCH_MNT/test-$seq"
-rm -rf "$testdir"
-mkdir "$testdir"
-free_blocks0=$(stat -f "$testdir" -c '%f')
+testdir=$SCRATCH_MNT/test-$seq
+mkdir $testdir
+free_blocks0=$(stat -f $testdir -c '%f')
 
 echo "Create the original file and reflink to file2, file3"
 blks=2000
@@ -63,57 +62,57 @@ margin=160
 blksz=65536
 real_blksz="$(stat -f $testdir -c '%S')"
 blksz_factor=$((blksz / real_blksz))
-_pwrite_byte 0x61 0 $((blks * blksz)) "$testdir/file1" >> "$seqres.full"
-_cp_reflink "$testdir/file1" "$testdir/file2"
-_cp_reflink "$testdir/file2" "$testdir/file3"
-_cp_reflink "$testdir/file3" "$testdir/file4"
+_pwrite_byte 0x61 0 $((blks * blksz)) $testdir/file1 >> $seqres.full
+_cp_reflink $testdir/file1 $testdir/file2
+_cp_reflink $testdir/file2 $testdir/file3
+_cp_reflink $testdir/file3 $testdir/file4
 _test_remount
-free_blocks1=$(stat -f "$testdir" -c '%f')
+free_blocks1=$(stat -f $testdir -c '%f')
 
-md5sum "$testdir/file1" | _filter_scratch
-md5sum "$testdir/file2" | _filter_scratch
-md5sum "$testdir/file3" | _filter_scratch
-md5sum "$testdir/file4" | _filter_scratch
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file2 | _filter_scratch
+md5sum $testdir/file3 | _filter_scratch
+md5sum $testdir/file4 | _filter_scratch
 
-c01=$(_md5_checksum "$testdir/file1")
-c02=$(_md5_checksum "$testdir/file2")
-c03=$(_md5_checksum "$testdir/file3")
-c04=$(_md5_checksum "$testdir/file4")
+c01=$(_md5_checksum $testdir/file1)
+c02=$(_md5_checksum $testdir/file2)
+c03=$(_md5_checksum $testdir/file3)
+c04=$(_md5_checksum $testdir/file4)
 
 echo "CoW the reflink copies"
-_pwrite_byte 0x62 $blksz $blksz "$testdir/file2" >> "$seqres.full"
-_pwrite_byte 0x63 $(( blksz * (blks - 1) )) $blksz "$testdir/file3" >> "$seqres.full"
+_pwrite_byte 0x62 $blksz $blksz $testdir/file2 >> $seqres.full
+_pwrite_byte 0x63 $(( blksz * (blks - 1) )) $blksz $testdir/file3 >> $seqres.full
 _test_remount
-free_blocks2=$(stat -f "$testdir" -c '%f')
+free_blocks2=$(stat -f $testdir -c '%f')
 
-md5sum "$testdir/file1" | _filter_scratch
-md5sum "$testdir/file2" | _filter_scratch
-md5sum "$testdir/file3" | _filter_scratch
-md5sum "$testdir/file4" | _filter_scratch
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file2 | _filter_scratch
+md5sum $testdir/file3 | _filter_scratch
+md5sum $testdir/file4 | _filter_scratch
 
-c11=$(_md5_checksum "$testdir/file1")
-c12=$(_md5_checksum "$testdir/file2")
-c13=$(_md5_checksum "$testdir/file3")
-c14=$(_md5_checksum "$testdir/file4")
+c11=$(_md5_checksum $testdir/file1)
+c12=$(_md5_checksum $testdir/file2)
+c13=$(_md5_checksum $testdir/file3)
+c14=$(_md5_checksum $testdir/file4)
 
 echo "Defragment"
-lsattr -l "$testdir/" | _filter_scratch | _filter_spaces
-xfs_fsr -v -d "$testdir/file1" >> "$seqres.full"
-xfs_fsr -v -d "$testdir/file2" >> "$seqres.full" # fsr probably breaks the link
-xfs_fsr -v -d "$testdir/file3" >> "$seqres.full" # fsr probably breaks the link
-xfs_fsr -v -d "$testdir/file4" >> "$seqres.full" # fsr probably ignores this file
+lsattr -l $testdir/ | _filter_scratch | _filter_spaces
+xfs_fsr -v -d $testdir/file1 >> $seqres.full
+xfs_fsr -v -d $testdir/file2 >> $seqres.full # fsr probably breaks the link
+xfs_fsr -v -d $testdir/file3 >> $seqres.full # fsr probably breaks the link
+xfs_fsr -v -d $testdir/file4 >> $seqres.full # fsr probably ignores this file
 _test_remount
-free_blocks3=$(stat -f "$testdir" -c '%f')
+free_blocks3=$(stat -f $testdir -c '%f')
 
-md5sum "$testdir/file1" | _filter_scratch
-md5sum "$testdir/file2" | _filter_scratch
-md5sum "$testdir/file3" | _filter_scratch
-md5sum "$testdir/file4" | _filter_scratch
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file2 | _filter_scratch
+md5sum $testdir/file3 | _filter_scratch
+md5sum $testdir/file4 | _filter_scratch
 
-c21=$(_md5_checksum "$testdir/file1")
-c22=$(_md5_checksum "$testdir/file2")
-c23=$(_md5_checksum "$testdir/file3")
-c24=$(_md5_checksum "$testdir/file4")
+c21=$(_md5_checksum $testdir/file1)
+c22=$(_md5_checksum $testdir/file2)
+c23=$(_md5_checksum $testdir/file3)
+c24=$(_md5_checksum $testdir/file4)
 
 echo "Check files"
 test $c01 = $c02 || echo "Files 1-2 do not match"
diff --git a/tests/xfs/129 b/tests/xfs/129
index 8d608f2..d29f842 100755
--- a/tests/xfs/129
+++ b/tests/xfs/129
@@ -22,7 +22,7 @@
 # Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 #-----------------------------------------------------------------------
 
-seq=`basename "$0"`
+seq=`basename $0`
 seqres=$RESULT_DIR/$seq
 echo "QA output created by $seq"
 
@@ -34,8 +34,8 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _cleanup()
 {
     cd /
-    umount "$SCRATCH_MNT" > /dev/null 2>&1
-    rm -rf "$tmp".* "$testdir" "$metadump_file" "$TEST_DIR/image"
+    umount $SCRATCH_MNT > /dev/null 2>&1
+    rm -rf $tmp.* $testdir $metadump_file $TEST_DIR/image
 }
 
 # get standard environment, filters and checks
@@ -49,39 +49,38 @@ _supported_fs xfs
 _require_loop
 _require_scratch_reflink
 
-rm -f "$seqres.full"
+rm -f $seqres.full
 
 _scratch_mkfs >/dev/null 2>&1
 _scratch_mount
 
-testdir="$SCRATCH_MNT/test-$seq"
-rm -rf "$testdir"
-mkdir "$testdir"
-metadump_file="$TEST_DIR/${seq}_metadump"
+testdir=$SCRATCH_MNT/test-$seq
+mkdir $testdir
+metadump_file=$TEST_DIR/${seq}_metadump
 
 echo "Create the original file blocks"
-blksz="$(stat -f "$testdir" -c '%S')"
+blksz="$(stat -f $testdir -c '%S')"
 nr_blks=$((4 * blksz / 12))
-_pwrite_byte 0x61 0 $((blksz * nr_blks)) "$testdir/file1" >> "$seqres.full"
+_pwrite_byte 0x61 0 $((blksz * nr_blks)) $testdir/file1 >> $seqres.full
 
 echo "Reflink every other block"
 seq 1 2 $((nr_blks - 1)) | while read nr; do
-	_reflink_range  "$testdir/file1" $((nr * blksz)) \
-			"$testdir/file2" $((nr * blksz)) $blksz >> "$seqres.full"
+	_reflink_range  $testdir/file1 $((nr * blksz)) \
+			$testdir/file2 $((nr * blksz)) $blksz >> $seqres.full
 done
 
 echo "Create metadump file"
 _scratch_unmount
-_scratch_metadump "$metadump_file"
+_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"
-_mount -t $FSTYP "$TEST_DIR/image" "$SCRATCH_MNT"
-umount "$SCRATCH_MNT"
+xfs_mdrestore $metadump_file $TEST_DIR/image
+_mount -t $FSTYP $TEST_DIR/image $SCRATCH_MNT
+umount $SCRATCH_MNT
 
 echo "Check restored fs"
-_check_generic_filesystem "$metadump_file"
+_check_generic_filesystem $metadump_file
 
 # success, all done
 status=0
diff --git a/tests/xfs/131 b/tests/xfs/131
index f553a44..8df77ff 100755
--- a/tests/xfs/131
+++ b/tests/xfs/131
@@ -20,7 +20,7 @@
 # Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 #-----------------------------------------------------------------------
 
-seq=`basename "$0"`
+seq=`basename $0`
 seqres=$RESULT_DIR/$seq
 echo "QA output created by $seq"
 
@@ -32,8 +32,8 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _cleanup()
 {
     cd /
-    umount "$SCRATCH_MNT" > /dev/null 2>&1
-    rm -rf "$tmp".* "$testdir" "$metadump_file"
+    umount $SCRATCH_MNT > /dev/null 2>&1
+    rm -rf $tmp.* $testdir $metadump_file
 }
 
 # get standard environment, filters and checks
@@ -48,24 +48,23 @@ _require_realtime
 _require_scratch_reflink
 _require_cp_reflink
 
-rm -f "$seqres.full"
+rm -f $seqres.full
 
 echo "Format and mount scratch device"
-_scratch_mkfs >> "$seqres.full"
+_scratch_mkfs >> $seqres.full
 _scratch_mount
 
-testdir="$SCRATCH_MNT/test-$seq"
-rm -rf "$testdir"
-mkdir "$testdir"
+testdir=$SCRATCH_MNT/test-$seq
+mkdir $testdir
 
 echo "Create the original file blocks"
 blksz=65536
-$XFS_IO_PROG -R -f -c "truncate $blksz" "$testdir/file1"
+$XFS_IO_PROG -R -f -c "truncate $blksz" $testdir/file1
 
 echo "Reflink every block"
-_cp_reflink "$testdir/file1" "$testdir/file2" 2>&1 | _filter_scratch
+_cp_reflink $testdir/file1 $testdir/file2 2>&1 | _filter_scratch
 
-test -s "$testdir/file2" && _fail "Should not be able to reflink a realtime file."
+test -s $testdir/file2 && _fail "Should not be able to reflink a realtime file."
 
 # success, all done
 status=0
diff --git a/tests/xfs/132 b/tests/xfs/132
index 9c57c3b..cf3d645 100755
--- a/tests/xfs/132
+++ b/tests/xfs/132
@@ -37,8 +37,8 @@
 # Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 #-----------------------------------------------------------------------
 
-seq=`basename "$0"`
-seqres="$RESULT_DIR/$seq"
+seq=`basename $0`
+seqres=$RESULT_DIR/$seq
 echo "QA output created by $seq"
 
 here=`pwd`
@@ -49,7 +49,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _cleanup()
 {
     cd /
-    rm -rf "$tmp".* "$testdir"
+    rm -rf $tmp.* $testdir
 }
 
 # get standard environment, filters and checks
@@ -65,53 +65,54 @@ _require_test_lsattr
 _require_cp_reflink
 _require_xfs_io_command "falloc"
 
-rm -f "$seqres.full"
+rm -f $seqres.full
 
-testdir="$TEST_DIR/test-$seq"
-rm -rf "$testdir"
-mkdir "$testdir"
+testdir=$TEST_DIR/test-$seq
+rm -rf $testdir
+mkdir $testdir
 
 echo "Create the original file blocks"
-blksz="$(stat -f "$testdir" -c '%S')"
+blksz="$(stat -f $testdir -c '%S')"
 blks=2000
 margin=100
 sz=$((blksz * blks))
-free_blocks0=$(stat -f "$testdir" -c '%f')
+free_blocks0=$(stat -f $testdir -c '%f')
 nr=4
-_pwrite_byte 0x61 0 $sz "$testdir/file1" >> "$seqres.full"
+filesize=$((blksz * nr))
+_pwrite_byte 0x61 0 $sz $testdir/file1 >> $seqres.full
 _test_remount
 
 echo "Create the reflink copies"
 for i in `seq 2 $nr`; do
-	_cp_reflink "$testdir/file1" "$testdir/file$i"
+	_cp_reflink $testdir/file1 $testdir/file$i
 done
 _test_remount
-free_blocks1=$(stat -f "$testdir" -c '%f')
+free_blocks1=$(stat -f $testdir -c '%f')
 lsattr -l $testdir/ | _filter_test_dir | _filter_spaces
 
 echo "funshare part of a file"
-"$XFS_IO_PROG" -f -c "falloc 0 $((sz / 2))" "$testdir/file2"
+$XFS_IO_PROG -f -c "falloc 0 $((sz / 2))" $testdir/file2
 _test_remount
 lsattr -l $testdir/ | _filter_test_dir | _filter_spaces
 
 echo "funshare some of the copies"
-"$XFS_IO_PROG" -f -c "falloc 0 $sz" "$testdir/file2"
-"$XFS_IO_PROG" -f -c "falloc 0 $sz" "$testdir/file3"
+$XFS_IO_PROG -f -c "falloc 0 $sz" $testdir/file2
+$XFS_IO_PROG -f -c "falloc 0 $sz" $testdir/file3
 _test_remount
-free_blocks2=$(stat -f "$testdir" -c '%f')
+free_blocks2=$(stat -f $testdir -c '%f')
 lsattr -l $testdir/ | _filter_test_dir | _filter_spaces
 
 echo "funshare the rest of the files"
-"$XFS_IO_PROG" -f -c "falloc 0 $sz" "$testdir/file4"
-"$XFS_IO_PROG" -f -c "falloc 0 $sz" "$testdir/file1"
+$XFS_IO_PROG -f -c "falloc 0 $sz" $testdir/file4
+$XFS_IO_PROG -f -c "falloc 0 $sz" $testdir/file1
 _test_remount
-free_blocks3=$(stat -f "$testdir" -c '%f')
+free_blocks3=$(stat -f $testdir -c '%f')
 lsattr -l $testdir/ | _filter_test_dir | _filter_spaces
 
 echo "Rewrite the original file"
-_pwrite_byte 0x65 0 $sz "$testdir/file1" >> "$seqres.full"
+_pwrite_byte 0x65 0 $sz $testdir/file1 >> $seqres.full
 _test_remount
-free_blocks4=$(stat -f "$testdir" -c '%f')
+free_blocks4=$(stat -f $testdir -c '%f')
 lsattr -l $testdir/ | _filter_test_dir | _filter_spaces
 #echo $free_blocks0 $free_blocks1 $free_blocks2 $free_blocks3 $free_blocks4
 
diff --git a/tests/xfs/139 b/tests/xfs/139
index 55dd7d0..ecd88e6 100755
--- a/tests/xfs/139
+++ b/tests/xfs/139
@@ -21,8 +21,8 @@
 # Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 #-----------------------------------------------------------------------
 
-seq=`basename "$0"`
-seqres="$RESULT_DIR/$seq"
+seq=`basename $0`
+seqres=$RESULT_DIR/$seq
 echo "QA output created by $seq"
 
 here=`pwd`
@@ -33,7 +33,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _cleanup()
 {
     cd /
-    rm -rf "$tmp".* "$testdir"
+    rm -rf $tmp.* $testdir
 }
 
 # get standard environment, filters and checks
@@ -46,32 +46,31 @@ _supported_os Linux
 _require_scratch_reflink
 _require_cp_reflink
 
-rm -f "$seqres.full"
+rm -f $seqres.full
 
 echo "Format and mount"
-_scratch_mkfs -d agsize=$((32 * 1048576)) > "$seqres.full" 2>&1
-_scratch_mount >> "$seqres.full" 2>&1
+_scratch_mkfs -d agsize=$((32 * 1048576)) > $seqres.full 2>&1
+_scratch_mount >> $seqres.full 2>&1
 
-testdir="$SCRATCH_MNT/test-$seq"
-rm -rf "$testdir"
-mkdir "$testdir"
-blksz="$(stat -f "$testdir" -c '%S')"
+testdir=$SCRATCH_MNT/test-$seq
+mkdir $testdir
+blksz="$(stat -f $testdir -c '%S')"
 
 echo "Create the original files"
 sz=$((48 * 1048576))
 nr=$((sz / blksz))
-_pwrite_byte 0x61 0 $sz "$testdir/file1" >> "$seqres.full"
-_cp_reflink "$testdir/file1" "$testdir/file2" >> "$seqres.full"
+_pwrite_byte 0x61 0 $sz $testdir/file1 >> $seqres.full
+_cp_reflink $testdir/file1 $testdir/file2 >> $seqres.full
 _scratch_remount
 
 echo "CoW every other block"
-_pwrite_byte 0x62 0 $sz "$testdir/file1" >> "$seqres.full"
+_pwrite_byte 0x62 0 $sz $testdir/file1 >> $seqres.full
 _scratch_remount
 
 echo "Compare files"
-md5sum "$testdir/file1" | _filter_scratch
-md5sum "$testdir/file2" | _filter_scratch
-#filefrag -v "$testdir/file1" "$testdir/file2"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file2 | _filter_scratch
+#filefrag -v $testdir/file1 $testdir/file2
 
 # success, all done
 status=0
diff --git a/tests/xfs/140 b/tests/xfs/140
index a379ca7..6dfe581 100644
--- a/tests/xfs/140
+++ b/tests/xfs/140
@@ -21,8 +21,8 @@
 # Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 #-----------------------------------------------------------------------
 
-seq=`basename "$0"`
-seqres="$RESULT_DIR/$seq"
+seq=`basename $0`
+seqres=$RESULT_DIR/$seq
 echo "QA output created by $seq"
 
 here=`pwd`
@@ -33,7 +33,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _cleanup()
 {
     cd /
-    rm -rf "$tmp".* "$testdir"
+    rm -rf $tmp.* $testdir
 }
 
 # get standard environment, filters and checks
@@ -46,39 +46,38 @@ _supported_os Linux
 _require_scratch_reflink
 _require_cp_reflink
 
-rm -f "$seqres.full"
+rm -f $seqres.full
 
 echo "Format and mount"
-_scratch_mkfs -d agsize=$((32 * 1048576)) > "$seqres.full" 2>&1
-_scratch_mount >> "$seqres.full" 2>&1
+_scratch_mkfs -d agsize=$((32 * 1048576)) > $seqres.full 2>&1
+_scratch_mount >> $seqres.full 2>&1
 
-testdir="$SCRATCH_MNT/test-$seq"
-rm -rf "$testdir"
-mkdir "$testdir"
-blksz="$(stat -f -c '%S' "$testdir")"
+testdir=$SCRATCH_MNT/test-$seq
+mkdir $testdir
+blksz=$(stat -f -c '%S' $testdir)
 
 echo "Create the original files"
 sz=$((48 * 1048576))
 nr=$((sz / blksz))
-_pwrite_byte 0x61 0 $sz "$testdir/file1" >> "$seqres.full"
-_cp_reflink "$testdir/file1" "$testdir/file2" >> "$seqres.full"
-_pwrite_byte 0x61 0 $sz "$testdir/file2.chk" >> "$seqres.full"
+_pwrite_byte 0x61 0 $sz $testdir/file1 >> $seqres.full
+_cp_reflink $testdir/file1 $testdir/file2 >> $seqres.full
+_pwrite_byte 0x61 0 $sz $testdir/file2.chk >> $seqres.full
 _scratch_remount
 
 echo "Compare files"
-cmp -s "$testdir/file1" "$testdir/file2" || echo "file1 and file2 do not match"
-cmp -s "$testdir/file2" "$testdir/file2.chk" || echo "file2 and file2.chk do not match"
+cmp -s $testdir/file1 $testdir/file2 || echo "file1 and file2 do not match"
+cmp -s $testdir/file2 $testdir/file2.chk || echo "file2 and file2.chk do not match"
 
 echo "CoW every other block"
 seq 1 2 $((nr - 1)) | while read f; do
-	_pwrite_byte 0x62 $((f * blksz)) $blksz "$testdir/file2" >> "$seqres.full"
-	_pwrite_byte 0x62 $((f * blksz)) $blksz "$testdir/file2.chk" >> "$seqres.full"
+	_pwrite_byte 0x62 $((f * blksz)) $blksz $testdir/file2 >> $seqres.full
+	_pwrite_byte 0x62 $((f * blksz)) $blksz $testdir/file2.chk >> $seqres.full
 done
 _scratch_remount
 
 echo "Compare files"
-! cmp -s "$testdir/file1" "$testdir/file2" || echo "file1 and file2 must not match"
-cmp -s "$testdir/file2" "$testdir/file2.chk" || echo "file2 and file2.chk do not match"
+! cmp -s $testdir/file1 $testdir/file2 || echo "file1 and file2 must not match"
+cmp -s $testdir/file2 $testdir/file2.chk || echo "file2 and file2.chk do not match"
 
 # success, all done
 status=0

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

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

* [PATCH 11/32] reflink: add _require_odirect to the directio tests
  2016-02-11 23:39 ` Darrick J. Wong
@ 2016-02-11 23:40   ` Darrick J. Wong
  -1 siblings, 0 replies; 81+ messages in thread
From: Darrick J. Wong @ 2016-02-11 23:40 UTC (permalink / raw)
  To: david, darrick.wong; +Cc: linux-btrfs, fstests, xfs

For the tests that test O_DIRECT, we need to _require_odirect.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 tests/generic/139 |    1 +
 tests/generic/143 |    1 +
 tests/generic/155 |    1 +
 tests/generic/165 |    1 +
 tests/generic/166 |    1 +
 tests/generic/170 |    1 +
 tests/generic/174 |    1 +
 tests/generic/183 |    1 +
 tests/generic/187 |    1 +
 tests/generic/188 |    1 +
 tests/generic/190 |    1 +
 tests/generic/194 |    1 +
 tests/generic/196 |    1 +
 tests/generic/199 |    1 +
 tests/generic/200 |    1 +
 tests/generic/203 |    1 +
 tests/generic/206 |    1 +
 tests/generic/217 |    1 +
 tests/generic/220 |    1 +
 tests/generic/227 |    1 +
 tests/generic/238 |    1 +
 tests/generic/243 |    1 +
 22 files changed, 22 insertions(+)


diff --git a/tests/generic/139 b/tests/generic/139
index 5e7b631..989b054 100755
--- a/tests/generic/139
+++ b/tests/generic/139
@@ -47,6 +47,7 @@ _cleanup()
 _supported_os Linux
 _require_test_reflink
 _require_cp_reflink
+_require_odirect
 
 rm -f $seqres.full
 
diff --git a/tests/generic/143 b/tests/generic/143
index 586cf5c..703b585 100755
--- a/tests/generic/143
+++ b/tests/generic/143
@@ -49,6 +49,7 @@ _cleanup()
 _supported_os Linux
 _require_test_reflink
 _require_cp_reflink
+_require_odirect
 
 rm -f $seqres.full
 
diff --git a/tests/generic/155 b/tests/generic/155
index c6416a1..e96bda7 100755
--- a/tests/generic/155
+++ b/tests/generic/155
@@ -55,6 +55,7 @@ _supported_os Linux
 _require_test_reflink
 _require_cp_reflink
 _require_xfs_io_command "fzero"
+_require_odirect
 
 rm -f $seqres.full
 
diff --git a/tests/generic/165 b/tests/generic/165
index e4c9a9d..1ae08a4 100755
--- a/tests/generic/165
+++ b/tests/generic/165
@@ -47,6 +47,7 @@ _cleanup()
 _supported_os Linux
 _require_scratch_reflink
 _require_cp_reflink
+_require_odirect
 
 echo "Format and mount"
 _scratch_mkfs > $seqres.full 2>&1
diff --git a/tests/generic/166 b/tests/generic/166
index 9be753d..9b177be 100755
--- a/tests/generic/166
+++ b/tests/generic/166
@@ -47,6 +47,7 @@ _cleanup()
 _supported_os Linux
 _require_scratch_reflink
 _require_cp_reflink
+_require_odirect
 
 echo "Format and mount"
 _scratch_mkfs > $seqres.full 2>&1
diff --git a/tests/generic/170 b/tests/generic/170
index dbf1564..0f29b3a 100755
--- a/tests/generic/170
+++ b/tests/generic/170
@@ -46,6 +46,7 @@ _cleanup()
 # real QA test starts here
 _supported_os Linux
 _require_scratch_reflink
+_require_odirect
 
 echo "Format and mount"
 _scratch_mkfs > $seqres.full 2>&1
diff --git a/tests/generic/174 b/tests/generic/174
index cec2f05..edfc2bc 100755
--- a/tests/generic/174
+++ b/tests/generic/174
@@ -46,6 +46,7 @@ _cleanup()
 _supported_os Linux
 _require_scratch_reflink
 _require_cp_reflink
+_require_odirect
 
 rm -f $seqres.full
 
diff --git a/tests/generic/183 b/tests/generic/183
index 0f35da2..0ab4afe 100755
--- a/tests/generic/183
+++ b/tests/generic/183
@@ -49,6 +49,7 @@ _cleanup()
 # real QA test starts here
 _supported_os Linux
 _require_scratch_reflink
+_require_odirect
 
 rm -f $seqres.full
 
diff --git a/tests/generic/187 b/tests/generic/187
index b8fade2..ac6037d 100755
--- a/tests/generic/187
+++ b/tests/generic/187
@@ -55,6 +55,7 @@ _require_cp_reflink
 _require_xfs_io_command "falloc"
 _require_xfs_io_command "fpunch"
 test $FSTYP = "btrfs" && _notrun "Can't fragment free space on btrfs."
+_require_odirect
 
 rm -f $seqres.full
 
diff --git a/tests/generic/188 b/tests/generic/188
index 7be1080..bb293b1 100755
--- a/tests/generic/188
+++ b/tests/generic/188
@@ -49,6 +49,7 @@ _cleanup()
 _supported_os Linux
 _require_scratch_reflink
 _require_xfs_io_command "falloc"
+_require_odirect
 
 rm -f $seqres.full
 
diff --git a/tests/generic/190 b/tests/generic/190
index a5c2137..b4de3ed 100755
--- a/tests/generic/190
+++ b/tests/generic/190
@@ -49,6 +49,7 @@ _cleanup()
 _supported_os Linux
 _require_scratch_reflink
 _require_xfs_io_command "falloc"
+_require_odirect
 
 rm -f $seqres.full
 
diff --git a/tests/generic/194 b/tests/generic/194
index 69a3e6c..f67e567 100755
--- a/tests/generic/194
+++ b/tests/generic/194
@@ -50,6 +50,7 @@ _cleanup()
 _supported_os Linux
 _require_scratch_reflink
 _require_xfs_io_command "falloc"
+_require_odirect
 
 rm -f $seqres.full
 
diff --git a/tests/generic/196 b/tests/generic/196
index 951079c..1505de8 100755
--- a/tests/generic/196
+++ b/tests/generic/196
@@ -49,6 +49,7 @@ _cleanup()
 _supported_os Linux
 _require_scratch_reflink
 _require_xfs_io_command "falloc"
+_require_odirect
 
 rm -f $seqres.full
 
diff --git a/tests/generic/199 b/tests/generic/199
index f457245..04380ed 100755
--- a/tests/generic/199
+++ b/tests/generic/199
@@ -55,6 +55,7 @@ _require_scratch_reflink
 _require_xfs_io_command "falloc"
 _require_xfs_io_command "fpunch"
 _require_cp_reflink
+_require_odirect
 
 rm -f $seqres.full
 
diff --git a/tests/generic/200 b/tests/generic/200
index ffb5869..2aa0315 100755
--- a/tests/generic/200
+++ b/tests/generic/200
@@ -55,6 +55,7 @@ _require_scratch_reflink
 _require_xfs_io_command "falloc"
 _require_xfs_io_command "fpunch"
 _require_cp_reflink
+_require_odirect
 
 rm -f $seqres.full
 
diff --git a/tests/generic/203 b/tests/generic/203
index 5d9bfc4..2ffb311 100755
--- a/tests/generic/203
+++ b/tests/generic/203
@@ -44,6 +44,7 @@ _cleanup()
 _supported_os Linux
 _require_scratch_reflink
 _require_cp_reflink
+_require_odirect
 
 rm -f $seqres.full
 
diff --git a/tests/generic/206 b/tests/generic/206
index 4054626..6b3e200 100755
--- a/tests/generic/206
+++ b/tests/generic/206
@@ -47,6 +47,7 @@ _cleanup()
 # real QA test starts here
 _supported_os Linux
 _require_scratch_reflink
+_require_odirect
 
 rm -f $seqres.full
 
diff --git a/tests/generic/217 b/tests/generic/217
index b1bd635..ce8e0a1 100755
--- a/tests/generic/217
+++ b/tests/generic/217
@@ -48,6 +48,7 @@ _cleanup()
 _supported_os Linux
 _require_scratch_reflink
 _require_xfs_io_command "falloc"
+_require_odirect
 
 rm -f $seqres.full
 
diff --git a/tests/generic/220 b/tests/generic/220
index edb8432..3bce21b 100755
--- a/tests/generic/220
+++ b/tests/generic/220
@@ -48,6 +48,7 @@ _cleanup()
 _supported_os Linux
 _require_scratch_reflink
 _require_xfs_io_command "falloc"
+_require_odirect
 
 rm -f $seqres.full
 
diff --git a/tests/generic/227 b/tests/generic/227
index abaf8f7..00985d3 100755
--- a/tests/generic/227
+++ b/tests/generic/227
@@ -48,6 +48,7 @@ _cleanup()
 _supported_os Linux
 _require_scratch_reflink
 _require_xfs_io_command "falloc"
+_require_odirect
 
 rm -f $seqres.full
 
diff --git a/tests/generic/238 b/tests/generic/238
index ce7408c..3b46492 100755
--- a/tests/generic/238
+++ b/tests/generic/238
@@ -48,6 +48,7 @@ _cleanup()
 _supported_os Linux
 _require_scratch_reflink
 _require_xfs_io_command "falloc"
+_require_odirect
 
 rm -f $seqres.full
 
diff --git a/tests/generic/243 b/tests/generic/243
index 127070e..e1d698b 100755
--- a/tests/generic/243
+++ b/tests/generic/243
@@ -47,6 +47,7 @@ _cleanup()
 _supported_os Linux
 _require_scratch_reflink
 _require_cp_reflink
+_require_odirect
 
 rm -f $seqres.full
 


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

* [PATCH 11/32] reflink: add _require_odirect to the directio tests
@ 2016-02-11 23:40   ` Darrick J. Wong
  0 siblings, 0 replies; 81+ messages in thread
From: Darrick J. Wong @ 2016-02-11 23:40 UTC (permalink / raw)
  To: david, darrick.wong; +Cc: fstests, linux-btrfs, xfs

For the tests that test O_DIRECT, we need to _require_odirect.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 tests/generic/139 |    1 +
 tests/generic/143 |    1 +
 tests/generic/155 |    1 +
 tests/generic/165 |    1 +
 tests/generic/166 |    1 +
 tests/generic/170 |    1 +
 tests/generic/174 |    1 +
 tests/generic/183 |    1 +
 tests/generic/187 |    1 +
 tests/generic/188 |    1 +
 tests/generic/190 |    1 +
 tests/generic/194 |    1 +
 tests/generic/196 |    1 +
 tests/generic/199 |    1 +
 tests/generic/200 |    1 +
 tests/generic/203 |    1 +
 tests/generic/206 |    1 +
 tests/generic/217 |    1 +
 tests/generic/220 |    1 +
 tests/generic/227 |    1 +
 tests/generic/238 |    1 +
 tests/generic/243 |    1 +
 22 files changed, 22 insertions(+)


diff --git a/tests/generic/139 b/tests/generic/139
index 5e7b631..989b054 100755
--- a/tests/generic/139
+++ b/tests/generic/139
@@ -47,6 +47,7 @@ _cleanup()
 _supported_os Linux
 _require_test_reflink
 _require_cp_reflink
+_require_odirect
 
 rm -f $seqres.full
 
diff --git a/tests/generic/143 b/tests/generic/143
index 586cf5c..703b585 100755
--- a/tests/generic/143
+++ b/tests/generic/143
@@ -49,6 +49,7 @@ _cleanup()
 _supported_os Linux
 _require_test_reflink
 _require_cp_reflink
+_require_odirect
 
 rm -f $seqres.full
 
diff --git a/tests/generic/155 b/tests/generic/155
index c6416a1..e96bda7 100755
--- a/tests/generic/155
+++ b/tests/generic/155
@@ -55,6 +55,7 @@ _supported_os Linux
 _require_test_reflink
 _require_cp_reflink
 _require_xfs_io_command "fzero"
+_require_odirect
 
 rm -f $seqres.full
 
diff --git a/tests/generic/165 b/tests/generic/165
index e4c9a9d..1ae08a4 100755
--- a/tests/generic/165
+++ b/tests/generic/165
@@ -47,6 +47,7 @@ _cleanup()
 _supported_os Linux
 _require_scratch_reflink
 _require_cp_reflink
+_require_odirect
 
 echo "Format and mount"
 _scratch_mkfs > $seqres.full 2>&1
diff --git a/tests/generic/166 b/tests/generic/166
index 9be753d..9b177be 100755
--- a/tests/generic/166
+++ b/tests/generic/166
@@ -47,6 +47,7 @@ _cleanup()
 _supported_os Linux
 _require_scratch_reflink
 _require_cp_reflink
+_require_odirect
 
 echo "Format and mount"
 _scratch_mkfs > $seqres.full 2>&1
diff --git a/tests/generic/170 b/tests/generic/170
index dbf1564..0f29b3a 100755
--- a/tests/generic/170
+++ b/tests/generic/170
@@ -46,6 +46,7 @@ _cleanup()
 # real QA test starts here
 _supported_os Linux
 _require_scratch_reflink
+_require_odirect
 
 echo "Format and mount"
 _scratch_mkfs > $seqres.full 2>&1
diff --git a/tests/generic/174 b/tests/generic/174
index cec2f05..edfc2bc 100755
--- a/tests/generic/174
+++ b/tests/generic/174
@@ -46,6 +46,7 @@ _cleanup()
 _supported_os Linux
 _require_scratch_reflink
 _require_cp_reflink
+_require_odirect
 
 rm -f $seqres.full
 
diff --git a/tests/generic/183 b/tests/generic/183
index 0f35da2..0ab4afe 100755
--- a/tests/generic/183
+++ b/tests/generic/183
@@ -49,6 +49,7 @@ _cleanup()
 # real QA test starts here
 _supported_os Linux
 _require_scratch_reflink
+_require_odirect
 
 rm -f $seqres.full
 
diff --git a/tests/generic/187 b/tests/generic/187
index b8fade2..ac6037d 100755
--- a/tests/generic/187
+++ b/tests/generic/187
@@ -55,6 +55,7 @@ _require_cp_reflink
 _require_xfs_io_command "falloc"
 _require_xfs_io_command "fpunch"
 test $FSTYP = "btrfs" && _notrun "Can't fragment free space on btrfs."
+_require_odirect
 
 rm -f $seqres.full
 
diff --git a/tests/generic/188 b/tests/generic/188
index 7be1080..bb293b1 100755
--- a/tests/generic/188
+++ b/tests/generic/188
@@ -49,6 +49,7 @@ _cleanup()
 _supported_os Linux
 _require_scratch_reflink
 _require_xfs_io_command "falloc"
+_require_odirect
 
 rm -f $seqres.full
 
diff --git a/tests/generic/190 b/tests/generic/190
index a5c2137..b4de3ed 100755
--- a/tests/generic/190
+++ b/tests/generic/190
@@ -49,6 +49,7 @@ _cleanup()
 _supported_os Linux
 _require_scratch_reflink
 _require_xfs_io_command "falloc"
+_require_odirect
 
 rm -f $seqres.full
 
diff --git a/tests/generic/194 b/tests/generic/194
index 69a3e6c..f67e567 100755
--- a/tests/generic/194
+++ b/tests/generic/194
@@ -50,6 +50,7 @@ _cleanup()
 _supported_os Linux
 _require_scratch_reflink
 _require_xfs_io_command "falloc"
+_require_odirect
 
 rm -f $seqres.full
 
diff --git a/tests/generic/196 b/tests/generic/196
index 951079c..1505de8 100755
--- a/tests/generic/196
+++ b/tests/generic/196
@@ -49,6 +49,7 @@ _cleanup()
 _supported_os Linux
 _require_scratch_reflink
 _require_xfs_io_command "falloc"
+_require_odirect
 
 rm -f $seqres.full
 
diff --git a/tests/generic/199 b/tests/generic/199
index f457245..04380ed 100755
--- a/tests/generic/199
+++ b/tests/generic/199
@@ -55,6 +55,7 @@ _require_scratch_reflink
 _require_xfs_io_command "falloc"
 _require_xfs_io_command "fpunch"
 _require_cp_reflink
+_require_odirect
 
 rm -f $seqres.full
 
diff --git a/tests/generic/200 b/tests/generic/200
index ffb5869..2aa0315 100755
--- a/tests/generic/200
+++ b/tests/generic/200
@@ -55,6 +55,7 @@ _require_scratch_reflink
 _require_xfs_io_command "falloc"
 _require_xfs_io_command "fpunch"
 _require_cp_reflink
+_require_odirect
 
 rm -f $seqres.full
 
diff --git a/tests/generic/203 b/tests/generic/203
index 5d9bfc4..2ffb311 100755
--- a/tests/generic/203
+++ b/tests/generic/203
@@ -44,6 +44,7 @@ _cleanup()
 _supported_os Linux
 _require_scratch_reflink
 _require_cp_reflink
+_require_odirect
 
 rm -f $seqres.full
 
diff --git a/tests/generic/206 b/tests/generic/206
index 4054626..6b3e200 100755
--- a/tests/generic/206
+++ b/tests/generic/206
@@ -47,6 +47,7 @@ _cleanup()
 # real QA test starts here
 _supported_os Linux
 _require_scratch_reflink
+_require_odirect
 
 rm -f $seqres.full
 
diff --git a/tests/generic/217 b/tests/generic/217
index b1bd635..ce8e0a1 100755
--- a/tests/generic/217
+++ b/tests/generic/217
@@ -48,6 +48,7 @@ _cleanup()
 _supported_os Linux
 _require_scratch_reflink
 _require_xfs_io_command "falloc"
+_require_odirect
 
 rm -f $seqres.full
 
diff --git a/tests/generic/220 b/tests/generic/220
index edb8432..3bce21b 100755
--- a/tests/generic/220
+++ b/tests/generic/220
@@ -48,6 +48,7 @@ _cleanup()
 _supported_os Linux
 _require_scratch_reflink
 _require_xfs_io_command "falloc"
+_require_odirect
 
 rm -f $seqres.full
 
diff --git a/tests/generic/227 b/tests/generic/227
index abaf8f7..00985d3 100755
--- a/tests/generic/227
+++ b/tests/generic/227
@@ -48,6 +48,7 @@ _cleanup()
 _supported_os Linux
 _require_scratch_reflink
 _require_xfs_io_command "falloc"
+_require_odirect
 
 rm -f $seqres.full
 
diff --git a/tests/generic/238 b/tests/generic/238
index ce7408c..3b46492 100755
--- a/tests/generic/238
+++ b/tests/generic/238
@@ -48,6 +48,7 @@ _cleanup()
 _supported_os Linux
 _require_scratch_reflink
 _require_xfs_io_command "falloc"
+_require_odirect
 
 rm -f $seqres.full
 
diff --git a/tests/generic/243 b/tests/generic/243
index 127070e..e1d698b 100755
--- a/tests/generic/243
+++ b/tests/generic/243
@@ -47,6 +47,7 @@ _cleanup()
 _supported_os Linux
 _require_scratch_reflink
 _require_cp_reflink
+_require_odirect
 
 rm -f $seqres.full
 

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

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

* [PATCH 12/32] dio: unwritten conversion bug tests
  2016-02-11 23:39 ` Darrick J. Wong
@ 2016-02-11 23:40   ` Darrick J. Wong
  -1 siblings, 0 replies; 81+ messages in thread
From: Darrick J. Wong @ 2016-02-11 23:40 UTC (permalink / raw)
  To: david, darrick.wong; +Cc: linux-btrfs, fstests, xfs

Check that we don't expose old disk contents when a directio write to
an unwritten extent fails due to IO errors.  This primarily affects
XFS and ext4.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 .gitignore                  |    1 
 src/aio-dio-regress/aiocp.c |  489 +++++++++++++++++++++++++++++++++++++++++++
 tests/generic/250           |  100 +++++++++
 tests/generic/250.out       |   10 +
 tests/generic/252           |  103 +++++++++
 tests/generic/252.out       |   10 +
 tests/generic/group         |    2 
 7 files changed, 715 insertions(+)
 create mode 100644 src/aio-dio-regress/aiocp.c
 create mode 100755 tests/generic/250
 create mode 100644 tests/generic/250.out
 create mode 100755 tests/generic/252
 create mode 100644 tests/generic/252.out


diff --git a/.gitignore b/.gitignore
index a6f47d3..bbe7c1a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -112,6 +112,7 @@
 /src/aio-dio-regress/aio-free-ring-with-bogus-nr-pages
 /src/aio-dio-regress/aio-io-setup-with-nonwritable-context-pointer
 /src/aio-dio-regress/aio-last-ref-held-by-io
+/src/aio-dio-regress/aiocp
 /src/aio-dio-regress/aiodio_sparse2
 /src/aio-dio-regress/aio-dio-eof-race
 /src/cloner
diff --git a/src/aio-dio-regress/aiocp.c b/src/aio-dio-regress/aiocp.c
new file mode 100644
index 0000000..1abff9c
--- /dev/null
+++ b/src/aio-dio-regress/aiocp.c
@@ -0,0 +1,489 @@
+/*
+ * Copyright (c) 2004 Daniel McNeil <daniel@osdl.org>
+ *               2004 Open Source Development Lab
+ *   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; either version 2 of the License, or
+ *   (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will 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 to the Free Software
+ *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * Module: .c
+ */
+
+/*
+ * Change History:
+ *
+ *
+ * version of copy command using async i/o
+ * From:	Stephen Hemminger <shemminger@osdl.org>
+ * Modified by Daniel McNeil <daniel@osdl.org> for testing aio.
+ *	- added -a alignment
+ *	- added -b blksize option 
+ *	_ added -s size	option
+ *	- added -f open_flag option
+ *	- added -w (no write) option (reads from source only)
+ *	- added -n (num aio) option 
+ *	- added -z (zero dest) opton (writes zeros to dest only)
+ *	- added -D delay_ms option
+ *  - 2/2004  Marty Ridgeway (mridge@us.ibm.com) Changes to adapt to LTP
+ *
+ * Copy file by using a async I/O state machine.
+ * 1. Start read request
+ * 2. When read completes turn it into a write request
+ * 3. When write completes decrement counter and free resources
+ *
+ *
+ * Usage: aiocp [-b blksize] -n [num_aio] [-w] [-z] [-s filesize] 
+ *		[-f DIRECT|TRUNC|CREAT|SYNC|LARGEFILE] src dest
+ */
+
+//#define _GNU_SOURCE
+//#define DEBUG 1
+#undef DEBUG
+
+#include <unistd.h>
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <sys/param.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <stdlib.h>
+#include <sys/select.h>
+
+#include <libaio.h>
+
+#define AIO_BLKSIZE	(64*1024)
+#define AIO_MAXIO	32
+
+static int aio_blksize = AIO_BLKSIZE;
+static int aio_maxio = AIO_MAXIO;
+
+static int busy = 0;		// # of I/O's in flight
+static int tocopy = 0;		// # of blocks left to copy
+static int srcfd;		// source fd
+static int dstfd = -1;		// destination file descriptor
+static const char *dstname = NULL;
+static const char *srcname = NULL;
+static int source_open_flag = O_RDONLY;	/* open flags on source file */
+static int dest_open_flag = O_WRONLY;	/* open flags on dest file */
+static int no_write;			/* do not write */
+static int zero;			/* write zero's only */
+
+static int debug;
+static int count_io_q_waits;	/* how many time io_queue_wait called */
+
+struct iocb **iocb_free;	/* array of pointers to iocb */
+int iocb_free_count;		/* current free count */
+int alignment = 512;		/* buffer alignment */
+
+struct timeval delay;		/* delay between i/o */
+
+int init_iocb(int n, int iosize)
+{
+	void *buf;
+	int i;
+
+	if ((iocb_free = malloc(n * sizeof(struct iocb *))) == 0) {
+		return -1;
+	}
+
+	for (i = 0; i < n; i++) {
+		if (!(iocb_free[i] = (struct iocb *) malloc(sizeof(struct iocb))))
+			return -1;
+		if (posix_memalign(&buf, alignment, iosize))
+			return -1;
+		if (debug > 1) {
+			printf("buf allocated at 0x%p, align:%d\n",
+					buf, alignment);
+		}
+		if (zero) {
+			/*
+			 * We are writing zero's to dstfd
+			 */
+			memset(buf, 0, iosize);
+		}
+		io_prep_pread(iocb_free[i], -1, buf, iosize, 0);
+	}
+	iocb_free_count = i;
+	return 0;
+}
+
+struct iocb *alloc_iocb()
+{
+	if (!iocb_free_count)
+		return 0;
+	return iocb_free[--iocb_free_count];
+}
+
+void free_iocb(struct iocb *io)
+{
+	iocb_free[iocb_free_count++] = io;
+}
+
+/*
+ * io_wait_run() - wait for an io_event and then call the callback.
+ */
+int io_wait_run(io_context_t ctx, struct timespec *to)
+{
+	struct io_event events[aio_maxio];
+	struct io_event *ep;
+	int ret, n;
+
+	/*
+	 * get up to aio_maxio events at a time.
+	 */
+	ret = n = io_getevents(ctx, 1, aio_maxio, events, to);
+
+	/*
+	 * Call the callback functions for each event.
+	 */
+	for (ep = events; n-- > 0; ep++) {
+		io_callback_t cb = (io_callback_t)ep->data;
+		struct iocb *iocb = (struct iocb *)ep->obj;
+
+		cb(ctx, iocb, ep->res, ep->res2);
+	}
+	return ret;
+}
+
+/* Fatal error handler */
+static void io_error(const char *func, int rc)
+{
+	if (rc == -ENOSYS)
+		fprintf(stderr, "AIO not in this kernel\n");
+	else if (rc < 0)
+		fprintf(stderr, "%s: %s\n", func, strerror(-rc));
+	else
+		fprintf(stderr, "%s: error %d\n", func, rc);
+
+	if (dstfd > 0)
+		close(dstfd);
+	if (dstname && dest_open_flag & O_CREAT)
+		unlink(dstname);
+	exit(1);
+}
+
+/*
+ * Write complete callback.
+ * Adjust counts and free resources
+ */
+static void wr_done(io_context_t ctx, struct iocb *iocb, long res, long res2)
+{
+	if (res2 != 0) {
+		io_error("aio write", res2);
+	}
+	if (res != iocb->u.c.nbytes) {
+		fprintf(stderr, "write missed bytes expect %lu got %ld\n",
+			iocb->u.c.nbytes, res2);
+		exit(1);
+	}
+	--tocopy;
+	--busy;
+	free_iocb(iocb);
+	if (debug)
+		write(2, "w", 1);
+}
+
+/*
+ * Read complete callback.
+ * Change read iocb into a write iocb and start it.
+ */
+static void rd_done(io_context_t ctx, struct iocb *iocb, long res, long res2)
+{
+	/* library needs accessors to look at iocb? */
+	int iosize = iocb->u.c.nbytes;
+	char *buf = iocb->u.c.buf;
+	off_t offset = iocb->u.c.offset;
+
+	if (res2 != 0)
+		io_error("aio read", res2);
+	if (res != iosize) {
+		fprintf(stderr, "read missing bytes expect %lu got %ld\n",
+			iocb->u.c.nbytes, res);
+		exit(1);
+	}
+
+
+	/* turn read into write */
+	if (no_write) {
+		--tocopy;
+		--busy;
+		free_iocb(iocb);
+	} else {
+		io_prep_pwrite(iocb, dstfd, buf, iosize, offset);
+		io_set_callback(iocb, wr_done);
+		if (1 != (res = io_submit(ctx, 1, &iocb)))
+			io_error("io_submit write", res);
+	}
+	if (debug)
+		write(2, "r", 1);
+	if (debug > 1)
+		printf("%d", iosize);
+}
+
+void usage()
+{
+	fprintf(stderr,
+		"Usage: aiocp [-a align] [-s size] [-b blksize] [-n num_io]"
+		" [-f open_flag] SOURCE DEST\n"
+		"This copies from SOURCE to DEST using AIO.\n\n"
+		"Usage: aiocp [options] -w SOURCE\n"
+		"This does sequential AIO reads (no writes).\n\n"
+		"Usage: aiocp [options] -z DEST\n"
+		"This does sequential AIO writes of zeros.\n");
+		
+	exit(1);
+}
+
+/*
+ * Scale value by kilo, mega, or giga.
+ */
+long long scale_by_kmg(long long value, char scale)
+{
+	switch (scale) {
+	case 'g':
+	case 'G':
+		value *= 1024;
+	case 'm':
+	case 'M':
+		value *= 1024;
+	case 'k':
+	case 'K':
+		value *= 1024;
+		break;
+	case '\0':
+		break;
+	default:
+		usage();
+		break;
+	}
+	return value;
+}
+
+int main(int argc, char *const *argv)
+{
+	struct stat st;
+	off_t length = 0, offset = 0;
+	io_context_t myctx;
+	int c;
+	extern char *optarg;
+	extern int optind, opterr, optopt;
+
+	while ((c = getopt(argc, argv, "a:b:df:n:s:wzD:")) != -1) {
+		char *endp;
+
+		switch (c) {
+		case 'a':	/* alignment of data buffer */
+			alignment = strtol(optarg, &endp, 0);
+			alignment = (long)scale_by_kmg((long long)alignment,
+							*endp);
+			break;
+		case 'f':	/* use these open flags */
+			if (strcmp(optarg, "LARGEFILE") == 0 ||
+			    strcmp(optarg, "O_LARGEFILE") == 0) {
+				source_open_flag |= O_LARGEFILE;
+				dest_open_flag |= O_LARGEFILE;
+			} else if (strcmp(optarg, "TRUNC") == 0 ||
+			           strcmp(optarg, "O_TRUNC") == 0) {
+				dest_open_flag |= O_TRUNC;
+			} else if (strcmp(optarg, "SYNC") == 0 ||
+				   strcmp(optarg, "O_SYNC") == 0) {
+				dest_open_flag |= O_SYNC | O_NONBLOCK;
+			} else if (strcmp(optarg, "DIRECT") == 0 ||
+				   strcmp(optarg, "O_DIRECT") == 0) {
+				source_open_flag |= O_DIRECT;
+				dest_open_flag |= O_DIRECT;
+			} else if (strncmp(optarg, "CREAT", 5) == 0 ||
+				   strncmp(optarg, "O_CREAT", 5) == 0) {
+				dest_open_flag |= O_CREAT;
+			}
+			break;
+		case 'd':
+			debug++;
+			break;
+		case 'D':
+			delay.tv_usec = atoi(optarg);
+			break;
+		case 'b':	/* block size */
+			aio_blksize = strtol(optarg, &endp, 0);
+			aio_blksize = (long)scale_by_kmg((long long)aio_blksize, *endp);
+			break;
+
+		case 'n':	/* num io */
+			aio_maxio = strtol(optarg, &endp, 0);
+			break;
+		case 's':	/* size to transfer */
+			length = strtoll(optarg, &endp, 0);
+			length = scale_by_kmg(length, *endp);
+			break;
+		case 'w':	/* no write */
+			no_write = 1;
+			break;
+		case 'z':	/* write zero's */
+			zero = 1;
+			break;
+
+		default:
+			usage();
+		}
+	}
+
+	argc -= optind;
+	argv += optind;
+	
+#ifndef DEBUG
+	if (argc < 1) {
+		usage();
+	}
+#else
+    source_open_flag |= O_DIRECT;
+    dest_open_flag |= O_DIRECT;
+    aio_blksize = 1;
+    aio_maxio=1;
+    srcname = "junkdata";
+    dstname = "ff2";
+#endif
+	if (!zero) {
+#ifndef DEBUG
+	       	if ((srcfd = open(srcname = *argv, source_open_flag)) < 0) {
+#else
+                if ((srcfd = open(srcname, source_open_flag)) < 0) {
+#endif
+			perror(srcname);
+			exit(1);
+		}
+		argv++;
+		argc--;
+		if (fstat(srcfd, &st) < 0) {
+			perror("fstat");
+			exit(1);
+		}
+		if (length == 0)
+			length = st.st_size;
+	}
+
+	if (!no_write) {
+		/*
+		 * We are either copying or writing zeros to dstname
+		 */
+#ifndef DEBUG
+		if (argc < 1) {
+			usage();
+		}
+		if ((dstfd = open(dstname = *argv, dest_open_flag, 0666)) < 0) {
+#else
+            if ((dstfd = open(dstname, dest_open_flag, 0666)) < 0) {
+#endif
+			perror(dstname);
+			exit(1);
+		}
+		if (zero) {
+			/*
+			 * get size of dest, if we are zeroing it.
+			 * TODO: handle devices.
+			 */
+			if (fstat(dstfd, &st) < 0) {
+				perror("fstat");
+				exit(1);
+			}
+			if (length == 0)
+				length = st.st_size;
+		}
+	}
+
+	/* initialize state machine */
+	memset(&myctx, 0, sizeof(myctx));
+	io_queue_init(aio_maxio, &myctx);
+	tocopy = howmany(length, aio_blksize);
+printf("tocopy=%d len=%d blk=%d\n", tocopy, length, aio_blksize);
+	if (init_iocb(aio_maxio, aio_blksize) < 0) {
+		fprintf(stderr, "Error allocating the i/o buffers\n");
+		exit(1);
+	}
+
+	while (tocopy > 0) {
+		int i, rc;
+		/* Submit as many reads as once as possible upto aio_maxio */
+		int n = MIN(MIN(aio_maxio - busy, aio_maxio),
+				howmany(length - offset, aio_blksize));
+		if (n > 0) {
+			struct iocb *ioq[n];
+
+			for (i = 0; i < n; i++) {
+				struct iocb *io = alloc_iocb();
+				int iosize = MIN(length - offset, aio_blksize);
+
+				if (zero) {
+					/*
+					 * We are writing zero's to dstfd
+					 */
+					io_prep_pwrite(io, dstfd, io->u.c.buf,
+							iosize, offset);
+					io_set_callback(io, wr_done);
+				} else {
+					io_prep_pread(io, srcfd, io->u.c.buf,
+							iosize, offset);
+					io_set_callback(io, rd_done);
+				}
+				ioq[i] = io;
+				offset += iosize;
+			}
+
+			rc = io_submit(myctx, n, ioq);
+			if (rc < 0)
+				io_error("io_submit", rc);
+
+			busy += n;
+			if (debug > 1)
+				printf("io_submit(%d) busy:%d\n", n, busy);
+			if (delay.tv_usec) {
+				struct timeval t = delay;
+				(void)select(0,0,0,0,&t);
+			}
+		}
+
+		/*
+		 * We have submitted all the i/o requests. Wait for at least one to complete
+		 * and call the callbacks.
+		 */
+		count_io_q_waits++;
+		rc = io_wait_run(myctx, 0);
+		if (rc < 0)
+			io_error("io_wait_run", rc);
+
+		if (debug > 1) {
+			printf("io_wait_run: rc == %d\n", rc);
+			printf("busy:%d aio_maxio:%d tocopy:%d\n",
+					busy, aio_maxio, tocopy);
+		}
+	}
+
+	if (srcfd != -1)
+		close(srcfd);
+	if (dstfd != -1)
+		close(dstfd);
+	exit(0);
+}
+
+/* 
+ * Results look like:
+ * [alanm@toolbox ~/MOT3]$ ../taio -d kernel-source-2.4.8-0.4g.ppc.rpm abc
+ * rrrrrrrrrrrrrrrwwwrwrrwwrrwrwwrrwrwrwwrrwrwrrrrwwrwwwrrwrrrwwwwwwwwwwwwwwwww
+ * rrrrrrrrrrrrrrwwwrrwrwrwrwrrwwwwwwwwwwwwwwrrrrrrrrrrrrrrrrrrwwwwrwrwwrwrwrwr
+ * wrrrrrrrwwwwwwwwwwwwwrrrwrrrwrrwrwwwwwwwwwwrrrrwwrwrrrrrrrrrrrwwwwwwwwwwwrww
+ * wwwrrrrrrrrwwrrrwwrwrwrwwwrrrrrrrwwwrrwwwrrwrwwwwwwwwrrrrrrrwwwrrrrrrrwwwwww
+ * wwwwwwwrwrrrrrrrrwrrwrrwrrwrwrrrwrrrwrrrwrwwwwwwwwwwwwwwwwwwrrrwwwrrrrrrrrrr
+ * rrwrrrrrrwrrwwwwwwwwwwwwwwwwrwwwrrwrwwrrrrrrrrrrrrrrrrrrrwwwwwwwwwwwwwwwwwww
+ * rrrrrwrrwrwrwrrwrrrwwwwwwwwrrrrwrrrwrwwrwrrrwrrwrrrrwwwwwwwrwrwwwwrwwrrrwrrr
+ * rrrwwwwwwwrrrrwwrrrrrrrrrrrrwrwrrrrwwwwwwwwwwwwwwrwrrrrwwwwrwrrrrwrwwwrrrwww
+ * rwwrrrrrrrwrrrrrrrrrrrrwwwwrrrwwwrwrrwwwwwwwwwwwwwwwwwwwwwrrrrrrrwwwwwwwrw
+ */
diff --git a/tests/generic/250 b/tests/generic/250
new file mode 100755
index 0000000..b0b175a
--- /dev/null
+++ b/tests/generic/250
@@ -0,0 +1,100 @@
+#! /bin/bash
+# FS QA Test No. 250
+#
+# Create an unwritten extent, set up dm-error, try a DIO write, then
+# make sure we can't read back old disk contents.
+#
+#-----------------------------------------------------------------------
+# 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.* $testdir
+    _dmerror_cleanup
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+. ./common/dmerror
+
+# real QA test starts here
+_supported_os Linux
+_require_scratch
+_require_dm_target error
+_require_xfs_io_command "falloc"
+
+rm -f $seqres.full
+
+
+echo "Format and mount"
+$XFS_IO_PROG -d -c "pwrite -S 0x69 -b 1048576 0 $((64 * 1048576))" $SCRATCH_DEV >> $seqres.full
+_scratch_mkfs_sized $((64 * 1048576)) > $seqres.full 2>&1
+_dmerror_init
+_dmerror_mount >> $seqres.full 2>&1
+_dmerror_unmount
+_dmerror_mount
+
+testdir=$SCRATCH_MNT/test-$seq
+mkdir $testdir
+
+blksz=65536
+nr=640
+bufnr=128
+filesize=$((blksz * nr))
+bufsize=$((blksz * bufnr))
+
+_require_fs_space $SCRATCH_MNT $((filesize / 1024 * 5 / 4))
+
+echo "Create the original files"
+$XFS_IO_PROG -f -c "falloc 0 $filesize" $testdir/file2 >> $seqres.full
+_dmerror_unmount
+_dmerror_mount
+
+echo "Compare files"
+md5sum $testdir/file2 | _filter_scratch
+
+echo "CoW and unmount"
+$XFS_IO_PROG -f -c "pwrite -S 0x63 $bufsize 1" $testdir/file2 >> $seqres.full
+sync
+_dmerror_load_error_table
+$XFS_IO_PROG -d -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" $testdir/file2 >> $seqres.full
+_dmerror_load_working_table
+_dmerror_unmount
+_dmerror_mount
+
+echo "Compare files"
+md5sum $testdir/file2 | _filter_scratch
+
+echo "Check for damage"
+_dmerror_unmount
+_dmerror_cleanup
+_repair_scratch_fs >> $seqres.full
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/250.out b/tests/generic/250.out
new file mode 100644
index 0000000..710c80e
--- /dev/null
+++ b/tests/generic/250.out
@@ -0,0 +1,10 @@
+QA output created by 250
+Format and mount
+Create the original files
+Compare files
+ec8bb3b24d5b0f1b5bdf8c8f0f541ee6  SCRATCH_MNT/test-250/file2
+CoW and unmount
+pwrite64: Input/output error
+Compare files
+3ed86318f4ff8da26c1c2a6e3041f9be  SCRATCH_MNT/test-250/file2
+Check for damage
diff --git a/tests/generic/252 b/tests/generic/252
new file mode 100755
index 0000000..fc9a723
--- /dev/null
+++ b/tests/generic/252
@@ -0,0 +1,103 @@
+#! /bin/bash
+# FS QA Test No. 252
+#
+# Create an unwritten extent, set up dm-error, try an AIO DIO write, then
+# make sure we can't read back old disk contents.
+#
+#-----------------------------------------------------------------------
+# 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.* $testdir $TEST_DIR/moo
+    _dmerror_cleanup
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+. ./common/dmerror
+
+# real QA test starts here
+_supported_os Linux
+_require_scratch
+_require_dm_target error
+_require_xfs_io_command "falloc"
+_require_test_program "aio-dio-regress/aiocp"
+AIO_TEST="src/aio-dio-regress/aiocp"
+
+rm -f $seqres.full
+
+
+echo "Format and mount"
+$XFS_IO_PROG -d -c "pwrite -S 0x69 -b 1048576 0 $((64 * 1048576))" $SCRATCH_DEV >> $seqres.full
+_scratch_mkfs_sized $((64 * 1048576)) > $seqres.full 2>&1
+_dmerror_init
+_dmerror_mount >> $seqres.full 2>&1
+_dmerror_unmount
+_dmerror_mount
+
+testdir=$SCRATCH_MNT/test-$seq
+mkdir $testdir
+
+blksz=65536
+nr=640
+bufnr=128
+filesize=$((blksz * nr))
+bufsize=$((blksz * bufnr))
+
+_require_fs_space $SCRATCH_MNT $((filesize / 1024 * 5 / 4))
+
+echo "Create the original files"
+$XFS_IO_PROG -f -c "falloc 0 $filesize" $testdir/file2 >> $seqres.full
+_dmerror_unmount
+_dmerror_mount
+
+echo "Compare files"
+md5sum $testdir/file2 | _filter_scratch
+
+echo "CoW and unmount"
+$XFS_IO_PROG -f -c "pwrite -S 0x63 $bufsize 1" $testdir/file2 >> $seqres.full
+$XFS_IO_PROG -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" $TEST_DIR/moo >> $seqres.full
+sync
+_dmerror_load_error_table
+$AIO_TEST -f DIRECT -b $bufsize $TEST_DIR/moo $testdir/file2 >> $seqres.full
+_dmerror_load_working_table
+_dmerror_unmount
+_dmerror_mount
+
+echo "Compare files"
+md5sum $testdir/file2 | _filter_scratch
+
+echo "Check for damage"
+_dmerror_unmount
+_dmerror_cleanup
+_repair_scratch_fs >> $seqres.full
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/252.out b/tests/generic/252.out
new file mode 100644
index 0000000..3bc78c2
--- /dev/null
+++ b/tests/generic/252.out
@@ -0,0 +1,10 @@
+QA output created by 252
+Format and mount
+Create the original files
+Compare files
+ec8bb3b24d5b0f1b5bdf8c8f0f541ee6  SCRATCH_MNT/test-252/file2
+CoW and unmount
+write missed bytes expect 8388608 got 0
+Compare files
+3ed86318f4ff8da26c1c2a6e3041f9be  SCRATCH_MNT/test-252/file2
+Check for damage
diff --git a/tests/generic/group b/tests/generic/group
index 860ff4a..0e4e7d3 100644
--- a/tests/generic/group
+++ b/tests/generic/group
@@ -252,7 +252,9 @@
 247 auto quick rw
 248 auto quick rw
 249 auto quick rw
+250 auto quick prealloc rw
 251 ioctl trim
+252 auto quick prealloc rw
 255 auto quick prealloc
 256 auto quick
 257 dir auto quick


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

* [PATCH 12/32] dio: unwritten conversion bug tests
@ 2016-02-11 23:40   ` Darrick J. Wong
  0 siblings, 0 replies; 81+ messages in thread
From: Darrick J. Wong @ 2016-02-11 23:40 UTC (permalink / raw)
  To: david, darrick.wong; +Cc: fstests, linux-btrfs, xfs

Check that we don't expose old disk contents when a directio write to
an unwritten extent fails due to IO errors.  This primarily affects
XFS and ext4.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 .gitignore                  |    1 
 src/aio-dio-regress/aiocp.c |  489 +++++++++++++++++++++++++++++++++++++++++++
 tests/generic/250           |  100 +++++++++
 tests/generic/250.out       |   10 +
 tests/generic/252           |  103 +++++++++
 tests/generic/252.out       |   10 +
 tests/generic/group         |    2 
 7 files changed, 715 insertions(+)
 create mode 100644 src/aio-dio-regress/aiocp.c
 create mode 100755 tests/generic/250
 create mode 100644 tests/generic/250.out
 create mode 100755 tests/generic/252
 create mode 100644 tests/generic/252.out


diff --git a/.gitignore b/.gitignore
index a6f47d3..bbe7c1a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -112,6 +112,7 @@
 /src/aio-dio-regress/aio-free-ring-with-bogus-nr-pages
 /src/aio-dio-regress/aio-io-setup-with-nonwritable-context-pointer
 /src/aio-dio-regress/aio-last-ref-held-by-io
+/src/aio-dio-regress/aiocp
 /src/aio-dio-regress/aiodio_sparse2
 /src/aio-dio-regress/aio-dio-eof-race
 /src/cloner
diff --git a/src/aio-dio-regress/aiocp.c b/src/aio-dio-regress/aiocp.c
new file mode 100644
index 0000000..1abff9c
--- /dev/null
+++ b/src/aio-dio-regress/aiocp.c
@@ -0,0 +1,489 @@
+/*
+ * Copyright (c) 2004 Daniel McNeil <daniel@osdl.org>
+ *               2004 Open Source Development Lab
+ *   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; either version 2 of the License, or
+ *   (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will 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 to the Free Software
+ *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * Module: .c
+ */
+
+/*
+ * Change History:
+ *
+ *
+ * version of copy command using async i/o
+ * From:	Stephen Hemminger <shemminger@osdl.org>
+ * Modified by Daniel McNeil <daniel@osdl.org> for testing aio.
+ *	- added -a alignment
+ *	- added -b blksize option 
+ *	_ added -s size	option
+ *	- added -f open_flag option
+ *	- added -w (no write) option (reads from source only)
+ *	- added -n (num aio) option 
+ *	- added -z (zero dest) opton (writes zeros to dest only)
+ *	- added -D delay_ms option
+ *  - 2/2004  Marty Ridgeway (mridge@us.ibm.com) Changes to adapt to LTP
+ *
+ * Copy file by using a async I/O state machine.
+ * 1. Start read request
+ * 2. When read completes turn it into a write request
+ * 3. When write completes decrement counter and free resources
+ *
+ *
+ * Usage: aiocp [-b blksize] -n [num_aio] [-w] [-z] [-s filesize] 
+ *		[-f DIRECT|TRUNC|CREAT|SYNC|LARGEFILE] src dest
+ */
+
+//#define _GNU_SOURCE
+//#define DEBUG 1
+#undef DEBUG
+
+#include <unistd.h>
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <sys/param.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <stdlib.h>
+#include <sys/select.h>
+
+#include <libaio.h>
+
+#define AIO_BLKSIZE	(64*1024)
+#define AIO_MAXIO	32
+
+static int aio_blksize = AIO_BLKSIZE;
+static int aio_maxio = AIO_MAXIO;
+
+static int busy = 0;		// # of I/O's in flight
+static int tocopy = 0;		// # of blocks left to copy
+static int srcfd;		// source fd
+static int dstfd = -1;		// destination file descriptor
+static const char *dstname = NULL;
+static const char *srcname = NULL;
+static int source_open_flag = O_RDONLY;	/* open flags on source file */
+static int dest_open_flag = O_WRONLY;	/* open flags on dest file */
+static int no_write;			/* do not write */
+static int zero;			/* write zero's only */
+
+static int debug;
+static int count_io_q_waits;	/* how many time io_queue_wait called */
+
+struct iocb **iocb_free;	/* array of pointers to iocb */
+int iocb_free_count;		/* current free count */
+int alignment = 512;		/* buffer alignment */
+
+struct timeval delay;		/* delay between i/o */
+
+int init_iocb(int n, int iosize)
+{
+	void *buf;
+	int i;
+
+	if ((iocb_free = malloc(n * sizeof(struct iocb *))) == 0) {
+		return -1;
+	}
+
+	for (i = 0; i < n; i++) {
+		if (!(iocb_free[i] = (struct iocb *) malloc(sizeof(struct iocb))))
+			return -1;
+		if (posix_memalign(&buf, alignment, iosize))
+			return -1;
+		if (debug > 1) {
+			printf("buf allocated at 0x%p, align:%d\n",
+					buf, alignment);
+		}
+		if (zero) {
+			/*
+			 * We are writing zero's to dstfd
+			 */
+			memset(buf, 0, iosize);
+		}
+		io_prep_pread(iocb_free[i], -1, buf, iosize, 0);
+	}
+	iocb_free_count = i;
+	return 0;
+}
+
+struct iocb *alloc_iocb()
+{
+	if (!iocb_free_count)
+		return 0;
+	return iocb_free[--iocb_free_count];
+}
+
+void free_iocb(struct iocb *io)
+{
+	iocb_free[iocb_free_count++] = io;
+}
+
+/*
+ * io_wait_run() - wait for an io_event and then call the callback.
+ */
+int io_wait_run(io_context_t ctx, struct timespec *to)
+{
+	struct io_event events[aio_maxio];
+	struct io_event *ep;
+	int ret, n;
+
+	/*
+	 * get up to aio_maxio events at a time.
+	 */
+	ret = n = io_getevents(ctx, 1, aio_maxio, events, to);
+
+	/*
+	 * Call the callback functions for each event.
+	 */
+	for (ep = events; n-- > 0; ep++) {
+		io_callback_t cb = (io_callback_t)ep->data;
+		struct iocb *iocb = (struct iocb *)ep->obj;
+
+		cb(ctx, iocb, ep->res, ep->res2);
+	}
+	return ret;
+}
+
+/* Fatal error handler */
+static void io_error(const char *func, int rc)
+{
+	if (rc == -ENOSYS)
+		fprintf(stderr, "AIO not in this kernel\n");
+	else if (rc < 0)
+		fprintf(stderr, "%s: %s\n", func, strerror(-rc));
+	else
+		fprintf(stderr, "%s: error %d\n", func, rc);
+
+	if (dstfd > 0)
+		close(dstfd);
+	if (dstname && dest_open_flag & O_CREAT)
+		unlink(dstname);
+	exit(1);
+}
+
+/*
+ * Write complete callback.
+ * Adjust counts and free resources
+ */
+static void wr_done(io_context_t ctx, struct iocb *iocb, long res, long res2)
+{
+	if (res2 != 0) {
+		io_error("aio write", res2);
+	}
+	if (res != iocb->u.c.nbytes) {
+		fprintf(stderr, "write missed bytes expect %lu got %ld\n",
+			iocb->u.c.nbytes, res2);
+		exit(1);
+	}
+	--tocopy;
+	--busy;
+	free_iocb(iocb);
+	if (debug)
+		write(2, "w", 1);
+}
+
+/*
+ * Read complete callback.
+ * Change read iocb into a write iocb and start it.
+ */
+static void rd_done(io_context_t ctx, struct iocb *iocb, long res, long res2)
+{
+	/* library needs accessors to look at iocb? */
+	int iosize = iocb->u.c.nbytes;
+	char *buf = iocb->u.c.buf;
+	off_t offset = iocb->u.c.offset;
+
+	if (res2 != 0)
+		io_error("aio read", res2);
+	if (res != iosize) {
+		fprintf(stderr, "read missing bytes expect %lu got %ld\n",
+			iocb->u.c.nbytes, res);
+		exit(1);
+	}
+
+
+	/* turn read into write */
+	if (no_write) {
+		--tocopy;
+		--busy;
+		free_iocb(iocb);
+	} else {
+		io_prep_pwrite(iocb, dstfd, buf, iosize, offset);
+		io_set_callback(iocb, wr_done);
+		if (1 != (res = io_submit(ctx, 1, &iocb)))
+			io_error("io_submit write", res);
+	}
+	if (debug)
+		write(2, "r", 1);
+	if (debug > 1)
+		printf("%d", iosize);
+}
+
+void usage()
+{
+	fprintf(stderr,
+		"Usage: aiocp [-a align] [-s size] [-b blksize] [-n num_io]"
+		" [-f open_flag] SOURCE DEST\n"
+		"This copies from SOURCE to DEST using AIO.\n\n"
+		"Usage: aiocp [options] -w SOURCE\n"
+		"This does sequential AIO reads (no writes).\n\n"
+		"Usage: aiocp [options] -z DEST\n"
+		"This does sequential AIO writes of zeros.\n");
+		
+	exit(1);
+}
+
+/*
+ * Scale value by kilo, mega, or giga.
+ */
+long long scale_by_kmg(long long value, char scale)
+{
+	switch (scale) {
+	case 'g':
+	case 'G':
+		value *= 1024;
+	case 'm':
+	case 'M':
+		value *= 1024;
+	case 'k':
+	case 'K':
+		value *= 1024;
+		break;
+	case '\0':
+		break;
+	default:
+		usage();
+		break;
+	}
+	return value;
+}
+
+int main(int argc, char *const *argv)
+{
+	struct stat st;
+	off_t length = 0, offset = 0;
+	io_context_t myctx;
+	int c;
+	extern char *optarg;
+	extern int optind, opterr, optopt;
+
+	while ((c = getopt(argc, argv, "a:b:df:n:s:wzD:")) != -1) {
+		char *endp;
+
+		switch (c) {
+		case 'a':	/* alignment of data buffer */
+			alignment = strtol(optarg, &endp, 0);
+			alignment = (long)scale_by_kmg((long long)alignment,
+							*endp);
+			break;
+		case 'f':	/* use these open flags */
+			if (strcmp(optarg, "LARGEFILE") == 0 ||
+			    strcmp(optarg, "O_LARGEFILE") == 0) {
+				source_open_flag |= O_LARGEFILE;
+				dest_open_flag |= O_LARGEFILE;
+			} else if (strcmp(optarg, "TRUNC") == 0 ||
+			           strcmp(optarg, "O_TRUNC") == 0) {
+				dest_open_flag |= O_TRUNC;
+			} else if (strcmp(optarg, "SYNC") == 0 ||
+				   strcmp(optarg, "O_SYNC") == 0) {
+				dest_open_flag |= O_SYNC | O_NONBLOCK;
+			} else if (strcmp(optarg, "DIRECT") == 0 ||
+				   strcmp(optarg, "O_DIRECT") == 0) {
+				source_open_flag |= O_DIRECT;
+				dest_open_flag |= O_DIRECT;
+			} else if (strncmp(optarg, "CREAT", 5) == 0 ||
+				   strncmp(optarg, "O_CREAT", 5) == 0) {
+				dest_open_flag |= O_CREAT;
+			}
+			break;
+		case 'd':
+			debug++;
+			break;
+		case 'D':
+			delay.tv_usec = atoi(optarg);
+			break;
+		case 'b':	/* block size */
+			aio_blksize = strtol(optarg, &endp, 0);
+			aio_blksize = (long)scale_by_kmg((long long)aio_blksize, *endp);
+			break;
+
+		case 'n':	/* num io */
+			aio_maxio = strtol(optarg, &endp, 0);
+			break;
+		case 's':	/* size to transfer */
+			length = strtoll(optarg, &endp, 0);
+			length = scale_by_kmg(length, *endp);
+			break;
+		case 'w':	/* no write */
+			no_write = 1;
+			break;
+		case 'z':	/* write zero's */
+			zero = 1;
+			break;
+
+		default:
+			usage();
+		}
+	}
+
+	argc -= optind;
+	argv += optind;
+	
+#ifndef DEBUG
+	if (argc < 1) {
+		usage();
+	}
+#else
+    source_open_flag |= O_DIRECT;
+    dest_open_flag |= O_DIRECT;
+    aio_blksize = 1;
+    aio_maxio=1;
+    srcname = "junkdata";
+    dstname = "ff2";
+#endif
+	if (!zero) {
+#ifndef DEBUG
+	       	if ((srcfd = open(srcname = *argv, source_open_flag)) < 0) {
+#else
+                if ((srcfd = open(srcname, source_open_flag)) < 0) {
+#endif
+			perror(srcname);
+			exit(1);
+		}
+		argv++;
+		argc--;
+		if (fstat(srcfd, &st) < 0) {
+			perror("fstat");
+			exit(1);
+		}
+		if (length == 0)
+			length = st.st_size;
+	}
+
+	if (!no_write) {
+		/*
+		 * We are either copying or writing zeros to dstname
+		 */
+#ifndef DEBUG
+		if (argc < 1) {
+			usage();
+		}
+		if ((dstfd = open(dstname = *argv, dest_open_flag, 0666)) < 0) {
+#else
+            if ((dstfd = open(dstname, dest_open_flag, 0666)) < 0) {
+#endif
+			perror(dstname);
+			exit(1);
+		}
+		if (zero) {
+			/*
+			 * get size of dest, if we are zeroing it.
+			 * TODO: handle devices.
+			 */
+			if (fstat(dstfd, &st) < 0) {
+				perror("fstat");
+				exit(1);
+			}
+			if (length == 0)
+				length = st.st_size;
+		}
+	}
+
+	/* initialize state machine */
+	memset(&myctx, 0, sizeof(myctx));
+	io_queue_init(aio_maxio, &myctx);
+	tocopy = howmany(length, aio_blksize);
+printf("tocopy=%d len=%d blk=%d\n", tocopy, length, aio_blksize);
+	if (init_iocb(aio_maxio, aio_blksize) < 0) {
+		fprintf(stderr, "Error allocating the i/o buffers\n");
+		exit(1);
+	}
+
+	while (tocopy > 0) {
+		int i, rc;
+		/* Submit as many reads as once as possible upto aio_maxio */
+		int n = MIN(MIN(aio_maxio - busy, aio_maxio),
+				howmany(length - offset, aio_blksize));
+		if (n > 0) {
+			struct iocb *ioq[n];
+
+			for (i = 0; i < n; i++) {
+				struct iocb *io = alloc_iocb();
+				int iosize = MIN(length - offset, aio_blksize);
+
+				if (zero) {
+					/*
+					 * We are writing zero's to dstfd
+					 */
+					io_prep_pwrite(io, dstfd, io->u.c.buf,
+							iosize, offset);
+					io_set_callback(io, wr_done);
+				} else {
+					io_prep_pread(io, srcfd, io->u.c.buf,
+							iosize, offset);
+					io_set_callback(io, rd_done);
+				}
+				ioq[i] = io;
+				offset += iosize;
+			}
+
+			rc = io_submit(myctx, n, ioq);
+			if (rc < 0)
+				io_error("io_submit", rc);
+
+			busy += n;
+			if (debug > 1)
+				printf("io_submit(%d) busy:%d\n", n, busy);
+			if (delay.tv_usec) {
+				struct timeval t = delay;
+				(void)select(0,0,0,0,&t);
+			}
+		}
+
+		/*
+		 * We have submitted all the i/o requests. Wait for at least one to complete
+		 * and call the callbacks.
+		 */
+		count_io_q_waits++;
+		rc = io_wait_run(myctx, 0);
+		if (rc < 0)
+			io_error("io_wait_run", rc);
+
+		if (debug > 1) {
+			printf("io_wait_run: rc == %d\n", rc);
+			printf("busy:%d aio_maxio:%d tocopy:%d\n",
+					busy, aio_maxio, tocopy);
+		}
+	}
+
+	if (srcfd != -1)
+		close(srcfd);
+	if (dstfd != -1)
+		close(dstfd);
+	exit(0);
+}
+
+/* 
+ * Results look like:
+ * [alanm@toolbox ~/MOT3]$ ../taio -d kernel-source-2.4.8-0.4g.ppc.rpm abc
+ * rrrrrrrrrrrrrrrwwwrwrrwwrrwrwwrrwrwrwwrrwrwrrrrwwrwwwrrwrrrwwwwwwwwwwwwwwwww
+ * rrrrrrrrrrrrrrwwwrrwrwrwrwrrwwwwwwwwwwwwwwrrrrrrrrrrrrrrrrrrwwwwrwrwwrwrwrwr
+ * wrrrrrrrwwwwwwwwwwwwwrrrwrrrwrrwrwwwwwwwwwwrrrrwwrwrrrrrrrrrrrwwwwwwwwwwwrww
+ * wwwrrrrrrrrwwrrrwwrwrwrwwwrrrrrrrwwwrrwwwrrwrwwwwwwwwrrrrrrrwwwrrrrrrrwwwwww
+ * wwwwwwwrwrrrrrrrrwrrwrrwrrwrwrrrwrrrwrrrwrwwwwwwwwwwwwwwwwwwrrrwwwrrrrrrrrrr
+ * rrwrrrrrrwrrwwwwwwwwwwwwwwwwrwwwrrwrwwrrrrrrrrrrrrrrrrrrrwwwwwwwwwwwwwwwwwww
+ * rrrrrwrrwrwrwrrwrrrwwwwwwwwrrrrwrrrwrwwrwrrrwrrwrrrrwwwwwwwrwrwwwwrwwrrrwrrr
+ * rrrwwwwwwwrrrrwwrrrrrrrrrrrrwrwrrrrwwwwwwwwwwwwwwrwrrrrwwwwrwrrrrwrwwwrrrwww
+ * rwwrrrrrrrwrrrrrrrrrrrrwwwwrrrwwwrwrrwwwwwwwwwwwwwwwwwwwwwrrrrrrrwwwwwwwrw
+ */
diff --git a/tests/generic/250 b/tests/generic/250
new file mode 100755
index 0000000..b0b175a
--- /dev/null
+++ b/tests/generic/250
@@ -0,0 +1,100 @@
+#! /bin/bash
+# FS QA Test No. 250
+#
+# Create an unwritten extent, set up dm-error, try a DIO write, then
+# make sure we can't read back old disk contents.
+#
+#-----------------------------------------------------------------------
+# 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.* $testdir
+    _dmerror_cleanup
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+. ./common/dmerror
+
+# real QA test starts here
+_supported_os Linux
+_require_scratch
+_require_dm_target error
+_require_xfs_io_command "falloc"
+
+rm -f $seqres.full
+
+
+echo "Format and mount"
+$XFS_IO_PROG -d -c "pwrite -S 0x69 -b 1048576 0 $((64 * 1048576))" $SCRATCH_DEV >> $seqres.full
+_scratch_mkfs_sized $((64 * 1048576)) > $seqres.full 2>&1
+_dmerror_init
+_dmerror_mount >> $seqres.full 2>&1
+_dmerror_unmount
+_dmerror_mount
+
+testdir=$SCRATCH_MNT/test-$seq
+mkdir $testdir
+
+blksz=65536
+nr=640
+bufnr=128
+filesize=$((blksz * nr))
+bufsize=$((blksz * bufnr))
+
+_require_fs_space $SCRATCH_MNT $((filesize / 1024 * 5 / 4))
+
+echo "Create the original files"
+$XFS_IO_PROG -f -c "falloc 0 $filesize" $testdir/file2 >> $seqres.full
+_dmerror_unmount
+_dmerror_mount
+
+echo "Compare files"
+md5sum $testdir/file2 | _filter_scratch
+
+echo "CoW and unmount"
+$XFS_IO_PROG -f -c "pwrite -S 0x63 $bufsize 1" $testdir/file2 >> $seqres.full
+sync
+_dmerror_load_error_table
+$XFS_IO_PROG -d -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" $testdir/file2 >> $seqres.full
+_dmerror_load_working_table
+_dmerror_unmount
+_dmerror_mount
+
+echo "Compare files"
+md5sum $testdir/file2 | _filter_scratch
+
+echo "Check for damage"
+_dmerror_unmount
+_dmerror_cleanup
+_repair_scratch_fs >> $seqres.full
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/250.out b/tests/generic/250.out
new file mode 100644
index 0000000..710c80e
--- /dev/null
+++ b/tests/generic/250.out
@@ -0,0 +1,10 @@
+QA output created by 250
+Format and mount
+Create the original files
+Compare files
+ec8bb3b24d5b0f1b5bdf8c8f0f541ee6  SCRATCH_MNT/test-250/file2
+CoW and unmount
+pwrite64: Input/output error
+Compare files
+3ed86318f4ff8da26c1c2a6e3041f9be  SCRATCH_MNT/test-250/file2
+Check for damage
diff --git a/tests/generic/252 b/tests/generic/252
new file mode 100755
index 0000000..fc9a723
--- /dev/null
+++ b/tests/generic/252
@@ -0,0 +1,103 @@
+#! /bin/bash
+# FS QA Test No. 252
+#
+# Create an unwritten extent, set up dm-error, try an AIO DIO write, then
+# make sure we can't read back old disk contents.
+#
+#-----------------------------------------------------------------------
+# 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.* $testdir $TEST_DIR/moo
+    _dmerror_cleanup
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+. ./common/dmerror
+
+# real QA test starts here
+_supported_os Linux
+_require_scratch
+_require_dm_target error
+_require_xfs_io_command "falloc"
+_require_test_program "aio-dio-regress/aiocp"
+AIO_TEST="src/aio-dio-regress/aiocp"
+
+rm -f $seqres.full
+
+
+echo "Format and mount"
+$XFS_IO_PROG -d -c "pwrite -S 0x69 -b 1048576 0 $((64 * 1048576))" $SCRATCH_DEV >> $seqres.full
+_scratch_mkfs_sized $((64 * 1048576)) > $seqres.full 2>&1
+_dmerror_init
+_dmerror_mount >> $seqres.full 2>&1
+_dmerror_unmount
+_dmerror_mount
+
+testdir=$SCRATCH_MNT/test-$seq
+mkdir $testdir
+
+blksz=65536
+nr=640
+bufnr=128
+filesize=$((blksz * nr))
+bufsize=$((blksz * bufnr))
+
+_require_fs_space $SCRATCH_MNT $((filesize / 1024 * 5 / 4))
+
+echo "Create the original files"
+$XFS_IO_PROG -f -c "falloc 0 $filesize" $testdir/file2 >> $seqres.full
+_dmerror_unmount
+_dmerror_mount
+
+echo "Compare files"
+md5sum $testdir/file2 | _filter_scratch
+
+echo "CoW and unmount"
+$XFS_IO_PROG -f -c "pwrite -S 0x63 $bufsize 1" $testdir/file2 >> $seqres.full
+$XFS_IO_PROG -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" $TEST_DIR/moo >> $seqres.full
+sync
+_dmerror_load_error_table
+$AIO_TEST -f DIRECT -b $bufsize $TEST_DIR/moo $testdir/file2 >> $seqres.full
+_dmerror_load_working_table
+_dmerror_unmount
+_dmerror_mount
+
+echo "Compare files"
+md5sum $testdir/file2 | _filter_scratch
+
+echo "Check for damage"
+_dmerror_unmount
+_dmerror_cleanup
+_repair_scratch_fs >> $seqres.full
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/252.out b/tests/generic/252.out
new file mode 100644
index 0000000..3bc78c2
--- /dev/null
+++ b/tests/generic/252.out
@@ -0,0 +1,10 @@
+QA output created by 252
+Format and mount
+Create the original files
+Compare files
+ec8bb3b24d5b0f1b5bdf8c8f0f541ee6  SCRATCH_MNT/test-252/file2
+CoW and unmount
+write missed bytes expect 8388608 got 0
+Compare files
+3ed86318f4ff8da26c1c2a6e3041f9be  SCRATCH_MNT/test-252/file2
+Check for damage
diff --git a/tests/generic/group b/tests/generic/group
index 860ff4a..0e4e7d3 100644
--- a/tests/generic/group
+++ b/tests/generic/group
@@ -252,7 +252,9 @@
 247 auto quick rw
 248 auto quick rw
 249 auto quick rw
+250 auto quick prealloc rw
 251 ioctl trim
+252 auto quick prealloc rw
 255 auto quick prealloc
 256 auto quick
 257 dir auto quick

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

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

* [PATCH 13/32] reflink: test intersecting CoW and falloc/fpunch/fzero/fcollapse/finsert/ftrunc
  2016-02-11 23:39 ` Darrick J. Wong
@ 2016-02-11 23:40   ` Darrick J. Wong
  -1 siblings, 0 replies; 81+ messages in thread
From: Darrick J. Wong @ 2016-02-11 23:40 UTC (permalink / raw)
  To: david, darrick.wong; +Cc: linux-btrfs, fstests, xfs

Ensure that we correctly handle a CoW operation immediately followed
by a truncate, falloc, fpunch, fzero, fcollapse, and finsert operation
in the middle of the CoW'd region before any flush can occur.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 tests/generic/253     |   90 +++++++++++++++++++++++++++++++++++++++++++++++
 tests/generic/253.out |   12 ++++++
 tests/generic/254     |   90 +++++++++++++++++++++++++++++++++++++++++++++++
 tests/generic/254.out |   12 ++++++
 tests/generic/259     |   90 +++++++++++++++++++++++++++++++++++++++++++++++
 tests/generic/259.out |   12 ++++++
 tests/generic/261     |   90 +++++++++++++++++++++++++++++++++++++++++++++++
 tests/generic/261.out |   12 ++++++
 tests/generic/262     |   93 +++++++++++++++++++++++++++++++++++++++++++++++++
 tests/generic/262.out |   12 ++++++
 tests/generic/264     |   90 +++++++++++++++++++++++++++++++++++++++++++++++
 tests/generic/264.out |   12 ++++++
 tests/generic/group   |    6 +++
 13 files changed, 621 insertions(+)
 create mode 100755 tests/generic/253
 create mode 100644 tests/generic/253.out
 create mode 100755 tests/generic/254
 create mode 100644 tests/generic/254.out
 create mode 100755 tests/generic/259
 create mode 100644 tests/generic/259.out
 create mode 100755 tests/generic/261
 create mode 100644 tests/generic/261.out
 create mode 100755 tests/generic/262
 create mode 100644 tests/generic/262.out
 create mode 100755 tests/generic/264
 create mode 100644 tests/generic/264.out


diff --git a/tests/generic/253 b/tests/generic/253
new file mode 100755
index 0000000..bfb91a3
--- /dev/null
+++ b/tests/generic/253
@@ -0,0 +1,90 @@
+#! /bin/bash
+# FS QA Test No. 253
+#
+# Truncate a file at midway through a CoW region.
+#
+# This test is dependent on the system page size, so we cannot use md5 in
+# the golden output; we can only compare to a check file.
+#
+#-----------------------------------------------------------------------
+# 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
+_require_scratch_reflink
+_require_cp_reflink
+_require_xfs_io_command "truncate"
+
+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
+
+blksz=65536
+nr=4
+filesize=$((blksz * nr))
+
+echo "Create the original files"
+_pwrite_byte 0x61 0 $filesize $testdir/file1 >> $seqres.full
+_cp_reflink $testdir/file1 $testdir/file2 >> $seqres.full
+_pwrite_byte 0x61 0 $filesize $testdir/file2.chk >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file2 | _filter_scratch
+md5sum $testdir/file2.chk | _filter_scratch
+
+echo "CoW and unmount"
+$XFS_IO_PROG -f -c "pwrite -S 0x62 -b $((blksz * 2)) $blksz $((blksz * 2))" -c "truncate $((blksz * 2))" $testdir/file2 >> $seqres.full
+_scratch_remount
+$XFS_IO_PROG -f -c "pwrite -S 0x62 -b $((blksz * 2)) $blksz $((blksz * 2))" -c "truncate $((blksz * 2))" $testdir/file2.chk >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file2 | _filter_scratch
+md5sum $testdir/file2.chk | _filter_scratch
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/253.out b/tests/generic/253.out
new file mode 100644
index 0000000..3364ba0
--- /dev/null
+++ b/tests/generic/253.out
@@ -0,0 +1,12 @@
+QA output created by 253
+Format and mount
+Create the original files
+Compare files
+c946b71bb69c07daf25470742c967e7c  SCRATCH_MNT/test-253/file1
+c946b71bb69c07daf25470742c967e7c  SCRATCH_MNT/test-253/file2
+c946b71bb69c07daf25470742c967e7c  SCRATCH_MNT/test-253/file2.chk
+CoW and unmount
+Compare files
+c946b71bb69c07daf25470742c967e7c  SCRATCH_MNT/test-253/file1
+b5fc98f04b19fa7b2085ec1358c78760  SCRATCH_MNT/test-253/file2
+b5fc98f04b19fa7b2085ec1358c78760  SCRATCH_MNT/test-253/file2.chk
diff --git a/tests/generic/254 b/tests/generic/254
new file mode 100755
index 0000000..f16cdd3
--- /dev/null
+++ b/tests/generic/254
@@ -0,0 +1,90 @@
+#! /bin/bash
+# FS QA Test No. 254
+#
+# Punch a file at midway through a CoW region.
+#
+# This test is dependent on the system page size, so we cannot use md5 in
+# the golden output; we can only compare to a check file.
+#
+#-----------------------------------------------------------------------
+# 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
+_require_scratch_reflink
+_require_cp_reflink
+_require_xfs_io_command "fpunch"
+
+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
+
+blksz=65536
+nr=5
+filesize=$((blksz * nr))
+
+echo "Create the original files"
+_pwrite_byte 0x61 0 $filesize $testdir/file1 >> $seqres.full
+_cp_reflink $testdir/file1 $testdir/file2 >> $seqres.full
+_pwrite_byte 0x61 0 $filesize $testdir/file2.chk >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file2 | _filter_scratch
+md5sum $testdir/file2.chk | _filter_scratch
+
+echo "CoW and unmount"
+$XFS_IO_PROG -f -c "pwrite -S 0x62 -b $((blksz * 3)) $blksz $((blksz * 3))" -c "fpunch $((blksz * 2)) $blksz" $testdir/file2 >> $seqres.full
+_scratch_remount
+$XFS_IO_PROG -f -c "pwrite -S 0x62 -b $((blksz * 3)) $blksz $((blksz * 3))" -c "pwrite -S 0x00 $((blksz * 2)) $blksz" $testdir/file2.chk >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file2 | _filter_scratch
+md5sum $testdir/file2.chk | _filter_scratch
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/254.out b/tests/generic/254.out
new file mode 100644
index 0000000..97a8b5a
--- /dev/null
+++ b/tests/generic/254.out
@@ -0,0 +1,12 @@
+QA output created by 254
+Format and mount
+Create the original files
+Compare files
+17af09af790a9b4c79cddf72f6b642cb  SCRATCH_MNT/test-254/file1
+17af09af790a9b4c79cddf72f6b642cb  SCRATCH_MNT/test-254/file2
+17af09af790a9b4c79cddf72f6b642cb  SCRATCH_MNT/test-254/file2.chk
+CoW and unmount
+Compare files
+17af09af790a9b4c79cddf72f6b642cb  SCRATCH_MNT/test-254/file1
+b9f7a56c2ab90569cb19d8597583c6a6  SCRATCH_MNT/test-254/file2
+b9f7a56c2ab90569cb19d8597583c6a6  SCRATCH_MNT/test-254/file2.chk
diff --git a/tests/generic/259 b/tests/generic/259
new file mode 100755
index 0000000..6718c50
--- /dev/null
+++ b/tests/generic/259
@@ -0,0 +1,90 @@
+#! /bin/bash
+# FS QA Test No. 259
+#
+# fzero a file at midway through a CoW region.
+#
+# This test is dependent on the system page size, so we cannot use md5 in
+# the golden output; we can only compare to a check file.
+#
+#-----------------------------------------------------------------------
+# 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
+_require_scratch_reflink
+_require_cp_reflink
+_require_xfs_io_command "fzero"
+
+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
+
+blksz=65536
+nr=5
+filesize=$((blksz * nr))
+
+echo "Create the original files"
+_pwrite_byte 0x61 0 $filesize $testdir/file1 >> $seqres.full
+_cp_reflink $testdir/file1 $testdir/file2 >> $seqres.full
+_pwrite_byte 0x61 0 $filesize $testdir/file2.chk >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file2 | _filter_scratch
+md5sum $testdir/file2.chk | _filter_scratch
+
+echo "CoW and unmount"
+$XFS_IO_PROG -f -c "pwrite -S 0x62 -b $((blksz * 3)) $blksz $((blksz * 3))" -c "fzero $((blksz * 2)) $blksz" $testdir/file2 >> $seqres.full
+_scratch_remount
+$XFS_IO_PROG -f -c "pwrite -S 0x62 -b $((blksz * 3)) $blksz $((blksz * 3))" -c "pwrite -S 0x00 $((blksz * 2)) $blksz" $testdir/file2.chk >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file2 | _filter_scratch
+md5sum $testdir/file2.chk | _filter_scratch
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/259.out b/tests/generic/259.out
new file mode 100644
index 0000000..3517fb1
--- /dev/null
+++ b/tests/generic/259.out
@@ -0,0 +1,12 @@
+QA output created by 259
+Format and mount
+Create the original files
+Compare files
+17af09af790a9b4c79cddf72f6b642cb  SCRATCH_MNT/test-259/file1
+17af09af790a9b4c79cddf72f6b642cb  SCRATCH_MNT/test-259/file2
+17af09af790a9b4c79cddf72f6b642cb  SCRATCH_MNT/test-259/file2.chk
+CoW and unmount
+Compare files
+17af09af790a9b4c79cddf72f6b642cb  SCRATCH_MNT/test-259/file1
+b9f7a56c2ab90569cb19d8597583c6a6  SCRATCH_MNT/test-259/file2
+b9f7a56c2ab90569cb19d8597583c6a6  SCRATCH_MNT/test-259/file2.chk
diff --git a/tests/generic/261 b/tests/generic/261
new file mode 100755
index 0000000..28d0e0b
--- /dev/null
+++ b/tests/generic/261
@@ -0,0 +1,90 @@
+#! /bin/bash
+# FS QA Test No. 261
+#
+# fcollapse a file at midway through a CoW region.
+#
+# This test is dependent on the system page size, so we cannot use md5 in
+# the golden output; we can only compare to a check file.
+#
+#-----------------------------------------------------------------------
+# 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
+_require_scratch_reflink
+_require_cp_reflink
+_require_xfs_io_command "fcollapse"
+
+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
+
+blksz=65536
+nr=5
+filesize=$((blksz * nr))
+
+echo "Create the original files"
+_pwrite_byte 0x61 0 $filesize $testdir/file1 >> $seqres.full
+_cp_reflink $testdir/file1 $testdir/file2 >> $seqres.full
+_pwrite_byte 0x61 0 $filesize $testdir/file2.chk >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file2 | _filter_scratch
+md5sum $testdir/file2.chk | _filter_scratch
+
+echo "CoW and unmount"
+$XFS_IO_PROG -f -c "pwrite -S 0x62 -b $((blksz * 3)) $blksz $((blksz * 3))" -c "fcollapse $((blksz * 2)) $blksz" $testdir/file2 >> $seqres.full
+_scratch_remount
+$XFS_IO_PROG -f -c "pwrite -S 0x62 -b $((blksz * 2)) $blksz $((blksz * 2))" -c "truncate $((blksz * (nr - 1)))" $testdir/file2.chk >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file2 | _filter_scratch
+md5sum $testdir/file2.chk | _filter_scratch
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/261.out b/tests/generic/261.out
new file mode 100644
index 0000000..43691ad
--- /dev/null
+++ b/tests/generic/261.out
@@ -0,0 +1,12 @@
+QA output created by 261
+Format and mount
+Create the original files
+Compare files
+17af09af790a9b4c79cddf72f6b642cb  SCRATCH_MNT/test-261/file1
+17af09af790a9b4c79cddf72f6b642cb  SCRATCH_MNT/test-261/file2
+17af09af790a9b4c79cddf72f6b642cb  SCRATCH_MNT/test-261/file2.chk
+CoW and unmount
+Compare files
+17af09af790a9b4c79cddf72f6b642cb  SCRATCH_MNT/test-261/file1
+91b31bb8bffa8c3d3374445039287226  SCRATCH_MNT/test-261/file2
+91b31bb8bffa8c3d3374445039287226  SCRATCH_MNT/test-261/file2.chk
diff --git a/tests/generic/262 b/tests/generic/262
new file mode 100755
index 0000000..aaf38cf
--- /dev/null
+++ b/tests/generic/262
@@ -0,0 +1,93 @@
+#! /bin/bash
+# FS QA Test No. 262
+#
+# finsert a file at midway through a CoW region.
+#
+# This test is dependent on the system page size, so we cannot use md5 in
+# the golden output; we can only compare to a check file.
+#
+#-----------------------------------------------------------------------
+# 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
+_require_scratch_reflink
+_require_cp_reflink
+_require_xfs_io_command "finsert"
+
+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
+
+blksz=65536
+nr=4
+filesize=$((blksz * nr))
+
+echo "Create the original files"
+_pwrite_byte 0x61 0 $filesize $testdir/file1 >> $seqres.full
+_cp_reflink $testdir/file1 $testdir/file2 >> $seqres.full
+_pwrite_byte 0x61 0 $filesize $testdir/file2.chk >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file2 | _filter_scratch
+md5sum $testdir/file2.chk | _filter_scratch
+
+echo "CoW and unmount"
+$XFS_IO_PROG -f -c "pwrite -S 0x62 -b $((blksz * 2)) $blksz $((blksz * 2))" -c "finsert $((blksz * 2)) $blksz" $testdir/file2 >> $seqres.full
+_scratch_remount
+_pwrite_byte 0x62 $blksz $blksz $testdir/file2.chk >> $seqres.full
+_pwrite_byte 0x00 $((blksz * 2)) $blksz $testdir/file2.chk >> $seqres.full
+_pwrite_byte 0x62 $((blksz * 3)) $blksz $testdir/file2.chk >> $seqres.full
+_pwrite_byte 0x61 $((blksz * 4)) $blksz $testdir/file2.chk >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file2 | _filter_scratch
+md5sum $testdir/file2.chk | _filter_scratch
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/262.out b/tests/generic/262.out
new file mode 100644
index 0000000..32c7503
--- /dev/null
+++ b/tests/generic/262.out
@@ -0,0 +1,12 @@
+QA output created by 262
+Format and mount
+Create the original files
+Compare files
+c946b71bb69c07daf25470742c967e7c  SCRATCH_MNT/test-262/file1
+c946b71bb69c07daf25470742c967e7c  SCRATCH_MNT/test-262/file2
+c946b71bb69c07daf25470742c967e7c  SCRATCH_MNT/test-262/file2.chk
+CoW and unmount
+Compare files
+c946b71bb69c07daf25470742c967e7c  SCRATCH_MNT/test-262/file1
+b9f7a56c2ab90569cb19d8597583c6a6  SCRATCH_MNT/test-262/file2
+b9f7a56c2ab90569cb19d8597583c6a6  SCRATCH_MNT/test-262/file2.chk
diff --git a/tests/generic/264 b/tests/generic/264
new file mode 100755
index 0000000..d5bcca6
--- /dev/null
+++ b/tests/generic/264
@@ -0,0 +1,90 @@
+#! /bin/bash
+# FS QA Test No. 264
+#
+# fallocate a file at midway through a CoW region.
+#
+# This test is dependent on the system page size, so we cannot use md5 in
+# the golden output; we can only compare to a check file.
+#
+#-----------------------------------------------------------------------
+# 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
+_require_scratch_reflink
+_require_cp_reflink
+_require_xfs_io_command "falloc"
+
+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
+
+blksz=65536
+nr=5
+filesize=$((blksz * nr))
+
+echo "Create the original files"
+_pwrite_byte 0x61 0 $filesize $testdir/file1 >> $seqres.full
+_cp_reflink $testdir/file1 $testdir/file2 >> $seqres.full
+_pwrite_byte 0x61 0 $filesize $testdir/file2.chk >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file2 | _filter_scratch
+md5sum $testdir/file2.chk | _filter_scratch
+
+echo "CoW and unmount"
+$XFS_IO_PROG -f -c "pwrite -S 0x62 -b $((blksz * 3)) $blksz $((blksz * 3))" -c "falloc $((blksz * 2)) $blksz" $testdir/file2 >> $seqres.full
+_scratch_remount
+$XFS_IO_PROG -f -c "pwrite -S 0x62 -b $((blksz * 3)) $blksz $((blksz * 3))" $testdir/file2.chk >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file2 | _filter_scratch
+md5sum $testdir/file2.chk | _filter_scratch
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/264.out b/tests/generic/264.out
new file mode 100644
index 0000000..cd6904b
--- /dev/null
+++ b/tests/generic/264.out
@@ -0,0 +1,12 @@
+QA output created by 264
+Format and mount
+Create the original files
+Compare files
+17af09af790a9b4c79cddf72f6b642cb  SCRATCH_MNT/test-264/file1
+17af09af790a9b4c79cddf72f6b642cb  SCRATCH_MNT/test-264/file2
+17af09af790a9b4c79cddf72f6b642cb  SCRATCH_MNT/test-264/file2.chk
+CoW and unmount
+Compare files
+17af09af790a9b4c79cddf72f6b642cb  SCRATCH_MNT/test-264/file1
+3383b9c17e643acd1a9a249cf041e183  SCRATCH_MNT/test-264/file2
+3383b9c17e643acd1a9a249cf041e183  SCRATCH_MNT/test-264/file2.chk
diff --git a/tests/generic/group b/tests/generic/group
index 0e4e7d3..b768882 100644
--- a/tests/generic/group
+++ b/tests/generic/group
@@ -255,12 +255,18 @@
 250 auto quick prealloc rw
 251 ioctl trim
 252 auto quick prealloc rw
+253 auto quick clone
+254 auto quick clone
 255 auto quick prealloc
 256 auto quick
 257 dir auto quick
 258 auto quick
+259 auto quick clone
 260 auto quick trim
+261 auto quick clone
+262 auto quick clone
 263 rw auto quick
+264 auto quick clone
 269 auto rw prealloc ioctl enospc stress
 270 auto quota rw prealloc ioctl enospc stress
 273 auto rw


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

* [PATCH 13/32] reflink: test intersecting CoW and falloc/fpunch/fzero/fcollapse/finsert/ftrunc
@ 2016-02-11 23:40   ` Darrick J. Wong
  0 siblings, 0 replies; 81+ messages in thread
From: Darrick J. Wong @ 2016-02-11 23:40 UTC (permalink / raw)
  To: david, darrick.wong; +Cc: fstests, linux-btrfs, xfs

Ensure that we correctly handle a CoW operation immediately followed
by a truncate, falloc, fpunch, fzero, fcollapse, and finsert operation
in the middle of the CoW'd region before any flush can occur.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 tests/generic/253     |   90 +++++++++++++++++++++++++++++++++++++++++++++++
 tests/generic/253.out |   12 ++++++
 tests/generic/254     |   90 +++++++++++++++++++++++++++++++++++++++++++++++
 tests/generic/254.out |   12 ++++++
 tests/generic/259     |   90 +++++++++++++++++++++++++++++++++++++++++++++++
 tests/generic/259.out |   12 ++++++
 tests/generic/261     |   90 +++++++++++++++++++++++++++++++++++++++++++++++
 tests/generic/261.out |   12 ++++++
 tests/generic/262     |   93 +++++++++++++++++++++++++++++++++++++++++++++++++
 tests/generic/262.out |   12 ++++++
 tests/generic/264     |   90 +++++++++++++++++++++++++++++++++++++++++++++++
 tests/generic/264.out |   12 ++++++
 tests/generic/group   |    6 +++
 13 files changed, 621 insertions(+)
 create mode 100755 tests/generic/253
 create mode 100644 tests/generic/253.out
 create mode 100755 tests/generic/254
 create mode 100644 tests/generic/254.out
 create mode 100755 tests/generic/259
 create mode 100644 tests/generic/259.out
 create mode 100755 tests/generic/261
 create mode 100644 tests/generic/261.out
 create mode 100755 tests/generic/262
 create mode 100644 tests/generic/262.out
 create mode 100755 tests/generic/264
 create mode 100644 tests/generic/264.out


diff --git a/tests/generic/253 b/tests/generic/253
new file mode 100755
index 0000000..bfb91a3
--- /dev/null
+++ b/tests/generic/253
@@ -0,0 +1,90 @@
+#! /bin/bash
+# FS QA Test No. 253
+#
+# Truncate a file at midway through a CoW region.
+#
+# This test is dependent on the system page size, so we cannot use md5 in
+# the golden output; we can only compare to a check file.
+#
+#-----------------------------------------------------------------------
+# 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
+_require_scratch_reflink
+_require_cp_reflink
+_require_xfs_io_command "truncate"
+
+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
+
+blksz=65536
+nr=4
+filesize=$((blksz * nr))
+
+echo "Create the original files"
+_pwrite_byte 0x61 0 $filesize $testdir/file1 >> $seqres.full
+_cp_reflink $testdir/file1 $testdir/file2 >> $seqres.full
+_pwrite_byte 0x61 0 $filesize $testdir/file2.chk >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file2 | _filter_scratch
+md5sum $testdir/file2.chk | _filter_scratch
+
+echo "CoW and unmount"
+$XFS_IO_PROG -f -c "pwrite -S 0x62 -b $((blksz * 2)) $blksz $((blksz * 2))" -c "truncate $((blksz * 2))" $testdir/file2 >> $seqres.full
+_scratch_remount
+$XFS_IO_PROG -f -c "pwrite -S 0x62 -b $((blksz * 2)) $blksz $((blksz * 2))" -c "truncate $((blksz * 2))" $testdir/file2.chk >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file2 | _filter_scratch
+md5sum $testdir/file2.chk | _filter_scratch
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/253.out b/tests/generic/253.out
new file mode 100644
index 0000000..3364ba0
--- /dev/null
+++ b/tests/generic/253.out
@@ -0,0 +1,12 @@
+QA output created by 253
+Format and mount
+Create the original files
+Compare files
+c946b71bb69c07daf25470742c967e7c  SCRATCH_MNT/test-253/file1
+c946b71bb69c07daf25470742c967e7c  SCRATCH_MNT/test-253/file2
+c946b71bb69c07daf25470742c967e7c  SCRATCH_MNT/test-253/file2.chk
+CoW and unmount
+Compare files
+c946b71bb69c07daf25470742c967e7c  SCRATCH_MNT/test-253/file1
+b5fc98f04b19fa7b2085ec1358c78760  SCRATCH_MNT/test-253/file2
+b5fc98f04b19fa7b2085ec1358c78760  SCRATCH_MNT/test-253/file2.chk
diff --git a/tests/generic/254 b/tests/generic/254
new file mode 100755
index 0000000..f16cdd3
--- /dev/null
+++ b/tests/generic/254
@@ -0,0 +1,90 @@
+#! /bin/bash
+# FS QA Test No. 254
+#
+# Punch a file at midway through a CoW region.
+#
+# This test is dependent on the system page size, so we cannot use md5 in
+# the golden output; we can only compare to a check file.
+#
+#-----------------------------------------------------------------------
+# 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
+_require_scratch_reflink
+_require_cp_reflink
+_require_xfs_io_command "fpunch"
+
+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
+
+blksz=65536
+nr=5
+filesize=$((blksz * nr))
+
+echo "Create the original files"
+_pwrite_byte 0x61 0 $filesize $testdir/file1 >> $seqres.full
+_cp_reflink $testdir/file1 $testdir/file2 >> $seqres.full
+_pwrite_byte 0x61 0 $filesize $testdir/file2.chk >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file2 | _filter_scratch
+md5sum $testdir/file2.chk | _filter_scratch
+
+echo "CoW and unmount"
+$XFS_IO_PROG -f -c "pwrite -S 0x62 -b $((blksz * 3)) $blksz $((blksz * 3))" -c "fpunch $((blksz * 2)) $blksz" $testdir/file2 >> $seqres.full
+_scratch_remount
+$XFS_IO_PROG -f -c "pwrite -S 0x62 -b $((blksz * 3)) $blksz $((blksz * 3))" -c "pwrite -S 0x00 $((blksz * 2)) $blksz" $testdir/file2.chk >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file2 | _filter_scratch
+md5sum $testdir/file2.chk | _filter_scratch
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/254.out b/tests/generic/254.out
new file mode 100644
index 0000000..97a8b5a
--- /dev/null
+++ b/tests/generic/254.out
@@ -0,0 +1,12 @@
+QA output created by 254
+Format and mount
+Create the original files
+Compare files
+17af09af790a9b4c79cddf72f6b642cb  SCRATCH_MNT/test-254/file1
+17af09af790a9b4c79cddf72f6b642cb  SCRATCH_MNT/test-254/file2
+17af09af790a9b4c79cddf72f6b642cb  SCRATCH_MNT/test-254/file2.chk
+CoW and unmount
+Compare files
+17af09af790a9b4c79cddf72f6b642cb  SCRATCH_MNT/test-254/file1
+b9f7a56c2ab90569cb19d8597583c6a6  SCRATCH_MNT/test-254/file2
+b9f7a56c2ab90569cb19d8597583c6a6  SCRATCH_MNT/test-254/file2.chk
diff --git a/tests/generic/259 b/tests/generic/259
new file mode 100755
index 0000000..6718c50
--- /dev/null
+++ b/tests/generic/259
@@ -0,0 +1,90 @@
+#! /bin/bash
+# FS QA Test No. 259
+#
+# fzero a file at midway through a CoW region.
+#
+# This test is dependent on the system page size, so we cannot use md5 in
+# the golden output; we can only compare to a check file.
+#
+#-----------------------------------------------------------------------
+# 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
+_require_scratch_reflink
+_require_cp_reflink
+_require_xfs_io_command "fzero"
+
+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
+
+blksz=65536
+nr=5
+filesize=$((blksz * nr))
+
+echo "Create the original files"
+_pwrite_byte 0x61 0 $filesize $testdir/file1 >> $seqres.full
+_cp_reflink $testdir/file1 $testdir/file2 >> $seqres.full
+_pwrite_byte 0x61 0 $filesize $testdir/file2.chk >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file2 | _filter_scratch
+md5sum $testdir/file2.chk | _filter_scratch
+
+echo "CoW and unmount"
+$XFS_IO_PROG -f -c "pwrite -S 0x62 -b $((blksz * 3)) $blksz $((blksz * 3))" -c "fzero $((blksz * 2)) $blksz" $testdir/file2 >> $seqres.full
+_scratch_remount
+$XFS_IO_PROG -f -c "pwrite -S 0x62 -b $((blksz * 3)) $blksz $((blksz * 3))" -c "pwrite -S 0x00 $((blksz * 2)) $blksz" $testdir/file2.chk >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file2 | _filter_scratch
+md5sum $testdir/file2.chk | _filter_scratch
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/259.out b/tests/generic/259.out
new file mode 100644
index 0000000..3517fb1
--- /dev/null
+++ b/tests/generic/259.out
@@ -0,0 +1,12 @@
+QA output created by 259
+Format and mount
+Create the original files
+Compare files
+17af09af790a9b4c79cddf72f6b642cb  SCRATCH_MNT/test-259/file1
+17af09af790a9b4c79cddf72f6b642cb  SCRATCH_MNT/test-259/file2
+17af09af790a9b4c79cddf72f6b642cb  SCRATCH_MNT/test-259/file2.chk
+CoW and unmount
+Compare files
+17af09af790a9b4c79cddf72f6b642cb  SCRATCH_MNT/test-259/file1
+b9f7a56c2ab90569cb19d8597583c6a6  SCRATCH_MNT/test-259/file2
+b9f7a56c2ab90569cb19d8597583c6a6  SCRATCH_MNT/test-259/file2.chk
diff --git a/tests/generic/261 b/tests/generic/261
new file mode 100755
index 0000000..28d0e0b
--- /dev/null
+++ b/tests/generic/261
@@ -0,0 +1,90 @@
+#! /bin/bash
+# FS QA Test No. 261
+#
+# fcollapse a file at midway through a CoW region.
+#
+# This test is dependent on the system page size, so we cannot use md5 in
+# the golden output; we can only compare to a check file.
+#
+#-----------------------------------------------------------------------
+# 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
+_require_scratch_reflink
+_require_cp_reflink
+_require_xfs_io_command "fcollapse"
+
+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
+
+blksz=65536
+nr=5
+filesize=$((blksz * nr))
+
+echo "Create the original files"
+_pwrite_byte 0x61 0 $filesize $testdir/file1 >> $seqres.full
+_cp_reflink $testdir/file1 $testdir/file2 >> $seqres.full
+_pwrite_byte 0x61 0 $filesize $testdir/file2.chk >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file2 | _filter_scratch
+md5sum $testdir/file2.chk | _filter_scratch
+
+echo "CoW and unmount"
+$XFS_IO_PROG -f -c "pwrite -S 0x62 -b $((blksz * 3)) $blksz $((blksz * 3))" -c "fcollapse $((blksz * 2)) $blksz" $testdir/file2 >> $seqres.full
+_scratch_remount
+$XFS_IO_PROG -f -c "pwrite -S 0x62 -b $((blksz * 2)) $blksz $((blksz * 2))" -c "truncate $((blksz * (nr - 1)))" $testdir/file2.chk >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file2 | _filter_scratch
+md5sum $testdir/file2.chk | _filter_scratch
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/261.out b/tests/generic/261.out
new file mode 100644
index 0000000..43691ad
--- /dev/null
+++ b/tests/generic/261.out
@@ -0,0 +1,12 @@
+QA output created by 261
+Format and mount
+Create the original files
+Compare files
+17af09af790a9b4c79cddf72f6b642cb  SCRATCH_MNT/test-261/file1
+17af09af790a9b4c79cddf72f6b642cb  SCRATCH_MNT/test-261/file2
+17af09af790a9b4c79cddf72f6b642cb  SCRATCH_MNT/test-261/file2.chk
+CoW and unmount
+Compare files
+17af09af790a9b4c79cddf72f6b642cb  SCRATCH_MNT/test-261/file1
+91b31bb8bffa8c3d3374445039287226  SCRATCH_MNT/test-261/file2
+91b31bb8bffa8c3d3374445039287226  SCRATCH_MNT/test-261/file2.chk
diff --git a/tests/generic/262 b/tests/generic/262
new file mode 100755
index 0000000..aaf38cf
--- /dev/null
+++ b/tests/generic/262
@@ -0,0 +1,93 @@
+#! /bin/bash
+# FS QA Test No. 262
+#
+# finsert a file at midway through a CoW region.
+#
+# This test is dependent on the system page size, so we cannot use md5 in
+# the golden output; we can only compare to a check file.
+#
+#-----------------------------------------------------------------------
+# 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
+_require_scratch_reflink
+_require_cp_reflink
+_require_xfs_io_command "finsert"
+
+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
+
+blksz=65536
+nr=4
+filesize=$((blksz * nr))
+
+echo "Create the original files"
+_pwrite_byte 0x61 0 $filesize $testdir/file1 >> $seqres.full
+_cp_reflink $testdir/file1 $testdir/file2 >> $seqres.full
+_pwrite_byte 0x61 0 $filesize $testdir/file2.chk >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file2 | _filter_scratch
+md5sum $testdir/file2.chk | _filter_scratch
+
+echo "CoW and unmount"
+$XFS_IO_PROG -f -c "pwrite -S 0x62 -b $((blksz * 2)) $blksz $((blksz * 2))" -c "finsert $((blksz * 2)) $blksz" $testdir/file2 >> $seqres.full
+_scratch_remount
+_pwrite_byte 0x62 $blksz $blksz $testdir/file2.chk >> $seqres.full
+_pwrite_byte 0x00 $((blksz * 2)) $blksz $testdir/file2.chk >> $seqres.full
+_pwrite_byte 0x62 $((blksz * 3)) $blksz $testdir/file2.chk >> $seqres.full
+_pwrite_byte 0x61 $((blksz * 4)) $blksz $testdir/file2.chk >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file2 | _filter_scratch
+md5sum $testdir/file2.chk | _filter_scratch
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/262.out b/tests/generic/262.out
new file mode 100644
index 0000000..32c7503
--- /dev/null
+++ b/tests/generic/262.out
@@ -0,0 +1,12 @@
+QA output created by 262
+Format and mount
+Create the original files
+Compare files
+c946b71bb69c07daf25470742c967e7c  SCRATCH_MNT/test-262/file1
+c946b71bb69c07daf25470742c967e7c  SCRATCH_MNT/test-262/file2
+c946b71bb69c07daf25470742c967e7c  SCRATCH_MNT/test-262/file2.chk
+CoW and unmount
+Compare files
+c946b71bb69c07daf25470742c967e7c  SCRATCH_MNT/test-262/file1
+b9f7a56c2ab90569cb19d8597583c6a6  SCRATCH_MNT/test-262/file2
+b9f7a56c2ab90569cb19d8597583c6a6  SCRATCH_MNT/test-262/file2.chk
diff --git a/tests/generic/264 b/tests/generic/264
new file mode 100755
index 0000000..d5bcca6
--- /dev/null
+++ b/tests/generic/264
@@ -0,0 +1,90 @@
+#! /bin/bash
+# FS QA Test No. 264
+#
+# fallocate a file at midway through a CoW region.
+#
+# This test is dependent on the system page size, so we cannot use md5 in
+# the golden output; we can only compare to a check file.
+#
+#-----------------------------------------------------------------------
+# 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
+_require_scratch_reflink
+_require_cp_reflink
+_require_xfs_io_command "falloc"
+
+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
+
+blksz=65536
+nr=5
+filesize=$((blksz * nr))
+
+echo "Create the original files"
+_pwrite_byte 0x61 0 $filesize $testdir/file1 >> $seqres.full
+_cp_reflink $testdir/file1 $testdir/file2 >> $seqres.full
+_pwrite_byte 0x61 0 $filesize $testdir/file2.chk >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file2 | _filter_scratch
+md5sum $testdir/file2.chk | _filter_scratch
+
+echo "CoW and unmount"
+$XFS_IO_PROG -f -c "pwrite -S 0x62 -b $((blksz * 3)) $blksz $((blksz * 3))" -c "falloc $((blksz * 2)) $blksz" $testdir/file2 >> $seqres.full
+_scratch_remount
+$XFS_IO_PROG -f -c "pwrite -S 0x62 -b $((blksz * 3)) $blksz $((blksz * 3))" $testdir/file2.chk >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file2 | _filter_scratch
+md5sum $testdir/file2.chk | _filter_scratch
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/264.out b/tests/generic/264.out
new file mode 100644
index 0000000..cd6904b
--- /dev/null
+++ b/tests/generic/264.out
@@ -0,0 +1,12 @@
+QA output created by 264
+Format and mount
+Create the original files
+Compare files
+17af09af790a9b4c79cddf72f6b642cb  SCRATCH_MNT/test-264/file1
+17af09af790a9b4c79cddf72f6b642cb  SCRATCH_MNT/test-264/file2
+17af09af790a9b4c79cddf72f6b642cb  SCRATCH_MNT/test-264/file2.chk
+CoW and unmount
+Compare files
+17af09af790a9b4c79cddf72f6b642cb  SCRATCH_MNT/test-264/file1
+3383b9c17e643acd1a9a249cf041e183  SCRATCH_MNT/test-264/file2
+3383b9c17e643acd1a9a249cf041e183  SCRATCH_MNT/test-264/file2.chk
diff --git a/tests/generic/group b/tests/generic/group
index 0e4e7d3..b768882 100644
--- a/tests/generic/group
+++ b/tests/generic/group
@@ -255,12 +255,18 @@
 250 auto quick prealloc rw
 251 ioctl trim
 252 auto quick prealloc rw
+253 auto quick clone
+254 auto quick clone
 255 auto quick prealloc
 256 auto quick
 257 dir auto quick
 258 auto quick
+259 auto quick clone
 260 auto quick trim
+261 auto quick clone
+262 auto quick clone
 263 rw auto quick
+264 auto quick clone
 269 auto rw prealloc ioctl enospc stress
 270 auto quota rw prealloc ioctl enospc stress
 273 auto rw

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

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

* [PATCH 14/32] reflink: test CoW behavior with IO errors
  2016-02-11 23:39 ` Darrick J. Wong
@ 2016-02-11 23:40   ` Darrick J. Wong
  -1 siblings, 0 replies; 81+ messages in thread
From: Darrick J. Wong @ 2016-02-11 23:40 UTC (permalink / raw)
  To: david, darrick.wong; +Cc: linux-btrfs, fstests, xfs

Test various scenarios (with dm-flakey) where we simulate write
failures during CoW, to see if the FS can get through it without
blowing up or corrupting data.  Plumb in a FS-generic method to
sort out repairing filesystems after they get hit by IO errors.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 tests/generic/265     |   99 +++++++++++++++++++++++++++++++++++++++++++++++
 tests/generic/265.out |   11 +++++
 tests/generic/266     |   97 ++++++++++++++++++++++++++++++++++++++++++++++
 tests/generic/266.out |   11 +++++
 tests/generic/267     |  100 +++++++++++++++++++++++++++++++++++++++++++++++
 tests/generic/267.out |   10 +++++
 tests/generic/268     |  103 +++++++++++++++++++++++++++++++++++++++++++++++++
 tests/generic/268.out |   12 ++++++
 tests/generic/271     |  100 +++++++++++++++++++++++++++++++++++++++++++++++
 tests/generic/271.out |   11 +++++
 tests/generic/272     |   98 ++++++++++++++++++++++++++++++++++++++++++++++
 tests/generic/272.out |   11 +++++
 tests/generic/276     |  101 ++++++++++++++++++++++++++++++++++++++++++++++++
 tests/generic/276.out |   11 +++++
 tests/generic/278     |  104 +++++++++++++++++++++++++++++++++++++++++++++++++
 tests/generic/278.out |   12 ++++++
 tests/generic/279     |  100 +++++++++++++++++++++++++++++++++++++++++++++++
 tests/generic/279.out |   11 +++++
 tests/generic/281     |   98 ++++++++++++++++++++++++++++++++++++++++++++++
 tests/generic/281.out |   11 +++++
 tests/generic/282     |  101 ++++++++++++++++++++++++++++++++++++++++++++++++
 tests/generic/282.out |   10 +++++
 tests/generic/283     |  104 +++++++++++++++++++++++++++++++++++++++++++++++++
 tests/generic/283.out |   12 ++++++
 tests/generic/group   |   12 ++++++
 25 files changed, 1350 insertions(+)
 create mode 100755 tests/generic/265
 create mode 100644 tests/generic/265.out
 create mode 100755 tests/generic/266
 create mode 100644 tests/generic/266.out
 create mode 100755 tests/generic/267
 create mode 100644 tests/generic/267.out
 create mode 100755 tests/generic/268
 create mode 100644 tests/generic/268.out
 create mode 100755 tests/generic/271
 create mode 100644 tests/generic/271.out
 create mode 100755 tests/generic/272
 create mode 100644 tests/generic/272.out
 create mode 100755 tests/generic/276
 create mode 100644 tests/generic/276.out
 create mode 100755 tests/generic/278
 create mode 100644 tests/generic/278.out
 create mode 100755 tests/generic/279
 create mode 100644 tests/generic/279.out
 create mode 100755 tests/generic/281
 create mode 100644 tests/generic/281.out
 create mode 100755 tests/generic/282
 create mode 100644 tests/generic/282.out
 create mode 100755 tests/generic/283
 create mode 100644 tests/generic/283.out


diff --git a/tests/generic/265 b/tests/generic/265
new file mode 100755
index 0000000..607867d
--- /dev/null
+++ b/tests/generic/265
@@ -0,0 +1,99 @@
+#! /bin/bash
+# FS QA Test No. 265
+#
+# Test CoW behavior when the write temporarily fails.
+#
+#-----------------------------------------------------------------------
+# 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.*
+    _dmerror_cleanup
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+. ./common/reflink
+. ./common/dmerror
+
+# real QA test starts here
+_supported_os Linux
+_require_scratch_reflink
+_require_cp_reflink
+_need_to_be_root
+_require_dm_target error
+
+rm -f $seqres.full
+
+
+echo "Format and mount"
+_scratch_mkfs > $seqres.full 2>&1
+_dmerror_init
+_dmerror_mount >> $seqres.full 2>&1
+
+testdir=$SCRATCH_MNT/test-$seq
+mkdir $testdir
+
+blksz=65536
+nr=640
+bufnr=128
+filesize=$((blksz * nr))
+bufsize=$((blksz * bufnr))
+
+_require_fs_space $SCRATCH_MNT $((filesize / 1024 * 3 * 5 / 4))
+
+echo "Create the original files"
+$XFS_IO_PROG -f -c "pwrite -S 0x61 -b $bufsize 0 $filesize" $testdir/file1 >> $seqres.full
+_cp_reflink $testdir/file1 $testdir/file2 >> $seqres.full
+_dmerror_unmount
+_dmerror_mount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file2 | _filter_scratch
+
+echo "CoW and unmount"
+sync
+_dmerror_load_error_table
+$XFS_IO_PROG -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" -c "fdatasync" $testdir/file2 >> $seqres.full
+_dmerror_load_working_table
+_dmerror_unmount
+_dmerror_mount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+
+echo "Check for damage"
+_dmerror_unmount
+_dmerror_cleanup
+_repair_scratch_fs >> $seqres.full
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/265.out b/tests/generic/265.out
new file mode 100644
index 0000000..1b67114
--- /dev/null
+++ b/tests/generic/265.out
@@ -0,0 +1,11 @@
+QA output created by 265
+Format and mount
+Create the original files
+Compare files
+1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-265/file1
+1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-265/file2
+CoW and unmount
+fdatasync: Input/output error
+Compare files
+1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-265/file1
+Check for damage
diff --git a/tests/generic/266 b/tests/generic/266
new file mode 100755
index 0000000..102df76
--- /dev/null
+++ b/tests/generic/266
@@ -0,0 +1,97 @@
+#! /bin/bash
+# FS QA Test No. 266
+#
+# Test CoW behavior when the write permanently fails.
+#
+#-----------------------------------------------------------------------
+# 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.*
+    _dmerror_cleanup
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+. ./common/reflink
+. ./common/dmerror
+
+# real QA test starts here
+_supported_os Linux
+_require_scratch_reflink
+_require_cp_reflink
+_need_to_be_root
+_require_dm_target error
+
+rm -f $seqres.full
+
+
+echo "Format and mount"
+_scratch_mkfs > $seqres.full 2>&1
+_dmerror_init
+_dmerror_mount >> $seqres.full 2>&1
+
+testdir=$SCRATCH_MNT/test-$seq
+mkdir $testdir
+
+blksz=65536
+nr=640
+bufnr=128
+filesize=$((blksz * nr))
+bufsize=$((blksz * bufnr))
+
+_require_fs_space $SCRATCH_MNT $((filesize / 1024 * 3 * 5 / 4))
+
+echo "Create the original files"
+$XFS_IO_PROG -f -c "pwrite -S 0x61 -b $bufsize 0 $filesize" $testdir/file1 >> $seqres.full
+_cp_reflink $testdir/file1 $testdir/file2 >> $seqres.full
+_dmerror_unmount
+_dmerror_mount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file2 | _filter_scratch
+
+echo "CoW and unmount"
+sync
+_dmerror_load_error_table
+$XFS_IO_PROG -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" -c "fdatasync" $testdir/file2 >> $seqres.full
+
+echo "Clean up the mess"
+_dmerror_unmount
+_dmerror_cleanup
+_repair_scratch_fs >> $seqres.full
+_scratch_mount >> $seqres.full 2>&1
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/266.out b/tests/generic/266.out
new file mode 100644
index 0000000..dd34ad3
--- /dev/null
+++ b/tests/generic/266.out
@@ -0,0 +1,11 @@
+QA output created by 266
+Format and mount
+Create the original files
+Compare files
+1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-266/file1
+1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-266/file2
+CoW and unmount
+fdatasync: Input/output error
+Clean up the mess
+Compare files
+1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-266/file1
diff --git a/tests/generic/267 b/tests/generic/267
new file mode 100755
index 0000000..24b7b7c
--- /dev/null
+++ b/tests/generic/267
@@ -0,0 +1,100 @@
+#! /bin/bash
+# FS QA Test No. 267
+#
+# Test CoW behavior when the write temporarily fails and we unmount.
+#
+#-----------------------------------------------------------------------
+# 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.*
+    _dmerror_cleanup
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+. ./common/reflink
+. ./common/dmerror
+
+# real QA test starts here
+_supported_os Linux
+_require_scratch_reflink
+_require_cp_reflink
+_need_to_be_root
+_require_dm_target error
+
+rm -f $seqres.full
+
+
+echo "Format and mount"
+_scratch_mkfs > $seqres.full 2>&1
+_dmerror_init
+_dmerror_mount >> $seqres.full 2>&1
+
+testdir=$SCRATCH_MNT/test-$seq
+mkdir $testdir
+
+blksz=65536
+nr=640
+bufnr=128
+filesize=$((blksz * nr))
+bufsize=$((blksz * bufnr))
+
+_require_fs_space $SCRATCH_MNT $((filesize / 1024 * 3 * 5 / 4))
+
+echo "Create the original files"
+$XFS_IO_PROG -f -c "pwrite -S 0x61 -b $bufsize 0 $filesize" $testdir/file1 >> $seqres.full
+_cp_reflink $testdir/file1 $testdir/file2 >> $seqres.full
+_dmerror_unmount
+_dmerror_mount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file2 | _filter_scratch
+
+echo "CoW and unmount"
+sync
+_dmerror_load_error_table
+$XFS_IO_PROG -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" $testdir/file2 >> $seqres.full
+_dmerror_load_working_table
+rm -rf $testdir/file2 >> $seqres.full 2>&1
+_dmerror_unmount
+_dmerror_mount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+
+echo "Check for damage"
+_dmerror_unmount
+_dmerror_cleanup
+_repair_scratch_fs >> $seqres.full
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/267.out b/tests/generic/267.out
new file mode 100644
index 0000000..3c58e67
--- /dev/null
+++ b/tests/generic/267.out
@@ -0,0 +1,10 @@
+QA output created by 267
+Format and mount
+Create the original files
+Compare files
+1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-267/file1
+1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-267/file2
+CoW and unmount
+Compare files
+1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-267/file1
+Check for damage
diff --git a/tests/generic/268 b/tests/generic/268
new file mode 100755
index 0000000..c17ea57
--- /dev/null
+++ b/tests/generic/268
@@ -0,0 +1,103 @@
+#! /bin/bash
+# FS QA Test No. 268
+#
+# Test CoW behavior when the write temporarily fails but the userspace
+# program writes again.
+#
+#-----------------------------------------------------------------------
+# 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.*
+    _dmerror_cleanup
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+. ./common/reflink
+. ./common/dmerror
+
+# real QA test starts here
+_supported_os Linux
+_require_scratch_reflink
+_require_cp_reflink
+_need_to_be_root
+_require_dm_target error
+
+rm -f $seqres.full
+
+
+echo "Format and mount"
+_scratch_mkfs > $seqres.full 2>&1
+_dmerror_init
+_dmerror_mount >> $seqres.full 2>&1
+
+testdir=$SCRATCH_MNT/test-$seq
+mkdir $testdir
+
+blksz=65536
+nr=640
+bufnr=128
+filesize=$((blksz * nr))
+bufsize=$((blksz * bufnr))
+
+_require_fs_space $SCRATCH_MNT $((filesize / 1024 * 3 * 5 / 4))
+
+echo "Create the original files"
+$XFS_IO_PROG -f -c "pwrite -S 0x61 -b $bufsize 0 $filesize" $testdir/file1 >> $seqres.full
+_cp_reflink $testdir/file1 $testdir/file2 >> $seqres.full
+_dmerror_unmount
+_dmerror_mount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file2 | _filter_scratch
+
+echo "CoW and unmount"
+sync
+_dmerror_load_error_table
+$XFS_IO_PROG -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" -c "fdatasync" $testdir/file2 >> $seqres.full
+_dmerror_load_working_table
+
+echo "Rewrite"
+$XFS_IO_PROG -f -c "pwrite -S 0x64 -b $bufsize 0 $filesize" -c "fdatasync" $testdir/file2 >> $seqres.full 2>&1
+_dmerror_unmount
+_dmerror_mount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+
+echo "Check for damage"
+_dmerror_unmount
+_dmerror_cleanup
+_repair_scratch_fs >> $seqres.full
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/268.out b/tests/generic/268.out
new file mode 100644
index 0000000..234e8be
--- /dev/null
+++ b/tests/generic/268.out
@@ -0,0 +1,12 @@
+QA output created by 268
+Format and mount
+Create the original files
+Compare files
+1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-268/file1
+1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-268/file2
+CoW and unmount
+fdatasync: Input/output error
+Rewrite
+Compare files
+1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-268/file1
+Check for damage
diff --git a/tests/generic/271 b/tests/generic/271
new file mode 100755
index 0000000..955478e
--- /dev/null
+++ b/tests/generic/271
@@ -0,0 +1,100 @@
+#! /bin/bash
+# FS QA Test No. 271
+#
+# Test DIO CoW behavior when the write temporarily fails.
+#
+#-----------------------------------------------------------------------
+# 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.*
+    _dmerror_cleanup
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+. ./common/reflink
+. ./common/dmerror
+
+# real QA test starts here
+_supported_os Linux
+_require_scratch_reflink
+_require_cp_reflink
+_need_to_be_root
+_require_dm_target error
+_require_odirect
+
+rm -f $seqres.full
+
+
+echo "Format and mount"
+_scratch_mkfs > $seqres.full 2>&1
+_dmerror_init
+_dmerror_mount >> $seqres.full 2>&1
+
+testdir=$SCRATCH_MNT/test-$seq
+mkdir $testdir
+
+blksz=65536
+nr=640
+bufnr=128
+filesize=$((blksz * nr))
+bufsize=$((blksz * bufnr))
+
+_require_fs_space $SCRATCH_MNT $((filesize / 1024 * 3 * 5 / 4))
+
+echo "Create the original files"
+$XFS_IO_PROG -f -c "pwrite -S 0x61 -b $bufsize 0 $filesize" $testdir/file1 >> $seqres.full
+_cp_reflink $testdir/file1 $testdir/file2 >> $seqres.full
+_dmerror_unmount
+_dmerror_mount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file2 | _filter_scratch
+
+echo "CoW and unmount"
+sync
+_dmerror_load_error_table
+$XFS_IO_PROG -d -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" $testdir/file2 >> $seqres.full
+_dmerror_load_working_table
+_dmerror_unmount
+_dmerror_mount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+
+echo "Check for damage"
+_dmerror_unmount
+_dmerror_cleanup
+_repair_scratch_fs >> $seqres.full
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/271.out b/tests/generic/271.out
new file mode 100644
index 0000000..f7ea004
--- /dev/null
+++ b/tests/generic/271.out
@@ -0,0 +1,11 @@
+QA output created by 271
+Format and mount
+Create the original files
+Compare files
+1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-271/file1
+1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-271/file2
+CoW and unmount
+pwrite64: Input/output error
+Compare files
+1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-271/file1
+Check for damage
diff --git a/tests/generic/272 b/tests/generic/272
new file mode 100755
index 0000000..7560214
--- /dev/null
+++ b/tests/generic/272
@@ -0,0 +1,98 @@
+#! /bin/bash
+# FS QA Test No. 272
+#
+# Test DIO CoW behavior when the write permanently fails.
+#
+#-----------------------------------------------------------------------
+# 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.*
+    _dmerror_cleanup
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+. ./common/reflink
+. ./common/dmerror
+
+# real QA test starts here
+_supported_os Linux
+_require_scratch_reflink
+_require_cp_reflink
+_need_to_be_root
+_require_dm_target error
+_require_odirect
+
+rm -f $seqres.full
+
+
+echo "Format and mount"
+_scratch_mkfs > $seqres.full 2>&1
+_dmerror_init
+_dmerror_mount >> $seqres.full 2>&1
+
+testdir=$SCRATCH_MNT/test-$seq
+mkdir $testdir
+
+blksz=65536
+nr=640
+bufnr=128
+filesize=$((blksz * nr))
+bufsize=$((blksz * bufnr))
+
+_require_fs_space $SCRATCH_MNT $((filesize / 1024 * 3 * 5 / 4))
+
+echo "Create the original files"
+$XFS_IO_PROG -f -c "pwrite -S 0x61 -b $bufsize 0 $filesize" $testdir/file1 >> $seqres.full
+_cp_reflink $testdir/file1 $testdir/file2 >> $seqres.full
+_dmerror_unmount
+_dmerror_mount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file2 | _filter_scratch
+
+echo "CoW and unmount"
+sync
+_dmerror_load_error_table
+$XFS_IO_PROG -d -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" $testdir/file2 >> $seqres.full
+
+echo "Clean up the mess"
+_dmerror_unmount
+_dmerror_cleanup
+_repair_scratch_fs >> $seqres.full
+_scratch_mount >> $seqres.full 2>&1
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/272.out b/tests/generic/272.out
new file mode 100644
index 0000000..e21e4a8
--- /dev/null
+++ b/tests/generic/272.out
@@ -0,0 +1,11 @@
+QA output created by 272
+Format and mount
+Create the original files
+Compare files
+1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-272/file1
+1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-272/file2
+CoW and unmount
+pwrite64: Input/output error
+Clean up the mess
+Compare files
+1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-272/file1
diff --git a/tests/generic/276 b/tests/generic/276
new file mode 100755
index 0000000..560daba
--- /dev/null
+++ b/tests/generic/276
@@ -0,0 +1,101 @@
+#! /bin/bash
+# FS QA Test No. 276
+#
+# Test DIO CoW behavior when the write temporarily fails and we unmount.
+#
+#-----------------------------------------------------------------------
+# 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.*
+    _dmerror_cleanup
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+. ./common/reflink
+. ./common/dmerror
+
+# real QA test starts here
+_supported_os Linux
+_require_scratch_reflink
+_require_cp_reflink
+_need_to_be_root
+_require_dm_target error
+_require_odirect
+
+rm -f $seqres.full
+
+
+echo "Format and mount"
+_scratch_mkfs > $seqres.full 2>&1
+_dmerror_init
+_dmerror_mount >> $seqres.full 2>&1
+
+testdir=$SCRATCH_MNT/test-$seq
+mkdir $testdir
+
+blksz=65536
+nr=640
+bufnr=128
+filesize=$((blksz * nr))
+bufsize=$((blksz * bufnr))
+
+_require_fs_space $SCRATCH_MNT $((filesize / 1024 * 3 * 5 / 4))
+
+echo "Create the original files"
+$XFS_IO_PROG -f -c "pwrite -S 0x61 -b $bufsize 0 $filesize" $testdir/file1 >> $seqres.full
+_cp_reflink $testdir/file1 $testdir/file2 >> $seqres.full
+_dmerror_unmount
+_dmerror_mount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file2 | _filter_scratch
+
+echo "CoW and unmount"
+sync
+_dmerror_load_error_table
+$XFS_IO_PROG -d -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" $testdir/file2 >> $seqres.full
+_dmerror_load_working_table
+rm -rf $testdir/file2 >> $seqres.full 2>&1
+_dmerror_unmount
+_dmerror_mount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+
+echo "Check for damage"
+_dmerror_unmount
+_dmerror_cleanup
+_repair_scratch_fs >> $seqres.full
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/276.out b/tests/generic/276.out
new file mode 100644
index 0000000..e2aeacf
--- /dev/null
+++ b/tests/generic/276.out
@@ -0,0 +1,11 @@
+QA output created by 276
+Format and mount
+Create the original files
+Compare files
+1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-276/file1
+1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-276/file2
+CoW and unmount
+pwrite64: Input/output error
+Compare files
+1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-276/file1
+Check for damage
diff --git a/tests/generic/278 b/tests/generic/278
new file mode 100755
index 0000000..6d0c828
--- /dev/null
+++ b/tests/generic/278
@@ -0,0 +1,104 @@
+#! /bin/bash
+# FS QA Test No. 278
+#
+# Test DIO CoW behavior when the write temporarily fails but the userspace
+# program writes again.
+#
+#-----------------------------------------------------------------------
+# 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.*
+    _dmerror_cleanup
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+. ./common/reflink
+. ./common/dmerror
+
+# real QA test starts here
+_supported_os Linux
+_require_scratch_reflink
+_require_cp_reflink
+_need_to_be_root
+_require_dm_target error
+_require_odirect
+
+rm -f $seqres.full
+
+
+echo "Format and mount"
+_scratch_mkfs > $seqres.full 2>&1
+_dmerror_init
+_dmerror_mount >> $seqres.full 2>&1
+
+testdir=$SCRATCH_MNT/test-$seq
+mkdir $testdir
+
+blksz=65536
+nr=640
+filesize=$((blksz * nr))
+bufnr=128
+bufsize=$((blksz * bufnr))
+
+_require_fs_space $SCRATCH_MNT $((filesize / 1024 * 3 * 5 / 4))
+
+echo "Create the original files"
+$XFS_IO_PROG -f -c "pwrite -S 0x61 -b $bufsize 0 $filesize" $testdir/file1 >> $seqres.full
+_cp_reflink $testdir/file1 $testdir/file2 >> $seqres.full
+_dmerror_unmount
+_dmerror_mount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file2 | _filter_scratch
+
+echo "CoW and unmount"
+sync
+_dmerror_load_error_table
+$XFS_IO_PROG -d -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" $testdir/file2 >> $seqres.full
+_dmerror_load_working_table
+
+echo "Rewrite"
+$XFS_IO_PROG -d -f -c "pwrite -S 0x64 -b $bufsize 0 $filesize" $testdir/file2 >> $seqres.full 2>&1
+_dmerror_unmount
+_dmerror_mount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+
+echo "Check for damage"
+_dmerror_unmount
+_dmerror_cleanup
+_repair_scratch_fs >> $seqres.full
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/278.out b/tests/generic/278.out
new file mode 100644
index 0000000..6723b73
--- /dev/null
+++ b/tests/generic/278.out
@@ -0,0 +1,12 @@
+QA output created by 278
+Format and mount
+Create the original files
+Compare files
+1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-278/file1
+1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-278/file2
+CoW and unmount
+pwrite64: Input/output error
+Rewrite
+Compare files
+1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-278/file1
+Check for damage
diff --git a/tests/generic/279 b/tests/generic/279
new file mode 100755
index 0000000..67da34b
--- /dev/null
+++ b/tests/generic/279
@@ -0,0 +1,100 @@
+#! /bin/bash
+# FS QA Test No. 279
+#
+# Test mmap CoW behavior when the write temporarily fails.
+#
+#-----------------------------------------------------------------------
+# 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/mwrite.out
+    _dmerror_cleanup
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+. ./common/reflink
+. ./common/dmerror
+
+# real QA test starts here
+_supported_os Linux
+_require_scratch_reflink
+_require_cp_reflink
+_need_to_be_root
+_require_dm_target error
+
+rm -f $seqres.full
+
+
+echo "Format and mount"
+_scratch_mkfs > $seqres.full 2>&1
+_dmerror_init
+_dmerror_mount >> $seqres.full 2>&1
+
+testdir=$SCRATCH_MNT/test-$seq
+mkdir $testdir
+
+blksz=65536
+nr=640
+bufnr=128
+filesize=$((blksz * nr))
+bufsize=$((blksz * bufnr))
+
+_require_fs_space $SCRATCH_MNT $((filesize / 1024 * 3 * 5 / 4))
+
+echo "Create the original files"
+$XFS_IO_PROG -f -c "pwrite -S 0x61 -b $bufsize 0 $filesize" $testdir/file1 >> $seqres.full
+_cp_reflink $testdir/file1 $testdir/file2 >> $seqres.full
+_dmerror_unmount
+_dmerror_mount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file2 | _filter_scratch
+
+echo "CoW and unmount"
+sync
+_dmerror_load_error_table
+urk=$($XFS_IO_PROG -f -c "mmap -rw 0 $filesize" -c "mwrite -S 0x63 0 $filesize" -c "msync -s 0 $filesize" $testdir/file2 > $TEST_DIR/mwrite.out 2>&1)
+cat $TEST_DIR/mwrite.out | tee -a $seqres.full
+_dmerror_load_working_table
+_dmerror_unmount
+_dmerror_mount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+
+echo "Check for damage"
+_dmerror_unmount
+_dmerror_cleanup
+_repair_scratch_fs >> $seqres.full
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/279.out b/tests/generic/279.out
new file mode 100644
index 0000000..f34c2b2
--- /dev/null
+++ b/tests/generic/279.out
@@ -0,0 +1,11 @@
+QA output created by 279
+Format and mount
+Create the original files
+Compare files
+1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-279/file1
+1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-279/file2
+CoW and unmount
+msync: Input/output error
+Compare files
+1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-279/file1
+Check for damage
diff --git a/tests/generic/281 b/tests/generic/281
new file mode 100755
index 0000000..71e3dd7
--- /dev/null
+++ b/tests/generic/281
@@ -0,0 +1,98 @@
+#! /bin/bash
+# FS QA Test No. 281
+#
+# Test mmap CoW behavior when the write permanently fails.
+#
+#-----------------------------------------------------------------------
+# 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/mwrite.out
+    _dmerror_cleanup
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+. ./common/reflink
+. ./common/dmerror
+
+# real QA test starts here
+_supported_os Linux
+_require_scratch_reflink
+_require_cp_reflink
+_need_to_be_root
+_require_dm_target error
+
+rm -f $seqres.full
+
+
+echo "Format and mount"
+_scratch_mkfs > $seqres.full 2>&1
+_dmerror_init
+_dmerror_mount >> $seqres.full 2>&1
+
+testdir=$SCRATCH_MNT/test-$seq
+mkdir $testdir
+
+blksz=65536
+nr=640
+bufnr=128
+filesize=$((blksz * nr))
+bufsize=$((blksz * bufnr))
+
+_require_fs_space $SCRATCH_MNT $((filesize / 1024 * 3 * 5 / 4))
+
+echo "Create the original files"
+$XFS_IO_PROG -f -c "pwrite -S 0x61 -b $bufsize 0 $filesize" $testdir/file1 >> $seqres.full
+_cp_reflink $testdir/file1 $testdir/file2 >> $seqres.full
+_dmerror_unmount
+_dmerror_mount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file2 | _filter_scratch
+
+echo "CoW and unmount"
+sync
+_dmerror_load_error_table
+urk=$($XFS_IO_PROG -f -c "mmap -rw 0 $filesize" -c "mwrite -S 0x63 0 $filesize" -c "msync -s 0 $filesize" $testdir/file2 > $TEST_DIR/mwrite.out 2>&1)
+cat $TEST_DIR/mwrite.out | tee -a $seqres.full
+
+echo "Clean up the mess"
+_dmerror_unmount
+_dmerror_cleanup
+_repair_scratch_fs >> $seqres.full
+_scratch_mount >> $seqres.full 2>&1
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/281.out b/tests/generic/281.out
new file mode 100644
index 0000000..a2d8e3f
--- /dev/null
+++ b/tests/generic/281.out
@@ -0,0 +1,11 @@
+QA output created by 281
+Format and mount
+Create the original files
+Compare files
+1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-281/file1
+1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-281/file2
+CoW and unmount
+msync: Input/output error
+Clean up the mess
+Compare files
+1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-281/file1
diff --git a/tests/generic/282 b/tests/generic/282
new file mode 100755
index 0000000..38714e0
--- /dev/null
+++ b/tests/generic/282
@@ -0,0 +1,101 @@
+#! /bin/bash
+# FS QA Test No. 282
+#
+# Test mmap CoW behavior when the write temporarily fails and we unmount.
+#
+#-----------------------------------------------------------------------
+# 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/mwrite.out
+    _dmerror_cleanup
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+. ./common/reflink
+. ./common/dmerror
+
+# real QA test starts here
+_supported_os Linux
+_require_scratch_reflink
+_require_cp_reflink
+_need_to_be_root
+_require_dm_target error
+
+rm -f $seqres.full
+
+
+echo "Format and mount"
+_scratch_mkfs > $seqres.full 2>&1
+_dmerror_init
+_dmerror_mount >> $seqres.full 2>&1
+
+testdir=$SCRATCH_MNT/test-$seq
+mkdir $testdir
+
+blksz=65536
+nr=640
+bufnr=128
+filesize=$((blksz * nr))
+bufsize=$((blksz * bufnr))
+
+_require_fs_space $SCRATCH_MNT $((filesize / 1024 * 3 * 5 / 4))
+
+echo "Create the original files"
+$XFS_IO_PROG -f -c "pwrite -S 0x61 -b $bufsize 0 $filesize" $testdir/file1 >> $seqres.full
+_cp_reflink $testdir/file1 $testdir/file2 >> $seqres.full
+_dmerror_unmount
+_dmerror_mount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file2 | _filter_scratch
+
+echo "CoW and unmount"
+sync
+_dmerror_load_error_table
+urk=$($XFS_IO_PROG -f -c "mmap -rw 0 $filesize" -c "mwrite -S 0x63 0 $filesize" $testdir/file2 > $TEST_DIR/mwrite.out 2>&1)
+cat $TEST_DIR/mwrite.out | tee -a $seqres.full
+_dmerror_load_working_table
+rm -rf $testdir/file2 >> $seqres.full 2>&1
+_dmerror_unmount
+_dmerror_mount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+
+echo "Check for damage"
+_dmerror_unmount
+_dmerror_cleanup
+_repair_scratch_fs >> $seqres.full
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/282.out b/tests/generic/282.out
new file mode 100644
index 0000000..624dbfa
--- /dev/null
+++ b/tests/generic/282.out
@@ -0,0 +1,10 @@
+QA output created by 282
+Format and mount
+Create the original files
+Compare files
+1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-282/file1
+1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-282/file2
+CoW and unmount
+Compare files
+1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-282/file1
+Check for damage
diff --git a/tests/generic/283 b/tests/generic/283
new file mode 100755
index 0000000..6d8701f
--- /dev/null
+++ b/tests/generic/283
@@ -0,0 +1,104 @@
+#! /bin/bash
+# FS QA Test No. 283
+#
+# Test mmap CoW behavior when the write temporarily fails but the userspace
+# program writes again.
+#
+#-----------------------------------------------------------------------
+# 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/mwrite.out
+    _dmerror_cleanup
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+. ./common/reflink
+. ./common/dmerror
+
+# real QA test starts here
+_supported_os Linux
+_require_scratch_reflink
+_require_cp_reflink
+_need_to_be_root
+_require_dm_target error
+
+rm -f $seqres.full
+
+
+echo "Format and mount"
+_scratch_mkfs > $seqres.full 2>&1
+_dmerror_init
+_dmerror_mount >> $seqres.full 2>&1
+
+testdir=$SCRATCH_MNT/test-$seq
+mkdir $testdir
+
+blksz=65536
+nr=640
+bufnr=128
+filesize=$((blksz * nr))
+bufsize=$((blksz * bufnr))
+
+_require_fs_space $SCRATCH_MNT $((filesize / 1024 * 3 * 5 / 4))
+
+echo "Create the original files"
+$XFS_IO_PROG -f -c "pwrite -S 0x61 -b $bufsize 0 $filesize" $testdir/file1 >> $seqres.full
+_cp_reflink $testdir/file1 $testdir/file2 >> $seqres.full
+_dmerror_unmount
+_dmerror_mount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file2 | _filter_scratch
+
+echo "CoW and unmount"
+sync
+_dmerror_load_error_table
+urk=$($XFS_IO_PROG -f -c "mmap -rw 0 $filesize" -c "mwrite -S 0x63 0 $filesize" -c "msync -s 0 $filesize" $testdir/file2 > $TEST_DIR/mwrite.out 2>&1)
+cat $TEST_DIR/mwrite.out | tee -a $seqres.full
+_dmerror_load_working_table
+
+echo "Rewrite"
+$XFS_IO_PROG -f -c "mmap -rw 0 $filesize" -c "mwrite -S 0x63 0 $filesize" -c "msync 0 $filesize" $testdir/file2 >> $seqres.full 2>&1
+_dmerror_unmount
+_dmerror_mount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+
+echo "Check for damage"
+_dmerror_unmount
+_dmerror_cleanup
+_repair_scratch_fs >> $seqres.full
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/283.out b/tests/generic/283.out
new file mode 100644
index 0000000..f9fd5c8
--- /dev/null
+++ b/tests/generic/283.out
@@ -0,0 +1,12 @@
+QA output created by 283
+Format and mount
+Create the original files
+Compare files
+1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-283/file1
+1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-283/file2
+CoW and unmount
+msync: Input/output error
+Rewrite
+Compare files
+1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-283/file1
+Check for damage
diff --git a/tests/generic/group b/tests/generic/group
index b768882..b4a180e 100644
--- a/tests/generic/group
+++ b/tests/generic/group
@@ -267,13 +267,25 @@
 262 auto quick clone
 263 rw auto quick
 264 auto quick clone
+265 auto quick clone
+266 auto quick clone
+267 auto quick clone
+268 auto quick clone
 269 auto rw prealloc ioctl enospc stress
 270 auto quota rw prealloc ioctl enospc stress
+271 auto quick clone
+272 auto quick clone
 273 auto rw
 274 auto rw prealloc
 275 auto rw enospc
+276 auto quick clone
 277 auto ioctl quick metadata
+278 auto quick clone
+279 auto quick clone
 280 auto quota freeze dangerous
+281 auto quick clone
+282 auto quick clone
+283 auto quick clone
 285 auto rw
 286 auto quick other
 288 auto quick ioctl trim


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

* [PATCH 14/32] reflink: test CoW behavior with IO errors
@ 2016-02-11 23:40   ` Darrick J. Wong
  0 siblings, 0 replies; 81+ messages in thread
From: Darrick J. Wong @ 2016-02-11 23:40 UTC (permalink / raw)
  To: david, darrick.wong; +Cc: fstests, linux-btrfs, xfs

Test various scenarios (with dm-flakey) where we simulate write
failures during CoW, to see if the FS can get through it without
blowing up or corrupting data.  Plumb in a FS-generic method to
sort out repairing filesystems after they get hit by IO errors.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 tests/generic/265     |   99 +++++++++++++++++++++++++++++++++++++++++++++++
 tests/generic/265.out |   11 +++++
 tests/generic/266     |   97 ++++++++++++++++++++++++++++++++++++++++++++++
 tests/generic/266.out |   11 +++++
 tests/generic/267     |  100 +++++++++++++++++++++++++++++++++++++++++++++++
 tests/generic/267.out |   10 +++++
 tests/generic/268     |  103 +++++++++++++++++++++++++++++++++++++++++++++++++
 tests/generic/268.out |   12 ++++++
 tests/generic/271     |  100 +++++++++++++++++++++++++++++++++++++++++++++++
 tests/generic/271.out |   11 +++++
 tests/generic/272     |   98 ++++++++++++++++++++++++++++++++++++++++++++++
 tests/generic/272.out |   11 +++++
 tests/generic/276     |  101 ++++++++++++++++++++++++++++++++++++++++++++++++
 tests/generic/276.out |   11 +++++
 tests/generic/278     |  104 +++++++++++++++++++++++++++++++++++++++++++++++++
 tests/generic/278.out |   12 ++++++
 tests/generic/279     |  100 +++++++++++++++++++++++++++++++++++++++++++++++
 tests/generic/279.out |   11 +++++
 tests/generic/281     |   98 ++++++++++++++++++++++++++++++++++++++++++++++
 tests/generic/281.out |   11 +++++
 tests/generic/282     |  101 ++++++++++++++++++++++++++++++++++++++++++++++++
 tests/generic/282.out |   10 +++++
 tests/generic/283     |  104 +++++++++++++++++++++++++++++++++++++++++++++++++
 tests/generic/283.out |   12 ++++++
 tests/generic/group   |   12 ++++++
 25 files changed, 1350 insertions(+)
 create mode 100755 tests/generic/265
 create mode 100644 tests/generic/265.out
 create mode 100755 tests/generic/266
 create mode 100644 tests/generic/266.out
 create mode 100755 tests/generic/267
 create mode 100644 tests/generic/267.out
 create mode 100755 tests/generic/268
 create mode 100644 tests/generic/268.out
 create mode 100755 tests/generic/271
 create mode 100644 tests/generic/271.out
 create mode 100755 tests/generic/272
 create mode 100644 tests/generic/272.out
 create mode 100755 tests/generic/276
 create mode 100644 tests/generic/276.out
 create mode 100755 tests/generic/278
 create mode 100644 tests/generic/278.out
 create mode 100755 tests/generic/279
 create mode 100644 tests/generic/279.out
 create mode 100755 tests/generic/281
 create mode 100644 tests/generic/281.out
 create mode 100755 tests/generic/282
 create mode 100644 tests/generic/282.out
 create mode 100755 tests/generic/283
 create mode 100644 tests/generic/283.out


diff --git a/tests/generic/265 b/tests/generic/265
new file mode 100755
index 0000000..607867d
--- /dev/null
+++ b/tests/generic/265
@@ -0,0 +1,99 @@
+#! /bin/bash
+# FS QA Test No. 265
+#
+# Test CoW behavior when the write temporarily fails.
+#
+#-----------------------------------------------------------------------
+# 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.*
+    _dmerror_cleanup
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+. ./common/reflink
+. ./common/dmerror
+
+# real QA test starts here
+_supported_os Linux
+_require_scratch_reflink
+_require_cp_reflink
+_need_to_be_root
+_require_dm_target error
+
+rm -f $seqres.full
+
+
+echo "Format and mount"
+_scratch_mkfs > $seqres.full 2>&1
+_dmerror_init
+_dmerror_mount >> $seqres.full 2>&1
+
+testdir=$SCRATCH_MNT/test-$seq
+mkdir $testdir
+
+blksz=65536
+nr=640
+bufnr=128
+filesize=$((blksz * nr))
+bufsize=$((blksz * bufnr))
+
+_require_fs_space $SCRATCH_MNT $((filesize / 1024 * 3 * 5 / 4))
+
+echo "Create the original files"
+$XFS_IO_PROG -f -c "pwrite -S 0x61 -b $bufsize 0 $filesize" $testdir/file1 >> $seqres.full
+_cp_reflink $testdir/file1 $testdir/file2 >> $seqres.full
+_dmerror_unmount
+_dmerror_mount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file2 | _filter_scratch
+
+echo "CoW and unmount"
+sync
+_dmerror_load_error_table
+$XFS_IO_PROG -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" -c "fdatasync" $testdir/file2 >> $seqres.full
+_dmerror_load_working_table
+_dmerror_unmount
+_dmerror_mount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+
+echo "Check for damage"
+_dmerror_unmount
+_dmerror_cleanup
+_repair_scratch_fs >> $seqres.full
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/265.out b/tests/generic/265.out
new file mode 100644
index 0000000..1b67114
--- /dev/null
+++ b/tests/generic/265.out
@@ -0,0 +1,11 @@
+QA output created by 265
+Format and mount
+Create the original files
+Compare files
+1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-265/file1
+1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-265/file2
+CoW and unmount
+fdatasync: Input/output error
+Compare files
+1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-265/file1
+Check for damage
diff --git a/tests/generic/266 b/tests/generic/266
new file mode 100755
index 0000000..102df76
--- /dev/null
+++ b/tests/generic/266
@@ -0,0 +1,97 @@
+#! /bin/bash
+# FS QA Test No. 266
+#
+# Test CoW behavior when the write permanently fails.
+#
+#-----------------------------------------------------------------------
+# 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.*
+    _dmerror_cleanup
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+. ./common/reflink
+. ./common/dmerror
+
+# real QA test starts here
+_supported_os Linux
+_require_scratch_reflink
+_require_cp_reflink
+_need_to_be_root
+_require_dm_target error
+
+rm -f $seqres.full
+
+
+echo "Format and mount"
+_scratch_mkfs > $seqres.full 2>&1
+_dmerror_init
+_dmerror_mount >> $seqres.full 2>&1
+
+testdir=$SCRATCH_MNT/test-$seq
+mkdir $testdir
+
+blksz=65536
+nr=640
+bufnr=128
+filesize=$((blksz * nr))
+bufsize=$((blksz * bufnr))
+
+_require_fs_space $SCRATCH_MNT $((filesize / 1024 * 3 * 5 / 4))
+
+echo "Create the original files"
+$XFS_IO_PROG -f -c "pwrite -S 0x61 -b $bufsize 0 $filesize" $testdir/file1 >> $seqres.full
+_cp_reflink $testdir/file1 $testdir/file2 >> $seqres.full
+_dmerror_unmount
+_dmerror_mount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file2 | _filter_scratch
+
+echo "CoW and unmount"
+sync
+_dmerror_load_error_table
+$XFS_IO_PROG -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" -c "fdatasync" $testdir/file2 >> $seqres.full
+
+echo "Clean up the mess"
+_dmerror_unmount
+_dmerror_cleanup
+_repair_scratch_fs >> $seqres.full
+_scratch_mount >> $seqres.full 2>&1
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/266.out b/tests/generic/266.out
new file mode 100644
index 0000000..dd34ad3
--- /dev/null
+++ b/tests/generic/266.out
@@ -0,0 +1,11 @@
+QA output created by 266
+Format and mount
+Create the original files
+Compare files
+1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-266/file1
+1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-266/file2
+CoW and unmount
+fdatasync: Input/output error
+Clean up the mess
+Compare files
+1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-266/file1
diff --git a/tests/generic/267 b/tests/generic/267
new file mode 100755
index 0000000..24b7b7c
--- /dev/null
+++ b/tests/generic/267
@@ -0,0 +1,100 @@
+#! /bin/bash
+# FS QA Test No. 267
+#
+# Test CoW behavior when the write temporarily fails and we unmount.
+#
+#-----------------------------------------------------------------------
+# 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.*
+    _dmerror_cleanup
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+. ./common/reflink
+. ./common/dmerror
+
+# real QA test starts here
+_supported_os Linux
+_require_scratch_reflink
+_require_cp_reflink
+_need_to_be_root
+_require_dm_target error
+
+rm -f $seqres.full
+
+
+echo "Format and mount"
+_scratch_mkfs > $seqres.full 2>&1
+_dmerror_init
+_dmerror_mount >> $seqres.full 2>&1
+
+testdir=$SCRATCH_MNT/test-$seq
+mkdir $testdir
+
+blksz=65536
+nr=640
+bufnr=128
+filesize=$((blksz * nr))
+bufsize=$((blksz * bufnr))
+
+_require_fs_space $SCRATCH_MNT $((filesize / 1024 * 3 * 5 / 4))
+
+echo "Create the original files"
+$XFS_IO_PROG -f -c "pwrite -S 0x61 -b $bufsize 0 $filesize" $testdir/file1 >> $seqres.full
+_cp_reflink $testdir/file1 $testdir/file2 >> $seqres.full
+_dmerror_unmount
+_dmerror_mount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file2 | _filter_scratch
+
+echo "CoW and unmount"
+sync
+_dmerror_load_error_table
+$XFS_IO_PROG -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" $testdir/file2 >> $seqres.full
+_dmerror_load_working_table
+rm -rf $testdir/file2 >> $seqres.full 2>&1
+_dmerror_unmount
+_dmerror_mount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+
+echo "Check for damage"
+_dmerror_unmount
+_dmerror_cleanup
+_repair_scratch_fs >> $seqres.full
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/267.out b/tests/generic/267.out
new file mode 100644
index 0000000..3c58e67
--- /dev/null
+++ b/tests/generic/267.out
@@ -0,0 +1,10 @@
+QA output created by 267
+Format and mount
+Create the original files
+Compare files
+1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-267/file1
+1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-267/file2
+CoW and unmount
+Compare files
+1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-267/file1
+Check for damage
diff --git a/tests/generic/268 b/tests/generic/268
new file mode 100755
index 0000000..c17ea57
--- /dev/null
+++ b/tests/generic/268
@@ -0,0 +1,103 @@
+#! /bin/bash
+# FS QA Test No. 268
+#
+# Test CoW behavior when the write temporarily fails but the userspace
+# program writes again.
+#
+#-----------------------------------------------------------------------
+# 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.*
+    _dmerror_cleanup
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+. ./common/reflink
+. ./common/dmerror
+
+# real QA test starts here
+_supported_os Linux
+_require_scratch_reflink
+_require_cp_reflink
+_need_to_be_root
+_require_dm_target error
+
+rm -f $seqres.full
+
+
+echo "Format and mount"
+_scratch_mkfs > $seqres.full 2>&1
+_dmerror_init
+_dmerror_mount >> $seqres.full 2>&1
+
+testdir=$SCRATCH_MNT/test-$seq
+mkdir $testdir
+
+blksz=65536
+nr=640
+bufnr=128
+filesize=$((blksz * nr))
+bufsize=$((blksz * bufnr))
+
+_require_fs_space $SCRATCH_MNT $((filesize / 1024 * 3 * 5 / 4))
+
+echo "Create the original files"
+$XFS_IO_PROG -f -c "pwrite -S 0x61 -b $bufsize 0 $filesize" $testdir/file1 >> $seqres.full
+_cp_reflink $testdir/file1 $testdir/file2 >> $seqres.full
+_dmerror_unmount
+_dmerror_mount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file2 | _filter_scratch
+
+echo "CoW and unmount"
+sync
+_dmerror_load_error_table
+$XFS_IO_PROG -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" -c "fdatasync" $testdir/file2 >> $seqres.full
+_dmerror_load_working_table
+
+echo "Rewrite"
+$XFS_IO_PROG -f -c "pwrite -S 0x64 -b $bufsize 0 $filesize" -c "fdatasync" $testdir/file2 >> $seqres.full 2>&1
+_dmerror_unmount
+_dmerror_mount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+
+echo "Check for damage"
+_dmerror_unmount
+_dmerror_cleanup
+_repair_scratch_fs >> $seqres.full
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/268.out b/tests/generic/268.out
new file mode 100644
index 0000000..234e8be
--- /dev/null
+++ b/tests/generic/268.out
@@ -0,0 +1,12 @@
+QA output created by 268
+Format and mount
+Create the original files
+Compare files
+1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-268/file1
+1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-268/file2
+CoW and unmount
+fdatasync: Input/output error
+Rewrite
+Compare files
+1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-268/file1
+Check for damage
diff --git a/tests/generic/271 b/tests/generic/271
new file mode 100755
index 0000000..955478e
--- /dev/null
+++ b/tests/generic/271
@@ -0,0 +1,100 @@
+#! /bin/bash
+# FS QA Test No. 271
+#
+# Test DIO CoW behavior when the write temporarily fails.
+#
+#-----------------------------------------------------------------------
+# 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.*
+    _dmerror_cleanup
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+. ./common/reflink
+. ./common/dmerror
+
+# real QA test starts here
+_supported_os Linux
+_require_scratch_reflink
+_require_cp_reflink
+_need_to_be_root
+_require_dm_target error
+_require_odirect
+
+rm -f $seqres.full
+
+
+echo "Format and mount"
+_scratch_mkfs > $seqres.full 2>&1
+_dmerror_init
+_dmerror_mount >> $seqres.full 2>&1
+
+testdir=$SCRATCH_MNT/test-$seq
+mkdir $testdir
+
+blksz=65536
+nr=640
+bufnr=128
+filesize=$((blksz * nr))
+bufsize=$((blksz * bufnr))
+
+_require_fs_space $SCRATCH_MNT $((filesize / 1024 * 3 * 5 / 4))
+
+echo "Create the original files"
+$XFS_IO_PROG -f -c "pwrite -S 0x61 -b $bufsize 0 $filesize" $testdir/file1 >> $seqres.full
+_cp_reflink $testdir/file1 $testdir/file2 >> $seqres.full
+_dmerror_unmount
+_dmerror_mount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file2 | _filter_scratch
+
+echo "CoW and unmount"
+sync
+_dmerror_load_error_table
+$XFS_IO_PROG -d -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" $testdir/file2 >> $seqres.full
+_dmerror_load_working_table
+_dmerror_unmount
+_dmerror_mount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+
+echo "Check for damage"
+_dmerror_unmount
+_dmerror_cleanup
+_repair_scratch_fs >> $seqres.full
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/271.out b/tests/generic/271.out
new file mode 100644
index 0000000..f7ea004
--- /dev/null
+++ b/tests/generic/271.out
@@ -0,0 +1,11 @@
+QA output created by 271
+Format and mount
+Create the original files
+Compare files
+1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-271/file1
+1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-271/file2
+CoW and unmount
+pwrite64: Input/output error
+Compare files
+1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-271/file1
+Check for damage
diff --git a/tests/generic/272 b/tests/generic/272
new file mode 100755
index 0000000..7560214
--- /dev/null
+++ b/tests/generic/272
@@ -0,0 +1,98 @@
+#! /bin/bash
+# FS QA Test No. 272
+#
+# Test DIO CoW behavior when the write permanently fails.
+#
+#-----------------------------------------------------------------------
+# 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.*
+    _dmerror_cleanup
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+. ./common/reflink
+. ./common/dmerror
+
+# real QA test starts here
+_supported_os Linux
+_require_scratch_reflink
+_require_cp_reflink
+_need_to_be_root
+_require_dm_target error
+_require_odirect
+
+rm -f $seqres.full
+
+
+echo "Format and mount"
+_scratch_mkfs > $seqres.full 2>&1
+_dmerror_init
+_dmerror_mount >> $seqres.full 2>&1
+
+testdir=$SCRATCH_MNT/test-$seq
+mkdir $testdir
+
+blksz=65536
+nr=640
+bufnr=128
+filesize=$((blksz * nr))
+bufsize=$((blksz * bufnr))
+
+_require_fs_space $SCRATCH_MNT $((filesize / 1024 * 3 * 5 / 4))
+
+echo "Create the original files"
+$XFS_IO_PROG -f -c "pwrite -S 0x61 -b $bufsize 0 $filesize" $testdir/file1 >> $seqres.full
+_cp_reflink $testdir/file1 $testdir/file2 >> $seqres.full
+_dmerror_unmount
+_dmerror_mount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file2 | _filter_scratch
+
+echo "CoW and unmount"
+sync
+_dmerror_load_error_table
+$XFS_IO_PROG -d -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" $testdir/file2 >> $seqres.full
+
+echo "Clean up the mess"
+_dmerror_unmount
+_dmerror_cleanup
+_repair_scratch_fs >> $seqres.full
+_scratch_mount >> $seqres.full 2>&1
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/272.out b/tests/generic/272.out
new file mode 100644
index 0000000..e21e4a8
--- /dev/null
+++ b/tests/generic/272.out
@@ -0,0 +1,11 @@
+QA output created by 272
+Format and mount
+Create the original files
+Compare files
+1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-272/file1
+1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-272/file2
+CoW and unmount
+pwrite64: Input/output error
+Clean up the mess
+Compare files
+1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-272/file1
diff --git a/tests/generic/276 b/tests/generic/276
new file mode 100755
index 0000000..560daba
--- /dev/null
+++ b/tests/generic/276
@@ -0,0 +1,101 @@
+#! /bin/bash
+# FS QA Test No. 276
+#
+# Test DIO CoW behavior when the write temporarily fails and we unmount.
+#
+#-----------------------------------------------------------------------
+# 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.*
+    _dmerror_cleanup
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+. ./common/reflink
+. ./common/dmerror
+
+# real QA test starts here
+_supported_os Linux
+_require_scratch_reflink
+_require_cp_reflink
+_need_to_be_root
+_require_dm_target error
+_require_odirect
+
+rm -f $seqres.full
+
+
+echo "Format and mount"
+_scratch_mkfs > $seqres.full 2>&1
+_dmerror_init
+_dmerror_mount >> $seqres.full 2>&1
+
+testdir=$SCRATCH_MNT/test-$seq
+mkdir $testdir
+
+blksz=65536
+nr=640
+bufnr=128
+filesize=$((blksz * nr))
+bufsize=$((blksz * bufnr))
+
+_require_fs_space $SCRATCH_MNT $((filesize / 1024 * 3 * 5 / 4))
+
+echo "Create the original files"
+$XFS_IO_PROG -f -c "pwrite -S 0x61 -b $bufsize 0 $filesize" $testdir/file1 >> $seqres.full
+_cp_reflink $testdir/file1 $testdir/file2 >> $seqres.full
+_dmerror_unmount
+_dmerror_mount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file2 | _filter_scratch
+
+echo "CoW and unmount"
+sync
+_dmerror_load_error_table
+$XFS_IO_PROG -d -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" $testdir/file2 >> $seqres.full
+_dmerror_load_working_table
+rm -rf $testdir/file2 >> $seqres.full 2>&1
+_dmerror_unmount
+_dmerror_mount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+
+echo "Check for damage"
+_dmerror_unmount
+_dmerror_cleanup
+_repair_scratch_fs >> $seqres.full
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/276.out b/tests/generic/276.out
new file mode 100644
index 0000000..e2aeacf
--- /dev/null
+++ b/tests/generic/276.out
@@ -0,0 +1,11 @@
+QA output created by 276
+Format and mount
+Create the original files
+Compare files
+1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-276/file1
+1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-276/file2
+CoW and unmount
+pwrite64: Input/output error
+Compare files
+1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-276/file1
+Check for damage
diff --git a/tests/generic/278 b/tests/generic/278
new file mode 100755
index 0000000..6d0c828
--- /dev/null
+++ b/tests/generic/278
@@ -0,0 +1,104 @@
+#! /bin/bash
+# FS QA Test No. 278
+#
+# Test DIO CoW behavior when the write temporarily fails but the userspace
+# program writes again.
+#
+#-----------------------------------------------------------------------
+# 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.*
+    _dmerror_cleanup
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+. ./common/reflink
+. ./common/dmerror
+
+# real QA test starts here
+_supported_os Linux
+_require_scratch_reflink
+_require_cp_reflink
+_need_to_be_root
+_require_dm_target error
+_require_odirect
+
+rm -f $seqres.full
+
+
+echo "Format and mount"
+_scratch_mkfs > $seqres.full 2>&1
+_dmerror_init
+_dmerror_mount >> $seqres.full 2>&1
+
+testdir=$SCRATCH_MNT/test-$seq
+mkdir $testdir
+
+blksz=65536
+nr=640
+filesize=$((blksz * nr))
+bufnr=128
+bufsize=$((blksz * bufnr))
+
+_require_fs_space $SCRATCH_MNT $((filesize / 1024 * 3 * 5 / 4))
+
+echo "Create the original files"
+$XFS_IO_PROG -f -c "pwrite -S 0x61 -b $bufsize 0 $filesize" $testdir/file1 >> $seqres.full
+_cp_reflink $testdir/file1 $testdir/file2 >> $seqres.full
+_dmerror_unmount
+_dmerror_mount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file2 | _filter_scratch
+
+echo "CoW and unmount"
+sync
+_dmerror_load_error_table
+$XFS_IO_PROG -d -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" $testdir/file2 >> $seqres.full
+_dmerror_load_working_table
+
+echo "Rewrite"
+$XFS_IO_PROG -d -f -c "pwrite -S 0x64 -b $bufsize 0 $filesize" $testdir/file2 >> $seqres.full 2>&1
+_dmerror_unmount
+_dmerror_mount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+
+echo "Check for damage"
+_dmerror_unmount
+_dmerror_cleanup
+_repair_scratch_fs >> $seqres.full
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/278.out b/tests/generic/278.out
new file mode 100644
index 0000000..6723b73
--- /dev/null
+++ b/tests/generic/278.out
@@ -0,0 +1,12 @@
+QA output created by 278
+Format and mount
+Create the original files
+Compare files
+1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-278/file1
+1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-278/file2
+CoW and unmount
+pwrite64: Input/output error
+Rewrite
+Compare files
+1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-278/file1
+Check for damage
diff --git a/tests/generic/279 b/tests/generic/279
new file mode 100755
index 0000000..67da34b
--- /dev/null
+++ b/tests/generic/279
@@ -0,0 +1,100 @@
+#! /bin/bash
+# FS QA Test No. 279
+#
+# Test mmap CoW behavior when the write temporarily fails.
+#
+#-----------------------------------------------------------------------
+# 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/mwrite.out
+    _dmerror_cleanup
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+. ./common/reflink
+. ./common/dmerror
+
+# real QA test starts here
+_supported_os Linux
+_require_scratch_reflink
+_require_cp_reflink
+_need_to_be_root
+_require_dm_target error
+
+rm -f $seqres.full
+
+
+echo "Format and mount"
+_scratch_mkfs > $seqres.full 2>&1
+_dmerror_init
+_dmerror_mount >> $seqres.full 2>&1
+
+testdir=$SCRATCH_MNT/test-$seq
+mkdir $testdir
+
+blksz=65536
+nr=640
+bufnr=128
+filesize=$((blksz * nr))
+bufsize=$((blksz * bufnr))
+
+_require_fs_space $SCRATCH_MNT $((filesize / 1024 * 3 * 5 / 4))
+
+echo "Create the original files"
+$XFS_IO_PROG -f -c "pwrite -S 0x61 -b $bufsize 0 $filesize" $testdir/file1 >> $seqres.full
+_cp_reflink $testdir/file1 $testdir/file2 >> $seqres.full
+_dmerror_unmount
+_dmerror_mount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file2 | _filter_scratch
+
+echo "CoW and unmount"
+sync
+_dmerror_load_error_table
+urk=$($XFS_IO_PROG -f -c "mmap -rw 0 $filesize" -c "mwrite -S 0x63 0 $filesize" -c "msync -s 0 $filesize" $testdir/file2 > $TEST_DIR/mwrite.out 2>&1)
+cat $TEST_DIR/mwrite.out | tee -a $seqres.full
+_dmerror_load_working_table
+_dmerror_unmount
+_dmerror_mount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+
+echo "Check for damage"
+_dmerror_unmount
+_dmerror_cleanup
+_repair_scratch_fs >> $seqres.full
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/279.out b/tests/generic/279.out
new file mode 100644
index 0000000..f34c2b2
--- /dev/null
+++ b/tests/generic/279.out
@@ -0,0 +1,11 @@
+QA output created by 279
+Format and mount
+Create the original files
+Compare files
+1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-279/file1
+1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-279/file2
+CoW and unmount
+msync: Input/output error
+Compare files
+1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-279/file1
+Check for damage
diff --git a/tests/generic/281 b/tests/generic/281
new file mode 100755
index 0000000..71e3dd7
--- /dev/null
+++ b/tests/generic/281
@@ -0,0 +1,98 @@
+#! /bin/bash
+# FS QA Test No. 281
+#
+# Test mmap CoW behavior when the write permanently fails.
+#
+#-----------------------------------------------------------------------
+# 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/mwrite.out
+    _dmerror_cleanup
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+. ./common/reflink
+. ./common/dmerror
+
+# real QA test starts here
+_supported_os Linux
+_require_scratch_reflink
+_require_cp_reflink
+_need_to_be_root
+_require_dm_target error
+
+rm -f $seqres.full
+
+
+echo "Format and mount"
+_scratch_mkfs > $seqres.full 2>&1
+_dmerror_init
+_dmerror_mount >> $seqres.full 2>&1
+
+testdir=$SCRATCH_MNT/test-$seq
+mkdir $testdir
+
+blksz=65536
+nr=640
+bufnr=128
+filesize=$((blksz * nr))
+bufsize=$((blksz * bufnr))
+
+_require_fs_space $SCRATCH_MNT $((filesize / 1024 * 3 * 5 / 4))
+
+echo "Create the original files"
+$XFS_IO_PROG -f -c "pwrite -S 0x61 -b $bufsize 0 $filesize" $testdir/file1 >> $seqres.full
+_cp_reflink $testdir/file1 $testdir/file2 >> $seqres.full
+_dmerror_unmount
+_dmerror_mount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file2 | _filter_scratch
+
+echo "CoW and unmount"
+sync
+_dmerror_load_error_table
+urk=$($XFS_IO_PROG -f -c "mmap -rw 0 $filesize" -c "mwrite -S 0x63 0 $filesize" -c "msync -s 0 $filesize" $testdir/file2 > $TEST_DIR/mwrite.out 2>&1)
+cat $TEST_DIR/mwrite.out | tee -a $seqres.full
+
+echo "Clean up the mess"
+_dmerror_unmount
+_dmerror_cleanup
+_repair_scratch_fs >> $seqres.full
+_scratch_mount >> $seqres.full 2>&1
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/281.out b/tests/generic/281.out
new file mode 100644
index 0000000..a2d8e3f
--- /dev/null
+++ b/tests/generic/281.out
@@ -0,0 +1,11 @@
+QA output created by 281
+Format and mount
+Create the original files
+Compare files
+1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-281/file1
+1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-281/file2
+CoW and unmount
+msync: Input/output error
+Clean up the mess
+Compare files
+1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-281/file1
diff --git a/tests/generic/282 b/tests/generic/282
new file mode 100755
index 0000000..38714e0
--- /dev/null
+++ b/tests/generic/282
@@ -0,0 +1,101 @@
+#! /bin/bash
+# FS QA Test No. 282
+#
+# Test mmap CoW behavior when the write temporarily fails and we unmount.
+#
+#-----------------------------------------------------------------------
+# 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/mwrite.out
+    _dmerror_cleanup
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+. ./common/reflink
+. ./common/dmerror
+
+# real QA test starts here
+_supported_os Linux
+_require_scratch_reflink
+_require_cp_reflink
+_need_to_be_root
+_require_dm_target error
+
+rm -f $seqres.full
+
+
+echo "Format and mount"
+_scratch_mkfs > $seqres.full 2>&1
+_dmerror_init
+_dmerror_mount >> $seqres.full 2>&1
+
+testdir=$SCRATCH_MNT/test-$seq
+mkdir $testdir
+
+blksz=65536
+nr=640
+bufnr=128
+filesize=$((blksz * nr))
+bufsize=$((blksz * bufnr))
+
+_require_fs_space $SCRATCH_MNT $((filesize / 1024 * 3 * 5 / 4))
+
+echo "Create the original files"
+$XFS_IO_PROG -f -c "pwrite -S 0x61 -b $bufsize 0 $filesize" $testdir/file1 >> $seqres.full
+_cp_reflink $testdir/file1 $testdir/file2 >> $seqres.full
+_dmerror_unmount
+_dmerror_mount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file2 | _filter_scratch
+
+echo "CoW and unmount"
+sync
+_dmerror_load_error_table
+urk=$($XFS_IO_PROG -f -c "mmap -rw 0 $filesize" -c "mwrite -S 0x63 0 $filesize" $testdir/file2 > $TEST_DIR/mwrite.out 2>&1)
+cat $TEST_DIR/mwrite.out | tee -a $seqres.full
+_dmerror_load_working_table
+rm -rf $testdir/file2 >> $seqres.full 2>&1
+_dmerror_unmount
+_dmerror_mount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+
+echo "Check for damage"
+_dmerror_unmount
+_dmerror_cleanup
+_repair_scratch_fs >> $seqres.full
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/282.out b/tests/generic/282.out
new file mode 100644
index 0000000..624dbfa
--- /dev/null
+++ b/tests/generic/282.out
@@ -0,0 +1,10 @@
+QA output created by 282
+Format and mount
+Create the original files
+Compare files
+1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-282/file1
+1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-282/file2
+CoW and unmount
+Compare files
+1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-282/file1
+Check for damage
diff --git a/tests/generic/283 b/tests/generic/283
new file mode 100755
index 0000000..6d8701f
--- /dev/null
+++ b/tests/generic/283
@@ -0,0 +1,104 @@
+#! /bin/bash
+# FS QA Test No. 283
+#
+# Test mmap CoW behavior when the write temporarily fails but the userspace
+# program writes again.
+#
+#-----------------------------------------------------------------------
+# 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/mwrite.out
+    _dmerror_cleanup
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+. ./common/reflink
+. ./common/dmerror
+
+# real QA test starts here
+_supported_os Linux
+_require_scratch_reflink
+_require_cp_reflink
+_need_to_be_root
+_require_dm_target error
+
+rm -f $seqres.full
+
+
+echo "Format and mount"
+_scratch_mkfs > $seqres.full 2>&1
+_dmerror_init
+_dmerror_mount >> $seqres.full 2>&1
+
+testdir=$SCRATCH_MNT/test-$seq
+mkdir $testdir
+
+blksz=65536
+nr=640
+bufnr=128
+filesize=$((blksz * nr))
+bufsize=$((blksz * bufnr))
+
+_require_fs_space $SCRATCH_MNT $((filesize / 1024 * 3 * 5 / 4))
+
+echo "Create the original files"
+$XFS_IO_PROG -f -c "pwrite -S 0x61 -b $bufsize 0 $filesize" $testdir/file1 >> $seqres.full
+_cp_reflink $testdir/file1 $testdir/file2 >> $seqres.full
+_dmerror_unmount
+_dmerror_mount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file2 | _filter_scratch
+
+echo "CoW and unmount"
+sync
+_dmerror_load_error_table
+urk=$($XFS_IO_PROG -f -c "mmap -rw 0 $filesize" -c "mwrite -S 0x63 0 $filesize" -c "msync -s 0 $filesize" $testdir/file2 > $TEST_DIR/mwrite.out 2>&1)
+cat $TEST_DIR/mwrite.out | tee -a $seqres.full
+_dmerror_load_working_table
+
+echo "Rewrite"
+$XFS_IO_PROG -f -c "mmap -rw 0 $filesize" -c "mwrite -S 0x63 0 $filesize" -c "msync 0 $filesize" $testdir/file2 >> $seqres.full 2>&1
+_dmerror_unmount
+_dmerror_mount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+
+echo "Check for damage"
+_dmerror_unmount
+_dmerror_cleanup
+_repair_scratch_fs >> $seqres.full
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/283.out b/tests/generic/283.out
new file mode 100644
index 0000000..f9fd5c8
--- /dev/null
+++ b/tests/generic/283.out
@@ -0,0 +1,12 @@
+QA output created by 283
+Format and mount
+Create the original files
+Compare files
+1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-283/file1
+1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-283/file2
+CoW and unmount
+msync: Input/output error
+Rewrite
+Compare files
+1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-283/file1
+Check for damage
diff --git a/tests/generic/group b/tests/generic/group
index b768882..b4a180e 100644
--- a/tests/generic/group
+++ b/tests/generic/group
@@ -267,13 +267,25 @@
 262 auto quick clone
 263 rw auto quick
 264 auto quick clone
+265 auto quick clone
+266 auto quick clone
+267 auto quick clone
+268 auto quick clone
 269 auto rw prealloc ioctl enospc stress
 270 auto quota rw prealloc ioctl enospc stress
+271 auto quick clone
+272 auto quick clone
 273 auto rw
 274 auto rw prealloc
 275 auto rw enospc
+276 auto quick clone
 277 auto ioctl quick metadata
+278 auto quick clone
+279 auto quick clone
 280 auto quota freeze dangerous
+281 auto quick clone
+282 auto quick clone
+283 auto quick clone
 285 auto rw
 286 auto quick other
 288 auto quick ioctl trim

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

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

* [PATCH 15/32] reflink: test CoW operations against the source file
  2016-02-11 23:39 ` Darrick J. Wong
@ 2016-02-11 23:40   ` Darrick J. Wong
  -1 siblings, 0 replies; 81+ messages in thread
From: Darrick J. Wong @ 2016-02-11 23:40 UTC (permalink / raw)
  To: david, darrick.wong; +Cc: linux-btrfs, fstests, xfs

Ensure that CoW operations against shared blocks in the source file
work correctly.

v2: remove filefrag dependencies

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 common/reflink        |   66 ++++++++++++++++++++++++++++++++++
 tests/generic/196     |    2 +
 tests/generic/197     |    2 +
 tests/generic/284     |   89 ++++++++++++++++++++++++++++++++++++++++++++++
 tests/generic/284.out |   12 ++++++
 tests/generic/287     |   90 +++++++++++++++++++++++++++++++++++++++++++++++
 tests/generic/287.out |   12 ++++++
 tests/generic/289     |   91 +++++++++++++++++++++++++++++++++++++++++++++++
 tests/generic/289.out |   12 ++++++
 tests/generic/290     |   92 ++++++++++++++++++++++++++++++++++++++++++++++++
 tests/generic/290.out |   12 ++++++
 tests/generic/291     |   91 +++++++++++++++++++++++++++++++++++++++++++++++
 tests/generic/291.out |   12 ++++++
 tests/generic/292     |   92 ++++++++++++++++++++++++++++++++++++++++++++++++
 tests/generic/292.out |   12 ++++++
 tests/generic/293     |   93 ++++++++++++++++++++++++++++++++++++++++++++++++
 tests/generic/293.out |   12 ++++++
 tests/generic/295     |   94 +++++++++++++++++++++++++++++++++++++++++++++++++
 tests/generic/295.out |   12 ++++++
 tests/generic/296     |   90 +++++++++++++++++++++++++++++++++++++++++++++++
 tests/generic/296.out |   12 ++++++
 tests/generic/group   |    9 +++++
 22 files changed, 1007 insertions(+), 2 deletions(-)
 create mode 100755 tests/generic/284
 create mode 100644 tests/generic/284.out
 create mode 100755 tests/generic/287
 create mode 100644 tests/generic/287.out
 create mode 100755 tests/generic/289
 create mode 100644 tests/generic/289.out
 create mode 100755 tests/generic/290
 create mode 100644 tests/generic/290.out
 create mode 100755 tests/generic/291
 create mode 100644 tests/generic/291.out
 create mode 100755 tests/generic/292
 create mode 100644 tests/generic/292.out
 create mode 100755 tests/generic/293
 create mode 100644 tests/generic/293.out
 create mode 100755 tests/generic/295
 create mode 100644 tests/generic/295.out
 create mode 100755 tests/generic/296
 create mode 100644 tests/generic/296.out


diff --git a/common/reflink b/common/reflink
index b92f664..5d92a88 100644
--- a/common/reflink
+++ b/common/reflink
@@ -295,3 +295,69 @@ _weave_reflink_rainbow_delalloc() {
 		_pwrite_byte 0x62 $((blksz * i)) $blksz $dfile.chk
 	done
 }
+
+# Make the source file have interleaved regular blocks and reflinked blocks
+_sweave_reflink_regular() {
+	blksz=$1
+	nr=$2
+	sfile=$3
+	dfile=$4
+
+	_pwrite_byte 0x61 0 $((blksz * nr)) $sfile
+	_pwrite_byte 0x62 0 $((blksz * nr)) $dfile
+	_pwrite_byte 0x61 0 $((blksz * nr)) $sfile.chk
+	seq 1 2 $((nr - 1)) | while read i; do
+		_reflink_range $sfile $((blksz * i)) $dfile $((blksz * i)) $blksz
+	done
+}
+
+# Make the source file have interleaved unwritten blocks and reflinked blocks
+_sweave_reflink_unwritten() {
+	blksz=$1
+	nr=$2
+	sfile=$3
+	dfile=$4
+
+	$XFS_IO_PROG -f -c "falloc 0 $((blksz * nr))" $sfile
+	_pwrite_byte 0x00 0 $((blksz * nr)) $sfile.chk
+	_pwrite_byte 0x62 0 $((blksz * nr)) $dfile
+	seq 1 2 $((nr - 1)) | while read i; do
+		_pwrite_byte 0x61 $((blksz * i)) $blksz $sfile
+		_pwrite_byte 0x61 $((blksz * i)) $blksz $sfile.chk
+	done
+	seq 1 2 $((nr - 1)) | while read i; do
+		_reflink_range $sfile $((blksz * i)) $dfile $((blksz * i)) $blksz
+	done
+}
+
+# Make the source file have interleaved holes and reflinked blocks
+_sweave_reflink_holes() {
+	blksz=$1
+	nr=$2
+	sfile=$3
+	dfile=$4
+
+	$XFS_IO_PROG -f -c "truncate $((blksz * nr))" $sfile
+	_pwrite_byte 0x00 0 $((blksz * nr)) $sfile.chk
+	_pwrite_byte 0x62 0 $((blksz * nr)) $dfile
+	seq 1 2 $((nr - 1)) | while read i; do
+		_pwrite_byte 0x61 $((blksz * i)) $blksz $sfile
+		_pwrite_byte 0x61 $((blksz * i)) $blksz $sfile.chk
+	done
+	seq 1 2 $((nr - 1)) | while read i; do
+		_reflink_range $sfile $((blksz * i)) $dfile $((blksz * i)) $blksz
+	done
+}
+
+# For a file created with _sweave_reflink_holes, fill the holes with delalloc
+# extents
+_sweave_reflink_holes_delalloc() {
+	blksz=$1
+	nr=$2
+	sfile=$3
+
+	seq 0 2 $((nr - 1)) | while read i; do
+		_pwrite_byte 0x64 $((blksz * i)) $blksz $sfile
+		_pwrite_byte 0x64 $((blksz * i)) $blksz $sfile.chk
+	done
+}
diff --git a/tests/generic/196 b/tests/generic/196
index 1505de8..3fcf522 100755
--- a/tests/generic/196
+++ b/tests/generic/196
@@ -2,7 +2,7 @@
 # FS QA Test No. 196
 #
 # Ensuring that copy on write in direct-io mode works when the CoW
-# range originally covers multiple extents, some unwritten, some not.
+# range originally covers multiple extents, some regular, some not.
 #   - Create two files.
 #   - Reflink the odd blocks of the first file into the second file.
 #   - directio CoW across the halfway mark, starting with the unwritten extent.
diff --git a/tests/generic/197 b/tests/generic/197
index cfdbf1b..b40ea93 100755
--- a/tests/generic/197
+++ b/tests/generic/197
@@ -2,7 +2,7 @@
 # FS QA Test No. 197
 #
 # Ensuring that copy on write in buffered mode works when the CoW
-# range originally covers multiple extents, some unwritten, some not.
+# range originally covers multiple extents, some regular, some not.
 #   - Create two files.
 #   - Reflink the odd blocks of the first file into the second file.
 #   - CoW across the halfway mark, starting with the unwritten extent.
diff --git a/tests/generic/284 b/tests/generic/284
new file mode 100755
index 0000000..aae4bb0
--- /dev/null
+++ b/tests/generic/284
@@ -0,0 +1,89 @@
+#! /bin/bash
+# FS QA Test No. 284
+#
+# Ensuring that copy on write in buffered mode to the source file when the
+# CoW range covers regular unshared and regular shared blocks.
+#   - Create two files.
+#   - Reflink the odd blocks of the first file into the second file.
+#   - CoW the first file across the halfway mark, starting with the
+#     regular extent.
+#   - Check that the files are now different where we say they're different.
+#
+#-----------------------------------------------------------------------
+# 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
+_require_scratch_reflink
+_require_xfs_io_command "falloc"
+
+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
+
+echo "Create the original files"
+blksz=65536
+nr=64
+filesize=$((blksz * nr))
+_sweave_reflink_regular $blksz $nr $testdir/file1 $testdir/file3 >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file3 | _filter_scratch
+md5sum $testdir/file1.chk | _filter_scratch
+
+echo "CoW across the transition"
+cowoff=$((filesize / 4))
+cowsz=$((filesize / 2))
+$XFS_IO_PROG -f -c "pwrite -S 0x63 -b $cowsz $cowoff $cowsz" $testdir/file1 >> $seqres.full
+_pwrite_byte 0x63 $cowoff $cowsz $testdir/file1.chk >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file3 | _filter_scratch
+md5sum $testdir/file1.chk | _filter_scratch
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/284.out b/tests/generic/284.out
new file mode 100644
index 0000000..cc0054d
--- /dev/null
+++ b/tests/generic/284.out
@@ -0,0 +1,12 @@
+QA output created by 284
+Format and mount
+Create the original files
+Compare files
+bdbcf02ee0aa977795a79d25fcfdccb1  SCRATCH_MNT/test-284/file1
+ce2023f765eba19677517c511886d5c9  SCRATCH_MNT/test-284/file3
+bdbcf02ee0aa977795a79d25fcfdccb1  SCRATCH_MNT/test-284/file1.chk
+CoW across the transition
+Compare files
+2dc2b131303b2f70ddb480778caac8b7  SCRATCH_MNT/test-284/file1
+ce2023f765eba19677517c511886d5c9  SCRATCH_MNT/test-284/file3
+2dc2b131303b2f70ddb480778caac8b7  SCRATCH_MNT/test-284/file1.chk
diff --git a/tests/generic/287 b/tests/generic/287
new file mode 100755
index 0000000..11e3c9f
--- /dev/null
+++ b/tests/generic/287
@@ -0,0 +1,90 @@
+#! /bin/bash
+# FS QA Test No. 287
+#
+# Ensuring that copy on write in directio mode to the source file when the
+# CoW range covers regular unshared and regular shared blocks.
+#   - Create two files.
+#   - Reflink the odd blocks of the first file into the second file.
+#   - dio CoW the first file across the halfway mark, starting with the
+#     regular extent.
+#   - Check that the files are now different where we say they're different.
+#
+#-----------------------------------------------------------------------
+# 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
+_require_scratch_reflink
+_require_xfs_io_command "falloc"
+_require_odirect
+
+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
+
+echo "Create the original files"
+blksz=65536
+nr=64
+filesize=$((blksz * nr))
+_sweave_reflink_regular $blksz $nr $testdir/file1 $testdir/file3 >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file3 | _filter_scratch
+md5sum $testdir/file1.chk | _filter_scratch
+
+echo "CoW across the transition"
+cowoff=$((filesize / 4))
+cowsz=$((filesize / 2))
+$XFS_IO_PROG -d -f -c "pwrite -S 0x63 -b $cowsz $cowoff $cowsz" $testdir/file1 >> $seqres.full
+_pwrite_byte 0x63 $cowoff $cowsz $testdir/file1.chk >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file3 | _filter_scratch
+md5sum $testdir/file1.chk | _filter_scratch
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/287.out b/tests/generic/287.out
new file mode 100644
index 0000000..b7d47e8
--- /dev/null
+++ b/tests/generic/287.out
@@ -0,0 +1,12 @@
+QA output created by 287
+Format and mount
+Create the original files
+Compare files
+bdbcf02ee0aa977795a79d25fcfdccb1  SCRATCH_MNT/test-287/file1
+ce2023f765eba19677517c511886d5c9  SCRATCH_MNT/test-287/file3
+bdbcf02ee0aa977795a79d25fcfdccb1  SCRATCH_MNT/test-287/file1.chk
+CoW across the transition
+Compare files
+2dc2b131303b2f70ddb480778caac8b7  SCRATCH_MNT/test-287/file1
+ce2023f765eba19677517c511886d5c9  SCRATCH_MNT/test-287/file3
+2dc2b131303b2f70ddb480778caac8b7  SCRATCH_MNT/test-287/file1.chk
diff --git a/tests/generic/289 b/tests/generic/289
new file mode 100755
index 0000000..31df1b8
--- /dev/null
+++ b/tests/generic/289
@@ -0,0 +1,91 @@
+#! /bin/bash
+# FS QA Test No. 289
+#
+# Ensuring that copy on write in buffered mode to the source file when the
+# CoW range covers unwritten and regular shared blocks.
+#   - Create two files.
+#   - fallocate the first file.
+#   - Write the odd blocks of the first file.
+#   - Reflink the odd blocks of the first file into the second file.
+#   - CoW the first file across the halfway mark, starting with the
+#     regular extent.
+#   - Check that the files are now different where we say they're different.
+#
+#-----------------------------------------------------------------------
+# 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
+_require_scratch_reflink
+_require_xfs_io_command "falloc"
+
+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
+
+echo "Create the original files"
+blksz=65536
+nr=64
+filesize=$((blksz * nr))
+_sweave_reflink_unwritten $blksz $nr $testdir/file1 $testdir/file3 >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file3 | _filter_scratch
+md5sum $testdir/file1.chk | _filter_scratch
+
+echo "CoW across the transition"
+cowoff=$((filesize / 4))
+cowsz=$((filesize / 2))
+$XFS_IO_PROG -f -c "pwrite -S 0x63 -b $cowsz $cowoff $cowsz" $testdir/file1 >> $seqres.full
+_pwrite_byte 0x63 $cowoff $cowsz $testdir/file1.chk >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file3 | _filter_scratch
+md5sum $testdir/file1.chk | _filter_scratch
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/289.out b/tests/generic/289.out
new file mode 100644
index 0000000..e7e37a7
--- /dev/null
+++ b/tests/generic/289.out
@@ -0,0 +1,12 @@
+QA output created by 289
+Format and mount
+Create the original files
+Compare files
+b8a8a88d4c143f79900c4b4e79aa3e37  SCRATCH_MNT/test-289/file1
+ce2023f765eba19677517c511886d5c9  SCRATCH_MNT/test-289/file3
+b8a8a88d4c143f79900c4b4e79aa3e37  SCRATCH_MNT/test-289/file1.chk
+CoW across the transition
+Compare files
+e8cf59797f0b3758c8878c368bb4cf7e  SCRATCH_MNT/test-289/file1
+ce2023f765eba19677517c511886d5c9  SCRATCH_MNT/test-289/file3
+e8cf59797f0b3758c8878c368bb4cf7e  SCRATCH_MNT/test-289/file1.chk
diff --git a/tests/generic/290 b/tests/generic/290
new file mode 100755
index 0000000..4a576c5
--- /dev/null
+++ b/tests/generic/290
@@ -0,0 +1,92 @@
+#! /bin/bash
+# FS QA Test No. 290
+#
+# Ensuring that copy on write in directio mode to the source file when the
+# CoW range covers unwritten and regular shared blocks.
+#   - Create two files.
+#   - fallocate the first file.
+#   - Write the odd blocks of the first file.
+#   - Reflink the odd blocks of the first file into the second file.
+#   - DIO CoW the first file across the halfway mark, starting with the
+#     regular extent.
+#   - Check that the files are now different where we say they're different.
+#
+#-----------------------------------------------------------------------
+# 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
+_require_scratch_reflink
+_require_xfs_io_command "falloc"
+_require_odirect
+
+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
+
+echo "Create the original files"
+blksz=65536
+nr=64
+filesize=$((blksz * nr))
+_sweave_reflink_unwritten $blksz $nr $testdir/file1 $testdir/file3 >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file3 | _filter_scratch
+md5sum $testdir/file1.chk | _filter_scratch
+
+echo "CoW across the transition"
+cowoff=$((filesize / 4))
+cowsz=$((filesize / 2))
+$XFS_IO_PROG -d -f -c "pwrite -S 0x63 -b $cowsz $cowoff $cowsz" $testdir/file1 >> $seqres.full
+_pwrite_byte 0x63 $cowoff $cowsz $testdir/file1.chk >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file3 | _filter_scratch
+md5sum $testdir/file1.chk | _filter_scratch
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/290.out b/tests/generic/290.out
new file mode 100644
index 0000000..2343695
--- /dev/null
+++ b/tests/generic/290.out
@@ -0,0 +1,12 @@
+QA output created by 290
+Format and mount
+Create the original files
+Compare files
+b8a8a88d4c143f79900c4b4e79aa3e37  SCRATCH_MNT/test-290/file1
+ce2023f765eba19677517c511886d5c9  SCRATCH_MNT/test-290/file3
+b8a8a88d4c143f79900c4b4e79aa3e37  SCRATCH_MNT/test-290/file1.chk
+CoW across the transition
+Compare files
+e8cf59797f0b3758c8878c368bb4cf7e  SCRATCH_MNT/test-290/file1
+ce2023f765eba19677517c511886d5c9  SCRATCH_MNT/test-290/file3
+e8cf59797f0b3758c8878c368bb4cf7e  SCRATCH_MNT/test-290/file1.chk
diff --git a/tests/generic/291 b/tests/generic/291
new file mode 100755
index 0000000..0f35ee0
--- /dev/null
+++ b/tests/generic/291
@@ -0,0 +1,91 @@
+#! /bin/bash
+# FS QA Test No. 291
+#
+# Ensuring that copy on write in buffered mode to the source file when the
+# CoW range covers holes and regular shared blocks.
+#   - Create two files.
+#   - Truncate the first file.
+#   - Write the odd blocks of the first file.
+#   - Reflink the odd blocks of the first file into the second file.
+#   - CoW the first file across the halfway mark, starting with the
+#     regular extent.
+#   - Check that the files are now different where we say they're different.
+#
+#-----------------------------------------------------------------------
+# 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
+_require_scratch_reflink
+_require_xfs_io_command "falloc"
+
+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
+
+echo "Create the original files"
+blksz=65536
+nr=64
+filesize=$((blksz * nr))
+_sweave_reflink_holes $blksz $nr $testdir/file1 $testdir/file3 >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file3 | _filter_scratch
+md5sum $testdir/file1.chk | _filter_scratch
+
+echo "CoW across the transition"
+cowoff=$((filesize / 4))
+cowsz=$((filesize / 2))
+$XFS_IO_PROG -f -c "pwrite -S 0x63 -b $cowsz $cowoff $cowsz" $testdir/file1 >> $seqres.full
+_pwrite_byte 0x63 $cowoff $cowsz $testdir/file1.chk >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file3 | _filter_scratch
+md5sum $testdir/file1.chk | _filter_scratch
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/291.out b/tests/generic/291.out
new file mode 100644
index 0000000..6ac3d0e
--- /dev/null
+++ b/tests/generic/291.out
@@ -0,0 +1,12 @@
+QA output created by 291
+Format and mount
+Create the original files
+Compare files
+b8a8a88d4c143f79900c4b4e79aa3e37  SCRATCH_MNT/test-291/file1
+ce2023f765eba19677517c511886d5c9  SCRATCH_MNT/test-291/file3
+b8a8a88d4c143f79900c4b4e79aa3e37  SCRATCH_MNT/test-291/file1.chk
+CoW across the transition
+Compare files
+e8cf59797f0b3758c8878c368bb4cf7e  SCRATCH_MNT/test-291/file1
+ce2023f765eba19677517c511886d5c9  SCRATCH_MNT/test-291/file3
+e8cf59797f0b3758c8878c368bb4cf7e  SCRATCH_MNT/test-291/file1.chk
diff --git a/tests/generic/292 b/tests/generic/292
new file mode 100755
index 0000000..c3d9f11
--- /dev/null
+++ b/tests/generic/292
@@ -0,0 +1,92 @@
+#! /bin/bash
+# FS QA Test No. 292
+#
+# Ensuring that copy on write in directio mode to the source file when the
+# CoW range covers holes and regular shared blocks.
+#   - Create two files.
+#   - Truncate the first file.
+#   - Write the odd blocks of the first file.
+#   - Reflink the odd blocks of the first file into the second file.
+#   - DIO CoW the first file across the halfway mark, starting with the
+#     regular extent.
+#   - Check that the files are now different where we say they're different.
+#
+#-----------------------------------------------------------------------
+# 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
+_require_scratch_reflink
+_require_xfs_io_command "falloc"
+_require_odirect
+
+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
+
+echo "Create the original files"
+blksz=65536
+nr=64
+filesize=$((blksz * nr))
+_sweave_reflink_holes $blksz $nr $testdir/file1 $testdir/file3 >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file3 | _filter_scratch
+md5sum $testdir/file1.chk | _filter_scratch
+
+echo "CoW across the transition"
+cowoff=$((filesize / 4))
+cowsz=$((filesize / 2))
+$XFS_IO_PROG -d -f -c "pwrite -S 0x63 -b $cowsz $cowoff $cowsz" $testdir/file1 >> $seqres.full
+_pwrite_byte 0x63 $cowoff $cowsz $testdir/file1.chk >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file3 | _filter_scratch
+md5sum $testdir/file1.chk | _filter_scratch
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/292.out b/tests/generic/292.out
new file mode 100644
index 0000000..a50e54f
--- /dev/null
+++ b/tests/generic/292.out
@@ -0,0 +1,12 @@
+QA output created by 292
+Format and mount
+Create the original files
+Compare files
+b8a8a88d4c143f79900c4b4e79aa3e37  SCRATCH_MNT/test-292/file1
+ce2023f765eba19677517c511886d5c9  SCRATCH_MNT/test-292/file3
+b8a8a88d4c143f79900c4b4e79aa3e37  SCRATCH_MNT/test-292/file1.chk
+CoW across the transition
+Compare files
+e8cf59797f0b3758c8878c368bb4cf7e  SCRATCH_MNT/test-292/file1
+ce2023f765eba19677517c511886d5c9  SCRATCH_MNT/test-292/file3
+e8cf59797f0b3758c8878c368bb4cf7e  SCRATCH_MNT/test-292/file1.chk
diff --git a/tests/generic/293 b/tests/generic/293
new file mode 100755
index 0000000..f6579d9
--- /dev/null
+++ b/tests/generic/293
@@ -0,0 +1,93 @@
+#! /bin/bash
+# FS QA Test No. 293
+#
+# Ensuring that copy on write in buffered mode to the source file when the
+# CoW range covers delalloc blocks and regular shared blocks.
+#   - Create two files.
+#   - Truncate the first file.
+#   - Write the odd blocks of the first file.
+#   - Reflink the odd blocks of the first file into the second file.
+#   - Write the even blocks of the first file.
+#   - CoW the first file across the halfway mark, starting with the
+#     regular extent.
+#   - Check that the files are now different where we say they're different.
+#
+#-----------------------------------------------------------------------
+# 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
+_require_scratch_reflink
+_require_xfs_io_command "falloc"
+
+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
+
+echo "Create the original files"
+blksz=65536
+nr=64
+filesize=$((blksz * nr))
+_sweave_reflink_holes $blksz $nr $testdir/file1 $testdir/file3 >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file3 | _filter_scratch
+md5sum $testdir/file1.chk | _filter_scratch
+
+echo "CoW across the transition"
+cowoff=$((filesize / 4))
+cowsz=$((filesize / 2))
+_sweave_reflink_holes_delalloc $blksz $nr $testdir/file1 >> $seqres.full
+$XFS_IO_PROG -f -c "pwrite -S 0x63 -b $cowsz $cowoff $cowsz" $testdir/file1 >> $seqres.full
+_pwrite_byte 0x63 $cowoff $cowsz $testdir/file1.chk >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file3 | _filter_scratch
+md5sum $testdir/file1.chk | _filter_scratch
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/293.out b/tests/generic/293.out
new file mode 100644
index 0000000..aaf4fe2
--- /dev/null
+++ b/tests/generic/293.out
@@ -0,0 +1,12 @@
+QA output created by 293
+Format and mount
+Create the original files
+Compare files
+b8a8a88d4c143f79900c4b4e79aa3e37  SCRATCH_MNT/test-293/file1
+ce2023f765eba19677517c511886d5c9  SCRATCH_MNT/test-293/file3
+b8a8a88d4c143f79900c4b4e79aa3e37  SCRATCH_MNT/test-293/file1.chk
+CoW across the transition
+Compare files
+35e2170e14665b780c6dec328d6a263b  SCRATCH_MNT/test-293/file1
+ce2023f765eba19677517c511886d5c9  SCRATCH_MNT/test-293/file3
+35e2170e14665b780c6dec328d6a263b  SCRATCH_MNT/test-293/file1.chk
diff --git a/tests/generic/295 b/tests/generic/295
new file mode 100755
index 0000000..e7cfaa0
--- /dev/null
+++ b/tests/generic/295
@@ -0,0 +1,94 @@
+#! /bin/bash
+# FS QA Test No. 295
+#
+# Ensuring that copy on write in directio mode to the source file when the
+# CoW range covers delalloc blocks and regular shared blocks.
+#   - Create two files.
+#   - Truncate the first file.
+#   - Write the odd blocks of the first file.
+#   - Reflink the odd blocks of the first file into the second file.
+#   - Write the even blocks of the first file.
+#   - DIO CoW the first file across the halfway mark, starting with the
+#     regular extent.
+#   - Check that the files are now different where we say they're different.
+#
+#-----------------------------------------------------------------------
+# 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
+_require_scratch_reflink
+_require_xfs_io_command "falloc"
+_require_odirect
+
+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
+
+echo "Create the original files"
+blksz=65536
+nr=64
+filesize=$((blksz * nr))
+_sweave_reflink_holes $blksz $nr $testdir/file1 $testdir/file3 >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file3 | _filter_scratch
+md5sum $testdir/file1.chk | _filter_scratch
+
+echo "CoW across the transition"
+cowoff=$((filesize / 4))
+cowsz=$((filesize / 2))
+_sweave_reflink_holes_delalloc $blksz $nr $testdir/file1 >> $seqres.full
+$XFS_IO_PROG -d -f -c "pwrite -S 0x63 -b $cowsz $cowoff $cowsz" $testdir/file1 >> $seqres.full
+_pwrite_byte 0x63 $cowoff $cowsz $testdir/file1.chk >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file3 | _filter_scratch
+md5sum $testdir/file1.chk | _filter_scratch
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/295.out b/tests/generic/295.out
new file mode 100644
index 0000000..cdc2b10
--- /dev/null
+++ b/tests/generic/295.out
@@ -0,0 +1,12 @@
+QA output created by 295
+Format and mount
+Create the original files
+Compare files
+b8a8a88d4c143f79900c4b4e79aa3e37  SCRATCH_MNT/test-295/file1
+ce2023f765eba19677517c511886d5c9  SCRATCH_MNT/test-295/file3
+b8a8a88d4c143f79900c4b4e79aa3e37  SCRATCH_MNT/test-295/file1.chk
+CoW across the transition
+Compare files
+35e2170e14665b780c6dec328d6a263b  SCRATCH_MNT/test-295/file1
+ce2023f765eba19677517c511886d5c9  SCRATCH_MNT/test-295/file3
+35e2170e14665b780c6dec328d6a263b  SCRATCH_MNT/test-295/file1.chk
diff --git a/tests/generic/296 b/tests/generic/296
new file mode 100755
index 0000000..53eceb2
--- /dev/null
+++ b/tests/generic/296
@@ -0,0 +1,90 @@
+#! /bin/bash
+# FS QA Test No. 296
+#
+# - Create two reflinked files a byte longer than a block.
+# - Rewrite the whole file.
+#
+#-----------------------------------------------------------------------
+# 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
+_require_scratch_reflink
+_require_cp_reflink
+
+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
+
+blksz=65536
+nr=128
+filesize=$((blksz * nr))
+bufnr=16
+bufsize=$((blksz * bufnr))
+
+real_blksz=$(stat -f -c '%S' "$testdir")
+_require_fs_space $SCRATCH_MNT $((filesize / 1024 * 3 * 5 / 4))
+
+echo "Create the original files"
+$XFS_IO_PROG -f -c "pwrite -S 0x61 -b $bufsize 0 $((filesize + 1))" $testdir/file1 >> $seqres.full
+_cp_reflink $testdir/file1 $testdir/file2 >> $seqres.full
+$XFS_IO_PROG -f -c "pwrite -S 0x61 -b $bufsize 0 $((filesize + 1))" $testdir/file2.chk >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file2 | _filter_scratch
+md5sum $testdir/file2.chk | _filter_scratch
+
+echo "CoW and unmount"
+$XFS_IO_PROG -f -c "pwrite -S 0x63 -b $real_blksz 0 $((filesize + 1))" -c "fdatasync" $testdir/file2 >> $seqres.full
+$XFS_IO_PROG -f -c "pwrite -S 0x63 -b $real_blksz 0 $((filesize + 1))" -c "fdatasync" $testdir/file2.chk >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file2 | _filter_scratch
+md5sum $testdir/file2.chk | _filter_scratch
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/296.out b/tests/generic/296.out
new file mode 100644
index 0000000..4f9ed60
--- /dev/null
+++ b/tests/generic/296.out
@@ -0,0 +1,12 @@
+QA output created by 296
+Format and mount
+Create the original files
+Compare files
+2909feb63a37b0e95fe5cfb7f274f7b1  SCRATCH_MNT/test-296/file1
+2909feb63a37b0e95fe5cfb7f274f7b1  SCRATCH_MNT/test-296/file2
+2909feb63a37b0e95fe5cfb7f274f7b1  SCRATCH_MNT/test-296/file2.chk
+CoW and unmount
+Compare files
+2909feb63a37b0e95fe5cfb7f274f7b1  SCRATCH_MNT/test-296/file1
+d41f6527bc8320364e12ea7076140b8b  SCRATCH_MNT/test-296/file2
+d41f6527bc8320364e12ea7076140b8b  SCRATCH_MNT/test-296/file2.chk
diff --git a/tests/generic/group b/tests/generic/group
index b4a180e..c256617 100644
--- a/tests/generic/group
+++ b/tests/generic/group
@@ -286,10 +286,19 @@
 281 auto quick clone
 282 auto quick clone
 283 auto quick clone
+284 auto quick clone
 285 auto rw
 286 auto quick other
+287 auto quick clone
 288 auto quick ioctl trim
+289 auto quick clone
+290 auto quick clone
+291 auto quick clone
+292 auto quick clone
+293 auto quick clone
 294 auto quick
+295 auto quick clone
+296 auto quick clone
 299 auto aio enospc rw stress
 300 auto aio enospc preallocrw stress
 306 auto quick rw


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

* [PATCH 15/32] reflink: test CoW operations against the source file
@ 2016-02-11 23:40   ` Darrick J. Wong
  0 siblings, 0 replies; 81+ messages in thread
From: Darrick J. Wong @ 2016-02-11 23:40 UTC (permalink / raw)
  To: david, darrick.wong; +Cc: fstests, linux-btrfs, xfs

Ensure that CoW operations against shared blocks in the source file
work correctly.

v2: remove filefrag dependencies

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 common/reflink        |   66 ++++++++++++++++++++++++++++++++++
 tests/generic/196     |    2 +
 tests/generic/197     |    2 +
 tests/generic/284     |   89 ++++++++++++++++++++++++++++++++++++++++++++++
 tests/generic/284.out |   12 ++++++
 tests/generic/287     |   90 +++++++++++++++++++++++++++++++++++++++++++++++
 tests/generic/287.out |   12 ++++++
 tests/generic/289     |   91 +++++++++++++++++++++++++++++++++++++++++++++++
 tests/generic/289.out |   12 ++++++
 tests/generic/290     |   92 ++++++++++++++++++++++++++++++++++++++++++++++++
 tests/generic/290.out |   12 ++++++
 tests/generic/291     |   91 +++++++++++++++++++++++++++++++++++++++++++++++
 tests/generic/291.out |   12 ++++++
 tests/generic/292     |   92 ++++++++++++++++++++++++++++++++++++++++++++++++
 tests/generic/292.out |   12 ++++++
 tests/generic/293     |   93 ++++++++++++++++++++++++++++++++++++++++++++++++
 tests/generic/293.out |   12 ++++++
 tests/generic/295     |   94 +++++++++++++++++++++++++++++++++++++++++++++++++
 tests/generic/295.out |   12 ++++++
 tests/generic/296     |   90 +++++++++++++++++++++++++++++++++++++++++++++++
 tests/generic/296.out |   12 ++++++
 tests/generic/group   |    9 +++++
 22 files changed, 1007 insertions(+), 2 deletions(-)
 create mode 100755 tests/generic/284
 create mode 100644 tests/generic/284.out
 create mode 100755 tests/generic/287
 create mode 100644 tests/generic/287.out
 create mode 100755 tests/generic/289
 create mode 100644 tests/generic/289.out
 create mode 100755 tests/generic/290
 create mode 100644 tests/generic/290.out
 create mode 100755 tests/generic/291
 create mode 100644 tests/generic/291.out
 create mode 100755 tests/generic/292
 create mode 100644 tests/generic/292.out
 create mode 100755 tests/generic/293
 create mode 100644 tests/generic/293.out
 create mode 100755 tests/generic/295
 create mode 100644 tests/generic/295.out
 create mode 100755 tests/generic/296
 create mode 100644 tests/generic/296.out


diff --git a/common/reflink b/common/reflink
index b92f664..5d92a88 100644
--- a/common/reflink
+++ b/common/reflink
@@ -295,3 +295,69 @@ _weave_reflink_rainbow_delalloc() {
 		_pwrite_byte 0x62 $((blksz * i)) $blksz $dfile.chk
 	done
 }
+
+# Make the source file have interleaved regular blocks and reflinked blocks
+_sweave_reflink_regular() {
+	blksz=$1
+	nr=$2
+	sfile=$3
+	dfile=$4
+
+	_pwrite_byte 0x61 0 $((blksz * nr)) $sfile
+	_pwrite_byte 0x62 0 $((blksz * nr)) $dfile
+	_pwrite_byte 0x61 0 $((blksz * nr)) $sfile.chk
+	seq 1 2 $((nr - 1)) | while read i; do
+		_reflink_range $sfile $((blksz * i)) $dfile $((blksz * i)) $blksz
+	done
+}
+
+# Make the source file have interleaved unwritten blocks and reflinked blocks
+_sweave_reflink_unwritten() {
+	blksz=$1
+	nr=$2
+	sfile=$3
+	dfile=$4
+
+	$XFS_IO_PROG -f -c "falloc 0 $((blksz * nr))" $sfile
+	_pwrite_byte 0x00 0 $((blksz * nr)) $sfile.chk
+	_pwrite_byte 0x62 0 $((blksz * nr)) $dfile
+	seq 1 2 $((nr - 1)) | while read i; do
+		_pwrite_byte 0x61 $((blksz * i)) $blksz $sfile
+		_pwrite_byte 0x61 $((blksz * i)) $blksz $sfile.chk
+	done
+	seq 1 2 $((nr - 1)) | while read i; do
+		_reflink_range $sfile $((blksz * i)) $dfile $((blksz * i)) $blksz
+	done
+}
+
+# Make the source file have interleaved holes and reflinked blocks
+_sweave_reflink_holes() {
+	blksz=$1
+	nr=$2
+	sfile=$3
+	dfile=$4
+
+	$XFS_IO_PROG -f -c "truncate $((blksz * nr))" $sfile
+	_pwrite_byte 0x00 0 $((blksz * nr)) $sfile.chk
+	_pwrite_byte 0x62 0 $((blksz * nr)) $dfile
+	seq 1 2 $((nr - 1)) | while read i; do
+		_pwrite_byte 0x61 $((blksz * i)) $blksz $sfile
+		_pwrite_byte 0x61 $((blksz * i)) $blksz $sfile.chk
+	done
+	seq 1 2 $((nr - 1)) | while read i; do
+		_reflink_range $sfile $((blksz * i)) $dfile $((blksz * i)) $blksz
+	done
+}
+
+# For a file created with _sweave_reflink_holes, fill the holes with delalloc
+# extents
+_sweave_reflink_holes_delalloc() {
+	blksz=$1
+	nr=$2
+	sfile=$3
+
+	seq 0 2 $((nr - 1)) | while read i; do
+		_pwrite_byte 0x64 $((blksz * i)) $blksz $sfile
+		_pwrite_byte 0x64 $((blksz * i)) $blksz $sfile.chk
+	done
+}
diff --git a/tests/generic/196 b/tests/generic/196
index 1505de8..3fcf522 100755
--- a/tests/generic/196
+++ b/tests/generic/196
@@ -2,7 +2,7 @@
 # FS QA Test No. 196
 #
 # Ensuring that copy on write in direct-io mode works when the CoW
-# range originally covers multiple extents, some unwritten, some not.
+# range originally covers multiple extents, some regular, some not.
 #   - Create two files.
 #   - Reflink the odd blocks of the first file into the second file.
 #   - directio CoW across the halfway mark, starting with the unwritten extent.
diff --git a/tests/generic/197 b/tests/generic/197
index cfdbf1b..b40ea93 100755
--- a/tests/generic/197
+++ b/tests/generic/197
@@ -2,7 +2,7 @@
 # FS QA Test No. 197
 #
 # Ensuring that copy on write in buffered mode works when the CoW
-# range originally covers multiple extents, some unwritten, some not.
+# range originally covers multiple extents, some regular, some not.
 #   - Create two files.
 #   - Reflink the odd blocks of the first file into the second file.
 #   - CoW across the halfway mark, starting with the unwritten extent.
diff --git a/tests/generic/284 b/tests/generic/284
new file mode 100755
index 0000000..aae4bb0
--- /dev/null
+++ b/tests/generic/284
@@ -0,0 +1,89 @@
+#! /bin/bash
+# FS QA Test No. 284
+#
+# Ensuring that copy on write in buffered mode to the source file when the
+# CoW range covers regular unshared and regular shared blocks.
+#   - Create two files.
+#   - Reflink the odd blocks of the first file into the second file.
+#   - CoW the first file across the halfway mark, starting with the
+#     regular extent.
+#   - Check that the files are now different where we say they're different.
+#
+#-----------------------------------------------------------------------
+# 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
+_require_scratch_reflink
+_require_xfs_io_command "falloc"
+
+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
+
+echo "Create the original files"
+blksz=65536
+nr=64
+filesize=$((blksz * nr))
+_sweave_reflink_regular $blksz $nr $testdir/file1 $testdir/file3 >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file3 | _filter_scratch
+md5sum $testdir/file1.chk | _filter_scratch
+
+echo "CoW across the transition"
+cowoff=$((filesize / 4))
+cowsz=$((filesize / 2))
+$XFS_IO_PROG -f -c "pwrite -S 0x63 -b $cowsz $cowoff $cowsz" $testdir/file1 >> $seqres.full
+_pwrite_byte 0x63 $cowoff $cowsz $testdir/file1.chk >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file3 | _filter_scratch
+md5sum $testdir/file1.chk | _filter_scratch
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/284.out b/tests/generic/284.out
new file mode 100644
index 0000000..cc0054d
--- /dev/null
+++ b/tests/generic/284.out
@@ -0,0 +1,12 @@
+QA output created by 284
+Format and mount
+Create the original files
+Compare files
+bdbcf02ee0aa977795a79d25fcfdccb1  SCRATCH_MNT/test-284/file1
+ce2023f765eba19677517c511886d5c9  SCRATCH_MNT/test-284/file3
+bdbcf02ee0aa977795a79d25fcfdccb1  SCRATCH_MNT/test-284/file1.chk
+CoW across the transition
+Compare files
+2dc2b131303b2f70ddb480778caac8b7  SCRATCH_MNT/test-284/file1
+ce2023f765eba19677517c511886d5c9  SCRATCH_MNT/test-284/file3
+2dc2b131303b2f70ddb480778caac8b7  SCRATCH_MNT/test-284/file1.chk
diff --git a/tests/generic/287 b/tests/generic/287
new file mode 100755
index 0000000..11e3c9f
--- /dev/null
+++ b/tests/generic/287
@@ -0,0 +1,90 @@
+#! /bin/bash
+# FS QA Test No. 287
+#
+# Ensuring that copy on write in directio mode to the source file when the
+# CoW range covers regular unshared and regular shared blocks.
+#   - Create two files.
+#   - Reflink the odd blocks of the first file into the second file.
+#   - dio CoW the first file across the halfway mark, starting with the
+#     regular extent.
+#   - Check that the files are now different where we say they're different.
+#
+#-----------------------------------------------------------------------
+# 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
+_require_scratch_reflink
+_require_xfs_io_command "falloc"
+_require_odirect
+
+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
+
+echo "Create the original files"
+blksz=65536
+nr=64
+filesize=$((blksz * nr))
+_sweave_reflink_regular $blksz $nr $testdir/file1 $testdir/file3 >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file3 | _filter_scratch
+md5sum $testdir/file1.chk | _filter_scratch
+
+echo "CoW across the transition"
+cowoff=$((filesize / 4))
+cowsz=$((filesize / 2))
+$XFS_IO_PROG -d -f -c "pwrite -S 0x63 -b $cowsz $cowoff $cowsz" $testdir/file1 >> $seqres.full
+_pwrite_byte 0x63 $cowoff $cowsz $testdir/file1.chk >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file3 | _filter_scratch
+md5sum $testdir/file1.chk | _filter_scratch
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/287.out b/tests/generic/287.out
new file mode 100644
index 0000000..b7d47e8
--- /dev/null
+++ b/tests/generic/287.out
@@ -0,0 +1,12 @@
+QA output created by 287
+Format and mount
+Create the original files
+Compare files
+bdbcf02ee0aa977795a79d25fcfdccb1  SCRATCH_MNT/test-287/file1
+ce2023f765eba19677517c511886d5c9  SCRATCH_MNT/test-287/file3
+bdbcf02ee0aa977795a79d25fcfdccb1  SCRATCH_MNT/test-287/file1.chk
+CoW across the transition
+Compare files
+2dc2b131303b2f70ddb480778caac8b7  SCRATCH_MNT/test-287/file1
+ce2023f765eba19677517c511886d5c9  SCRATCH_MNT/test-287/file3
+2dc2b131303b2f70ddb480778caac8b7  SCRATCH_MNT/test-287/file1.chk
diff --git a/tests/generic/289 b/tests/generic/289
new file mode 100755
index 0000000..31df1b8
--- /dev/null
+++ b/tests/generic/289
@@ -0,0 +1,91 @@
+#! /bin/bash
+# FS QA Test No. 289
+#
+# Ensuring that copy on write in buffered mode to the source file when the
+# CoW range covers unwritten and regular shared blocks.
+#   - Create two files.
+#   - fallocate the first file.
+#   - Write the odd blocks of the first file.
+#   - Reflink the odd blocks of the first file into the second file.
+#   - CoW the first file across the halfway mark, starting with the
+#     regular extent.
+#   - Check that the files are now different where we say they're different.
+#
+#-----------------------------------------------------------------------
+# 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
+_require_scratch_reflink
+_require_xfs_io_command "falloc"
+
+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
+
+echo "Create the original files"
+blksz=65536
+nr=64
+filesize=$((blksz * nr))
+_sweave_reflink_unwritten $blksz $nr $testdir/file1 $testdir/file3 >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file3 | _filter_scratch
+md5sum $testdir/file1.chk | _filter_scratch
+
+echo "CoW across the transition"
+cowoff=$((filesize / 4))
+cowsz=$((filesize / 2))
+$XFS_IO_PROG -f -c "pwrite -S 0x63 -b $cowsz $cowoff $cowsz" $testdir/file1 >> $seqres.full
+_pwrite_byte 0x63 $cowoff $cowsz $testdir/file1.chk >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file3 | _filter_scratch
+md5sum $testdir/file1.chk | _filter_scratch
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/289.out b/tests/generic/289.out
new file mode 100644
index 0000000..e7e37a7
--- /dev/null
+++ b/tests/generic/289.out
@@ -0,0 +1,12 @@
+QA output created by 289
+Format and mount
+Create the original files
+Compare files
+b8a8a88d4c143f79900c4b4e79aa3e37  SCRATCH_MNT/test-289/file1
+ce2023f765eba19677517c511886d5c9  SCRATCH_MNT/test-289/file3
+b8a8a88d4c143f79900c4b4e79aa3e37  SCRATCH_MNT/test-289/file1.chk
+CoW across the transition
+Compare files
+e8cf59797f0b3758c8878c368bb4cf7e  SCRATCH_MNT/test-289/file1
+ce2023f765eba19677517c511886d5c9  SCRATCH_MNT/test-289/file3
+e8cf59797f0b3758c8878c368bb4cf7e  SCRATCH_MNT/test-289/file1.chk
diff --git a/tests/generic/290 b/tests/generic/290
new file mode 100755
index 0000000..4a576c5
--- /dev/null
+++ b/tests/generic/290
@@ -0,0 +1,92 @@
+#! /bin/bash
+# FS QA Test No. 290
+#
+# Ensuring that copy on write in directio mode to the source file when the
+# CoW range covers unwritten and regular shared blocks.
+#   - Create two files.
+#   - fallocate the first file.
+#   - Write the odd blocks of the first file.
+#   - Reflink the odd blocks of the first file into the second file.
+#   - DIO CoW the first file across the halfway mark, starting with the
+#     regular extent.
+#   - Check that the files are now different where we say they're different.
+#
+#-----------------------------------------------------------------------
+# 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
+_require_scratch_reflink
+_require_xfs_io_command "falloc"
+_require_odirect
+
+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
+
+echo "Create the original files"
+blksz=65536
+nr=64
+filesize=$((blksz * nr))
+_sweave_reflink_unwritten $blksz $nr $testdir/file1 $testdir/file3 >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file3 | _filter_scratch
+md5sum $testdir/file1.chk | _filter_scratch
+
+echo "CoW across the transition"
+cowoff=$((filesize / 4))
+cowsz=$((filesize / 2))
+$XFS_IO_PROG -d -f -c "pwrite -S 0x63 -b $cowsz $cowoff $cowsz" $testdir/file1 >> $seqres.full
+_pwrite_byte 0x63 $cowoff $cowsz $testdir/file1.chk >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file3 | _filter_scratch
+md5sum $testdir/file1.chk | _filter_scratch
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/290.out b/tests/generic/290.out
new file mode 100644
index 0000000..2343695
--- /dev/null
+++ b/tests/generic/290.out
@@ -0,0 +1,12 @@
+QA output created by 290
+Format and mount
+Create the original files
+Compare files
+b8a8a88d4c143f79900c4b4e79aa3e37  SCRATCH_MNT/test-290/file1
+ce2023f765eba19677517c511886d5c9  SCRATCH_MNT/test-290/file3
+b8a8a88d4c143f79900c4b4e79aa3e37  SCRATCH_MNT/test-290/file1.chk
+CoW across the transition
+Compare files
+e8cf59797f0b3758c8878c368bb4cf7e  SCRATCH_MNT/test-290/file1
+ce2023f765eba19677517c511886d5c9  SCRATCH_MNT/test-290/file3
+e8cf59797f0b3758c8878c368bb4cf7e  SCRATCH_MNT/test-290/file1.chk
diff --git a/tests/generic/291 b/tests/generic/291
new file mode 100755
index 0000000..0f35ee0
--- /dev/null
+++ b/tests/generic/291
@@ -0,0 +1,91 @@
+#! /bin/bash
+# FS QA Test No. 291
+#
+# Ensuring that copy on write in buffered mode to the source file when the
+# CoW range covers holes and regular shared blocks.
+#   - Create two files.
+#   - Truncate the first file.
+#   - Write the odd blocks of the first file.
+#   - Reflink the odd blocks of the first file into the second file.
+#   - CoW the first file across the halfway mark, starting with the
+#     regular extent.
+#   - Check that the files are now different where we say they're different.
+#
+#-----------------------------------------------------------------------
+# 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
+_require_scratch_reflink
+_require_xfs_io_command "falloc"
+
+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
+
+echo "Create the original files"
+blksz=65536
+nr=64
+filesize=$((blksz * nr))
+_sweave_reflink_holes $blksz $nr $testdir/file1 $testdir/file3 >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file3 | _filter_scratch
+md5sum $testdir/file1.chk | _filter_scratch
+
+echo "CoW across the transition"
+cowoff=$((filesize / 4))
+cowsz=$((filesize / 2))
+$XFS_IO_PROG -f -c "pwrite -S 0x63 -b $cowsz $cowoff $cowsz" $testdir/file1 >> $seqres.full
+_pwrite_byte 0x63 $cowoff $cowsz $testdir/file1.chk >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file3 | _filter_scratch
+md5sum $testdir/file1.chk | _filter_scratch
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/291.out b/tests/generic/291.out
new file mode 100644
index 0000000..6ac3d0e
--- /dev/null
+++ b/tests/generic/291.out
@@ -0,0 +1,12 @@
+QA output created by 291
+Format and mount
+Create the original files
+Compare files
+b8a8a88d4c143f79900c4b4e79aa3e37  SCRATCH_MNT/test-291/file1
+ce2023f765eba19677517c511886d5c9  SCRATCH_MNT/test-291/file3
+b8a8a88d4c143f79900c4b4e79aa3e37  SCRATCH_MNT/test-291/file1.chk
+CoW across the transition
+Compare files
+e8cf59797f0b3758c8878c368bb4cf7e  SCRATCH_MNT/test-291/file1
+ce2023f765eba19677517c511886d5c9  SCRATCH_MNT/test-291/file3
+e8cf59797f0b3758c8878c368bb4cf7e  SCRATCH_MNT/test-291/file1.chk
diff --git a/tests/generic/292 b/tests/generic/292
new file mode 100755
index 0000000..c3d9f11
--- /dev/null
+++ b/tests/generic/292
@@ -0,0 +1,92 @@
+#! /bin/bash
+# FS QA Test No. 292
+#
+# Ensuring that copy on write in directio mode to the source file when the
+# CoW range covers holes and regular shared blocks.
+#   - Create two files.
+#   - Truncate the first file.
+#   - Write the odd blocks of the first file.
+#   - Reflink the odd blocks of the first file into the second file.
+#   - DIO CoW the first file across the halfway mark, starting with the
+#     regular extent.
+#   - Check that the files are now different where we say they're different.
+#
+#-----------------------------------------------------------------------
+# 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
+_require_scratch_reflink
+_require_xfs_io_command "falloc"
+_require_odirect
+
+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
+
+echo "Create the original files"
+blksz=65536
+nr=64
+filesize=$((blksz * nr))
+_sweave_reflink_holes $blksz $nr $testdir/file1 $testdir/file3 >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file3 | _filter_scratch
+md5sum $testdir/file1.chk | _filter_scratch
+
+echo "CoW across the transition"
+cowoff=$((filesize / 4))
+cowsz=$((filesize / 2))
+$XFS_IO_PROG -d -f -c "pwrite -S 0x63 -b $cowsz $cowoff $cowsz" $testdir/file1 >> $seqres.full
+_pwrite_byte 0x63 $cowoff $cowsz $testdir/file1.chk >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file3 | _filter_scratch
+md5sum $testdir/file1.chk | _filter_scratch
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/292.out b/tests/generic/292.out
new file mode 100644
index 0000000..a50e54f
--- /dev/null
+++ b/tests/generic/292.out
@@ -0,0 +1,12 @@
+QA output created by 292
+Format and mount
+Create the original files
+Compare files
+b8a8a88d4c143f79900c4b4e79aa3e37  SCRATCH_MNT/test-292/file1
+ce2023f765eba19677517c511886d5c9  SCRATCH_MNT/test-292/file3
+b8a8a88d4c143f79900c4b4e79aa3e37  SCRATCH_MNT/test-292/file1.chk
+CoW across the transition
+Compare files
+e8cf59797f0b3758c8878c368bb4cf7e  SCRATCH_MNT/test-292/file1
+ce2023f765eba19677517c511886d5c9  SCRATCH_MNT/test-292/file3
+e8cf59797f0b3758c8878c368bb4cf7e  SCRATCH_MNT/test-292/file1.chk
diff --git a/tests/generic/293 b/tests/generic/293
new file mode 100755
index 0000000..f6579d9
--- /dev/null
+++ b/tests/generic/293
@@ -0,0 +1,93 @@
+#! /bin/bash
+# FS QA Test No. 293
+#
+# Ensuring that copy on write in buffered mode to the source file when the
+# CoW range covers delalloc blocks and regular shared blocks.
+#   - Create two files.
+#   - Truncate the first file.
+#   - Write the odd blocks of the first file.
+#   - Reflink the odd blocks of the first file into the second file.
+#   - Write the even blocks of the first file.
+#   - CoW the first file across the halfway mark, starting with the
+#     regular extent.
+#   - Check that the files are now different where we say they're different.
+#
+#-----------------------------------------------------------------------
+# 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
+_require_scratch_reflink
+_require_xfs_io_command "falloc"
+
+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
+
+echo "Create the original files"
+blksz=65536
+nr=64
+filesize=$((blksz * nr))
+_sweave_reflink_holes $blksz $nr $testdir/file1 $testdir/file3 >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file3 | _filter_scratch
+md5sum $testdir/file1.chk | _filter_scratch
+
+echo "CoW across the transition"
+cowoff=$((filesize / 4))
+cowsz=$((filesize / 2))
+_sweave_reflink_holes_delalloc $blksz $nr $testdir/file1 >> $seqres.full
+$XFS_IO_PROG -f -c "pwrite -S 0x63 -b $cowsz $cowoff $cowsz" $testdir/file1 >> $seqres.full
+_pwrite_byte 0x63 $cowoff $cowsz $testdir/file1.chk >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file3 | _filter_scratch
+md5sum $testdir/file1.chk | _filter_scratch
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/293.out b/tests/generic/293.out
new file mode 100644
index 0000000..aaf4fe2
--- /dev/null
+++ b/tests/generic/293.out
@@ -0,0 +1,12 @@
+QA output created by 293
+Format and mount
+Create the original files
+Compare files
+b8a8a88d4c143f79900c4b4e79aa3e37  SCRATCH_MNT/test-293/file1
+ce2023f765eba19677517c511886d5c9  SCRATCH_MNT/test-293/file3
+b8a8a88d4c143f79900c4b4e79aa3e37  SCRATCH_MNT/test-293/file1.chk
+CoW across the transition
+Compare files
+35e2170e14665b780c6dec328d6a263b  SCRATCH_MNT/test-293/file1
+ce2023f765eba19677517c511886d5c9  SCRATCH_MNT/test-293/file3
+35e2170e14665b780c6dec328d6a263b  SCRATCH_MNT/test-293/file1.chk
diff --git a/tests/generic/295 b/tests/generic/295
new file mode 100755
index 0000000..e7cfaa0
--- /dev/null
+++ b/tests/generic/295
@@ -0,0 +1,94 @@
+#! /bin/bash
+# FS QA Test No. 295
+#
+# Ensuring that copy on write in directio mode to the source file when the
+# CoW range covers delalloc blocks and regular shared blocks.
+#   - Create two files.
+#   - Truncate the first file.
+#   - Write the odd blocks of the first file.
+#   - Reflink the odd blocks of the first file into the second file.
+#   - Write the even blocks of the first file.
+#   - DIO CoW the first file across the halfway mark, starting with the
+#     regular extent.
+#   - Check that the files are now different where we say they're different.
+#
+#-----------------------------------------------------------------------
+# 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
+_require_scratch_reflink
+_require_xfs_io_command "falloc"
+_require_odirect
+
+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
+
+echo "Create the original files"
+blksz=65536
+nr=64
+filesize=$((blksz * nr))
+_sweave_reflink_holes $blksz $nr $testdir/file1 $testdir/file3 >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file3 | _filter_scratch
+md5sum $testdir/file1.chk | _filter_scratch
+
+echo "CoW across the transition"
+cowoff=$((filesize / 4))
+cowsz=$((filesize / 2))
+_sweave_reflink_holes_delalloc $blksz $nr $testdir/file1 >> $seqres.full
+$XFS_IO_PROG -d -f -c "pwrite -S 0x63 -b $cowsz $cowoff $cowsz" $testdir/file1 >> $seqres.full
+_pwrite_byte 0x63 $cowoff $cowsz $testdir/file1.chk >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file3 | _filter_scratch
+md5sum $testdir/file1.chk | _filter_scratch
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/295.out b/tests/generic/295.out
new file mode 100644
index 0000000..cdc2b10
--- /dev/null
+++ b/tests/generic/295.out
@@ -0,0 +1,12 @@
+QA output created by 295
+Format and mount
+Create the original files
+Compare files
+b8a8a88d4c143f79900c4b4e79aa3e37  SCRATCH_MNT/test-295/file1
+ce2023f765eba19677517c511886d5c9  SCRATCH_MNT/test-295/file3
+b8a8a88d4c143f79900c4b4e79aa3e37  SCRATCH_MNT/test-295/file1.chk
+CoW across the transition
+Compare files
+35e2170e14665b780c6dec328d6a263b  SCRATCH_MNT/test-295/file1
+ce2023f765eba19677517c511886d5c9  SCRATCH_MNT/test-295/file3
+35e2170e14665b780c6dec328d6a263b  SCRATCH_MNT/test-295/file1.chk
diff --git a/tests/generic/296 b/tests/generic/296
new file mode 100755
index 0000000..53eceb2
--- /dev/null
+++ b/tests/generic/296
@@ -0,0 +1,90 @@
+#! /bin/bash
+# FS QA Test No. 296
+#
+# - Create two reflinked files a byte longer than a block.
+# - Rewrite the whole file.
+#
+#-----------------------------------------------------------------------
+# 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
+_require_scratch_reflink
+_require_cp_reflink
+
+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
+
+blksz=65536
+nr=128
+filesize=$((blksz * nr))
+bufnr=16
+bufsize=$((blksz * bufnr))
+
+real_blksz=$(stat -f -c '%S' "$testdir")
+_require_fs_space $SCRATCH_MNT $((filesize / 1024 * 3 * 5 / 4))
+
+echo "Create the original files"
+$XFS_IO_PROG -f -c "pwrite -S 0x61 -b $bufsize 0 $((filesize + 1))" $testdir/file1 >> $seqres.full
+_cp_reflink $testdir/file1 $testdir/file2 >> $seqres.full
+$XFS_IO_PROG -f -c "pwrite -S 0x61 -b $bufsize 0 $((filesize + 1))" $testdir/file2.chk >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file2 | _filter_scratch
+md5sum $testdir/file2.chk | _filter_scratch
+
+echo "CoW and unmount"
+$XFS_IO_PROG -f -c "pwrite -S 0x63 -b $real_blksz 0 $((filesize + 1))" -c "fdatasync" $testdir/file2 >> $seqres.full
+$XFS_IO_PROG -f -c "pwrite -S 0x63 -b $real_blksz 0 $((filesize + 1))" -c "fdatasync" $testdir/file2.chk >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file2 | _filter_scratch
+md5sum $testdir/file2.chk | _filter_scratch
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/296.out b/tests/generic/296.out
new file mode 100644
index 0000000..4f9ed60
--- /dev/null
+++ b/tests/generic/296.out
@@ -0,0 +1,12 @@
+QA output created by 296
+Format and mount
+Create the original files
+Compare files
+2909feb63a37b0e95fe5cfb7f274f7b1  SCRATCH_MNT/test-296/file1
+2909feb63a37b0e95fe5cfb7f274f7b1  SCRATCH_MNT/test-296/file2
+2909feb63a37b0e95fe5cfb7f274f7b1  SCRATCH_MNT/test-296/file2.chk
+CoW and unmount
+Compare files
+2909feb63a37b0e95fe5cfb7f274f7b1  SCRATCH_MNT/test-296/file1
+d41f6527bc8320364e12ea7076140b8b  SCRATCH_MNT/test-296/file2
+d41f6527bc8320364e12ea7076140b8b  SCRATCH_MNT/test-296/file2.chk
diff --git a/tests/generic/group b/tests/generic/group
index b4a180e..c256617 100644
--- a/tests/generic/group
+++ b/tests/generic/group
@@ -286,10 +286,19 @@
 281 auto quick clone
 282 auto quick clone
 283 auto quick clone
+284 auto quick clone
 285 auto rw
 286 auto quick other
+287 auto quick clone
 288 auto quick ioctl trim
+289 auto quick clone
+290 auto quick clone
+291 auto quick clone
+292 auto quick clone
+293 auto quick clone
 294 auto quick
+295 auto quick clone
+296 auto quick clone
 299 auto aio enospc rw stress
 300 auto aio enospc preallocrw stress
 306 auto quick rw

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

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

* [PATCH 16/32] reflink: ensure that we can handle reflinking a lot of extents
  2016-02-11 23:39 ` Darrick J. Wong
@ 2016-02-11 23:41   ` Darrick J. Wong
  -1 siblings, 0 replies; 81+ messages in thread
From: Darrick J. Wong @ 2016-02-11 23:41 UTC (permalink / raw)
  To: david, darrick.wong; +Cc: linux-btrfs, Christoph Hellwig, fstests, xfs

Update the existing stress tests to ensure that we can handle
reflinking the same block a million times, and that we can handle
reflinking million different extents.  Add a couple of tests to ensure
that we can ^C and SIGKILL our way out of long-running reflinks.

v2: Don't run the signal tests on NFS, as we cannot interrupt NFS
clone operations.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
[hch@lst.de: don't run on NFS]
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 .gitignore              |    1 
 src/Makefile            |    2 -
 src/punch-alternating.c |   59 ++++++++++++++++++++++++++++
 tests/generic/175       |   46 +++++++---------------
 tests/generic/175.out   |    5 ++
 tests/generic/176       |   53 +++++++++++++++----------
 tests/generic/176.out   |    5 +-
 tests/generic/297       |   99 +++++++++++++++++++++++++++++++++++++++++++++++
 tests/generic/297.out   |    6 +++
 tests/generic/298       |   99 +++++++++++++++++++++++++++++++++++++++++++++++
 tests/generic/298.out   |    6 +++
 tests/generic/group     |    6 ++-
 12 files changed, 328 insertions(+), 59 deletions(-)
 create mode 100644 src/punch-alternating.c
 create mode 100755 tests/generic/297
 create mode 100644 tests/generic/297.out
 create mode 100755 tests/generic/298
 create mode 100644 tests/generic/298.out


diff --git a/.gitignore b/.gitignore
index bbe7c1a..c98c7bf 100644
--- a/.gitignore
+++ b/.gitignore
@@ -115,6 +115,7 @@
 /src/aio-dio-regress/aiocp
 /src/aio-dio-regress/aiodio_sparse2
 /src/aio-dio-regress/aio-dio-eof-race
+/src/punch-alternating
 /src/cloner
 /src/renameat2
 /src/t_rename_overwrite
diff --git a/src/Makefile b/src/Makefile
index 48e6765..3110208 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -19,7 +19,7 @@ LINUX_TARGETS = xfsctl bstat t_mtab getdevicesize preallo_rw_pattern_reader \
 	bulkstat_unlink_test_modified t_dir_offset t_futimens t_immutable \
 	stale_handle pwrite_mmap_blocked t_dir_offset2 seek_sanity_test \
 	seek_copy_test t_readdir_1 t_readdir_2 fsync-tester nsexec cloner \
-	renameat2 t_getcwd e4compact test-nextquota
+	renameat2 t_getcwd e4compact test-nextquota punch-alternating
 
 SUBDIRS =
 
diff --git a/src/punch-alternating.c b/src/punch-alternating.c
new file mode 100644
index 0000000..9566310
--- /dev/null
+++ b/src/punch-alternating.c
@@ -0,0 +1,59 @@
+/*
+ * Punch out every other block in a file.
+ * Copyright (C) 2016 Oracle.
+ */
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <stdlib.h>
+#include <string.h>
+#include "global.h"
+
+int main(int argc, char *argv[])
+{
+	struct stat	s;
+	off_t		offset;
+	int		fd;
+	blksize_t	blksz;
+	off_t		sz;
+	int		mode;
+	int		error;
+
+	if (argc != 2) {
+		printf("Usage: %s file\n", argv[0]);
+		printf("Punches every other block in the file.\n");
+		return 1;
+	}
+
+	fd = open(argv[1], O_WRONLY);
+	if (fd < 0)
+		goto err;
+
+	error = fstat(fd, &s);
+	if (error)
+		goto err;
+
+	sz = s.st_size;
+	blksz = s.st_blksize;
+
+	mode = FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE;
+	for (offset = 0; offset < sz; offset += blksz * 2) {
+		error = fallocate(fd, mode, offset, blksz);
+		if (error)
+			goto err;
+	}
+
+	error = fsync(fd);
+	if (error)
+		goto err;
+
+	error = close(fd);
+	if (error)
+		goto err;
+	return 0;
+err:
+	perror(argv[1]);
+	return 2;
+}
diff --git a/tests/generic/175 b/tests/generic/175
index ac2f54f..56e9919 100755
--- a/tests/generic/175
+++ b/tests/generic/175
@@ -1,12 +1,10 @@
 #! /bin/bash
 # FS QA Test No. 175
 #
-# Try to hit the maximum reference count (eek!)
-#
-# This test runs extremely slowly, so it's not automatically run anywhere.
+# See how well reflink handles reflinking the same block a million times.
 #
 #-----------------------------------------------------------------------
-# Copyright (c) 2015, Oracle and/or its affiliates.  All Rights Reserved.
+# 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
@@ -34,7 +32,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _cleanup()
 {
     cd /
-    rm -rf "$tmp".* "$testdir1"
+    rm -rf "$tmp".*
 }
 
 # get standard environment, filters and checks
@@ -55,43 +53,27 @@ _scratch_mkfs > "$seqres.full" 2>&1
 _scratch_mount >> "$seqres.full" 2>&1
 
 testdir="$SCRATCH_MNT/test-$seq"
-rm -rf "$testdir"
 mkdir "$testdir"
 
-# Well let's hope the maximum reflink count is (less than (ha!)) 2^32...
-
 echo "Create a one block file"
 blksz="$(stat -f "$testdir" -c '%S')"
 _pwrite_byte 0x61 0 $blksz "$testdir/file1" >> "$seqres.full"
-_pwrite_byte 0x62 0 $blksz "$testdir/file2" >> "$seqres.full"
-_cp_reflink "$testdir/file1" "$testdir/file2" >> "$seqres.full"
 
-nr=32
-fnr=32
+fnr=19
+echo "Create extents"
+truncate -s $(( (2 ** i) * blksz)) "$testdir/file1"
 for i in $(seq 0 $fnr); do
-	echo " ++ Reflink size $i, $(( (2 ** i) * blksz)) bytes" | tee -a "$seqres.full"
+	echo " ++ Reflink size $i, $((2 ** i)) blocks" >> "$seqres.full"
 	n=$(( (2 ** i) * blksz))
-	_reflink_range "$testdir/file1" 0 "$testdir/file1" $n $n >> "$seqres.full" || break
-done
-
-nrf=$((nr - fnr))
-echo "Clone $((2 ** nrf)) files"
-seq 0 $((2 ** nrf)) | while read i; do
-	_cp-reflink "$testdir/file1" "$testdir/file1-$i"
+	_reflink_range "$testdir/file1" 0 "$testdir/file1" $n $n >> "$seqres.full"
 done
+_scratch_remount
 
-echo "Check scratch fs"
-umount "$SCRATCH_MNT"
-_check_scratch_fs
-
-echo "Remove big file and recheck"
-_scratch_mount >> "$seqres.full" 2>&1
-umount "$SCRATCH_MNT"
-_check_scratch_fs
-
-echo "Remove all files and recheck"
-_scratch_mount >> "$seqres.full" 2>&1
-umount "$SCRATCH_MNT"
+echo "Reflink the big file"
+blks=$((2 ** (fnr + 1) ))
+bytes=$((blks * blksz))
+echo "reflinking $blks blocks, $bytes bytes" >> "$seqres.full"
+_reflink_range "$testdir/file1" 0 "$testdir/file2" 0 $bytes >> "$seqres.full"
 
 # success, all done
 status=0
diff --git a/tests/generic/175.out b/tests/generic/175.out
index e69de29..78031a5 100644
--- a/tests/generic/175.out
+++ b/tests/generic/175.out
@@ -0,0 +1,5 @@
+QA output created by 175
+Format and mount
+Create a one block file
+Create extents
+Reflink the big file
diff --git a/tests/generic/176 b/tests/generic/176
index e32f94f..a77a16d 100755
--- a/tests/generic/176
+++ b/tests/generic/176
@@ -1,10 +1,10 @@
 #! /bin/bash
 # FS QA Test No. 176
 #
-# Try to run out of space while cloning?
+# See how well reflink handles reflinking a file with a million extents.
 #
 #-----------------------------------------------------------------------
-# Copyright (c) 2015, Oracle and/or its affiliates.  All Rights Reserved.
+# 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
@@ -32,7 +32,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _cleanup()
 {
     cd /
-    rm -rf "$tmp".* "$testdir1"
+    rm -rf "$tmp".*
 }
 
 # get standard environment, filters and checks
@@ -44,6 +44,8 @@ _cleanup()
 # real QA test starts here
 _supported_os Linux
 _require_scratch_reflink
+_require_cp_reflink
+_require_test_program "punch-alternating"
 
 rm -f "$seqres.full"
 
@@ -52,28 +54,37 @@ _scratch_mkfs > "$seqres.full" 2>&1
 _scratch_mount >> "$seqres.full" 2>&1
 
 testdir="$SCRATCH_MNT/test-$seq"
-rm -rf "$testdir"
 mkdir "$testdir"
 
-blksz="$(stat -f "$testdir" -c '%S')"
-nr_free="$(stat -f -c '%f' "$testdir")"
-echo "Create a big file"
-touch "$testdir/file0" "$testdir/file1"
-_pwrite_byte 0x61 0 $((blksz * nr_free)) "$testdir/bigfile" >> "$seqres.full" 2>&1
-_scratch_remount
-sz="$(stat -c '%s' "$testdir/bigfile")"
-
-blks="$((sz / blksz))"
-echo "Try to reflink"
-seq 0 $blks | while read lblk; do
-	fname="$testdir/file$((lblk % 2))"
-	out="$(_reflink_range "$testdir/bigfile" $((lblk * blksz)) "$fname" $((lblk * blksz)) $blksz 2>&1)"
-	echo "$fname: $out" >> "$seqres.full"
-	echo "$out" | grep -q "No space left on device" && break
+# Setup for one million blocks, but we'll accept stress testing down to
+# 2^17 blocks... that should be plenty for anyone.
+fnr=20
+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 17 && _notrun "Insufficient space for stress test; would only create $blocks_needed extents."
+
+echo "Create a many-block file"
+echo "creating $blocks_needed blocks..." >> "$seqres.full"
+"$XFS_IO_PROG" -f -c "pwrite -S 0x61 -b 4194304 0 $((2 ** (fnr + 1) * blksz))" "$testdir/file1" >> "$seqres.full"
+echo "punching..." >> "$seqres.full"
+"$here/src/punch-alternating" "$testdir/file1" >> "$seqres.full"
+echo "...done" >> "$seqres.full"
+_scratch_remount
 
-echo "Check scratch fs"
-umount "$SCRATCH_MNT"
+echo "Reflink the big file"
+bytes=$((blocks_needed * blksz))
+echo "reflinking $((blocks_needed / 2)) blocks, $((bytes / 2)) bytes" >> "$seqres.full"
+_reflink_range "$testdir/file1" 0 "$testdir/file2" 0 $bytes >> "$seqres.full"
 
 # success, all done
 status=0
diff --git a/tests/generic/176.out b/tests/generic/176.out
index eec98eb..538cc17 100644
--- a/tests/generic/176.out
+++ b/tests/generic/176.out
@@ -1,5 +1,4 @@
 QA output created by 176
 Format and mount
-Create a big file
-Try to reflink
-Check scratch fs
+Create a many-block file
+Reflink the big file
diff --git a/tests/generic/297 b/tests/generic/297
new file mode 100755
index 0000000..4ae2b9c
--- /dev/null
+++ b/tests/generic/297
@@ -0,0 +1,99 @@
+#! /bin/bash
+# FS QA Test No. 297
+#
+# See how well reflink handles ^C in the middle of a slow reflink.
+#
+#-----------------------------------------------------------------------
+# 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/before $TEST_DIR/after
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+. ./common/attr
+. ./common/reflink
+
+# real QA test starts here
+_supported_os Linux
+_require_scratch_reflink
+_require_cp_reflink
+_require_command "$(which timeout)" "timeout"
+
+test $FSTYP == "nfs"  && _notrun "NFS can't interrupt clone operations"
+
+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
+
+echo "Create a one block file"
+blksz="$(stat -f $testdir -c '%S')"
+_pwrite_byte 0x61 0 $blksz $testdir/file1 >> $seqres.full
+
+fnr=26		# 2^26 reflink extents should be enough to find a slow op?
+timeout=8	# guarantee a good long run...
+echo "Find a reflink size that takes a long time"
+truncate -s $(( (2 ** i) * blksz)) $testdir/file1
+for i in $(seq 0 $fnr); do
+	echo " ++ Reflink size $i, $((2 ** i)) blocks" >> $seqres.full
+	n=$(( (2 ** i) * blksz))
+	touch $TEST_DIR/before
+	$XFS_IO_PROG -f -c "reflink $testdir/file1 0 $n $n" $testdir/file1 >> $seqres.full 2>&1
+	touch $TEST_DIR/after
+	before=$(stat -c '%Y' $TEST_DIR/before)
+	after=$(stat -c '%Y' $TEST_DIR/after)
+	delta=$((after - before))
+	test $delta -gt $timeout && break
+done
+
+echo "Try to kill reflink after a shorter period of time"
+kill_after=2	# give us a shorter time to die
+n=$(stat -c '%s' $testdir/file1)
+echo "performing kill test on $n bytes..." >> $seqres.full
+touch $TEST_DIR/before
+timeout -s INT ${kill_after}s $XFS_IO_PROG -f -c "reflink $testdir/file1 0 $n $n" $testdir/file1 >> $seqres.full 2>&1
+touch $TEST_DIR/after
+before=$(stat -c '%Y' $TEST_DIR/before)
+after=$(stat -c '%Y' $TEST_DIR/after)
+delta=$((after - before))
+echo "reflink of $n bytes took $delta seconds" >> $seqres.full
+test $delta -gt $timeout && _fail "reflink didn't stop in time, n=$n t=$delta"
+
+echo "Check scratch fs"
+sleep 2		# give it a few seconds to actually die...
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/297.out b/tests/generic/297.out
new file mode 100644
index 0000000..cfe5b96
--- /dev/null
+++ b/tests/generic/297.out
@@ -0,0 +1,6 @@
+QA output created by 297
+Format and mount
+Create a one block file
+Find a reflink size that takes a long time
+Try to kill reflink after a shorter period of time
+Check scratch fs
diff --git a/tests/generic/298 b/tests/generic/298
new file mode 100755
index 0000000..e85db12
--- /dev/null
+++ b/tests/generic/298
@@ -0,0 +1,99 @@
+#! /bin/bash
+# FS QA Test No. 298
+#
+# See how well reflink handles SIGKILL in the middle of a slow reflink.
+#
+#-----------------------------------------------------------------------
+# 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/before $TEST_DIR/after
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+. ./common/attr
+. ./common/reflink
+
+# real QA test starts here
+_supported_os Linux
+_require_scratch_reflink
+_require_cp_reflink
+_require_command "$(which timeout)" "timeout"
+
+test $FSTYP == "nfs"  && _notrun "NFS can't interrupt clone operations"
+
+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
+
+echo "Create a one block file"
+blksz="$(stat -f $testdir -c '%S')"
+_pwrite_byte 0x61 0 $blksz $testdir/file1 >> $seqres.full
+
+fnr=26		# 2^26 reflink extents should be enough to find a slow op?
+timeout=8	# guarantee a good long run...
+echo "Find a reflink size that takes a long time"
+truncate -s $(( (2 ** i) * blksz)) $testdir/file1
+for i in $(seq 0 $fnr); do
+	echo " ++ Reflink size $i, $((2 ** i)) blocks" >> $seqres.full
+	n=$(( (2 ** i) * blksz))
+	touch $TEST_DIR/before
+	$XFS_IO_PROG -f -c "reflink $testdir/file1 0 $n $n" $testdir/file1 >> $seqres.full 2>&1
+	touch $TEST_DIR/after
+	before=$(stat -c '%Y' $TEST_DIR/before)
+	after=$(stat -c '%Y' $TEST_DIR/after)
+	delta=$((after - before))
+	test $delta -gt $timeout && break
+done
+
+echo "Try to kill reflink after a shorter period of time"
+kill_after=2	# give us a shorter time to die
+n=$(stat -c '%s' $testdir/file1)
+echo "performing kill test on $n bytes..." >> $seqres.full
+touch $TEST_DIR/before
+urk=$(timeout -s KILL ${kill_after}s $XFS_IO_PROG -f -c "reflink $testdir/file1 0 $n $n" $testdir/file1 >> $seqres.full 2>&1)
+touch $TEST_DIR/after
+before=$(stat -c '%Y' $TEST_DIR/before)
+after=$(stat -c '%Y' $TEST_DIR/after)
+delta=$((after - before))
+echo "reflink of $n bytes took $delta seconds" >> $seqres.full
+test $delta -gt $timeout && _fail "reflink didn't stop in time, n=$n t=$delta"
+
+echo "Check scratch fs"
+sleep 2		# give it a few seconds to actually die...
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/298.out b/tests/generic/298.out
new file mode 100644
index 0000000..c1cdc7d
--- /dev/null
+++ b/tests/generic/298.out
@@ -0,0 +1,6 @@
+QA output created by 298
+Format and mount
+Create a one block file
+Find a reflink size that takes a long time
+Try to kill reflink after a shorter period of time
+Check scratch fs
diff --git a/tests/generic/group b/tests/generic/group
index c256617..f1a398c 100644
--- a/tests/generic/group
+++ b/tests/generic/group
@@ -177,8 +177,8 @@
 172 auto quick clone
 173 auto quick clone
 174 auto quick clone
-175 clone_stress
-176 clone_stress
+175 auto quick clone
+176 auto quick clone
 177 auto quick prealloc metadata
 178 auto quick clone
 179 auto quick clone
@@ -299,6 +299,8 @@
 294 auto quick
 295 auto quick clone
 296 auto quick clone
+297 auto quick clone
+298 auto quick clone
 299 auto aio enospc rw stress
 300 auto aio enospc preallocrw stress
 306 auto quick rw


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

* [PATCH 16/32] reflink: ensure that we can handle reflinking a lot of extents
@ 2016-02-11 23:41   ` Darrick J. Wong
  0 siblings, 0 replies; 81+ messages in thread
From: Darrick J. Wong @ 2016-02-11 23:41 UTC (permalink / raw)
  To: david, darrick.wong; +Cc: fstests, Christoph Hellwig, linux-btrfs, xfs

Update the existing stress tests to ensure that we can handle
reflinking the same block a million times, and that we can handle
reflinking million different extents.  Add a couple of tests to ensure
that we can ^C and SIGKILL our way out of long-running reflinks.

v2: Don't run the signal tests on NFS, as we cannot interrupt NFS
clone operations.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
[hch@lst.de: don't run on NFS]
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 .gitignore              |    1 
 src/Makefile            |    2 -
 src/punch-alternating.c |   59 ++++++++++++++++++++++++++++
 tests/generic/175       |   46 +++++++---------------
 tests/generic/175.out   |    5 ++
 tests/generic/176       |   53 +++++++++++++++----------
 tests/generic/176.out   |    5 +-
 tests/generic/297       |   99 +++++++++++++++++++++++++++++++++++++++++++++++
 tests/generic/297.out   |    6 +++
 tests/generic/298       |   99 +++++++++++++++++++++++++++++++++++++++++++++++
 tests/generic/298.out   |    6 +++
 tests/generic/group     |    6 ++-
 12 files changed, 328 insertions(+), 59 deletions(-)
 create mode 100644 src/punch-alternating.c
 create mode 100755 tests/generic/297
 create mode 100644 tests/generic/297.out
 create mode 100755 tests/generic/298
 create mode 100644 tests/generic/298.out


diff --git a/.gitignore b/.gitignore
index bbe7c1a..c98c7bf 100644
--- a/.gitignore
+++ b/.gitignore
@@ -115,6 +115,7 @@
 /src/aio-dio-regress/aiocp
 /src/aio-dio-regress/aiodio_sparse2
 /src/aio-dio-regress/aio-dio-eof-race
+/src/punch-alternating
 /src/cloner
 /src/renameat2
 /src/t_rename_overwrite
diff --git a/src/Makefile b/src/Makefile
index 48e6765..3110208 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -19,7 +19,7 @@ LINUX_TARGETS = xfsctl bstat t_mtab getdevicesize preallo_rw_pattern_reader \
 	bulkstat_unlink_test_modified t_dir_offset t_futimens t_immutable \
 	stale_handle pwrite_mmap_blocked t_dir_offset2 seek_sanity_test \
 	seek_copy_test t_readdir_1 t_readdir_2 fsync-tester nsexec cloner \
-	renameat2 t_getcwd e4compact test-nextquota
+	renameat2 t_getcwd e4compact test-nextquota punch-alternating
 
 SUBDIRS =
 
diff --git a/src/punch-alternating.c b/src/punch-alternating.c
new file mode 100644
index 0000000..9566310
--- /dev/null
+++ b/src/punch-alternating.c
@@ -0,0 +1,59 @@
+/*
+ * Punch out every other block in a file.
+ * Copyright (C) 2016 Oracle.
+ */
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <stdlib.h>
+#include <string.h>
+#include "global.h"
+
+int main(int argc, char *argv[])
+{
+	struct stat	s;
+	off_t		offset;
+	int		fd;
+	blksize_t	blksz;
+	off_t		sz;
+	int		mode;
+	int		error;
+
+	if (argc != 2) {
+		printf("Usage: %s file\n", argv[0]);
+		printf("Punches every other block in the file.\n");
+		return 1;
+	}
+
+	fd = open(argv[1], O_WRONLY);
+	if (fd < 0)
+		goto err;
+
+	error = fstat(fd, &s);
+	if (error)
+		goto err;
+
+	sz = s.st_size;
+	blksz = s.st_blksize;
+
+	mode = FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE;
+	for (offset = 0; offset < sz; offset += blksz * 2) {
+		error = fallocate(fd, mode, offset, blksz);
+		if (error)
+			goto err;
+	}
+
+	error = fsync(fd);
+	if (error)
+		goto err;
+
+	error = close(fd);
+	if (error)
+		goto err;
+	return 0;
+err:
+	perror(argv[1]);
+	return 2;
+}
diff --git a/tests/generic/175 b/tests/generic/175
index ac2f54f..56e9919 100755
--- a/tests/generic/175
+++ b/tests/generic/175
@@ -1,12 +1,10 @@
 #! /bin/bash
 # FS QA Test No. 175
 #
-# Try to hit the maximum reference count (eek!)
-#
-# This test runs extremely slowly, so it's not automatically run anywhere.
+# See how well reflink handles reflinking the same block a million times.
 #
 #-----------------------------------------------------------------------
-# Copyright (c) 2015, Oracle and/or its affiliates.  All Rights Reserved.
+# 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
@@ -34,7 +32,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _cleanup()
 {
     cd /
-    rm -rf "$tmp".* "$testdir1"
+    rm -rf "$tmp".*
 }
 
 # get standard environment, filters and checks
@@ -55,43 +53,27 @@ _scratch_mkfs > "$seqres.full" 2>&1
 _scratch_mount >> "$seqres.full" 2>&1
 
 testdir="$SCRATCH_MNT/test-$seq"
-rm -rf "$testdir"
 mkdir "$testdir"
 
-# Well let's hope the maximum reflink count is (less than (ha!)) 2^32...
-
 echo "Create a one block file"
 blksz="$(stat -f "$testdir" -c '%S')"
 _pwrite_byte 0x61 0 $blksz "$testdir/file1" >> "$seqres.full"
-_pwrite_byte 0x62 0 $blksz "$testdir/file2" >> "$seqres.full"
-_cp_reflink "$testdir/file1" "$testdir/file2" >> "$seqres.full"
 
-nr=32
-fnr=32
+fnr=19
+echo "Create extents"
+truncate -s $(( (2 ** i) * blksz)) "$testdir/file1"
 for i in $(seq 0 $fnr); do
-	echo " ++ Reflink size $i, $(( (2 ** i) * blksz)) bytes" | tee -a "$seqres.full"
+	echo " ++ Reflink size $i, $((2 ** i)) blocks" >> "$seqres.full"
 	n=$(( (2 ** i) * blksz))
-	_reflink_range "$testdir/file1" 0 "$testdir/file1" $n $n >> "$seqres.full" || break
-done
-
-nrf=$((nr - fnr))
-echo "Clone $((2 ** nrf)) files"
-seq 0 $((2 ** nrf)) | while read i; do
-	_cp-reflink "$testdir/file1" "$testdir/file1-$i"
+	_reflink_range "$testdir/file1" 0 "$testdir/file1" $n $n >> "$seqres.full"
 done
+_scratch_remount
 
-echo "Check scratch fs"
-umount "$SCRATCH_MNT"
-_check_scratch_fs
-
-echo "Remove big file and recheck"
-_scratch_mount >> "$seqres.full" 2>&1
-umount "$SCRATCH_MNT"
-_check_scratch_fs
-
-echo "Remove all files and recheck"
-_scratch_mount >> "$seqres.full" 2>&1
-umount "$SCRATCH_MNT"
+echo "Reflink the big file"
+blks=$((2 ** (fnr + 1) ))
+bytes=$((blks * blksz))
+echo "reflinking $blks blocks, $bytes bytes" >> "$seqres.full"
+_reflink_range "$testdir/file1" 0 "$testdir/file2" 0 $bytes >> "$seqres.full"
 
 # success, all done
 status=0
diff --git a/tests/generic/175.out b/tests/generic/175.out
index e69de29..78031a5 100644
--- a/tests/generic/175.out
+++ b/tests/generic/175.out
@@ -0,0 +1,5 @@
+QA output created by 175
+Format and mount
+Create a one block file
+Create extents
+Reflink the big file
diff --git a/tests/generic/176 b/tests/generic/176
index e32f94f..a77a16d 100755
--- a/tests/generic/176
+++ b/tests/generic/176
@@ -1,10 +1,10 @@
 #! /bin/bash
 # FS QA Test No. 176
 #
-# Try to run out of space while cloning?
+# See how well reflink handles reflinking a file with a million extents.
 #
 #-----------------------------------------------------------------------
-# Copyright (c) 2015, Oracle and/or its affiliates.  All Rights Reserved.
+# 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
@@ -32,7 +32,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _cleanup()
 {
     cd /
-    rm -rf "$tmp".* "$testdir1"
+    rm -rf "$tmp".*
 }
 
 # get standard environment, filters and checks
@@ -44,6 +44,8 @@ _cleanup()
 # real QA test starts here
 _supported_os Linux
 _require_scratch_reflink
+_require_cp_reflink
+_require_test_program "punch-alternating"
 
 rm -f "$seqres.full"
 
@@ -52,28 +54,37 @@ _scratch_mkfs > "$seqres.full" 2>&1
 _scratch_mount >> "$seqres.full" 2>&1
 
 testdir="$SCRATCH_MNT/test-$seq"
-rm -rf "$testdir"
 mkdir "$testdir"
 
-blksz="$(stat -f "$testdir" -c '%S')"
-nr_free="$(stat -f -c '%f' "$testdir")"
-echo "Create a big file"
-touch "$testdir/file0" "$testdir/file1"
-_pwrite_byte 0x61 0 $((blksz * nr_free)) "$testdir/bigfile" >> "$seqres.full" 2>&1
-_scratch_remount
-sz="$(stat -c '%s' "$testdir/bigfile")"
-
-blks="$((sz / blksz))"
-echo "Try to reflink"
-seq 0 $blks | while read lblk; do
-	fname="$testdir/file$((lblk % 2))"
-	out="$(_reflink_range "$testdir/bigfile" $((lblk * blksz)) "$fname" $((lblk * blksz)) $blksz 2>&1)"
-	echo "$fname: $out" >> "$seqres.full"
-	echo "$out" | grep -q "No space left on device" && break
+# Setup for one million blocks, but we'll accept stress testing down to
+# 2^17 blocks... that should be plenty for anyone.
+fnr=20
+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 17 && _notrun "Insufficient space for stress test; would only create $blocks_needed extents."
+
+echo "Create a many-block file"
+echo "creating $blocks_needed blocks..." >> "$seqres.full"
+"$XFS_IO_PROG" -f -c "pwrite -S 0x61 -b 4194304 0 $((2 ** (fnr + 1) * blksz))" "$testdir/file1" >> "$seqres.full"
+echo "punching..." >> "$seqres.full"
+"$here/src/punch-alternating" "$testdir/file1" >> "$seqres.full"
+echo "...done" >> "$seqres.full"
+_scratch_remount
 
-echo "Check scratch fs"
-umount "$SCRATCH_MNT"
+echo "Reflink the big file"
+bytes=$((blocks_needed * blksz))
+echo "reflinking $((blocks_needed / 2)) blocks, $((bytes / 2)) bytes" >> "$seqres.full"
+_reflink_range "$testdir/file1" 0 "$testdir/file2" 0 $bytes >> "$seqres.full"
 
 # success, all done
 status=0
diff --git a/tests/generic/176.out b/tests/generic/176.out
index eec98eb..538cc17 100644
--- a/tests/generic/176.out
+++ b/tests/generic/176.out
@@ -1,5 +1,4 @@
 QA output created by 176
 Format and mount
-Create a big file
-Try to reflink
-Check scratch fs
+Create a many-block file
+Reflink the big file
diff --git a/tests/generic/297 b/tests/generic/297
new file mode 100755
index 0000000..4ae2b9c
--- /dev/null
+++ b/tests/generic/297
@@ -0,0 +1,99 @@
+#! /bin/bash
+# FS QA Test No. 297
+#
+# See how well reflink handles ^C in the middle of a slow reflink.
+#
+#-----------------------------------------------------------------------
+# 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/before $TEST_DIR/after
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+. ./common/attr
+. ./common/reflink
+
+# real QA test starts here
+_supported_os Linux
+_require_scratch_reflink
+_require_cp_reflink
+_require_command "$(which timeout)" "timeout"
+
+test $FSTYP == "nfs"  && _notrun "NFS can't interrupt clone operations"
+
+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
+
+echo "Create a one block file"
+blksz="$(stat -f $testdir -c '%S')"
+_pwrite_byte 0x61 0 $blksz $testdir/file1 >> $seqres.full
+
+fnr=26		# 2^26 reflink extents should be enough to find a slow op?
+timeout=8	# guarantee a good long run...
+echo "Find a reflink size that takes a long time"
+truncate -s $(( (2 ** i) * blksz)) $testdir/file1
+for i in $(seq 0 $fnr); do
+	echo " ++ Reflink size $i, $((2 ** i)) blocks" >> $seqres.full
+	n=$(( (2 ** i) * blksz))
+	touch $TEST_DIR/before
+	$XFS_IO_PROG -f -c "reflink $testdir/file1 0 $n $n" $testdir/file1 >> $seqres.full 2>&1
+	touch $TEST_DIR/after
+	before=$(stat -c '%Y' $TEST_DIR/before)
+	after=$(stat -c '%Y' $TEST_DIR/after)
+	delta=$((after - before))
+	test $delta -gt $timeout && break
+done
+
+echo "Try to kill reflink after a shorter period of time"
+kill_after=2	# give us a shorter time to die
+n=$(stat -c '%s' $testdir/file1)
+echo "performing kill test on $n bytes..." >> $seqres.full
+touch $TEST_DIR/before
+timeout -s INT ${kill_after}s $XFS_IO_PROG -f -c "reflink $testdir/file1 0 $n $n" $testdir/file1 >> $seqres.full 2>&1
+touch $TEST_DIR/after
+before=$(stat -c '%Y' $TEST_DIR/before)
+after=$(stat -c '%Y' $TEST_DIR/after)
+delta=$((after - before))
+echo "reflink of $n bytes took $delta seconds" >> $seqres.full
+test $delta -gt $timeout && _fail "reflink didn't stop in time, n=$n t=$delta"
+
+echo "Check scratch fs"
+sleep 2		# give it a few seconds to actually die...
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/297.out b/tests/generic/297.out
new file mode 100644
index 0000000..cfe5b96
--- /dev/null
+++ b/tests/generic/297.out
@@ -0,0 +1,6 @@
+QA output created by 297
+Format and mount
+Create a one block file
+Find a reflink size that takes a long time
+Try to kill reflink after a shorter period of time
+Check scratch fs
diff --git a/tests/generic/298 b/tests/generic/298
new file mode 100755
index 0000000..e85db12
--- /dev/null
+++ b/tests/generic/298
@@ -0,0 +1,99 @@
+#! /bin/bash
+# FS QA Test No. 298
+#
+# See how well reflink handles SIGKILL in the middle of a slow reflink.
+#
+#-----------------------------------------------------------------------
+# 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/before $TEST_DIR/after
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+. ./common/attr
+. ./common/reflink
+
+# real QA test starts here
+_supported_os Linux
+_require_scratch_reflink
+_require_cp_reflink
+_require_command "$(which timeout)" "timeout"
+
+test $FSTYP == "nfs"  && _notrun "NFS can't interrupt clone operations"
+
+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
+
+echo "Create a one block file"
+blksz="$(stat -f $testdir -c '%S')"
+_pwrite_byte 0x61 0 $blksz $testdir/file1 >> $seqres.full
+
+fnr=26		# 2^26 reflink extents should be enough to find a slow op?
+timeout=8	# guarantee a good long run...
+echo "Find a reflink size that takes a long time"
+truncate -s $(( (2 ** i) * blksz)) $testdir/file1
+for i in $(seq 0 $fnr); do
+	echo " ++ Reflink size $i, $((2 ** i)) blocks" >> $seqres.full
+	n=$(( (2 ** i) * blksz))
+	touch $TEST_DIR/before
+	$XFS_IO_PROG -f -c "reflink $testdir/file1 0 $n $n" $testdir/file1 >> $seqres.full 2>&1
+	touch $TEST_DIR/after
+	before=$(stat -c '%Y' $TEST_DIR/before)
+	after=$(stat -c '%Y' $TEST_DIR/after)
+	delta=$((after - before))
+	test $delta -gt $timeout && break
+done
+
+echo "Try to kill reflink after a shorter period of time"
+kill_after=2	# give us a shorter time to die
+n=$(stat -c '%s' $testdir/file1)
+echo "performing kill test on $n bytes..." >> $seqres.full
+touch $TEST_DIR/before
+urk=$(timeout -s KILL ${kill_after}s $XFS_IO_PROG -f -c "reflink $testdir/file1 0 $n $n" $testdir/file1 >> $seqres.full 2>&1)
+touch $TEST_DIR/after
+before=$(stat -c '%Y' $TEST_DIR/before)
+after=$(stat -c '%Y' $TEST_DIR/after)
+delta=$((after - before))
+echo "reflink of $n bytes took $delta seconds" >> $seqres.full
+test $delta -gt $timeout && _fail "reflink didn't stop in time, n=$n t=$delta"
+
+echo "Check scratch fs"
+sleep 2		# give it a few seconds to actually die...
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/298.out b/tests/generic/298.out
new file mode 100644
index 0000000..c1cdc7d
--- /dev/null
+++ b/tests/generic/298.out
@@ -0,0 +1,6 @@
+QA output created by 298
+Format and mount
+Create a one block file
+Find a reflink size that takes a long time
+Try to kill reflink after a shorter period of time
+Check scratch fs
diff --git a/tests/generic/group b/tests/generic/group
index c256617..f1a398c 100644
--- a/tests/generic/group
+++ b/tests/generic/group
@@ -177,8 +177,8 @@
 172 auto quick clone
 173 auto quick clone
 174 auto quick clone
-175 clone_stress
-176 clone_stress
+175 auto quick clone
+176 auto quick clone
 177 auto quick prealloc metadata
 178 auto quick clone
 179 auto quick clone
@@ -299,6 +299,8 @@
 294 auto quick
 295 auto quick clone
 296 auto quick clone
+297 auto quick clone
+298 auto quick clone
 299 auto aio enospc rw stress
 300 auto aio enospc preallocrw stress
 306 auto quick rw

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

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

* [PATCH 17/32] xfs: more reflink tests
  2016-02-11 23:39 ` Darrick J. Wong
@ 2016-02-11 23:41   ` Darrick J. Wong
  -1 siblings, 0 replies; 81+ messages in thread
From: Darrick J. Wong @ 2016-02-11 23:41 UTC (permalink / raw)
  To: david, darrick.wong; +Cc: linux-btrfs, fstests, xfs

Create a couple of XFS-specific tests -- one to check that growing
and shrinking the refcount btree works and a second one to check
what happens when we hit maximum refcount.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 tests/xfs/169     |   86 +++++++++++++++++++++++++++++++++++++++
 tests/xfs/169.out |    7 +++
 tests/xfs/179     |  118 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/xfs/179.out |   10 ++++
 tests/xfs/group   |    4 +-
 5 files changed, 224 insertions(+), 1 deletion(-)
 create mode 100755 tests/xfs/169
 create mode 100644 tests/xfs/169.out
 create mode 100755 tests/xfs/179
 create mode 100644 tests/xfs/179.out


diff --git a/tests/xfs/169 b/tests/xfs/169
new file mode 100755
index 0000000..996500e
--- /dev/null
+++ b/tests/xfs/169
@@ -0,0 +1,86 @@
+#! /bin/bash
+# FS QA Test No. 169
+#
+# Ensure that we can create enough distinct reflink entries to force creation
+# of a multi-level refcount btree.  Delete and recreate a few times to
+# exercise the refcount btree grow/shrink functions.
+#
+#-----------------------------------------------------------------------
+# 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 /
+    umount $SCRATCH_MNT > /dev/null 2>&1
+    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
+
+rm -f $seqres.full
+
+_scratch_mkfs >/dev/null 2>&1
+_scratch_mount
+
+testdir=$SCRATCH_MNT/test-$seq
+mkdir $testdir
+
+echo "Create the original file blocks"
+blksz="$(stat -f $testdir -c '%S')"
+nr_blks=$((8 * blksz / 12))
+
+for i in 1 2 x; do
+	_pwrite_byte 0x61 0 $((blksz * nr_blks)) $testdir/file1 >> $seqres.full
+
+	echo "$i: Reflink every other block"
+	seq 1 2 $((nr_blks - 1)) | while read nr; do
+		_reflink_range  $testdir/file1 $((nr * blksz)) \
+				$testdir/file2 $((nr * blksz)) $blksz >> $seqres.full
+	done
+	umount $SCRATCH_MNT
+	_check_scratch_fs
+	_scratch_mount
+
+	test $i = "x" && break
+
+	echo "$i: Delete both files"
+	rm -rf $testdir/file1 $testdir/file2
+	umount $SCRATCH_MNT
+	_check_scratch_fs
+	_scratch_mount
+done
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/169.out b/tests/xfs/169.out
new file mode 100644
index 0000000..1159e30
--- /dev/null
+++ b/tests/xfs/169.out
@@ -0,0 +1,7 @@
+QA output created by 169
+Create the original file blocks
+1: Reflink every other block
+1: Delete both files
+2: Reflink every other block
+2: Delete both files
+x: Reflink every other block
diff --git a/tests/xfs/179 b/tests/xfs/179
new file mode 100755
index 0000000..e0b0af8
--- /dev/null
+++ b/tests/xfs/179
@@ -0,0 +1,118 @@
+#! /bin/bash
+# FS QA Test No. 179
+#
+# See how well reflink handles overflowing reflink counts.
+#
+#-----------------------------------------------------------------------
+# 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_scratch_nocheck
+_require_cp_reflink
+_require_test_program "punch-alternating"
+
+rm -f $seqres.full
+
+echo "Format and mount"
+_scratch_mkfs -d agcount=1 > $seqres.full 2>&1
+_scratch_mount >> $seqres.full 2>&1
+
+testdir=$SCRATCH_MNT/test-$seq
+mkdir $testdir
+
+blksz=65536
+
+echo "Create original files"
+_pwrite_byte 0x61 0 $blksz $testdir/file1 >> $seqres.full
+_cp_reflink $testdir/file1 $testdir/file2 >> $seqres.full
+
+echo "Change reference count"
+umount $SCRATCH_MNT
+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
+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
+_scratch_mount >> $seqres.full
+
+echo "Reflink the overlinked file"
+_cp_reflink $testdir/file1 $testdir/file3 >> $seqres.full
+_cp_reflink $testdir/file1 $testdir/file4 >> $seqres.full
+_cp_reflink $testdir/file1 $testdir/file5 >> $seqres.full
+_cp_reflink $testdir/file1 $testdir/file6 >> $seqres.full
+_cp_reflink $testdir/file1 $testdir/file7 >> $seqres.full
+
+echo "Check scratch fs"
+umount $SCRATCH_MNT
+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
+_scratch_mount >> $seqres.full
+
+echo "CoW a couple files"
+_pwrite_byte 0x62 0 $blksz $testdir/file3 >> $seqres.full
+_pwrite_byte 0x62 0 $blksz $testdir/file5 >> $seqres.full
+_pwrite_byte 0x62 0 $blksz $testdir/file7 >> $seqres.full
+
+echo "Check scratch fs"
+umount $SCRATCH_MNT
+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
+_scratch_mount >> $seqres.full
+
+echo "Remove reflinked files"
+rm -rf $testdir/file*
+
+echo "Check scratch fs"
+umount $SCRATCH_MNT
+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_REPAIR_PROG -o force_geometry -n $SCRATCH_DEV >> $seqres.full 2>&1
+res=$?
+if [ $res -eq 0 ]; then
+	# If repair succeeds then format the device so that the post-test
+	# check doesn't fail due to the single AG.
+	_scratch_mkfs >> $seqres.full 2>&1
+else
+	_fail "xfs_repair fails"
+fi
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/179.out b/tests/xfs/179.out
new file mode 100644
index 0000000..4d3e605
--- /dev/null
+++ b/tests/xfs/179.out
@@ -0,0 +1,10 @@
+QA output created by 179
+Format and mount
+Create original files
+Change reference count
+Reflink the overlinked file
+Check scratch fs
+CoW a couple files
+Check scratch fs
+Remove reflinked files
+Check scratch fs
diff --git a/tests/xfs/group b/tests/xfs/group
index 2db3520..f0c1c2b 100644
--- a/tests/xfs/group
+++ b/tests/xfs/group
@@ -127,7 +127,7 @@
 127 auto quick clone
 128 auto quick clone
 129 auto quick clone
-130 fuzzers
+130 fuzzers clone
 131 auto quick clone
 132 auto quick clone
 133 auto quick quota
@@ -166,6 +166,7 @@
 166 rw metadata auto quick
 167 rw metadata auto stress
 168 dmapi
+169 auto quick clone
 170 rw filestreams auto quick
 171 rw filestreams
 172 rw filestreams
@@ -175,6 +176,7 @@
 176 dmapi
 177 dmapi
 178 mkfs other auto
+179 auto quick clone
 181 log auto quick
 183 rw other auto quick
 185 dmapi


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

* [PATCH 17/32] xfs: more reflink tests
@ 2016-02-11 23:41   ` Darrick J. Wong
  0 siblings, 0 replies; 81+ messages in thread
From: Darrick J. Wong @ 2016-02-11 23:41 UTC (permalink / raw)
  To: david, darrick.wong; +Cc: fstests, linux-btrfs, xfs

Create a couple of XFS-specific tests -- one to check that growing
and shrinking the refcount btree works and a second one to check
what happens when we hit maximum refcount.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 tests/xfs/169     |   86 +++++++++++++++++++++++++++++++++++++++
 tests/xfs/169.out |    7 +++
 tests/xfs/179     |  118 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/xfs/179.out |   10 ++++
 tests/xfs/group   |    4 +-
 5 files changed, 224 insertions(+), 1 deletion(-)
 create mode 100755 tests/xfs/169
 create mode 100644 tests/xfs/169.out
 create mode 100755 tests/xfs/179
 create mode 100644 tests/xfs/179.out


diff --git a/tests/xfs/169 b/tests/xfs/169
new file mode 100755
index 0000000..996500e
--- /dev/null
+++ b/tests/xfs/169
@@ -0,0 +1,86 @@
+#! /bin/bash
+# FS QA Test No. 169
+#
+# Ensure that we can create enough distinct reflink entries to force creation
+# of a multi-level refcount btree.  Delete and recreate a few times to
+# exercise the refcount btree grow/shrink functions.
+#
+#-----------------------------------------------------------------------
+# 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 /
+    umount $SCRATCH_MNT > /dev/null 2>&1
+    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
+
+rm -f $seqres.full
+
+_scratch_mkfs >/dev/null 2>&1
+_scratch_mount
+
+testdir=$SCRATCH_MNT/test-$seq
+mkdir $testdir
+
+echo "Create the original file blocks"
+blksz="$(stat -f $testdir -c '%S')"
+nr_blks=$((8 * blksz / 12))
+
+for i in 1 2 x; do
+	_pwrite_byte 0x61 0 $((blksz * nr_blks)) $testdir/file1 >> $seqres.full
+
+	echo "$i: Reflink every other block"
+	seq 1 2 $((nr_blks - 1)) | while read nr; do
+		_reflink_range  $testdir/file1 $((nr * blksz)) \
+				$testdir/file2 $((nr * blksz)) $blksz >> $seqres.full
+	done
+	umount $SCRATCH_MNT
+	_check_scratch_fs
+	_scratch_mount
+
+	test $i = "x" && break
+
+	echo "$i: Delete both files"
+	rm -rf $testdir/file1 $testdir/file2
+	umount $SCRATCH_MNT
+	_check_scratch_fs
+	_scratch_mount
+done
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/169.out b/tests/xfs/169.out
new file mode 100644
index 0000000..1159e30
--- /dev/null
+++ b/tests/xfs/169.out
@@ -0,0 +1,7 @@
+QA output created by 169
+Create the original file blocks
+1: Reflink every other block
+1: Delete both files
+2: Reflink every other block
+2: Delete both files
+x: Reflink every other block
diff --git a/tests/xfs/179 b/tests/xfs/179
new file mode 100755
index 0000000..e0b0af8
--- /dev/null
+++ b/tests/xfs/179
@@ -0,0 +1,118 @@
+#! /bin/bash
+# FS QA Test No. 179
+#
+# See how well reflink handles overflowing reflink counts.
+#
+#-----------------------------------------------------------------------
+# 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_scratch_nocheck
+_require_cp_reflink
+_require_test_program "punch-alternating"
+
+rm -f $seqres.full
+
+echo "Format and mount"
+_scratch_mkfs -d agcount=1 > $seqres.full 2>&1
+_scratch_mount >> $seqres.full 2>&1
+
+testdir=$SCRATCH_MNT/test-$seq
+mkdir $testdir
+
+blksz=65536
+
+echo "Create original files"
+_pwrite_byte 0x61 0 $blksz $testdir/file1 >> $seqres.full
+_cp_reflink $testdir/file1 $testdir/file2 >> $seqres.full
+
+echo "Change reference count"
+umount $SCRATCH_MNT
+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
+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
+_scratch_mount >> $seqres.full
+
+echo "Reflink the overlinked file"
+_cp_reflink $testdir/file1 $testdir/file3 >> $seqres.full
+_cp_reflink $testdir/file1 $testdir/file4 >> $seqres.full
+_cp_reflink $testdir/file1 $testdir/file5 >> $seqres.full
+_cp_reflink $testdir/file1 $testdir/file6 >> $seqres.full
+_cp_reflink $testdir/file1 $testdir/file7 >> $seqres.full
+
+echo "Check scratch fs"
+umount $SCRATCH_MNT
+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
+_scratch_mount >> $seqres.full
+
+echo "CoW a couple files"
+_pwrite_byte 0x62 0 $blksz $testdir/file3 >> $seqres.full
+_pwrite_byte 0x62 0 $blksz $testdir/file5 >> $seqres.full
+_pwrite_byte 0x62 0 $blksz $testdir/file7 >> $seqres.full
+
+echo "Check scratch fs"
+umount $SCRATCH_MNT
+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
+_scratch_mount >> $seqres.full
+
+echo "Remove reflinked files"
+rm -rf $testdir/file*
+
+echo "Check scratch fs"
+umount $SCRATCH_MNT
+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_REPAIR_PROG -o force_geometry -n $SCRATCH_DEV >> $seqres.full 2>&1
+res=$?
+if [ $res -eq 0 ]; then
+	# If repair succeeds then format the device so that the post-test
+	# check doesn't fail due to the single AG.
+	_scratch_mkfs >> $seqres.full 2>&1
+else
+	_fail "xfs_repair fails"
+fi
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/179.out b/tests/xfs/179.out
new file mode 100644
index 0000000..4d3e605
--- /dev/null
+++ b/tests/xfs/179.out
@@ -0,0 +1,10 @@
+QA output created by 179
+Format and mount
+Create original files
+Change reference count
+Reflink the overlinked file
+Check scratch fs
+CoW a couple files
+Check scratch fs
+Remove reflinked files
+Check scratch fs
diff --git a/tests/xfs/group b/tests/xfs/group
index 2db3520..f0c1c2b 100644
--- a/tests/xfs/group
+++ b/tests/xfs/group
@@ -127,7 +127,7 @@
 127 auto quick clone
 128 auto quick clone
 129 auto quick clone
-130 fuzzers
+130 fuzzers clone
 131 auto quick clone
 132 auto quick clone
 133 auto quick quota
@@ -166,6 +166,7 @@
 166 rw metadata auto quick
 167 rw metadata auto stress
 168 dmapi
+169 auto quick clone
 170 rw filestreams auto quick
 171 rw filestreams
 172 rw filestreams
@@ -175,6 +176,7 @@
 176 dmapi
 177 dmapi
 178 mkfs other auto
+179 auto quick clone
 181 log auto quick
 183 rw other auto quick
 185 dmapi

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

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

* [PATCH 18/32] xfs/122: support refcount/rmap data structures
  2016-02-11 23:39 ` Darrick J. Wong
@ 2016-02-11 23:41   ` Darrick J. Wong
  -1 siblings, 0 replies; 81+ messages in thread
From: Darrick J. Wong @ 2016-02-11 23:41 UTC (permalink / raw)
  To: david, darrick.wong; +Cc: linux-btrfs, fstests, xfs

Include the refcount and rmap structures in the golden output.

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


diff --git a/tests/xfs/122 b/tests/xfs/122
index e6697a2..758cb50 100755
--- a/tests/xfs/122
+++ b/tests/xfs/122
@@ -90,6 +90,9 @@ xfs_da3_icnode_hdr
 xfs_dir3_icfree_hdr
 xfs_dir3_icleaf_hdr
 xfs_name
+xfs_owner_info
+xfs_refcount_irec
+xfs_rmap_irec
 xfs_alloctype_t
 xfs_buf_cancel_t
 xfs_bmbt_rec_32_t
diff --git a/tests/xfs/122.out b/tests/xfs/122.out
index 8ba121e..c590166 100644
--- a/tests/xfs/122.out
+++ b/tests/xfs/122.out
@@ -75,6 +75,10 @@ sizeof(struct xfs_extent_data) = 24
 sizeof(struct xfs_extent_data_info) = 32
 sizeof(struct xfs_fs_eofblocks) = 128
 sizeof(struct xfs_icreate_log) = 28
+sizeof(struct xfs_refcount_key) = 4
+sizeof(struct xfs_refcount_rec) = 12
+sizeof(struct xfs_rmap_key) = 20
+sizeof(struct xfs_rmap_rec) = 24
 sizeof(xfs_agf_t) = 224
 sizeof(xfs_agfl_t) = 36
 sizeof(xfs_agi_t) = 336
diff --git a/tests/xfs/group b/tests/xfs/group
index f0c1c2b..abf1d33 100644
--- a/tests/xfs/group
+++ b/tests/xfs/group
@@ -119,7 +119,7 @@
 119 log v2log auto freeze dangerous
 120 fuzzers
 121 log auto quick
-122 other auto quick
+122 other auto quick clone
 123 fuzzers
 124 fuzzers
 125 fuzzers


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

* [PATCH 18/32] xfs/122: support refcount/rmap data structures
@ 2016-02-11 23:41   ` Darrick J. Wong
  0 siblings, 0 replies; 81+ messages in thread
From: Darrick J. Wong @ 2016-02-11 23:41 UTC (permalink / raw)
  To: david, darrick.wong; +Cc: fstests, linux-btrfs, xfs

Include the refcount and rmap structures in the golden output.

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


diff --git a/tests/xfs/122 b/tests/xfs/122
index e6697a2..758cb50 100755
--- a/tests/xfs/122
+++ b/tests/xfs/122
@@ -90,6 +90,9 @@ xfs_da3_icnode_hdr
 xfs_dir3_icfree_hdr
 xfs_dir3_icleaf_hdr
 xfs_name
+xfs_owner_info
+xfs_refcount_irec
+xfs_rmap_irec
 xfs_alloctype_t
 xfs_buf_cancel_t
 xfs_bmbt_rec_32_t
diff --git a/tests/xfs/122.out b/tests/xfs/122.out
index 8ba121e..c590166 100644
--- a/tests/xfs/122.out
+++ b/tests/xfs/122.out
@@ -75,6 +75,10 @@ sizeof(struct xfs_extent_data) = 24
 sizeof(struct xfs_extent_data_info) = 32
 sizeof(struct xfs_fs_eofblocks) = 128
 sizeof(struct xfs_icreate_log) = 28
+sizeof(struct xfs_refcount_key) = 4
+sizeof(struct xfs_refcount_rec) = 12
+sizeof(struct xfs_rmap_key) = 20
+sizeof(struct xfs_rmap_rec) = 24
 sizeof(xfs_agf_t) = 224
 sizeof(xfs_agfl_t) = 36
 sizeof(xfs_agi_t) = 336
diff --git a/tests/xfs/group b/tests/xfs/group
index f0c1c2b..abf1d33 100644
--- a/tests/xfs/group
+++ b/tests/xfs/group
@@ -119,7 +119,7 @@
 119 log v2log auto freeze dangerous
 120 fuzzers
 121 log auto quick
-122 other auto quick
+122 other auto quick clone
 123 fuzzers
 124 fuzzers
 125 fuzzers

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

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

* [PATCH 19/32] xfs: test fragmentation characteristics of copy-on-write
  2016-02-11 23:39 ` Darrick J. Wong
@ 2016-02-11 23:41   ` Darrick J. Wong
  -1 siblings, 0 replies; 81+ messages in thread
From: Darrick J. Wong @ 2016-02-11 23:41 UTC (permalink / raw)
  To: david, darrick.wong; +Cc: linux-btrfs, fstests, xfs

Perform copy-on-writes at random offsets to stress the CoW allocation
system.  Assess the effectiveness of the extent size hint at
combatting fragmentation via unshare, a rewrite, and no-op after the
random writes.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 tests/generic/301     |  100 ++++++++++++++++++++++++++++++++++++
 tests/generic/301.out |   10 ++++
 tests/generic/302     |  101 ++++++++++++++++++++++++++++++++++++
 tests/generic/302.out |   10 ++++
 tests/generic/group   |    2 +
 tests/xfs/180         |  106 ++++++++++++++++++++++++++++++++++++++
 tests/xfs/180.out     |   11 ++++
 tests/xfs/182         |  107 ++++++++++++++++++++++++++++++++++++++
 tests/xfs/182.out     |   12 ++++
 tests/xfs/184         |  105 +++++++++++++++++++++++++++++++++++++
 tests/xfs/184.out     |   10 ++++
 tests/xfs/192         |  106 ++++++++++++++++++++++++++++++++++++++
 tests/xfs/192.out     |   10 ++++
 tests/xfs/193         |  102 ++++++++++++++++++++++++++++++++++++
 tests/xfs/193.out     |   10 ++++
 tests/xfs/198         |  103 +++++++++++++++++++++++++++++++++++++
 tests/xfs/198.out     |   10 ++++
 tests/xfs/200         |  109 +++++++++++++++++++++++++++++++++++++++
 tests/xfs/200.out     |   10 ++++
 tests/xfs/204         |  110 +++++++++++++++++++++++++++++++++++++++
 tests/xfs/204.out     |   10 ++++
 tests/xfs/207         |  101 ++++++++++++++++++++++++++++++++++++
 tests/xfs/207.out     |   18 ++++++
 tests/xfs/208         |  138 +++++++++++++++++++++++++++++++++++++++++++++++++
 tests/xfs/208.out     |   13 +++++
 tests/xfs/209         |   82 +++++++++++++++++++++++++++++
 tests/xfs/209.out     |   13 +++++
 tests/xfs/210         |  108 ++++++++++++++++++++++++++++++++++++++
 tests/xfs/210.out     |   23 ++++++++
 tests/xfs/211         |  107 ++++++++++++++++++++++++++++++++++++++
 tests/xfs/211.out     |   11 ++++
 tests/xfs/group       |   13 +++++
 32 files changed, 1781 insertions(+)
 create mode 100755 tests/generic/301
 create mode 100644 tests/generic/301.out
 create mode 100755 tests/generic/302
 create mode 100644 tests/generic/302.out
 create mode 100755 tests/xfs/180
 create mode 100644 tests/xfs/180.out
 create mode 100755 tests/xfs/182
 create mode 100644 tests/xfs/182.out
 create mode 100755 tests/xfs/184
 create mode 100644 tests/xfs/184.out
 create mode 100755 tests/xfs/192
 create mode 100644 tests/xfs/192.out
 create mode 100755 tests/xfs/193
 create mode 100644 tests/xfs/193.out
 create mode 100755 tests/xfs/198
 create mode 100644 tests/xfs/198.out
 create mode 100755 tests/xfs/200
 create mode 100644 tests/xfs/200.out
 create mode 100755 tests/xfs/204
 create mode 100644 tests/xfs/204.out
 create mode 100755 tests/xfs/207
 create mode 100644 tests/xfs/207.out
 create mode 100755 tests/xfs/208
 create mode 100644 tests/xfs/208.out
 create mode 100755 tests/xfs/209
 create mode 100644 tests/xfs/209.out
 create mode 100755 tests/xfs/210
 create mode 100644 tests/xfs/210.out
 create mode 100755 tests/xfs/211
 create mode 100644 tests/xfs/211.out


diff --git a/tests/generic/301 b/tests/generic/301
new file mode 100755
index 0000000..0201d0b
--- /dev/null
+++ b/tests/generic/301
@@ -0,0 +1,100 @@
+#! /bin/bash
+# FS QA Test No. 301
+#
+# Test fragmentation after a lot of random CoW:
+# - Create two reflinked files.
+# - Buffered write to random offsets to scatter CoW reservations.
+# - Check the number of 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/reflink
+
+# real QA test starts here
+_supported_os Linux
+_require_scratch_reflink
+_require_cp_reflink
+_require_fiemap
+
+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
+
+blksz=65536
+nr=128
+filesize=$((blksz * nr))
+bufnr=16
+bufsize=$((blksz * bufnr))
+
+_require_fs_space $SCRATCH_MNT $((filesize / 1024 * 3 * 5 / 4))
+real_blksz=$(stat -f -c '%S' $testdir)
+internal_blks=$((filesize / real_blksz))
+
+echo "Create the original files"
+$XFS_IO_PROG -f -c "pwrite -S 0x61 -b $bufsize 0 $((filesize + 1))" $testdir/file1 >> $seqres.full
+_cp_reflink $testdir/file1 $testdir/file2 >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file2 | _filter_scratch
+
+echo "CoW and unmount"
+for i in `seq 1 8`; do
+	$XFS_IO_PROG -f -c "pwrite -R -S 0x63 -b $real_blksz 0 $filesize" -c "fdatasync" $testdir/file2 >> $seqres.full
+done
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+
+echo "Check extent counts"
+old_extents=$(_count_extents $testdir/file1)
+new_extents=$(_count_extents $testdir/file2)
+
+echo "old extents: $old_extents" >> $seqres.full
+echo "new extents: $new_extents" >> $seqres.full
+echo "maximum extents: $internal_blks" >> $seqres.full
+test $new_extents -lt $((internal_blks * 2 / 3)) || echo "file2 badly fragmented"
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/301.out b/tests/generic/301.out
new file mode 100644
index 0000000..3b677cb
--- /dev/null
+++ b/tests/generic/301.out
@@ -0,0 +1,10 @@
+QA output created by 301
+Format and mount
+Create the original files
+Compare files
+2909feb63a37b0e95fe5cfb7f274f7b1  SCRATCH_MNT/test-301/file1
+2909feb63a37b0e95fe5cfb7f274f7b1  SCRATCH_MNT/test-301/file2
+CoW and unmount
+Compare files
+2909feb63a37b0e95fe5cfb7f274f7b1  SCRATCH_MNT/test-301/file1
+Check extent counts
diff --git a/tests/generic/302 b/tests/generic/302
new file mode 100755
index 0000000..c48da0a
--- /dev/null
+++ b/tests/generic/302
@@ -0,0 +1,101 @@
+#! /bin/bash
+# FS QA Test No. 302
+#
+# Test fragmentation after a lot of random CoW:
+# - Create two reflinked files.
+# - Directio write to random offsets to scatter CoW reservations.
+# - Check the number of 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/reflink
+
+# real QA test starts here
+_supported_os Linux
+_require_scratch_reflink
+_require_cp_reflink
+_require_fiemap
+_require_odirect
+
+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
+
+blksz=65536
+nr=128
+filesize=$((blksz * nr))
+bufnr=16
+bufsize=$((blksz * bufnr))
+
+_require_fs_space $SCRATCH_MNT $((filesize / 1024 * 3 * 5 / 4))
+real_blksz=$(stat -f -c '%S' $testdir)
+internal_blks=$((filesize / real_blksz))
+
+echo "Create the original files"
+$XFS_IO_PROG -f -c "pwrite -S 0x61 -b $bufsize 0 $((filesize + 1))" $testdir/file1 >> $seqres.full
+_cp_reflink $testdir/file1 $testdir/file2 >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file2 | _filter_scratch
+
+echo "CoW and unmount"
+for i in `seq 1 8`; do
+	$XFS_IO_PROG -d -f -c "pwrite -R -S 0x63 -b $real_blksz 0 $filesize" $testdir/file2 >> $seqres.full
+done
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+
+echo "Check extent counts"
+old_extents=$(_count_extents $testdir/file1)
+new_extents=$(_count_extents $testdir/file2)
+
+echo "old extents: $old_extents" >> $seqres.full
+echo "new extents: $new_extents" >> $seqres.full
+echo "maximum extents: $internal_blks" >> $seqres.full
+test $new_extents -le $internal_blks || echo "file2 badly fragmented"
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/302.out b/tests/generic/302.out
new file mode 100644
index 0000000..6a46fd7
--- /dev/null
+++ b/tests/generic/302.out
@@ -0,0 +1,10 @@
+QA output created by 302
+Format and mount
+Create the original files
+Compare files
+2909feb63a37b0e95fe5cfb7f274f7b1  SCRATCH_MNT/test-302/file1
+2909feb63a37b0e95fe5cfb7f274f7b1  SCRATCH_MNT/test-302/file2
+CoW and unmount
+Compare files
+2909feb63a37b0e95fe5cfb7f274f7b1  SCRATCH_MNT/test-302/file1
+Check extent counts
diff --git a/tests/generic/group b/tests/generic/group
index f1a398c..7edc963 100644
--- a/tests/generic/group
+++ b/tests/generic/group
@@ -303,6 +303,8 @@
 298 auto quick clone
 299 auto aio enospc rw stress
 300 auto aio enospc preallocrw stress
+301 auto quick clone
+302 auto quick clone
 306 auto quick rw
 307 auto quick
 308 auto quick
diff --git a/tests/xfs/180 b/tests/xfs/180
new file mode 100755
index 0000000..fdb24eb
--- /dev/null
+++ b/tests/xfs/180
@@ -0,0 +1,106 @@
+#! /bin/bash
+# FS QA Test No. 180
+#
+# Test fragmentation after a lot of random CoW:
+# - Create two reflinked files.  Set extsz hint on second file.
+# - Buffered write to random offsets to scatter CoW reservations.
+# - Rewrite the whole file to use up reservations.
+# - Check the number of 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/reflink
+
+# real QA test starts here
+_supported_os Linux
+_supported_fs xfs
+_require_scratch_reflink
+_require_cp_reflink
+_require_fiemap
+_require_xfs_io_command "cowextsize"
+
+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
+
+blksz=65536
+nr=128
+filesize=$((blksz * nr))
+bufnr=16
+bufsize=$((blksz * bufnr))
+
+_require_fs_space $SCRATCH_MNT $((filesize / 1024 * 3 * 5 / 4))
+real_blksz=$(stat -f -c '%S' $testdir)
+internal_blks=$((filesize / real_blksz))
+
+echo "Create the original files"
+$XFS_IO_PROG -f -c "pwrite -S 0x61 -b $bufsize 0 $((filesize + 1))" $testdir/file1 >> $seqres.full
+$XFS_IO_PROG -f -c "cowextsize $bufsize" $testdir/file2
+_cp_reflink $testdir/file1 $testdir/file2 >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file2 | _filter_scratch
+
+echo "CoW and unmount"
+$XFS_IO_PROG -f -c "cowextsize" $testdir/file2 >> $seqres.full
+$XFS_IO_PROG -f -c "pwrite -R -S 0x63 -b $real_blksz 0 $filesize" -c "fdatasync" $testdir/file2 >> $seqres.full
+$XFS_IO_PROG -f -c "pwrite -S 0x63 -b $real_blksz 0 $((filesize + 1))" -c "fdatasync" $testdir/file2 >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file2 | _filter_scratch
+
+echo "Check extent counts"
+old_extents=$(_count_extents $testdir/file1)
+new_extents=$(_count_extents $testdir/file2)
+
+echo "old extents: $old_extents" >> $seqres.full
+echo "new extents: $new_extents" >> $seqres.full
+echo "maximum extents: $internal_blks" >> $seqres.full
+test $new_extents -lt $((internal_blks / 20)) || test $new_extents -lt 15 \
+	|| echo "file2 badly fragmented"
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/180.out b/tests/xfs/180.out
new file mode 100644
index 0000000..a1cc4fd
--- /dev/null
+++ b/tests/xfs/180.out
@@ -0,0 +1,11 @@
+QA output created by 180
+Format and mount
+Create the original files
+Compare files
+2909feb63a37b0e95fe5cfb7f274f7b1  SCRATCH_MNT/test-180/file1
+2909feb63a37b0e95fe5cfb7f274f7b1  SCRATCH_MNT/test-180/file2
+CoW and unmount
+Compare files
+2909feb63a37b0e95fe5cfb7f274f7b1  SCRATCH_MNT/test-180/file1
+d41f6527bc8320364e12ea7076140b8b  SCRATCH_MNT/test-180/file2
+Check extent counts
diff --git a/tests/xfs/182 b/tests/xfs/182
new file mode 100755
index 0000000..c1bfc02
--- /dev/null
+++ b/tests/xfs/182
@@ -0,0 +1,107 @@
+#! /bin/bash
+# FS QA Test No. 182
+#
+# Test fragmentation after a lot of random CoW:
+# - Create two reflinked files.  Set extsz hint on second file.
+# - Directio write to random offsets to scatter CoW reservations.
+# - Rewrite the whole file to use up reservations.
+# - Check the number of 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/reflink
+
+# real QA test starts here
+_supported_os Linux
+_supported_fs xfs
+_require_scratch_reflink
+_require_cp_reflink
+_require_fiemap
+_require_xfs_io_command "cowextsize"
+_require_odirect
+
+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
+
+blksz=65536
+nr=128
+filesize=$((blksz * nr))
+bufnr=16
+bufsize=$((blksz * bufnr))
+
+_require_fs_space $SCRATCH_MNT $((filesize / 1024 * 3 * 5 / 4))
+real_blksz=$(stat -f -c '%S' $testdir)
+internal_blks=$((filesize / real_blksz))
+
+echo "Create the original files"
+$XFS_IO_PROG -f -c "pwrite -S 0x61 -b $bufsize 0 $((filesize + 1))" $testdir/file1 >> $seqres.full
+$XFS_IO_PROG -f -c "cowextsize $bufsize" $testdir/file2
+_cp_reflink $testdir/file1 $testdir/file2 >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file2 | _filter_scratch
+
+echo "CoW and unmount"
+$XFS_IO_PROG -f -c "cowextsize" $testdir/file2 >> $seqres.full
+$XFS_IO_PROG -d -f -c "pwrite -R -S 0x63 -b $real_blksz 0 $((filesize + 1))" $testdir/file2 >> $seqres.full
+$XFS_IO_PROG -d -f -c "pwrite -S 0x63 -b $real_blksz 0 $((filesize + 1))" $testdir/file2 >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file2 | _filter_scratch
+
+echo "Check extent counts"
+old_extents=$(_count_extents $testdir/file1)
+new_extents=$(_count_extents $testdir/file2)
+
+echo "old extents: $old_extents" >> $seqres.full
+echo "new extents: $new_extents" >> $seqres.full
+echo "maximum extents: $internal_blks" >> $seqres.full
+test $new_extents -lt $((internal_blks / 20)) || test $new_extents -lt 15 \
+	|| echo "file2 badly fragmented"
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/182.out b/tests/xfs/182.out
new file mode 100644
index 0000000..7b0af93
--- /dev/null
+++ b/tests/xfs/182.out
@@ -0,0 +1,12 @@
+QA output created by 182
+Format and mount
+Create the original files
+Compare files
+2909feb63a37b0e95fe5cfb7f274f7b1  SCRATCH_MNT/test-182/file1
+2909feb63a37b0e95fe5cfb7f274f7b1  SCRATCH_MNT/test-182/file2
+CoW and unmount
+pwrite64: Invalid argument
+Compare files
+2909feb63a37b0e95fe5cfb7f274f7b1  SCRATCH_MNT/test-182/file1
+c6ba35da9f73ced20d7781a448cc11d4  SCRATCH_MNT/test-182/file2
+Check extent counts
diff --git a/tests/xfs/184 b/tests/xfs/184
new file mode 100755
index 0000000..50674ff
--- /dev/null
+++ b/tests/xfs/184
@@ -0,0 +1,105 @@
+#! /bin/bash
+# FS QA Test No. 184
+#
+# Test fragmentation after a lot of random CoW:
+# - Create two reflinked files.  Set extsz hint on second file.
+# - Buffered write to random offsets to scatter CoW reservations.
+# - falloc the whole file to unshare blocks.
+# - Check the number of 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/reflink
+
+# real QA test starts here
+_supported_os Linux
+_supported_fs xfs
+_require_scratch_reflink
+_require_cp_reflink
+_require_fiemap
+_require_xfs_io_command "cowextsize"
+
+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
+
+blksz=65536
+nr=128
+filesize=$((blksz * nr))
+bufnr=16
+bufsize=$((blksz * bufnr))
+
+_require_fs_space $SCRATCH_MNT $((filesize / 1024 * 3 * 5 / 4))
+real_blksz=$(stat -f -c '%S' $testdir)
+internal_blks=$((filesize / real_blksz))
+
+echo "Create the original files"
+$XFS_IO_PROG -f -c "pwrite -S 0x61 -b $bufsize 0 $((filesize + 1))" $testdir/file1 >> $seqres.full
+$XFS_IO_PROG -f -c "cowextsize $bufsize" $testdir/file2
+_cp_reflink $testdir/file1 $testdir/file2 >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file2 | _filter_scratch
+
+echo "CoW and unmount"
+$XFS_IO_PROG -f -c "cowextsize" $testdir/file2 >> $seqres.full
+$XFS_IO_PROG -f -c "pwrite -R -S 0x63 -b $real_blksz 0 $((filesize + 1))" -c "fdatasync" $testdir/file2 >> $seqres.full
+$XFS_IO_PROG -f -c "falloc 0 $((filesize + 1))" $testdir/file2 >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+
+echo "Check extent counts"
+old_extents=$(_count_extents $testdir/file1)
+new_extents=$(_count_extents $testdir/file2)
+
+echo "old extents: $old_extents" >> $seqres.full
+echo "new extents: $new_extents" >> $seqres.full
+echo "maximum extents: $internal_blks" >> $seqres.full
+test $new_extents -lt $((internal_blks / 20)) || test $new_extents -lt 15 \
+	|| echo "file2 badly fragmented"
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/184.out b/tests/xfs/184.out
new file mode 100644
index 0000000..f6f6061
--- /dev/null
+++ b/tests/xfs/184.out
@@ -0,0 +1,10 @@
+QA output created by 184
+Format and mount
+Create the original files
+Compare files
+2909feb63a37b0e95fe5cfb7f274f7b1  SCRATCH_MNT/test-184/file1
+2909feb63a37b0e95fe5cfb7f274f7b1  SCRATCH_MNT/test-184/file2
+CoW and unmount
+Compare files
+2909feb63a37b0e95fe5cfb7f274f7b1  SCRATCH_MNT/test-184/file1
+Check extent counts
diff --git a/tests/xfs/192 b/tests/xfs/192
new file mode 100755
index 0000000..6429def
--- /dev/null
+++ b/tests/xfs/192
@@ -0,0 +1,106 @@
+#! /bin/bash
+# FS QA Test No. 192
+#
+# Test fragmentation after a lot of random CoW:
+# - Create two reflinked files.  Set extsz hint on second file.
+# - Directio write to random offsets to scatter CoW reservations.
+# - falloc the whole file to unshare blocks.
+# - Check the number of 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/reflink
+
+# real QA test starts here
+_supported_os Linux
+_supported_fs xfs
+_require_scratch_reflink
+_require_cp_reflink
+_require_fiemap
+_require_xfs_io_command "cowextsize"
+_require_odirect
+
+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
+
+blksz=65536
+nr=128
+filesize=$((blksz * nr))
+bufnr=16
+bufsize=$((blksz * bufnr))
+
+_require_fs_space $SCRATCH_MNT $((filesize / 1024 * 3 * 5 / 4))
+real_blksz=$(stat -f -c '%S' $testdir)
+internal_blks=$((filesize / real_blksz))
+
+echo "Create the original files"
+$XFS_IO_PROG -f -c "pwrite -S 0x61 -b $bufsize 0 $((filesize + 1))" $testdir/file1 >> $seqres.full
+$XFS_IO_PROG -f -c "cowextsize $bufsize" $testdir/file2
+_cp_reflink $testdir/file1 $testdir/file2 >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file2 | _filter_scratch
+
+echo "CoW and unmount"
+$XFS_IO_PROG -f -c "cowextsize" $testdir/file2 >> $seqres.full
+$XFS_IO_PROG -d -f -c "pwrite -R -S 0x63 -b $real_blksz 0 $filesize" $testdir/file2 >> $seqres.full
+$XFS_IO_PROG -d -f -c "falloc 0 $filesize" $testdir/file2 >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+
+echo "Check extent counts"
+old_extents=$(_count_extents $testdir/file1)
+new_extents=$(_count_extents $testdir/file2)
+
+echo "old extents: $old_extents" >> $seqres.full
+echo "new extents: $new_extents" >> $seqres.full
+echo "maximum extents: $internal_blks" >> $seqres.full
+test $new_extents -lt $((internal_blks / 20)) || test $new_extents -lt 15 \
+	|| echo "file2 badly fragmented"
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/192.out b/tests/xfs/192.out
new file mode 100644
index 0000000..13c8061
--- /dev/null
+++ b/tests/xfs/192.out
@@ -0,0 +1,10 @@
+QA output created by 192
+Format and mount
+Create the original files
+Compare files
+2909feb63a37b0e95fe5cfb7f274f7b1  SCRATCH_MNT/test-192/file1
+2909feb63a37b0e95fe5cfb7f274f7b1  SCRATCH_MNT/test-192/file2
+CoW and unmount
+Compare files
+2909feb63a37b0e95fe5cfb7f274f7b1  SCRATCH_MNT/test-192/file1
+Check extent counts
diff --git a/tests/xfs/193 b/tests/xfs/193
new file mode 100755
index 0000000..974f1eb
--- /dev/null
+++ b/tests/xfs/193
@@ -0,0 +1,102 @@
+#! /bin/bash
+# FS QA Test No. 193
+#
+# Test fragmentation after a lot of random CoW:
+# - Create two reflinked files.  Set extsz hint on second file.
+# - Buffered write to random offsets to scatter CoW reservations.
+# - Check the number of 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/reflink
+
+# real QA test starts here
+_supported_os Linux
+_supported_fs xfs
+_require_scratch_reflink
+_require_cp_reflink
+_require_fiemap
+_require_xfs_io_command "cowextsize"
+
+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
+
+blksz=65536
+nr=128
+filesize=$((blksz * nr))
+bufnr=16
+bufsize=$((blksz * bufnr))
+
+_require_fs_space $SCRATCH_MNT $((filesize / 1024 * 3 * 5 / 4))
+real_blksz=$(stat -f -c '%S' $testdir)
+internal_blks=$((filesize / real_blksz))
+
+echo "Create the original files"
+$XFS_IO_PROG -f -c "pwrite -S 0x61 -b $bufsize 0 $((filesize + 1))" $testdir/file1 >> $seqres.full
+$XFS_IO_PROG -f -c "cowextsize $bufsize" $testdir/file2
+_cp_reflink $testdir/file1 $testdir/file2 >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file2 | _filter_scratch
+
+echo "CoW and unmount"
+$XFS_IO_PROG -f -c "cowextsize" $testdir/file2 >> $seqres.full
+$XFS_IO_PROG -f -c "pwrite -R -S 0x63 -b $real_blksz 0 $filesize" -c "fdatasync" $testdir/file2 >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+
+echo "Check extent counts"
+old_extents=$(_count_extents $testdir/file1)
+new_extents=$(_count_extents $testdir/file2)
+
+echo "old extents: $old_extents" >> $seqres.full
+echo "new extents: $new_extents" >> $seqres.full
+echo "maximum extents: $internal_blks" >> $seqres.full
+test $new_extents -lt $((internal_blks * 2 / 3)) || echo "file2 badly fragmented"
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/193.out b/tests/xfs/193.out
new file mode 100644
index 0000000..cc12b6b
--- /dev/null
+++ b/tests/xfs/193.out
@@ -0,0 +1,10 @@
+QA output created by 193
+Format and mount
+Create the original files
+Compare files
+2909feb63a37b0e95fe5cfb7f274f7b1  SCRATCH_MNT/test-193/file1
+2909feb63a37b0e95fe5cfb7f274f7b1  SCRATCH_MNT/test-193/file2
+CoW and unmount
+Compare files
+2909feb63a37b0e95fe5cfb7f274f7b1  SCRATCH_MNT/test-193/file1
+Check extent counts
diff --git a/tests/xfs/198 b/tests/xfs/198
new file mode 100755
index 0000000..7f3c105
--- /dev/null
+++ b/tests/xfs/198
@@ -0,0 +1,103 @@
+#! /bin/bash
+# FS QA Test No. 198
+#
+# Test fragmentation after a lot of random CoW:
+# - Create two reflinked files.  Set extsz hint on second file.
+# - Directio write to random offsets to scatter CoW reservations.
+# - Check the number of 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/reflink
+
+# real QA test starts here
+_supported_os Linux
+_supported_fs xfs
+_require_scratch_reflink
+_require_cp_reflink
+_require_fiemap
+_require_xfs_io_command "cowextsize"
+_require_odirect
+
+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
+
+blksz=65536
+nr=128
+filesize=$((blksz * nr))
+bufnr=16
+bufsize=$((blksz * bufnr))
+
+_require_fs_space $SCRATCH_MNT $((filesize / 1024 * 3 * 5 / 4))
+real_blksz=$(stat -f -c '%S' $testdir)
+internal_blks=$((filesize / real_blksz))
+
+echo "Create the original files"
+$XFS_IO_PROG -f -c "pwrite -S 0x61 -b $bufsize 0 $((filesize + 1))" $testdir/file1 >> $seqres.full
+$XFS_IO_PROG -f -c "cowextsize $bufsize" $testdir/file2
+_cp_reflink $testdir/file1 $testdir/file2 >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file2 | _filter_scratch
+
+echo "CoW and unmount"
+$XFS_IO_PROG -f -c "cowextsize" $testdir/file2 >> $seqres.full
+$XFS_IO_PROG -d -f -c "pwrite -R -S 0x63 -b $real_blksz 0 $filesize" $testdir/file2 >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+
+echo "Check extent counts"
+old_extents=$(_count_extents $testdir/file1)
+new_extents=$(_count_extents $testdir/file2)
+
+echo "old extents: $old_extents" >> $seqres.full
+echo "new extents: $new_extents" >> $seqres.full
+echo "maximum extents: $internal_blks" >> $seqres.full
+test $new_extents -lt $((internal_blks * 2 / 3)) || echo "file2 badly fragmented"
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/198.out b/tests/xfs/198.out
new file mode 100644
index 0000000..e1d1831
--- /dev/null
+++ b/tests/xfs/198.out
@@ -0,0 +1,10 @@
+QA output created by 198
+Format and mount
+Create the original files
+Compare files
+2909feb63a37b0e95fe5cfb7f274f7b1  SCRATCH_MNT/test-198/file1
+2909feb63a37b0e95fe5cfb7f274f7b1  SCRATCH_MNT/test-198/file2
+CoW and unmount
+Compare files
+2909feb63a37b0e95fe5cfb7f274f7b1  SCRATCH_MNT/test-198/file1
+Check extent counts
diff --git a/tests/xfs/200 b/tests/xfs/200
new file mode 100755
index 0000000..99bcf31
--- /dev/null
+++ b/tests/xfs/200
@@ -0,0 +1,109 @@
+#! /bin/bash
+# FS QA Test No. 200
+#
+# Test fragmentation after a lot of random CoW:
+# - Create two reflinked files.  Set extsz hint on second file.
+# - Read the whole file into memory.
+# - Buffered write to random offsets to scatter CoW reservations.
+# - fadvise(dontneed) the whole file to evict the pages.
+# - falloc the whole fle to see if the extsz hints still apply.
+# - Check the number of 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/reflink
+
+# real QA test starts here
+_supported_os Linux
+_supported_fs xfs
+_require_scratch_reflink
+_require_cp_reflink
+_require_fiemap
+_require_xfs_io_command "cowextsize"
+
+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
+
+blksz=65536
+nr=128
+filesize=$((blksz * nr))
+bufnr=16
+bufsize=$((blksz * bufnr))
+
+_require_fs_space $SCRATCH_MNT $((filesize / 1024 * 3 * 5 / 4))
+real_blksz=$(stat -f -c '%S' $testdir)
+internal_blks=$((filesize / real_blksz))
+
+echo "Create the original files"
+$XFS_IO_PROG -f -c "pwrite -S 0x61 -b $bufsize 0 $((filesize + 1))" $testdir/file1 >> $seqres.full
+$XFS_IO_PROG -f -c "cowextsize $bufsize" $testdir/file2
+_cp_reflink $testdir/file1 $testdir/file2 >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file2 | _filter_scratch
+
+echo "CoW and unmount"
+$XFS_IO_PROG -f -c "cowextsize" $testdir/file2 >> $seqres.full
+cat $testdir/file2 > /dev/null
+$XFS_IO_PROG -f -c "pwrite -R -S 0x63 -b $real_blksz 0 $filesize" -c "fdatasync" $testdir/file2 >> $seqres.full
+$XFS_IO_PROG -f -c "fadvise -d 0 $filesize" -c "fsync" $testdir/file2 >> $seqres.full
+$XFS_IO_PROG -f -c "falloc 0 $filesize" $testdir/file2 >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+
+echo "Check extent counts"
+old_extents=$(_count_extents $testdir/file1)
+new_extents=$(_count_extents $testdir/file2)
+
+echo "old extents: $old_extents" >> $seqres.full
+echo "new extents: $new_extents" >> $seqres.full
+echo "maximum extents: $internal_blks" >> $seqres.full
+test $new_extents -lt $((internal_blks / 20)) || test $new_extents -lt 15 \
+	|| echo "file2 badly fragmented"
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/200.out b/tests/xfs/200.out
new file mode 100644
index 0000000..6e0a1ee
--- /dev/null
+++ b/tests/xfs/200.out
@@ -0,0 +1,10 @@
+QA output created by 200
+Format and mount
+Create the original files
+Compare files
+2909feb63a37b0e95fe5cfb7f274f7b1  SCRATCH_MNT/test-200/file1
+2909feb63a37b0e95fe5cfb7f274f7b1  SCRATCH_MNT/test-200/file2
+CoW and unmount
+Compare files
+2909feb63a37b0e95fe5cfb7f274f7b1  SCRATCH_MNT/test-200/file1
+Check extent counts
diff --git a/tests/xfs/204 b/tests/xfs/204
new file mode 100755
index 0000000..3159849
--- /dev/null
+++ b/tests/xfs/204
@@ -0,0 +1,110 @@
+#! /bin/bash
+# FS QA Test No. 204
+#
+# Test fragmentation after a lot of random CoW:
+# - Create two reflinked files.  Set extsz hint on second file.
+# - Read the whole file into memory.
+# - DIO write to random offsets to scatter CoW reservations.
+# - fadvise(dontneed) the whole file to evict the pages.
+# - falloc the whole fle to see if the extsz hints still apply.
+# - Check the number of 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/reflink
+
+# real QA test starts here
+_supported_os Linux
+_supported_fs xfs
+_require_scratch_reflink
+_require_cp_reflink
+_require_fiemap
+_require_xfs_io_command "cowextsize"
+_require_odirect
+
+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
+
+blksz=65536
+nr=128
+filesize=$((blksz * nr))
+bufnr=16
+bufsize=$((blksz * bufnr))
+
+_require_fs_space $SCRATCH_MNT $((filesize / 1024 * 3 * 5 / 4))
+real_blksz=$(stat -f -c '%S' $testdir)
+internal_blks=$((filesize / real_blksz))
+
+echo "Create the original files"
+$XFS_IO_PROG -f -c "pwrite -S 0x61 -b $bufsize 0 $((filesize + 1))" $testdir/file1 >> $seqres.full
+$XFS_IO_PROG -f -c "cowextsize $bufsize" $testdir/file2
+_cp_reflink $testdir/file1 $testdir/file2 >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file2 | _filter_scratch
+
+echo "CoW and unmount"
+$XFS_IO_PROG -f -c "cowextsize" $testdir/file2 >> $seqres.full
+cat $testdir/file2 > /dev/null
+$XFS_IO_PROG -d -f -c "pwrite -R -S 0x63 -b $real_blksz 0 $filesize" -c "fdatasync" $testdir/file2 >> $seqres.full
+$XFS_IO_PROG -f -c "fadvise -d 0 $filesize" -c "fsync" $testdir/file2 >> $seqres.full
+$XFS_IO_PROG -f -c "falloc 0 $filesize" $testdir/file2 >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+
+echo "Check extent counts"
+old_extents=$(_count_extents $testdir/file1)
+new_extents=$(_count_extents $testdir/file2)
+
+echo "old extents: $old_extents" >> $seqres.full
+echo "new extents: $new_extents" >> $seqres.full
+echo "maximum extents: $internal_blks" >> $seqres.full
+test $new_extents -lt $((internal_blks / 20)) || test $new_extents -lt 15 \
+	|| echo "file2 badly fragmented"
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/204.out b/tests/xfs/204.out
new file mode 100644
index 0000000..702cd72
--- /dev/null
+++ b/tests/xfs/204.out
@@ -0,0 +1,10 @@
+QA output created by 204
+Format and mount
+Create the original files
+Compare files
+2909feb63a37b0e95fe5cfb7f274f7b1  SCRATCH_MNT/test-204/file1
+2909feb63a37b0e95fe5cfb7f274f7b1  SCRATCH_MNT/test-204/file2
+CoW and unmount
+Compare files
+2909feb63a37b0e95fe5cfb7f274f7b1  SCRATCH_MNT/test-204/file1
+Check extent counts
diff --git a/tests/xfs/207 b/tests/xfs/207
new file mode 100755
index 0000000..d416f79
--- /dev/null
+++ b/tests/xfs/207
@@ -0,0 +1,101 @@
+#! /bin/bash
+# FS QA Test No. 207
+#
+# Test setting the extsz and cowextsz hints:
+# - Ensure that we can set both on a zero-byte file.
+# - Ensure that we can set only cowextsz on a many-byte file.
+# - Ensure that whatever we set we get back later.
+#
+#-----------------------------------------------------------------------
+# 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_reflink
+_require_cp_reflink
+_require_fiemap
+_require_xfs_io_command "cowextsize"
+
+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
+
+echo "Create the original files"
+$XFS_IO_PROG -f -c "pwrite -S 0x61 0 0" $testdir/file1 >> $seqres.full
+$XFS_IO_PROG -f -c "pwrite -S 0x61 0 1048576" $testdir/file2 >> $seqres.full
+$XFS_IO_PROG -f -c "pwrite -S 0x61 0 0" $testdir/file3 >> $seqres.full
+_scratch_remount
+
+echo "Set extsz and cowextsz on zero byte file"
+$XFS_IO_PROG -c "extsize 1048576" $testdir/file1 | _filter_scratch
+$XFS_IO_PROG -c "cowextsize 1048576" $testdir/file1 | _filter_scratch
+
+echo "Set extsz and cowextsz on 1Mbyte file"
+$XFS_IO_PROG -c "extsize 1048576" $testdir/file2 | _filter_scratch
+$XFS_IO_PROG -c "cowextsize 1048576" $testdir/file2 | _filter_scratch
+_scratch_remount
+
+echo "Check extsz and cowextsz settings on zero byte file"
+$XFS_IO_PROG -c "extsize" $testdir/file1 | _filter_scratch
+$XFS_IO_PROG -c "cowextsize" $testdir/file1 | _filter_scratch
+
+echo "Check extsz and cowextsz settings on 1Mbyte file"
+$XFS_IO_PROG -c "extsize" $testdir/file2 | _filter_scratch
+$XFS_IO_PROG -c "cowextsize" $testdir/file2 | _filter_scratch
+
+echo "Set cowextsize and check flag"
+$XFS_IO_PROG -c "cowextsize 1048576" $testdir/file3 | _filter_scratch
+_scratch_remount
+
+$XFS_IO_PROG -c "stat" $testdir/file3 | grep 'fsxattr.xflags' | _filter_scratch
+$XFS_IO_PROG -c "cowextsize" $testdir/file3 | _filter_scratch
+
+echo "Unset cowextsize and check flag"
+$XFS_IO_PROG -c "cowextsize 0" $testdir/file3 | _filter_scratch
+_scratch_remount
+
+$XFS_IO_PROG -c "stat" $testdir/file3 | grep 'fsxattr.xflags' | _filter_scratch
+$XFS_IO_PROG -c "cowextsize" $testdir/file3 | _filter_scratch
+
+status=0
+exit
diff --git a/tests/xfs/207.out b/tests/xfs/207.out
new file mode 100644
index 0000000..14eede4
--- /dev/null
+++ b/tests/xfs/207.out
@@ -0,0 +1,18 @@
+QA output created by 207
+Format and mount
+Create the original files
+Set extsz and cowextsz on zero byte file
+Set extsz and cowextsz on 1Mbyte file
+xfs_io: XFS_IOC_FSSETXATTR SCRATCH_MNT/test-207/file2: Invalid argument
+Check extsz and cowextsz settings on zero byte file
+[1048576] SCRATCH_MNT/test-207/file1
+[1048576] SCRATCH_MNT/test-207/file1
+Check extsz and cowextsz settings on 1Mbyte file
+[0] SCRATCH_MNT/test-207/file2
+[1048576] SCRATCH_MNT/test-207/file2
+Set cowextsize and check flag
+fsxattr.xflags = 0x20000 [---------------C]
+[1048576] SCRATCH_MNT/test-207/file3
+Unset cowextsize and check flag
+fsxattr.xflags = 0x0 [----------------]
+[0] SCRATCH_MNT/test-207/file3
diff --git a/tests/xfs/208 b/tests/xfs/208
new file mode 100755
index 0000000..d876898
--- /dev/null
+++ b/tests/xfs/208
@@ -0,0 +1,138 @@
+#! /bin/bash
+# FS QA Test No. 208
+#
+# Ensure that the effective cow extent allocation size hint is the maximum of
+# the cowextsize and extsize inode fields.
+# - Create two reflinked files.  Set extsz hint on second file to $blocksize
+#   and cowextsize hint to 1MB.
+# - Buffered write to random offsets to scatter CoW reservations.
+# - Rewrite the whole file to use up reservations.
+# - Check the number of extents.
+# - Repeat, but with extsz = 1MB and cowextsz = $blocksize.
+#
+#-----------------------------------------------------------------------
+# 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_reflink
+_require_cp_reflink
+_require_fiemap
+_require_xfs_io_command "cowextsize"
+
+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
+
+blksz=65536
+nr=128
+filesize=$((blksz * nr))
+bufnr=16
+bufsize=$((blksz * bufnr))
+
+_require_fs_space $SCRATCH_MNT $((filesize / 1024 * 3 * 5 / 4))
+real_blksz=$(stat -f -c '%S' $testdir)
+internal_blks=$((filesize / real_blksz))
+
+echo "Create the original files"
+$XFS_IO_PROG -f -c "pwrite -S 0x61 -b $bufsize 0 $((filesize + 1))" $testdir/file1 >> $seqres.full
+
+$XFS_IO_PROG -f -c "extsize $real_blksz" $testdir/file2
+$XFS_IO_PROG -f -c "cowextsize $bufsize" $testdir/file2
+_cp_reflink $testdir/file1 $testdir/file2 >> $seqres.full
+_cp_reflink $testdir/file1 $testdir/file2 >> $seqres.full
+
+$XFS_IO_PROG -f -c "extsize $bufsize" $testdir/file3
+$XFS_IO_PROG -f -c "cowextsize $real_blksz" $testdir/file3
+_cp_reflink $testdir/file1 $testdir/file3 >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file2 | _filter_scratch
+md5sum $testdir/file3 | _filter_scratch
+
+echo "CoW and unmount"
+echo "extsize" >> $seqres.full
+$XFS_IO_PROG -f -c "extsize" $testdir/file2 >> $seqres.full
+echo "cowextsize" >> $seqres.full
+$XFS_IO_PROG -f -c "cowextsize" $testdir/file2 >> $seqres.full
+
+$XFS_IO_PROG -f -c "pwrite -R -S 0x63 -b $real_blksz 0 $filesize" -c "fdatasync" $testdir/file2 >> $seqres.full
+$XFS_IO_PROG -f -c "pwrite -S 0x63 -b $real_blksz 0 $((filesize + 1))" -c "fdatasync" $testdir/file2 >> $seqres.full
+
+echo "extsize" >> $seqres.full
+$XFS_IO_PROG -f -c "extsize" $testdir/file3 >> $seqres.full
+echo "cowextsize" >> $seqres.full
+$XFS_IO_PROG -f -c "cowextsize" $testdir/file3 >> $seqres.full
+
+$XFS_IO_PROG -f -c "pwrite -R -S 0x63 -b $real_blksz 0 $filesize" -c "fdatasync" $testdir/file3 >> $seqres.full
+$XFS_IO_PROG -f -c "pwrite -S 0x63 -b $real_blksz 0 $((filesize + 1))" -c "fdatasync" $testdir/file3 >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file2 | _filter_scratch
+md5sum $testdir/file3 | _filter_scratch
+
+echo "Check extent counts"
+old_extents=$(_count_extents $testdir/file1)
+new_extents=$(_count_extents $testdir/file2)
+
+echo "old extents: $old_extents" >> $seqres.full
+echo "new extents: $new_extents" >> $seqres.full
+echo "maximum extents: $internal_blks" >> $seqres.full
+test $new_extents -lt $((internal_blks / 20)) || test $new_extents -lt 15 \
+	|| echo "file2 badly fragmented"
+
+new_extents=$(_count_extents $testdir/file3)
+
+echo "old extents: $old_extents" >> $seqres.full
+echo "new extents: $new_extents" >> $seqres.full
+echo "maximum extents: $internal_blks" >> $seqres.full
+test $new_extents -lt $((internal_blks / 20)) || test $new_extents -lt 15 \
+	|| echo "file3 badly fragmented"
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/208.out b/tests/xfs/208.out
new file mode 100644
index 0000000..a344036
--- /dev/null
+++ b/tests/xfs/208.out
@@ -0,0 +1,13 @@
+QA output created by 208
+Format and mount
+Create the original files
+Compare files
+2909feb63a37b0e95fe5cfb7f274f7b1  SCRATCH_MNT/test-208/file1
+2909feb63a37b0e95fe5cfb7f274f7b1  SCRATCH_MNT/test-208/file2
+2909feb63a37b0e95fe5cfb7f274f7b1  SCRATCH_MNT/test-208/file3
+CoW and unmount
+Compare files
+2909feb63a37b0e95fe5cfb7f274f7b1  SCRATCH_MNT/test-208/file1
+d41f6527bc8320364e12ea7076140b8b  SCRATCH_MNT/test-208/file2
+d41f6527bc8320364e12ea7076140b8b  SCRATCH_MNT/test-208/file3
+Check extent counts
diff --git a/tests/xfs/209 b/tests/xfs/209
new file mode 100755
index 0000000..684187e
--- /dev/null
+++ b/tests/xfs/209
@@ -0,0 +1,82 @@
+#! /bin/bash
+# FS QA Test No. 209
+#
+# Make sure setting cowextsz on a directory propagates it to subfiles.
+#
+#-----------------------------------------------------------------------
+# 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_reflink
+_require_cp_reflink
+_require_fiemap
+_require_xfs_io_command "cowextsize"
+
+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
+
+echo "Set extsz and cowextsz on directory"
+$XFS_IO_PROG -c "cowextsize 1048576" $testdir >> $seqres.full
+
+echo "Create a fake tree structure"
+seq 1 2 | while read nr; do
+	mkdir "$testdir/dir-$nr"
+	seq 1 4 | while read nnr; do
+		touch "$testdir/dir-$nr/file-$nnr"
+	done
+done
+_scratch_remount
+
+echo "Check cowextsize settings"
+seq 1 2 | while read nr; do
+	seq 1 4 | while read nnr; do
+		file="$testdir/dir-$nr/file-$nnr"
+		$XFS_IO_PROG -c "cowextsize" $file
+	done
+done
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/209.out b/tests/xfs/209.out
new file mode 100644
index 0000000..109af34
--- /dev/null
+++ b/tests/xfs/209.out
@@ -0,0 +1,13 @@
+QA output created by 209
+Format and mount
+Set extsz and cowextsz on directory
+Create a fake tree structure
+Check cowextsize settings
+[1048576] /opt/test-209/dir-1/file-1
+[1048576] /opt/test-209/dir-1/file-2
+[1048576] /opt/test-209/dir-1/file-3
+[1048576] /opt/test-209/dir-1/file-4
+[1048576] /opt/test-209/dir-2/file-1
+[1048576] /opt/test-209/dir-2/file-2
+[1048576] /opt/test-209/dir-2/file-3
+[1048576] /opt/test-209/dir-2/file-4
diff --git a/tests/xfs/210 b/tests/xfs/210
new file mode 100755
index 0000000..d3a2716
--- /dev/null
+++ b/tests/xfs/210
@@ -0,0 +1,108 @@
+#! /bin/bash
+# FS QA Test No. 210
+#
+# During reflink, XFS should carry the cowextsz setting to the destination file
+# if the destination file size is less than the size of the source file, the
+# length is the size of the source file, both offsets are zero, and the
+# destination does not already have a cowextsz setting.  It should not do so
+# otherwise.
+#
+#-----------------------------------------------------------------------
+# 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_reflink
+_require_cp_reflink
+_require_fiemap
+_require_xfs_io_command "cowextsize"
+
+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
+
+echo "Create initial file"
+$XFS_IO_PROG -f -c "pwrite -S 0x61 0 131072" $testdir/file1 >> $seqres.full
+$XFS_IO_PROG -c "cowextsize 1048576" $testdir/file1 >> $seqres.full
+$XFS_IO_PROG -f -c "pwrite -S 0x61 0 1" $testdir/file4 >> $seqres.full
+$XFS_IO_PROG -f -c "pwrite -S 0x61 0 262144" $testdir/file7 >> $seqres.full
+$XFS_IO_PROG -f -c "pwrite -S 0x61 0 262144" $testdir/file9 >> $seqres.full
+$XFS_IO_PROG -f -c "pwrite -S 0x61 0 262144" $testdir/file10 >> $seqres.full
+
+echo "Reflink to an empty file"
+_reflink_range $testdir/file1 0 $testdir/file2 0 0 >> $seqres.full
+
+echo "Reflink to an empty file that already has cowextsz"
+$XFS_IO_PROG -f -c "cowextsize 524288" $testdir/file3 >> $seqres.full
+_reflink_range $testdir/file1 0 $testdir/file3 0 0 >> $seqres.full
+
+echo "Reflink to a small file"
+_reflink_range $testdir/file1 0 $testdir/file4 0 0 >> $seqres.full
+
+echo "Reflink to a nonzero offset"
+_reflink_range $testdir/file1 0 $testdir/file5 65536 0 >> $seqres.full
+
+echo "Reflink from a nonzero offset"
+_reflink_range $testdir/file1 65536 $testdir/file6 0 0 >> $seqres.full
+
+echo "Reflink to a larger file"
+_reflink_range $testdir/file1 0 $testdir/file7 0 0 >> $seqres.full
+
+echo "Reflink less than the whole source file"
+_reflink_range $testdir/file1 0 $testdir/file8 0 65536 >> $seqres.full
+
+echo "cp reflink to a larger file"
+_cp_reflink $testdir/file1 $testdir/file9 >> $seqres.full
+
+echo "cp reflink to a larger file with cowextsize"
+$XFS_IO_PROG -f -c "cowextsize 524288" $testdir/file10 >> $seqres.full
+_cp_reflink $testdir/file1 $testdir/file10 >> $seqres.full
+
+echo "Check cowextsz"
+for i in `seq 1 10`; do
+	$XFS_IO_PROG -c "cowextsize" $testdir/file$i | _filter_scratch
+done
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/210.out b/tests/xfs/210.out
new file mode 100644
index 0000000..46d28d9
--- /dev/null
+++ b/tests/xfs/210.out
@@ -0,0 +1,23 @@
+QA output created by 210
+Format and mount
+Create initial file
+Reflink to an empty file
+Reflink to an empty file that already has cowextsz
+Reflink to a small file
+Reflink to a nonzero offset
+Reflink from a nonzero offset
+Reflink to a larger file
+Reflink less than the whole source file
+cp reflink to a larger file
+cp reflink to a larger file with cowextsize
+Check cowextsz
+[1048576] SCRATCH_MNT/test-210/file1
+[1048576] SCRATCH_MNT/test-210/file2
+[524288] SCRATCH_MNT/test-210/file3
+[1048576] SCRATCH_MNT/test-210/file4
+[0] SCRATCH_MNT/test-210/file5
+[0] SCRATCH_MNT/test-210/file6
+[0] SCRATCH_MNT/test-210/file7
+[0] SCRATCH_MNT/test-210/file8
+[1048576] SCRATCH_MNT/test-210/file9
+[524288] SCRATCH_MNT/test-210/file10
diff --git a/tests/xfs/211 b/tests/xfs/211
new file mode 100755
index 0000000..cb0f17a
--- /dev/null
+++ b/tests/xfs/211
@@ -0,0 +1,107 @@
+#! /bin/bash
+# FS QA Test No. 211
+#
+# Test fragmentation in a big file after a lot of random CoW:
+# - Create two reflinked files.  Set extsz hint on second file.
+# - Directio write to random offsets to scatter CoW reservations.
+# - Rewrite the whole file to use up reservations.
+# - Check the number of 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/reflink
+
+# real QA test starts here
+_supported_os Linux
+_supported_fs xfs
+_require_scratch_reflink
+_require_cp_reflink
+_require_fiemap
+_require_xfs_io_command "cowextsize"
+_require_odirect
+
+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
+
+blksz=65536
+nr=50000
+filesize=$((blksz * nr))
+bufnr=16
+bufsize=$((blksz * bufnr))
+
+_require_fs_space $SCRATCH_MNT $((filesize / 1024 * 2 * 5 / 4))
+real_blksz=$(stat -f -c '%S' $testdir)
+internal_blks=$((filesize / real_blksz))
+
+echo "Create the original files"
+$XFS_IO_PROG -f -c "pwrite -S 0x61 -b $bufsize 0 $((filesize + 1))" $testdir/file1 >> $seqres.full
+$XFS_IO_PROG -f -c "cowextsize $bufsize" $testdir/file2
+_cp_reflink $testdir/file1 $testdir/file2 >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file2 | _filter_scratch
+
+echo "CoW and unmount"
+$XFS_IO_PROG -f -c "cowextsize" $testdir/file2 >> $seqres.full
+$XFS_IO_PROG -d -f -c "pwrite -R -S 0x63 -b $real_blksz 0 $((filesize + 1))" $testdir/file2 >> $seqres.full
+$XFS_IO_PROG -d -f -c "pwrite -S 0x63 -b 8388608 0 $filesize" $testdir/file2 >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file2 | _filter_scratch
+
+echo "Check extent counts"
+old_extents=$(_count_extents $testdir/file1)
+new_extents=$(_count_extents $testdir/file2)
+
+echo "old extents: $old_extents" >> $seqres.full
+echo "new extents: $new_extents" >> $seqres.full
+echo "maximum extents: $internal_blks" >> $seqres.full
+test $new_extents -lt $((internal_blks / 20)) || test $new_extents -lt 15 \
+	|| echo "file2 badly fragmented"
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/211.out b/tests/xfs/211.out
new file mode 100644
index 0000000..7371c5b
--- /dev/null
+++ b/tests/xfs/211.out
@@ -0,0 +1,11 @@
+QA output created by 211
+Format and mount
+Create the original files
+Compare files
+07415406aea963ab8e005f1d3744fded  SCRATCH_MNT/test-211/file1
+07415406aea963ab8e005f1d3744fded  SCRATCH_MNT/test-211/file2
+CoW and unmount
+Compare files
+07415406aea963ab8e005f1d3744fded  SCRATCH_MNT/test-211/file1
+7d8ab127adfc1f745a7d1cd5e44d10d8  SCRATCH_MNT/test-211/file2
+Check extent counts
diff --git a/tests/xfs/group b/tests/xfs/group
index abf1d33..119e1fd 100644
--- a/tests/xfs/group
+++ b/tests/xfs/group
@@ -177,8 +177,11 @@
 177 dmapi
 178 mkfs other auto
 179 auto quick clone
+180 auto quick clone
 181 log auto quick
+182 auto quick clone
 183 rw other auto quick
+184 auto quick clone
 185 dmapi
 186 attr auto quick
 187 attr auto quick
@@ -186,16 +189,26 @@
 189 mount auto quick
 190 rw auto quick
 191 nfs4acl auto
+192 auto quick clone
+193 auto quick clone
 194 rw auto
 195 ioctl dump auto quick
 196 quota auto quick
 197 dir auto quick
+198 auto quick clone
 199 mount auto quick
+200 auto quick clone
 201 metadata auto quick
 202 repair auto quick
 203 ioctl auto
+204 auto quick clone
 205 metadata rw auto
 206 growfs auto quick
+207 auto quick clone
+208 auto quick clone
+209 auto quick clone
+210 auto quick clone
+211 clone_stress
 216 log metadata auto quick
 217 log metadata auto
 220 auto quota quick


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

* [PATCH 19/32] xfs: test fragmentation characteristics of copy-on-write
@ 2016-02-11 23:41   ` Darrick J. Wong
  0 siblings, 0 replies; 81+ messages in thread
From: Darrick J. Wong @ 2016-02-11 23:41 UTC (permalink / raw)
  To: david, darrick.wong; +Cc: fstests, linux-btrfs, xfs

Perform copy-on-writes at random offsets to stress the CoW allocation
system.  Assess the effectiveness of the extent size hint at
combatting fragmentation via unshare, a rewrite, and no-op after the
random writes.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 tests/generic/301     |  100 ++++++++++++++++++++++++++++++++++++
 tests/generic/301.out |   10 ++++
 tests/generic/302     |  101 ++++++++++++++++++++++++++++++++++++
 tests/generic/302.out |   10 ++++
 tests/generic/group   |    2 +
 tests/xfs/180         |  106 ++++++++++++++++++++++++++++++++++++++
 tests/xfs/180.out     |   11 ++++
 tests/xfs/182         |  107 ++++++++++++++++++++++++++++++++++++++
 tests/xfs/182.out     |   12 ++++
 tests/xfs/184         |  105 +++++++++++++++++++++++++++++++++++++
 tests/xfs/184.out     |   10 ++++
 tests/xfs/192         |  106 ++++++++++++++++++++++++++++++++++++++
 tests/xfs/192.out     |   10 ++++
 tests/xfs/193         |  102 ++++++++++++++++++++++++++++++++++++
 tests/xfs/193.out     |   10 ++++
 tests/xfs/198         |  103 +++++++++++++++++++++++++++++++++++++
 tests/xfs/198.out     |   10 ++++
 tests/xfs/200         |  109 +++++++++++++++++++++++++++++++++++++++
 tests/xfs/200.out     |   10 ++++
 tests/xfs/204         |  110 +++++++++++++++++++++++++++++++++++++++
 tests/xfs/204.out     |   10 ++++
 tests/xfs/207         |  101 ++++++++++++++++++++++++++++++++++++
 tests/xfs/207.out     |   18 ++++++
 tests/xfs/208         |  138 +++++++++++++++++++++++++++++++++++++++++++++++++
 tests/xfs/208.out     |   13 +++++
 tests/xfs/209         |   82 +++++++++++++++++++++++++++++
 tests/xfs/209.out     |   13 +++++
 tests/xfs/210         |  108 ++++++++++++++++++++++++++++++++++++++
 tests/xfs/210.out     |   23 ++++++++
 tests/xfs/211         |  107 ++++++++++++++++++++++++++++++++++++++
 tests/xfs/211.out     |   11 ++++
 tests/xfs/group       |   13 +++++
 32 files changed, 1781 insertions(+)
 create mode 100755 tests/generic/301
 create mode 100644 tests/generic/301.out
 create mode 100755 tests/generic/302
 create mode 100644 tests/generic/302.out
 create mode 100755 tests/xfs/180
 create mode 100644 tests/xfs/180.out
 create mode 100755 tests/xfs/182
 create mode 100644 tests/xfs/182.out
 create mode 100755 tests/xfs/184
 create mode 100644 tests/xfs/184.out
 create mode 100755 tests/xfs/192
 create mode 100644 tests/xfs/192.out
 create mode 100755 tests/xfs/193
 create mode 100644 tests/xfs/193.out
 create mode 100755 tests/xfs/198
 create mode 100644 tests/xfs/198.out
 create mode 100755 tests/xfs/200
 create mode 100644 tests/xfs/200.out
 create mode 100755 tests/xfs/204
 create mode 100644 tests/xfs/204.out
 create mode 100755 tests/xfs/207
 create mode 100644 tests/xfs/207.out
 create mode 100755 tests/xfs/208
 create mode 100644 tests/xfs/208.out
 create mode 100755 tests/xfs/209
 create mode 100644 tests/xfs/209.out
 create mode 100755 tests/xfs/210
 create mode 100644 tests/xfs/210.out
 create mode 100755 tests/xfs/211
 create mode 100644 tests/xfs/211.out


diff --git a/tests/generic/301 b/tests/generic/301
new file mode 100755
index 0000000..0201d0b
--- /dev/null
+++ b/tests/generic/301
@@ -0,0 +1,100 @@
+#! /bin/bash
+# FS QA Test No. 301
+#
+# Test fragmentation after a lot of random CoW:
+# - Create two reflinked files.
+# - Buffered write to random offsets to scatter CoW reservations.
+# - Check the number of 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/reflink
+
+# real QA test starts here
+_supported_os Linux
+_require_scratch_reflink
+_require_cp_reflink
+_require_fiemap
+
+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
+
+blksz=65536
+nr=128
+filesize=$((blksz * nr))
+bufnr=16
+bufsize=$((blksz * bufnr))
+
+_require_fs_space $SCRATCH_MNT $((filesize / 1024 * 3 * 5 / 4))
+real_blksz=$(stat -f -c '%S' $testdir)
+internal_blks=$((filesize / real_blksz))
+
+echo "Create the original files"
+$XFS_IO_PROG -f -c "pwrite -S 0x61 -b $bufsize 0 $((filesize + 1))" $testdir/file1 >> $seqres.full
+_cp_reflink $testdir/file1 $testdir/file2 >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file2 | _filter_scratch
+
+echo "CoW and unmount"
+for i in `seq 1 8`; do
+	$XFS_IO_PROG -f -c "pwrite -R -S 0x63 -b $real_blksz 0 $filesize" -c "fdatasync" $testdir/file2 >> $seqres.full
+done
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+
+echo "Check extent counts"
+old_extents=$(_count_extents $testdir/file1)
+new_extents=$(_count_extents $testdir/file2)
+
+echo "old extents: $old_extents" >> $seqres.full
+echo "new extents: $new_extents" >> $seqres.full
+echo "maximum extents: $internal_blks" >> $seqres.full
+test $new_extents -lt $((internal_blks * 2 / 3)) || echo "file2 badly fragmented"
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/301.out b/tests/generic/301.out
new file mode 100644
index 0000000..3b677cb
--- /dev/null
+++ b/tests/generic/301.out
@@ -0,0 +1,10 @@
+QA output created by 301
+Format and mount
+Create the original files
+Compare files
+2909feb63a37b0e95fe5cfb7f274f7b1  SCRATCH_MNT/test-301/file1
+2909feb63a37b0e95fe5cfb7f274f7b1  SCRATCH_MNT/test-301/file2
+CoW and unmount
+Compare files
+2909feb63a37b0e95fe5cfb7f274f7b1  SCRATCH_MNT/test-301/file1
+Check extent counts
diff --git a/tests/generic/302 b/tests/generic/302
new file mode 100755
index 0000000..c48da0a
--- /dev/null
+++ b/tests/generic/302
@@ -0,0 +1,101 @@
+#! /bin/bash
+# FS QA Test No. 302
+#
+# Test fragmentation after a lot of random CoW:
+# - Create two reflinked files.
+# - Directio write to random offsets to scatter CoW reservations.
+# - Check the number of 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/reflink
+
+# real QA test starts here
+_supported_os Linux
+_require_scratch_reflink
+_require_cp_reflink
+_require_fiemap
+_require_odirect
+
+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
+
+blksz=65536
+nr=128
+filesize=$((blksz * nr))
+bufnr=16
+bufsize=$((blksz * bufnr))
+
+_require_fs_space $SCRATCH_MNT $((filesize / 1024 * 3 * 5 / 4))
+real_blksz=$(stat -f -c '%S' $testdir)
+internal_blks=$((filesize / real_blksz))
+
+echo "Create the original files"
+$XFS_IO_PROG -f -c "pwrite -S 0x61 -b $bufsize 0 $((filesize + 1))" $testdir/file1 >> $seqres.full
+_cp_reflink $testdir/file1 $testdir/file2 >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file2 | _filter_scratch
+
+echo "CoW and unmount"
+for i in `seq 1 8`; do
+	$XFS_IO_PROG -d -f -c "pwrite -R -S 0x63 -b $real_blksz 0 $filesize" $testdir/file2 >> $seqres.full
+done
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+
+echo "Check extent counts"
+old_extents=$(_count_extents $testdir/file1)
+new_extents=$(_count_extents $testdir/file2)
+
+echo "old extents: $old_extents" >> $seqres.full
+echo "new extents: $new_extents" >> $seqres.full
+echo "maximum extents: $internal_blks" >> $seqres.full
+test $new_extents -le $internal_blks || echo "file2 badly fragmented"
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/302.out b/tests/generic/302.out
new file mode 100644
index 0000000..6a46fd7
--- /dev/null
+++ b/tests/generic/302.out
@@ -0,0 +1,10 @@
+QA output created by 302
+Format and mount
+Create the original files
+Compare files
+2909feb63a37b0e95fe5cfb7f274f7b1  SCRATCH_MNT/test-302/file1
+2909feb63a37b0e95fe5cfb7f274f7b1  SCRATCH_MNT/test-302/file2
+CoW and unmount
+Compare files
+2909feb63a37b0e95fe5cfb7f274f7b1  SCRATCH_MNT/test-302/file1
+Check extent counts
diff --git a/tests/generic/group b/tests/generic/group
index f1a398c..7edc963 100644
--- a/tests/generic/group
+++ b/tests/generic/group
@@ -303,6 +303,8 @@
 298 auto quick clone
 299 auto aio enospc rw stress
 300 auto aio enospc preallocrw stress
+301 auto quick clone
+302 auto quick clone
 306 auto quick rw
 307 auto quick
 308 auto quick
diff --git a/tests/xfs/180 b/tests/xfs/180
new file mode 100755
index 0000000..fdb24eb
--- /dev/null
+++ b/tests/xfs/180
@@ -0,0 +1,106 @@
+#! /bin/bash
+# FS QA Test No. 180
+#
+# Test fragmentation after a lot of random CoW:
+# - Create two reflinked files.  Set extsz hint on second file.
+# - Buffered write to random offsets to scatter CoW reservations.
+# - Rewrite the whole file to use up reservations.
+# - Check the number of 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/reflink
+
+# real QA test starts here
+_supported_os Linux
+_supported_fs xfs
+_require_scratch_reflink
+_require_cp_reflink
+_require_fiemap
+_require_xfs_io_command "cowextsize"
+
+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
+
+blksz=65536
+nr=128
+filesize=$((blksz * nr))
+bufnr=16
+bufsize=$((blksz * bufnr))
+
+_require_fs_space $SCRATCH_MNT $((filesize / 1024 * 3 * 5 / 4))
+real_blksz=$(stat -f -c '%S' $testdir)
+internal_blks=$((filesize / real_blksz))
+
+echo "Create the original files"
+$XFS_IO_PROG -f -c "pwrite -S 0x61 -b $bufsize 0 $((filesize + 1))" $testdir/file1 >> $seqres.full
+$XFS_IO_PROG -f -c "cowextsize $bufsize" $testdir/file2
+_cp_reflink $testdir/file1 $testdir/file2 >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file2 | _filter_scratch
+
+echo "CoW and unmount"
+$XFS_IO_PROG -f -c "cowextsize" $testdir/file2 >> $seqres.full
+$XFS_IO_PROG -f -c "pwrite -R -S 0x63 -b $real_blksz 0 $filesize" -c "fdatasync" $testdir/file2 >> $seqres.full
+$XFS_IO_PROG -f -c "pwrite -S 0x63 -b $real_blksz 0 $((filesize + 1))" -c "fdatasync" $testdir/file2 >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file2 | _filter_scratch
+
+echo "Check extent counts"
+old_extents=$(_count_extents $testdir/file1)
+new_extents=$(_count_extents $testdir/file2)
+
+echo "old extents: $old_extents" >> $seqres.full
+echo "new extents: $new_extents" >> $seqres.full
+echo "maximum extents: $internal_blks" >> $seqres.full
+test $new_extents -lt $((internal_blks / 20)) || test $new_extents -lt 15 \
+	|| echo "file2 badly fragmented"
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/180.out b/tests/xfs/180.out
new file mode 100644
index 0000000..a1cc4fd
--- /dev/null
+++ b/tests/xfs/180.out
@@ -0,0 +1,11 @@
+QA output created by 180
+Format and mount
+Create the original files
+Compare files
+2909feb63a37b0e95fe5cfb7f274f7b1  SCRATCH_MNT/test-180/file1
+2909feb63a37b0e95fe5cfb7f274f7b1  SCRATCH_MNT/test-180/file2
+CoW and unmount
+Compare files
+2909feb63a37b0e95fe5cfb7f274f7b1  SCRATCH_MNT/test-180/file1
+d41f6527bc8320364e12ea7076140b8b  SCRATCH_MNT/test-180/file2
+Check extent counts
diff --git a/tests/xfs/182 b/tests/xfs/182
new file mode 100755
index 0000000..c1bfc02
--- /dev/null
+++ b/tests/xfs/182
@@ -0,0 +1,107 @@
+#! /bin/bash
+# FS QA Test No. 182
+#
+# Test fragmentation after a lot of random CoW:
+# - Create two reflinked files.  Set extsz hint on second file.
+# - Directio write to random offsets to scatter CoW reservations.
+# - Rewrite the whole file to use up reservations.
+# - Check the number of 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/reflink
+
+# real QA test starts here
+_supported_os Linux
+_supported_fs xfs
+_require_scratch_reflink
+_require_cp_reflink
+_require_fiemap
+_require_xfs_io_command "cowextsize"
+_require_odirect
+
+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
+
+blksz=65536
+nr=128
+filesize=$((blksz * nr))
+bufnr=16
+bufsize=$((blksz * bufnr))
+
+_require_fs_space $SCRATCH_MNT $((filesize / 1024 * 3 * 5 / 4))
+real_blksz=$(stat -f -c '%S' $testdir)
+internal_blks=$((filesize / real_blksz))
+
+echo "Create the original files"
+$XFS_IO_PROG -f -c "pwrite -S 0x61 -b $bufsize 0 $((filesize + 1))" $testdir/file1 >> $seqres.full
+$XFS_IO_PROG -f -c "cowextsize $bufsize" $testdir/file2
+_cp_reflink $testdir/file1 $testdir/file2 >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file2 | _filter_scratch
+
+echo "CoW and unmount"
+$XFS_IO_PROG -f -c "cowextsize" $testdir/file2 >> $seqres.full
+$XFS_IO_PROG -d -f -c "pwrite -R -S 0x63 -b $real_blksz 0 $((filesize + 1))" $testdir/file2 >> $seqres.full
+$XFS_IO_PROG -d -f -c "pwrite -S 0x63 -b $real_blksz 0 $((filesize + 1))" $testdir/file2 >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file2 | _filter_scratch
+
+echo "Check extent counts"
+old_extents=$(_count_extents $testdir/file1)
+new_extents=$(_count_extents $testdir/file2)
+
+echo "old extents: $old_extents" >> $seqres.full
+echo "new extents: $new_extents" >> $seqres.full
+echo "maximum extents: $internal_blks" >> $seqres.full
+test $new_extents -lt $((internal_blks / 20)) || test $new_extents -lt 15 \
+	|| echo "file2 badly fragmented"
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/182.out b/tests/xfs/182.out
new file mode 100644
index 0000000..7b0af93
--- /dev/null
+++ b/tests/xfs/182.out
@@ -0,0 +1,12 @@
+QA output created by 182
+Format and mount
+Create the original files
+Compare files
+2909feb63a37b0e95fe5cfb7f274f7b1  SCRATCH_MNT/test-182/file1
+2909feb63a37b0e95fe5cfb7f274f7b1  SCRATCH_MNT/test-182/file2
+CoW and unmount
+pwrite64: Invalid argument
+Compare files
+2909feb63a37b0e95fe5cfb7f274f7b1  SCRATCH_MNT/test-182/file1
+c6ba35da9f73ced20d7781a448cc11d4  SCRATCH_MNT/test-182/file2
+Check extent counts
diff --git a/tests/xfs/184 b/tests/xfs/184
new file mode 100755
index 0000000..50674ff
--- /dev/null
+++ b/tests/xfs/184
@@ -0,0 +1,105 @@
+#! /bin/bash
+# FS QA Test No. 184
+#
+# Test fragmentation after a lot of random CoW:
+# - Create two reflinked files.  Set extsz hint on second file.
+# - Buffered write to random offsets to scatter CoW reservations.
+# - falloc the whole file to unshare blocks.
+# - Check the number of 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/reflink
+
+# real QA test starts here
+_supported_os Linux
+_supported_fs xfs
+_require_scratch_reflink
+_require_cp_reflink
+_require_fiemap
+_require_xfs_io_command "cowextsize"
+
+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
+
+blksz=65536
+nr=128
+filesize=$((blksz * nr))
+bufnr=16
+bufsize=$((blksz * bufnr))
+
+_require_fs_space $SCRATCH_MNT $((filesize / 1024 * 3 * 5 / 4))
+real_blksz=$(stat -f -c '%S' $testdir)
+internal_blks=$((filesize / real_blksz))
+
+echo "Create the original files"
+$XFS_IO_PROG -f -c "pwrite -S 0x61 -b $bufsize 0 $((filesize + 1))" $testdir/file1 >> $seqres.full
+$XFS_IO_PROG -f -c "cowextsize $bufsize" $testdir/file2
+_cp_reflink $testdir/file1 $testdir/file2 >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file2 | _filter_scratch
+
+echo "CoW and unmount"
+$XFS_IO_PROG -f -c "cowextsize" $testdir/file2 >> $seqres.full
+$XFS_IO_PROG -f -c "pwrite -R -S 0x63 -b $real_blksz 0 $((filesize + 1))" -c "fdatasync" $testdir/file2 >> $seqres.full
+$XFS_IO_PROG -f -c "falloc 0 $((filesize + 1))" $testdir/file2 >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+
+echo "Check extent counts"
+old_extents=$(_count_extents $testdir/file1)
+new_extents=$(_count_extents $testdir/file2)
+
+echo "old extents: $old_extents" >> $seqres.full
+echo "new extents: $new_extents" >> $seqres.full
+echo "maximum extents: $internal_blks" >> $seqres.full
+test $new_extents -lt $((internal_blks / 20)) || test $new_extents -lt 15 \
+	|| echo "file2 badly fragmented"
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/184.out b/tests/xfs/184.out
new file mode 100644
index 0000000..f6f6061
--- /dev/null
+++ b/tests/xfs/184.out
@@ -0,0 +1,10 @@
+QA output created by 184
+Format and mount
+Create the original files
+Compare files
+2909feb63a37b0e95fe5cfb7f274f7b1  SCRATCH_MNT/test-184/file1
+2909feb63a37b0e95fe5cfb7f274f7b1  SCRATCH_MNT/test-184/file2
+CoW and unmount
+Compare files
+2909feb63a37b0e95fe5cfb7f274f7b1  SCRATCH_MNT/test-184/file1
+Check extent counts
diff --git a/tests/xfs/192 b/tests/xfs/192
new file mode 100755
index 0000000..6429def
--- /dev/null
+++ b/tests/xfs/192
@@ -0,0 +1,106 @@
+#! /bin/bash
+# FS QA Test No. 192
+#
+# Test fragmentation after a lot of random CoW:
+# - Create two reflinked files.  Set extsz hint on second file.
+# - Directio write to random offsets to scatter CoW reservations.
+# - falloc the whole file to unshare blocks.
+# - Check the number of 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/reflink
+
+# real QA test starts here
+_supported_os Linux
+_supported_fs xfs
+_require_scratch_reflink
+_require_cp_reflink
+_require_fiemap
+_require_xfs_io_command "cowextsize"
+_require_odirect
+
+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
+
+blksz=65536
+nr=128
+filesize=$((blksz * nr))
+bufnr=16
+bufsize=$((blksz * bufnr))
+
+_require_fs_space $SCRATCH_MNT $((filesize / 1024 * 3 * 5 / 4))
+real_blksz=$(stat -f -c '%S' $testdir)
+internal_blks=$((filesize / real_blksz))
+
+echo "Create the original files"
+$XFS_IO_PROG -f -c "pwrite -S 0x61 -b $bufsize 0 $((filesize + 1))" $testdir/file1 >> $seqres.full
+$XFS_IO_PROG -f -c "cowextsize $bufsize" $testdir/file2
+_cp_reflink $testdir/file1 $testdir/file2 >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file2 | _filter_scratch
+
+echo "CoW and unmount"
+$XFS_IO_PROG -f -c "cowextsize" $testdir/file2 >> $seqres.full
+$XFS_IO_PROG -d -f -c "pwrite -R -S 0x63 -b $real_blksz 0 $filesize" $testdir/file2 >> $seqres.full
+$XFS_IO_PROG -d -f -c "falloc 0 $filesize" $testdir/file2 >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+
+echo "Check extent counts"
+old_extents=$(_count_extents $testdir/file1)
+new_extents=$(_count_extents $testdir/file2)
+
+echo "old extents: $old_extents" >> $seqres.full
+echo "new extents: $new_extents" >> $seqres.full
+echo "maximum extents: $internal_blks" >> $seqres.full
+test $new_extents -lt $((internal_blks / 20)) || test $new_extents -lt 15 \
+	|| echo "file2 badly fragmented"
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/192.out b/tests/xfs/192.out
new file mode 100644
index 0000000..13c8061
--- /dev/null
+++ b/tests/xfs/192.out
@@ -0,0 +1,10 @@
+QA output created by 192
+Format and mount
+Create the original files
+Compare files
+2909feb63a37b0e95fe5cfb7f274f7b1  SCRATCH_MNT/test-192/file1
+2909feb63a37b0e95fe5cfb7f274f7b1  SCRATCH_MNT/test-192/file2
+CoW and unmount
+Compare files
+2909feb63a37b0e95fe5cfb7f274f7b1  SCRATCH_MNT/test-192/file1
+Check extent counts
diff --git a/tests/xfs/193 b/tests/xfs/193
new file mode 100755
index 0000000..974f1eb
--- /dev/null
+++ b/tests/xfs/193
@@ -0,0 +1,102 @@
+#! /bin/bash
+# FS QA Test No. 193
+#
+# Test fragmentation after a lot of random CoW:
+# - Create two reflinked files.  Set extsz hint on second file.
+# - Buffered write to random offsets to scatter CoW reservations.
+# - Check the number of 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/reflink
+
+# real QA test starts here
+_supported_os Linux
+_supported_fs xfs
+_require_scratch_reflink
+_require_cp_reflink
+_require_fiemap
+_require_xfs_io_command "cowextsize"
+
+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
+
+blksz=65536
+nr=128
+filesize=$((blksz * nr))
+bufnr=16
+bufsize=$((blksz * bufnr))
+
+_require_fs_space $SCRATCH_MNT $((filesize / 1024 * 3 * 5 / 4))
+real_blksz=$(stat -f -c '%S' $testdir)
+internal_blks=$((filesize / real_blksz))
+
+echo "Create the original files"
+$XFS_IO_PROG -f -c "pwrite -S 0x61 -b $bufsize 0 $((filesize + 1))" $testdir/file1 >> $seqres.full
+$XFS_IO_PROG -f -c "cowextsize $bufsize" $testdir/file2
+_cp_reflink $testdir/file1 $testdir/file2 >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file2 | _filter_scratch
+
+echo "CoW and unmount"
+$XFS_IO_PROG -f -c "cowextsize" $testdir/file2 >> $seqres.full
+$XFS_IO_PROG -f -c "pwrite -R -S 0x63 -b $real_blksz 0 $filesize" -c "fdatasync" $testdir/file2 >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+
+echo "Check extent counts"
+old_extents=$(_count_extents $testdir/file1)
+new_extents=$(_count_extents $testdir/file2)
+
+echo "old extents: $old_extents" >> $seqres.full
+echo "new extents: $new_extents" >> $seqres.full
+echo "maximum extents: $internal_blks" >> $seqres.full
+test $new_extents -lt $((internal_blks * 2 / 3)) || echo "file2 badly fragmented"
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/193.out b/tests/xfs/193.out
new file mode 100644
index 0000000..cc12b6b
--- /dev/null
+++ b/tests/xfs/193.out
@@ -0,0 +1,10 @@
+QA output created by 193
+Format and mount
+Create the original files
+Compare files
+2909feb63a37b0e95fe5cfb7f274f7b1  SCRATCH_MNT/test-193/file1
+2909feb63a37b0e95fe5cfb7f274f7b1  SCRATCH_MNT/test-193/file2
+CoW and unmount
+Compare files
+2909feb63a37b0e95fe5cfb7f274f7b1  SCRATCH_MNT/test-193/file1
+Check extent counts
diff --git a/tests/xfs/198 b/tests/xfs/198
new file mode 100755
index 0000000..7f3c105
--- /dev/null
+++ b/tests/xfs/198
@@ -0,0 +1,103 @@
+#! /bin/bash
+# FS QA Test No. 198
+#
+# Test fragmentation after a lot of random CoW:
+# - Create two reflinked files.  Set extsz hint on second file.
+# - Directio write to random offsets to scatter CoW reservations.
+# - Check the number of 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/reflink
+
+# real QA test starts here
+_supported_os Linux
+_supported_fs xfs
+_require_scratch_reflink
+_require_cp_reflink
+_require_fiemap
+_require_xfs_io_command "cowextsize"
+_require_odirect
+
+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
+
+blksz=65536
+nr=128
+filesize=$((blksz * nr))
+bufnr=16
+bufsize=$((blksz * bufnr))
+
+_require_fs_space $SCRATCH_MNT $((filesize / 1024 * 3 * 5 / 4))
+real_blksz=$(stat -f -c '%S' $testdir)
+internal_blks=$((filesize / real_blksz))
+
+echo "Create the original files"
+$XFS_IO_PROG -f -c "pwrite -S 0x61 -b $bufsize 0 $((filesize + 1))" $testdir/file1 >> $seqres.full
+$XFS_IO_PROG -f -c "cowextsize $bufsize" $testdir/file2
+_cp_reflink $testdir/file1 $testdir/file2 >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file2 | _filter_scratch
+
+echo "CoW and unmount"
+$XFS_IO_PROG -f -c "cowextsize" $testdir/file2 >> $seqres.full
+$XFS_IO_PROG -d -f -c "pwrite -R -S 0x63 -b $real_blksz 0 $filesize" $testdir/file2 >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+
+echo "Check extent counts"
+old_extents=$(_count_extents $testdir/file1)
+new_extents=$(_count_extents $testdir/file2)
+
+echo "old extents: $old_extents" >> $seqres.full
+echo "new extents: $new_extents" >> $seqres.full
+echo "maximum extents: $internal_blks" >> $seqres.full
+test $new_extents -lt $((internal_blks * 2 / 3)) || echo "file2 badly fragmented"
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/198.out b/tests/xfs/198.out
new file mode 100644
index 0000000..e1d1831
--- /dev/null
+++ b/tests/xfs/198.out
@@ -0,0 +1,10 @@
+QA output created by 198
+Format and mount
+Create the original files
+Compare files
+2909feb63a37b0e95fe5cfb7f274f7b1  SCRATCH_MNT/test-198/file1
+2909feb63a37b0e95fe5cfb7f274f7b1  SCRATCH_MNT/test-198/file2
+CoW and unmount
+Compare files
+2909feb63a37b0e95fe5cfb7f274f7b1  SCRATCH_MNT/test-198/file1
+Check extent counts
diff --git a/tests/xfs/200 b/tests/xfs/200
new file mode 100755
index 0000000..99bcf31
--- /dev/null
+++ b/tests/xfs/200
@@ -0,0 +1,109 @@
+#! /bin/bash
+# FS QA Test No. 200
+#
+# Test fragmentation after a lot of random CoW:
+# - Create two reflinked files.  Set extsz hint on second file.
+# - Read the whole file into memory.
+# - Buffered write to random offsets to scatter CoW reservations.
+# - fadvise(dontneed) the whole file to evict the pages.
+# - falloc the whole fle to see if the extsz hints still apply.
+# - Check the number of 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/reflink
+
+# real QA test starts here
+_supported_os Linux
+_supported_fs xfs
+_require_scratch_reflink
+_require_cp_reflink
+_require_fiemap
+_require_xfs_io_command "cowextsize"
+
+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
+
+blksz=65536
+nr=128
+filesize=$((blksz * nr))
+bufnr=16
+bufsize=$((blksz * bufnr))
+
+_require_fs_space $SCRATCH_MNT $((filesize / 1024 * 3 * 5 / 4))
+real_blksz=$(stat -f -c '%S' $testdir)
+internal_blks=$((filesize / real_blksz))
+
+echo "Create the original files"
+$XFS_IO_PROG -f -c "pwrite -S 0x61 -b $bufsize 0 $((filesize + 1))" $testdir/file1 >> $seqres.full
+$XFS_IO_PROG -f -c "cowextsize $bufsize" $testdir/file2
+_cp_reflink $testdir/file1 $testdir/file2 >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file2 | _filter_scratch
+
+echo "CoW and unmount"
+$XFS_IO_PROG -f -c "cowextsize" $testdir/file2 >> $seqres.full
+cat $testdir/file2 > /dev/null
+$XFS_IO_PROG -f -c "pwrite -R -S 0x63 -b $real_blksz 0 $filesize" -c "fdatasync" $testdir/file2 >> $seqres.full
+$XFS_IO_PROG -f -c "fadvise -d 0 $filesize" -c "fsync" $testdir/file2 >> $seqres.full
+$XFS_IO_PROG -f -c "falloc 0 $filesize" $testdir/file2 >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+
+echo "Check extent counts"
+old_extents=$(_count_extents $testdir/file1)
+new_extents=$(_count_extents $testdir/file2)
+
+echo "old extents: $old_extents" >> $seqres.full
+echo "new extents: $new_extents" >> $seqres.full
+echo "maximum extents: $internal_blks" >> $seqres.full
+test $new_extents -lt $((internal_blks / 20)) || test $new_extents -lt 15 \
+	|| echo "file2 badly fragmented"
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/200.out b/tests/xfs/200.out
new file mode 100644
index 0000000..6e0a1ee
--- /dev/null
+++ b/tests/xfs/200.out
@@ -0,0 +1,10 @@
+QA output created by 200
+Format and mount
+Create the original files
+Compare files
+2909feb63a37b0e95fe5cfb7f274f7b1  SCRATCH_MNT/test-200/file1
+2909feb63a37b0e95fe5cfb7f274f7b1  SCRATCH_MNT/test-200/file2
+CoW and unmount
+Compare files
+2909feb63a37b0e95fe5cfb7f274f7b1  SCRATCH_MNT/test-200/file1
+Check extent counts
diff --git a/tests/xfs/204 b/tests/xfs/204
new file mode 100755
index 0000000..3159849
--- /dev/null
+++ b/tests/xfs/204
@@ -0,0 +1,110 @@
+#! /bin/bash
+# FS QA Test No. 204
+#
+# Test fragmentation after a lot of random CoW:
+# - Create two reflinked files.  Set extsz hint on second file.
+# - Read the whole file into memory.
+# - DIO write to random offsets to scatter CoW reservations.
+# - fadvise(dontneed) the whole file to evict the pages.
+# - falloc the whole fle to see if the extsz hints still apply.
+# - Check the number of 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/reflink
+
+# real QA test starts here
+_supported_os Linux
+_supported_fs xfs
+_require_scratch_reflink
+_require_cp_reflink
+_require_fiemap
+_require_xfs_io_command "cowextsize"
+_require_odirect
+
+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
+
+blksz=65536
+nr=128
+filesize=$((blksz * nr))
+bufnr=16
+bufsize=$((blksz * bufnr))
+
+_require_fs_space $SCRATCH_MNT $((filesize / 1024 * 3 * 5 / 4))
+real_blksz=$(stat -f -c '%S' $testdir)
+internal_blks=$((filesize / real_blksz))
+
+echo "Create the original files"
+$XFS_IO_PROG -f -c "pwrite -S 0x61 -b $bufsize 0 $((filesize + 1))" $testdir/file1 >> $seqres.full
+$XFS_IO_PROG -f -c "cowextsize $bufsize" $testdir/file2
+_cp_reflink $testdir/file1 $testdir/file2 >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file2 | _filter_scratch
+
+echo "CoW and unmount"
+$XFS_IO_PROG -f -c "cowextsize" $testdir/file2 >> $seqres.full
+cat $testdir/file2 > /dev/null
+$XFS_IO_PROG -d -f -c "pwrite -R -S 0x63 -b $real_blksz 0 $filesize" -c "fdatasync" $testdir/file2 >> $seqres.full
+$XFS_IO_PROG -f -c "fadvise -d 0 $filesize" -c "fsync" $testdir/file2 >> $seqres.full
+$XFS_IO_PROG -f -c "falloc 0 $filesize" $testdir/file2 >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+
+echo "Check extent counts"
+old_extents=$(_count_extents $testdir/file1)
+new_extents=$(_count_extents $testdir/file2)
+
+echo "old extents: $old_extents" >> $seqres.full
+echo "new extents: $new_extents" >> $seqres.full
+echo "maximum extents: $internal_blks" >> $seqres.full
+test $new_extents -lt $((internal_blks / 20)) || test $new_extents -lt 15 \
+	|| echo "file2 badly fragmented"
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/204.out b/tests/xfs/204.out
new file mode 100644
index 0000000..702cd72
--- /dev/null
+++ b/tests/xfs/204.out
@@ -0,0 +1,10 @@
+QA output created by 204
+Format and mount
+Create the original files
+Compare files
+2909feb63a37b0e95fe5cfb7f274f7b1  SCRATCH_MNT/test-204/file1
+2909feb63a37b0e95fe5cfb7f274f7b1  SCRATCH_MNT/test-204/file2
+CoW and unmount
+Compare files
+2909feb63a37b0e95fe5cfb7f274f7b1  SCRATCH_MNT/test-204/file1
+Check extent counts
diff --git a/tests/xfs/207 b/tests/xfs/207
new file mode 100755
index 0000000..d416f79
--- /dev/null
+++ b/tests/xfs/207
@@ -0,0 +1,101 @@
+#! /bin/bash
+# FS QA Test No. 207
+#
+# Test setting the extsz and cowextsz hints:
+# - Ensure that we can set both on a zero-byte file.
+# - Ensure that we can set only cowextsz on a many-byte file.
+# - Ensure that whatever we set we get back later.
+#
+#-----------------------------------------------------------------------
+# 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_reflink
+_require_cp_reflink
+_require_fiemap
+_require_xfs_io_command "cowextsize"
+
+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
+
+echo "Create the original files"
+$XFS_IO_PROG -f -c "pwrite -S 0x61 0 0" $testdir/file1 >> $seqres.full
+$XFS_IO_PROG -f -c "pwrite -S 0x61 0 1048576" $testdir/file2 >> $seqres.full
+$XFS_IO_PROG -f -c "pwrite -S 0x61 0 0" $testdir/file3 >> $seqres.full
+_scratch_remount
+
+echo "Set extsz and cowextsz on zero byte file"
+$XFS_IO_PROG -c "extsize 1048576" $testdir/file1 | _filter_scratch
+$XFS_IO_PROG -c "cowextsize 1048576" $testdir/file1 | _filter_scratch
+
+echo "Set extsz and cowextsz on 1Mbyte file"
+$XFS_IO_PROG -c "extsize 1048576" $testdir/file2 | _filter_scratch
+$XFS_IO_PROG -c "cowextsize 1048576" $testdir/file2 | _filter_scratch
+_scratch_remount
+
+echo "Check extsz and cowextsz settings on zero byte file"
+$XFS_IO_PROG -c "extsize" $testdir/file1 | _filter_scratch
+$XFS_IO_PROG -c "cowextsize" $testdir/file1 | _filter_scratch
+
+echo "Check extsz and cowextsz settings on 1Mbyte file"
+$XFS_IO_PROG -c "extsize" $testdir/file2 | _filter_scratch
+$XFS_IO_PROG -c "cowextsize" $testdir/file2 | _filter_scratch
+
+echo "Set cowextsize and check flag"
+$XFS_IO_PROG -c "cowextsize 1048576" $testdir/file3 | _filter_scratch
+_scratch_remount
+
+$XFS_IO_PROG -c "stat" $testdir/file3 | grep 'fsxattr.xflags' | _filter_scratch
+$XFS_IO_PROG -c "cowextsize" $testdir/file3 | _filter_scratch
+
+echo "Unset cowextsize and check flag"
+$XFS_IO_PROG -c "cowextsize 0" $testdir/file3 | _filter_scratch
+_scratch_remount
+
+$XFS_IO_PROG -c "stat" $testdir/file3 | grep 'fsxattr.xflags' | _filter_scratch
+$XFS_IO_PROG -c "cowextsize" $testdir/file3 | _filter_scratch
+
+status=0
+exit
diff --git a/tests/xfs/207.out b/tests/xfs/207.out
new file mode 100644
index 0000000..14eede4
--- /dev/null
+++ b/tests/xfs/207.out
@@ -0,0 +1,18 @@
+QA output created by 207
+Format and mount
+Create the original files
+Set extsz and cowextsz on zero byte file
+Set extsz and cowextsz on 1Mbyte file
+xfs_io: XFS_IOC_FSSETXATTR SCRATCH_MNT/test-207/file2: Invalid argument
+Check extsz and cowextsz settings on zero byte file
+[1048576] SCRATCH_MNT/test-207/file1
+[1048576] SCRATCH_MNT/test-207/file1
+Check extsz and cowextsz settings on 1Mbyte file
+[0] SCRATCH_MNT/test-207/file2
+[1048576] SCRATCH_MNT/test-207/file2
+Set cowextsize and check flag
+fsxattr.xflags = 0x20000 [---------------C]
+[1048576] SCRATCH_MNT/test-207/file3
+Unset cowextsize and check flag
+fsxattr.xflags = 0x0 [----------------]
+[0] SCRATCH_MNT/test-207/file3
diff --git a/tests/xfs/208 b/tests/xfs/208
new file mode 100755
index 0000000..d876898
--- /dev/null
+++ b/tests/xfs/208
@@ -0,0 +1,138 @@
+#! /bin/bash
+# FS QA Test No. 208
+#
+# Ensure that the effective cow extent allocation size hint is the maximum of
+# the cowextsize and extsize inode fields.
+# - Create two reflinked files.  Set extsz hint on second file to $blocksize
+#   and cowextsize hint to 1MB.
+# - Buffered write to random offsets to scatter CoW reservations.
+# - Rewrite the whole file to use up reservations.
+# - Check the number of extents.
+# - Repeat, but with extsz = 1MB and cowextsz = $blocksize.
+#
+#-----------------------------------------------------------------------
+# 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_reflink
+_require_cp_reflink
+_require_fiemap
+_require_xfs_io_command "cowextsize"
+
+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
+
+blksz=65536
+nr=128
+filesize=$((blksz * nr))
+bufnr=16
+bufsize=$((blksz * bufnr))
+
+_require_fs_space $SCRATCH_MNT $((filesize / 1024 * 3 * 5 / 4))
+real_blksz=$(stat -f -c '%S' $testdir)
+internal_blks=$((filesize / real_blksz))
+
+echo "Create the original files"
+$XFS_IO_PROG -f -c "pwrite -S 0x61 -b $bufsize 0 $((filesize + 1))" $testdir/file1 >> $seqres.full
+
+$XFS_IO_PROG -f -c "extsize $real_blksz" $testdir/file2
+$XFS_IO_PROG -f -c "cowextsize $bufsize" $testdir/file2
+_cp_reflink $testdir/file1 $testdir/file2 >> $seqres.full
+_cp_reflink $testdir/file1 $testdir/file2 >> $seqres.full
+
+$XFS_IO_PROG -f -c "extsize $bufsize" $testdir/file3
+$XFS_IO_PROG -f -c "cowextsize $real_blksz" $testdir/file3
+_cp_reflink $testdir/file1 $testdir/file3 >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file2 | _filter_scratch
+md5sum $testdir/file3 | _filter_scratch
+
+echo "CoW and unmount"
+echo "extsize" >> $seqres.full
+$XFS_IO_PROG -f -c "extsize" $testdir/file2 >> $seqres.full
+echo "cowextsize" >> $seqres.full
+$XFS_IO_PROG -f -c "cowextsize" $testdir/file2 >> $seqres.full
+
+$XFS_IO_PROG -f -c "pwrite -R -S 0x63 -b $real_blksz 0 $filesize" -c "fdatasync" $testdir/file2 >> $seqres.full
+$XFS_IO_PROG -f -c "pwrite -S 0x63 -b $real_blksz 0 $((filesize + 1))" -c "fdatasync" $testdir/file2 >> $seqres.full
+
+echo "extsize" >> $seqres.full
+$XFS_IO_PROG -f -c "extsize" $testdir/file3 >> $seqres.full
+echo "cowextsize" >> $seqres.full
+$XFS_IO_PROG -f -c "cowextsize" $testdir/file3 >> $seqres.full
+
+$XFS_IO_PROG -f -c "pwrite -R -S 0x63 -b $real_blksz 0 $filesize" -c "fdatasync" $testdir/file3 >> $seqres.full
+$XFS_IO_PROG -f -c "pwrite -S 0x63 -b $real_blksz 0 $((filesize + 1))" -c "fdatasync" $testdir/file3 >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file2 | _filter_scratch
+md5sum $testdir/file3 | _filter_scratch
+
+echo "Check extent counts"
+old_extents=$(_count_extents $testdir/file1)
+new_extents=$(_count_extents $testdir/file2)
+
+echo "old extents: $old_extents" >> $seqres.full
+echo "new extents: $new_extents" >> $seqres.full
+echo "maximum extents: $internal_blks" >> $seqres.full
+test $new_extents -lt $((internal_blks / 20)) || test $new_extents -lt 15 \
+	|| echo "file2 badly fragmented"
+
+new_extents=$(_count_extents $testdir/file3)
+
+echo "old extents: $old_extents" >> $seqres.full
+echo "new extents: $new_extents" >> $seqres.full
+echo "maximum extents: $internal_blks" >> $seqres.full
+test $new_extents -lt $((internal_blks / 20)) || test $new_extents -lt 15 \
+	|| echo "file3 badly fragmented"
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/208.out b/tests/xfs/208.out
new file mode 100644
index 0000000..a344036
--- /dev/null
+++ b/tests/xfs/208.out
@@ -0,0 +1,13 @@
+QA output created by 208
+Format and mount
+Create the original files
+Compare files
+2909feb63a37b0e95fe5cfb7f274f7b1  SCRATCH_MNT/test-208/file1
+2909feb63a37b0e95fe5cfb7f274f7b1  SCRATCH_MNT/test-208/file2
+2909feb63a37b0e95fe5cfb7f274f7b1  SCRATCH_MNT/test-208/file3
+CoW and unmount
+Compare files
+2909feb63a37b0e95fe5cfb7f274f7b1  SCRATCH_MNT/test-208/file1
+d41f6527bc8320364e12ea7076140b8b  SCRATCH_MNT/test-208/file2
+d41f6527bc8320364e12ea7076140b8b  SCRATCH_MNT/test-208/file3
+Check extent counts
diff --git a/tests/xfs/209 b/tests/xfs/209
new file mode 100755
index 0000000..684187e
--- /dev/null
+++ b/tests/xfs/209
@@ -0,0 +1,82 @@
+#! /bin/bash
+# FS QA Test No. 209
+#
+# Make sure setting cowextsz on a directory propagates it to subfiles.
+#
+#-----------------------------------------------------------------------
+# 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_reflink
+_require_cp_reflink
+_require_fiemap
+_require_xfs_io_command "cowextsize"
+
+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
+
+echo "Set extsz and cowextsz on directory"
+$XFS_IO_PROG -c "cowextsize 1048576" $testdir >> $seqres.full
+
+echo "Create a fake tree structure"
+seq 1 2 | while read nr; do
+	mkdir "$testdir/dir-$nr"
+	seq 1 4 | while read nnr; do
+		touch "$testdir/dir-$nr/file-$nnr"
+	done
+done
+_scratch_remount
+
+echo "Check cowextsize settings"
+seq 1 2 | while read nr; do
+	seq 1 4 | while read nnr; do
+		file="$testdir/dir-$nr/file-$nnr"
+		$XFS_IO_PROG -c "cowextsize" $file
+	done
+done
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/209.out b/tests/xfs/209.out
new file mode 100644
index 0000000..109af34
--- /dev/null
+++ b/tests/xfs/209.out
@@ -0,0 +1,13 @@
+QA output created by 209
+Format and mount
+Set extsz and cowextsz on directory
+Create a fake tree structure
+Check cowextsize settings
+[1048576] /opt/test-209/dir-1/file-1
+[1048576] /opt/test-209/dir-1/file-2
+[1048576] /opt/test-209/dir-1/file-3
+[1048576] /opt/test-209/dir-1/file-4
+[1048576] /opt/test-209/dir-2/file-1
+[1048576] /opt/test-209/dir-2/file-2
+[1048576] /opt/test-209/dir-2/file-3
+[1048576] /opt/test-209/dir-2/file-4
diff --git a/tests/xfs/210 b/tests/xfs/210
new file mode 100755
index 0000000..d3a2716
--- /dev/null
+++ b/tests/xfs/210
@@ -0,0 +1,108 @@
+#! /bin/bash
+# FS QA Test No. 210
+#
+# During reflink, XFS should carry the cowextsz setting to the destination file
+# if the destination file size is less than the size of the source file, the
+# length is the size of the source file, both offsets are zero, and the
+# destination does not already have a cowextsz setting.  It should not do so
+# otherwise.
+#
+#-----------------------------------------------------------------------
+# 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_reflink
+_require_cp_reflink
+_require_fiemap
+_require_xfs_io_command "cowextsize"
+
+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
+
+echo "Create initial file"
+$XFS_IO_PROG -f -c "pwrite -S 0x61 0 131072" $testdir/file1 >> $seqres.full
+$XFS_IO_PROG -c "cowextsize 1048576" $testdir/file1 >> $seqres.full
+$XFS_IO_PROG -f -c "pwrite -S 0x61 0 1" $testdir/file4 >> $seqres.full
+$XFS_IO_PROG -f -c "pwrite -S 0x61 0 262144" $testdir/file7 >> $seqres.full
+$XFS_IO_PROG -f -c "pwrite -S 0x61 0 262144" $testdir/file9 >> $seqres.full
+$XFS_IO_PROG -f -c "pwrite -S 0x61 0 262144" $testdir/file10 >> $seqres.full
+
+echo "Reflink to an empty file"
+_reflink_range $testdir/file1 0 $testdir/file2 0 0 >> $seqres.full
+
+echo "Reflink to an empty file that already has cowextsz"
+$XFS_IO_PROG -f -c "cowextsize 524288" $testdir/file3 >> $seqres.full
+_reflink_range $testdir/file1 0 $testdir/file3 0 0 >> $seqres.full
+
+echo "Reflink to a small file"
+_reflink_range $testdir/file1 0 $testdir/file4 0 0 >> $seqres.full
+
+echo "Reflink to a nonzero offset"
+_reflink_range $testdir/file1 0 $testdir/file5 65536 0 >> $seqres.full
+
+echo "Reflink from a nonzero offset"
+_reflink_range $testdir/file1 65536 $testdir/file6 0 0 >> $seqres.full
+
+echo "Reflink to a larger file"
+_reflink_range $testdir/file1 0 $testdir/file7 0 0 >> $seqres.full
+
+echo "Reflink less than the whole source file"
+_reflink_range $testdir/file1 0 $testdir/file8 0 65536 >> $seqres.full
+
+echo "cp reflink to a larger file"
+_cp_reflink $testdir/file1 $testdir/file9 >> $seqres.full
+
+echo "cp reflink to a larger file with cowextsize"
+$XFS_IO_PROG -f -c "cowextsize 524288" $testdir/file10 >> $seqres.full
+_cp_reflink $testdir/file1 $testdir/file10 >> $seqres.full
+
+echo "Check cowextsz"
+for i in `seq 1 10`; do
+	$XFS_IO_PROG -c "cowextsize" $testdir/file$i | _filter_scratch
+done
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/210.out b/tests/xfs/210.out
new file mode 100644
index 0000000..46d28d9
--- /dev/null
+++ b/tests/xfs/210.out
@@ -0,0 +1,23 @@
+QA output created by 210
+Format and mount
+Create initial file
+Reflink to an empty file
+Reflink to an empty file that already has cowextsz
+Reflink to a small file
+Reflink to a nonzero offset
+Reflink from a nonzero offset
+Reflink to a larger file
+Reflink less than the whole source file
+cp reflink to a larger file
+cp reflink to a larger file with cowextsize
+Check cowextsz
+[1048576] SCRATCH_MNT/test-210/file1
+[1048576] SCRATCH_MNT/test-210/file2
+[524288] SCRATCH_MNT/test-210/file3
+[1048576] SCRATCH_MNT/test-210/file4
+[0] SCRATCH_MNT/test-210/file5
+[0] SCRATCH_MNT/test-210/file6
+[0] SCRATCH_MNT/test-210/file7
+[0] SCRATCH_MNT/test-210/file8
+[1048576] SCRATCH_MNT/test-210/file9
+[524288] SCRATCH_MNT/test-210/file10
diff --git a/tests/xfs/211 b/tests/xfs/211
new file mode 100755
index 0000000..cb0f17a
--- /dev/null
+++ b/tests/xfs/211
@@ -0,0 +1,107 @@
+#! /bin/bash
+# FS QA Test No. 211
+#
+# Test fragmentation in a big file after a lot of random CoW:
+# - Create two reflinked files.  Set extsz hint on second file.
+# - Directio write to random offsets to scatter CoW reservations.
+# - Rewrite the whole file to use up reservations.
+# - Check the number of 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/reflink
+
+# real QA test starts here
+_supported_os Linux
+_supported_fs xfs
+_require_scratch_reflink
+_require_cp_reflink
+_require_fiemap
+_require_xfs_io_command "cowextsize"
+_require_odirect
+
+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
+
+blksz=65536
+nr=50000
+filesize=$((blksz * nr))
+bufnr=16
+bufsize=$((blksz * bufnr))
+
+_require_fs_space $SCRATCH_MNT $((filesize / 1024 * 2 * 5 / 4))
+real_blksz=$(stat -f -c '%S' $testdir)
+internal_blks=$((filesize / real_blksz))
+
+echo "Create the original files"
+$XFS_IO_PROG -f -c "pwrite -S 0x61 -b $bufsize 0 $((filesize + 1))" $testdir/file1 >> $seqres.full
+$XFS_IO_PROG -f -c "cowextsize $bufsize" $testdir/file2
+_cp_reflink $testdir/file1 $testdir/file2 >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file2 | _filter_scratch
+
+echo "CoW and unmount"
+$XFS_IO_PROG -f -c "cowextsize" $testdir/file2 >> $seqres.full
+$XFS_IO_PROG -d -f -c "pwrite -R -S 0x63 -b $real_blksz 0 $((filesize + 1))" $testdir/file2 >> $seqres.full
+$XFS_IO_PROG -d -f -c "pwrite -S 0x63 -b 8388608 0 $filesize" $testdir/file2 >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file2 | _filter_scratch
+
+echo "Check extent counts"
+old_extents=$(_count_extents $testdir/file1)
+new_extents=$(_count_extents $testdir/file2)
+
+echo "old extents: $old_extents" >> $seqres.full
+echo "new extents: $new_extents" >> $seqres.full
+echo "maximum extents: $internal_blks" >> $seqres.full
+test $new_extents -lt $((internal_blks / 20)) || test $new_extents -lt 15 \
+	|| echo "file2 badly fragmented"
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/211.out b/tests/xfs/211.out
new file mode 100644
index 0000000..7371c5b
--- /dev/null
+++ b/tests/xfs/211.out
@@ -0,0 +1,11 @@
+QA output created by 211
+Format and mount
+Create the original files
+Compare files
+07415406aea963ab8e005f1d3744fded  SCRATCH_MNT/test-211/file1
+07415406aea963ab8e005f1d3744fded  SCRATCH_MNT/test-211/file2
+CoW and unmount
+Compare files
+07415406aea963ab8e005f1d3744fded  SCRATCH_MNT/test-211/file1
+7d8ab127adfc1f745a7d1cd5e44d10d8  SCRATCH_MNT/test-211/file2
+Check extent counts
diff --git a/tests/xfs/group b/tests/xfs/group
index abf1d33..119e1fd 100644
--- a/tests/xfs/group
+++ b/tests/xfs/group
@@ -177,8 +177,11 @@
 177 dmapi
 178 mkfs other auto
 179 auto quick clone
+180 auto quick clone
 181 log auto quick
+182 auto quick clone
 183 rw other auto quick
+184 auto quick clone
 185 dmapi
 186 attr auto quick
 187 attr auto quick
@@ -186,16 +189,26 @@
 189 mount auto quick
 190 rw auto quick
 191 nfs4acl auto
+192 auto quick clone
+193 auto quick clone
 194 rw auto
 195 ioctl dump auto quick
 196 quota auto quick
 197 dir auto quick
+198 auto quick clone
 199 mount auto quick
+200 auto quick clone
 201 metadata auto quick
 202 repair auto quick
 203 ioctl auto
+204 auto quick clone
 205 metadata rw auto
 206 growfs auto quick
+207 auto quick clone
+208 auto quick clone
+209 auto quick clone
+210 auto quick clone
+211 clone_stress
 216 log metadata auto quick
 217 log metadata auto
 220 auto quota quick

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

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

* [PATCH 20/32] reflink: high offset reflink and dedupe tests
  2016-02-11 23:39 ` Darrick J. Wong
@ 2016-02-11 23:41   ` Darrick J. Wong
  -1 siblings, 0 replies; 81+ messages in thread
From: Darrick J. Wong @ 2016-02-11 23:41 UTC (permalink / raw)
  To: david, darrick.wong; +Cc: linux-btrfs, Christoph Hellwig, fstests, xfs

Ensure that we can pass absurdly enormous offsets and lengths to
reflink/dedupe and it'll survive.

v2: Ask for dedupe in the dedupe test.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
[hch@lst.de: call _require_test_dedupe]
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 tests/generic/303     |   98 +++++++++++++++++++++++++++++++++++++++++++++++++
 tests/generic/303.out |   21 ++++++++++
 tests/generic/304     |   99 +++++++++++++++++++++++++++++++++++++++++++++++++
 tests/generic/304.out |   22 +++++++++++
 tests/generic/group   |    2 +
 5 files changed, 242 insertions(+)
 create mode 100755 tests/generic/303
 create mode 100644 tests/generic/303.out
 create mode 100755 tests/generic/304
 create mode 100644 tests/generic/304.out


diff --git a/tests/generic/303 b/tests/generic/303
new file mode 100755
index 0000000..2283b5e
--- /dev/null
+++ b/tests/generic/303
@@ -0,0 +1,98 @@
+#! /bin/bash
+# FS QA Test No. 303
+#
+# Check that high-offset reflinks work.
+#
+#-----------------------------------------------------------------------
+# 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.* $testdir
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+. ./common/attr
+. ./common/reflink
+
+# real QA test starts here
+_supported_os Linux
+_require_test_reflink
+_require_cp_reflink
+
+rm -f $seqres.full
+
+echo "Format and mount"
+testdir=$TEST_DIR/test-$seq
+mkdir $testdir
+
+echo "Create the original files"
+bigoff=9223372036854775806
+len=9223372036854775807
+bigoff_64k=9223372036854710272	# bigoff rounded down to 64k
+$XFS_IO_PROG -f -c "truncate $len" $testdir/file0 >> $seqres.full
+test -s $testdir/file0 || _notrun "High offset ftruncate failed"
+_pwrite_byte 0x61 $bigoff 1 $testdir/file1 >> $seqres.full
+_pwrite_byte 0x61 1048575 1 $testdir/file2 >> $seqres.full
+
+echo "Reflink large single byte file"
+_cp_reflink $testdir/file1 $testdir/file3 >> $seqres.full
+
+echo "Reflink large empty file"
+_cp_reflink $testdir/file0 $testdir/file4 >> $seqres.full
+
+echo "Reflink past maximum file size in dest file (should fail)"
+_reflink_range $testdir/file1 0 $testdir/file5 4611686018427322368 $len >> $seqres.full
+
+echo "Reflink high offset to low offset"
+_reflink_range $testdir/file1 $bigoff_64k $testdir/file6 1048576 65535 >> $seqres.full
+
+echo "Reflink past source file EOF (should fail)"
+_reflink_range $testdir/file2 524288 $testdir/file7 0 1048576 >> $seqres.full
+
+echo "Reflink max size at nonzero offset (should fail)"
+_reflink_range $testdir/file2 524288 $testdir/file8 0 $len >> $seqres.full
+
+echo "Reflink with huge off/len (should fail)"
+_reflink_range $testdir/file2 $bigoff_64k $testdir/file9 0 $bigoff_64k >> $seqres.full
+
+echo "Check file creation"
+_test_remount
+echo "file3"
+$XFS_IO_PROG -c "pread -v -q $bigoff 1" $testdir/file3
+echo "file4"
+$XFS_IO_PROG -c "pread -v -q $bigoff 1" $testdir/file4
+# file5 should fail above
+echo "file6"
+$XFS_IO_PROG -c "pread -v -q 1114110 1" $testdir/file6
+# file7 should fail above
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/303.out b/tests/generic/303.out
new file mode 100644
index 0000000..39a8803
--- /dev/null
+++ b/tests/generic/303.out
@@ -0,0 +1,21 @@
+QA output created by 303
+Format and mount
+Create the original files
+Reflink large single byte file
+Reflink large empty file
+Reflink past maximum file size in dest file (should fail)
+XFS_IOC_CLONE_RANGE: Invalid argument
+Reflink high offset to low offset
+Reflink past source file EOF (should fail)
+XFS_IOC_CLONE_RANGE: Invalid argument
+Reflink max size at nonzero offset (should fail)
+XFS_IOC_CLONE_RANGE: Invalid argument
+Reflink with huge off/len (should fail)
+XFS_IOC_CLONE_RANGE: Invalid argument
+Check file creation
+file3
+7ffffffffffffffe:  61  a
+file4
+7ffffffffffffffe:  00  .
+file6
+0010fffe:  61  a
diff --git a/tests/generic/304 b/tests/generic/304
new file mode 100755
index 0000000..e50fc2a
--- /dev/null
+++ b/tests/generic/304
@@ -0,0 +1,99 @@
+#! /bin/bash
+# FS QA Test No. 304
+#
+# Check that high-offset dedupes work.
+#
+#-----------------------------------------------------------------------
+# 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.* $testdir
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+. ./common/attr
+. ./common/reflink
+
+# real QA test starts here
+_supported_os Linux
+_require_test_dedupe
+_require_cp_reflink
+
+rm -f $seqres.full
+
+echo "Format and mount"
+testdir=$TEST_DIR/test-$seq
+mkdir $testdir
+
+echo "Create the original files"
+bigoff=9223372036854775806
+len=9223372036854775807
+bigoff_64k=9223372036854710272	# bigoff rounded down to 64k
+$XFS_IO_PROG -f -c "truncate $len" $testdir/file0 >> $seqres.full
+test -s $testdir/file0 || _notrun "High offset ftruncate failed"
+_pwrite_byte 0x61 $bigoff 1 $testdir/file1 >> $seqres.full
+_pwrite_byte 0x61 $bigoff 1 $testdir/file3 >> $seqres.full
+_pwrite_byte 0x61 1048575 1 $testdir/file2 >> $seqres.full
+
+echo "Dedupe large single byte file"
+_dedupe_range $testdir/file1 0 $testdir/file3 0 $len >> $seqres.full
+
+echo "Dedupe large empty file"
+_dedupe_range $testdir/file0 0 $testdir/file4 0 $len >> $seqres.full
+
+echo "Dedupe past maximum file size in dest file (should fail)"
+_dedupe_range $testdir/file1 0 $testdir/file5 4611686018427322368 $len >> $seqres.full
+
+echo "Dedupe high offset to low offset"
+_dedupe_range $testdir/file1 $bigoff_64k $testdir/file6 1048576 65535 >> $seqres.full
+
+echo "Dedupe past source file EOF (should fail)"
+_dedupe_range $testdir/file2 524288 $testdir/file7 0 1048576 >> $seqres.full
+
+echo "Dedupe max size at nonzero offset (should fail)"
+_dedupe_range $testdir/file2 524288 $testdir/file8 0 $len >> $seqres.full
+
+echo "Dedupe with huge off/len (should fail)"
+_dedupe_range $testdir/file2 $bigoff_64k $testdir/file9 0 $bigoff_64k >> $seqres.full
+
+echo "Check file creation"
+_test_remount
+echo "file3"
+$XFS_IO_PROG -c "pread -v -q $bigoff 1" $testdir/file3
+echo "file4"
+$XFS_IO_PROG -c "pread -v -q $bigoff 1" $testdir/file4
+# file5 should fail above
+echo "file6"
+$XFS_IO_PROG -c "pread -v -q 1114110 1" $testdir/file6
+# file7 should fail above
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/304.out b/tests/generic/304.out
new file mode 100644
index 0000000..4af2a39
--- /dev/null
+++ b/tests/generic/304.out
@@ -0,0 +1,22 @@
+QA output created by 304
+Format and mount
+Create the original files
+Dedupe large single byte file
+dedupe: Invalid argument
+Dedupe large empty file
+dedupe: Invalid argument
+Dedupe past maximum file size in dest file (should fail)
+dedupe: Invalid argument
+Dedupe high offset to low offset
+dedupe: Extents did not match.
+Dedupe past source file EOF (should fail)
+dedupe: Invalid argument
+Dedupe max size at nonzero offset (should fail)
+dedupe: Invalid argument
+Dedupe with huge off/len (should fail)
+XFS_IOC_FILE_EXTENT_SAME: Invalid argument
+Check file creation
+file3
+7ffffffffffffffe:  61  a
+file4
+file6
diff --git a/tests/generic/group b/tests/generic/group
index 7edc963..4a1cce4 100644
--- a/tests/generic/group
+++ b/tests/generic/group
@@ -305,6 +305,8 @@
 300 auto aio enospc preallocrw stress
 301 auto quick clone
 302 auto quick clone
+303 auto quick clone
+304 auto quick clone
 306 auto quick rw
 307 auto quick
 308 auto quick


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

* [PATCH 20/32] reflink: high offset reflink and dedupe tests
@ 2016-02-11 23:41   ` Darrick J. Wong
  0 siblings, 0 replies; 81+ messages in thread
From: Darrick J. Wong @ 2016-02-11 23:41 UTC (permalink / raw)
  To: david, darrick.wong; +Cc: fstests, Christoph Hellwig, linux-btrfs, xfs

Ensure that we can pass absurdly enormous offsets and lengths to
reflink/dedupe and it'll survive.

v2: Ask for dedupe in the dedupe test.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
[hch@lst.de: call _require_test_dedupe]
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 tests/generic/303     |   98 +++++++++++++++++++++++++++++++++++++++++++++++++
 tests/generic/303.out |   21 ++++++++++
 tests/generic/304     |   99 +++++++++++++++++++++++++++++++++++++++++++++++++
 tests/generic/304.out |   22 +++++++++++
 tests/generic/group   |    2 +
 5 files changed, 242 insertions(+)
 create mode 100755 tests/generic/303
 create mode 100644 tests/generic/303.out
 create mode 100755 tests/generic/304
 create mode 100644 tests/generic/304.out


diff --git a/tests/generic/303 b/tests/generic/303
new file mode 100755
index 0000000..2283b5e
--- /dev/null
+++ b/tests/generic/303
@@ -0,0 +1,98 @@
+#! /bin/bash
+# FS QA Test No. 303
+#
+# Check that high-offset reflinks work.
+#
+#-----------------------------------------------------------------------
+# 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.* $testdir
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+. ./common/attr
+. ./common/reflink
+
+# real QA test starts here
+_supported_os Linux
+_require_test_reflink
+_require_cp_reflink
+
+rm -f $seqres.full
+
+echo "Format and mount"
+testdir=$TEST_DIR/test-$seq
+mkdir $testdir
+
+echo "Create the original files"
+bigoff=9223372036854775806
+len=9223372036854775807
+bigoff_64k=9223372036854710272	# bigoff rounded down to 64k
+$XFS_IO_PROG -f -c "truncate $len" $testdir/file0 >> $seqres.full
+test -s $testdir/file0 || _notrun "High offset ftruncate failed"
+_pwrite_byte 0x61 $bigoff 1 $testdir/file1 >> $seqres.full
+_pwrite_byte 0x61 1048575 1 $testdir/file2 >> $seqres.full
+
+echo "Reflink large single byte file"
+_cp_reflink $testdir/file1 $testdir/file3 >> $seqres.full
+
+echo "Reflink large empty file"
+_cp_reflink $testdir/file0 $testdir/file4 >> $seqres.full
+
+echo "Reflink past maximum file size in dest file (should fail)"
+_reflink_range $testdir/file1 0 $testdir/file5 4611686018427322368 $len >> $seqres.full
+
+echo "Reflink high offset to low offset"
+_reflink_range $testdir/file1 $bigoff_64k $testdir/file6 1048576 65535 >> $seqres.full
+
+echo "Reflink past source file EOF (should fail)"
+_reflink_range $testdir/file2 524288 $testdir/file7 0 1048576 >> $seqres.full
+
+echo "Reflink max size at nonzero offset (should fail)"
+_reflink_range $testdir/file2 524288 $testdir/file8 0 $len >> $seqres.full
+
+echo "Reflink with huge off/len (should fail)"
+_reflink_range $testdir/file2 $bigoff_64k $testdir/file9 0 $bigoff_64k >> $seqres.full
+
+echo "Check file creation"
+_test_remount
+echo "file3"
+$XFS_IO_PROG -c "pread -v -q $bigoff 1" $testdir/file3
+echo "file4"
+$XFS_IO_PROG -c "pread -v -q $bigoff 1" $testdir/file4
+# file5 should fail above
+echo "file6"
+$XFS_IO_PROG -c "pread -v -q 1114110 1" $testdir/file6
+# file7 should fail above
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/303.out b/tests/generic/303.out
new file mode 100644
index 0000000..39a8803
--- /dev/null
+++ b/tests/generic/303.out
@@ -0,0 +1,21 @@
+QA output created by 303
+Format and mount
+Create the original files
+Reflink large single byte file
+Reflink large empty file
+Reflink past maximum file size in dest file (should fail)
+XFS_IOC_CLONE_RANGE: Invalid argument
+Reflink high offset to low offset
+Reflink past source file EOF (should fail)
+XFS_IOC_CLONE_RANGE: Invalid argument
+Reflink max size at nonzero offset (should fail)
+XFS_IOC_CLONE_RANGE: Invalid argument
+Reflink with huge off/len (should fail)
+XFS_IOC_CLONE_RANGE: Invalid argument
+Check file creation
+file3
+7ffffffffffffffe:  61  a
+file4
+7ffffffffffffffe:  00  .
+file6
+0010fffe:  61  a
diff --git a/tests/generic/304 b/tests/generic/304
new file mode 100755
index 0000000..e50fc2a
--- /dev/null
+++ b/tests/generic/304
@@ -0,0 +1,99 @@
+#! /bin/bash
+# FS QA Test No. 304
+#
+# Check that high-offset dedupes work.
+#
+#-----------------------------------------------------------------------
+# 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.* $testdir
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+. ./common/attr
+. ./common/reflink
+
+# real QA test starts here
+_supported_os Linux
+_require_test_dedupe
+_require_cp_reflink
+
+rm -f $seqres.full
+
+echo "Format and mount"
+testdir=$TEST_DIR/test-$seq
+mkdir $testdir
+
+echo "Create the original files"
+bigoff=9223372036854775806
+len=9223372036854775807
+bigoff_64k=9223372036854710272	# bigoff rounded down to 64k
+$XFS_IO_PROG -f -c "truncate $len" $testdir/file0 >> $seqres.full
+test -s $testdir/file0 || _notrun "High offset ftruncate failed"
+_pwrite_byte 0x61 $bigoff 1 $testdir/file1 >> $seqres.full
+_pwrite_byte 0x61 $bigoff 1 $testdir/file3 >> $seqres.full
+_pwrite_byte 0x61 1048575 1 $testdir/file2 >> $seqres.full
+
+echo "Dedupe large single byte file"
+_dedupe_range $testdir/file1 0 $testdir/file3 0 $len >> $seqres.full
+
+echo "Dedupe large empty file"
+_dedupe_range $testdir/file0 0 $testdir/file4 0 $len >> $seqres.full
+
+echo "Dedupe past maximum file size in dest file (should fail)"
+_dedupe_range $testdir/file1 0 $testdir/file5 4611686018427322368 $len >> $seqres.full
+
+echo "Dedupe high offset to low offset"
+_dedupe_range $testdir/file1 $bigoff_64k $testdir/file6 1048576 65535 >> $seqres.full
+
+echo "Dedupe past source file EOF (should fail)"
+_dedupe_range $testdir/file2 524288 $testdir/file7 0 1048576 >> $seqres.full
+
+echo "Dedupe max size at nonzero offset (should fail)"
+_dedupe_range $testdir/file2 524288 $testdir/file8 0 $len >> $seqres.full
+
+echo "Dedupe with huge off/len (should fail)"
+_dedupe_range $testdir/file2 $bigoff_64k $testdir/file9 0 $bigoff_64k >> $seqres.full
+
+echo "Check file creation"
+_test_remount
+echo "file3"
+$XFS_IO_PROG -c "pread -v -q $bigoff 1" $testdir/file3
+echo "file4"
+$XFS_IO_PROG -c "pread -v -q $bigoff 1" $testdir/file4
+# file5 should fail above
+echo "file6"
+$XFS_IO_PROG -c "pread -v -q 1114110 1" $testdir/file6
+# file7 should fail above
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/304.out b/tests/generic/304.out
new file mode 100644
index 0000000..4af2a39
--- /dev/null
+++ b/tests/generic/304.out
@@ -0,0 +1,22 @@
+QA output created by 304
+Format and mount
+Create the original files
+Dedupe large single byte file
+dedupe: Invalid argument
+Dedupe large empty file
+dedupe: Invalid argument
+Dedupe past maximum file size in dest file (should fail)
+dedupe: Invalid argument
+Dedupe high offset to low offset
+dedupe: Extents did not match.
+Dedupe past source file EOF (should fail)
+dedupe: Invalid argument
+Dedupe max size at nonzero offset (should fail)
+dedupe: Invalid argument
+Dedupe with huge off/len (should fail)
+XFS_IOC_FILE_EXTENT_SAME: Invalid argument
+Check file creation
+file3
+7ffffffffffffffe:  61  a
+file4
+file6
diff --git a/tests/generic/group b/tests/generic/group
index 7edc963..4a1cce4 100644
--- a/tests/generic/group
+++ b/tests/generic/group
@@ -305,6 +305,8 @@
 300 auto aio enospc preallocrw stress
 301 auto quick clone
 302 auto quick clone
+303 auto quick clone
+304 auto quick clone
 306 auto quick rw
 307 auto quick
 308 auto quick

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

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

* [PATCH 21/32] reflink: test xfs cow behavior when the filesystem crashes
  2016-02-11 23:39 ` Darrick J. Wong
@ 2016-02-11 23:41   ` Darrick J. Wong
  -1 siblings, 0 replies; 81+ messages in thread
From: Darrick J. Wong @ 2016-02-11 23:41 UTC (permalink / raw)
  To: david, darrick.wong; +Cc: linux-btrfs, fstests, xfs

Use the extent size hint to force leftover CoW reservations then
crash the filesystem to see how recovery works.

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


diff --git a/tests/xfs/212 b/tests/xfs/212
new file mode 100755
index 0000000..4e3bcd4
--- /dev/null
+++ b/tests/xfs/212
@@ -0,0 +1,99 @@
+#! /bin/bash
+# FS QA Test No. 212
+#
+# Test recovery of "lost" CoW blocks after a crash:
+# - Create two reflinked files.  Set extsz hint on second file.
+# - Dirty one byte on the second file and fsync.
+# - Crash the FS to test recovery.
+#
+#-----------------------------------------------------------------------
+# 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_reflink
+_require_cp_reflink
+_require_fiemap
+
+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
+
+blksz=65536
+nr=16
+filesize=$((blksz * nr))
+bufnr=2
+bufsize=$((blksz * bufnr))
+
+_require_fs_space $SCRATCH_MNT $((filesize / 1024 * 3 * 5 / 4))
+
+echo "Create the original files"
+$XFS_IO_PROG -f -c "pwrite -S 0x61 -b $bufsize 0 $filesize" $testdir/file1 >> $seqres.full
+$XFS_IO_PROG -f -c "pwrite -S 0x61 -b $bufsize 0 $filesize" $testdir/file2.chk >> $seqres.full
+$XFS_IO_PROG -f -c "extsize $bufsize" $testdir/file2
+_cp_reflink $testdir/file1 $testdir/file2 >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file2 | _filter_scratch
+md5sum $testdir/file2.chk | _filter_scratch
+
+echo "CoW and leave leftovers"
+$XFS_IO_PROG -f -c "extsize" $testdir/file2 >> $seqres.full
+$XFS_IO_PROG -f -c "pwrite -S 0x63 $((filesize - 1)) 1" -c "fsync" $testdir/file2 >> $seqres.full
+$XFS_IO_PROG -f -c "pwrite -S 0x63 $((filesize - 1)) 1" -c "fsync" $testdir/file2.chk >> $seqres.full
+sync
+
+echo "Crash and recover"
+$XFS_IO_PROG -x -c "shutdown" $testdir/file2 >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file2 | _filter_scratch
+md5sum $testdir/file2.chk | _filter_scratch
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/212.out b/tests/xfs/212.out
new file mode 100644
index 0000000..97e8425
--- /dev/null
+++ b/tests/xfs/212.out
@@ -0,0 +1,13 @@
+QA output created by 212
+Format and mount
+Create the original files
+Compare files
+7202826a7791073fe2787f0c94603278  SCRATCH_MNT/test-212/file1
+7202826a7791073fe2787f0c94603278  SCRATCH_MNT/test-212/file2
+7202826a7791073fe2787f0c94603278  SCRATCH_MNT/test-212/file2.chk
+CoW and leave leftovers
+Crash and recover
+Compare files
+7202826a7791073fe2787f0c94603278  SCRATCH_MNT/test-212/file1
+83feff041c88d5c746837552399dc27d  SCRATCH_MNT/test-212/file2
+83feff041c88d5c746837552399dc27d  SCRATCH_MNT/test-212/file2.chk
diff --git a/tests/xfs/group b/tests/xfs/group
index 119e1fd..d4a0d59 100644
--- a/tests/xfs/group
+++ b/tests/xfs/group
@@ -209,6 +209,7 @@
 209 auto quick clone
 210 auto quick clone
 211 clone_stress
+212 auto quick clone
 216 log metadata auto quick
 217 log metadata auto
 220 auto quota quick


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

* [PATCH 21/32] reflink: test xfs cow behavior when the filesystem crashes
@ 2016-02-11 23:41   ` Darrick J. Wong
  0 siblings, 0 replies; 81+ messages in thread
From: Darrick J. Wong @ 2016-02-11 23:41 UTC (permalink / raw)
  To: david, darrick.wong; +Cc: fstests, linux-btrfs, xfs

Use the extent size hint to force leftover CoW reservations then
crash the filesystem to see how recovery works.

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


diff --git a/tests/xfs/212 b/tests/xfs/212
new file mode 100755
index 0000000..4e3bcd4
--- /dev/null
+++ b/tests/xfs/212
@@ -0,0 +1,99 @@
+#! /bin/bash
+# FS QA Test No. 212
+#
+# Test recovery of "lost" CoW blocks after a crash:
+# - Create two reflinked files.  Set extsz hint on second file.
+# - Dirty one byte on the second file and fsync.
+# - Crash the FS to test recovery.
+#
+#-----------------------------------------------------------------------
+# 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_reflink
+_require_cp_reflink
+_require_fiemap
+
+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
+
+blksz=65536
+nr=16
+filesize=$((blksz * nr))
+bufnr=2
+bufsize=$((blksz * bufnr))
+
+_require_fs_space $SCRATCH_MNT $((filesize / 1024 * 3 * 5 / 4))
+
+echo "Create the original files"
+$XFS_IO_PROG -f -c "pwrite -S 0x61 -b $bufsize 0 $filesize" $testdir/file1 >> $seqres.full
+$XFS_IO_PROG -f -c "pwrite -S 0x61 -b $bufsize 0 $filesize" $testdir/file2.chk >> $seqres.full
+$XFS_IO_PROG -f -c "extsize $bufsize" $testdir/file2
+_cp_reflink $testdir/file1 $testdir/file2 >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file2 | _filter_scratch
+md5sum $testdir/file2.chk | _filter_scratch
+
+echo "CoW and leave leftovers"
+$XFS_IO_PROG -f -c "extsize" $testdir/file2 >> $seqres.full
+$XFS_IO_PROG -f -c "pwrite -S 0x63 $((filesize - 1)) 1" -c "fsync" $testdir/file2 >> $seqres.full
+$XFS_IO_PROG -f -c "pwrite -S 0x63 $((filesize - 1)) 1" -c "fsync" $testdir/file2.chk >> $seqres.full
+sync
+
+echo "Crash and recover"
+$XFS_IO_PROG -x -c "shutdown" $testdir/file2 >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file2 | _filter_scratch
+md5sum $testdir/file2.chk | _filter_scratch
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/212.out b/tests/xfs/212.out
new file mode 100644
index 0000000..97e8425
--- /dev/null
+++ b/tests/xfs/212.out
@@ -0,0 +1,13 @@
+QA output created by 212
+Format and mount
+Create the original files
+Compare files
+7202826a7791073fe2787f0c94603278  SCRATCH_MNT/test-212/file1
+7202826a7791073fe2787f0c94603278  SCRATCH_MNT/test-212/file2
+7202826a7791073fe2787f0c94603278  SCRATCH_MNT/test-212/file2.chk
+CoW and leave leftovers
+Crash and recover
+Compare files
+7202826a7791073fe2787f0c94603278  SCRATCH_MNT/test-212/file1
+83feff041c88d5c746837552399dc27d  SCRATCH_MNT/test-212/file2
+83feff041c88d5c746837552399dc27d  SCRATCH_MNT/test-212/file2.chk
diff --git a/tests/xfs/group b/tests/xfs/group
index 119e1fd..d4a0d59 100644
--- a/tests/xfs/group
+++ b/tests/xfs/group
@@ -209,6 +209,7 @@
 209 auto quick clone
 210 auto quick clone
 211 clone_stress
+212 auto quick clone
 216 log metadata auto quick
 217 log metadata auto
 220 auto quota quick

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

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

* [PATCH 22/32] reflink: test quota accounting
  2016-02-11 23:39 ` Darrick J. Wong
@ 2016-02-11 23:41   ` Darrick J. Wong
  -1 siblings, 0 replies; 81+ messages in thread
From: Darrick J. Wong @ 2016-02-11 23:41 UTC (permalink / raw)
  To: david, darrick.wong; +Cc: linux-btrfs, fstests, xfs

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 common/reflink        |    2 -
 tests/generic/305     |  100 ++++++++++++++++++++++++++++++++++++++++++++++
 tests/generic/305.out |   22 ++++++++++
 tests/generic/326     |  101 +++++++++++++++++++++++++++++++++++++++++++++++
 tests/generic/326.out |   22 ++++++++++
 tests/generic/327     |   87 ++++++++++++++++++++++++++++++++++++++++
 tests/generic/327.out |   12 ++++++
 tests/generic/328     |  105 +++++++++++++++++++++++++++++++++++++++++++++++++
 tests/generic/328.out |   25 ++++++++++++
 tests/generic/group   |    4 ++
 tests/xfs/213         |  105 +++++++++++++++++++++++++++++++++++++++++++++++++
 tests/xfs/213.out     |   22 ++++++++++
 tests/xfs/214         |  106 +++++++++++++++++++++++++++++++++++++++++++++++++
 tests/xfs/214.out     |   22 ++++++++++
 tests/xfs/group       |    2 +
 15 files changed, 736 insertions(+), 1 deletion(-)
 create mode 100755 tests/generic/305
 create mode 100644 tests/generic/305.out
 create mode 100755 tests/generic/326
 create mode 100644 tests/generic/326.out
 create mode 100755 tests/generic/327
 create mode 100644 tests/generic/327.out
 create mode 100755 tests/generic/328
 create mode 100644 tests/generic/328.out
 create mode 100755 tests/xfs/213
 create mode 100644 tests/xfs/213.out
 create mode 100755 tests/xfs/214
 create mode 100644 tests/xfs/214.out


diff --git a/common/reflink b/common/reflink
index 5d92a88..4ec390d 100644
--- a/common/reflink
+++ b/common/reflink
@@ -153,7 +153,7 @@ _cp_reflink() {
 	file1="$1"
 	file2="$2"
 
-	cp --reflink=always "$file1" "$file2"
+	cp --reflink=always -p "$file1" "$file2"
 }
 
 # Reflink some file1 into file2
diff --git a/tests/generic/305 b/tests/generic/305
new file mode 100755
index 0000000..9356a86
--- /dev/null
+++ b/tests/generic/305
@@ -0,0 +1,100 @@
+#! /bin/bash
+# FS QA Test No. 305
+#
+# Ensure that quota charges us for reflinking a file and that we're not
+# charged for buffered copy on write.
+#
+#-----------------------------------------------------------------------
+# 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
+. ./common/quota
+
+# real QA test starts here
+_supported_os Linux
+_require_scratch_reflink
+_require_cp_reflink
+_require_fiemap
+_require_quota
+_require_nobody
+
+_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
+mkdir $testdir
+
+sz=1048576
+echo "Create the original files"
+$XFS_IO_PROG -f -c "pwrite -S 0x61 -b $sz 0 $sz" $testdir/file1 >> $seqres.full
+_cp_reflink $testdir/file1 $testdir/file2 >> $seqres.full
+_cp_reflink $testdir/file1 $testdir/file3 >> $seqres.full
+touch $testdir/urk
+chown nobody $testdir/urk
+touch $testdir/erk
+chown fsgqa $testdir/erk
+_repquota
+_scratch_remount
+
+echo "Change file ownership"
+chown fsgqa $testdir/file1
+chown fsgqa $testdir/file2
+chown fsgqa $testdir/file3
+_repquota
+
+echo "CoW one of the files"
+$XFS_IO_PROG -f -c "pwrite -S 0x63 -b $((sz/2)) 0 $((sz/2))" -c "fsync" $testdir/file2 >> $seqres.full
+_repquota
+
+echo "Remount the FS to see if accounting changes"
+_scratch_remount
+_repquota
+
+echo "Chown one of the files"
+chown nobody $testdir/file3
+_repquota
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/305.out b/tests/generic/305.out
new file mode 100644
index 0000000..0bfd620
--- /dev/null
+++ b/tests/generic/305.out
@@ -0,0 +1,22 @@
+QA output created by 305
+Format and mount
+Create the original files
+root      --    3072       0       0              7     0     0       
+nobody    --       0       0       0              1     0     0       
+fsgqa     --       0       0       0              1     0     0       
+Change file ownership
+root      --       0       0       0              4     0     0       
+nobody    --       0       0       0              1     0     0       
+fsgqa     --    3072       0       0              4     0     0       
+CoW one of the files
+root      --       0       0       0              4     0     0       
+nobody    --       0       0       0              1     0     0       
+fsgqa     --    3072       0       0              4     0     0       
+Remount the FS to see if accounting changes
+root      --       0       0       0              4     0     0       
+nobody    --       0       0       0              1     0     0       
+fsgqa     --    3072       0       0              4     0     0       
+Chown one of the files
+root      --       0       0       0              4     0     0       
+nobody    --    1024       0       0              2     0     0       
+fsgqa     --    2048       0       0              3     0     0       
diff --git a/tests/generic/326 b/tests/generic/326
new file mode 100755
index 0000000..b6c748c
--- /dev/null
+++ b/tests/generic/326
@@ -0,0 +1,101 @@
+#! /bin/bash
+# FS QA Test No. 326
+#
+# Ensure that quota charges us for reflinking a file and that we're not
+# charged for directio copy on write.
+#
+#-----------------------------------------------------------------------
+# 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
+. ./common/quota
+
+# real QA test starts here
+_supported_os Linux
+_require_scratch_reflink
+_require_cp_reflink
+_require_fiemap
+_require_quota
+_require_nobody
+_require_odirect
+
+_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
+mkdir $testdir
+
+sz=1048576
+echo "Create the original files"
+$XFS_IO_PROG -f -c "pwrite -S 0x61 -b $sz 0 $sz" $testdir/file1 >> $seqres.full
+_cp_reflink $testdir/file1 $testdir/file2 >> $seqres.full
+_cp_reflink $testdir/file1 $testdir/file3 >> $seqres.full
+touch $testdir/urk
+chown nobody $testdir/urk
+touch $testdir/erk
+chown fsgqa $testdir/erk
+_repquota
+_scratch_remount
+
+echo "Change file ownership"
+chown fsgqa $testdir/file1
+chown fsgqa $testdir/file2
+chown fsgqa $testdir/file3
+_repquota
+
+echo "CoW one of the files"
+$XFS_IO_PROG -d -f -c "pwrite -S 0x63 -b $((sz/2)) 0 $((sz/2))" -c "fsync" $testdir/file2 >> $seqres.full
+_repquota
+
+echo "Remount the FS to see if accounting changes"
+_scratch_remount
+_repquota
+
+echo "Chown one of the files"
+chown nobody $testdir/file3
+_repquota
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/326.out b/tests/generic/326.out
new file mode 100644
index 0000000..e771eb7
--- /dev/null
+++ b/tests/generic/326.out
@@ -0,0 +1,22 @@
+QA output created by 326
+Format and mount
+Create the original files
+root      --    3072       0       0              7     0     0       
+nobody    --       0       0       0              1     0     0       
+fsgqa     --       0       0       0              1     0     0       
+Change file ownership
+root      --       0       0       0              4     0     0       
+nobody    --       0       0       0              1     0     0       
+fsgqa     --    3072       0       0              4     0     0       
+CoW one of the files
+root      --       0       0       0              4     0     0       
+nobody    --       0       0       0              1     0     0       
+fsgqa     --    3072       0       0              4     0     0       
+Remount the FS to see if accounting changes
+root      --       0       0       0              4     0     0       
+nobody    --       0       0       0              1     0     0       
+fsgqa     --    3072       0       0              4     0     0       
+Chown one of the files
+root      --       0       0       0              4     0     0       
+nobody    --    1024       0       0              2     0     0       
+fsgqa     --    2048       0       0              3     0     0       
diff --git a/tests/generic/327 b/tests/generic/327
new file mode 100755
index 0000000..90d2aca
--- /dev/null
+++ b/tests/generic/327
@@ -0,0 +1,87 @@
+#! /bin/bash
+# FS QA Test No. 327
+#
+# Ensure that we can't go over the hard block limit when reflinking.
+#
+#-----------------------------------------------------------------------
+# 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
+. ./common/quota
+
+# real QA test starts here
+_supported_os Linux
+_require_scratch_reflink
+_require_cp_reflink
+_require_fiemap
+_require_quota
+_require_nobody
+
+_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
+mkdir $testdir
+
+sz=1048576
+echo "Create the original files"
+$XFS_IO_PROG -f -c "pwrite -S 0x61 -b $sz 0 $sz" $testdir/file1 >> $seqres.full
+chown fsgqa $testdir/file1
+_cp_reflink $testdir/file1 $testdir/file2 >> $seqres.full
+_repquota
+_scratch_remount
+
+echo "Set hard quota to prevent third reflink"
+setquota -u fsgqa 0 1024 0 0 $SCRATCH_MNT
+_repquota
+
+echo "Try to reflink again"
+touch $testdir/file3
+chown fsgqa $testdir/file3
+_cp_reflink $testdir/file1 $testdir/file3 2>&1 | _filter_scratch
+_repquota
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/327.out b/tests/generic/327.out
new file mode 100644
index 0000000..7160ff2
--- /dev/null
+++ b/tests/generic/327.out
@@ -0,0 +1,12 @@
+QA output created by 327
+Format and mount
+Create the original files
+root      --       0       0       0              4     0     0       
+fsgqa     --    2048       0       0              2     0     0       
+Set hard quota to prevent third reflink
+root      --       0       0       0              4     0     0       
+fsgqa     +-    2048       0    1024              2     0     0       
+Try to reflink again
+cp: failed to clone 'SCRATCH_MNT/test-327/file3' from 'SCRATCH_MNT/test-327/file1': Disk quota exceeded
+root      --       0       0       0              4     0     0       
+fsgqa     +-    2048       0    1024              3     0     0       
diff --git a/tests/generic/328 b/tests/generic/328
new file mode 100755
index 0000000..46cfa66
--- /dev/null
+++ b/tests/generic/328
@@ -0,0 +1,105 @@
+#! /bin/bash
+# FS QA Test No. 328
+#
+# Ensure that we can't go over the hard block limit when CoWing a file.
+#
+#-----------------------------------------------------------------------
+# 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
+. ./common/quota
+
+# real QA test starts here
+_supported_os Linux
+_require_scratch_reflink
+_require_cp_reflink
+_require_fiemap
+_require_quota
+_require_nobody
+_require_odirect
+
+_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
+mkdir $testdir
+
+sz=1048576
+echo "Create the original files"
+$XFS_IO_PROG -f -c "pwrite -S 0x61 -b $sz 0 $sz" $testdir/file1 >> $seqres.full
+chown fsgqa $testdir/file1
+_cp_reflink $testdir/file1 $testdir/file2 >> $seqres.full
+_cp_reflink $testdir/file1 $testdir/file3 >> $seqres.full
+_repquota
+_scratch_remount
+
+echo "Set hard quota to prevent rewrite"
+setquota -u fsgqa 0 1024 0 0 $SCRATCH_MNT
+_repquota
+
+echo "Try to dio write the whole file"
+_pwrite_byte 0x62 0 $sz $testdir/file1 -d >> $seqres.full
+_repquota
+
+echo "Try to write the whole file"
+_pwrite_byte 0x62 0 $sz $testdir/file1 >> $seqres.full
+_repquota
+
+echo "Set hard quota to allow rewrite"
+setquota -u fsgqa 0 8192 0 0 $SCRATCH_MNT
+_repquota
+
+echo "Try to dio write the whole file"
+_pwrite_byte 0x62 0 $sz $testdir/file1 -d >> $seqres.full
+sync
+_repquota
+
+echo "Try to write the whole file"
+_pwrite_byte 0x62 0 $sz $testdir/file3 >> $seqres.full
+sync
+_repquota
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/328.out b/tests/generic/328.out
new file mode 100644
index 0000000..5e99255
--- /dev/null
+++ b/tests/generic/328.out
@@ -0,0 +1,25 @@
+QA output created by 328
+Format and mount
+Create the original files
+root      --       0       0       0              4     0     0       
+fsgqa     --    3072       0       0              3     0     0       
+Set hard quota to prevent rewrite
+root      --       0       0       0              4     0     0       
+fsgqa     +-    3072       0    1024              3     0     0       
+Try to dio write the whole file
+pwrite64: Disk quota exceeded
+root      --       0       0       0              4     0     0       
+fsgqa     +-    3072       0    1024              3     0     0       
+Try to write the whole file
+pwrite64: Disk quota exceeded
+root      --       0       0       0              4     0     0       
+fsgqa     +-    3072       0    1024              3     0     0       
+Set hard quota to allow rewrite
+root      --       0       0       0              4     0     0       
+fsgqa     --    3072       0    8192              3     0     0       
+Try to dio write the whole file
+root      --       0       0       0              4     0     0       
+fsgqa     --    3072       0    8192              3     0     0       
+Try to write the whole file
+root      --       0       0       0              4     0     0       
+fsgqa     --    3072       0    8192              3     0     0       
diff --git a/tests/generic/group b/tests/generic/group
index 4a1cce4..8b9e0e5 100644
--- a/tests/generic/group
+++ b/tests/generic/group
@@ -307,6 +307,7 @@
 302 auto quick clone
 303 auto quick clone
 304 auto quick clone
+305 auto quick clone
 306 auto quick rw
 307 auto quick
 308 auto quick
@@ -327,3 +328,6 @@
 323 auto aio stress
 324 auto fsr quick
 325 auto quick data log
+326 auto quick clone
+327 auto quick clone
+328 auto quick clone
diff --git a/tests/xfs/213 b/tests/xfs/213
new file mode 100755
index 0000000..2450097
--- /dev/null
+++ b/tests/xfs/213
@@ -0,0 +1,105 @@
+#! /bin/bash
+# FS QA Test No. 213
+#
+# Ensure that quota charges us for reflnking a file and that we're not
+# charged for buffered copy on write.  Same test as g/305, but we get to
+# play with cowextsz.
+#
+#-----------------------------------------------------------------------
+# 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
+. ./common/quota
+
+# real QA test starts here
+_supported_os Linux
+_supported_fs xfs
+_require_scratch_reflink
+_require_cp_reflink
+_require_fiemap
+_require_quota
+_require_nobody
+_require_xfs_io_command "cowextsize"
+
+_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
+mkdir $testdir
+
+sz=1048576
+blksz=65536
+echo "Create the original files"
+$XFS_IO_PROG -c "cowextsize $((sz/2))" $testdir >> $seqres.full
+$XFS_IO_PROG -f -c "pwrite -S 0x61 -b $sz 0 $sz" $testdir/file1 >> $seqres.full
+_cp_reflink $testdir/file1 $testdir/file2 >> $seqres.full
+_cp_reflink $testdir/file1 $testdir/file3 >> $seqres.full
+touch $testdir/urk
+chown nobody $testdir/urk
+touch $testdir/erk
+chown fsgqa $testdir/erk
+_repquota
+_scratch_remount
+
+echo "Change file ownership"
+chown fsgqa $testdir/file1
+chown fsgqa $testdir/file2
+chown fsgqa $testdir/file3
+_repquota
+
+echo "CoW one of the files"
+$XFS_IO_PROG -f -c "pwrite -S 0x63 -b $blksz $((sz - blksz)) $blksz" -c "fsync" $testdir/file2 >> $seqres.full
+_repquota
+
+echo "Remount the FS to see if accounting changes"
+_scratch_remount
+_repquota
+
+echo "Chown one of the files"
+chown nobody $testdir/file3
+_repquota
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/213.out b/tests/xfs/213.out
new file mode 100644
index 0000000..be8d56c
--- /dev/null
+++ b/tests/xfs/213.out
@@ -0,0 +1,22 @@
+QA output created by 213
+Format and mount
+Create the original files
+root      --    3072       0       0              7     0     0       
+nobody    --       0       0       0              1     0     0       
+fsgqa     --       0       0       0              1     0     0       
+Change file ownership
+root      --       0       0       0              4     0     0       
+nobody    --       0       0       0              1     0     0       
+fsgqa     --    3072       0       0              4     0     0       
+CoW one of the files
+root      --       0       0       0              4     0     0       
+nobody    --       0       0       0              1     0     0       
+fsgqa     --    3520       0       0              4     0     0       
+Remount the FS to see if accounting changes
+root      --       0       0       0              4     0     0       
+nobody    --       0       0       0              1     0     0       
+fsgqa     --    3072       0       0              4     0     0       
+Chown one of the files
+root      --       0       0       0              4     0     0       
+nobody    --    1024       0       0              2     0     0       
+fsgqa     --    2048       0       0              3     0     0       
diff --git a/tests/xfs/214 b/tests/xfs/214
new file mode 100755
index 0000000..847f489
--- /dev/null
+++ b/tests/xfs/214
@@ -0,0 +1,106 @@
+#! /bin/bash
+# FS QA Test No. 214
+#
+# Ensure that quota charges us for reflnking a file and that we're not
+# charged for directio copy on write.  Same as g/326, but we get to play
+# with cowextsz.
+#
+#-----------------------------------------------------------------------
+# 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
+. ./common/quota
+
+# real QA test starts here
+_supported_os Linux
+_supported_fs xfs
+_require_scratch_reflink
+_require_cp_reflink
+_require_fiemap
+_require_quota
+_require_nobody
+_require_xfs_io_command "cowextsize"
+_require_odirect
+
+_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
+mkdir $testdir
+
+sz=1048576
+blksz=65536
+echo "Create the original files"
+$XFS_IO_PROG -c "cowextsize $((sz/2))" $testdir >> $seqres.full
+$XFS_IO_PROG -f -c "pwrite -S 0x61 -b $sz 0 $sz" $testdir/file1 >> $seqres.full
+_cp_reflink $testdir/file1 $testdir/file2 >> $seqres.full
+_cp_reflink $testdir/file1 $testdir/file3 >> $seqres.full
+touch $testdir/urk
+chown nobody $testdir/urk
+touch $testdir/erk
+chown fsgqa $testdir/erk
+_repquota
+_scratch_remount
+
+echo "Change file ownership"
+chown fsgqa $testdir/file1
+chown fsgqa $testdir/file2
+chown fsgqa $testdir/file3
+_repquota
+
+echo "CoW one of the files"
+$XFS_IO_PROG -d -f -c "pwrite -S 0x63 -b $blksz $((sz - blksz)) $blksz" -c "fsync" $testdir/file2 >> $seqres.full
+_repquota
+
+echo "Remount the FS to see if accounting changes"
+_scratch_remount
+_repquota
+
+echo "Chown one of the files"
+chown nobody $testdir/file3
+_repquota
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/214.out b/tests/xfs/214.out
new file mode 100644
index 0000000..496a503
--- /dev/null
+++ b/tests/xfs/214.out
@@ -0,0 +1,22 @@
+QA output created by 214
+Format and mount
+Create the original files
+root      --    3072       0       0              7     0     0       
+nobody    --       0       0       0              1     0     0       
+fsgqa     --       0       0       0              1     0     0       
+Change file ownership
+root      --       0       0       0              4     0     0       
+nobody    --       0       0       0              1     0     0       
+fsgqa     --    3072       0       0              4     0     0       
+CoW one of the files
+root      --       0       0       0              4     0     0       
+nobody    --       0       0       0              1     0     0       
+fsgqa     --    3520       0       0              4     0     0       
+Remount the FS to see if accounting changes
+root      --       0       0       0              4     0     0       
+nobody    --       0       0       0              1     0     0       
+fsgqa     --    3072       0       0              4     0     0       
+Chown one of the files
+root      --       0       0       0              4     0     0       
+nobody    --    1024       0       0              2     0     0       
+fsgqa     --    2048       0       0              3     0     0       
diff --git a/tests/xfs/group b/tests/xfs/group
index d4a0d59..afd960f 100644
--- a/tests/xfs/group
+++ b/tests/xfs/group
@@ -210,6 +210,8 @@
 210 auto quick clone
 211 clone_stress
 212 auto quick clone
+213 auto quick clone
+214 auto quick clone
 216 log metadata auto quick
 217 log metadata auto
 220 auto quota quick


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

* [PATCH 22/32] reflink: test quota accounting
@ 2016-02-11 23:41   ` Darrick J. Wong
  0 siblings, 0 replies; 81+ messages in thread
From: Darrick J. Wong @ 2016-02-11 23:41 UTC (permalink / raw)
  To: david, darrick.wong; +Cc: fstests, linux-btrfs, xfs

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 common/reflink        |    2 -
 tests/generic/305     |  100 ++++++++++++++++++++++++++++++++++++++++++++++
 tests/generic/305.out |   22 ++++++++++
 tests/generic/326     |  101 +++++++++++++++++++++++++++++++++++++++++++++++
 tests/generic/326.out |   22 ++++++++++
 tests/generic/327     |   87 ++++++++++++++++++++++++++++++++++++++++
 tests/generic/327.out |   12 ++++++
 tests/generic/328     |  105 +++++++++++++++++++++++++++++++++++++++++++++++++
 tests/generic/328.out |   25 ++++++++++++
 tests/generic/group   |    4 ++
 tests/xfs/213         |  105 +++++++++++++++++++++++++++++++++++++++++++++++++
 tests/xfs/213.out     |   22 ++++++++++
 tests/xfs/214         |  106 +++++++++++++++++++++++++++++++++++++++++++++++++
 tests/xfs/214.out     |   22 ++++++++++
 tests/xfs/group       |    2 +
 15 files changed, 736 insertions(+), 1 deletion(-)
 create mode 100755 tests/generic/305
 create mode 100644 tests/generic/305.out
 create mode 100755 tests/generic/326
 create mode 100644 tests/generic/326.out
 create mode 100755 tests/generic/327
 create mode 100644 tests/generic/327.out
 create mode 100755 tests/generic/328
 create mode 100644 tests/generic/328.out
 create mode 100755 tests/xfs/213
 create mode 100644 tests/xfs/213.out
 create mode 100755 tests/xfs/214
 create mode 100644 tests/xfs/214.out


diff --git a/common/reflink b/common/reflink
index 5d92a88..4ec390d 100644
--- a/common/reflink
+++ b/common/reflink
@@ -153,7 +153,7 @@ _cp_reflink() {
 	file1="$1"
 	file2="$2"
 
-	cp --reflink=always "$file1" "$file2"
+	cp --reflink=always -p "$file1" "$file2"
 }
 
 # Reflink some file1 into file2
diff --git a/tests/generic/305 b/tests/generic/305
new file mode 100755
index 0000000..9356a86
--- /dev/null
+++ b/tests/generic/305
@@ -0,0 +1,100 @@
+#! /bin/bash
+# FS QA Test No. 305
+#
+# Ensure that quota charges us for reflinking a file and that we're not
+# charged for buffered copy on write.
+#
+#-----------------------------------------------------------------------
+# 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
+. ./common/quota
+
+# real QA test starts here
+_supported_os Linux
+_require_scratch_reflink
+_require_cp_reflink
+_require_fiemap
+_require_quota
+_require_nobody
+
+_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
+mkdir $testdir
+
+sz=1048576
+echo "Create the original files"
+$XFS_IO_PROG -f -c "pwrite -S 0x61 -b $sz 0 $sz" $testdir/file1 >> $seqres.full
+_cp_reflink $testdir/file1 $testdir/file2 >> $seqres.full
+_cp_reflink $testdir/file1 $testdir/file3 >> $seqres.full
+touch $testdir/urk
+chown nobody $testdir/urk
+touch $testdir/erk
+chown fsgqa $testdir/erk
+_repquota
+_scratch_remount
+
+echo "Change file ownership"
+chown fsgqa $testdir/file1
+chown fsgqa $testdir/file2
+chown fsgqa $testdir/file3
+_repquota
+
+echo "CoW one of the files"
+$XFS_IO_PROG -f -c "pwrite -S 0x63 -b $((sz/2)) 0 $((sz/2))" -c "fsync" $testdir/file2 >> $seqres.full
+_repquota
+
+echo "Remount the FS to see if accounting changes"
+_scratch_remount
+_repquota
+
+echo "Chown one of the files"
+chown nobody $testdir/file3
+_repquota
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/305.out b/tests/generic/305.out
new file mode 100644
index 0000000..0bfd620
--- /dev/null
+++ b/tests/generic/305.out
@@ -0,0 +1,22 @@
+QA output created by 305
+Format and mount
+Create the original files
+root      --    3072       0       0              7     0     0       
+nobody    --       0       0       0              1     0     0       
+fsgqa     --       0       0       0              1     0     0       
+Change file ownership
+root      --       0       0       0              4     0     0       
+nobody    --       0       0       0              1     0     0       
+fsgqa     --    3072       0       0              4     0     0       
+CoW one of the files
+root      --       0       0       0              4     0     0       
+nobody    --       0       0       0              1     0     0       
+fsgqa     --    3072       0       0              4     0     0       
+Remount the FS to see if accounting changes
+root      --       0       0       0              4     0     0       
+nobody    --       0       0       0              1     0     0       
+fsgqa     --    3072       0       0              4     0     0       
+Chown one of the files
+root      --       0       0       0              4     0     0       
+nobody    --    1024       0       0              2     0     0       
+fsgqa     --    2048       0       0              3     0     0       
diff --git a/tests/generic/326 b/tests/generic/326
new file mode 100755
index 0000000..b6c748c
--- /dev/null
+++ b/tests/generic/326
@@ -0,0 +1,101 @@
+#! /bin/bash
+# FS QA Test No. 326
+#
+# Ensure that quota charges us for reflinking a file and that we're not
+# charged for directio copy on write.
+#
+#-----------------------------------------------------------------------
+# 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
+. ./common/quota
+
+# real QA test starts here
+_supported_os Linux
+_require_scratch_reflink
+_require_cp_reflink
+_require_fiemap
+_require_quota
+_require_nobody
+_require_odirect
+
+_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
+mkdir $testdir
+
+sz=1048576
+echo "Create the original files"
+$XFS_IO_PROG -f -c "pwrite -S 0x61 -b $sz 0 $sz" $testdir/file1 >> $seqres.full
+_cp_reflink $testdir/file1 $testdir/file2 >> $seqres.full
+_cp_reflink $testdir/file1 $testdir/file3 >> $seqres.full
+touch $testdir/urk
+chown nobody $testdir/urk
+touch $testdir/erk
+chown fsgqa $testdir/erk
+_repquota
+_scratch_remount
+
+echo "Change file ownership"
+chown fsgqa $testdir/file1
+chown fsgqa $testdir/file2
+chown fsgqa $testdir/file3
+_repquota
+
+echo "CoW one of the files"
+$XFS_IO_PROG -d -f -c "pwrite -S 0x63 -b $((sz/2)) 0 $((sz/2))" -c "fsync" $testdir/file2 >> $seqres.full
+_repquota
+
+echo "Remount the FS to see if accounting changes"
+_scratch_remount
+_repquota
+
+echo "Chown one of the files"
+chown nobody $testdir/file3
+_repquota
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/326.out b/tests/generic/326.out
new file mode 100644
index 0000000..e771eb7
--- /dev/null
+++ b/tests/generic/326.out
@@ -0,0 +1,22 @@
+QA output created by 326
+Format and mount
+Create the original files
+root      --    3072       0       0              7     0     0       
+nobody    --       0       0       0              1     0     0       
+fsgqa     --       0       0       0              1     0     0       
+Change file ownership
+root      --       0       0       0              4     0     0       
+nobody    --       0       0       0              1     0     0       
+fsgqa     --    3072       0       0              4     0     0       
+CoW one of the files
+root      --       0       0       0              4     0     0       
+nobody    --       0       0       0              1     0     0       
+fsgqa     --    3072       0       0              4     0     0       
+Remount the FS to see if accounting changes
+root      --       0       0       0              4     0     0       
+nobody    --       0       0       0              1     0     0       
+fsgqa     --    3072       0       0              4     0     0       
+Chown one of the files
+root      --       0       0       0              4     0     0       
+nobody    --    1024       0       0              2     0     0       
+fsgqa     --    2048       0       0              3     0     0       
diff --git a/tests/generic/327 b/tests/generic/327
new file mode 100755
index 0000000..90d2aca
--- /dev/null
+++ b/tests/generic/327
@@ -0,0 +1,87 @@
+#! /bin/bash
+# FS QA Test No. 327
+#
+# Ensure that we can't go over the hard block limit when reflinking.
+#
+#-----------------------------------------------------------------------
+# 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
+. ./common/quota
+
+# real QA test starts here
+_supported_os Linux
+_require_scratch_reflink
+_require_cp_reflink
+_require_fiemap
+_require_quota
+_require_nobody
+
+_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
+mkdir $testdir
+
+sz=1048576
+echo "Create the original files"
+$XFS_IO_PROG -f -c "pwrite -S 0x61 -b $sz 0 $sz" $testdir/file1 >> $seqres.full
+chown fsgqa $testdir/file1
+_cp_reflink $testdir/file1 $testdir/file2 >> $seqres.full
+_repquota
+_scratch_remount
+
+echo "Set hard quota to prevent third reflink"
+setquota -u fsgqa 0 1024 0 0 $SCRATCH_MNT
+_repquota
+
+echo "Try to reflink again"
+touch $testdir/file3
+chown fsgqa $testdir/file3
+_cp_reflink $testdir/file1 $testdir/file3 2>&1 | _filter_scratch
+_repquota
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/327.out b/tests/generic/327.out
new file mode 100644
index 0000000..7160ff2
--- /dev/null
+++ b/tests/generic/327.out
@@ -0,0 +1,12 @@
+QA output created by 327
+Format and mount
+Create the original files
+root      --       0       0       0              4     0     0       
+fsgqa     --    2048       0       0              2     0     0       
+Set hard quota to prevent third reflink
+root      --       0       0       0              4     0     0       
+fsgqa     +-    2048       0    1024              2     0     0       
+Try to reflink again
+cp: failed to clone 'SCRATCH_MNT/test-327/file3' from 'SCRATCH_MNT/test-327/file1': Disk quota exceeded
+root      --       0       0       0              4     0     0       
+fsgqa     +-    2048       0    1024              3     0     0       
diff --git a/tests/generic/328 b/tests/generic/328
new file mode 100755
index 0000000..46cfa66
--- /dev/null
+++ b/tests/generic/328
@@ -0,0 +1,105 @@
+#! /bin/bash
+# FS QA Test No. 328
+#
+# Ensure that we can't go over the hard block limit when CoWing a file.
+#
+#-----------------------------------------------------------------------
+# 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
+. ./common/quota
+
+# real QA test starts here
+_supported_os Linux
+_require_scratch_reflink
+_require_cp_reflink
+_require_fiemap
+_require_quota
+_require_nobody
+_require_odirect
+
+_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
+mkdir $testdir
+
+sz=1048576
+echo "Create the original files"
+$XFS_IO_PROG -f -c "pwrite -S 0x61 -b $sz 0 $sz" $testdir/file1 >> $seqres.full
+chown fsgqa $testdir/file1
+_cp_reflink $testdir/file1 $testdir/file2 >> $seqres.full
+_cp_reflink $testdir/file1 $testdir/file3 >> $seqres.full
+_repquota
+_scratch_remount
+
+echo "Set hard quota to prevent rewrite"
+setquota -u fsgqa 0 1024 0 0 $SCRATCH_MNT
+_repquota
+
+echo "Try to dio write the whole file"
+_pwrite_byte 0x62 0 $sz $testdir/file1 -d >> $seqres.full
+_repquota
+
+echo "Try to write the whole file"
+_pwrite_byte 0x62 0 $sz $testdir/file1 >> $seqres.full
+_repquota
+
+echo "Set hard quota to allow rewrite"
+setquota -u fsgqa 0 8192 0 0 $SCRATCH_MNT
+_repquota
+
+echo "Try to dio write the whole file"
+_pwrite_byte 0x62 0 $sz $testdir/file1 -d >> $seqres.full
+sync
+_repquota
+
+echo "Try to write the whole file"
+_pwrite_byte 0x62 0 $sz $testdir/file3 >> $seqres.full
+sync
+_repquota
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/328.out b/tests/generic/328.out
new file mode 100644
index 0000000..5e99255
--- /dev/null
+++ b/tests/generic/328.out
@@ -0,0 +1,25 @@
+QA output created by 328
+Format and mount
+Create the original files
+root      --       0       0       0              4     0     0       
+fsgqa     --    3072       0       0              3     0     0       
+Set hard quota to prevent rewrite
+root      --       0       0       0              4     0     0       
+fsgqa     +-    3072       0    1024              3     0     0       
+Try to dio write the whole file
+pwrite64: Disk quota exceeded
+root      --       0       0       0              4     0     0       
+fsgqa     +-    3072       0    1024              3     0     0       
+Try to write the whole file
+pwrite64: Disk quota exceeded
+root      --       0       0       0              4     0     0       
+fsgqa     +-    3072       0    1024              3     0     0       
+Set hard quota to allow rewrite
+root      --       0       0       0              4     0     0       
+fsgqa     --    3072       0    8192              3     0     0       
+Try to dio write the whole file
+root      --       0       0       0              4     0     0       
+fsgqa     --    3072       0    8192              3     0     0       
+Try to write the whole file
+root      --       0       0       0              4     0     0       
+fsgqa     --    3072       0    8192              3     0     0       
diff --git a/tests/generic/group b/tests/generic/group
index 4a1cce4..8b9e0e5 100644
--- a/tests/generic/group
+++ b/tests/generic/group
@@ -307,6 +307,7 @@
 302 auto quick clone
 303 auto quick clone
 304 auto quick clone
+305 auto quick clone
 306 auto quick rw
 307 auto quick
 308 auto quick
@@ -327,3 +328,6 @@
 323 auto aio stress
 324 auto fsr quick
 325 auto quick data log
+326 auto quick clone
+327 auto quick clone
+328 auto quick clone
diff --git a/tests/xfs/213 b/tests/xfs/213
new file mode 100755
index 0000000..2450097
--- /dev/null
+++ b/tests/xfs/213
@@ -0,0 +1,105 @@
+#! /bin/bash
+# FS QA Test No. 213
+#
+# Ensure that quota charges us for reflnking a file and that we're not
+# charged for buffered copy on write.  Same test as g/305, but we get to
+# play with cowextsz.
+#
+#-----------------------------------------------------------------------
+# 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
+. ./common/quota
+
+# real QA test starts here
+_supported_os Linux
+_supported_fs xfs
+_require_scratch_reflink
+_require_cp_reflink
+_require_fiemap
+_require_quota
+_require_nobody
+_require_xfs_io_command "cowextsize"
+
+_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
+mkdir $testdir
+
+sz=1048576
+blksz=65536
+echo "Create the original files"
+$XFS_IO_PROG -c "cowextsize $((sz/2))" $testdir >> $seqres.full
+$XFS_IO_PROG -f -c "pwrite -S 0x61 -b $sz 0 $sz" $testdir/file1 >> $seqres.full
+_cp_reflink $testdir/file1 $testdir/file2 >> $seqres.full
+_cp_reflink $testdir/file1 $testdir/file3 >> $seqres.full
+touch $testdir/urk
+chown nobody $testdir/urk
+touch $testdir/erk
+chown fsgqa $testdir/erk
+_repquota
+_scratch_remount
+
+echo "Change file ownership"
+chown fsgqa $testdir/file1
+chown fsgqa $testdir/file2
+chown fsgqa $testdir/file3
+_repquota
+
+echo "CoW one of the files"
+$XFS_IO_PROG -f -c "pwrite -S 0x63 -b $blksz $((sz - blksz)) $blksz" -c "fsync" $testdir/file2 >> $seqres.full
+_repquota
+
+echo "Remount the FS to see if accounting changes"
+_scratch_remount
+_repquota
+
+echo "Chown one of the files"
+chown nobody $testdir/file3
+_repquota
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/213.out b/tests/xfs/213.out
new file mode 100644
index 0000000..be8d56c
--- /dev/null
+++ b/tests/xfs/213.out
@@ -0,0 +1,22 @@
+QA output created by 213
+Format and mount
+Create the original files
+root      --    3072       0       0              7     0     0       
+nobody    --       0       0       0              1     0     0       
+fsgqa     --       0       0       0              1     0     0       
+Change file ownership
+root      --       0       0       0              4     0     0       
+nobody    --       0       0       0              1     0     0       
+fsgqa     --    3072       0       0              4     0     0       
+CoW one of the files
+root      --       0       0       0              4     0     0       
+nobody    --       0       0       0              1     0     0       
+fsgqa     --    3520       0       0              4     0     0       
+Remount the FS to see if accounting changes
+root      --       0       0       0              4     0     0       
+nobody    --       0       0       0              1     0     0       
+fsgqa     --    3072       0       0              4     0     0       
+Chown one of the files
+root      --       0       0       0              4     0     0       
+nobody    --    1024       0       0              2     0     0       
+fsgqa     --    2048       0       0              3     0     0       
diff --git a/tests/xfs/214 b/tests/xfs/214
new file mode 100755
index 0000000..847f489
--- /dev/null
+++ b/tests/xfs/214
@@ -0,0 +1,106 @@
+#! /bin/bash
+# FS QA Test No. 214
+#
+# Ensure that quota charges us for reflnking a file and that we're not
+# charged for directio copy on write.  Same as g/326, but we get to play
+# with cowextsz.
+#
+#-----------------------------------------------------------------------
+# 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
+. ./common/quota
+
+# real QA test starts here
+_supported_os Linux
+_supported_fs xfs
+_require_scratch_reflink
+_require_cp_reflink
+_require_fiemap
+_require_quota
+_require_nobody
+_require_xfs_io_command "cowextsize"
+_require_odirect
+
+_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
+mkdir $testdir
+
+sz=1048576
+blksz=65536
+echo "Create the original files"
+$XFS_IO_PROG -c "cowextsize $((sz/2))" $testdir >> $seqres.full
+$XFS_IO_PROG -f -c "pwrite -S 0x61 -b $sz 0 $sz" $testdir/file1 >> $seqres.full
+_cp_reflink $testdir/file1 $testdir/file2 >> $seqres.full
+_cp_reflink $testdir/file1 $testdir/file3 >> $seqres.full
+touch $testdir/urk
+chown nobody $testdir/urk
+touch $testdir/erk
+chown fsgqa $testdir/erk
+_repquota
+_scratch_remount
+
+echo "Change file ownership"
+chown fsgqa $testdir/file1
+chown fsgqa $testdir/file2
+chown fsgqa $testdir/file3
+_repquota
+
+echo "CoW one of the files"
+$XFS_IO_PROG -d -f -c "pwrite -S 0x63 -b $blksz $((sz - blksz)) $blksz" -c "fsync" $testdir/file2 >> $seqres.full
+_repquota
+
+echo "Remount the FS to see if accounting changes"
+_scratch_remount
+_repquota
+
+echo "Chown one of the files"
+chown nobody $testdir/file3
+_repquota
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/214.out b/tests/xfs/214.out
new file mode 100644
index 0000000..496a503
--- /dev/null
+++ b/tests/xfs/214.out
@@ -0,0 +1,22 @@
+QA output created by 214
+Format and mount
+Create the original files
+root      --    3072       0       0              7     0     0       
+nobody    --       0       0       0              1     0     0       
+fsgqa     --       0       0       0              1     0     0       
+Change file ownership
+root      --       0       0       0              4     0     0       
+nobody    --       0       0       0              1     0     0       
+fsgqa     --    3072       0       0              4     0     0       
+CoW one of the files
+root      --       0       0       0              4     0     0       
+nobody    --       0       0       0              1     0     0       
+fsgqa     --    3520       0       0              4     0     0       
+Remount the FS to see if accounting changes
+root      --       0       0       0              4     0     0       
+nobody    --       0       0       0              1     0     0       
+fsgqa     --    3072       0       0              4     0     0       
+Chown one of the files
+root      --       0       0       0              4     0     0       
+nobody    --    1024       0       0              2     0     0       
+fsgqa     --    2048       0       0              3     0     0       
diff --git a/tests/xfs/group b/tests/xfs/group
index d4a0d59..afd960f 100644
--- a/tests/xfs/group
+++ b/tests/xfs/group
@@ -210,6 +210,8 @@
 210 auto quick clone
 211 clone_stress
 212 auto quick clone
+213 auto quick clone
+214 auto quick clone
 216 log metadata auto quick
 217 log metadata auto
 220 auto quota quick

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

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

* [PATCH 23/32] reflink: test CoW across a mixed range of block types with cowextsize set
  2016-02-11 23:39 ` Darrick J. Wong
@ 2016-02-11 23:41   ` Darrick J. Wong
  -1 siblings, 0 replies; 81+ messages in thread
From: Darrick J. Wong @ 2016-02-11 23:41 UTC (permalink / raw)
  To: david, darrick.wong; +Cc: linux-btrfs, fstests, xfs

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 tests/xfs/215     |  102 +++++++++++++++++++++++++++++++++++++++++++++++++
 tests/xfs/215.out |   13 ++++++
 tests/xfs/218     |  101 +++++++++++++++++++++++++++++++++++++++++++++++++
 tests/xfs/218.out |   13 ++++++
 tests/xfs/219     |  102 +++++++++++++++++++++++++++++++++++++++++++++++++
 tests/xfs/219.out |   13 ++++++
 tests/xfs/221     |  101 +++++++++++++++++++++++++++++++++++++++++++++++++
 tests/xfs/221.out |   13 ++++++
 tests/xfs/223     |  104 ++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/xfs/223.out |   13 ++++++
 tests/xfs/224     |  103 ++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/xfs/224.out |   13 ++++++
 tests/xfs/225     |  102 +++++++++++++++++++++++++++++++++++++++++++++++++
 tests/xfs/225.out |   13 ++++++
 tests/xfs/226     |  101 +++++++++++++++++++++++++++++++++++++++++++++++++
 tests/xfs/226.out |   13 ++++++
 tests/xfs/228     |  110 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/xfs/228.out |   13 ++++++
 tests/xfs/230     |  110 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/xfs/230.out |   13 ++++++
 tests/xfs/group   |   10 +++++
 21 files changed, 1176 insertions(+)
 create mode 100755 tests/xfs/215
 create mode 100644 tests/xfs/215.out
 create mode 100755 tests/xfs/218
 create mode 100644 tests/xfs/218.out
 create mode 100755 tests/xfs/219
 create mode 100644 tests/xfs/219.out
 create mode 100755 tests/xfs/221
 create mode 100644 tests/xfs/221.out
 create mode 100755 tests/xfs/223
 create mode 100644 tests/xfs/223.out
 create mode 100755 tests/xfs/224
 create mode 100644 tests/xfs/224.out
 create mode 100755 tests/xfs/225
 create mode 100644 tests/xfs/225.out
 create mode 100755 tests/xfs/226
 create mode 100644 tests/xfs/226.out
 create mode 100755 tests/xfs/228
 create mode 100644 tests/xfs/228.out
 create mode 100755 tests/xfs/230
 create mode 100644 tests/xfs/230.out


diff --git a/tests/xfs/215 b/tests/xfs/215
new file mode 100755
index 0000000..9ed842e
--- /dev/null
+++ b/tests/xfs/215
@@ -0,0 +1,102 @@
+#! /bin/bash
+# FS QA Test No. 215
+#
+# Ensuring that copy on write in direct-io mode works when the CoW
+# range originally covers multiple extents, some unwritten, some not.
+#   - Set cowextsize hint.
+#   - Create a file and fallocate a second file.
+#   - Reflink the odd blocks of the first file into the second file.
+#   - directio CoW across the halfway mark, starting with the unwritten extent.
+#   - Check that the files are now different where we say they're different.
+#
+#-----------------------------------------------------------------------
+# 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
+_require_scratch_reflink
+_require_xfs_io_command "falloc"
+_require_odirect
+
+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
+
+echo "Create the original files"
+blksz=65536
+nr=64
+filesize=$((blksz * nr))
+real_blksz=$(stat -f -c '%S' $testdir)
+internal_blks=$((filesize / real_blksz))
+$XFS_IO_PROG -c "cowextsize $((blksz * 16))" $testdir >> $seqres.full
+_weave_reflink_unwritten $blksz $nr $testdir/file1 $testdir/file3 >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file3 | _filter_scratch
+md5sum $testdir/file3.chk | _filter_scratch
+
+echo "directio CoW across the transition"
+cowoff=$((filesize / 4))
+cowsz=$((filesize / 2))
+$XFS_IO_PROG -d -f -c "pwrite -S 0x63 -b $cowsz $cowoff $cowsz" $testdir/file3 >> $seqres.full
+_pwrite_byte 0x63 $cowoff $cowsz $testdir/file3.chk >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file3 | _filter_scratch
+md5sum $testdir/file3.chk | _filter_scratch
+
+echo "Check extent counts"
+old_extents=$(_count_extents $testdir/file1)
+new_extents=$(_count_extents $testdir/file3)
+
+echo "old extents: $old_extents" >> $seqres.full
+echo "new extents: $new_extents" >> $seqres.full
+echo "maximum extents: $internal_blks" >> $seqres.full
+test $new_extents -lt $((internal_blks / 20)) || echo "file3 badly fragmented"
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/215.out b/tests/xfs/215.out
new file mode 100644
index 0000000..ce3a08b
--- /dev/null
+++ b/tests/xfs/215.out
@@ -0,0 +1,13 @@
+QA output created by 215
+Format and mount
+Create the original files
+Compare files
+bdbcf02ee0aa977795a79d25fcfdccb1  SCRATCH_MNT/test-215/file1
+fa50dba51826899c372464a153cb2117  SCRATCH_MNT/test-215/file3
+fa50dba51826899c372464a153cb2117  SCRATCH_MNT/test-215/file3.chk
+directio CoW across the transition
+Compare files
+bdbcf02ee0aa977795a79d25fcfdccb1  SCRATCH_MNT/test-215/file1
+09101629908f9bdd5d178e7ce20bb1bb  SCRATCH_MNT/test-215/file3
+09101629908f9bdd5d178e7ce20bb1bb  SCRATCH_MNT/test-215/file3.chk
+Check extent counts
diff --git a/tests/xfs/218 b/tests/xfs/218
new file mode 100755
index 0000000..e98b14e
--- /dev/null
+++ b/tests/xfs/218
@@ -0,0 +1,101 @@
+#! /bin/bash
+# FS QA Test No. 218
+#
+# Ensuring that copy on write in buffered mode works when the CoW
+# range originally covers multiple extents, some unwritten, some not.
+#   - Set cowextsize hint.
+#   - Create a file and fallocate a second file.
+#   - Reflink the odd blocks of the first file into the second file.
+#   - CoW across the halfway mark, starting with the unwritten extent.
+#   - Check that the files are now different where we say they're different.
+#
+#-----------------------------------------------------------------------
+# 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
+_require_scratch_reflink
+_require_xfs_io_command "falloc"
+
+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
+
+echo "Create the original files"
+blksz=65536
+nr=64
+filesize=$((blksz * nr))
+real_blksz=$(stat -f -c '%S' $testdir)
+internal_blks=$((filesize / real_blksz))
+$XFS_IO_PROG -c "cowextsize $((blksz * 16))" $testdir >> $seqres.full
+_weave_reflink_unwritten $blksz $nr $testdir/file1 $testdir/file3 >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file3 | _filter_scratch
+md5sum $testdir/file3.chk | _filter_scratch
+
+echo "CoW across the transition"
+cowoff=$((filesize / 4))
+cowsz=$((filesize / 2))
+$XFS_IO_PROG -f -c "pwrite -S 0x63 -b $cowsz $cowoff $cowsz" $testdir/file3 >> $seqres.full
+_pwrite_byte 0x63 $cowoff $cowsz $testdir/file3.chk >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file3 | _filter_scratch
+md5sum $testdir/file3.chk | _filter_scratch
+
+echo "Check extent counts"
+old_extents=$(_count_extents $testdir/file1)
+new_extents=$(_count_extents $testdir/file3)
+
+echo "old extents: $old_extents" >> $seqres.full
+echo "new extents: $new_extents" >> $seqres.full
+echo "maximum extents: $internal_blks" >> $seqres.full
+test $new_extents -lt $((internal_blks / 20)) || echo "file3 badly fragmented"
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/218.out b/tests/xfs/218.out
new file mode 100644
index 0000000..ad1efda
--- /dev/null
+++ b/tests/xfs/218.out
@@ -0,0 +1,13 @@
+QA output created by 218
+Format and mount
+Create the original files
+Compare files
+bdbcf02ee0aa977795a79d25fcfdccb1  SCRATCH_MNT/test-218/file1
+fa50dba51826899c372464a153cb2117  SCRATCH_MNT/test-218/file3
+fa50dba51826899c372464a153cb2117  SCRATCH_MNT/test-218/file3.chk
+CoW across the transition
+Compare files
+bdbcf02ee0aa977795a79d25fcfdccb1  SCRATCH_MNT/test-218/file1
+09101629908f9bdd5d178e7ce20bb1bb  SCRATCH_MNT/test-218/file3
+09101629908f9bdd5d178e7ce20bb1bb  SCRATCH_MNT/test-218/file3.chk
+Check extent counts
diff --git a/tests/xfs/219 b/tests/xfs/219
new file mode 100755
index 0000000..25c0bb4
--- /dev/null
+++ b/tests/xfs/219
@@ -0,0 +1,102 @@
+#! /bin/bash
+# FS QA Test No. 219
+#
+# Ensuring that copy on write in direct-io mode works when the CoW
+# range originally covers multiple extents, some holes, some not.
+#   - Set cowextsize hint.
+#   - Create a file and truncate a second file.
+#   - Reflink the odd blocks of the first file into the second file.
+#   - directio CoW across the halfway mark, starting with the unwritten extent.
+#   - Check that the files are now different where we say they're different.
+#
+#-----------------------------------------------------------------------
+# 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
+_require_scratch_reflink
+_require_xfs_io_command "falloc"
+_require_odirect
+
+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
+
+echo "Create the original files"
+blksz=65536
+nr=64
+filesize=$((blksz * nr))
+real_blksz=$(stat -f -c '%S' $testdir)
+internal_blks=$((filesize / real_blksz))
+$XFS_IO_PROG -c "cowextsize $((blksz * 16))" $testdir >> $seqres.full
+_weave_reflink_holes $blksz $nr $testdir/file1 $testdir/file3 >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file3 | _filter_scratch
+md5sum $testdir/file3.chk | _filter_scratch
+
+echo "directio CoW across the transition"
+cowoff=$((filesize / 4))
+cowsz=$((filesize / 2))
+$XFS_IO_PROG -d -f -c "pwrite -S 0x63 -b $cowsz $cowoff $cowsz" $testdir/file3 >> $seqres.full
+_pwrite_byte 0x63 $cowoff $cowsz $testdir/file3.chk >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file3 | _filter_scratch
+md5sum $testdir/file3.chk | _filter_scratch
+
+echo "Check extent counts"
+old_extents=$(_count_extents $testdir/file1)
+new_extents=$(_count_extents $testdir/file3)
+
+echo "old extents: $old_extents" >> $seqres.full
+echo "new extents: $new_extents" >> $seqres.full
+echo "maximum extents: $internal_blks" >> $seqres.full
+test $new_extents -lt $((internal_blks / 20)) || echo "file3 badly fragmented"
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/219.out b/tests/xfs/219.out
new file mode 100644
index 0000000..9052f1f
--- /dev/null
+++ b/tests/xfs/219.out
@@ -0,0 +1,13 @@
+QA output created by 219
+Format and mount
+Create the original files
+Compare files
+bdbcf02ee0aa977795a79d25fcfdccb1  SCRATCH_MNT/test-219/file1
+fa50dba51826899c372464a153cb2117  SCRATCH_MNT/test-219/file3
+fa50dba51826899c372464a153cb2117  SCRATCH_MNT/test-219/file3.chk
+directio CoW across the transition
+Compare files
+bdbcf02ee0aa977795a79d25fcfdccb1  SCRATCH_MNT/test-219/file1
+09101629908f9bdd5d178e7ce20bb1bb  SCRATCH_MNT/test-219/file3
+09101629908f9bdd5d178e7ce20bb1bb  SCRATCH_MNT/test-219/file3.chk
+Check extent counts
diff --git a/tests/xfs/221 b/tests/xfs/221
new file mode 100755
index 0000000..dc00331
--- /dev/null
+++ b/tests/xfs/221
@@ -0,0 +1,101 @@
+#! /bin/bash
+# FS QA Test No. 221
+#
+# Ensuring that copy on write in buffered mode works when the CoW
+# range originally covers multiple extents, some holes, some not.
+#   - Set cowextsize hint.
+#   - Create a file and truncate a second file.
+#   - Reflink the odd blocks of the first file into the second file.
+#   - CoW across the halfway mark, starting with the unwritten extent.
+#   - Check that the files are now different where we say they're different.
+#
+#-----------------------------------------------------------------------
+# 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
+_require_scratch_reflink
+_require_xfs_io_command "falloc"
+
+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
+
+echo "Create the original files"
+blksz=65536
+nr=64
+filesize=$((blksz * nr))
+real_blksz=$(stat -f -c '%S' $testdir)
+internal_blks=$((filesize / real_blksz))
+$XFS_IO_PROG -c "cowextsize $((blksz * 16))" $testdir >> $seqres.full
+_weave_reflink_holes $blksz $nr $testdir/file1 $testdir/file3 >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file3 | _filter_scratch
+md5sum $testdir/file3.chk | _filter_scratch
+
+echo "CoW across the transition"
+cowoff=$((filesize / 4))
+cowsz=$((filesize / 2))
+$XFS_IO_PROG -f -c "pwrite -S 0x63 -b $cowsz $cowoff $cowsz" $testdir/file3 >> $seqres.full
+_pwrite_byte 0x63 $cowoff $cowsz $testdir/file3.chk >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file3 | _filter_scratch
+md5sum $testdir/file3.chk | _filter_scratch
+
+echo "Check extent counts"
+old_extents=$(_count_extents $testdir/file1)
+new_extents=$(_count_extents $testdir/file3)
+
+echo "old extents: $old_extents" >> $seqres.full
+echo "new extents: $new_extents" >> $seqres.full
+echo "maximum extents: $internal_blks" >> $seqres.full
+test $new_extents -lt $((internal_blks / 20)) || echo "file3 badly fragmented"
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/221.out b/tests/xfs/221.out
new file mode 100644
index 0000000..63963ec
--- /dev/null
+++ b/tests/xfs/221.out
@@ -0,0 +1,13 @@
+QA output created by 221
+Format and mount
+Create the original files
+Compare files
+bdbcf02ee0aa977795a79d25fcfdccb1  SCRATCH_MNT/test-221/file1
+fa50dba51826899c372464a153cb2117  SCRATCH_MNT/test-221/file3
+fa50dba51826899c372464a153cb2117  SCRATCH_MNT/test-221/file3.chk
+CoW across the transition
+Compare files
+bdbcf02ee0aa977795a79d25fcfdccb1  SCRATCH_MNT/test-221/file1
+09101629908f9bdd5d178e7ce20bb1bb  SCRATCH_MNT/test-221/file3
+09101629908f9bdd5d178e7ce20bb1bb  SCRATCH_MNT/test-221/file3.chk
+Check extent counts
diff --git a/tests/xfs/223 b/tests/xfs/223
new file mode 100755
index 0000000..2bb1fcb
--- /dev/null
+++ b/tests/xfs/223
@@ -0,0 +1,104 @@
+#! /bin/bash
+# FS QA Test No. 223
+#
+# Ensuring that copy on write in direct-io mode works when the CoW
+# range originally covers multiple extents, some delalloc, some not.
+#   - Set cowextsize hint.
+#   - Create a file.
+#   - Reflink the odd blocks of the first file into the second file.
+#   - Buffered write the even blocks of the second file.
+#   - directio CoW across the halfway mark, starting with the unwritten extent.
+#   - Check that the files are now different where we say they're different.
+#
+#-----------------------------------------------------------------------
+# 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
+_require_scratch_reflink
+_require_xfs_io_command "falloc"
+_require_odirect
+
+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
+
+echo "Create the original files"
+blksz=65536
+nr=64
+filesize=$((blksz * nr))
+real_blksz=$(stat -f -c '%S' $testdir)
+internal_blks=$((filesize / real_blksz))
+$XFS_IO_PROG -c "cowextsize $((blksz * 16))" $testdir >> $seqres.full
+_weave_reflink_holes $blksz $nr $testdir/file1 $testdir/file3 >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file3 | _filter_scratch
+md5sum $testdir/file3.chk | _filter_scratch
+
+echo "directio CoW across the transition"
+cowoff=$((filesize / 4))
+cowsz=$((filesize / 2))
+_weave_reflink_holes_delalloc $blksz $nr $testdir/file3 >> $seqres.full
+$XFS_IO_PROG -d -f -c "pwrite -S 0x63 -b $cowsz $cowoff $cowsz" $testdir/file3 >> $seqres.full
+_pwrite_byte 0x63 $cowoff $cowsz $testdir/file3.chk >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file3 | _filter_scratch
+md5sum $testdir/file3.chk | _filter_scratch
+
+echo "Check extent counts"
+old_extents=$(_count_extents $testdir/file1)
+new_extents=$(_count_extents $testdir/file3)
+
+echo "old extents: $old_extents" >> $seqres.full
+echo "new extents: $new_extents" >> $seqres.full
+echo "maximum extents: $internal_blks" >> $seqres.full
+test $new_extents -lt $((internal_blks / 20)) || echo "file3 badly fragmented"
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/223.out b/tests/xfs/223.out
new file mode 100644
index 0000000..e07b33e
--- /dev/null
+++ b/tests/xfs/223.out
@@ -0,0 +1,13 @@
+QA output created by 223
+Format and mount
+Create the original files
+Compare files
+bdbcf02ee0aa977795a79d25fcfdccb1  SCRATCH_MNT/test-223/file1
+fa50dba51826899c372464a153cb2117  SCRATCH_MNT/test-223/file3
+fa50dba51826899c372464a153cb2117  SCRATCH_MNT/test-223/file3.chk
+directio CoW across the transition
+Compare files
+bdbcf02ee0aa977795a79d25fcfdccb1  SCRATCH_MNT/test-223/file1
+55968a95dfc0120df4e8485576514320  SCRATCH_MNT/test-223/file3
+55968a95dfc0120df4e8485576514320  SCRATCH_MNT/test-223/file3.chk
+Check extent counts
diff --git a/tests/xfs/224 b/tests/xfs/224
new file mode 100755
index 0000000..92d3b05
--- /dev/null
+++ b/tests/xfs/224
@@ -0,0 +1,103 @@
+#! /bin/bash
+# FS QA Test No. 224
+#
+# Ensuring that copy on write in buffered mode works when the CoW
+# range originally covers multiple extents, some delalloc, some not.
+#   - Set cowextsize hint.
+#   - Create a file.
+#   - Reflink the odd blocks of the first file into the second file.
+#   - Buffered write the even blocks of the second file.
+#   - CoW across the halfway mark, starting with the unwritten extent.
+#   - Check that the files are now different where we say they're different.
+#
+#-----------------------------------------------------------------------
+# 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
+_require_scratch_reflink
+_require_xfs_io_command "falloc"
+
+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
+
+echo "Create the original files"
+blksz=65536
+nr=64
+filesize=$((blksz * nr))
+real_blksz=$(stat -f -c '%S' $testdir)
+internal_blks=$((filesize / real_blksz))
+$XFS_IO_PROG -c "cowextsize $((blksz * 16))" $testdir >> $seqres.full
+_weave_reflink_holes $blksz $nr $testdir/file1 $testdir/file3 >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file3 | _filter_scratch
+md5sum $testdir/file3.chk | _filter_scratch
+
+echo "CoW across the transition"
+cowoff=$((filesize / 4))
+cowsz=$((filesize / 2))
+_weave_reflink_holes_delalloc $blksz $nr $testdir/file3 >> $seqres.full
+$XFS_IO_PROG -f -c "pwrite -S 0x63 -b $cowsz $cowoff $cowsz" $testdir/file3 >> $seqres.full
+_pwrite_byte 0x63 $cowoff $cowsz $testdir/file3.chk >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file3 | _filter_scratch
+md5sum $testdir/file3.chk | _filter_scratch
+
+echo "Check extent counts"
+old_extents=$(_count_extents $testdir/file1)
+new_extents=$(_count_extents $testdir/file3)
+
+echo "old extents: $old_extents" >> $seqres.full
+echo "new extents: $new_extents" >> $seqres.full
+echo "maximum extents: $internal_blks" >> $seqres.full
+test $new_extents -lt $((internal_blks / 20)) || echo "file3 badly fragmented"
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/224.out b/tests/xfs/224.out
new file mode 100644
index 0000000..749b3c9
--- /dev/null
+++ b/tests/xfs/224.out
@@ -0,0 +1,13 @@
+QA output created by 224
+Format and mount
+Create the original files
+Compare files
+bdbcf02ee0aa977795a79d25fcfdccb1  SCRATCH_MNT/test-224/file1
+fa50dba51826899c372464a153cb2117  SCRATCH_MNT/test-224/file3
+fa50dba51826899c372464a153cb2117  SCRATCH_MNT/test-224/file3.chk
+CoW across the transition
+Compare files
+bdbcf02ee0aa977795a79d25fcfdccb1  SCRATCH_MNT/test-224/file1
+55968a95dfc0120df4e8485576514320  SCRATCH_MNT/test-224/file3
+55968a95dfc0120df4e8485576514320  SCRATCH_MNT/test-224/file3.chk
+Check extent counts
diff --git a/tests/xfs/225 b/tests/xfs/225
new file mode 100755
index 0000000..b8e7712
--- /dev/null
+++ b/tests/xfs/225
@@ -0,0 +1,102 @@
+#! /bin/bash
+# FS QA Test No. 225
+#
+# Ensuring that copy on write in direct-io mode works when the CoW
+# range originally covers multiple extents, some regular, some not.
+#   - Set cowextsize hint.
+#   - Create two files.
+#   - Reflink the odd blocks of the first file into the second file.
+#   - directio CoW across the halfway mark, starting with the unwritten extent.
+#   - Check that the files are now different where we say they're different.
+#
+#-----------------------------------------------------------------------
+# 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
+_require_scratch_reflink
+_require_xfs_io_command "falloc"
+_require_odirect
+
+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
+
+echo "Create the original files"
+blksz=65536
+nr=64
+filesize=$((blksz * nr))
+real_blksz=$(stat -f -c '%S' $testdir)
+internal_blks=$((filesize / real_blksz))
+$XFS_IO_PROG -c "cowextsize $((blksz * 16))" $testdir >> $seqres.full
+_weave_reflink_regular $blksz $nr $testdir/file1 $testdir/file3 >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file3 | _filter_scratch
+md5sum $testdir/file3.chk | _filter_scratch
+
+echo "directio CoW across the transition"
+cowoff=$((filesize / 4))
+cowsz=$((filesize / 2))
+$XFS_IO_PROG -d -f -c "pwrite -S 0x63 -b $cowsz $cowoff $cowsz" $testdir/file3 >> $seqres.full
+_pwrite_byte 0x63 $cowoff $cowsz $testdir/file3.chk >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file3 | _filter_scratch
+md5sum $testdir/file3.chk | _filter_scratch
+
+echo "Check extent counts"
+old_extents=$(_count_extents $testdir/file1)
+new_extents=$(_count_extents $testdir/file3)
+
+echo "old extents: $old_extents" >> $seqres.full
+echo "new extents: $new_extents" >> $seqres.full
+echo "maximum extents: $internal_blks" >> $seqres.full
+test $new_extents -lt $((internal_blks / 20)) || echo "file3 badly fragmented"
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/225.out b/tests/xfs/225.out
new file mode 100644
index 0000000..da70fbc
--- /dev/null
+++ b/tests/xfs/225.out
@@ -0,0 +1,13 @@
+QA output created by 225
+Format and mount
+Create the original files
+Compare files
+bdbcf02ee0aa977795a79d25fcfdccb1  SCRATCH_MNT/test-225/file1
+d3959a68638c50af07f0258e032cb554  SCRATCH_MNT/test-225/file3
+d3959a68638c50af07f0258e032cb554  SCRATCH_MNT/test-225/file3.chk
+directio CoW across the transition
+Compare files
+bdbcf02ee0aa977795a79d25fcfdccb1  SCRATCH_MNT/test-225/file1
+55968a95dfc0120df4e8485576514320  SCRATCH_MNT/test-225/file3
+55968a95dfc0120df4e8485576514320  SCRATCH_MNT/test-225/file3.chk
+Check extent counts
diff --git a/tests/xfs/226 b/tests/xfs/226
new file mode 100755
index 0000000..ef4226e
--- /dev/null
+++ b/tests/xfs/226
@@ -0,0 +1,101 @@
+#! /bin/bash
+# FS QA Test No. 226
+#
+# Ensuring that copy on write in buffered mode works when the CoW
+# range originally covers multiple extents, some regular, some not.
+#   - Set cowextsize hint.
+#   - Create two files.
+#   - Reflink the odd blocks of the first file into the second file.
+#   - CoW across the halfway mark, starting with the unwritten extent.
+#   - Check that the files are now different where we say they're different.
+#
+#-----------------------------------------------------------------------
+# 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
+_require_scratch_reflink
+_require_xfs_io_command "falloc"
+
+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
+
+echo "Create the original files"
+blksz=65536
+nr=64
+filesize=$((blksz * nr))
+real_blksz=$(stat -f -c '%S' $testdir)
+internal_blks=$((filesize / real_blksz))
+$XFS_IO_PROG -c "cowextsize $((blksz * 16))" $testdir >> $seqres.full
+_weave_reflink_regular $blksz $nr $testdir/file1 $testdir/file3 >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file3 | _filter_scratch
+md5sum $testdir/file3.chk | _filter_scratch
+
+echo "CoW across the transition"
+cowoff=$((filesize / 4))
+cowsz=$((filesize / 2))
+$XFS_IO_PROG -f -c "pwrite -S 0x63 -b $cowsz $cowoff $cowsz" $testdir/file3 >> $seqres.full
+_pwrite_byte 0x63 $cowoff $cowsz $testdir/file3.chk >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file3 | _filter_scratch
+md5sum $testdir/file3.chk | _filter_scratch
+
+echo "Check extent counts"
+old_extents=$(_count_extents $testdir/file1)
+new_extents=$(_count_extents $testdir/file3)
+
+echo "old extents: $old_extents" >> $seqres.full
+echo "new extents: $new_extents" >> $seqres.full
+echo "maximum extents: $internal_blks" >> $seqres.full
+test $new_extents -lt $((internal_blks / 20)) || echo "file3 badly fragmented"
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/226.out b/tests/xfs/226.out
new file mode 100644
index 0000000..d413e8b
--- /dev/null
+++ b/tests/xfs/226.out
@@ -0,0 +1,13 @@
+QA output created by 226
+Format and mount
+Create the original files
+Compare files
+bdbcf02ee0aa977795a79d25fcfdccb1  SCRATCH_MNT/test-226/file1
+d3959a68638c50af07f0258e032cb554  SCRATCH_MNT/test-226/file3
+d3959a68638c50af07f0258e032cb554  SCRATCH_MNT/test-226/file3.chk
+CoW across the transition
+Compare files
+bdbcf02ee0aa977795a79d25fcfdccb1  SCRATCH_MNT/test-226/file1
+55968a95dfc0120df4e8485576514320  SCRATCH_MNT/test-226/file3
+55968a95dfc0120df4e8485576514320  SCRATCH_MNT/test-226/file3.chk
+Check extent counts
diff --git a/tests/xfs/228 b/tests/xfs/228
new file mode 100755
index 0000000..ecbe35f
--- /dev/null
+++ b/tests/xfs/228
@@ -0,0 +1,110 @@
+#! /bin/bash
+# FS QA Test No. 228
+#
+# Ensuring that copy on write in direct-io mode works when the CoW
+# range originally covers multiple extents, some unwritten, some not.
+#   - Set cowextsize hint.
+#   - Create a file with the following repeating sequence of blocks:
+#     1. reflinked
+#     2. unwritten
+#     3. hole
+#     4. regular block
+#     5. delalloc
+#   - directio CoW across the halfway mark, starting with the unwritten extent.
+#   - Check that the files are now different where we say they're different.
+#
+#-----------------------------------------------------------------------
+# 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
+_require_scratch_reflink
+_require_xfs_io_command "falloc"
+_require_xfs_io_command "fpunch"
+_require_cp_reflink
+_require_odirect
+
+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
+
+echo "Create the original files"
+blksz=65536
+nr=64
+filesize=$((blksz * nr))
+real_blksz=$(stat -f -c '%S' $testdir)
+internal_blks=$((filesize / real_blksz))
+$XFS_IO_PROG -c "cowextsize $((blksz * 16))" $testdir >> $seqres.full
+_weave_reflink_rainbow $blksz $nr $testdir/file1 $testdir/file3 >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file3 | _filter_scratch
+md5sum $testdir/file3.chk | _filter_scratch
+
+echo "directio CoW across the transition"
+cowoff=$((filesize / 4))
+cowsz=$((filesize / 2))
+_weave_reflink_rainbow_delalloc $blksz $nr $testdir/file3 >> $seqres.full
+# now cow
+$XFS_IO_PROG -d -f -c "pwrite -S 0x63 -b $cowsz $cowoff $cowsz" $testdir/file3 >> $seqres.full
+_pwrite_byte 0x63 $cowoff $cowsz $testdir/file3.chk >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file3 | _filter_scratch
+md5sum $testdir/file3.chk | _filter_scratch
+
+echo "Check extent counts"
+old_extents=$(_count_extents $testdir/file1)
+new_extents=$(_count_extents $testdir/file3)
+
+echo "old extents: $old_extents" >> $seqres.full
+echo "new extents: $new_extents" >> $seqres.full
+echo "maximum extents: $internal_blks" >> $seqres.full
+test $new_extents -lt $((internal_blks / 20)) || echo "file3 badly fragmented"
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/228.out b/tests/xfs/228.out
new file mode 100644
index 0000000..13b0aee
--- /dev/null
+++ b/tests/xfs/228.out
@@ -0,0 +1,13 @@
+QA output created by 228
+Format and mount
+Create the original files
+Compare files
+bdbcf02ee0aa977795a79d25fcfdccb1  SCRATCH_MNT/test-228/file1
+6366fd359371414186688a0ef6988893  SCRATCH_MNT/test-228/file3
+6366fd359371414186688a0ef6988893  SCRATCH_MNT/test-228/file3.chk
+directio CoW across the transition
+Compare files
+bdbcf02ee0aa977795a79d25fcfdccb1  SCRATCH_MNT/test-228/file1
+26aa3a0749b867ec58363c8539ee5471  SCRATCH_MNT/test-228/file3
+26aa3a0749b867ec58363c8539ee5471  SCRATCH_MNT/test-228/file3.chk
+Check extent counts
diff --git a/tests/xfs/230 b/tests/xfs/230
new file mode 100755
index 0000000..e09b52e
--- /dev/null
+++ b/tests/xfs/230
@@ -0,0 +1,110 @@
+#! /bin/bash
+# FS QA Test No. 230
+#
+# Ensuring that copy on write in buffered mode works when the CoW
+# range originally covers multiple extents, some unwritten, some not.
+#   - Set cowextsize hint.
+#   - Create a file with the following repeating sequence of blocks:
+#     1. reflinked
+#     2. unwritten
+#     3. hole
+#     4. regular block
+#     5. delalloc
+#   - CoW across the halfway mark, starting with the unwritten extent.
+#   - Check that the files are now different where we say they're different.
+#
+#-----------------------------------------------------------------------
+# 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
+_require_scratch_reflink
+_require_xfs_io_command "falloc"
+_require_xfs_io_command "fpunch"
+_require_cp_reflink
+_require_odirect
+
+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
+
+echo "Create the original files"
+blksz=65536
+nr=64
+filesize=$((blksz * nr))
+real_blksz=$(stat -f -c '%S' $testdir)
+internal_blks=$((filesize / real_blksz))
+$XFS_IO_PROG -c "cowextsize $((blksz * 16))" $testdir >> $seqres.full
+_weave_reflink_rainbow $blksz $nr $testdir/file1 $testdir/file3 >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file3 | _filter_scratch
+md5sum $testdir/file3.chk | _filter_scratch
+
+echo "directio CoW across the transition"
+cowoff=$((filesize / 4))
+cowsz=$((filesize / 2))
+_weave_reflink_rainbow_delalloc $blksz $nr $testdir/file3 >> $seqres.full
+# now cow
+$XFS_IO_PROG -f -c "pwrite -S 0x63 -b $cowsz $cowoff $cowsz" $testdir/file3 >> $seqres.full
+_pwrite_byte 0x63 $cowoff $cowsz $testdir/file3.chk >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file3 | _filter_scratch
+md5sum $testdir/file3.chk | _filter_scratch
+
+echo "Check extent counts"
+old_extents=$(_count_extents $testdir/file1)
+new_extents=$(_count_extents $testdir/file3)
+
+echo "old extents: $old_extents" >> $seqres.full
+echo "new extents: $new_extents" >> $seqres.full
+echo "maximum extents: $internal_blks" >> $seqres.full
+test $new_extents -lt $((internal_blks / 20)) || echo "file3 badly fragmented"
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/230.out b/tests/xfs/230.out
new file mode 100644
index 0000000..439427c
--- /dev/null
+++ b/tests/xfs/230.out
@@ -0,0 +1,13 @@
+QA output created by 230
+Format and mount
+Create the original files
+Compare files
+bdbcf02ee0aa977795a79d25fcfdccb1  SCRATCH_MNT/test-230/file1
+6366fd359371414186688a0ef6988893  SCRATCH_MNT/test-230/file3
+6366fd359371414186688a0ef6988893  SCRATCH_MNT/test-230/file3.chk
+directio CoW across the transition
+Compare files
+bdbcf02ee0aa977795a79d25fcfdccb1  SCRATCH_MNT/test-230/file1
+26aa3a0749b867ec58363c8539ee5471  SCRATCH_MNT/test-230/file3
+26aa3a0749b867ec58363c8539ee5471  SCRATCH_MNT/test-230/file3.chk
+Check extent counts
diff --git a/tests/xfs/group b/tests/xfs/group
index afd960f..da83274 100644
--- a/tests/xfs/group
+++ b/tests/xfs/group
@@ -212,12 +212,22 @@
 212 auto quick clone
 213 auto quick clone
 214 auto quick clone
+215 auto quick clone
 216 log metadata auto quick
 217 log metadata auto
+218 auto quick clone
+219 auto quick clone
 220 auto quota quick
+221 auto quick clone
 222 auto fsr ioctl quick
+223 auto quick clone
+224 auto quick clone
+225 auto quick clone
+226 auto quick clone
 227 auto fsr
+228 auto quick clone
 229 auto rw
+230 auto quick clone
 238 auto quick metadata ioctl
 242 auto quick prealloc
 244 auto quota quick


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

* [PATCH 23/32] reflink: test CoW across a mixed range of block types with cowextsize set
@ 2016-02-11 23:41   ` Darrick J. Wong
  0 siblings, 0 replies; 81+ messages in thread
From: Darrick J. Wong @ 2016-02-11 23:41 UTC (permalink / raw)
  To: david, darrick.wong; +Cc: fstests, linux-btrfs, xfs

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 tests/xfs/215     |  102 +++++++++++++++++++++++++++++++++++++++++++++++++
 tests/xfs/215.out |   13 ++++++
 tests/xfs/218     |  101 +++++++++++++++++++++++++++++++++++++++++++++++++
 tests/xfs/218.out |   13 ++++++
 tests/xfs/219     |  102 +++++++++++++++++++++++++++++++++++++++++++++++++
 tests/xfs/219.out |   13 ++++++
 tests/xfs/221     |  101 +++++++++++++++++++++++++++++++++++++++++++++++++
 tests/xfs/221.out |   13 ++++++
 tests/xfs/223     |  104 ++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/xfs/223.out |   13 ++++++
 tests/xfs/224     |  103 ++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/xfs/224.out |   13 ++++++
 tests/xfs/225     |  102 +++++++++++++++++++++++++++++++++++++++++++++++++
 tests/xfs/225.out |   13 ++++++
 tests/xfs/226     |  101 +++++++++++++++++++++++++++++++++++++++++++++++++
 tests/xfs/226.out |   13 ++++++
 tests/xfs/228     |  110 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/xfs/228.out |   13 ++++++
 tests/xfs/230     |  110 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/xfs/230.out |   13 ++++++
 tests/xfs/group   |   10 +++++
 21 files changed, 1176 insertions(+)
 create mode 100755 tests/xfs/215
 create mode 100644 tests/xfs/215.out
 create mode 100755 tests/xfs/218
 create mode 100644 tests/xfs/218.out
 create mode 100755 tests/xfs/219
 create mode 100644 tests/xfs/219.out
 create mode 100755 tests/xfs/221
 create mode 100644 tests/xfs/221.out
 create mode 100755 tests/xfs/223
 create mode 100644 tests/xfs/223.out
 create mode 100755 tests/xfs/224
 create mode 100644 tests/xfs/224.out
 create mode 100755 tests/xfs/225
 create mode 100644 tests/xfs/225.out
 create mode 100755 tests/xfs/226
 create mode 100644 tests/xfs/226.out
 create mode 100755 tests/xfs/228
 create mode 100644 tests/xfs/228.out
 create mode 100755 tests/xfs/230
 create mode 100644 tests/xfs/230.out


diff --git a/tests/xfs/215 b/tests/xfs/215
new file mode 100755
index 0000000..9ed842e
--- /dev/null
+++ b/tests/xfs/215
@@ -0,0 +1,102 @@
+#! /bin/bash
+# FS QA Test No. 215
+#
+# Ensuring that copy on write in direct-io mode works when the CoW
+# range originally covers multiple extents, some unwritten, some not.
+#   - Set cowextsize hint.
+#   - Create a file and fallocate a second file.
+#   - Reflink the odd blocks of the first file into the second file.
+#   - directio CoW across the halfway mark, starting with the unwritten extent.
+#   - Check that the files are now different where we say they're different.
+#
+#-----------------------------------------------------------------------
+# 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
+_require_scratch_reflink
+_require_xfs_io_command "falloc"
+_require_odirect
+
+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
+
+echo "Create the original files"
+blksz=65536
+nr=64
+filesize=$((blksz * nr))
+real_blksz=$(stat -f -c '%S' $testdir)
+internal_blks=$((filesize / real_blksz))
+$XFS_IO_PROG -c "cowextsize $((blksz * 16))" $testdir >> $seqres.full
+_weave_reflink_unwritten $blksz $nr $testdir/file1 $testdir/file3 >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file3 | _filter_scratch
+md5sum $testdir/file3.chk | _filter_scratch
+
+echo "directio CoW across the transition"
+cowoff=$((filesize / 4))
+cowsz=$((filesize / 2))
+$XFS_IO_PROG -d -f -c "pwrite -S 0x63 -b $cowsz $cowoff $cowsz" $testdir/file3 >> $seqres.full
+_pwrite_byte 0x63 $cowoff $cowsz $testdir/file3.chk >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file3 | _filter_scratch
+md5sum $testdir/file3.chk | _filter_scratch
+
+echo "Check extent counts"
+old_extents=$(_count_extents $testdir/file1)
+new_extents=$(_count_extents $testdir/file3)
+
+echo "old extents: $old_extents" >> $seqres.full
+echo "new extents: $new_extents" >> $seqres.full
+echo "maximum extents: $internal_blks" >> $seqres.full
+test $new_extents -lt $((internal_blks / 20)) || echo "file3 badly fragmented"
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/215.out b/tests/xfs/215.out
new file mode 100644
index 0000000..ce3a08b
--- /dev/null
+++ b/tests/xfs/215.out
@@ -0,0 +1,13 @@
+QA output created by 215
+Format and mount
+Create the original files
+Compare files
+bdbcf02ee0aa977795a79d25fcfdccb1  SCRATCH_MNT/test-215/file1
+fa50dba51826899c372464a153cb2117  SCRATCH_MNT/test-215/file3
+fa50dba51826899c372464a153cb2117  SCRATCH_MNT/test-215/file3.chk
+directio CoW across the transition
+Compare files
+bdbcf02ee0aa977795a79d25fcfdccb1  SCRATCH_MNT/test-215/file1
+09101629908f9bdd5d178e7ce20bb1bb  SCRATCH_MNT/test-215/file3
+09101629908f9bdd5d178e7ce20bb1bb  SCRATCH_MNT/test-215/file3.chk
+Check extent counts
diff --git a/tests/xfs/218 b/tests/xfs/218
new file mode 100755
index 0000000..e98b14e
--- /dev/null
+++ b/tests/xfs/218
@@ -0,0 +1,101 @@
+#! /bin/bash
+# FS QA Test No. 218
+#
+# Ensuring that copy on write in buffered mode works when the CoW
+# range originally covers multiple extents, some unwritten, some not.
+#   - Set cowextsize hint.
+#   - Create a file and fallocate a second file.
+#   - Reflink the odd blocks of the first file into the second file.
+#   - CoW across the halfway mark, starting with the unwritten extent.
+#   - Check that the files are now different where we say they're different.
+#
+#-----------------------------------------------------------------------
+# 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
+_require_scratch_reflink
+_require_xfs_io_command "falloc"
+
+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
+
+echo "Create the original files"
+blksz=65536
+nr=64
+filesize=$((blksz * nr))
+real_blksz=$(stat -f -c '%S' $testdir)
+internal_blks=$((filesize / real_blksz))
+$XFS_IO_PROG -c "cowextsize $((blksz * 16))" $testdir >> $seqres.full
+_weave_reflink_unwritten $blksz $nr $testdir/file1 $testdir/file3 >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file3 | _filter_scratch
+md5sum $testdir/file3.chk | _filter_scratch
+
+echo "CoW across the transition"
+cowoff=$((filesize / 4))
+cowsz=$((filesize / 2))
+$XFS_IO_PROG -f -c "pwrite -S 0x63 -b $cowsz $cowoff $cowsz" $testdir/file3 >> $seqres.full
+_pwrite_byte 0x63 $cowoff $cowsz $testdir/file3.chk >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file3 | _filter_scratch
+md5sum $testdir/file3.chk | _filter_scratch
+
+echo "Check extent counts"
+old_extents=$(_count_extents $testdir/file1)
+new_extents=$(_count_extents $testdir/file3)
+
+echo "old extents: $old_extents" >> $seqres.full
+echo "new extents: $new_extents" >> $seqres.full
+echo "maximum extents: $internal_blks" >> $seqres.full
+test $new_extents -lt $((internal_blks / 20)) || echo "file3 badly fragmented"
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/218.out b/tests/xfs/218.out
new file mode 100644
index 0000000..ad1efda
--- /dev/null
+++ b/tests/xfs/218.out
@@ -0,0 +1,13 @@
+QA output created by 218
+Format and mount
+Create the original files
+Compare files
+bdbcf02ee0aa977795a79d25fcfdccb1  SCRATCH_MNT/test-218/file1
+fa50dba51826899c372464a153cb2117  SCRATCH_MNT/test-218/file3
+fa50dba51826899c372464a153cb2117  SCRATCH_MNT/test-218/file3.chk
+CoW across the transition
+Compare files
+bdbcf02ee0aa977795a79d25fcfdccb1  SCRATCH_MNT/test-218/file1
+09101629908f9bdd5d178e7ce20bb1bb  SCRATCH_MNT/test-218/file3
+09101629908f9bdd5d178e7ce20bb1bb  SCRATCH_MNT/test-218/file3.chk
+Check extent counts
diff --git a/tests/xfs/219 b/tests/xfs/219
new file mode 100755
index 0000000..25c0bb4
--- /dev/null
+++ b/tests/xfs/219
@@ -0,0 +1,102 @@
+#! /bin/bash
+# FS QA Test No. 219
+#
+# Ensuring that copy on write in direct-io mode works when the CoW
+# range originally covers multiple extents, some holes, some not.
+#   - Set cowextsize hint.
+#   - Create a file and truncate a second file.
+#   - Reflink the odd blocks of the first file into the second file.
+#   - directio CoW across the halfway mark, starting with the unwritten extent.
+#   - Check that the files are now different where we say they're different.
+#
+#-----------------------------------------------------------------------
+# 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
+_require_scratch_reflink
+_require_xfs_io_command "falloc"
+_require_odirect
+
+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
+
+echo "Create the original files"
+blksz=65536
+nr=64
+filesize=$((blksz * nr))
+real_blksz=$(stat -f -c '%S' $testdir)
+internal_blks=$((filesize / real_blksz))
+$XFS_IO_PROG -c "cowextsize $((blksz * 16))" $testdir >> $seqres.full
+_weave_reflink_holes $blksz $nr $testdir/file1 $testdir/file3 >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file3 | _filter_scratch
+md5sum $testdir/file3.chk | _filter_scratch
+
+echo "directio CoW across the transition"
+cowoff=$((filesize / 4))
+cowsz=$((filesize / 2))
+$XFS_IO_PROG -d -f -c "pwrite -S 0x63 -b $cowsz $cowoff $cowsz" $testdir/file3 >> $seqres.full
+_pwrite_byte 0x63 $cowoff $cowsz $testdir/file3.chk >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file3 | _filter_scratch
+md5sum $testdir/file3.chk | _filter_scratch
+
+echo "Check extent counts"
+old_extents=$(_count_extents $testdir/file1)
+new_extents=$(_count_extents $testdir/file3)
+
+echo "old extents: $old_extents" >> $seqres.full
+echo "new extents: $new_extents" >> $seqres.full
+echo "maximum extents: $internal_blks" >> $seqres.full
+test $new_extents -lt $((internal_blks / 20)) || echo "file3 badly fragmented"
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/219.out b/tests/xfs/219.out
new file mode 100644
index 0000000..9052f1f
--- /dev/null
+++ b/tests/xfs/219.out
@@ -0,0 +1,13 @@
+QA output created by 219
+Format and mount
+Create the original files
+Compare files
+bdbcf02ee0aa977795a79d25fcfdccb1  SCRATCH_MNT/test-219/file1
+fa50dba51826899c372464a153cb2117  SCRATCH_MNT/test-219/file3
+fa50dba51826899c372464a153cb2117  SCRATCH_MNT/test-219/file3.chk
+directio CoW across the transition
+Compare files
+bdbcf02ee0aa977795a79d25fcfdccb1  SCRATCH_MNT/test-219/file1
+09101629908f9bdd5d178e7ce20bb1bb  SCRATCH_MNT/test-219/file3
+09101629908f9bdd5d178e7ce20bb1bb  SCRATCH_MNT/test-219/file3.chk
+Check extent counts
diff --git a/tests/xfs/221 b/tests/xfs/221
new file mode 100755
index 0000000..dc00331
--- /dev/null
+++ b/tests/xfs/221
@@ -0,0 +1,101 @@
+#! /bin/bash
+# FS QA Test No. 221
+#
+# Ensuring that copy on write in buffered mode works when the CoW
+# range originally covers multiple extents, some holes, some not.
+#   - Set cowextsize hint.
+#   - Create a file and truncate a second file.
+#   - Reflink the odd blocks of the first file into the second file.
+#   - CoW across the halfway mark, starting with the unwritten extent.
+#   - Check that the files are now different where we say they're different.
+#
+#-----------------------------------------------------------------------
+# 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
+_require_scratch_reflink
+_require_xfs_io_command "falloc"
+
+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
+
+echo "Create the original files"
+blksz=65536
+nr=64
+filesize=$((blksz * nr))
+real_blksz=$(stat -f -c '%S' $testdir)
+internal_blks=$((filesize / real_blksz))
+$XFS_IO_PROG -c "cowextsize $((blksz * 16))" $testdir >> $seqres.full
+_weave_reflink_holes $blksz $nr $testdir/file1 $testdir/file3 >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file3 | _filter_scratch
+md5sum $testdir/file3.chk | _filter_scratch
+
+echo "CoW across the transition"
+cowoff=$((filesize / 4))
+cowsz=$((filesize / 2))
+$XFS_IO_PROG -f -c "pwrite -S 0x63 -b $cowsz $cowoff $cowsz" $testdir/file3 >> $seqres.full
+_pwrite_byte 0x63 $cowoff $cowsz $testdir/file3.chk >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file3 | _filter_scratch
+md5sum $testdir/file3.chk | _filter_scratch
+
+echo "Check extent counts"
+old_extents=$(_count_extents $testdir/file1)
+new_extents=$(_count_extents $testdir/file3)
+
+echo "old extents: $old_extents" >> $seqres.full
+echo "new extents: $new_extents" >> $seqres.full
+echo "maximum extents: $internal_blks" >> $seqres.full
+test $new_extents -lt $((internal_blks / 20)) || echo "file3 badly fragmented"
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/221.out b/tests/xfs/221.out
new file mode 100644
index 0000000..63963ec
--- /dev/null
+++ b/tests/xfs/221.out
@@ -0,0 +1,13 @@
+QA output created by 221
+Format and mount
+Create the original files
+Compare files
+bdbcf02ee0aa977795a79d25fcfdccb1  SCRATCH_MNT/test-221/file1
+fa50dba51826899c372464a153cb2117  SCRATCH_MNT/test-221/file3
+fa50dba51826899c372464a153cb2117  SCRATCH_MNT/test-221/file3.chk
+CoW across the transition
+Compare files
+bdbcf02ee0aa977795a79d25fcfdccb1  SCRATCH_MNT/test-221/file1
+09101629908f9bdd5d178e7ce20bb1bb  SCRATCH_MNT/test-221/file3
+09101629908f9bdd5d178e7ce20bb1bb  SCRATCH_MNT/test-221/file3.chk
+Check extent counts
diff --git a/tests/xfs/223 b/tests/xfs/223
new file mode 100755
index 0000000..2bb1fcb
--- /dev/null
+++ b/tests/xfs/223
@@ -0,0 +1,104 @@
+#! /bin/bash
+# FS QA Test No. 223
+#
+# Ensuring that copy on write in direct-io mode works when the CoW
+# range originally covers multiple extents, some delalloc, some not.
+#   - Set cowextsize hint.
+#   - Create a file.
+#   - Reflink the odd blocks of the first file into the second file.
+#   - Buffered write the even blocks of the second file.
+#   - directio CoW across the halfway mark, starting with the unwritten extent.
+#   - Check that the files are now different where we say they're different.
+#
+#-----------------------------------------------------------------------
+# 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
+_require_scratch_reflink
+_require_xfs_io_command "falloc"
+_require_odirect
+
+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
+
+echo "Create the original files"
+blksz=65536
+nr=64
+filesize=$((blksz * nr))
+real_blksz=$(stat -f -c '%S' $testdir)
+internal_blks=$((filesize / real_blksz))
+$XFS_IO_PROG -c "cowextsize $((blksz * 16))" $testdir >> $seqres.full
+_weave_reflink_holes $blksz $nr $testdir/file1 $testdir/file3 >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file3 | _filter_scratch
+md5sum $testdir/file3.chk | _filter_scratch
+
+echo "directio CoW across the transition"
+cowoff=$((filesize / 4))
+cowsz=$((filesize / 2))
+_weave_reflink_holes_delalloc $blksz $nr $testdir/file3 >> $seqres.full
+$XFS_IO_PROG -d -f -c "pwrite -S 0x63 -b $cowsz $cowoff $cowsz" $testdir/file3 >> $seqres.full
+_pwrite_byte 0x63 $cowoff $cowsz $testdir/file3.chk >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file3 | _filter_scratch
+md5sum $testdir/file3.chk | _filter_scratch
+
+echo "Check extent counts"
+old_extents=$(_count_extents $testdir/file1)
+new_extents=$(_count_extents $testdir/file3)
+
+echo "old extents: $old_extents" >> $seqres.full
+echo "new extents: $new_extents" >> $seqres.full
+echo "maximum extents: $internal_blks" >> $seqres.full
+test $new_extents -lt $((internal_blks / 20)) || echo "file3 badly fragmented"
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/223.out b/tests/xfs/223.out
new file mode 100644
index 0000000..e07b33e
--- /dev/null
+++ b/tests/xfs/223.out
@@ -0,0 +1,13 @@
+QA output created by 223
+Format and mount
+Create the original files
+Compare files
+bdbcf02ee0aa977795a79d25fcfdccb1  SCRATCH_MNT/test-223/file1
+fa50dba51826899c372464a153cb2117  SCRATCH_MNT/test-223/file3
+fa50dba51826899c372464a153cb2117  SCRATCH_MNT/test-223/file3.chk
+directio CoW across the transition
+Compare files
+bdbcf02ee0aa977795a79d25fcfdccb1  SCRATCH_MNT/test-223/file1
+55968a95dfc0120df4e8485576514320  SCRATCH_MNT/test-223/file3
+55968a95dfc0120df4e8485576514320  SCRATCH_MNT/test-223/file3.chk
+Check extent counts
diff --git a/tests/xfs/224 b/tests/xfs/224
new file mode 100755
index 0000000..92d3b05
--- /dev/null
+++ b/tests/xfs/224
@@ -0,0 +1,103 @@
+#! /bin/bash
+# FS QA Test No. 224
+#
+# Ensuring that copy on write in buffered mode works when the CoW
+# range originally covers multiple extents, some delalloc, some not.
+#   - Set cowextsize hint.
+#   - Create a file.
+#   - Reflink the odd blocks of the first file into the second file.
+#   - Buffered write the even blocks of the second file.
+#   - CoW across the halfway mark, starting with the unwritten extent.
+#   - Check that the files are now different where we say they're different.
+#
+#-----------------------------------------------------------------------
+# 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
+_require_scratch_reflink
+_require_xfs_io_command "falloc"
+
+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
+
+echo "Create the original files"
+blksz=65536
+nr=64
+filesize=$((blksz * nr))
+real_blksz=$(stat -f -c '%S' $testdir)
+internal_blks=$((filesize / real_blksz))
+$XFS_IO_PROG -c "cowextsize $((blksz * 16))" $testdir >> $seqres.full
+_weave_reflink_holes $blksz $nr $testdir/file1 $testdir/file3 >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file3 | _filter_scratch
+md5sum $testdir/file3.chk | _filter_scratch
+
+echo "CoW across the transition"
+cowoff=$((filesize / 4))
+cowsz=$((filesize / 2))
+_weave_reflink_holes_delalloc $blksz $nr $testdir/file3 >> $seqres.full
+$XFS_IO_PROG -f -c "pwrite -S 0x63 -b $cowsz $cowoff $cowsz" $testdir/file3 >> $seqres.full
+_pwrite_byte 0x63 $cowoff $cowsz $testdir/file3.chk >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file3 | _filter_scratch
+md5sum $testdir/file3.chk | _filter_scratch
+
+echo "Check extent counts"
+old_extents=$(_count_extents $testdir/file1)
+new_extents=$(_count_extents $testdir/file3)
+
+echo "old extents: $old_extents" >> $seqres.full
+echo "new extents: $new_extents" >> $seqres.full
+echo "maximum extents: $internal_blks" >> $seqres.full
+test $new_extents -lt $((internal_blks / 20)) || echo "file3 badly fragmented"
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/224.out b/tests/xfs/224.out
new file mode 100644
index 0000000..749b3c9
--- /dev/null
+++ b/tests/xfs/224.out
@@ -0,0 +1,13 @@
+QA output created by 224
+Format and mount
+Create the original files
+Compare files
+bdbcf02ee0aa977795a79d25fcfdccb1  SCRATCH_MNT/test-224/file1
+fa50dba51826899c372464a153cb2117  SCRATCH_MNT/test-224/file3
+fa50dba51826899c372464a153cb2117  SCRATCH_MNT/test-224/file3.chk
+CoW across the transition
+Compare files
+bdbcf02ee0aa977795a79d25fcfdccb1  SCRATCH_MNT/test-224/file1
+55968a95dfc0120df4e8485576514320  SCRATCH_MNT/test-224/file3
+55968a95dfc0120df4e8485576514320  SCRATCH_MNT/test-224/file3.chk
+Check extent counts
diff --git a/tests/xfs/225 b/tests/xfs/225
new file mode 100755
index 0000000..b8e7712
--- /dev/null
+++ b/tests/xfs/225
@@ -0,0 +1,102 @@
+#! /bin/bash
+# FS QA Test No. 225
+#
+# Ensuring that copy on write in direct-io mode works when the CoW
+# range originally covers multiple extents, some regular, some not.
+#   - Set cowextsize hint.
+#   - Create two files.
+#   - Reflink the odd blocks of the first file into the second file.
+#   - directio CoW across the halfway mark, starting with the unwritten extent.
+#   - Check that the files are now different where we say they're different.
+#
+#-----------------------------------------------------------------------
+# 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
+_require_scratch_reflink
+_require_xfs_io_command "falloc"
+_require_odirect
+
+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
+
+echo "Create the original files"
+blksz=65536
+nr=64
+filesize=$((blksz * nr))
+real_blksz=$(stat -f -c '%S' $testdir)
+internal_blks=$((filesize / real_blksz))
+$XFS_IO_PROG -c "cowextsize $((blksz * 16))" $testdir >> $seqres.full
+_weave_reflink_regular $blksz $nr $testdir/file1 $testdir/file3 >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file3 | _filter_scratch
+md5sum $testdir/file3.chk | _filter_scratch
+
+echo "directio CoW across the transition"
+cowoff=$((filesize / 4))
+cowsz=$((filesize / 2))
+$XFS_IO_PROG -d -f -c "pwrite -S 0x63 -b $cowsz $cowoff $cowsz" $testdir/file3 >> $seqres.full
+_pwrite_byte 0x63 $cowoff $cowsz $testdir/file3.chk >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file3 | _filter_scratch
+md5sum $testdir/file3.chk | _filter_scratch
+
+echo "Check extent counts"
+old_extents=$(_count_extents $testdir/file1)
+new_extents=$(_count_extents $testdir/file3)
+
+echo "old extents: $old_extents" >> $seqres.full
+echo "new extents: $new_extents" >> $seqres.full
+echo "maximum extents: $internal_blks" >> $seqres.full
+test $new_extents -lt $((internal_blks / 20)) || echo "file3 badly fragmented"
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/225.out b/tests/xfs/225.out
new file mode 100644
index 0000000..da70fbc
--- /dev/null
+++ b/tests/xfs/225.out
@@ -0,0 +1,13 @@
+QA output created by 225
+Format and mount
+Create the original files
+Compare files
+bdbcf02ee0aa977795a79d25fcfdccb1  SCRATCH_MNT/test-225/file1
+d3959a68638c50af07f0258e032cb554  SCRATCH_MNT/test-225/file3
+d3959a68638c50af07f0258e032cb554  SCRATCH_MNT/test-225/file3.chk
+directio CoW across the transition
+Compare files
+bdbcf02ee0aa977795a79d25fcfdccb1  SCRATCH_MNT/test-225/file1
+55968a95dfc0120df4e8485576514320  SCRATCH_MNT/test-225/file3
+55968a95dfc0120df4e8485576514320  SCRATCH_MNT/test-225/file3.chk
+Check extent counts
diff --git a/tests/xfs/226 b/tests/xfs/226
new file mode 100755
index 0000000..ef4226e
--- /dev/null
+++ b/tests/xfs/226
@@ -0,0 +1,101 @@
+#! /bin/bash
+# FS QA Test No. 226
+#
+# Ensuring that copy on write in buffered mode works when the CoW
+# range originally covers multiple extents, some regular, some not.
+#   - Set cowextsize hint.
+#   - Create two files.
+#   - Reflink the odd blocks of the first file into the second file.
+#   - CoW across the halfway mark, starting with the unwritten extent.
+#   - Check that the files are now different where we say they're different.
+#
+#-----------------------------------------------------------------------
+# 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
+_require_scratch_reflink
+_require_xfs_io_command "falloc"
+
+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
+
+echo "Create the original files"
+blksz=65536
+nr=64
+filesize=$((blksz * nr))
+real_blksz=$(stat -f -c '%S' $testdir)
+internal_blks=$((filesize / real_blksz))
+$XFS_IO_PROG -c "cowextsize $((blksz * 16))" $testdir >> $seqres.full
+_weave_reflink_regular $blksz $nr $testdir/file1 $testdir/file3 >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file3 | _filter_scratch
+md5sum $testdir/file3.chk | _filter_scratch
+
+echo "CoW across the transition"
+cowoff=$((filesize / 4))
+cowsz=$((filesize / 2))
+$XFS_IO_PROG -f -c "pwrite -S 0x63 -b $cowsz $cowoff $cowsz" $testdir/file3 >> $seqres.full
+_pwrite_byte 0x63 $cowoff $cowsz $testdir/file3.chk >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file3 | _filter_scratch
+md5sum $testdir/file3.chk | _filter_scratch
+
+echo "Check extent counts"
+old_extents=$(_count_extents $testdir/file1)
+new_extents=$(_count_extents $testdir/file3)
+
+echo "old extents: $old_extents" >> $seqres.full
+echo "new extents: $new_extents" >> $seqres.full
+echo "maximum extents: $internal_blks" >> $seqres.full
+test $new_extents -lt $((internal_blks / 20)) || echo "file3 badly fragmented"
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/226.out b/tests/xfs/226.out
new file mode 100644
index 0000000..d413e8b
--- /dev/null
+++ b/tests/xfs/226.out
@@ -0,0 +1,13 @@
+QA output created by 226
+Format and mount
+Create the original files
+Compare files
+bdbcf02ee0aa977795a79d25fcfdccb1  SCRATCH_MNT/test-226/file1
+d3959a68638c50af07f0258e032cb554  SCRATCH_MNT/test-226/file3
+d3959a68638c50af07f0258e032cb554  SCRATCH_MNT/test-226/file3.chk
+CoW across the transition
+Compare files
+bdbcf02ee0aa977795a79d25fcfdccb1  SCRATCH_MNT/test-226/file1
+55968a95dfc0120df4e8485576514320  SCRATCH_MNT/test-226/file3
+55968a95dfc0120df4e8485576514320  SCRATCH_MNT/test-226/file3.chk
+Check extent counts
diff --git a/tests/xfs/228 b/tests/xfs/228
new file mode 100755
index 0000000..ecbe35f
--- /dev/null
+++ b/tests/xfs/228
@@ -0,0 +1,110 @@
+#! /bin/bash
+# FS QA Test No. 228
+#
+# Ensuring that copy on write in direct-io mode works when the CoW
+# range originally covers multiple extents, some unwritten, some not.
+#   - Set cowextsize hint.
+#   - Create a file with the following repeating sequence of blocks:
+#     1. reflinked
+#     2. unwritten
+#     3. hole
+#     4. regular block
+#     5. delalloc
+#   - directio CoW across the halfway mark, starting with the unwritten extent.
+#   - Check that the files are now different where we say they're different.
+#
+#-----------------------------------------------------------------------
+# 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
+_require_scratch_reflink
+_require_xfs_io_command "falloc"
+_require_xfs_io_command "fpunch"
+_require_cp_reflink
+_require_odirect
+
+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
+
+echo "Create the original files"
+blksz=65536
+nr=64
+filesize=$((blksz * nr))
+real_blksz=$(stat -f -c '%S' $testdir)
+internal_blks=$((filesize / real_blksz))
+$XFS_IO_PROG -c "cowextsize $((blksz * 16))" $testdir >> $seqres.full
+_weave_reflink_rainbow $blksz $nr $testdir/file1 $testdir/file3 >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file3 | _filter_scratch
+md5sum $testdir/file3.chk | _filter_scratch
+
+echo "directio CoW across the transition"
+cowoff=$((filesize / 4))
+cowsz=$((filesize / 2))
+_weave_reflink_rainbow_delalloc $blksz $nr $testdir/file3 >> $seqres.full
+# now cow
+$XFS_IO_PROG -d -f -c "pwrite -S 0x63 -b $cowsz $cowoff $cowsz" $testdir/file3 >> $seqres.full
+_pwrite_byte 0x63 $cowoff $cowsz $testdir/file3.chk >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file3 | _filter_scratch
+md5sum $testdir/file3.chk | _filter_scratch
+
+echo "Check extent counts"
+old_extents=$(_count_extents $testdir/file1)
+new_extents=$(_count_extents $testdir/file3)
+
+echo "old extents: $old_extents" >> $seqres.full
+echo "new extents: $new_extents" >> $seqres.full
+echo "maximum extents: $internal_blks" >> $seqres.full
+test $new_extents -lt $((internal_blks / 20)) || echo "file3 badly fragmented"
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/228.out b/tests/xfs/228.out
new file mode 100644
index 0000000..13b0aee
--- /dev/null
+++ b/tests/xfs/228.out
@@ -0,0 +1,13 @@
+QA output created by 228
+Format and mount
+Create the original files
+Compare files
+bdbcf02ee0aa977795a79d25fcfdccb1  SCRATCH_MNT/test-228/file1
+6366fd359371414186688a0ef6988893  SCRATCH_MNT/test-228/file3
+6366fd359371414186688a0ef6988893  SCRATCH_MNT/test-228/file3.chk
+directio CoW across the transition
+Compare files
+bdbcf02ee0aa977795a79d25fcfdccb1  SCRATCH_MNT/test-228/file1
+26aa3a0749b867ec58363c8539ee5471  SCRATCH_MNT/test-228/file3
+26aa3a0749b867ec58363c8539ee5471  SCRATCH_MNT/test-228/file3.chk
+Check extent counts
diff --git a/tests/xfs/230 b/tests/xfs/230
new file mode 100755
index 0000000..e09b52e
--- /dev/null
+++ b/tests/xfs/230
@@ -0,0 +1,110 @@
+#! /bin/bash
+# FS QA Test No. 230
+#
+# Ensuring that copy on write in buffered mode works when the CoW
+# range originally covers multiple extents, some unwritten, some not.
+#   - Set cowextsize hint.
+#   - Create a file with the following repeating sequence of blocks:
+#     1. reflinked
+#     2. unwritten
+#     3. hole
+#     4. regular block
+#     5. delalloc
+#   - CoW across the halfway mark, starting with the unwritten extent.
+#   - Check that the files are now different where we say they're different.
+#
+#-----------------------------------------------------------------------
+# 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
+_require_scratch_reflink
+_require_xfs_io_command "falloc"
+_require_xfs_io_command "fpunch"
+_require_cp_reflink
+_require_odirect
+
+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
+
+echo "Create the original files"
+blksz=65536
+nr=64
+filesize=$((blksz * nr))
+real_blksz=$(stat -f -c '%S' $testdir)
+internal_blks=$((filesize / real_blksz))
+$XFS_IO_PROG -c "cowextsize $((blksz * 16))" $testdir >> $seqres.full
+_weave_reflink_rainbow $blksz $nr $testdir/file1 $testdir/file3 >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file3 | _filter_scratch
+md5sum $testdir/file3.chk | _filter_scratch
+
+echo "directio CoW across the transition"
+cowoff=$((filesize / 4))
+cowsz=$((filesize / 2))
+_weave_reflink_rainbow_delalloc $blksz $nr $testdir/file3 >> $seqres.full
+# now cow
+$XFS_IO_PROG -f -c "pwrite -S 0x63 -b $cowsz $cowoff $cowsz" $testdir/file3 >> $seqres.full
+_pwrite_byte 0x63 $cowoff $cowsz $testdir/file3.chk >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file3 | _filter_scratch
+md5sum $testdir/file3.chk | _filter_scratch
+
+echo "Check extent counts"
+old_extents=$(_count_extents $testdir/file1)
+new_extents=$(_count_extents $testdir/file3)
+
+echo "old extents: $old_extents" >> $seqres.full
+echo "new extents: $new_extents" >> $seqres.full
+echo "maximum extents: $internal_blks" >> $seqres.full
+test $new_extents -lt $((internal_blks / 20)) || echo "file3 badly fragmented"
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/230.out b/tests/xfs/230.out
new file mode 100644
index 0000000..439427c
--- /dev/null
+++ b/tests/xfs/230.out
@@ -0,0 +1,13 @@
+QA output created by 230
+Format and mount
+Create the original files
+Compare files
+bdbcf02ee0aa977795a79d25fcfdccb1  SCRATCH_MNT/test-230/file1
+6366fd359371414186688a0ef6988893  SCRATCH_MNT/test-230/file3
+6366fd359371414186688a0ef6988893  SCRATCH_MNT/test-230/file3.chk
+directio CoW across the transition
+Compare files
+bdbcf02ee0aa977795a79d25fcfdccb1  SCRATCH_MNT/test-230/file1
+26aa3a0749b867ec58363c8539ee5471  SCRATCH_MNT/test-230/file3
+26aa3a0749b867ec58363c8539ee5471  SCRATCH_MNT/test-230/file3.chk
+Check extent counts
diff --git a/tests/xfs/group b/tests/xfs/group
index afd960f..da83274 100644
--- a/tests/xfs/group
+++ b/tests/xfs/group
@@ -212,12 +212,22 @@
 212 auto quick clone
 213 auto quick clone
 214 auto quick clone
+215 auto quick clone
 216 log metadata auto quick
 217 log metadata auto
+218 auto quick clone
+219 auto quick clone
 220 auto quota quick
+221 auto quick clone
 222 auto fsr ioctl quick
+223 auto quick clone
+224 auto quick clone
+225 auto quick clone
+226 auto quick clone
 227 auto fsr
+228 auto quick clone
 229 auto rw
+230 auto quick clone
 238 auto quick metadata ioctl
 242 auto quick prealloc
 244 auto quota quick

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

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

* [PATCH 24/32] xfs: test the automatic cowextsize extent garbage collector
  2016-02-11 23:39 ` Darrick J. Wong
@ 2016-02-11 23:42   ` Darrick J. Wong
  -1 siblings, 0 replies; 81+ messages in thread
From: Darrick J. Wong @ 2016-02-11 23:42 UTC (permalink / raw)
  To: david, darrick.wong; +Cc: linux-btrfs, fstests, xfs

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 tests/xfs/231     |  130 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/xfs/231.out |   16 ++++++
 tests/xfs/232     |  132 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/xfs/232.out |   16 ++++++
 tests/xfs/group   |    2 +
 5 files changed, 296 insertions(+)
 create mode 100755 tests/xfs/231
 create mode 100644 tests/xfs/231.out
 create mode 100755 tests/xfs/232
 create mode 100644 tests/xfs/232.out


diff --git a/tests/xfs/231 b/tests/xfs/231
new file mode 100755
index 0000000..3672887
--- /dev/null
+++ b/tests/xfs/231
@@ -0,0 +1,130 @@
+#! /bin/bash
+# FS QA Test No. 231
+#
+# Test recovery of unused CoW reservations:
+# - Create two reflinked files.  Set extsz hint on second file.
+# - Dirty a single byte on a number of CoW reservations in the second file.
+# - Fsync to flush out the dirty pages.
+# - Wait for the reclaim to run.
+# - Write more and see how bad fragmentation is.
+#
+#-----------------------------------------------------------------------
+# 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 /
+    echo $old_cow_lifetime > /proc/sys/fs/xfs/speculative_cow_prealloc_lifetime
+    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_cp_reflink
+_require_fiemap
+
+old_cow_lifetime=$(cat /proc/sys/fs/xfs/speculative_cow_prealloc_lifetime)
+
+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
+
+blksz=65536
+nr=64
+filesize=$((blksz * nr))
+bufnr=2
+bufsize=$((blksz * bufnr))
+
+_require_fs_space $SCRATCH_MNT $((filesize / 1024 * 3 * 5 / 4))
+real_blksz=$(stat -f -c '%S' $testdir)
+internal_blks=$((filesize / real_blksz))
+
+echo "Create the original files"
+$XFS_IO_PROG -c "cowextsize $bufsize" $testdir
+$XFS_IO_PROG -f -c "pwrite -S 0x61 -b $bufsize 0 $filesize" $testdir/file1 >> $seqres.full
+$XFS_IO_PROG -f -c "pwrite -S 0x61 -b $bufsize 0 $filesize" $testdir/file2.chk >> $seqres.full
+_cp_reflink $testdir/file1 $testdir/file2 >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file2 | _filter_scratch
+md5sum $testdir/file2.chk | _filter_scratch
+
+echo "CoW and leave leftovers"
+echo 2 > /proc/sys/fs/xfs/speculative_cow_prealloc_lifetime
+seq 2 2 $((nr - 1)) | while read f; do
+	$XFS_IO_PROG -f -c "pwrite -S 0x63 $((blksz * f - 1)) 1" $testdir/file2 >> $seqres.full
+	$XFS_IO_PROG -f -c "pwrite -S 0x63 $((blksz * f - 1)) 1" $testdir/file2.chk >> $seqres.full
+done
+sync
+
+echo "Wait for CoW expiration"
+sleep 3
+
+echo "Allocate free space"
+for i in $(seq 1 32); do
+	$XFS_IO_PROG -f -c "falloc 0 1" $testdir/junk.$i >> $seqres.full
+done
+$XFS_IO_PROG -f -c "falloc 0 $filesize" $testdir/junk >> $seqres.full
+
+echo "CoW and leave leftovers"
+echo $old_cow_lifetime > /proc/sys/fs/xfs/speculative_cow_prealloc_lifetime
+seq 2 2 $((nr - 1)) | while read f; do
+	$XFS_IO_PROG -f -c "pwrite -S 0x63 $((blksz * f)) 1" $testdir/file2 >> $seqres.full
+	$XFS_IO_PROG -f -c "pwrite -S 0x63 $((blksz * f)) 1" $testdir/file2.chk >> $seqres.full
+done
+sync
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file2 | _filter_scratch
+md5sum $testdir/file2.chk | _filter_scratch
+
+echo "Check extent counts"
+old_extents=$(_count_extents $testdir/file1)
+new_extents=$(_count_extents $testdir/file2)
+
+echo "old extents: $old_extents" >> $seqres.full
+echo "new extents: $new_extents" >> $seqres.full
+echo "maximum extents: $internal_blks" >> $seqres.full
+test $new_extents -lt $((internal_blks / 7)) || echo "file2 badly fragmented"
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/231.out b/tests/xfs/231.out
new file mode 100644
index 0000000..0dcaba3
--- /dev/null
+++ b/tests/xfs/231.out
@@ -0,0 +1,16 @@
+QA output created by 231
+Format and mount
+Create the original files
+Compare files
+bdbcf02ee0aa977795a79d25fcfdccb1  SCRATCH_MNT/test-231/file1
+bdbcf02ee0aa977795a79d25fcfdccb1  SCRATCH_MNT/test-231/file2
+bdbcf02ee0aa977795a79d25fcfdccb1  SCRATCH_MNT/test-231/file2.chk
+CoW and leave leftovers
+Wait for CoW expiration
+Allocate free space
+CoW and leave leftovers
+Compare files
+bdbcf02ee0aa977795a79d25fcfdccb1  SCRATCH_MNT/test-231/file1
+211b0f725e67149d75104a747365eb70  SCRATCH_MNT/test-231/file2
+211b0f725e67149d75104a747365eb70  SCRATCH_MNT/test-231/file2.chk
+Check extent counts
diff --git a/tests/xfs/232 b/tests/xfs/232
new file mode 100755
index 0000000..7219a64
--- /dev/null
+++ b/tests/xfs/232
@@ -0,0 +1,132 @@
+#! /bin/bash
+# FS QA Test No. 232
+#
+# Test non-recovery of unused CoW reservations for dirty files:
+# - Create two reflinked files.  Set extsz hint on second file.
+# - Dirty a single byte on a number of CoW reservations in the second file.
+# - Fsync to flush out the dirty pages.
+# - Dirty a single byte anywhere in the second file.
+# - Wait for the reclaim to run.
+# - Write more and see how bad fragmentation is.
+#
+#-----------------------------------------------------------------------
+# 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 /
+    echo $old_cow_lifetime > /proc/sys/fs/xfs/speculative_cow_prealloc_lifetime
+    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_cp_reflink
+_require_fiemap
+
+old_cow_lifetime=$(cat /proc/sys/fs/xfs/speculative_cow_prealloc_lifetime)
+
+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
+
+blksz=65536
+nr=64
+filesize=$((blksz * nr))
+bufnr=2
+bufsize=$((blksz * bufnr))
+
+_require_fs_space $SCRATCH_MNT $((filesize / 1024 * 3 * 5 / 4))
+real_blksz=$(stat -f -c '%S' $testdir)
+internal_blks=$((filesize / real_blksz))
+
+echo "Create the original files"
+$XFS_IO_PROG -c "cowextsize $bufsize" $testdir
+$XFS_IO_PROG -f -c "pwrite -S 0x61 -b $bufsize 0 $filesize" $testdir/file1 >> $seqres.full
+$XFS_IO_PROG -f -c "pwrite -S 0x61 -b $bufsize 0 $filesize" $testdir/file2.chk >> $seqres.full
+_cp_reflink $testdir/file1 $testdir/file2 >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file2 | _filter_scratch
+md5sum $testdir/file2.chk | _filter_scratch
+
+echo "CoW and leave leftovers"
+echo 2 > /proc/sys/fs/xfs/speculative_cow_prealloc_lifetime
+seq 2 2 $((nr - 1)) | while read f; do
+	$XFS_IO_PROG -f -c "pwrite -S 0x63 $((blksz * f - 1)) 1" $testdir/file2 >> $seqres.full
+	$XFS_IO_PROG -f -c "pwrite -S 0x63 $((blksz * f - 1)) 1" $testdir/file2.chk >> $seqres.full
+done
+sync
+
+echo "Wait for CoW expiration"
+$XFS_IO_PROG -f -c "pwrite -S 0x63 $((blksz * 2)) 1" $testdir/file2 >> $seqres.full
+sleep 3
+
+echo "Allocate free space"
+for i in $(seq 1 32); do
+	$XFS_IO_PROG -f -c "falloc 0 1" $testdir/junk.$i >> $seqres.full
+done
+$XFS_IO_PROG -f -c "falloc 0 $filesize" $testdir/junk >> $seqres.full
+
+echo "CoW and leave leftovers"
+echo $old_cow_lifetime > /proc/sys/fs/xfs/speculative_cow_prealloc_lifetime
+seq 2 2 $((nr - 1)) | while read f; do
+	$XFS_IO_PROG -f -c "pwrite -S 0x63 $((blksz * f)) 1" $testdir/file2 >> $seqres.full
+	$XFS_IO_PROG -f -c "pwrite -S 0x63 $((blksz * f)) 1" $testdir/file2.chk >> $seqres.full
+done
+sync
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file2 | _filter_scratch
+md5sum $testdir/file2.chk | _filter_scratch
+
+echo "Check extent counts"
+old_extents=$(_count_extents $testdir/file1)
+new_extents=$(_count_extents $testdir/file2)
+
+echo "old extents: $old_extents" >> $seqres.full
+echo "new extents: $new_extents" >> $seqres.full
+echo "maximum extents: $internal_blks" >> $seqres.full
+test $new_extents -lt $((internal_blks / 12)) || echo "file2 not sufficiently fragmented"
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/232.out b/tests/xfs/232.out
new file mode 100644
index 0000000..0fb9fb9
--- /dev/null
+++ b/tests/xfs/232.out
@@ -0,0 +1,16 @@
+QA output created by 232
+Format and mount
+Create the original files
+Compare files
+bdbcf02ee0aa977795a79d25fcfdccb1  SCRATCH_MNT/test-232/file1
+bdbcf02ee0aa977795a79d25fcfdccb1  SCRATCH_MNT/test-232/file2
+bdbcf02ee0aa977795a79d25fcfdccb1  SCRATCH_MNT/test-232/file2.chk
+CoW and leave leftovers
+Wait for CoW expiration
+Allocate free space
+CoW and leave leftovers
+Compare files
+bdbcf02ee0aa977795a79d25fcfdccb1  SCRATCH_MNT/test-232/file1
+211b0f725e67149d75104a747365eb70  SCRATCH_MNT/test-232/file2
+211b0f725e67149d75104a747365eb70  SCRATCH_MNT/test-232/file2.chk
+Check extent counts
diff --git a/tests/xfs/group b/tests/xfs/group
index da83274..de3c7d6 100644
--- a/tests/xfs/group
+++ b/tests/xfs/group
@@ -228,6 +228,8 @@
 228 auto quick clone
 229 auto rw
 230 auto quick clone
+231 auto quick clone
+232 auto quick clone
 238 auto quick metadata ioctl
 242 auto quick prealloc
 244 auto quota quick


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

* [PATCH 24/32] xfs: test the automatic cowextsize extent garbage collector
@ 2016-02-11 23:42   ` Darrick J. Wong
  0 siblings, 0 replies; 81+ messages in thread
From: Darrick J. Wong @ 2016-02-11 23:42 UTC (permalink / raw)
  To: david, darrick.wong; +Cc: fstests, linux-btrfs, xfs

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 tests/xfs/231     |  130 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/xfs/231.out |   16 ++++++
 tests/xfs/232     |  132 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/xfs/232.out |   16 ++++++
 tests/xfs/group   |    2 +
 5 files changed, 296 insertions(+)
 create mode 100755 tests/xfs/231
 create mode 100644 tests/xfs/231.out
 create mode 100755 tests/xfs/232
 create mode 100644 tests/xfs/232.out


diff --git a/tests/xfs/231 b/tests/xfs/231
new file mode 100755
index 0000000..3672887
--- /dev/null
+++ b/tests/xfs/231
@@ -0,0 +1,130 @@
+#! /bin/bash
+# FS QA Test No. 231
+#
+# Test recovery of unused CoW reservations:
+# - Create two reflinked files.  Set extsz hint on second file.
+# - Dirty a single byte on a number of CoW reservations in the second file.
+# - Fsync to flush out the dirty pages.
+# - Wait for the reclaim to run.
+# - Write more and see how bad fragmentation is.
+#
+#-----------------------------------------------------------------------
+# 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 /
+    echo $old_cow_lifetime > /proc/sys/fs/xfs/speculative_cow_prealloc_lifetime
+    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_cp_reflink
+_require_fiemap
+
+old_cow_lifetime=$(cat /proc/sys/fs/xfs/speculative_cow_prealloc_lifetime)
+
+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
+
+blksz=65536
+nr=64
+filesize=$((blksz * nr))
+bufnr=2
+bufsize=$((blksz * bufnr))
+
+_require_fs_space $SCRATCH_MNT $((filesize / 1024 * 3 * 5 / 4))
+real_blksz=$(stat -f -c '%S' $testdir)
+internal_blks=$((filesize / real_blksz))
+
+echo "Create the original files"
+$XFS_IO_PROG -c "cowextsize $bufsize" $testdir
+$XFS_IO_PROG -f -c "pwrite -S 0x61 -b $bufsize 0 $filesize" $testdir/file1 >> $seqres.full
+$XFS_IO_PROG -f -c "pwrite -S 0x61 -b $bufsize 0 $filesize" $testdir/file2.chk >> $seqres.full
+_cp_reflink $testdir/file1 $testdir/file2 >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file2 | _filter_scratch
+md5sum $testdir/file2.chk | _filter_scratch
+
+echo "CoW and leave leftovers"
+echo 2 > /proc/sys/fs/xfs/speculative_cow_prealloc_lifetime
+seq 2 2 $((nr - 1)) | while read f; do
+	$XFS_IO_PROG -f -c "pwrite -S 0x63 $((blksz * f - 1)) 1" $testdir/file2 >> $seqres.full
+	$XFS_IO_PROG -f -c "pwrite -S 0x63 $((blksz * f - 1)) 1" $testdir/file2.chk >> $seqres.full
+done
+sync
+
+echo "Wait for CoW expiration"
+sleep 3
+
+echo "Allocate free space"
+for i in $(seq 1 32); do
+	$XFS_IO_PROG -f -c "falloc 0 1" $testdir/junk.$i >> $seqres.full
+done
+$XFS_IO_PROG -f -c "falloc 0 $filesize" $testdir/junk >> $seqres.full
+
+echo "CoW and leave leftovers"
+echo $old_cow_lifetime > /proc/sys/fs/xfs/speculative_cow_prealloc_lifetime
+seq 2 2 $((nr - 1)) | while read f; do
+	$XFS_IO_PROG -f -c "pwrite -S 0x63 $((blksz * f)) 1" $testdir/file2 >> $seqres.full
+	$XFS_IO_PROG -f -c "pwrite -S 0x63 $((blksz * f)) 1" $testdir/file2.chk >> $seqres.full
+done
+sync
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file2 | _filter_scratch
+md5sum $testdir/file2.chk | _filter_scratch
+
+echo "Check extent counts"
+old_extents=$(_count_extents $testdir/file1)
+new_extents=$(_count_extents $testdir/file2)
+
+echo "old extents: $old_extents" >> $seqres.full
+echo "new extents: $new_extents" >> $seqres.full
+echo "maximum extents: $internal_blks" >> $seqres.full
+test $new_extents -lt $((internal_blks / 7)) || echo "file2 badly fragmented"
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/231.out b/tests/xfs/231.out
new file mode 100644
index 0000000..0dcaba3
--- /dev/null
+++ b/tests/xfs/231.out
@@ -0,0 +1,16 @@
+QA output created by 231
+Format and mount
+Create the original files
+Compare files
+bdbcf02ee0aa977795a79d25fcfdccb1  SCRATCH_MNT/test-231/file1
+bdbcf02ee0aa977795a79d25fcfdccb1  SCRATCH_MNT/test-231/file2
+bdbcf02ee0aa977795a79d25fcfdccb1  SCRATCH_MNT/test-231/file2.chk
+CoW and leave leftovers
+Wait for CoW expiration
+Allocate free space
+CoW and leave leftovers
+Compare files
+bdbcf02ee0aa977795a79d25fcfdccb1  SCRATCH_MNT/test-231/file1
+211b0f725e67149d75104a747365eb70  SCRATCH_MNT/test-231/file2
+211b0f725e67149d75104a747365eb70  SCRATCH_MNT/test-231/file2.chk
+Check extent counts
diff --git a/tests/xfs/232 b/tests/xfs/232
new file mode 100755
index 0000000..7219a64
--- /dev/null
+++ b/tests/xfs/232
@@ -0,0 +1,132 @@
+#! /bin/bash
+# FS QA Test No. 232
+#
+# Test non-recovery of unused CoW reservations for dirty files:
+# - Create two reflinked files.  Set extsz hint on second file.
+# - Dirty a single byte on a number of CoW reservations in the second file.
+# - Fsync to flush out the dirty pages.
+# - Dirty a single byte anywhere in the second file.
+# - Wait for the reclaim to run.
+# - Write more and see how bad fragmentation is.
+#
+#-----------------------------------------------------------------------
+# 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 /
+    echo $old_cow_lifetime > /proc/sys/fs/xfs/speculative_cow_prealloc_lifetime
+    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_cp_reflink
+_require_fiemap
+
+old_cow_lifetime=$(cat /proc/sys/fs/xfs/speculative_cow_prealloc_lifetime)
+
+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
+
+blksz=65536
+nr=64
+filesize=$((blksz * nr))
+bufnr=2
+bufsize=$((blksz * bufnr))
+
+_require_fs_space $SCRATCH_MNT $((filesize / 1024 * 3 * 5 / 4))
+real_blksz=$(stat -f -c '%S' $testdir)
+internal_blks=$((filesize / real_blksz))
+
+echo "Create the original files"
+$XFS_IO_PROG -c "cowextsize $bufsize" $testdir
+$XFS_IO_PROG -f -c "pwrite -S 0x61 -b $bufsize 0 $filesize" $testdir/file1 >> $seqres.full
+$XFS_IO_PROG -f -c "pwrite -S 0x61 -b $bufsize 0 $filesize" $testdir/file2.chk >> $seqres.full
+_cp_reflink $testdir/file1 $testdir/file2 >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file2 | _filter_scratch
+md5sum $testdir/file2.chk | _filter_scratch
+
+echo "CoW and leave leftovers"
+echo 2 > /proc/sys/fs/xfs/speculative_cow_prealloc_lifetime
+seq 2 2 $((nr - 1)) | while read f; do
+	$XFS_IO_PROG -f -c "pwrite -S 0x63 $((blksz * f - 1)) 1" $testdir/file2 >> $seqres.full
+	$XFS_IO_PROG -f -c "pwrite -S 0x63 $((blksz * f - 1)) 1" $testdir/file2.chk >> $seqres.full
+done
+sync
+
+echo "Wait for CoW expiration"
+$XFS_IO_PROG -f -c "pwrite -S 0x63 $((blksz * 2)) 1" $testdir/file2 >> $seqres.full
+sleep 3
+
+echo "Allocate free space"
+for i in $(seq 1 32); do
+	$XFS_IO_PROG -f -c "falloc 0 1" $testdir/junk.$i >> $seqres.full
+done
+$XFS_IO_PROG -f -c "falloc 0 $filesize" $testdir/junk >> $seqres.full
+
+echo "CoW and leave leftovers"
+echo $old_cow_lifetime > /proc/sys/fs/xfs/speculative_cow_prealloc_lifetime
+seq 2 2 $((nr - 1)) | while read f; do
+	$XFS_IO_PROG -f -c "pwrite -S 0x63 $((blksz * f)) 1" $testdir/file2 >> $seqres.full
+	$XFS_IO_PROG -f -c "pwrite -S 0x63 $((blksz * f)) 1" $testdir/file2.chk >> $seqres.full
+done
+sync
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file2 | _filter_scratch
+md5sum $testdir/file2.chk | _filter_scratch
+
+echo "Check extent counts"
+old_extents=$(_count_extents $testdir/file1)
+new_extents=$(_count_extents $testdir/file2)
+
+echo "old extents: $old_extents" >> $seqres.full
+echo "new extents: $new_extents" >> $seqres.full
+echo "maximum extents: $internal_blks" >> $seqres.full
+test $new_extents -lt $((internal_blks / 12)) || echo "file2 not sufficiently fragmented"
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/232.out b/tests/xfs/232.out
new file mode 100644
index 0000000..0fb9fb9
--- /dev/null
+++ b/tests/xfs/232.out
@@ -0,0 +1,16 @@
+QA output created by 232
+Format and mount
+Create the original files
+Compare files
+bdbcf02ee0aa977795a79d25fcfdccb1  SCRATCH_MNT/test-232/file1
+bdbcf02ee0aa977795a79d25fcfdccb1  SCRATCH_MNT/test-232/file2
+bdbcf02ee0aa977795a79d25fcfdccb1  SCRATCH_MNT/test-232/file2.chk
+CoW and leave leftovers
+Wait for CoW expiration
+Allocate free space
+CoW and leave leftovers
+Compare files
+bdbcf02ee0aa977795a79d25fcfdccb1  SCRATCH_MNT/test-232/file1
+211b0f725e67149d75104a747365eb70  SCRATCH_MNT/test-232/file2
+211b0f725e67149d75104a747365eb70  SCRATCH_MNT/test-232/file2.chk
+Check extent counts
diff --git a/tests/xfs/group b/tests/xfs/group
index da83274..de3c7d6 100644
--- a/tests/xfs/group
+++ b/tests/xfs/group
@@ -228,6 +228,8 @@
 228 auto quick clone
 229 auto rw
 230 auto quick clone
+231 auto quick clone
+232 auto quick clone
 238 auto quick metadata ioctl
 242 auto quick prealloc
 244 auto quota quick

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

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

* [PATCH 25/32] xfs: test rmapbt functionality
  2016-02-11 23:39 ` Darrick J. Wong
@ 2016-02-11 23:42   ` Darrick J. Wong
  -1 siblings, 0 replies; 81+ messages in thread
From: Darrick J. Wong @ 2016-02-11 23:42 UTC (permalink / raw)
  To: david, darrick.wong; +Cc: linux-btrfs, fstests, xfs

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 common/rc         |   22 +++++++++++
 tests/xfs/233     |   73 ++++++++++++++++++++++++++++++++++++
 tests/xfs/233.out |    5 ++
 tests/xfs/234     |   88 +++++++++++++++++++++++++++++++++++++++++++
 tests/xfs/234.out |    6 +++
 tests/xfs/235     |  108 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/xfs/235.out |   14 +++++++
 tests/xfs/236     |   88 +++++++++++++++++++++++++++++++++++++++++++
 tests/xfs/236.out |    7 +++
 tests/xfs/group   |    4 ++
 10 files changed, 415 insertions(+)
 create mode 100755 tests/xfs/233
 create mode 100644 tests/xfs/233.out
 create mode 100755 tests/xfs/234
 create mode 100644 tests/xfs/234.out
 create mode 100755 tests/xfs/235
 create mode 100644 tests/xfs/235.out
 create mode 100755 tests/xfs/236
 create mode 100644 tests/xfs/236.out


diff --git a/common/rc b/common/rc
index e05df74..7e83d6e 100644
--- a/common/rc
+++ b/common/rc
@@ -3053,6 +3053,28 @@ _require_test_lsattr()
 		_notrun "lsattr not supported by test filesystem type: $FSTYP"
 }
 
+_require_xfs_test_rmapbt()
+{
+	_require_test
+
+	if [ "$(xfs_info "$TEST_DIR" | grep -c "rmapbt=1")" -ne 1 ]; then
+		_notrun "rmapbt not supported by test filesystem type: $FSTYP"
+	fi
+}
+
+_require_xfs_scratch_rmapbt()
+{
+	_require_scratch
+
+	_scratch_mkfs > /dev/null
+	_scratch_mount
+	if [ "$(xfs_info "$SCRATCH_MNT" | grep -c "rmapbt=1")" -ne 1 ]; then
+		_scratch_unmount
+		_notrun "rmapbt not supported by scratch filesystem type: $FSTYP"
+	fi
+	_scratch_unmount
+}
+
 _get_total_inode()
 {
 	if [ -z "$1" ]; then
diff --git a/tests/xfs/233 b/tests/xfs/233
new file mode 100755
index 0000000..f821004
--- /dev/null
+++ b/tests/xfs/233
@@ -0,0 +1,73 @@
+#! /bin/bash
+# FS QA Test No. 233
+#
+# Tests xfs_growfs 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 -f $tmp.*
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+. ./common/xfs
+
+# real QA test starts here
+_supported_os Linux
+_supported_fs xfs
+_require_xfs_scratch_rmapbt
+
+echo "Format and mount"
+_scratch_mkfs_sized $((2 * 4096 * 4096)) > $seqres.full 2>&1
+_scratch_mount >> $seqres.full 2>&1
+
+testdir=$SCRATCH_MNT/test-$seq
+mkdir $testdir
+
+echo "Create the original files"
+blksz="$(stat -f $testdir -c '%S')"
+_pwrite_byte 0x61 0 $((blksz * 14 + 71)) $testdir/original >> $seqres.full
+cp -p $testdir/original $testdir/copy1
+cp -p $testdir/copy1 $testdir/copy2
+
+echo "Grow fs"
+$XFS_GROWFS_PROG $SCRATCH_MNT 2>&1 |  _filter_growfs >> $seqres.full
+_scratch_remount
+
+echo "Create more copies"
+cp -p $testdir/original $testdir/copy3
+
+xfs_info $SCRATCH_MNT >> $seqres.full
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/233.out b/tests/xfs/233.out
new file mode 100644
index 0000000..4a4fc3a
--- /dev/null
+++ b/tests/xfs/233.out
@@ -0,0 +1,5 @@
+QA output created by 233
+Format and mount
+Create the original files
+Grow fs
+Create more copies
diff --git a/tests/xfs/234 b/tests/xfs/234
new file mode 100755
index 0000000..649cb7e
--- /dev/null
+++ b/tests/xfs/234
@@ -0,0 +1,88 @@
+#! /bin/bash
+# FS QA Test No. 234
+#
+# Ensure that we can create enough distinct rmap entries to force creation
+# of a multi-level rmap btree, and that metadump will successfully copy
+# said block.
+#
+#-----------------------------------------------------------------------
+# 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 /
+    umount $SCRATCH_MNT > /dev/null 2>&1
+    rm -rf $tmp.* $metadump_file $TEST_DIR/image
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+. ./common/xfs
+
+# real QA test starts here
+_supported_os Linux
+_supported_fs xfs
+_require_loop
+_require_xfs_scratch_rmapbt
+_require_xfs_io_command "fpunch"
+
+rm -f $seqres.full
+
+_scratch_mkfs >/dev/null 2>&1
+_scratch_mount
+
+testdir=$SCRATCH_MNT/test-$seq
+mkdir $testdir
+metadump_file=$TEST_DIR/${seq}_metadump
+
+echo "Create the original file blocks"
+blksz="$(stat -f $testdir -c '%S')"
+nr_blks=$((4 * blksz / 12))
+_pwrite_byte 0x61 0 $((blksz * nr_blks)) $testdir/file1 >> $seqres.full
+sync
+
+echo "Punch every other block"
+seq 1 2 $((nr_blks - 1)) | while read nr; do
+	$XFS_IO_PROG -c "fpunch $((nr * blksz)) $blksz" $testdir/file1 >> $seqres.full
+done
+
+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
+_mount -t $FSTYP $TEST_DIR/image $SCRATCH_MNT
+umount $SCRATCH_MNT
+
+echo "Check restored fs"
+_check_generic_filesystem $metadump_file
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/234.out b/tests/xfs/234.out
new file mode 100644
index 0000000..463d466
--- /dev/null
+++ b/tests/xfs/234.out
@@ -0,0 +1,6 @@
+QA output created by 234
+Create the original file blocks
+Punch every other block
+Create metadump file
+Restore metadump
+Check restored fs
diff --git a/tests/xfs/235 b/tests/xfs/235
new file mode 100755
index 0000000..5af72a6
--- /dev/null
+++ b/tests/xfs/235
@@ -0,0 +1,108 @@
+#! /bin/bash
+# FS QA Test No. 235
+#
+# Create and populate an XFS filesystem, corrupt the rmap btree,
+# then see how the kernel and xfs_repair deal with it.
+#
+#-----------------------------------------------------------------------
+# 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-7031  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 -f $tmp.*
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+. ./common/attr
+. ./common/xfs
+
+# real QA test starts here
+_supported_os Linux
+_supported_fs xfs
+_require_xfs_scratch_rmapbt
+test -n ${FORCE_FUZZ} || _require_scratch_xfs_crc
+
+rm -f $seqres.full
+
+echo "+ create scratch fs"
+_scratch_mkfs_xfs > /dev/null
+
+echo "+ mount fs image"
+_scratch_mount
+blksz=$(stat -f -c '%s' ${SCRATCH_MNT})
+agcount=$(xfs_info ${SCRATCH_MNT} | grep agcount= | sed -e 's/^.*agcount=\([0-9]*\),.*$/\1/g')
+
+echo "+ make some files"
+_pwrite_byte 0x62 0 $((blksz * 64)) ${SCRATCH_MNT}/file0 >> $seqres.full
+_pwrite_byte 0x61 0 $((blksz * 64)) ${SCRATCH_MNT}/file1 >> $seqres.full
+cp -p ${SCRATCH_MNT}/file0 ${SCRATCH_MNT}/file2
+cp -p ${SCRATCH_MNT}/file1 ${SCRATCH_MNT}/file3
+umount ${SCRATCH_MNT}
+
+echo "+ check fs"
+_scratch_xfs_repair -n >> $seqres.full 2>&1 || \
+	_fail "xfs_repair should not fail"
+
+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
+done
+
+echo "+ mount image"
+_scratch_mount
+
+echo "+ copy more"
+$XFS_IO_PROG -f -c "pwrite -S 0x63 0 $((blksz * 64))" -c "fsync" ${SCRATCH_MNT}/file4 >> $seqres.full
+test -s ${SCRATCH_MNT}/file4 || _fail "should not be able to copy with busted rmap btree"
+umount ${SCRATCH_MNT}
+
+echo "+ repair fs"
+_scratch_xfs_repair >> $seqres.full 2>&1
+_scratch_xfs_repair >> $seqres.full 2>&1
+
+echo "+ mount image (2)"
+_scratch_mount
+
+echo "+ chattr -R -i"
+chattr -R -f -i ${SCRATCH_MNT}/
+
+echo "+ copy more (2)"
+cp -p ${SCRATCH_MNT}/file1 ${SCRATCH_MNT}/file5 || \
+	_fail "modified rmap tree"
+umount ${SCRATCH_MNT}
+
+echo "+ check fs (2)"
+_scratch_xfs_repair -n >> $seqres.full 2>&1 || \
+	_fail "xfs_repair should not fail"
+
+status=0
+exit
diff --git a/tests/xfs/235.out b/tests/xfs/235.out
new file mode 100644
index 0000000..89a11d6
--- /dev/null
+++ b/tests/xfs/235.out
@@ -0,0 +1,14 @@
+QA output created by 235
++ create scratch fs
++ mount fs image
++ make some files
++ check fs
++ corrupt image
++ mount image
++ copy more
+fsync: Structure needs cleaning
++ repair fs
++ mount image (2)
++ chattr -R -i
++ copy more (2)
++ check fs (2)
diff --git a/tests/xfs/236 b/tests/xfs/236
new file mode 100755
index 0000000..99e9a75
--- /dev/null
+++ b/tests/xfs/236
@@ -0,0 +1,88 @@
+#! /bin/bash
+# FS QA Test No. 236
+#
+# Ensure that we can create enough distinct rmapbt entries to force creation
+# of a multi-level rmap btree.  Delete and recreate a few times to
+# exercise the rmap btree grow/shrink functions.
+#
+#-----------------------------------------------------------------------
+# 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 /
+    umount $SCRATCH_MNT > /dev/null 2>&1
+    rm -rf $tmp.*
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+. ./common/xfs
+
+# real QA test starts here
+_supported_os Linux
+_supported_fs xfs
+_require_xfs_scratch_rmapbt
+_require_xfs_io_command "fpunch"
+
+rm -f $seqres.full
+
+_scratch_mkfs >/dev/null 2>&1
+_scratch_mount
+
+testdir=$SCRATCH_MNT/test-$seq
+mkdir $testdir
+
+echo "Create the original file blocks"
+blksz="$(stat -f $testdir -c '%S')"
+nr_blks=$((8 * blksz / 12))
+
+for i in 1 2 x; do
+	_pwrite_byte 0x61 0 $((blksz * nr_blks)) $testdir/file1 >> $seqres.full
+	_pwrite_byte 0x62 0 $((blksz * nr_blks)) $testdir/file2 >> $seqres.full
+	sync
+
+	echo "$i: Reflink every other block"
+	seq 1 2 $((nr_blks - 1)) | while read nr; do
+		$XFS_IO_PROG -c "fpunch $((nr * blksz)) $blksz" $testdir/file2 >> $seqres.full
+	done
+	umount $SCRATCH_MNT
+	_check_scratch_fs
+	_scratch_mount
+
+	test $i = "x" && break
+
+	echo "$i: Delete both files"
+	rm -rf $testdir/file1 $testdir/file2
+	umount $SCRATCH_MNT
+	_check_scratch_fs
+	_scratch_mount
+done
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/236.out b/tests/xfs/236.out
new file mode 100644
index 0000000..272246d
--- /dev/null
+++ b/tests/xfs/236.out
@@ -0,0 +1,7 @@
+QA output created by 236
+Create the original file blocks
+1: Reflink every other block
+1: Delete both files
+2: Reflink every other block
+2: Delete both files
+x: Reflink every other block
diff --git a/tests/xfs/group b/tests/xfs/group
index de3c7d6..1d08065 100644
--- a/tests/xfs/group
+++ b/tests/xfs/group
@@ -230,6 +230,10 @@
 230 auto quick clone
 231 auto quick clone
 232 auto quick clone
+233 auto quick rmap
+234 auto quick rmap
+235 fuzzers rmap
+236 auto quick rmap
 238 auto quick metadata ioctl
 242 auto quick prealloc
 244 auto quota quick


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

* [PATCH 25/32] xfs: test rmapbt functionality
@ 2016-02-11 23:42   ` Darrick J. Wong
  0 siblings, 0 replies; 81+ messages in thread
From: Darrick J. Wong @ 2016-02-11 23:42 UTC (permalink / raw)
  To: david, darrick.wong; +Cc: fstests, linux-btrfs, xfs

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 common/rc         |   22 +++++++++++
 tests/xfs/233     |   73 ++++++++++++++++++++++++++++++++++++
 tests/xfs/233.out |    5 ++
 tests/xfs/234     |   88 +++++++++++++++++++++++++++++++++++++++++++
 tests/xfs/234.out |    6 +++
 tests/xfs/235     |  108 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/xfs/235.out |   14 +++++++
 tests/xfs/236     |   88 +++++++++++++++++++++++++++++++++++++++++++
 tests/xfs/236.out |    7 +++
 tests/xfs/group   |    4 ++
 10 files changed, 415 insertions(+)
 create mode 100755 tests/xfs/233
 create mode 100644 tests/xfs/233.out
 create mode 100755 tests/xfs/234
 create mode 100644 tests/xfs/234.out
 create mode 100755 tests/xfs/235
 create mode 100644 tests/xfs/235.out
 create mode 100755 tests/xfs/236
 create mode 100644 tests/xfs/236.out


diff --git a/common/rc b/common/rc
index e05df74..7e83d6e 100644
--- a/common/rc
+++ b/common/rc
@@ -3053,6 +3053,28 @@ _require_test_lsattr()
 		_notrun "lsattr not supported by test filesystem type: $FSTYP"
 }
 
+_require_xfs_test_rmapbt()
+{
+	_require_test
+
+	if [ "$(xfs_info "$TEST_DIR" | grep -c "rmapbt=1")" -ne 1 ]; then
+		_notrun "rmapbt not supported by test filesystem type: $FSTYP"
+	fi
+}
+
+_require_xfs_scratch_rmapbt()
+{
+	_require_scratch
+
+	_scratch_mkfs > /dev/null
+	_scratch_mount
+	if [ "$(xfs_info "$SCRATCH_MNT" | grep -c "rmapbt=1")" -ne 1 ]; then
+		_scratch_unmount
+		_notrun "rmapbt not supported by scratch filesystem type: $FSTYP"
+	fi
+	_scratch_unmount
+}
+
 _get_total_inode()
 {
 	if [ -z "$1" ]; then
diff --git a/tests/xfs/233 b/tests/xfs/233
new file mode 100755
index 0000000..f821004
--- /dev/null
+++ b/tests/xfs/233
@@ -0,0 +1,73 @@
+#! /bin/bash
+# FS QA Test No. 233
+#
+# Tests xfs_growfs 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 -f $tmp.*
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+. ./common/xfs
+
+# real QA test starts here
+_supported_os Linux
+_supported_fs xfs
+_require_xfs_scratch_rmapbt
+
+echo "Format and mount"
+_scratch_mkfs_sized $((2 * 4096 * 4096)) > $seqres.full 2>&1
+_scratch_mount >> $seqres.full 2>&1
+
+testdir=$SCRATCH_MNT/test-$seq
+mkdir $testdir
+
+echo "Create the original files"
+blksz="$(stat -f $testdir -c '%S')"
+_pwrite_byte 0x61 0 $((blksz * 14 + 71)) $testdir/original >> $seqres.full
+cp -p $testdir/original $testdir/copy1
+cp -p $testdir/copy1 $testdir/copy2
+
+echo "Grow fs"
+$XFS_GROWFS_PROG $SCRATCH_MNT 2>&1 |  _filter_growfs >> $seqres.full
+_scratch_remount
+
+echo "Create more copies"
+cp -p $testdir/original $testdir/copy3
+
+xfs_info $SCRATCH_MNT >> $seqres.full
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/233.out b/tests/xfs/233.out
new file mode 100644
index 0000000..4a4fc3a
--- /dev/null
+++ b/tests/xfs/233.out
@@ -0,0 +1,5 @@
+QA output created by 233
+Format and mount
+Create the original files
+Grow fs
+Create more copies
diff --git a/tests/xfs/234 b/tests/xfs/234
new file mode 100755
index 0000000..649cb7e
--- /dev/null
+++ b/tests/xfs/234
@@ -0,0 +1,88 @@
+#! /bin/bash
+# FS QA Test No. 234
+#
+# Ensure that we can create enough distinct rmap entries to force creation
+# of a multi-level rmap btree, and that metadump will successfully copy
+# said block.
+#
+#-----------------------------------------------------------------------
+# 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 /
+    umount $SCRATCH_MNT > /dev/null 2>&1
+    rm -rf $tmp.* $metadump_file $TEST_DIR/image
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+. ./common/xfs
+
+# real QA test starts here
+_supported_os Linux
+_supported_fs xfs
+_require_loop
+_require_xfs_scratch_rmapbt
+_require_xfs_io_command "fpunch"
+
+rm -f $seqres.full
+
+_scratch_mkfs >/dev/null 2>&1
+_scratch_mount
+
+testdir=$SCRATCH_MNT/test-$seq
+mkdir $testdir
+metadump_file=$TEST_DIR/${seq}_metadump
+
+echo "Create the original file blocks"
+blksz="$(stat -f $testdir -c '%S')"
+nr_blks=$((4 * blksz / 12))
+_pwrite_byte 0x61 0 $((blksz * nr_blks)) $testdir/file1 >> $seqres.full
+sync
+
+echo "Punch every other block"
+seq 1 2 $((nr_blks - 1)) | while read nr; do
+	$XFS_IO_PROG -c "fpunch $((nr * blksz)) $blksz" $testdir/file1 >> $seqres.full
+done
+
+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
+_mount -t $FSTYP $TEST_DIR/image $SCRATCH_MNT
+umount $SCRATCH_MNT
+
+echo "Check restored fs"
+_check_generic_filesystem $metadump_file
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/234.out b/tests/xfs/234.out
new file mode 100644
index 0000000..463d466
--- /dev/null
+++ b/tests/xfs/234.out
@@ -0,0 +1,6 @@
+QA output created by 234
+Create the original file blocks
+Punch every other block
+Create metadump file
+Restore metadump
+Check restored fs
diff --git a/tests/xfs/235 b/tests/xfs/235
new file mode 100755
index 0000000..5af72a6
--- /dev/null
+++ b/tests/xfs/235
@@ -0,0 +1,108 @@
+#! /bin/bash
+# FS QA Test No. 235
+#
+# Create and populate an XFS filesystem, corrupt the rmap btree,
+# then see how the kernel and xfs_repair deal with it.
+#
+#-----------------------------------------------------------------------
+# 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-7031  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 -f $tmp.*
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+. ./common/attr
+. ./common/xfs
+
+# real QA test starts here
+_supported_os Linux
+_supported_fs xfs
+_require_xfs_scratch_rmapbt
+test -n ${FORCE_FUZZ} || _require_scratch_xfs_crc
+
+rm -f $seqres.full
+
+echo "+ create scratch fs"
+_scratch_mkfs_xfs > /dev/null
+
+echo "+ mount fs image"
+_scratch_mount
+blksz=$(stat -f -c '%s' ${SCRATCH_MNT})
+agcount=$(xfs_info ${SCRATCH_MNT} | grep agcount= | sed -e 's/^.*agcount=\([0-9]*\),.*$/\1/g')
+
+echo "+ make some files"
+_pwrite_byte 0x62 0 $((blksz * 64)) ${SCRATCH_MNT}/file0 >> $seqres.full
+_pwrite_byte 0x61 0 $((blksz * 64)) ${SCRATCH_MNT}/file1 >> $seqres.full
+cp -p ${SCRATCH_MNT}/file0 ${SCRATCH_MNT}/file2
+cp -p ${SCRATCH_MNT}/file1 ${SCRATCH_MNT}/file3
+umount ${SCRATCH_MNT}
+
+echo "+ check fs"
+_scratch_xfs_repair -n >> $seqres.full 2>&1 || \
+	_fail "xfs_repair should not fail"
+
+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
+done
+
+echo "+ mount image"
+_scratch_mount
+
+echo "+ copy more"
+$XFS_IO_PROG -f -c "pwrite -S 0x63 0 $((blksz * 64))" -c "fsync" ${SCRATCH_MNT}/file4 >> $seqres.full
+test -s ${SCRATCH_MNT}/file4 || _fail "should not be able to copy with busted rmap btree"
+umount ${SCRATCH_MNT}
+
+echo "+ repair fs"
+_scratch_xfs_repair >> $seqres.full 2>&1
+_scratch_xfs_repair >> $seqres.full 2>&1
+
+echo "+ mount image (2)"
+_scratch_mount
+
+echo "+ chattr -R -i"
+chattr -R -f -i ${SCRATCH_MNT}/
+
+echo "+ copy more (2)"
+cp -p ${SCRATCH_MNT}/file1 ${SCRATCH_MNT}/file5 || \
+	_fail "modified rmap tree"
+umount ${SCRATCH_MNT}
+
+echo "+ check fs (2)"
+_scratch_xfs_repair -n >> $seqres.full 2>&1 || \
+	_fail "xfs_repair should not fail"
+
+status=0
+exit
diff --git a/tests/xfs/235.out b/tests/xfs/235.out
new file mode 100644
index 0000000..89a11d6
--- /dev/null
+++ b/tests/xfs/235.out
@@ -0,0 +1,14 @@
+QA output created by 235
++ create scratch fs
++ mount fs image
++ make some files
++ check fs
++ corrupt image
++ mount image
++ copy more
+fsync: Structure needs cleaning
++ repair fs
++ mount image (2)
++ chattr -R -i
++ copy more (2)
++ check fs (2)
diff --git a/tests/xfs/236 b/tests/xfs/236
new file mode 100755
index 0000000..99e9a75
--- /dev/null
+++ b/tests/xfs/236
@@ -0,0 +1,88 @@
+#! /bin/bash
+# FS QA Test No. 236
+#
+# Ensure that we can create enough distinct rmapbt entries to force creation
+# of a multi-level rmap btree.  Delete and recreate a few times to
+# exercise the rmap btree grow/shrink functions.
+#
+#-----------------------------------------------------------------------
+# 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 /
+    umount $SCRATCH_MNT > /dev/null 2>&1
+    rm -rf $tmp.*
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+. ./common/xfs
+
+# real QA test starts here
+_supported_os Linux
+_supported_fs xfs
+_require_xfs_scratch_rmapbt
+_require_xfs_io_command "fpunch"
+
+rm -f $seqres.full
+
+_scratch_mkfs >/dev/null 2>&1
+_scratch_mount
+
+testdir=$SCRATCH_MNT/test-$seq
+mkdir $testdir
+
+echo "Create the original file blocks"
+blksz="$(stat -f $testdir -c '%S')"
+nr_blks=$((8 * blksz / 12))
+
+for i in 1 2 x; do
+	_pwrite_byte 0x61 0 $((blksz * nr_blks)) $testdir/file1 >> $seqres.full
+	_pwrite_byte 0x62 0 $((blksz * nr_blks)) $testdir/file2 >> $seqres.full
+	sync
+
+	echo "$i: Reflink every other block"
+	seq 1 2 $((nr_blks - 1)) | while read nr; do
+		$XFS_IO_PROG -c "fpunch $((nr * blksz)) $blksz" $testdir/file2 >> $seqres.full
+	done
+	umount $SCRATCH_MNT
+	_check_scratch_fs
+	_scratch_mount
+
+	test $i = "x" && break
+
+	echo "$i: Delete both files"
+	rm -rf $testdir/file1 $testdir/file2
+	umount $SCRATCH_MNT
+	_check_scratch_fs
+	_scratch_mount
+done
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/236.out b/tests/xfs/236.out
new file mode 100644
index 0000000..272246d
--- /dev/null
+++ b/tests/xfs/236.out
@@ -0,0 +1,7 @@
+QA output created by 236
+Create the original file blocks
+1: Reflink every other block
+1: Delete both files
+2: Reflink every other block
+2: Delete both files
+x: Reflink every other block
diff --git a/tests/xfs/group b/tests/xfs/group
index de3c7d6..1d08065 100644
--- a/tests/xfs/group
+++ b/tests/xfs/group
@@ -230,6 +230,10 @@
 230 auto quick clone
 231 auto quick clone
 232 auto quick clone
+233 auto quick rmap
+234 auto quick rmap
+235 fuzzers rmap
+236 auto quick rmap
 238 auto quick metadata ioctl
 242 auto quick prealloc
 244 auto quota quick

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

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

* [PATCH 26/32] reflink: test aio copy on write
  2016-02-11 23:39 ` Darrick J. Wong
@ 2016-02-11 23:42   ` Darrick J. Wong
  -1 siblings, 0 replies; 81+ messages in thread
From: Darrick J. Wong @ 2016-02-11 23:42 UTC (permalink / raw)
  To: david, darrick.wong; +Cc: linux-btrfs, fstests, xfs

Make sure that copy on write works with the AIO path.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 tests/generic/329     |  102 ++++++++++++++++++++++++++++++++++++++++++++++++
 tests/generic/329.out |   12 ++++++
 tests/generic/330     |   93 ++++++++++++++++++++++++++++++++++++++++++++
 tests/generic/330.out |   11 +++++
 tests/generic/331     |  104 +++++++++++++++++++++++++++++++++++++++++++++++++
 tests/generic/331.out |   12 ++++++
 tests/generic/332     |   94 ++++++++++++++++++++++++++++++++++++++++++++
 tests/generic/332.out |   11 +++++
 tests/generic/group   |    4 ++
 9 files changed, 443 insertions(+)
 create mode 100755 tests/generic/329
 create mode 100644 tests/generic/329.out
 create mode 100755 tests/generic/330
 create mode 100644 tests/generic/330.out
 create mode 100755 tests/generic/331
 create mode 100644 tests/generic/331.out
 create mode 100755 tests/generic/332
 create mode 100644 tests/generic/332.out


diff --git a/tests/generic/329 b/tests/generic/329
new file mode 100755
index 0000000..3991672
--- /dev/null
+++ b/tests/generic/329
@@ -0,0 +1,102 @@
+#! /bin/bash
+# FS QA Test No. 329
+#
+# Test AIO DIO CoW behavior when the write temporarily fails.
+#
+#-----------------------------------------------------------------------
+# 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/moo
+    _dmerror_cleanup
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+. ./common/reflink
+. ./common/dmerror
+
+# real QA test starts here
+_supported_os Linux
+_require_scratch_reflink
+_require_cp_reflink
+_require_dm_target error
+_require_aiodio "aiocp"
+
+rm -f $seqres.full
+
+
+echo "Format and mount"
+_scratch_mkfs > $seqres.full 2>&1
+_dmerror_init
+_dmerror_mount >> $seqres.full 2>&1
+
+testdir=$SCRATCH_MNT/test-$seq
+mkdir $testdir
+
+blksz=65536
+nr=640
+bufnr=128
+filesize=$((blksz * nr))
+bufsize=$((blksz * bufnr))
+
+_require_fs_space $SCRATCH_MNT $((filesize / 1024 * 3 * 5 / 4))
+
+echo "Create the original files"
+$XFS_IO_PROG -f -c "pwrite -S 0x61 -b $bufsize 0 $filesize" $testdir/file1 >> $seqres.full
+_cp_reflink $testdir/file1 $testdir/file2 >> $seqres.full
+_dmerror_unmount
+_dmerror_mount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file2 | _filter_scratch
+
+echo "CoW and unmount"
+$XFS_IO_PROG -f -c "pwrite -S 0x63 $bufsize 1" $testdir/file2 >> $seqres.full
+$XFS_IO_PROG -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" $TEST_DIR/moo >> $seqres.full
+sync
+_dmerror_load_error_table
+$AIO_TEST -f DIRECT -b $bufsize $TEST_DIR/moo $testdir/file2 >> $seqres.full
+_dmerror_load_working_table
+_dmerror_unmount
+_dmerror_mount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file2 | _filter_scratch
+
+echo "Check for damage"
+_dmerror_unmount
+_dmerror_cleanup
+_repair_scratch_fs >> $seqres.full
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/329.out b/tests/generic/329.out
new file mode 100644
index 0000000..f14726c
--- /dev/null
+++ b/tests/generic/329.out
@@ -0,0 +1,12 @@
+QA output created by 329
+Format and mount
+Create the original files
+Compare files
+1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-329/file1
+1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-329/file2
+CoW and unmount
+write missed bytes expect 8388608 got 0
+Compare files
+1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-329/file1
+d94b0ab13385aba594411c174b1cc13c  SCRATCH_MNT/test-329/file2
+Check for damage
diff --git a/tests/generic/330 b/tests/generic/330
new file mode 100755
index 0000000..377d822
--- /dev/null
+++ b/tests/generic/330
@@ -0,0 +1,93 @@
+#! /bin/bash
+# FS QA Test No. 330
+#
+# Test AIO DIO CoW behavior.
+#
+#-----------------------------------------------------------------------
+# 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/moo
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+. ./common/reflink
+
+# real QA test starts here
+_supported_os Linux
+_require_scratch_reflink
+_require_cp_reflink
+_require_aiodio "aiocp"
+
+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
+
+blksz=65536
+nr=640
+bufnr=128
+filesize=$((blksz * nr))
+bufsize=$((blksz * bufnr))
+
+_require_fs_space $SCRATCH_MNT $((filesize / 1024 * 3 * 5 / 4))
+
+echo "Create the original files"
+$XFS_IO_PROG -f -c "pwrite -S 0x61 -b $bufsize 0 $filesize" $testdir/file1 >> $seqres.full
+_cp_reflink $testdir/file1 $testdir/file2 >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file2 | _filter_scratch
+
+echo "CoW and unmount"
+$XFS_IO_PROG -f -c "pwrite -S 0x63 $bufsize 1" $testdir/file2 >> $seqres.full
+sync
+$XFS_IO_PROG -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" $TEST_DIR/moo >> $seqres.full
+$AIO_TEST -f DIRECT -b $bufsize $TEST_DIR/moo $testdir/file2 >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file2 | _filter_scratch
+
+echo "Check for damage"
+umount $SCRATCH_MNT
+_repair_scratch_fs >> $seqres.full
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/330.out b/tests/generic/330.out
new file mode 100644
index 0000000..9a33a22
--- /dev/null
+++ b/tests/generic/330.out
@@ -0,0 +1,11 @@
+QA output created by 330
+Format and mount
+Create the original files
+Compare files
+1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-330/file1
+1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-330/file2
+CoW and unmount
+Compare files
+1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-330/file1
+7a4d22297e80ff3c92cb1b3e4566d234  SCRATCH_MNT/test-330/file2
+Check for damage
diff --git a/tests/generic/331 b/tests/generic/331
new file mode 100755
index 0000000..8d8fd6a
--- /dev/null
+++ b/tests/generic/331
@@ -0,0 +1,104 @@
+#! /bin/bash
+# FS QA Test No. 331
+#
+# Test AIO CoW behavior when the write temporarily fails.
+#
+#-----------------------------------------------------------------------
+# 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/moo
+    _dmerror_cleanup
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+. ./common/reflink
+. ./common/dmerror
+
+# real QA test starts here
+_supported_os Linux
+_require_scratch_reflink
+_require_cp_reflink
+_require_dm_target error
+_require_test_program "aio-dio-regress/aiocp"
+AIO_TEST="src/aio-dio-regress/aiocp"
+
+rm -f $seqres.full
+
+
+echo "Format and mount"
+_scratch_mkfs > $seqres.full 2>&1
+_dmerror_init
+_dmerror_mount >> $seqres.full 2>&1
+
+testdir=$SCRATCH_MNT/test-$seq
+mkdir $testdir
+
+blksz=65536
+nr=640
+bufnr=128
+filesize=$((blksz * nr))
+bufsize=$((blksz * bufnr))
+
+_require_fs_space $SCRATCH_MNT $((filesize / 1024 * 3 * 5 / 4))
+
+echo "Create the original files"
+$XFS_IO_PROG -f -c "pwrite -S 0x61 -b $bufsize 0 $filesize" $testdir/file1 >> $seqres.full
+_cp_reflink $testdir/file1 $testdir/file2 >> $seqres.full
+_dmerror_unmount
+_dmerror_mount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file2 | _filter_scratch
+
+echo "CoW and unmount"
+$XFS_IO_PROG -f -c "pwrite -S 0x63 $bufsize 1" $testdir/file2 >> $seqres.full
+$XFS_IO_PROG -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" $TEST_DIR/moo >> $seqres.full
+sync
+_dmerror_load_error_table
+$AIO_TEST -b $bufsize $TEST_DIR/moo $testdir/file2 >> $seqres.full
+$XFS_IO_PROG -c "fdatasync" $testdir/file2
+_dmerror_load_working_table
+_dmerror_unmount
+_dmerror_mount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file2 | _filter_scratch
+
+echo "Check for damage"
+_dmerror_unmount
+_dmerror_cleanup
+_repair_scratch_fs >> $seqres.full
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/331.out b/tests/generic/331.out
new file mode 100644
index 0000000..adbf841
--- /dev/null
+++ b/tests/generic/331.out
@@ -0,0 +1,12 @@
+QA output created by 331
+Format and mount
+Create the original files
+Compare files
+1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-331/file1
+1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-331/file2
+CoW and unmount
+fdatasync: Input/output error
+Compare files
+1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-331/file1
+d94b0ab13385aba594411c174b1cc13c  SCRATCH_MNT/test-331/file2
+Check for damage
diff --git a/tests/generic/332 b/tests/generic/332
new file mode 100755
index 0000000..f9b5f6f
--- /dev/null
+++ b/tests/generic/332
@@ -0,0 +1,94 @@
+#! /bin/bash
+# FS QA Test No. 332
+#
+# Test AIO CoW behavior.
+#
+#-----------------------------------------------------------------------
+# 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/moo
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+. ./common/reflink
+
+# real QA test starts here
+_supported_os Linux
+_require_scratch_reflink
+_require_cp_reflink
+_require_test_program "aio-dio-regress/aiocp"
+AIO_TEST="src/aio-dio-regress/aiocp"
+
+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
+
+blksz=65536
+nr=640
+bufnr=128
+filesize=$((blksz * nr))
+bufsize=$((blksz * bufnr))
+
+_require_fs_space $SCRATCH_MNT $((filesize / 1024 * 3 * 5 / 4))
+
+echo "Create the original files"
+$XFS_IO_PROG -f -c "pwrite -S 0x61 -b $bufsize 0 $filesize" $testdir/file1 >> $seqres.full
+_cp_reflink $testdir/file1 $testdir/file2 >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file2 | _filter_scratch
+
+echo "CoW and unmount"
+$XFS_IO_PROG -f -c "pwrite -S 0x63 $bufsize 1" $testdir/file2 >> $seqres.full
+$XFS_IO_PROG -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" $TEST_DIR/moo >> $seqres.full
+sync
+$AIO_TEST -b $bufsize $TEST_DIR/moo $testdir/file2 >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file2 | _filter_scratch
+
+echo "Check for damage"
+umount $SCRATCH_MNT
+_repair_scratch_fs >> $seqres.full
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/332.out b/tests/generic/332.out
new file mode 100644
index 0000000..b584b1e
--- /dev/null
+++ b/tests/generic/332.out
@@ -0,0 +1,11 @@
+QA output created by 332
+Format and mount
+Create the original files
+Compare files
+1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-332/file1
+1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-332/file2
+CoW and unmount
+Compare files
+1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-332/file1
+7a4d22297e80ff3c92cb1b3e4566d234  SCRATCH_MNT/test-332/file2
+Check for damage
diff --git a/tests/generic/group b/tests/generic/group
index 8b9e0e5..e7ed475 100644
--- a/tests/generic/group
+++ b/tests/generic/group
@@ -331,3 +331,7 @@
 326 auto quick clone
 327 auto quick clone
 328 auto quick clone
+329 auto quick clone
+330 auto quick clone
+331 auto quick clone
+332 auto quick clone


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

* [PATCH 26/32] reflink: test aio copy on write
@ 2016-02-11 23:42   ` Darrick J. Wong
  0 siblings, 0 replies; 81+ messages in thread
From: Darrick J. Wong @ 2016-02-11 23:42 UTC (permalink / raw)
  To: david, darrick.wong; +Cc: fstests, linux-btrfs, xfs

Make sure that copy on write works with the AIO path.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 tests/generic/329     |  102 ++++++++++++++++++++++++++++++++++++++++++++++++
 tests/generic/329.out |   12 ++++++
 tests/generic/330     |   93 ++++++++++++++++++++++++++++++++++++++++++++
 tests/generic/330.out |   11 +++++
 tests/generic/331     |  104 +++++++++++++++++++++++++++++++++++++++++++++++++
 tests/generic/331.out |   12 ++++++
 tests/generic/332     |   94 ++++++++++++++++++++++++++++++++++++++++++++
 tests/generic/332.out |   11 +++++
 tests/generic/group   |    4 ++
 9 files changed, 443 insertions(+)
 create mode 100755 tests/generic/329
 create mode 100644 tests/generic/329.out
 create mode 100755 tests/generic/330
 create mode 100644 tests/generic/330.out
 create mode 100755 tests/generic/331
 create mode 100644 tests/generic/331.out
 create mode 100755 tests/generic/332
 create mode 100644 tests/generic/332.out


diff --git a/tests/generic/329 b/tests/generic/329
new file mode 100755
index 0000000..3991672
--- /dev/null
+++ b/tests/generic/329
@@ -0,0 +1,102 @@
+#! /bin/bash
+# FS QA Test No. 329
+#
+# Test AIO DIO CoW behavior when the write temporarily fails.
+#
+#-----------------------------------------------------------------------
+# 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/moo
+    _dmerror_cleanup
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+. ./common/reflink
+. ./common/dmerror
+
+# real QA test starts here
+_supported_os Linux
+_require_scratch_reflink
+_require_cp_reflink
+_require_dm_target error
+_require_aiodio "aiocp"
+
+rm -f $seqres.full
+
+
+echo "Format and mount"
+_scratch_mkfs > $seqres.full 2>&1
+_dmerror_init
+_dmerror_mount >> $seqres.full 2>&1
+
+testdir=$SCRATCH_MNT/test-$seq
+mkdir $testdir
+
+blksz=65536
+nr=640
+bufnr=128
+filesize=$((blksz * nr))
+bufsize=$((blksz * bufnr))
+
+_require_fs_space $SCRATCH_MNT $((filesize / 1024 * 3 * 5 / 4))
+
+echo "Create the original files"
+$XFS_IO_PROG -f -c "pwrite -S 0x61 -b $bufsize 0 $filesize" $testdir/file1 >> $seqres.full
+_cp_reflink $testdir/file1 $testdir/file2 >> $seqres.full
+_dmerror_unmount
+_dmerror_mount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file2 | _filter_scratch
+
+echo "CoW and unmount"
+$XFS_IO_PROG -f -c "pwrite -S 0x63 $bufsize 1" $testdir/file2 >> $seqres.full
+$XFS_IO_PROG -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" $TEST_DIR/moo >> $seqres.full
+sync
+_dmerror_load_error_table
+$AIO_TEST -f DIRECT -b $bufsize $TEST_DIR/moo $testdir/file2 >> $seqres.full
+_dmerror_load_working_table
+_dmerror_unmount
+_dmerror_mount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file2 | _filter_scratch
+
+echo "Check for damage"
+_dmerror_unmount
+_dmerror_cleanup
+_repair_scratch_fs >> $seqres.full
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/329.out b/tests/generic/329.out
new file mode 100644
index 0000000..f14726c
--- /dev/null
+++ b/tests/generic/329.out
@@ -0,0 +1,12 @@
+QA output created by 329
+Format and mount
+Create the original files
+Compare files
+1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-329/file1
+1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-329/file2
+CoW and unmount
+write missed bytes expect 8388608 got 0
+Compare files
+1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-329/file1
+d94b0ab13385aba594411c174b1cc13c  SCRATCH_MNT/test-329/file2
+Check for damage
diff --git a/tests/generic/330 b/tests/generic/330
new file mode 100755
index 0000000..377d822
--- /dev/null
+++ b/tests/generic/330
@@ -0,0 +1,93 @@
+#! /bin/bash
+# FS QA Test No. 330
+#
+# Test AIO DIO CoW behavior.
+#
+#-----------------------------------------------------------------------
+# 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/moo
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+. ./common/reflink
+
+# real QA test starts here
+_supported_os Linux
+_require_scratch_reflink
+_require_cp_reflink
+_require_aiodio "aiocp"
+
+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
+
+blksz=65536
+nr=640
+bufnr=128
+filesize=$((blksz * nr))
+bufsize=$((blksz * bufnr))
+
+_require_fs_space $SCRATCH_MNT $((filesize / 1024 * 3 * 5 / 4))
+
+echo "Create the original files"
+$XFS_IO_PROG -f -c "pwrite -S 0x61 -b $bufsize 0 $filesize" $testdir/file1 >> $seqres.full
+_cp_reflink $testdir/file1 $testdir/file2 >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file2 | _filter_scratch
+
+echo "CoW and unmount"
+$XFS_IO_PROG -f -c "pwrite -S 0x63 $bufsize 1" $testdir/file2 >> $seqres.full
+sync
+$XFS_IO_PROG -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" $TEST_DIR/moo >> $seqres.full
+$AIO_TEST -f DIRECT -b $bufsize $TEST_DIR/moo $testdir/file2 >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file2 | _filter_scratch
+
+echo "Check for damage"
+umount $SCRATCH_MNT
+_repair_scratch_fs >> $seqres.full
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/330.out b/tests/generic/330.out
new file mode 100644
index 0000000..9a33a22
--- /dev/null
+++ b/tests/generic/330.out
@@ -0,0 +1,11 @@
+QA output created by 330
+Format and mount
+Create the original files
+Compare files
+1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-330/file1
+1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-330/file2
+CoW and unmount
+Compare files
+1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-330/file1
+7a4d22297e80ff3c92cb1b3e4566d234  SCRATCH_MNT/test-330/file2
+Check for damage
diff --git a/tests/generic/331 b/tests/generic/331
new file mode 100755
index 0000000..8d8fd6a
--- /dev/null
+++ b/tests/generic/331
@@ -0,0 +1,104 @@
+#! /bin/bash
+# FS QA Test No. 331
+#
+# Test AIO CoW behavior when the write temporarily fails.
+#
+#-----------------------------------------------------------------------
+# 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/moo
+    _dmerror_cleanup
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+. ./common/reflink
+. ./common/dmerror
+
+# real QA test starts here
+_supported_os Linux
+_require_scratch_reflink
+_require_cp_reflink
+_require_dm_target error
+_require_test_program "aio-dio-regress/aiocp"
+AIO_TEST="src/aio-dio-regress/aiocp"
+
+rm -f $seqres.full
+
+
+echo "Format and mount"
+_scratch_mkfs > $seqres.full 2>&1
+_dmerror_init
+_dmerror_mount >> $seqres.full 2>&1
+
+testdir=$SCRATCH_MNT/test-$seq
+mkdir $testdir
+
+blksz=65536
+nr=640
+bufnr=128
+filesize=$((blksz * nr))
+bufsize=$((blksz * bufnr))
+
+_require_fs_space $SCRATCH_MNT $((filesize / 1024 * 3 * 5 / 4))
+
+echo "Create the original files"
+$XFS_IO_PROG -f -c "pwrite -S 0x61 -b $bufsize 0 $filesize" $testdir/file1 >> $seqres.full
+_cp_reflink $testdir/file1 $testdir/file2 >> $seqres.full
+_dmerror_unmount
+_dmerror_mount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file2 | _filter_scratch
+
+echo "CoW and unmount"
+$XFS_IO_PROG -f -c "pwrite -S 0x63 $bufsize 1" $testdir/file2 >> $seqres.full
+$XFS_IO_PROG -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" $TEST_DIR/moo >> $seqres.full
+sync
+_dmerror_load_error_table
+$AIO_TEST -b $bufsize $TEST_DIR/moo $testdir/file2 >> $seqres.full
+$XFS_IO_PROG -c "fdatasync" $testdir/file2
+_dmerror_load_working_table
+_dmerror_unmount
+_dmerror_mount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file2 | _filter_scratch
+
+echo "Check for damage"
+_dmerror_unmount
+_dmerror_cleanup
+_repair_scratch_fs >> $seqres.full
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/331.out b/tests/generic/331.out
new file mode 100644
index 0000000..adbf841
--- /dev/null
+++ b/tests/generic/331.out
@@ -0,0 +1,12 @@
+QA output created by 331
+Format and mount
+Create the original files
+Compare files
+1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-331/file1
+1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-331/file2
+CoW and unmount
+fdatasync: Input/output error
+Compare files
+1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-331/file1
+d94b0ab13385aba594411c174b1cc13c  SCRATCH_MNT/test-331/file2
+Check for damage
diff --git a/tests/generic/332 b/tests/generic/332
new file mode 100755
index 0000000..f9b5f6f
--- /dev/null
+++ b/tests/generic/332
@@ -0,0 +1,94 @@
+#! /bin/bash
+# FS QA Test No. 332
+#
+# Test AIO CoW behavior.
+#
+#-----------------------------------------------------------------------
+# 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/moo
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+. ./common/reflink
+
+# real QA test starts here
+_supported_os Linux
+_require_scratch_reflink
+_require_cp_reflink
+_require_test_program "aio-dio-regress/aiocp"
+AIO_TEST="src/aio-dio-regress/aiocp"
+
+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
+
+blksz=65536
+nr=640
+bufnr=128
+filesize=$((blksz * nr))
+bufsize=$((blksz * bufnr))
+
+_require_fs_space $SCRATCH_MNT $((filesize / 1024 * 3 * 5 / 4))
+
+echo "Create the original files"
+$XFS_IO_PROG -f -c "pwrite -S 0x61 -b $bufsize 0 $filesize" $testdir/file1 >> $seqres.full
+_cp_reflink $testdir/file1 $testdir/file2 >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file2 | _filter_scratch
+
+echo "CoW and unmount"
+$XFS_IO_PROG -f -c "pwrite -S 0x63 $bufsize 1" $testdir/file2 >> $seqres.full
+$XFS_IO_PROG -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" $TEST_DIR/moo >> $seqres.full
+sync
+$AIO_TEST -b $bufsize $TEST_DIR/moo $testdir/file2 >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file2 | _filter_scratch
+
+echo "Check for damage"
+umount $SCRATCH_MNT
+_repair_scratch_fs >> $seqres.full
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/332.out b/tests/generic/332.out
new file mode 100644
index 0000000..b584b1e
--- /dev/null
+++ b/tests/generic/332.out
@@ -0,0 +1,11 @@
+QA output created by 332
+Format and mount
+Create the original files
+Compare files
+1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-332/file1
+1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-332/file2
+CoW and unmount
+Compare files
+1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-332/file1
+7a4d22297e80ff3c92cb1b3e4566d234  SCRATCH_MNT/test-332/file2
+Check for damage
diff --git a/tests/generic/group b/tests/generic/group
index 8b9e0e5..e7ed475 100644
--- a/tests/generic/group
+++ b/tests/generic/group
@@ -331,3 +331,7 @@
 326 auto quick clone
 327 auto quick clone
 328 auto quick clone
+329 auto quick clone
+330 auto quick clone
+331 auto quick clone
+332 auto quick clone

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

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

* [PATCH 27/32] xfs: aio cow tests
  2016-02-11 23:39 ` Darrick J. Wong
@ 2016-02-11 23:42   ` Darrick J. Wong
  -1 siblings, 0 replies; 81+ messages in thread
From: Darrick J. Wong @ 2016-02-11 23:42 UTC (permalink / raw)
  To: david, darrick.wong; +Cc: linux-btrfs, fstests, xfs

Test what happens when AIO writes fail when we have a cowextsize hint
set on the files.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 tests/xfs/237     |  105 +++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/xfs/237.out |   12 ++++++
 tests/xfs/239     |   98 +++++++++++++++++++++++++++++++++++++++++++++++
 tests/xfs/239.out |   11 +++++
 tests/xfs/240     |  110 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/xfs/240.out |   12 ++++++
 tests/xfs/241     |  100 ++++++++++++++++++++++++++++++++++++++++++++++++
 tests/xfs/241.out |   11 +++++
 tests/xfs/group   |    4 ++
 9 files changed, 463 insertions(+)
 create mode 100755 tests/xfs/237
 create mode 100644 tests/xfs/237.out
 create mode 100755 tests/xfs/239
 create mode 100644 tests/xfs/239.out
 create mode 100755 tests/xfs/240
 create mode 100644 tests/xfs/240.out
 create mode 100755 tests/xfs/241
 create mode 100644 tests/xfs/241.out


diff --git a/tests/xfs/237 b/tests/xfs/237
new file mode 100755
index 0000000..f961de3
--- /dev/null
+++ b/tests/xfs/237
@@ -0,0 +1,105 @@
+#! /bin/bash
+# FS QA Test No. 237
+#
+# Test AIO DIO CoW behavior when the write temporarily fails.
+#
+#-----------------------------------------------------------------------
+# 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/moo
+    _dmerror_cleanup
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+. ./common/reflink
+. ./common/dmerror
+
+# real QA test starts here
+_supported_os Linux
+_supported_fs xfs
+_require_scratch_reflink
+_require_cp_reflink
+_require_dm_target error
+_require_xfs_io_command "cowextsize"
+_require_aiodio "aiocp"
+
+rm -f $seqres.full
+
+
+echo "Format and mount"
+_scratch_mkfs > $seqres.full 2>&1
+_dmerror_init
+_dmerror_mount >> $seqres.full 2>&1
+
+testdir=$SCRATCH_MNT/test-$seq
+mkdir $testdir
+
+blksz=65536
+nr=640
+bufnr=128
+filesize=$((blksz * nr))
+bufsize=$((blksz * bufnr))
+
+_require_fs_space $SCRATCH_MNT $((filesize / 1024 * 3 * 5 / 4))
+
+echo "Create the original files"
+$XFS_IO_PROG -c "cowextsize $((bufsize * 2))" $testdir
+$XFS_IO_PROG -f -c "pwrite -S 0x61 -b $bufsize 0 $filesize" $testdir/file1 >> $seqres.full
+_cp_reflink $testdir/file1 $testdir/file2 >> $seqres.full
+_dmerror_unmount
+_dmerror_mount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file2 | _filter_scratch
+
+echo "CoW and unmount"
+$XFS_IO_PROG -f -c "pwrite -S 0x63 $bufsize 1" $testdir/file2 >> $seqres.full
+$XFS_IO_PROG -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" $TEST_DIR/moo >> $seqres.full
+sync
+_dmerror_load_error_table
+$AIO_TEST -f DIRECT -b $bufsize $TEST_DIR/moo $testdir/file2 >> $seqres.full
+_dmerror_load_working_table
+_dmerror_unmount
+_dmerror_mount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file2 | _filter_scratch
+
+echo "Check for damage"
+_dmerror_unmount
+_dmerror_cleanup
+_repair_scratch_fs >> $seqres.full
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/237.out b/tests/xfs/237.out
new file mode 100644
index 0000000..c83dd8b
--- /dev/null
+++ b/tests/xfs/237.out
@@ -0,0 +1,12 @@
+QA output created by 237
+Format and mount
+Create the original files
+Compare files
+1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-237/file1
+1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-237/file2
+CoW and unmount
+write missed bytes expect 8388608 got 0
+Compare files
+1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-237/file1
+d94b0ab13385aba594411c174b1cc13c  SCRATCH_MNT/test-237/file2
+Check for damage
diff --git a/tests/xfs/239 b/tests/xfs/239
new file mode 100755
index 0000000..5bab633
--- /dev/null
+++ b/tests/xfs/239
@@ -0,0 +1,98 @@
+#! /bin/bash
+# FS QA Test No. 239
+#
+# Test AIO DIO CoW behavior.
+#
+#-----------------------------------------------------------------------
+# 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/moo
+}
+
+# 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_cp_reflink
+_require_xfs_io_command "cowextsize"
+_require_aiodio "aiocp"
+
+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
+
+blksz=65536
+nr=640
+bufnr=128
+filesize=$((blksz * nr))
+bufsize=$((blksz * bufnr))
+filesize=$filesize
+bufsize=$bufsize
+
+_require_fs_space $SCRATCH_MNT $((filesize / 1024 * 3 * 5 / 4))
+
+echo "Create the original files"
+$XFS_IO_PROG -c "cowextsize $((bufsize * 2))" $testdir
+$XFS_IO_PROG -f -c "pwrite -S 0x61 -b $bufsize 0 $filesize" $testdir/file1 >> $seqres.full
+_cp_reflink $testdir/file1 $testdir/file2 >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file2 | _filter_scratch
+
+echo "CoW and unmount"
+$XFS_IO_PROG -f -c "pwrite -S 0x63 $bufsize 1" $testdir/file2 >> $seqres.full
+sync
+$XFS_IO_PROG -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" $TEST_DIR/moo >> $seqres.full
+$AIO_TEST -f DIRECT -b $bufsize $TEST_DIR/moo $testdir/file2 >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file2 | _filter_scratch
+
+echo "Check for damage"
+umount $SCRATCH_MNT
+_repair_scratch_fs >> $seqres.full
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/239.out b/tests/xfs/239.out
new file mode 100644
index 0000000..a123da9
--- /dev/null
+++ b/tests/xfs/239.out
@@ -0,0 +1,11 @@
+QA output created by 239
+Format and mount
+Create the original files
+Compare files
+1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-239/file1
+1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-239/file2
+CoW and unmount
+Compare files
+1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-239/file1
+7a4d22297e80ff3c92cb1b3e4566d234  SCRATCH_MNT/test-239/file2
+Check for damage
diff --git a/tests/xfs/240 b/tests/xfs/240
new file mode 100755
index 0000000..62a7735
--- /dev/null
+++ b/tests/xfs/240
@@ -0,0 +1,110 @@
+#! /bin/bash
+# FS QA Test No. 240
+#
+# Test AIO CoW behavior when the write temporarily fails.
+#
+#-----------------------------------------------------------------------
+# 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/moo
+    _dmerror_cleanup
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+. ./common/reflink
+. ./common/dmerror
+
+# real QA test starts here
+_supported_os Linux
+_supported_fs xfs
+_require_scratch_reflink
+_require_cp_reflink
+_require_dm_target error
+_require_xfs_io_command "cowextsize"
+_require_test_program "aio-dio-regress/aiocp"
+AIO_TEST="src/aio-dio-regress/aiocp"
+_require_odirect
+
+rm -f $seqres.full
+
+
+echo "Format and mount"
+_scratch_mkfs > $seqres.full 2>&1
+_dmerror_init
+_dmerror_mount >> $seqres.full 2>&1
+
+testdir=$SCRATCH_MNT/test-$seq
+mkdir $testdir
+
+blksz=65536
+nr=640
+bufnr=128
+filesize=$((blksz * nr))
+bufsize=$((blksz * bufnr))
+filesize=$filesize
+bufsize=$bufsize
+
+_require_fs_space $SCRATCH_MNT $((filesize / 1024 * 3 * 5 / 4))
+
+echo "Create the original files"
+$XFS_IO_PROG -c "cowextsize $((bufsize * 2))" $testdir
+$XFS_IO_PROG -f -c "pwrite -S 0x61 -b $bufsize 0 $filesize" $testdir/file1 >> $seqres.full
+_cp_reflink $testdir/file1 $testdir/file2 >> $seqres.full
+_dmerror_unmount
+_dmerror_mount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file2 | _filter_scratch
+
+echo "CoW and unmount"
+$XFS_IO_PROG -f -c "pwrite -S 0x63 $bufsize 1" $testdir/file2 >> $seqres.full
+$XFS_IO_PROG -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" $TEST_DIR/moo >> $seqres.full
+sync
+_dmerror_load_error_table
+$AIO_TEST -b $bufsize $TEST_DIR/moo $testdir/file2 >> $seqres.full
+$XFS_IO_PROG -c "fdatasync" $testdir/file2
+_dmerror_load_working_table
+_dmerror_unmount
+_dmerror_mount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file2 | _filter_scratch
+
+echo "Check for damage"
+_dmerror_unmount
+_dmerror_cleanup
+_repair_scratch_fs >> $seqres.full
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/240.out b/tests/xfs/240.out
new file mode 100644
index 0000000..1a22e8a
--- /dev/null
+++ b/tests/xfs/240.out
@@ -0,0 +1,12 @@
+QA output created by 240
+Format and mount
+Create the original files
+Compare files
+1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-240/file1
+1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-240/file2
+CoW and unmount
+fdatasync: Input/output error
+Compare files
+1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-240/file1
+d94b0ab13385aba594411c174b1cc13c  SCRATCH_MNT/test-240/file2
+Check for damage
diff --git a/tests/xfs/241 b/tests/xfs/241
new file mode 100755
index 0000000..090f913
--- /dev/null
+++ b/tests/xfs/241
@@ -0,0 +1,100 @@
+#! /bin/bash
+# FS QA Test No. 241
+#
+# Test AIO CoW behavior.
+#
+#-----------------------------------------------------------------------
+# 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/moo
+}
+
+# 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_cp_reflink
+_require_xfs_io_command "cowextsize"
+_require_test_program "aio-dio-regress/aiocp"
+AIO_TEST="src/aio-dio-regress/aiocp"
+_require_odirect
+
+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
+
+blksz=65536
+nr=640
+bufnr=128
+filesize=$((blksz * nr))
+bufsize=$((blksz * bufnr))
+filesize=$filesize
+bufsize=$bufsize
+
+_require_fs_space $SCRATCH_MNT $((filesize / 1024 * 3 * 5 / 4))
+
+echo "Create the original files"
+$XFS_IO_PROG -c "cowextsize $((bufsize * 2))" $testdir
+$XFS_IO_PROG -f -c "pwrite -S 0x61 -b $bufsize 0 $filesize" $testdir/file1 >> $seqres.full
+_cp_reflink $testdir/file1 $testdir/file2 >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file2 | _filter_scratch
+
+echo "CoW and unmount"
+$XFS_IO_PROG -f -c "pwrite -S 0x63 $bufsize 1" $testdir/file2 >> $seqres.full
+$XFS_IO_PROG -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" $TEST_DIR/moo >> $seqres.full
+sync
+$AIO_TEST -b $bufsize $TEST_DIR/moo $testdir/file2 >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file2 | _filter_scratch
+
+echo "Check for damage"
+umount $SCRATCH_MNT
+_repair_scratch_fs >> $seqres.full
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/241.out b/tests/xfs/241.out
new file mode 100644
index 0000000..a7e7df2
--- /dev/null
+++ b/tests/xfs/241.out
@@ -0,0 +1,11 @@
+QA output created by 241
+Format and mount
+Create the original files
+Compare files
+1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-241/file1
+1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-241/file2
+CoW and unmount
+Compare files
+1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-241/file1
+7a4d22297e80ff3c92cb1b3e4566d234  SCRATCH_MNT/test-241/file2
+Check for damage
diff --git a/tests/xfs/group b/tests/xfs/group
index 1d08065..c0ce1f4 100644
--- a/tests/xfs/group
+++ b/tests/xfs/group
@@ -234,7 +234,11 @@
 234 auto quick rmap
 235 fuzzers rmap
 236 auto quick rmap
+237 auto quick clone
 238 auto quick metadata ioctl
+239 auto quick clone
+240 auto quick clone
+241 auto quick clone
 242 auto quick prealloc
 244 auto quota quick
 250 auto quick rw prealloc metadata


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

* [PATCH 27/32] xfs: aio cow tests
@ 2016-02-11 23:42   ` Darrick J. Wong
  0 siblings, 0 replies; 81+ messages in thread
From: Darrick J. Wong @ 2016-02-11 23:42 UTC (permalink / raw)
  To: david, darrick.wong; +Cc: fstests, linux-btrfs, xfs

Test what happens when AIO writes fail when we have a cowextsize hint
set on the files.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 tests/xfs/237     |  105 +++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/xfs/237.out |   12 ++++++
 tests/xfs/239     |   98 +++++++++++++++++++++++++++++++++++++++++++++++
 tests/xfs/239.out |   11 +++++
 tests/xfs/240     |  110 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/xfs/240.out |   12 ++++++
 tests/xfs/241     |  100 ++++++++++++++++++++++++++++++++++++++++++++++++
 tests/xfs/241.out |   11 +++++
 tests/xfs/group   |    4 ++
 9 files changed, 463 insertions(+)
 create mode 100755 tests/xfs/237
 create mode 100644 tests/xfs/237.out
 create mode 100755 tests/xfs/239
 create mode 100644 tests/xfs/239.out
 create mode 100755 tests/xfs/240
 create mode 100644 tests/xfs/240.out
 create mode 100755 tests/xfs/241
 create mode 100644 tests/xfs/241.out


diff --git a/tests/xfs/237 b/tests/xfs/237
new file mode 100755
index 0000000..f961de3
--- /dev/null
+++ b/tests/xfs/237
@@ -0,0 +1,105 @@
+#! /bin/bash
+# FS QA Test No. 237
+#
+# Test AIO DIO CoW behavior when the write temporarily fails.
+#
+#-----------------------------------------------------------------------
+# 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/moo
+    _dmerror_cleanup
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+. ./common/reflink
+. ./common/dmerror
+
+# real QA test starts here
+_supported_os Linux
+_supported_fs xfs
+_require_scratch_reflink
+_require_cp_reflink
+_require_dm_target error
+_require_xfs_io_command "cowextsize"
+_require_aiodio "aiocp"
+
+rm -f $seqres.full
+
+
+echo "Format and mount"
+_scratch_mkfs > $seqres.full 2>&1
+_dmerror_init
+_dmerror_mount >> $seqres.full 2>&1
+
+testdir=$SCRATCH_MNT/test-$seq
+mkdir $testdir
+
+blksz=65536
+nr=640
+bufnr=128
+filesize=$((blksz * nr))
+bufsize=$((blksz * bufnr))
+
+_require_fs_space $SCRATCH_MNT $((filesize / 1024 * 3 * 5 / 4))
+
+echo "Create the original files"
+$XFS_IO_PROG -c "cowextsize $((bufsize * 2))" $testdir
+$XFS_IO_PROG -f -c "pwrite -S 0x61 -b $bufsize 0 $filesize" $testdir/file1 >> $seqres.full
+_cp_reflink $testdir/file1 $testdir/file2 >> $seqres.full
+_dmerror_unmount
+_dmerror_mount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file2 | _filter_scratch
+
+echo "CoW and unmount"
+$XFS_IO_PROG -f -c "pwrite -S 0x63 $bufsize 1" $testdir/file2 >> $seqres.full
+$XFS_IO_PROG -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" $TEST_DIR/moo >> $seqres.full
+sync
+_dmerror_load_error_table
+$AIO_TEST -f DIRECT -b $bufsize $TEST_DIR/moo $testdir/file2 >> $seqres.full
+_dmerror_load_working_table
+_dmerror_unmount
+_dmerror_mount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file2 | _filter_scratch
+
+echo "Check for damage"
+_dmerror_unmount
+_dmerror_cleanup
+_repair_scratch_fs >> $seqres.full
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/237.out b/tests/xfs/237.out
new file mode 100644
index 0000000..c83dd8b
--- /dev/null
+++ b/tests/xfs/237.out
@@ -0,0 +1,12 @@
+QA output created by 237
+Format and mount
+Create the original files
+Compare files
+1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-237/file1
+1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-237/file2
+CoW and unmount
+write missed bytes expect 8388608 got 0
+Compare files
+1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-237/file1
+d94b0ab13385aba594411c174b1cc13c  SCRATCH_MNT/test-237/file2
+Check for damage
diff --git a/tests/xfs/239 b/tests/xfs/239
new file mode 100755
index 0000000..5bab633
--- /dev/null
+++ b/tests/xfs/239
@@ -0,0 +1,98 @@
+#! /bin/bash
+# FS QA Test No. 239
+#
+# Test AIO DIO CoW behavior.
+#
+#-----------------------------------------------------------------------
+# 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/moo
+}
+
+# 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_cp_reflink
+_require_xfs_io_command "cowextsize"
+_require_aiodio "aiocp"
+
+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
+
+blksz=65536
+nr=640
+bufnr=128
+filesize=$((blksz * nr))
+bufsize=$((blksz * bufnr))
+filesize=$filesize
+bufsize=$bufsize
+
+_require_fs_space $SCRATCH_MNT $((filesize / 1024 * 3 * 5 / 4))
+
+echo "Create the original files"
+$XFS_IO_PROG -c "cowextsize $((bufsize * 2))" $testdir
+$XFS_IO_PROG -f -c "pwrite -S 0x61 -b $bufsize 0 $filesize" $testdir/file1 >> $seqres.full
+_cp_reflink $testdir/file1 $testdir/file2 >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file2 | _filter_scratch
+
+echo "CoW and unmount"
+$XFS_IO_PROG -f -c "pwrite -S 0x63 $bufsize 1" $testdir/file2 >> $seqres.full
+sync
+$XFS_IO_PROG -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" $TEST_DIR/moo >> $seqres.full
+$AIO_TEST -f DIRECT -b $bufsize $TEST_DIR/moo $testdir/file2 >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file2 | _filter_scratch
+
+echo "Check for damage"
+umount $SCRATCH_MNT
+_repair_scratch_fs >> $seqres.full
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/239.out b/tests/xfs/239.out
new file mode 100644
index 0000000..a123da9
--- /dev/null
+++ b/tests/xfs/239.out
@@ -0,0 +1,11 @@
+QA output created by 239
+Format and mount
+Create the original files
+Compare files
+1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-239/file1
+1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-239/file2
+CoW and unmount
+Compare files
+1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-239/file1
+7a4d22297e80ff3c92cb1b3e4566d234  SCRATCH_MNT/test-239/file2
+Check for damage
diff --git a/tests/xfs/240 b/tests/xfs/240
new file mode 100755
index 0000000..62a7735
--- /dev/null
+++ b/tests/xfs/240
@@ -0,0 +1,110 @@
+#! /bin/bash
+# FS QA Test No. 240
+#
+# Test AIO CoW behavior when the write temporarily fails.
+#
+#-----------------------------------------------------------------------
+# 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/moo
+    _dmerror_cleanup
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+. ./common/reflink
+. ./common/dmerror
+
+# real QA test starts here
+_supported_os Linux
+_supported_fs xfs
+_require_scratch_reflink
+_require_cp_reflink
+_require_dm_target error
+_require_xfs_io_command "cowextsize"
+_require_test_program "aio-dio-regress/aiocp"
+AIO_TEST="src/aio-dio-regress/aiocp"
+_require_odirect
+
+rm -f $seqres.full
+
+
+echo "Format and mount"
+_scratch_mkfs > $seqres.full 2>&1
+_dmerror_init
+_dmerror_mount >> $seqres.full 2>&1
+
+testdir=$SCRATCH_MNT/test-$seq
+mkdir $testdir
+
+blksz=65536
+nr=640
+bufnr=128
+filesize=$((blksz * nr))
+bufsize=$((blksz * bufnr))
+filesize=$filesize
+bufsize=$bufsize
+
+_require_fs_space $SCRATCH_MNT $((filesize / 1024 * 3 * 5 / 4))
+
+echo "Create the original files"
+$XFS_IO_PROG -c "cowextsize $((bufsize * 2))" $testdir
+$XFS_IO_PROG -f -c "pwrite -S 0x61 -b $bufsize 0 $filesize" $testdir/file1 >> $seqres.full
+_cp_reflink $testdir/file1 $testdir/file2 >> $seqres.full
+_dmerror_unmount
+_dmerror_mount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file2 | _filter_scratch
+
+echo "CoW and unmount"
+$XFS_IO_PROG -f -c "pwrite -S 0x63 $bufsize 1" $testdir/file2 >> $seqres.full
+$XFS_IO_PROG -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" $TEST_DIR/moo >> $seqres.full
+sync
+_dmerror_load_error_table
+$AIO_TEST -b $bufsize $TEST_DIR/moo $testdir/file2 >> $seqres.full
+$XFS_IO_PROG -c "fdatasync" $testdir/file2
+_dmerror_load_working_table
+_dmerror_unmount
+_dmerror_mount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file2 | _filter_scratch
+
+echo "Check for damage"
+_dmerror_unmount
+_dmerror_cleanup
+_repair_scratch_fs >> $seqres.full
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/240.out b/tests/xfs/240.out
new file mode 100644
index 0000000..1a22e8a
--- /dev/null
+++ b/tests/xfs/240.out
@@ -0,0 +1,12 @@
+QA output created by 240
+Format and mount
+Create the original files
+Compare files
+1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-240/file1
+1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-240/file2
+CoW and unmount
+fdatasync: Input/output error
+Compare files
+1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-240/file1
+d94b0ab13385aba594411c174b1cc13c  SCRATCH_MNT/test-240/file2
+Check for damage
diff --git a/tests/xfs/241 b/tests/xfs/241
new file mode 100755
index 0000000..090f913
--- /dev/null
+++ b/tests/xfs/241
@@ -0,0 +1,100 @@
+#! /bin/bash
+# FS QA Test No. 241
+#
+# Test AIO CoW behavior.
+#
+#-----------------------------------------------------------------------
+# 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/moo
+}
+
+# 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_cp_reflink
+_require_xfs_io_command "cowextsize"
+_require_test_program "aio-dio-regress/aiocp"
+AIO_TEST="src/aio-dio-regress/aiocp"
+_require_odirect
+
+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
+
+blksz=65536
+nr=640
+bufnr=128
+filesize=$((blksz * nr))
+bufsize=$((blksz * bufnr))
+filesize=$filesize
+bufsize=$bufsize
+
+_require_fs_space $SCRATCH_MNT $((filesize / 1024 * 3 * 5 / 4))
+
+echo "Create the original files"
+$XFS_IO_PROG -c "cowextsize $((bufsize * 2))" $testdir
+$XFS_IO_PROG -f -c "pwrite -S 0x61 -b $bufsize 0 $filesize" $testdir/file1 >> $seqres.full
+_cp_reflink $testdir/file1 $testdir/file2 >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file2 | _filter_scratch
+
+echo "CoW and unmount"
+$XFS_IO_PROG -f -c "pwrite -S 0x63 $bufsize 1" $testdir/file2 >> $seqres.full
+$XFS_IO_PROG -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" $TEST_DIR/moo >> $seqres.full
+sync
+$AIO_TEST -b $bufsize $TEST_DIR/moo $testdir/file2 >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file2 | _filter_scratch
+
+echo "Check for damage"
+umount $SCRATCH_MNT
+_repair_scratch_fs >> $seqres.full
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/241.out b/tests/xfs/241.out
new file mode 100644
index 0000000..a7e7df2
--- /dev/null
+++ b/tests/xfs/241.out
@@ -0,0 +1,11 @@
+QA output created by 241
+Format and mount
+Create the original files
+Compare files
+1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-241/file1
+1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-241/file2
+CoW and unmount
+Compare files
+1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-241/file1
+7a4d22297e80ff3c92cb1b3e4566d234  SCRATCH_MNT/test-241/file2
+Check for damage
diff --git a/tests/xfs/group b/tests/xfs/group
index 1d08065..c0ce1f4 100644
--- a/tests/xfs/group
+++ b/tests/xfs/group
@@ -234,7 +234,11 @@
 234 auto quick rmap
 235 fuzzers rmap
 236 auto quick rmap
+237 auto quick clone
 238 auto quick metadata ioctl
+239 auto quick clone
+240 auto quick clone
+241 auto quick clone
 242 auto quick prealloc
 244 auto quota quick
 250 auto quick rw prealloc metadata

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

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

* [PATCH 28/32] xfs: test xfs_getbmapx behavior with shared extents
  2016-02-11 23:39 ` Darrick J. Wong
@ 2016-02-11 23:42   ` Darrick J. Wong
  -1 siblings, 0 replies; 81+ messages in thread
From: Darrick J. Wong @ 2016-02-11 23:42 UTC (permalink / raw)
  To: david, darrick.wong; +Cc: linux-btrfs, fstests, xfs

Make sure that xfs_getbmapx behaves properly w.r.t. shared extents
and CoW fork reporting.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 common/rc         |   19 ++++++
 tests/xfs/243     |  165 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/xfs/243.out |   26 ++++++++
 tests/xfs/245     |   95 +++++++++++++++++++++++++++++++
 tests/xfs/245.out |   12 ++++
 tests/xfs/246     |   65 +++++++++++++++++++++
 tests/xfs/246.out |    6 ++
 tests/xfs/group   |    3 +
 8 files changed, 391 insertions(+)
 create mode 100755 tests/xfs/243
 create mode 100644 tests/xfs/243.out
 create mode 100755 tests/xfs/245
 create mode 100644 tests/xfs/245.out
 create mode 100755 tests/xfs/246
 create mode 100644 tests/xfs/246.out


diff --git a/common/rc b/common/rc
index 7e83d6e..52c4a36 100644
--- a/common/rc
+++ b/common/rc
@@ -3075,6 +3075,25 @@ _require_xfs_scratch_rmapbt()
 	_scratch_unmount
 }
 
+_xfs_bmapx_find() {
+	case "$1" in
+	"attr")
+		param="a"
+		;;
+	"cow")
+		param="c"
+		;;
+	*)
+		param="e"
+		;;
+	esac
+	shift
+	file="$1"
+	shift
+
+	"$XFS_IO_PROG" -c "bmap -${param}lpv" "$file" | grep -c "$@"
+}
+
 _get_total_inode()
 {
 	if [ -z "$1" ]; then
diff --git a/tests/xfs/243 b/tests/xfs/243
new file mode 100755
index 0000000..629173e
--- /dev/null
+++ b/tests/xfs/243
@@ -0,0 +1,165 @@
+#! /bin/bash
+# FS QA Test No. 243
+#
+# Ensuring that copy on write in buffered mode works when the CoW
+# range originally covers multiple extents, some unwritten, some not.
+#   - Set cowextsize hint.
+#   - Create a file with the following repeating sequence of blocks:
+#     1. reflinked
+#     2. unwritten
+#     3. hole
+#     4. regular block
+#     5. delalloc
+#   - CoW across the halfway mark, starting with the unwritten extent.
+#   - Check that the files are now different where we say they're different.
+#
+#-----------------------------------------------------------------------
+# 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_reflink
+_require_xfs_io_command "falloc"
+_require_xfs_io_command "fpunch"
+_require_cp_reflink
+
+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
+
+echo "Create the original files"
+blksz=65536
+nr=64
+filesize=$((blksz * nr))
+
+$XFS_IO_PROG -c "cowextsize $((blksz * 16))" $testdir >> $seqres.full
+_pwrite_byte 0x61 0 $filesize $testdir/file1 >> $seqres.full
+$XFS_IO_PROG -f -c "truncate $filesize" $testdir/file3 >> $seqres.full
+# 0 blocks are reflinked
+seq 0 5 $nr | while read f; do
+	_reflink_range $testdir/file1 $((blksz * f)) $testdir/file3 $((blksz * f)) $blksz >> $seqres.full
+	_pwrite_byte 0x61 $((blksz * f)) $blksz $testdir/file3.chk >> $seqres.full
+done
+# 1 blocks are unwritten
+seq 1 5 $nr | while read f; do
+	$XFS_IO_PROG -f -c "falloc $((blksz * f)) $blksz" $testdir/file3 >> $seqres.full
+	_pwrite_byte 0x00 $((blksz * f)) $blksz $testdir/file3.chk >> $seqres.full
+done
+# 2 blocks are holes
+seq 2 5 $nr | while read f; do
+	_pwrite_byte 0x00 $((blksz * f)) $blksz $testdir/file3.chk >> $seqres.full
+done
+# 3 blocks are regular
+seq 3 5 $nr | while read f; do
+	_pwrite_byte 0x71 $((blksz * f)) $blksz $testdir/file3 >> $seqres.full
+	_pwrite_byte 0x71 $((blksz * f)) $blksz $testdir/file3.chk >> $seqres.full
+done
+sync
+# 4 blocks are delalloc (do later)
+seq 4 5 $nr | while read f; do
+	_pwrite_byte 0x62 $((blksz * f)) $blksz $testdir/file3 >> $seqres.full
+	_pwrite_byte 0x62 $((blksz * f)) $blksz $testdir/file3.chk >> $seqres.full
+done
+
+# 10 blocks are cow'd
+seq 0 10 $((nr/2)) | while read f; do
+	_pwrite_byte 0x61 $((blksz * f)) 1 $testdir/file3 >> $seqres.full
+	_pwrite_byte 0x61 $((blksz * f)) 1 $testdir/file3.chk >> $seqres.full
+done
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file3 | _filter_scratch
+md5sum $testdir/file3.chk | _filter_scratch
+
+echo "Dump extents"
+$XFS_IO_PROG -c "cowextsize" $testdir/file3 | _filter_scratch
+echo "Delayed allocation CoW extents:"
+test $(_xfs_bmapx_find cow $testdir/file3 delalloc) -gt 0 || \
+	echo "Expected to find a delalloc CoW extent"
+echo "Shared data extents:"
+test $(_xfs_bmapx_find data $testdir/file3 '100000$') -gt 0 || \
+	echo "Expected to find a shared data extent"
+echo "Unwritten data extents:"
+test $(_xfs_bmapx_find data $testdir/file3 '10000$') -gt 0 || \
+	echo "Expected to find an unwritten data extent"
+echo "Hole data extents:"
+test $(_xfs_bmapx_find data $testdir/file3 hole) -gt 0 || \
+	echo "Expected to find a hole data extent"
+echo "Regular data extents:"
+test $(_xfs_bmapx_find data $testdir/file3 '000000$') -gt 0 || \
+	echo "Expected to find a regular data extent"
+
+sync
+
+echo "Dump extents after sync"
+$XFS_IO_PROG -c "cowextsize" $testdir/file3 | _filter_scratch
+echo "Delayed allocation CoW extents:"
+test $(_xfs_bmapx_find cow $testdir/file3 -v hole ) -gt 0 || \
+	echo "Expected to find a regular CoW extent"
+echo "Real CoW extents:"
+test $(_xfs_bmapx_find cow $testdir/file3 delalloc ) -eq 0 || \
+	echo "Expected to find zero delalloc CoW extent"
+echo "Shared data extents:"
+test $(_xfs_bmapx_find data $testdir/file3 '100000$') -gt 0 || \
+	echo "Expected to find a shared data extent"
+echo "Unwritten data extents:"
+test $(_xfs_bmapx_find data $testdir/file3 '10000$') -gt 0 || \
+	echo "Expected to find an unwritten data extent"
+echo "Hole data extents:"
+test $(_xfs_bmapx_find data $testdir/file3 hole) -gt 0 || \
+	echo "Expected to find a hole data extent"
+echo "Regular data extents:"
+test $(_xfs_bmapx_find data $testdir/file3 '000000$') -gt 0 || \
+	echo "Expected to find a regular data extent"
+
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file3 | _filter_scratch
+md5sum $testdir/file3.chk | _filter_scratch
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/243.out b/tests/xfs/243.out
new file mode 100644
index 0000000..e6e5326
--- /dev/null
+++ b/tests/xfs/243.out
@@ -0,0 +1,26 @@
+QA output created by 243
+Format and mount
+Create the original files
+Compare files
+bdbcf02ee0aa977795a79d25fcfdccb1  SCRATCH_MNT/test-243/file1
+d0fda5bf5d4fd70904ef1c1c56db28d0  SCRATCH_MNT/test-243/file3
+d0fda5bf5d4fd70904ef1c1c56db28d0  SCRATCH_MNT/test-243/file3.chk
+Dump extents
+[1048576] SCRATCH_MNT/test-243/file3
+Delayed allocation CoW extents:
+Shared data extents:
+Unwritten data extents:
+Hole data extents:
+Regular data extents:
+Dump extents after sync
+[1048576] SCRATCH_MNT/test-243/file3
+Delayed allocation CoW extents:
+Real CoW extents:
+Shared data extents:
+Unwritten data extents:
+Hole data extents:
+Regular data extents:
+Compare files
+bdbcf02ee0aa977795a79d25fcfdccb1  SCRATCH_MNT/test-243/file1
+d0fda5bf5d4fd70904ef1c1c56db28d0  SCRATCH_MNT/test-243/file3
+d0fda5bf5d4fd70904ef1c1c56db28d0  SCRATCH_MNT/test-243/file3.chk
diff --git a/tests/xfs/245 b/tests/xfs/245
new file mode 100755
index 0000000..6da701d
--- /dev/null
+++ b/tests/xfs/245
@@ -0,0 +1,95 @@
+#! /bin/bash
+# FS QA Test No. 245
+#
+# Make sure that reflink deals with extents going beyond EOF.
+# - fallocate 256k in file1
+# - pwrite 252-257k to cause it to speculatively prealloc file1
+# - reflink file1 to file2
+# - compare file[12]
+#
+#-----------------------------------------------------------------------
+# 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_reflink
+_require_xfs_io_command "falloc"
+_require_cp_reflink
+
+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
+
+echo "Create the original files"
+$XFS_IO_PROG -f -c "falloc 0 256k" -c "pwrite 252k 6k" $testdir/file1 >> $seqres.full
+_scratch_remount
+_cp_reflink $testdir/file1 $testdir/file2 >> $seqres.full
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file2 | _filter_scratch
+
+echo "Unwritten data extents"
+test $(_xfs_bmapx_find data $testdir/file1 '10000$') -gt 0 || \
+	echo "Expected to find an unwritten file1 extent"
+echo "Shared data extents"
+test $(_xfs_bmapx_find data $testdir/file1 '100000$') -gt 0 || \
+	echo "Expected to find a shared data extent"
+
+echo "Hole data extents"
+test $(_xfs_bmapx_find data $testdir/file2 'hole') -gt 0 || \
+	echo "Expected to find a hole data extent"
+echo "Shared data extents"
+test $(_xfs_bmapx_find data $testdir/file2 '100000$') -gt 0 || \
+	echo "Expected to find a shared data extent"
+
+echo "Hole cow extents"
+test $(_xfs_bmapx_find cow $testdir/file1 'hole') -gt 0 || \
+	echo "Expected to find a hole cow extent"
+echo "Hole cow extents"
+test $(_xfs_bmapx_find cow $testdir/file2 'hole') -gt 0 || \
+	echo "Expected to find a hole cow extent"
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/245.out b/tests/xfs/245.out
new file mode 100644
index 0000000..9a5fa5f
--- /dev/null
+++ b/tests/xfs/245.out
@@ -0,0 +1,12 @@
+QA output created by 245
+Format and mount
+Create the original files
+Compare files
+b0b91e1a18165fcd6549f2f5f3ef4823  SCRATCH_MNT/test-245/file1
+b0b91e1a18165fcd6549f2f5f3ef4823  SCRATCH_MNT/test-245/file2
+Unwritten data extents
+Shared data extents
+Hole data extents
+Shared data extents
+Hole cow extents
+Hole cow extents
diff --git a/tests/xfs/246 b/tests/xfs/246
new file mode 100755
index 0000000..13b0c98
--- /dev/null
+++ b/tests/xfs/246
@@ -0,0 +1,65 @@
+#! /bin/bash
+# FS QA Test No. 246
+#
+# Create an empty file and try to query the (nonexistant) CoW fork.
+#
+#-----------------------------------------------------------------------
+# 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
+
+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
+
+echo "Create the original files"
+touch $testdir/file1
+sync
+
+echo "Dump extents after sync"
+echo "Hole CoW extents:"
+$XFS_IO_PROG -c "bmap -clpv" $testdir/file1 | _filter_scratch
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/246.out b/tests/xfs/246.out
new file mode 100644
index 0000000..c543e74
--- /dev/null
+++ b/tests/xfs/246.out
@@ -0,0 +1,6 @@
+QA output created by 246
+Format and mount
+Create the original files
+Dump extents after sync
+Hole CoW extents:
+SCRATCH_MNT/test-246/file1: no extents
diff --git a/tests/xfs/group b/tests/xfs/group
index c0ce1f4..f6c7db8 100644
--- a/tests/xfs/group
+++ b/tests/xfs/group
@@ -240,7 +240,10 @@
 240 auto quick clone
 241 auto quick clone
 242 auto quick prealloc
+243 auto quick clone
 244 auto quota quick
+245 auto quick clone
+246 auto quick clone
 250 auto quick rw prealloc metadata
 252 auto quick prealloc
 253 auto quick


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

* [PATCH 28/32] xfs: test xfs_getbmapx behavior with shared extents
@ 2016-02-11 23:42   ` Darrick J. Wong
  0 siblings, 0 replies; 81+ messages in thread
From: Darrick J. Wong @ 2016-02-11 23:42 UTC (permalink / raw)
  To: david, darrick.wong; +Cc: fstests, linux-btrfs, xfs

Make sure that xfs_getbmapx behaves properly w.r.t. shared extents
and CoW fork reporting.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 common/rc         |   19 ++++++
 tests/xfs/243     |  165 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/xfs/243.out |   26 ++++++++
 tests/xfs/245     |   95 +++++++++++++++++++++++++++++++
 tests/xfs/245.out |   12 ++++
 tests/xfs/246     |   65 +++++++++++++++++++++
 tests/xfs/246.out |    6 ++
 tests/xfs/group   |    3 +
 8 files changed, 391 insertions(+)
 create mode 100755 tests/xfs/243
 create mode 100644 tests/xfs/243.out
 create mode 100755 tests/xfs/245
 create mode 100644 tests/xfs/245.out
 create mode 100755 tests/xfs/246
 create mode 100644 tests/xfs/246.out


diff --git a/common/rc b/common/rc
index 7e83d6e..52c4a36 100644
--- a/common/rc
+++ b/common/rc
@@ -3075,6 +3075,25 @@ _require_xfs_scratch_rmapbt()
 	_scratch_unmount
 }
 
+_xfs_bmapx_find() {
+	case "$1" in
+	"attr")
+		param="a"
+		;;
+	"cow")
+		param="c"
+		;;
+	*)
+		param="e"
+		;;
+	esac
+	shift
+	file="$1"
+	shift
+
+	"$XFS_IO_PROG" -c "bmap -${param}lpv" "$file" | grep -c "$@"
+}
+
 _get_total_inode()
 {
 	if [ -z "$1" ]; then
diff --git a/tests/xfs/243 b/tests/xfs/243
new file mode 100755
index 0000000..629173e
--- /dev/null
+++ b/tests/xfs/243
@@ -0,0 +1,165 @@
+#! /bin/bash
+# FS QA Test No. 243
+#
+# Ensuring that copy on write in buffered mode works when the CoW
+# range originally covers multiple extents, some unwritten, some not.
+#   - Set cowextsize hint.
+#   - Create a file with the following repeating sequence of blocks:
+#     1. reflinked
+#     2. unwritten
+#     3. hole
+#     4. regular block
+#     5. delalloc
+#   - CoW across the halfway mark, starting with the unwritten extent.
+#   - Check that the files are now different where we say they're different.
+#
+#-----------------------------------------------------------------------
+# 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_reflink
+_require_xfs_io_command "falloc"
+_require_xfs_io_command "fpunch"
+_require_cp_reflink
+
+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
+
+echo "Create the original files"
+blksz=65536
+nr=64
+filesize=$((blksz * nr))
+
+$XFS_IO_PROG -c "cowextsize $((blksz * 16))" $testdir >> $seqres.full
+_pwrite_byte 0x61 0 $filesize $testdir/file1 >> $seqres.full
+$XFS_IO_PROG -f -c "truncate $filesize" $testdir/file3 >> $seqres.full
+# 0 blocks are reflinked
+seq 0 5 $nr | while read f; do
+	_reflink_range $testdir/file1 $((blksz * f)) $testdir/file3 $((blksz * f)) $blksz >> $seqres.full
+	_pwrite_byte 0x61 $((blksz * f)) $blksz $testdir/file3.chk >> $seqres.full
+done
+# 1 blocks are unwritten
+seq 1 5 $nr | while read f; do
+	$XFS_IO_PROG -f -c "falloc $((blksz * f)) $blksz" $testdir/file3 >> $seqres.full
+	_pwrite_byte 0x00 $((blksz * f)) $blksz $testdir/file3.chk >> $seqres.full
+done
+# 2 blocks are holes
+seq 2 5 $nr | while read f; do
+	_pwrite_byte 0x00 $((blksz * f)) $blksz $testdir/file3.chk >> $seqres.full
+done
+# 3 blocks are regular
+seq 3 5 $nr | while read f; do
+	_pwrite_byte 0x71 $((blksz * f)) $blksz $testdir/file3 >> $seqres.full
+	_pwrite_byte 0x71 $((blksz * f)) $blksz $testdir/file3.chk >> $seqres.full
+done
+sync
+# 4 blocks are delalloc (do later)
+seq 4 5 $nr | while read f; do
+	_pwrite_byte 0x62 $((blksz * f)) $blksz $testdir/file3 >> $seqres.full
+	_pwrite_byte 0x62 $((blksz * f)) $blksz $testdir/file3.chk >> $seqres.full
+done
+
+# 10 blocks are cow'd
+seq 0 10 $((nr/2)) | while read f; do
+	_pwrite_byte 0x61 $((blksz * f)) 1 $testdir/file3 >> $seqres.full
+	_pwrite_byte 0x61 $((blksz * f)) 1 $testdir/file3.chk >> $seqres.full
+done
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file3 | _filter_scratch
+md5sum $testdir/file3.chk | _filter_scratch
+
+echo "Dump extents"
+$XFS_IO_PROG -c "cowextsize" $testdir/file3 | _filter_scratch
+echo "Delayed allocation CoW extents:"
+test $(_xfs_bmapx_find cow $testdir/file3 delalloc) -gt 0 || \
+	echo "Expected to find a delalloc CoW extent"
+echo "Shared data extents:"
+test $(_xfs_bmapx_find data $testdir/file3 '100000$') -gt 0 || \
+	echo "Expected to find a shared data extent"
+echo "Unwritten data extents:"
+test $(_xfs_bmapx_find data $testdir/file3 '10000$') -gt 0 || \
+	echo "Expected to find an unwritten data extent"
+echo "Hole data extents:"
+test $(_xfs_bmapx_find data $testdir/file3 hole) -gt 0 || \
+	echo "Expected to find a hole data extent"
+echo "Regular data extents:"
+test $(_xfs_bmapx_find data $testdir/file3 '000000$') -gt 0 || \
+	echo "Expected to find a regular data extent"
+
+sync
+
+echo "Dump extents after sync"
+$XFS_IO_PROG -c "cowextsize" $testdir/file3 | _filter_scratch
+echo "Delayed allocation CoW extents:"
+test $(_xfs_bmapx_find cow $testdir/file3 -v hole ) -gt 0 || \
+	echo "Expected to find a regular CoW extent"
+echo "Real CoW extents:"
+test $(_xfs_bmapx_find cow $testdir/file3 delalloc ) -eq 0 || \
+	echo "Expected to find zero delalloc CoW extent"
+echo "Shared data extents:"
+test $(_xfs_bmapx_find data $testdir/file3 '100000$') -gt 0 || \
+	echo "Expected to find a shared data extent"
+echo "Unwritten data extents:"
+test $(_xfs_bmapx_find data $testdir/file3 '10000$') -gt 0 || \
+	echo "Expected to find an unwritten data extent"
+echo "Hole data extents:"
+test $(_xfs_bmapx_find data $testdir/file3 hole) -gt 0 || \
+	echo "Expected to find a hole data extent"
+echo "Regular data extents:"
+test $(_xfs_bmapx_find data $testdir/file3 '000000$') -gt 0 || \
+	echo "Expected to find a regular data extent"
+
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file3 | _filter_scratch
+md5sum $testdir/file3.chk | _filter_scratch
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/243.out b/tests/xfs/243.out
new file mode 100644
index 0000000..e6e5326
--- /dev/null
+++ b/tests/xfs/243.out
@@ -0,0 +1,26 @@
+QA output created by 243
+Format and mount
+Create the original files
+Compare files
+bdbcf02ee0aa977795a79d25fcfdccb1  SCRATCH_MNT/test-243/file1
+d0fda5bf5d4fd70904ef1c1c56db28d0  SCRATCH_MNT/test-243/file3
+d0fda5bf5d4fd70904ef1c1c56db28d0  SCRATCH_MNT/test-243/file3.chk
+Dump extents
+[1048576] SCRATCH_MNT/test-243/file3
+Delayed allocation CoW extents:
+Shared data extents:
+Unwritten data extents:
+Hole data extents:
+Regular data extents:
+Dump extents after sync
+[1048576] SCRATCH_MNT/test-243/file3
+Delayed allocation CoW extents:
+Real CoW extents:
+Shared data extents:
+Unwritten data extents:
+Hole data extents:
+Regular data extents:
+Compare files
+bdbcf02ee0aa977795a79d25fcfdccb1  SCRATCH_MNT/test-243/file1
+d0fda5bf5d4fd70904ef1c1c56db28d0  SCRATCH_MNT/test-243/file3
+d0fda5bf5d4fd70904ef1c1c56db28d0  SCRATCH_MNT/test-243/file3.chk
diff --git a/tests/xfs/245 b/tests/xfs/245
new file mode 100755
index 0000000..6da701d
--- /dev/null
+++ b/tests/xfs/245
@@ -0,0 +1,95 @@
+#! /bin/bash
+# FS QA Test No. 245
+#
+# Make sure that reflink deals with extents going beyond EOF.
+# - fallocate 256k in file1
+# - pwrite 252-257k to cause it to speculatively prealloc file1
+# - reflink file1 to file2
+# - compare file[12]
+#
+#-----------------------------------------------------------------------
+# 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_reflink
+_require_xfs_io_command "falloc"
+_require_cp_reflink
+
+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
+
+echo "Create the original files"
+$XFS_IO_PROG -f -c "falloc 0 256k" -c "pwrite 252k 6k" $testdir/file1 >> $seqres.full
+_scratch_remount
+_cp_reflink $testdir/file1 $testdir/file2 >> $seqres.full
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file2 | _filter_scratch
+
+echo "Unwritten data extents"
+test $(_xfs_bmapx_find data $testdir/file1 '10000$') -gt 0 || \
+	echo "Expected to find an unwritten file1 extent"
+echo "Shared data extents"
+test $(_xfs_bmapx_find data $testdir/file1 '100000$') -gt 0 || \
+	echo "Expected to find a shared data extent"
+
+echo "Hole data extents"
+test $(_xfs_bmapx_find data $testdir/file2 'hole') -gt 0 || \
+	echo "Expected to find a hole data extent"
+echo "Shared data extents"
+test $(_xfs_bmapx_find data $testdir/file2 '100000$') -gt 0 || \
+	echo "Expected to find a shared data extent"
+
+echo "Hole cow extents"
+test $(_xfs_bmapx_find cow $testdir/file1 'hole') -gt 0 || \
+	echo "Expected to find a hole cow extent"
+echo "Hole cow extents"
+test $(_xfs_bmapx_find cow $testdir/file2 'hole') -gt 0 || \
+	echo "Expected to find a hole cow extent"
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/245.out b/tests/xfs/245.out
new file mode 100644
index 0000000..9a5fa5f
--- /dev/null
+++ b/tests/xfs/245.out
@@ -0,0 +1,12 @@
+QA output created by 245
+Format and mount
+Create the original files
+Compare files
+b0b91e1a18165fcd6549f2f5f3ef4823  SCRATCH_MNT/test-245/file1
+b0b91e1a18165fcd6549f2f5f3ef4823  SCRATCH_MNT/test-245/file2
+Unwritten data extents
+Shared data extents
+Hole data extents
+Shared data extents
+Hole cow extents
+Hole cow extents
diff --git a/tests/xfs/246 b/tests/xfs/246
new file mode 100755
index 0000000..13b0c98
--- /dev/null
+++ b/tests/xfs/246
@@ -0,0 +1,65 @@
+#! /bin/bash
+# FS QA Test No. 246
+#
+# Create an empty file and try to query the (nonexistant) CoW fork.
+#
+#-----------------------------------------------------------------------
+# 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
+
+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
+
+echo "Create the original files"
+touch $testdir/file1
+sync
+
+echo "Dump extents after sync"
+echo "Hole CoW extents:"
+$XFS_IO_PROG -c "bmap -clpv" $testdir/file1 | _filter_scratch
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/246.out b/tests/xfs/246.out
new file mode 100644
index 0000000..c543e74
--- /dev/null
+++ b/tests/xfs/246.out
@@ -0,0 +1,6 @@
+QA output created by 246
+Format and mount
+Create the original files
+Dump extents after sync
+Hole CoW extents:
+SCRATCH_MNT/test-246/file1: no extents
diff --git a/tests/xfs/group b/tests/xfs/group
index c0ce1f4..f6c7db8 100644
--- a/tests/xfs/group
+++ b/tests/xfs/group
@@ -240,7 +240,10 @@
 240 auto quick clone
 241 auto quick clone
 242 auto quick prealloc
+243 auto quick clone
 244 auto quota quick
+245 auto quick clone
+246 auto quick clone
 250 auto quick rw prealloc metadata
 252 auto quick prealloc
 253 auto quick

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

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

* [PATCH 29/32] reflink: test reflink+cow+enospc all at the same time
  2016-02-11 23:39 ` Darrick J. Wong
@ 2016-02-11 23:42   ` Darrick J. Wong
  -1 siblings, 0 replies; 81+ messages in thread
From: Darrick J. Wong @ 2016-02-11 23:42 UTC (permalink / raw)
  To: david, darrick.wong; +Cc: linux-btrfs, fstests, xfs

Set up an impossibly small filesystem and try to reflink and rewrite a
file on it to see what happens when we ENOSPC.  Basically
generic/16[67] but with a constrained fs size.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 tests/generic/166     |    6 ++-
 tests/generic/167     |    6 ++-
 tests/generic/333     |   99 +++++++++++++++++++++++++++++++++++++++++++++++++
 tests/generic/333.out |    4 ++
 tests/generic/334     |   98 +++++++++++++++++++++++++++++++++++++++++++++++++
 tests/generic/334.out |    4 ++
 tests/generic/group   |    2 +
 7 files changed, 217 insertions(+), 2 deletions(-)
 create mode 100755 tests/generic/333
 create mode 100644 tests/generic/333.out
 create mode 100755 tests/generic/334
 create mode 100644 tests/generic/334.out


diff --git a/tests/generic/166 b/tests/generic/166
index 9b177be..a1e4ff4 100755
--- a/tests/generic/166
+++ b/tests/generic/166
@@ -69,7 +69,11 @@ _scratch_remount
 snappy() {
 	n=0
 	while [ ! -e $testdir/finished ]; do
-		_cp_reflink $testdir/file1 $testdir/snap_$n || break
+		out="$(_cp_reflink $testdir/file1 $testdir/snap_$n 2>&1)"
+		res=$?
+		echo "$out" | grep -q "No space left" && break
+		test -n "$out" && echo "$out"
+		test $res -ne 0 && break
 		n=$((n + 1))
 	done
 }
diff --git a/tests/generic/167 b/tests/generic/167
index ef8e75b..76969c1 100755
--- a/tests/generic/167
+++ b/tests/generic/167
@@ -68,7 +68,11 @@ _scratch_remount
 snappy() {
 	n=0
 	while [ ! -e $testdir/finished ]; do
-		_cp_reflink $testdir/file1 $testdir/snap_$n || break
+		out="$(_cp_reflink $testdir/file1 $testdir/snap_$n 2>&1)"
+		res=$?
+		echo "$out" | grep -q "No space left" && break
+		test -n "$out" && echo "$out"
+		test $res -ne 0 && break
 		n=$((n + 1))
 	done
 }
diff --git a/tests/generic/333 b/tests/generic/333
new file mode 100755
index 0000000..b8a1ea8
--- /dev/null
+++ b/tests/generic/333
@@ -0,0 +1,99 @@
+#! /bin/bash
+# FS QA Test No. 333
+#
+# Test for races or FS corruption when trying to hit ENOSPC while DIO writing
+# to a file that's also the source of a reflink operation.
+#
+#-----------------------------------------------------------------------
+# 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.*
+    wait
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+. ./common/reflink
+
+# real QA test starts here
+_supported_os Linux
+_require_scratch_reflink
+_require_cp_reflink
+_require_odirect
+
+echo "Format and mount"
+_scratch_mkfs_sized $((400 * 1048576)) > $seqres.full 2>&1
+_scratch_mount >> $seqres.full 2>&1
+
+testdir=$SCRATCH_MNT/test-$seq
+mkdir $testdir
+
+loops=1024
+nr_loops=$((loops - 1))
+blksz=65536
+
+echo "Initialize file"
+echo > $seqres.full
+_pwrite_byte 0x61 0 $((loops * blksz)) $testdir/file1 >> $seqres.full
+_scratch_remount
+
+# Snapshot creator...
+snappy() {
+	n=0
+	while [ ! -e $testdir/finished ]; do
+		out="$(_cp_reflink $testdir/file1 $testdir/snap_$n 2>&1)"
+		res=$?
+		echo $out | grep -q "No space left" && break
+		test -n "$out" && echo $out
+		test $res -ne 0 && break
+		n=$((n + 1))
+	done
+	touch $testdir/abort
+}
+
+echo "Snapshot a file undergoing directio rewrite"
+snappy &
+seq 1 1000 | while read j; do
+	seq $nr_loops -1 0 | while read i; do
+		out="$(_pwrite_byte 0x63 $((i * blksz)) $blksz -d $testdir/file1 2>&1)"
+		echo $out >> $seqres.full
+		echo $out | grep -q "No space left" && touch $testdir/abort
+		echo $out | grep -qi "error" && touch $testdir/abort
+		test -e $testdir/abort && break
+	done
+	test -e $testdir/abort && break
+done
+touch $testdir/finished
+wait
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/333.out b/tests/generic/333.out
new file mode 100644
index 0000000..3354c98
--- /dev/null
+++ b/tests/generic/333.out
@@ -0,0 +1,4 @@
+QA output created by 333
+Format and mount
+Initialize file
+Snapshot a file undergoing directio rewrite
diff --git a/tests/generic/334 b/tests/generic/334
new file mode 100755
index 0000000..89601be
--- /dev/null
+++ b/tests/generic/334
@@ -0,0 +1,98 @@
+#! /bin/bash
+# FS QA Test No. 334
+#
+# Test for races or FS corruption when trying to hit ENOSPC while writing
+# to a file that's also the source of a reflink operation.
+#
+#-----------------------------------------------------------------------
+# 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.*
+    wait
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+. ./common/reflink
+
+# real QA test starts here
+_supported_os Linux
+_require_scratch_reflink
+_require_cp_reflink
+
+echo "Format and mount"
+_scratch_mkfs_sized $((400 * 1048576)) > $seqres.full 2>&1
+_scratch_mount >> $seqres.full 2>&1
+
+testdir=$SCRATCH_MNT/test-$seq
+mkdir $testdir
+
+loops=1024
+nr_loops=$((loops - 1))
+blksz=65536
+
+echo "Initialize file"
+echo > $seqres.full
+_pwrite_byte 0x61 0 $((loops * blksz)) $testdir/file1 >> $seqres.full
+_scratch_remount
+
+# Snapshot creator...
+snappy() {
+	n=0
+	while [ ! -e $testdir/finished ]; do
+		out="$(_cp_reflink $testdir/file1 $testdir/snap_$n 2>&1)"
+		res=$?
+		echo $out | grep -q "No space left" && break
+		test -n "$out" && echo $out
+		test $res -ne 0 && break
+		n=$((n + 1))
+	done
+	touch $testdir/abort
+}
+
+echo "Snapshot a file undergoing buffered rewrite"
+snappy &
+seq 1 1000 | while read j; do
+	seq $nr_loops -1 0 | while read i; do
+		out="$(_pwrite_byte 0x63 $((i * blksz)) $blksz $testdir/file1 2>&1)"
+		echo $out >> $seqres.full
+		echo $out | grep -q "No space left" && touch $testdir/abort
+		echo $out | grep -qi "error" && touch $testdir/abort
+		test -e $testdir/abort && break
+	done
+	test -e $testdir/abort && break
+done
+touch $testdir/finished
+wait
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/334.out b/tests/generic/334.out
new file mode 100644
index 0000000..c2c40fd
--- /dev/null
+++ b/tests/generic/334.out
@@ -0,0 +1,4 @@
+QA output created by 334
+Format and mount
+Initialize file
+Snapshot a file undergoing buffered rewrite
diff --git a/tests/generic/group b/tests/generic/group
index e7ed475..e3c4e8a 100644
--- a/tests/generic/group
+++ b/tests/generic/group
@@ -335,3 +335,5 @@
 330 auto quick clone
 331 auto quick clone
 332 auto quick clone
+333 auto quick clone
+334 auto quick clone


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

* [PATCH 29/32] reflink: test reflink+cow+enospc all at the same time
@ 2016-02-11 23:42   ` Darrick J. Wong
  0 siblings, 0 replies; 81+ messages in thread
From: Darrick J. Wong @ 2016-02-11 23:42 UTC (permalink / raw)
  To: david, darrick.wong; +Cc: fstests, linux-btrfs, xfs

Set up an impossibly small filesystem and try to reflink and rewrite a
file on it to see what happens when we ENOSPC.  Basically
generic/16[67] but with a constrained fs size.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 tests/generic/166     |    6 ++-
 tests/generic/167     |    6 ++-
 tests/generic/333     |   99 +++++++++++++++++++++++++++++++++++++++++++++++++
 tests/generic/333.out |    4 ++
 tests/generic/334     |   98 +++++++++++++++++++++++++++++++++++++++++++++++++
 tests/generic/334.out |    4 ++
 tests/generic/group   |    2 +
 7 files changed, 217 insertions(+), 2 deletions(-)
 create mode 100755 tests/generic/333
 create mode 100644 tests/generic/333.out
 create mode 100755 tests/generic/334
 create mode 100644 tests/generic/334.out


diff --git a/tests/generic/166 b/tests/generic/166
index 9b177be..a1e4ff4 100755
--- a/tests/generic/166
+++ b/tests/generic/166
@@ -69,7 +69,11 @@ _scratch_remount
 snappy() {
 	n=0
 	while [ ! -e $testdir/finished ]; do
-		_cp_reflink $testdir/file1 $testdir/snap_$n || break
+		out="$(_cp_reflink $testdir/file1 $testdir/snap_$n 2>&1)"
+		res=$?
+		echo "$out" | grep -q "No space left" && break
+		test -n "$out" && echo "$out"
+		test $res -ne 0 && break
 		n=$((n + 1))
 	done
 }
diff --git a/tests/generic/167 b/tests/generic/167
index ef8e75b..76969c1 100755
--- a/tests/generic/167
+++ b/tests/generic/167
@@ -68,7 +68,11 @@ _scratch_remount
 snappy() {
 	n=0
 	while [ ! -e $testdir/finished ]; do
-		_cp_reflink $testdir/file1 $testdir/snap_$n || break
+		out="$(_cp_reflink $testdir/file1 $testdir/snap_$n 2>&1)"
+		res=$?
+		echo "$out" | grep -q "No space left" && break
+		test -n "$out" && echo "$out"
+		test $res -ne 0 && break
 		n=$((n + 1))
 	done
 }
diff --git a/tests/generic/333 b/tests/generic/333
new file mode 100755
index 0000000..b8a1ea8
--- /dev/null
+++ b/tests/generic/333
@@ -0,0 +1,99 @@
+#! /bin/bash
+# FS QA Test No. 333
+#
+# Test for races or FS corruption when trying to hit ENOSPC while DIO writing
+# to a file that's also the source of a reflink operation.
+#
+#-----------------------------------------------------------------------
+# 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.*
+    wait
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+. ./common/reflink
+
+# real QA test starts here
+_supported_os Linux
+_require_scratch_reflink
+_require_cp_reflink
+_require_odirect
+
+echo "Format and mount"
+_scratch_mkfs_sized $((400 * 1048576)) > $seqres.full 2>&1
+_scratch_mount >> $seqres.full 2>&1
+
+testdir=$SCRATCH_MNT/test-$seq
+mkdir $testdir
+
+loops=1024
+nr_loops=$((loops - 1))
+blksz=65536
+
+echo "Initialize file"
+echo > $seqres.full
+_pwrite_byte 0x61 0 $((loops * blksz)) $testdir/file1 >> $seqres.full
+_scratch_remount
+
+# Snapshot creator...
+snappy() {
+	n=0
+	while [ ! -e $testdir/finished ]; do
+		out="$(_cp_reflink $testdir/file1 $testdir/snap_$n 2>&1)"
+		res=$?
+		echo $out | grep -q "No space left" && break
+		test -n "$out" && echo $out
+		test $res -ne 0 && break
+		n=$((n + 1))
+	done
+	touch $testdir/abort
+}
+
+echo "Snapshot a file undergoing directio rewrite"
+snappy &
+seq 1 1000 | while read j; do
+	seq $nr_loops -1 0 | while read i; do
+		out="$(_pwrite_byte 0x63 $((i * blksz)) $blksz -d $testdir/file1 2>&1)"
+		echo $out >> $seqres.full
+		echo $out | grep -q "No space left" && touch $testdir/abort
+		echo $out | grep -qi "error" && touch $testdir/abort
+		test -e $testdir/abort && break
+	done
+	test -e $testdir/abort && break
+done
+touch $testdir/finished
+wait
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/333.out b/tests/generic/333.out
new file mode 100644
index 0000000..3354c98
--- /dev/null
+++ b/tests/generic/333.out
@@ -0,0 +1,4 @@
+QA output created by 333
+Format and mount
+Initialize file
+Snapshot a file undergoing directio rewrite
diff --git a/tests/generic/334 b/tests/generic/334
new file mode 100755
index 0000000..89601be
--- /dev/null
+++ b/tests/generic/334
@@ -0,0 +1,98 @@
+#! /bin/bash
+# FS QA Test No. 334
+#
+# Test for races or FS corruption when trying to hit ENOSPC while writing
+# to a file that's also the source of a reflink operation.
+#
+#-----------------------------------------------------------------------
+# 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.*
+    wait
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+. ./common/reflink
+
+# real QA test starts here
+_supported_os Linux
+_require_scratch_reflink
+_require_cp_reflink
+
+echo "Format and mount"
+_scratch_mkfs_sized $((400 * 1048576)) > $seqres.full 2>&1
+_scratch_mount >> $seqres.full 2>&1
+
+testdir=$SCRATCH_MNT/test-$seq
+mkdir $testdir
+
+loops=1024
+nr_loops=$((loops - 1))
+blksz=65536
+
+echo "Initialize file"
+echo > $seqres.full
+_pwrite_byte 0x61 0 $((loops * blksz)) $testdir/file1 >> $seqres.full
+_scratch_remount
+
+# Snapshot creator...
+snappy() {
+	n=0
+	while [ ! -e $testdir/finished ]; do
+		out="$(_cp_reflink $testdir/file1 $testdir/snap_$n 2>&1)"
+		res=$?
+		echo $out | grep -q "No space left" && break
+		test -n "$out" && echo $out
+		test $res -ne 0 && break
+		n=$((n + 1))
+	done
+	touch $testdir/abort
+}
+
+echo "Snapshot a file undergoing buffered rewrite"
+snappy &
+seq 1 1000 | while read j; do
+	seq $nr_loops -1 0 | while read i; do
+		out="$(_pwrite_byte 0x63 $((i * blksz)) $blksz $testdir/file1 2>&1)"
+		echo $out >> $seqres.full
+		echo $out | grep -q "No space left" && touch $testdir/abort
+		echo $out | grep -qi "error" && touch $testdir/abort
+		test -e $testdir/abort && break
+	done
+	test -e $testdir/abort && break
+done
+touch $testdir/finished
+wait
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/334.out b/tests/generic/334.out
new file mode 100644
index 0000000..c2c40fd
--- /dev/null
+++ b/tests/generic/334.out
@@ -0,0 +1,4 @@
+QA output created by 334
+Format and mount
+Initialize file
+Snapshot a file undergoing buffered rewrite
diff --git a/tests/generic/group b/tests/generic/group
index e7ed475..e3c4e8a 100644
--- a/tests/generic/group
+++ b/tests/generic/group
@@ -335,3 +335,5 @@
 330 auto quick clone
 331 auto quick clone
 332 auto quick clone
+333 auto quick clone
+334 auto quick clone

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

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

* [PATCH 30/32] xfs: ensure that we don't crash when freeing the ag reservations on a ro mount
  2016-02-11 23:39 ` Darrick J. Wong
@ 2016-02-11 23:42   ` Darrick J. Wong
  -1 siblings, 0 replies; 81+ messages in thread
From: Darrick J. Wong @ 2016-02-11 23:42 UTC (permalink / raw)
  To: david, darrick.wong; +Cc: linux-btrfs, fstests, xfs

Christoph Hellwig discovered that the kernel crashed trying to free
the refcount btree per-ag reservation on a ro mount (because we don't
create the reservation except for rw mounts and ro->rw remounts).  So,
test this to make sure we never do that again. :)

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


diff --git a/tests/xfs/247 b/tests/xfs/247
new file mode 100755
index 0000000..1581dd3
--- /dev/null
+++ b/tests/xfs/247
@@ -0,0 +1,57 @@
+#! /bin/bash
+# FS QA Test No. 247
+#
+# Mount a reflink/rmap filesystem ro (so the per-AG reservation isn't
+# created) and unmount, to ensure that we free correctly.
+#
+#-----------------------------------------------------------------------
+# 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_reflink
+
+rm -f $seqres.full
+
+echo "Format and mount"
+_scratch_mkfs > $seqres.full 2>&1
+_scratch_mount -o ro >> $seqres.full 2>&1
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/247.out b/tests/xfs/247.out
new file mode 100644
index 0000000..a65574f
--- /dev/null
+++ b/tests/xfs/247.out
@@ -0,0 +1,2 @@
+QA output created by 247
+Format and mount
diff --git a/tests/xfs/group b/tests/xfs/group
index f6c7db8..6f43c79 100644
--- a/tests/xfs/group
+++ b/tests/xfs/group
@@ -244,6 +244,7 @@
 244 auto quota quick
 245 auto quick clone
 246 auto quick clone
+247 auto quick clone
 250 auto quick rw prealloc metadata
 252 auto quick prealloc
 253 auto quick


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

* [PATCH 30/32] xfs: ensure that we don't crash when freeing the ag reservations on a ro mount
@ 2016-02-11 23:42   ` Darrick J. Wong
  0 siblings, 0 replies; 81+ messages in thread
From: Darrick J. Wong @ 2016-02-11 23:42 UTC (permalink / raw)
  To: david, darrick.wong; +Cc: fstests, linux-btrfs, xfs

Christoph Hellwig discovered that the kernel crashed trying to free
the refcount btree per-ag reservation on a ro mount (because we don't
create the reservation except for rw mounts and ro->rw remounts).  So,
test this to make sure we never do that again. :)

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


diff --git a/tests/xfs/247 b/tests/xfs/247
new file mode 100755
index 0000000..1581dd3
--- /dev/null
+++ b/tests/xfs/247
@@ -0,0 +1,57 @@
+#! /bin/bash
+# FS QA Test No. 247
+#
+# Mount a reflink/rmap filesystem ro (so the per-AG reservation isn't
+# created) and unmount, to ensure that we free correctly.
+#
+#-----------------------------------------------------------------------
+# 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_reflink
+
+rm -f $seqres.full
+
+echo "Format and mount"
+_scratch_mkfs > $seqres.full 2>&1
+_scratch_mount -o ro >> $seqres.full 2>&1
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/247.out b/tests/xfs/247.out
new file mode 100644
index 0000000..a65574f
--- /dev/null
+++ b/tests/xfs/247.out
@@ -0,0 +1,2 @@
+QA output created by 247
+Format and mount
diff --git a/tests/xfs/group b/tests/xfs/group
index f6c7db8..6f43c79 100644
--- a/tests/xfs/group
+++ b/tests/xfs/group
@@ -244,6 +244,7 @@
 244 auto quota quick
 245 auto quick clone
 246 auto quick clone
+247 auto quick clone
 250 auto quick rw prealloc metadata
 252 auto quick prealloc
 253 auto quick

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

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

* [PATCH 31/32] xfs: test source CoW across mixed block types with cowextsz set
  2016-02-11 23:39 ` Darrick J. Wong
@ 2016-02-11 23:42   ` Darrick J. Wong
  -1 siblings, 0 replies; 81+ messages in thread
From: Darrick J. Wong @ 2016-02-11 23:42 UTC (permalink / raw)
  To: david, darrick.wong; +Cc: linux-btrfs, fstests, xfs

Ensure that we can CoW the source file when the source file consists
of a range of mixed block types and there's a cowextsize hint set.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 tests/xfs/248     |   91 ++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/xfs/248.out |   12 +++++++
 tests/xfs/249     |   92 +++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/xfs/249.out |   12 +++++++
 tests/xfs/251     |   93 +++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/xfs/251.out |   12 +++++++
 tests/xfs/254     |   94 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/xfs/254.out |   12 +++++++
 tests/xfs/255     |   93 +++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/xfs/255.out |   12 +++++++
 tests/xfs/256     |   94 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/xfs/256.out |   12 +++++++
 tests/xfs/257     |   95 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/xfs/257.out |   12 +++++++
 tests/xfs/258     |   96 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/xfs/258.out |   12 +++++++
 tests/xfs/group   |    8 ++++
 17 files changed, 852 insertions(+)
 create mode 100755 tests/xfs/248
 create mode 100644 tests/xfs/248.out
 create mode 100755 tests/xfs/249
 create mode 100644 tests/xfs/249.out
 create mode 100755 tests/xfs/251
 create mode 100644 tests/xfs/251.out
 create mode 100755 tests/xfs/254
 create mode 100644 tests/xfs/254.out
 create mode 100755 tests/xfs/255
 create mode 100644 tests/xfs/255.out
 create mode 100755 tests/xfs/256
 create mode 100644 tests/xfs/256.out
 create mode 100755 tests/xfs/257
 create mode 100644 tests/xfs/257.out
 create mode 100755 tests/xfs/258
 create mode 100644 tests/xfs/258.out


diff --git a/tests/xfs/248 b/tests/xfs/248
new file mode 100755
index 0000000..50771a1
--- /dev/null
+++ b/tests/xfs/248
@@ -0,0 +1,91 @@
+#! /bin/bash
+# FS QA Test No. 248
+#
+# Ensuring that copy on write in buffered mode to the source file when the
+# CoW range covers regular unshared and regular shared blocks.
+#   - Set cowextsz.
+#   - Create two files.
+#   - Reflink the odd blocks of the first file into the second file.
+#   - CoW the first file across the halfway mark, starting with the
+#     regular extent.
+#   - Check that the files are now different where we say they're different.
+#
+#-----------------------------------------------------------------------
+# 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
+_require_scratch_reflink
+_require_xfs_io_command "falloc"
+
+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
+
+echo "Create the original files"
+blksz=65536
+nr=64
+filesize=$((blksz * nr))
+$XFS_IO_PROG -c "cowextsize $((blksz * 16))" $testdir >> $seqres.full
+_sweave_reflink_regular $blksz $nr $testdir/file1 $testdir/file3 >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file3 | _filter_scratch
+md5sum $testdir/file1.chk | _filter_scratch
+
+echo "CoW across the transition"
+cowoff=$((filesize / 4))
+cowsz=$((filesize / 2))
+$XFS_IO_PROG -f -c "pwrite -S 0x63 -b $cowsz $cowoff $cowsz" $testdir/file1 >> $seqres.full
+_pwrite_byte 0x63 $cowoff $cowsz $testdir/file1.chk >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file3 | _filter_scratch
+md5sum $testdir/file1.chk | _filter_scratch
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/248.out b/tests/xfs/248.out
new file mode 100644
index 0000000..bb668ad
--- /dev/null
+++ b/tests/xfs/248.out
@@ -0,0 +1,12 @@
+QA output created by 248
+Format and mount
+Create the original files
+Compare files
+bdbcf02ee0aa977795a79d25fcfdccb1  SCRATCH_MNT/test-248/file1
+ce2023f765eba19677517c511886d5c9  SCRATCH_MNT/test-248/file3
+bdbcf02ee0aa977795a79d25fcfdccb1  SCRATCH_MNT/test-248/file1.chk
+CoW across the transition
+Compare files
+2dc2b131303b2f70ddb480778caac8b7  SCRATCH_MNT/test-248/file1
+ce2023f765eba19677517c511886d5c9  SCRATCH_MNT/test-248/file3
+2dc2b131303b2f70ddb480778caac8b7  SCRATCH_MNT/test-248/file1.chk
diff --git a/tests/xfs/249 b/tests/xfs/249
new file mode 100755
index 0000000..f2088ee
--- /dev/null
+++ b/tests/xfs/249
@@ -0,0 +1,92 @@
+#! /bin/bash
+# FS QA Test No. 249
+#
+# Ensuring that copy on write in directio mode to the source file when the
+# CoW range covers regular unshared and regular shared blocks.
+#   - Set cowextsz.
+#   - Create two files.
+#   - Reflink the odd blocks of the first file into the second file.
+#   - dio CoW the first file across the halfway mark, starting with the
+#     regular extent.
+#   - Check that the files are now different where we say they're different.
+#
+#-----------------------------------------------------------------------
+# 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
+_require_scratch_reflink
+_require_xfs_io_command "falloc"
+_require_odirect
+
+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
+
+echo "Create the original files"
+blksz=65536
+nr=64
+filesize=$((blksz * nr))
+$XFS_IO_PROG -c "cowextsize $((blksz * 16))" $testdir >> $seqres.full
+_sweave_reflink_regular $blksz $nr $testdir/file1 $testdir/file3 >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file3 | _filter_scratch
+md5sum $testdir/file1.chk | _filter_scratch
+
+echo "CoW across the transition"
+cowoff=$((filesize / 4))
+cowsz=$((filesize / 2))
+$XFS_IO_PROG -d -f -c "pwrite -S 0x63 -b $cowsz $cowoff $cowsz" $testdir/file1 >> $seqres.full
+_pwrite_byte 0x63 $cowoff $cowsz $testdir/file1.chk >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file3 | _filter_scratch
+md5sum $testdir/file1.chk | _filter_scratch
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/249.out b/tests/xfs/249.out
new file mode 100644
index 0000000..4a9728a
--- /dev/null
+++ b/tests/xfs/249.out
@@ -0,0 +1,12 @@
+QA output created by 249
+Format and mount
+Create the original files
+Compare files
+bdbcf02ee0aa977795a79d25fcfdccb1  SCRATCH_MNT/test-249/file1
+ce2023f765eba19677517c511886d5c9  SCRATCH_MNT/test-249/file3
+bdbcf02ee0aa977795a79d25fcfdccb1  SCRATCH_MNT/test-249/file1.chk
+CoW across the transition
+Compare files
+2dc2b131303b2f70ddb480778caac8b7  SCRATCH_MNT/test-249/file1
+ce2023f765eba19677517c511886d5c9  SCRATCH_MNT/test-249/file3
+2dc2b131303b2f70ddb480778caac8b7  SCRATCH_MNT/test-249/file1.chk
diff --git a/tests/xfs/251 b/tests/xfs/251
new file mode 100755
index 0000000..a2617bb
--- /dev/null
+++ b/tests/xfs/251
@@ -0,0 +1,93 @@
+#! /bin/bash
+# FS QA Test No. 251
+#
+# Ensuring that copy on write in buffered mode to the source file when the
+# CoW range covers unwritten and regular shared blocks.
+#   - Set cowextsz.
+#   - Create two files.
+#   - fallocate the first file.
+#   - Write the odd blocks of the first file.
+#   - Reflink the odd blocks of the first file into the second file.
+#   - CoW the first file across the halfway mark, starting with the
+#     regular extent.
+#   - Check that the files are now different where we say they're different.
+#
+#-----------------------------------------------------------------------
+# 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
+_require_scratch_reflink
+_require_xfs_io_command "falloc"
+
+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
+
+echo "Create the original files"
+blksz=65536
+nr=64
+filesize=$((blksz * nr))
+$XFS_IO_PROG -c "cowextsize $((blksz * 16))" $testdir >> $seqres.full
+_sweave_reflink_unwritten $blksz $nr $testdir/file1 $testdir/file3 >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file3 | _filter_scratch
+md5sum $testdir/file1.chk | _filter_scratch
+
+echo "CoW across the transition"
+cowoff=$((filesize / 4))
+cowsz=$((filesize / 2))
+$XFS_IO_PROG -f -c "pwrite -S 0x63 -b $cowsz $cowoff $cowsz" $testdir/file1 >> $seqres.full
+_pwrite_byte 0x63 $cowoff $cowsz $testdir/file1.chk >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file3 | _filter_scratch
+md5sum $testdir/file1.chk | _filter_scratch
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/251.out b/tests/xfs/251.out
new file mode 100644
index 0000000..bd6b222
--- /dev/null
+++ b/tests/xfs/251.out
@@ -0,0 +1,12 @@
+QA output created by 251
+Format and mount
+Create the original files
+Compare files
+b8a8a88d4c143f79900c4b4e79aa3e37  SCRATCH_MNT/test-251/file1
+ce2023f765eba19677517c511886d5c9  SCRATCH_MNT/test-251/file3
+b8a8a88d4c143f79900c4b4e79aa3e37  SCRATCH_MNT/test-251/file1.chk
+CoW across the transition
+Compare files
+e8cf59797f0b3758c8878c368bb4cf7e  SCRATCH_MNT/test-251/file1
+ce2023f765eba19677517c511886d5c9  SCRATCH_MNT/test-251/file3
+e8cf59797f0b3758c8878c368bb4cf7e  SCRATCH_MNT/test-251/file1.chk
diff --git a/tests/xfs/254 b/tests/xfs/254
new file mode 100755
index 0000000..f5cbbfe
--- /dev/null
+++ b/tests/xfs/254
@@ -0,0 +1,94 @@
+#! /bin/bash
+# FS QA Test No. 254
+#
+# Ensuring that copy on write in directio mode to the source file when the
+# CoW range covers unwritten and regular shared blocks.
+#   - Set cowextsz.
+#   - Create two files.
+#   - fallocate the first file.
+#   - Write the odd blocks of the first file.
+#   - Reflink the odd blocks of the first file into the second file.
+#   - DIO CoW the first file across the halfway mark, starting with the
+#     regular extent.
+#   - Check that the files are now different where we say they're different.
+#
+#-----------------------------------------------------------------------
+# 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
+_require_scratch_reflink
+_require_xfs_io_command "falloc"
+_require_odirect
+
+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
+
+echo "Create the original files"
+blksz=65536
+nr=64
+filesize=$((blksz * nr))
+$XFS_IO_PROG -c "cowextsize $((blksz * 16))" $testdir >> $seqres.full
+_sweave_reflink_unwritten $blksz $nr $testdir/file1 $testdir/file3 >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file3 | _filter_scratch
+md5sum $testdir/file1.chk | _filter_scratch
+
+echo "CoW across the transition"
+cowoff=$((filesize / 4))
+cowsz=$((filesize / 2))
+$XFS_IO_PROG -d -f -c "pwrite -S 0x63 -b $cowsz $cowoff $cowsz" $testdir/file1 >> $seqres.full
+_pwrite_byte 0x63 $cowoff $cowsz $testdir/file1.chk >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file3 | _filter_scratch
+md5sum $testdir/file1.chk | _filter_scratch
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/254.out b/tests/xfs/254.out
new file mode 100644
index 0000000..14c7772
--- /dev/null
+++ b/tests/xfs/254.out
@@ -0,0 +1,12 @@
+QA output created by 254
+Format and mount
+Create the original files
+Compare files
+b8a8a88d4c143f79900c4b4e79aa3e37  SCRATCH_MNT/test-254/file1
+ce2023f765eba19677517c511886d5c9  SCRATCH_MNT/test-254/file3
+b8a8a88d4c143f79900c4b4e79aa3e37  SCRATCH_MNT/test-254/file1.chk
+CoW across the transition
+Compare files
+e8cf59797f0b3758c8878c368bb4cf7e  SCRATCH_MNT/test-254/file1
+ce2023f765eba19677517c511886d5c9  SCRATCH_MNT/test-254/file3
+e8cf59797f0b3758c8878c368bb4cf7e  SCRATCH_MNT/test-254/file1.chk
diff --git a/tests/xfs/255 b/tests/xfs/255
new file mode 100755
index 0000000..7532d68
--- /dev/null
+++ b/tests/xfs/255
@@ -0,0 +1,93 @@
+#! /bin/bash
+# FS QA Test No. 255
+#
+# Ensuring that copy on write in buffered mode to the source file when the
+# CoW range covers holes and regular shared blocks.
+#   - Set cowextsz.
+#   - Create two files.
+#   - Truncate the first file.
+#   - Write the odd blocks of the first file.
+#   - Reflink the odd blocks of the first file into the second file.
+#   - CoW the first file across the halfway mark, starting with the
+#     regular extent.
+#   - Check that the files are now different where we say they're different.
+#
+#-----------------------------------------------------------------------
+# 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
+_require_scratch_reflink
+_require_xfs_io_command "falloc"
+
+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
+
+echo "Create the original files"
+blksz=65536
+nr=64
+filesize=$((blksz * nr))
+$XFS_IO_PROG -c "cowextsize $((blksz * 16))" $testdir >> $seqres.full
+_sweave_reflink_holes $blksz $nr $testdir/file1 $testdir/file3 >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file3 | _filter_scratch
+md5sum $testdir/file1.chk | _filter_scratch
+
+echo "CoW across the transition"
+cowoff=$((filesize / 4))
+cowsz=$((filesize / 2))
+$XFS_IO_PROG -f -c "pwrite -S 0x63 -b $cowsz $cowoff $cowsz" $testdir/file1 >> $seqres.full
+_pwrite_byte 0x63 $cowoff $cowsz $testdir/file1.chk >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file3 | _filter_scratch
+md5sum $testdir/file1.chk | _filter_scratch
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/255.out b/tests/xfs/255.out
new file mode 100644
index 0000000..7c665d1
--- /dev/null
+++ b/tests/xfs/255.out
@@ -0,0 +1,12 @@
+QA output created by 255
+Format and mount
+Create the original files
+Compare files
+b8a8a88d4c143f79900c4b4e79aa3e37  SCRATCH_MNT/test-255/file1
+ce2023f765eba19677517c511886d5c9  SCRATCH_MNT/test-255/file3
+b8a8a88d4c143f79900c4b4e79aa3e37  SCRATCH_MNT/test-255/file1.chk
+CoW across the transition
+Compare files
+e8cf59797f0b3758c8878c368bb4cf7e  SCRATCH_MNT/test-255/file1
+ce2023f765eba19677517c511886d5c9  SCRATCH_MNT/test-255/file3
+e8cf59797f0b3758c8878c368bb4cf7e  SCRATCH_MNT/test-255/file1.chk
diff --git a/tests/xfs/256 b/tests/xfs/256
new file mode 100755
index 0000000..ea8bd69
--- /dev/null
+++ b/tests/xfs/256
@@ -0,0 +1,94 @@
+#! /bin/bash
+# FS QA Test No. 256
+#
+# Ensuring that copy on write in directio mode to the source file when the
+# CoW range covers holes and regular shared blocks.
+#   - Set cowextsz.
+#   - Create two files.
+#   - Truncate the first file.
+#   - Write the odd blocks of the first file.
+#   - Reflink the odd blocks of the first file into the second file.
+#   - DIO CoW the first file across the halfway mark, starting with the
+#     regular extent.
+#   - Check that the files are now different where we say they're different.
+#
+#-----------------------------------------------------------------------
+# 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
+_require_scratch_reflink
+_require_xfs_io_command "falloc"
+_require_odirect
+
+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
+
+echo "Create the original files"
+blksz=65536
+nr=64
+filesize=$((blksz * nr))
+$XFS_IO_PROG -c "cowextsize $((blksz * 16))" $testdir >> $seqres.full
+_sweave_reflink_holes $blksz $nr $testdir/file1 $testdir/file3 >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file3 | _filter_scratch
+md5sum $testdir/file1.chk | _filter_scratch
+
+echo "CoW across the transition"
+cowoff=$((filesize / 4))
+cowsz=$((filesize / 2))
+$XFS_IO_PROG -d -f -c "pwrite -S 0x63 -b $cowsz $cowoff $cowsz" $testdir/file1 >> $seqres.full
+_pwrite_byte 0x63 $cowoff $cowsz $testdir/file1.chk >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file3 | _filter_scratch
+md5sum $testdir/file1.chk | _filter_scratch
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/256.out b/tests/xfs/256.out
new file mode 100644
index 0000000..5c3d36c
--- /dev/null
+++ b/tests/xfs/256.out
@@ -0,0 +1,12 @@
+QA output created by 256
+Format and mount
+Create the original files
+Compare files
+b8a8a88d4c143f79900c4b4e79aa3e37  SCRATCH_MNT/test-256/file1
+ce2023f765eba19677517c511886d5c9  SCRATCH_MNT/test-256/file3
+b8a8a88d4c143f79900c4b4e79aa3e37  SCRATCH_MNT/test-256/file1.chk
+CoW across the transition
+Compare files
+e8cf59797f0b3758c8878c368bb4cf7e  SCRATCH_MNT/test-256/file1
+ce2023f765eba19677517c511886d5c9  SCRATCH_MNT/test-256/file3
+e8cf59797f0b3758c8878c368bb4cf7e  SCRATCH_MNT/test-256/file1.chk
diff --git a/tests/xfs/257 b/tests/xfs/257
new file mode 100755
index 0000000..05a3d25
--- /dev/null
+++ b/tests/xfs/257
@@ -0,0 +1,95 @@
+#! /bin/bash
+# FS QA Test No. 257
+#
+# Ensuring that copy on write in buffered mode to the source file when the
+# CoW range covers delalloc blocks and regular shared blocks.
+#   - Set cowextsz.
+#   - Create two files.
+#   - Truncate the first file.
+#   - Write the odd blocks of the first file.
+#   - Reflink the odd blocks of the first file into the second file.
+#   - Write the even blocks of the first file.
+#   - CoW the first file across the halfway mark, starting with the
+#     regular extent.
+#   - Check that the files are now different where we say they're different.
+#
+#-----------------------------------------------------------------------
+# 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
+_require_scratch_reflink
+_require_xfs_io_command "falloc"
+
+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
+
+echo "Create the original files"
+blksz=65536
+nr=64
+filesize=$((blksz * nr))
+$XFS_IO_PROG -c "cowextsize $((blksz * 16))" $testdir >> $seqres.full
+_sweave_reflink_holes $blksz $nr $testdir/file1 $testdir/file3 >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file3 | _filter_scratch
+md5sum $testdir/file1.chk | _filter_scratch
+
+echo "CoW across the transition"
+cowoff=$((filesize / 4))
+cowsz=$((filesize / 2))
+_sweave_reflink_holes_delalloc $blksz $nr $testdir/file1 >> $seqres.full
+$XFS_IO_PROG -f -c "pwrite -S 0x63 -b $cowsz $cowoff $cowsz" $testdir/file1 >> $seqres.full
+_pwrite_byte 0x63 $cowoff $cowsz $testdir/file1.chk >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file3 | _filter_scratch
+md5sum $testdir/file1.chk | _filter_scratch
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/257.out b/tests/xfs/257.out
new file mode 100644
index 0000000..0f27f03
--- /dev/null
+++ b/tests/xfs/257.out
@@ -0,0 +1,12 @@
+QA output created by 257
+Format and mount
+Create the original files
+Compare files
+b8a8a88d4c143f79900c4b4e79aa3e37  SCRATCH_MNT/test-257/file1
+ce2023f765eba19677517c511886d5c9  SCRATCH_MNT/test-257/file3
+b8a8a88d4c143f79900c4b4e79aa3e37  SCRATCH_MNT/test-257/file1.chk
+CoW across the transition
+Compare files
+35e2170e14665b780c6dec328d6a263b  SCRATCH_MNT/test-257/file1
+ce2023f765eba19677517c511886d5c9  SCRATCH_MNT/test-257/file3
+35e2170e14665b780c6dec328d6a263b  SCRATCH_MNT/test-257/file1.chk
diff --git a/tests/xfs/258 b/tests/xfs/258
new file mode 100755
index 0000000..ad7cb83
--- /dev/null
+++ b/tests/xfs/258
@@ -0,0 +1,96 @@
+#! /bin/bash
+# FS QA Test No. 258
+#
+# Ensuring that copy on write in directio mode to the source file when the
+# CoW range covers delalloc blocks and regular shared blocks.
+#   - Set cowextsz.
+#   - Create two files.
+#   - Truncate the first file.
+#   - Write the odd blocks of the first file.
+#   - Reflink the odd blocks of the first file into the second file.
+#   - Write the even blocks of the first file.
+#   - DIO CoW the first file across the halfway mark, starting with the
+#     regular extent.
+#   - Check that the files are now different where we say they're different.
+#
+#-----------------------------------------------------------------------
+# 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
+_require_scratch_reflink
+_require_xfs_io_command "falloc"
+_require_odirect
+
+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
+
+echo "Create the original files"
+blksz=65536
+nr=64
+filesize=$((blksz * nr))
+$XFS_IO_PROG -c "cowextsize $((blksz * 16))" $testdir >> $seqres.full
+_sweave_reflink_holes $blksz $nr $testdir/file1 $testdir/file3 >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file3 | _filter_scratch
+md5sum $testdir/file1.chk | _filter_scratch
+
+echo "CoW across the transition"
+cowoff=$((filesize / 4))
+cowsz=$((filesize / 2))
+_sweave_reflink_holes_delalloc $blksz $nr $testdir/file1 >> $seqres.full
+$XFS_IO_PROG -d -f -c "pwrite -S 0x63 -b $cowsz $cowoff $cowsz" $testdir/file1 >> $seqres.full
+_pwrite_byte 0x63 $cowoff $cowsz $testdir/file1.chk >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file3 | _filter_scratch
+md5sum $testdir/file1.chk | _filter_scratch
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/258.out b/tests/xfs/258.out
new file mode 100644
index 0000000..ccaca02
--- /dev/null
+++ b/tests/xfs/258.out
@@ -0,0 +1,12 @@
+QA output created by 258
+Format and mount
+Create the original files
+Compare files
+b8a8a88d4c143f79900c4b4e79aa3e37  SCRATCH_MNT/test-258/file1
+ce2023f765eba19677517c511886d5c9  SCRATCH_MNT/test-258/file3
+b8a8a88d4c143f79900c4b4e79aa3e37  SCRATCH_MNT/test-258/file1.chk
+CoW across the transition
+Compare files
+35e2170e14665b780c6dec328d6a263b  SCRATCH_MNT/test-258/file1
+ce2023f765eba19677517c511886d5c9  SCRATCH_MNT/test-258/file3
+35e2170e14665b780c6dec328d6a263b  SCRATCH_MNT/test-258/file1.chk
diff --git a/tests/xfs/group b/tests/xfs/group
index 6f43c79..4fb7618 100644
--- a/tests/xfs/group
+++ b/tests/xfs/group
@@ -245,9 +245,17 @@
 245 auto quick clone
 246 auto quick clone
 247 auto quick clone
+248 auto quick clone
+249 auto quick clone
 250 auto quick rw prealloc metadata
+251 auto quick clone
 252 auto quick prealloc
 253 auto quick
+254 auto quick clone
+255 auto quick clone
+256 auto quick clone
+257 auto quick clone
+258 auto quick clone
 259 auto quick
 261 auto quick quota
 262 auto quick quota


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

* [PATCH 31/32] xfs: test source CoW across mixed block types with cowextsz set
@ 2016-02-11 23:42   ` Darrick J. Wong
  0 siblings, 0 replies; 81+ messages in thread
From: Darrick J. Wong @ 2016-02-11 23:42 UTC (permalink / raw)
  To: david, darrick.wong; +Cc: fstests, linux-btrfs, xfs

Ensure that we can CoW the source file when the source file consists
of a range of mixed block types and there's a cowextsize hint set.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 tests/xfs/248     |   91 ++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/xfs/248.out |   12 +++++++
 tests/xfs/249     |   92 +++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/xfs/249.out |   12 +++++++
 tests/xfs/251     |   93 +++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/xfs/251.out |   12 +++++++
 tests/xfs/254     |   94 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/xfs/254.out |   12 +++++++
 tests/xfs/255     |   93 +++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/xfs/255.out |   12 +++++++
 tests/xfs/256     |   94 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/xfs/256.out |   12 +++++++
 tests/xfs/257     |   95 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/xfs/257.out |   12 +++++++
 tests/xfs/258     |   96 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/xfs/258.out |   12 +++++++
 tests/xfs/group   |    8 ++++
 17 files changed, 852 insertions(+)
 create mode 100755 tests/xfs/248
 create mode 100644 tests/xfs/248.out
 create mode 100755 tests/xfs/249
 create mode 100644 tests/xfs/249.out
 create mode 100755 tests/xfs/251
 create mode 100644 tests/xfs/251.out
 create mode 100755 tests/xfs/254
 create mode 100644 tests/xfs/254.out
 create mode 100755 tests/xfs/255
 create mode 100644 tests/xfs/255.out
 create mode 100755 tests/xfs/256
 create mode 100644 tests/xfs/256.out
 create mode 100755 tests/xfs/257
 create mode 100644 tests/xfs/257.out
 create mode 100755 tests/xfs/258
 create mode 100644 tests/xfs/258.out


diff --git a/tests/xfs/248 b/tests/xfs/248
new file mode 100755
index 0000000..50771a1
--- /dev/null
+++ b/tests/xfs/248
@@ -0,0 +1,91 @@
+#! /bin/bash
+# FS QA Test No. 248
+#
+# Ensuring that copy on write in buffered mode to the source file when the
+# CoW range covers regular unshared and regular shared blocks.
+#   - Set cowextsz.
+#   - Create two files.
+#   - Reflink the odd blocks of the first file into the second file.
+#   - CoW the first file across the halfway mark, starting with the
+#     regular extent.
+#   - Check that the files are now different where we say they're different.
+#
+#-----------------------------------------------------------------------
+# 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
+_require_scratch_reflink
+_require_xfs_io_command "falloc"
+
+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
+
+echo "Create the original files"
+blksz=65536
+nr=64
+filesize=$((blksz * nr))
+$XFS_IO_PROG -c "cowextsize $((blksz * 16))" $testdir >> $seqres.full
+_sweave_reflink_regular $blksz $nr $testdir/file1 $testdir/file3 >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file3 | _filter_scratch
+md5sum $testdir/file1.chk | _filter_scratch
+
+echo "CoW across the transition"
+cowoff=$((filesize / 4))
+cowsz=$((filesize / 2))
+$XFS_IO_PROG -f -c "pwrite -S 0x63 -b $cowsz $cowoff $cowsz" $testdir/file1 >> $seqres.full
+_pwrite_byte 0x63 $cowoff $cowsz $testdir/file1.chk >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file3 | _filter_scratch
+md5sum $testdir/file1.chk | _filter_scratch
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/248.out b/tests/xfs/248.out
new file mode 100644
index 0000000..bb668ad
--- /dev/null
+++ b/tests/xfs/248.out
@@ -0,0 +1,12 @@
+QA output created by 248
+Format and mount
+Create the original files
+Compare files
+bdbcf02ee0aa977795a79d25fcfdccb1  SCRATCH_MNT/test-248/file1
+ce2023f765eba19677517c511886d5c9  SCRATCH_MNT/test-248/file3
+bdbcf02ee0aa977795a79d25fcfdccb1  SCRATCH_MNT/test-248/file1.chk
+CoW across the transition
+Compare files
+2dc2b131303b2f70ddb480778caac8b7  SCRATCH_MNT/test-248/file1
+ce2023f765eba19677517c511886d5c9  SCRATCH_MNT/test-248/file3
+2dc2b131303b2f70ddb480778caac8b7  SCRATCH_MNT/test-248/file1.chk
diff --git a/tests/xfs/249 b/tests/xfs/249
new file mode 100755
index 0000000..f2088ee
--- /dev/null
+++ b/tests/xfs/249
@@ -0,0 +1,92 @@
+#! /bin/bash
+# FS QA Test No. 249
+#
+# Ensuring that copy on write in directio mode to the source file when the
+# CoW range covers regular unshared and regular shared blocks.
+#   - Set cowextsz.
+#   - Create two files.
+#   - Reflink the odd blocks of the first file into the second file.
+#   - dio CoW the first file across the halfway mark, starting with the
+#     regular extent.
+#   - Check that the files are now different where we say they're different.
+#
+#-----------------------------------------------------------------------
+# 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
+_require_scratch_reflink
+_require_xfs_io_command "falloc"
+_require_odirect
+
+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
+
+echo "Create the original files"
+blksz=65536
+nr=64
+filesize=$((blksz * nr))
+$XFS_IO_PROG -c "cowextsize $((blksz * 16))" $testdir >> $seqres.full
+_sweave_reflink_regular $blksz $nr $testdir/file1 $testdir/file3 >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file3 | _filter_scratch
+md5sum $testdir/file1.chk | _filter_scratch
+
+echo "CoW across the transition"
+cowoff=$((filesize / 4))
+cowsz=$((filesize / 2))
+$XFS_IO_PROG -d -f -c "pwrite -S 0x63 -b $cowsz $cowoff $cowsz" $testdir/file1 >> $seqres.full
+_pwrite_byte 0x63 $cowoff $cowsz $testdir/file1.chk >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file3 | _filter_scratch
+md5sum $testdir/file1.chk | _filter_scratch
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/249.out b/tests/xfs/249.out
new file mode 100644
index 0000000..4a9728a
--- /dev/null
+++ b/tests/xfs/249.out
@@ -0,0 +1,12 @@
+QA output created by 249
+Format and mount
+Create the original files
+Compare files
+bdbcf02ee0aa977795a79d25fcfdccb1  SCRATCH_MNT/test-249/file1
+ce2023f765eba19677517c511886d5c9  SCRATCH_MNT/test-249/file3
+bdbcf02ee0aa977795a79d25fcfdccb1  SCRATCH_MNT/test-249/file1.chk
+CoW across the transition
+Compare files
+2dc2b131303b2f70ddb480778caac8b7  SCRATCH_MNT/test-249/file1
+ce2023f765eba19677517c511886d5c9  SCRATCH_MNT/test-249/file3
+2dc2b131303b2f70ddb480778caac8b7  SCRATCH_MNT/test-249/file1.chk
diff --git a/tests/xfs/251 b/tests/xfs/251
new file mode 100755
index 0000000..a2617bb
--- /dev/null
+++ b/tests/xfs/251
@@ -0,0 +1,93 @@
+#! /bin/bash
+# FS QA Test No. 251
+#
+# Ensuring that copy on write in buffered mode to the source file when the
+# CoW range covers unwritten and regular shared blocks.
+#   - Set cowextsz.
+#   - Create two files.
+#   - fallocate the first file.
+#   - Write the odd blocks of the first file.
+#   - Reflink the odd blocks of the first file into the second file.
+#   - CoW the first file across the halfway mark, starting with the
+#     regular extent.
+#   - Check that the files are now different where we say they're different.
+#
+#-----------------------------------------------------------------------
+# 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
+_require_scratch_reflink
+_require_xfs_io_command "falloc"
+
+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
+
+echo "Create the original files"
+blksz=65536
+nr=64
+filesize=$((blksz * nr))
+$XFS_IO_PROG -c "cowextsize $((blksz * 16))" $testdir >> $seqres.full
+_sweave_reflink_unwritten $blksz $nr $testdir/file1 $testdir/file3 >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file3 | _filter_scratch
+md5sum $testdir/file1.chk | _filter_scratch
+
+echo "CoW across the transition"
+cowoff=$((filesize / 4))
+cowsz=$((filesize / 2))
+$XFS_IO_PROG -f -c "pwrite -S 0x63 -b $cowsz $cowoff $cowsz" $testdir/file1 >> $seqres.full
+_pwrite_byte 0x63 $cowoff $cowsz $testdir/file1.chk >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file3 | _filter_scratch
+md5sum $testdir/file1.chk | _filter_scratch
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/251.out b/tests/xfs/251.out
new file mode 100644
index 0000000..bd6b222
--- /dev/null
+++ b/tests/xfs/251.out
@@ -0,0 +1,12 @@
+QA output created by 251
+Format and mount
+Create the original files
+Compare files
+b8a8a88d4c143f79900c4b4e79aa3e37  SCRATCH_MNT/test-251/file1
+ce2023f765eba19677517c511886d5c9  SCRATCH_MNT/test-251/file3
+b8a8a88d4c143f79900c4b4e79aa3e37  SCRATCH_MNT/test-251/file1.chk
+CoW across the transition
+Compare files
+e8cf59797f0b3758c8878c368bb4cf7e  SCRATCH_MNT/test-251/file1
+ce2023f765eba19677517c511886d5c9  SCRATCH_MNT/test-251/file3
+e8cf59797f0b3758c8878c368bb4cf7e  SCRATCH_MNT/test-251/file1.chk
diff --git a/tests/xfs/254 b/tests/xfs/254
new file mode 100755
index 0000000..f5cbbfe
--- /dev/null
+++ b/tests/xfs/254
@@ -0,0 +1,94 @@
+#! /bin/bash
+# FS QA Test No. 254
+#
+# Ensuring that copy on write in directio mode to the source file when the
+# CoW range covers unwritten and regular shared blocks.
+#   - Set cowextsz.
+#   - Create two files.
+#   - fallocate the first file.
+#   - Write the odd blocks of the first file.
+#   - Reflink the odd blocks of the first file into the second file.
+#   - DIO CoW the first file across the halfway mark, starting with the
+#     regular extent.
+#   - Check that the files are now different where we say they're different.
+#
+#-----------------------------------------------------------------------
+# 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
+_require_scratch_reflink
+_require_xfs_io_command "falloc"
+_require_odirect
+
+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
+
+echo "Create the original files"
+blksz=65536
+nr=64
+filesize=$((blksz * nr))
+$XFS_IO_PROG -c "cowextsize $((blksz * 16))" $testdir >> $seqres.full
+_sweave_reflink_unwritten $blksz $nr $testdir/file1 $testdir/file3 >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file3 | _filter_scratch
+md5sum $testdir/file1.chk | _filter_scratch
+
+echo "CoW across the transition"
+cowoff=$((filesize / 4))
+cowsz=$((filesize / 2))
+$XFS_IO_PROG -d -f -c "pwrite -S 0x63 -b $cowsz $cowoff $cowsz" $testdir/file1 >> $seqres.full
+_pwrite_byte 0x63 $cowoff $cowsz $testdir/file1.chk >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file3 | _filter_scratch
+md5sum $testdir/file1.chk | _filter_scratch
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/254.out b/tests/xfs/254.out
new file mode 100644
index 0000000..14c7772
--- /dev/null
+++ b/tests/xfs/254.out
@@ -0,0 +1,12 @@
+QA output created by 254
+Format and mount
+Create the original files
+Compare files
+b8a8a88d4c143f79900c4b4e79aa3e37  SCRATCH_MNT/test-254/file1
+ce2023f765eba19677517c511886d5c9  SCRATCH_MNT/test-254/file3
+b8a8a88d4c143f79900c4b4e79aa3e37  SCRATCH_MNT/test-254/file1.chk
+CoW across the transition
+Compare files
+e8cf59797f0b3758c8878c368bb4cf7e  SCRATCH_MNT/test-254/file1
+ce2023f765eba19677517c511886d5c9  SCRATCH_MNT/test-254/file3
+e8cf59797f0b3758c8878c368bb4cf7e  SCRATCH_MNT/test-254/file1.chk
diff --git a/tests/xfs/255 b/tests/xfs/255
new file mode 100755
index 0000000..7532d68
--- /dev/null
+++ b/tests/xfs/255
@@ -0,0 +1,93 @@
+#! /bin/bash
+# FS QA Test No. 255
+#
+# Ensuring that copy on write in buffered mode to the source file when the
+# CoW range covers holes and regular shared blocks.
+#   - Set cowextsz.
+#   - Create two files.
+#   - Truncate the first file.
+#   - Write the odd blocks of the first file.
+#   - Reflink the odd blocks of the first file into the second file.
+#   - CoW the first file across the halfway mark, starting with the
+#     regular extent.
+#   - Check that the files are now different where we say they're different.
+#
+#-----------------------------------------------------------------------
+# 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
+_require_scratch_reflink
+_require_xfs_io_command "falloc"
+
+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
+
+echo "Create the original files"
+blksz=65536
+nr=64
+filesize=$((blksz * nr))
+$XFS_IO_PROG -c "cowextsize $((blksz * 16))" $testdir >> $seqres.full
+_sweave_reflink_holes $blksz $nr $testdir/file1 $testdir/file3 >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file3 | _filter_scratch
+md5sum $testdir/file1.chk | _filter_scratch
+
+echo "CoW across the transition"
+cowoff=$((filesize / 4))
+cowsz=$((filesize / 2))
+$XFS_IO_PROG -f -c "pwrite -S 0x63 -b $cowsz $cowoff $cowsz" $testdir/file1 >> $seqres.full
+_pwrite_byte 0x63 $cowoff $cowsz $testdir/file1.chk >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file3 | _filter_scratch
+md5sum $testdir/file1.chk | _filter_scratch
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/255.out b/tests/xfs/255.out
new file mode 100644
index 0000000..7c665d1
--- /dev/null
+++ b/tests/xfs/255.out
@@ -0,0 +1,12 @@
+QA output created by 255
+Format and mount
+Create the original files
+Compare files
+b8a8a88d4c143f79900c4b4e79aa3e37  SCRATCH_MNT/test-255/file1
+ce2023f765eba19677517c511886d5c9  SCRATCH_MNT/test-255/file3
+b8a8a88d4c143f79900c4b4e79aa3e37  SCRATCH_MNT/test-255/file1.chk
+CoW across the transition
+Compare files
+e8cf59797f0b3758c8878c368bb4cf7e  SCRATCH_MNT/test-255/file1
+ce2023f765eba19677517c511886d5c9  SCRATCH_MNT/test-255/file3
+e8cf59797f0b3758c8878c368bb4cf7e  SCRATCH_MNT/test-255/file1.chk
diff --git a/tests/xfs/256 b/tests/xfs/256
new file mode 100755
index 0000000..ea8bd69
--- /dev/null
+++ b/tests/xfs/256
@@ -0,0 +1,94 @@
+#! /bin/bash
+# FS QA Test No. 256
+#
+# Ensuring that copy on write in directio mode to the source file when the
+# CoW range covers holes and regular shared blocks.
+#   - Set cowextsz.
+#   - Create two files.
+#   - Truncate the first file.
+#   - Write the odd blocks of the first file.
+#   - Reflink the odd blocks of the first file into the second file.
+#   - DIO CoW the first file across the halfway mark, starting with the
+#     regular extent.
+#   - Check that the files are now different where we say they're different.
+#
+#-----------------------------------------------------------------------
+# 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
+_require_scratch_reflink
+_require_xfs_io_command "falloc"
+_require_odirect
+
+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
+
+echo "Create the original files"
+blksz=65536
+nr=64
+filesize=$((blksz * nr))
+$XFS_IO_PROG -c "cowextsize $((blksz * 16))" $testdir >> $seqres.full
+_sweave_reflink_holes $blksz $nr $testdir/file1 $testdir/file3 >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file3 | _filter_scratch
+md5sum $testdir/file1.chk | _filter_scratch
+
+echo "CoW across the transition"
+cowoff=$((filesize / 4))
+cowsz=$((filesize / 2))
+$XFS_IO_PROG -d -f -c "pwrite -S 0x63 -b $cowsz $cowoff $cowsz" $testdir/file1 >> $seqres.full
+_pwrite_byte 0x63 $cowoff $cowsz $testdir/file1.chk >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file3 | _filter_scratch
+md5sum $testdir/file1.chk | _filter_scratch
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/256.out b/tests/xfs/256.out
new file mode 100644
index 0000000..5c3d36c
--- /dev/null
+++ b/tests/xfs/256.out
@@ -0,0 +1,12 @@
+QA output created by 256
+Format and mount
+Create the original files
+Compare files
+b8a8a88d4c143f79900c4b4e79aa3e37  SCRATCH_MNT/test-256/file1
+ce2023f765eba19677517c511886d5c9  SCRATCH_MNT/test-256/file3
+b8a8a88d4c143f79900c4b4e79aa3e37  SCRATCH_MNT/test-256/file1.chk
+CoW across the transition
+Compare files
+e8cf59797f0b3758c8878c368bb4cf7e  SCRATCH_MNT/test-256/file1
+ce2023f765eba19677517c511886d5c9  SCRATCH_MNT/test-256/file3
+e8cf59797f0b3758c8878c368bb4cf7e  SCRATCH_MNT/test-256/file1.chk
diff --git a/tests/xfs/257 b/tests/xfs/257
new file mode 100755
index 0000000..05a3d25
--- /dev/null
+++ b/tests/xfs/257
@@ -0,0 +1,95 @@
+#! /bin/bash
+# FS QA Test No. 257
+#
+# Ensuring that copy on write in buffered mode to the source file when the
+# CoW range covers delalloc blocks and regular shared blocks.
+#   - Set cowextsz.
+#   - Create two files.
+#   - Truncate the first file.
+#   - Write the odd blocks of the first file.
+#   - Reflink the odd blocks of the first file into the second file.
+#   - Write the even blocks of the first file.
+#   - CoW the first file across the halfway mark, starting with the
+#     regular extent.
+#   - Check that the files are now different where we say they're different.
+#
+#-----------------------------------------------------------------------
+# 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
+_require_scratch_reflink
+_require_xfs_io_command "falloc"
+
+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
+
+echo "Create the original files"
+blksz=65536
+nr=64
+filesize=$((blksz * nr))
+$XFS_IO_PROG -c "cowextsize $((blksz * 16))" $testdir >> $seqres.full
+_sweave_reflink_holes $blksz $nr $testdir/file1 $testdir/file3 >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file3 | _filter_scratch
+md5sum $testdir/file1.chk | _filter_scratch
+
+echo "CoW across the transition"
+cowoff=$((filesize / 4))
+cowsz=$((filesize / 2))
+_sweave_reflink_holes_delalloc $blksz $nr $testdir/file1 >> $seqres.full
+$XFS_IO_PROG -f -c "pwrite -S 0x63 -b $cowsz $cowoff $cowsz" $testdir/file1 >> $seqres.full
+_pwrite_byte 0x63 $cowoff $cowsz $testdir/file1.chk >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file3 | _filter_scratch
+md5sum $testdir/file1.chk | _filter_scratch
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/257.out b/tests/xfs/257.out
new file mode 100644
index 0000000..0f27f03
--- /dev/null
+++ b/tests/xfs/257.out
@@ -0,0 +1,12 @@
+QA output created by 257
+Format and mount
+Create the original files
+Compare files
+b8a8a88d4c143f79900c4b4e79aa3e37  SCRATCH_MNT/test-257/file1
+ce2023f765eba19677517c511886d5c9  SCRATCH_MNT/test-257/file3
+b8a8a88d4c143f79900c4b4e79aa3e37  SCRATCH_MNT/test-257/file1.chk
+CoW across the transition
+Compare files
+35e2170e14665b780c6dec328d6a263b  SCRATCH_MNT/test-257/file1
+ce2023f765eba19677517c511886d5c9  SCRATCH_MNT/test-257/file3
+35e2170e14665b780c6dec328d6a263b  SCRATCH_MNT/test-257/file1.chk
diff --git a/tests/xfs/258 b/tests/xfs/258
new file mode 100755
index 0000000..ad7cb83
--- /dev/null
+++ b/tests/xfs/258
@@ -0,0 +1,96 @@
+#! /bin/bash
+# FS QA Test No. 258
+#
+# Ensuring that copy on write in directio mode to the source file when the
+# CoW range covers delalloc blocks and regular shared blocks.
+#   - Set cowextsz.
+#   - Create two files.
+#   - Truncate the first file.
+#   - Write the odd blocks of the first file.
+#   - Reflink the odd blocks of the first file into the second file.
+#   - Write the even blocks of the first file.
+#   - DIO CoW the first file across the halfway mark, starting with the
+#     regular extent.
+#   - Check that the files are now different where we say they're different.
+#
+#-----------------------------------------------------------------------
+# 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
+_require_scratch_reflink
+_require_xfs_io_command "falloc"
+_require_odirect
+
+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
+
+echo "Create the original files"
+blksz=65536
+nr=64
+filesize=$((blksz * nr))
+$XFS_IO_PROG -c "cowextsize $((blksz * 16))" $testdir >> $seqres.full
+_sweave_reflink_holes $blksz $nr $testdir/file1 $testdir/file3 >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file3 | _filter_scratch
+md5sum $testdir/file1.chk | _filter_scratch
+
+echo "CoW across the transition"
+cowoff=$((filesize / 4))
+cowsz=$((filesize / 2))
+_sweave_reflink_holes_delalloc $blksz $nr $testdir/file1 >> $seqres.full
+$XFS_IO_PROG -d -f -c "pwrite -S 0x63 -b $cowsz $cowoff $cowsz" $testdir/file1 >> $seqres.full
+_pwrite_byte 0x63 $cowoff $cowsz $testdir/file1.chk >> $seqres.full
+_scratch_remount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file3 | _filter_scratch
+md5sum $testdir/file1.chk | _filter_scratch
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/258.out b/tests/xfs/258.out
new file mode 100644
index 0000000..ccaca02
--- /dev/null
+++ b/tests/xfs/258.out
@@ -0,0 +1,12 @@
+QA output created by 258
+Format and mount
+Create the original files
+Compare files
+b8a8a88d4c143f79900c4b4e79aa3e37  SCRATCH_MNT/test-258/file1
+ce2023f765eba19677517c511886d5c9  SCRATCH_MNT/test-258/file3
+b8a8a88d4c143f79900c4b4e79aa3e37  SCRATCH_MNT/test-258/file1.chk
+CoW across the transition
+Compare files
+35e2170e14665b780c6dec328d6a263b  SCRATCH_MNT/test-258/file1
+ce2023f765eba19677517c511886d5c9  SCRATCH_MNT/test-258/file3
+35e2170e14665b780c6dec328d6a263b  SCRATCH_MNT/test-258/file1.chk
diff --git a/tests/xfs/group b/tests/xfs/group
index 6f43c79..4fb7618 100644
--- a/tests/xfs/group
+++ b/tests/xfs/group
@@ -245,9 +245,17 @@
 245 auto quick clone
 246 auto quick clone
 247 auto quick clone
+248 auto quick clone
+249 auto quick clone
 250 auto quick rw prealloc metadata
+251 auto quick clone
 252 auto quick prealloc
 253 auto quick
+254 auto quick clone
+255 auto quick clone
+256 auto quick clone
+257 auto quick clone
+258 auto quick clone
 259 auto quick
 261 auto quick quota
 262 auto quick quota

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

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

* [PATCH 32/32] reflink: kick the slow tests out of the 'quick' group
  2016-02-11 23:39 ` Darrick J. Wong
@ 2016-02-11 23:42   ` Darrick J. Wong
  -1 siblings, 0 replies; 81+ messages in thread
From: Darrick J. Wong @ 2016-02-11 23:42 UTC (permalink / raw)
  To: david, darrick.wong; +Cc: linux-btrfs, fstests, xfs

Since 'quick' tests are supposed to run in < 15s, kick out the ones
that can't finish that soon even on fast storage.

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


diff --git a/tests/generic/group b/tests/generic/group
index e3c4e8a..5f699ce 100644
--- a/tests/generic/group
+++ b/tests/generic/group
@@ -139,7 +139,7 @@
 134 auto quick clone
 135 metadata auto quick
 136 auto quick clone dedupe
-137 auto quick clone dedupe
+137 auto clone dedupe
 138 auto quick clone
 139 auto quick clone
 140 auto quick clone
@@ -166,19 +166,19 @@
 161 auto quick clone
 162 auto quick clone dedupe
 163 auto quick clone dedupe
-164 auto quick clone
-165 auto quick clone
-166 auto quick clone
-167 auto quick clone
-168 auto quick clone
+164 auto clone
+165 auto clone
+166 auto clone
+167 auto clone
+168 auto clone
 169 rw metadata auto quick
-170 auto quick clone
+170 auto clone
 171 auto quick clone
 172 auto quick clone
 173 auto quick clone
 174 auto quick clone
-175 auto quick clone
-176 auto quick clone
+175 auto clone
+176 auto clone
 177 auto quick prealloc metadata
 178 auto quick clone
 179 auto quick clone
@@ -188,8 +188,8 @@
 183 auto quick clone
 184 metadata auto quick
 185 auto quick clone
-186 auto quick clone
-187 auto quick clone
+186 auto clone
+187 auto clone
 188 auto quick clone
 189 auto quick clone
 190 auto quick clone
@@ -244,8 +244,8 @@
 239 auto aio rw
 240 auto aio quick rw
 241 auto
-242 auto quick clone
-243 auto quick clone
+242 auto clone
+243 auto clone
 244 auto quick quota
 245 auto quick dir
 246 auto quick rw
@@ -299,8 +299,8 @@
 294 auto quick
 295 auto quick clone
 296 auto quick clone
-297 auto quick clone
-298 auto quick clone
+297 auto clone
+298 auto clone
 299 auto aio enospc rw stress
 300 auto aio enospc preallocrw stress
 301 auto quick clone
@@ -335,5 +335,5 @@
 330 auto quick clone
 331 auto quick clone
 332 auto quick clone
-333 auto quick clone
-334 auto quick clone
+333 auto clone
+334 auto clone
diff --git a/tests/xfs/group b/tests/xfs/group
index 4fb7618..eadc212 100644
--- a/tests/xfs/group
+++ b/tests/xfs/group
@@ -137,7 +137,7 @@
 137 auto metadata v2log
 138 auto quick quota
 139 auto quick clone
-140 auto quick clone
+140 auto clone
 141 auto log metadata
 142 dmapi
 143 dmapi
@@ -166,7 +166,7 @@
 166 rw metadata auto quick
 167 rw metadata auto stress
 168 dmapi
-169 auto quick clone
+169 auto clone
 170 rw filestreams auto quick
 171 rw filestreams
 172 rw filestreams
@@ -233,7 +233,7 @@
 233 auto quick rmap
 234 auto quick rmap
 235 fuzzers rmap
-236 auto quick rmap
+236 auto rmap
 237 auto quick clone
 238 auto quick metadata ioctl
 239 auto quick clone


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

* [PATCH 32/32] reflink: kick the slow tests out of the 'quick' group
@ 2016-02-11 23:42   ` Darrick J. Wong
  0 siblings, 0 replies; 81+ messages in thread
From: Darrick J. Wong @ 2016-02-11 23:42 UTC (permalink / raw)
  To: david, darrick.wong; +Cc: fstests, linux-btrfs, xfs

Since 'quick' tests are supposed to run in < 15s, kick out the ones
that can't finish that soon even on fast storage.

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


diff --git a/tests/generic/group b/tests/generic/group
index e3c4e8a..5f699ce 100644
--- a/tests/generic/group
+++ b/tests/generic/group
@@ -139,7 +139,7 @@
 134 auto quick clone
 135 metadata auto quick
 136 auto quick clone dedupe
-137 auto quick clone dedupe
+137 auto clone dedupe
 138 auto quick clone
 139 auto quick clone
 140 auto quick clone
@@ -166,19 +166,19 @@
 161 auto quick clone
 162 auto quick clone dedupe
 163 auto quick clone dedupe
-164 auto quick clone
-165 auto quick clone
-166 auto quick clone
-167 auto quick clone
-168 auto quick clone
+164 auto clone
+165 auto clone
+166 auto clone
+167 auto clone
+168 auto clone
 169 rw metadata auto quick
-170 auto quick clone
+170 auto clone
 171 auto quick clone
 172 auto quick clone
 173 auto quick clone
 174 auto quick clone
-175 auto quick clone
-176 auto quick clone
+175 auto clone
+176 auto clone
 177 auto quick prealloc metadata
 178 auto quick clone
 179 auto quick clone
@@ -188,8 +188,8 @@
 183 auto quick clone
 184 metadata auto quick
 185 auto quick clone
-186 auto quick clone
-187 auto quick clone
+186 auto clone
+187 auto clone
 188 auto quick clone
 189 auto quick clone
 190 auto quick clone
@@ -244,8 +244,8 @@
 239 auto aio rw
 240 auto aio quick rw
 241 auto
-242 auto quick clone
-243 auto quick clone
+242 auto clone
+243 auto clone
 244 auto quick quota
 245 auto quick dir
 246 auto quick rw
@@ -299,8 +299,8 @@
 294 auto quick
 295 auto quick clone
 296 auto quick clone
-297 auto quick clone
-298 auto quick clone
+297 auto clone
+298 auto clone
 299 auto aio enospc rw stress
 300 auto aio enospc preallocrw stress
 301 auto quick clone
@@ -335,5 +335,5 @@
 330 auto quick clone
 331 auto quick clone
 332 auto quick clone
-333 auto quick clone
-334 auto quick clone
+333 auto clone
+334 auto clone
diff --git a/tests/xfs/group b/tests/xfs/group
index 4fb7618..eadc212 100644
--- a/tests/xfs/group
+++ b/tests/xfs/group
@@ -137,7 +137,7 @@
 137 auto metadata v2log
 138 auto quick quota
 139 auto quick clone
-140 auto quick clone
+140 auto clone
 141 auto log metadata
 142 dmapi
 143 dmapi
@@ -166,7 +166,7 @@
 166 rw metadata auto quick
 167 rw metadata auto stress
 168 dmapi
-169 auto quick clone
+169 auto clone
 170 rw filestreams auto quick
 171 rw filestreams
 172 rw filestreams
@@ -233,7 +233,7 @@
 233 auto quick rmap
 234 auto quick rmap
 235 fuzzers rmap
-236 auto quick rmap
+236 auto rmap
 237 auto quick clone
 238 auto quick metadata ioctl
 239 auto quick clone

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

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

* Re: [PATCH 12/32] dio: unwritten conversion bug tests
  2016-02-11 23:40   ` Darrick J. Wong
@ 2016-02-12  3:52     ` Dave Chinner
  -1 siblings, 0 replies; 81+ messages in thread
From: Dave Chinner @ 2016-02-12  3:52 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: linux-btrfs, fstests, xfs

On Thu, Feb 11, 2016 at 03:40:37PM -0800, Darrick J. Wong wrote:
> Check that we don't expose old disk contents when a directio write to
> an unwritten extent fails due to IO errors.  This primarily affects
> XFS and ext4.
> 
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>

aiocp.c: In function 'main':
aiocp.c:407:1: warning: format '%d' expects argument of type 'int', but argument 3 has type 'off_t' [-Wformat=]
 printf("tocopy=%d len=%d blk=%d\n", tocopy, length, aio_blksize);
 ^

Followup patch is fine, I'll commit as is.

Cheers,

Dave.
-- 
Dave Chinner
david@fromorbit.com

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

* Re: [PATCH 12/32] dio: unwritten conversion bug tests
@ 2016-02-12  3:52     ` Dave Chinner
  0 siblings, 0 replies; 81+ messages in thread
From: Dave Chinner @ 2016-02-12  3:52 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: fstests, linux-btrfs, xfs

On Thu, Feb 11, 2016 at 03:40:37PM -0800, Darrick J. Wong wrote:
> Check that we don't expose old disk contents when a directio write to
> an unwritten extent fails due to IO errors.  This primarily affects
> XFS and ext4.
> 
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>

aiocp.c: In function 'main':
aiocp.c:407:1: warning: format '%d' expects argument of type 'int', but argument 3 has type 'off_t' [-Wformat=]
 printf("tocopy=%d len=%d blk=%d\n", tocopy, length, aio_blksize);
 ^

Followup patch is fine, I'll commit as is.

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] 81+ messages in thread

* Re: [PATCH 12/32] dio: unwritten conversion bug tests
  2016-02-12  3:52     ` Dave Chinner
@ 2016-02-12 15:22       ` Theodore Ts'o
  -1 siblings, 0 replies; 81+ messages in thread
From: Theodore Ts'o @ 2016-02-12 15:22 UTC (permalink / raw)
  To: Dave Chinner; +Cc: Darrick J. Wong, linux-btrfs, fstests, xfs

On Fri, Feb 12, 2016 at 02:52:53PM +1100, Dave Chinner wrote:
> On Thu, Feb 11, 2016 at 03:40:37PM -0800, Darrick J. Wong wrote:
> > Check that we don't expose old disk contents when a directio write to
> > an unwritten extent fails due to IO errors.  This primarily affects
> > XFS and ext4.
> > 
> > Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> 
> aiocp.c: In function 'main':
> aiocp.c:407:1: warning: format '%d' expects argument of type 'int', but argument 3 has type 'off_t' [-Wformat=]
>  printf("tocopy=%d len=%d blk=%d\n", tocopy, length, aio_blksize);
>  ^
> 
> Followup patch is fine, I'll commit as is.

Dave, given that Darrick's patches is going to cause more
_scratch_mount occurences, how quickly do you plan to commit his
patchset?  Should I wait until he makes his change before I do the
s/_scratch_mount/_scratch_cycle_mount/ change?  Should I make that
change, and let you fix it up the commit?

Thanks,

					- Ted

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

* Re: [PATCH 12/32] dio: unwritten conversion bug tests
@ 2016-02-12 15:22       ` Theodore Ts'o
  0 siblings, 0 replies; 81+ messages in thread
From: Theodore Ts'o @ 2016-02-12 15:22 UTC (permalink / raw)
  To: Dave Chinner; +Cc: xfs, fstests, linux-btrfs, Darrick J. Wong

On Fri, Feb 12, 2016 at 02:52:53PM +1100, Dave Chinner wrote:
> On Thu, Feb 11, 2016 at 03:40:37PM -0800, Darrick J. Wong wrote:
> > Check that we don't expose old disk contents when a directio write to
> > an unwritten extent fails due to IO errors.  This primarily affects
> > XFS and ext4.
> > 
> > Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> 
> aiocp.c: In function 'main':
> aiocp.c:407:1: warning: format '%d' expects argument of type 'int', but argument 3 has type 'off_t' [-Wformat=]
>  printf("tocopy=%d len=%d blk=%d\n", tocopy, length, aio_blksize);
>  ^
> 
> Followup patch is fine, I'll commit as is.

Dave, given that Darrick's patches is going to cause more
_scratch_mount occurences, how quickly do you plan to commit his
patchset?  Should I wait until he makes his change before I do the
s/_scratch_mount/_scratch_cycle_mount/ change?  Should I make that
change, and let you fix it up the commit?

Thanks,

					- Ted

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

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

* Re: [PATCH 12/32] dio: unwritten conversion bug tests
  2016-02-12  3:52     ` Dave Chinner
@ 2016-02-12 17:40       ` Darrick J. Wong
  -1 siblings, 0 replies; 81+ messages in thread
From: Darrick J. Wong @ 2016-02-12 17:40 UTC (permalink / raw)
  To: Dave Chinner; +Cc: linux-btrfs, fstests, xfs

On Fri, Feb 12, 2016 at 02:52:53PM +1100, Dave Chinner wrote:
> On Thu, Feb 11, 2016 at 03:40:37PM -0800, Darrick J. Wong wrote:
> > Check that we don't expose old disk contents when a directio write to
> > an unwritten extent fails due to IO errors.  This primarily affects
> > XFS and ext4.
> > 
> > Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> 
> aiocp.c: In function 'main':
> aiocp.c:407:1: warning: format '%d' expects argument of type 'int', but argument 3 has type 'off_t' [-Wformat=]
>  printf("tocopy=%d len=%d blk=%d\n", tocopy, length, aio_blksize);
>  ^
> 
> Followup patch is fine, I'll commit as is.

Ok, I'll send a cleanup patch to the mailing list.  Also see new pull req:

(I only added the aiocp cleanup, so if you've already pulled it, you can
avoid the scourge of github and pick up the one patch. ;))

---

The following changes since commit d98149c205559950c03d6b1d539e45fd35b5630e:

  Fix prerequisite packages to build fstests on Ubuntu (2016-02-08 09:27:15 +1100)

are available in the git repository at:

  https://github.com/djwong/xfstests for-dave

for you to fetch changes up to 74b326f9a616bcdc33c6439cf2a457b79de4b96f:

  aiocp: fix the gcc warnings (2016-02-12 09:39:14 -0800)

----------------------------------------------------------------
Darrick J. Wong (33):
      generic/182: this is a dedupe test, check for dedupe
      xfstests: filter whitespace in 128 and 132
      xfstests: make _scratch_mkfs_blocksized usable
      reflink: remove redundant filesystem checks from the end of the tests
      reflink: remove unnecessary umounts from test code
      common/dmerror: add some more dmerror routines
      common: create _require_test_program to look for programs in src/
      common: provide a method to repair the scratch fs
      reflink: refactor mixed block creation code
      reflink: fix style problems in existing tests
      reflink: add _require_odirect to the directio tests
      dio: unwritten conversion bug tests
      reflink: test intersecting CoW and falloc/fpunch/fzero/fcollapse/finsert/ftrunc
      reflink: test CoW behavior with IO errors
      reflink: test CoW operations against the source file
      reflink: ensure that we can handle reflinking a lot of extents
      xfs: more reflink tests
      xfs/122: support refcount/rmap data structures
      xfs: test fragmentation characteristics of copy-on-write
      reflink: high offset reflink and dedupe tests
      reflink: test xfs cow behavior when the filesystem crashes
      reflink: test quota accounting
      reflink: test CoW across a mixed range of block types with cowextsize set
      xfs: test the automatic cowextsize extent garbage collector
      xfs: test rmapbt functionality
      reflink: test aio copy on write
      xfs: aio cow tests
      xfs: test xfs_getbmapx behavior with shared extents
      reflink: test reflink+cow+enospc all at the same time
      xfs: ensure that we don't crash when freeing the ag reservations on a ro mount
      xfs: test source CoW across mixed block types with cowextsz set
      reflink: kick the slow tests out of the 'quick' group
      aiocp: fix the gcc warnings

 .gitignore                  |   2 +
 common/dmerror              |  27 ++-
 common/rc                   | 117 +++++++++++
 common/reflink              | 202 +++++++++++++++---
 src/Makefile                |   2 +-
 src/aio-dio-regress/aiocp.c | 488 ++++++++++++++++++++++++++++++++++++++++++++
 src/punch-alternating.c     |  59 ++++++
 tests/btrfs/100             |   2 +-
 tests/btrfs/101             |   2 +-
 tests/generic/010           |   2 +-
 tests/generic/094           |   2 +-
 tests/generic/110           |   2 +-
 tests/generic/111           |   2 +-
 tests/generic/115           |   2 +-
 tests/generic/116           |  44 ++--
 tests/generic/118           |  42 ++--
 tests/generic/119           | 102 ++++-----
 tests/generic/121           |  44 ++--
 tests/generic/122           |  44 ++--
 tests/generic/134           |  78 +++----
 tests/generic/136           |  78 +++----
 tests/generic/137           |  44 ++--
 tests/generic/138           | 104 +++++-----
 tests/generic/139           |  99 ++++-----
 tests/generic/140           | 104 +++++-----
 tests/generic/142           |  37 ++--
 tests/generic/143           |  38 ++--
 tests/generic/144           | 124 +++++------
 tests/generic/145           | 150 +++++++-------
 tests/generic/146           | 132 ++++++------
 tests/generic/147           | 146 ++++++-------
 tests/generic/148           |  84 ++++----
 tests/generic/149           | 132 ++++++------
 tests/generic/150           |  23 ++-
 tests/generic/151           |  35 ++--
 tests/generic/152           |  39 ++--
 tests/generic/153           |  41 ++--
 tests/generic/154           |  43 ++--
 tests/generic/155           |  40 ++--
 tests/generic/156           |  43 ++--
 tests/generic/157           |  64 +++---
 tests/generic/157.out       |   1 -
 tests/generic/158           |  66 +++---
 tests/generic/158.out       |   1 -
 tests/generic/159           |  19 +-
 tests/generic/160           |  19 +-
 tests/generic/161           |  30 ++-
 tests/generic/161.out       |   2 -
 tests/generic/162           |  36 ++--
 tests/generic/162.out       |   2 -
 tests/generic/163           |  36 ++--
 tests/generic/163.out       |   2 -
 tests/generic/164           |  40 ++--
 tests/generic/164.out       |   2 -
 tests/generic/165           |  39 ++--
 tests/generic/165.out       |   2 -
 tests/generic/166           |  36 ++--
 tests/generic/166.out       |   2 -
 tests/generic/167           |  35 ++--
 tests/generic/167.out       |   2 -
 tests/generic/168           |  37 ++--
 tests/generic/168.out       |   2 -
 tests/generic/170           |  38 ++--
 tests/generic/170.out       |   2 -
 tests/generic/171           |  62 +++---
 tests/generic/171.out       |   1 -
 tests/generic/172           |  62 +++---
 tests/generic/172.out       |   1 -
 tests/generic/173           |  54 +++--
 tests/generic/173.out       |   1 -
 tests/generic/174           |  63 +++---
 tests/generic/174.out       |   1 -
 tests/generic/175           |  47 ++---
 tests/generic/175.out       |   5 +
 tests/generic/176           |  54 +++--
 tests/generic/176.out       |   5 +-
 tests/generic/178           |  31 +--
 tests/generic/179           |  50 ++---
 tests/generic/180           |  50 ++---
 tests/generic/181           |  38 ++--
 tests/generic/182           |  89 ++++----
 tests/generic/183           |  55 +++--
 tests/generic/183.out       |   1 -
 tests/generic/185           |  54 +++--
 tests/generic/185.out       |   1 -
 tests/generic/186           |  73 ++++---
 tests/generic/186.out       |   1 -
 tests/generic/187           |  74 +++----
 tests/generic/187.out       |   1 -
 tests/generic/188           |  47 ++---
 tests/generic/188.out       |   1 -
 tests/generic/189           |  46 ++---
 tests/generic/189.out       |   1 -
 tests/generic/190           |  47 ++---
 tests/generic/190.out       |   1 -
 tests/generic/191           |  46 ++---
 tests/generic/191.out       |   1 -
 tests/generic/194           |  52 ++---
 tests/generic/194.out       |   1 -
 tests/generic/195           |  51 ++---
 tests/generic/195.out       |   1 -
 tests/generic/196           |  49 ++---
 tests/generic/196.out       |   1 -
 tests/generic/197           |  48 ++---
 tests/generic/197.out       |   1 -
 tests/generic/199           |  70 ++-----
 tests/generic/199.out       |   5 +-
 tests/generic/200           |  70 ++-----
 tests/generic/200.out       |   5 +-
 tests/generic/201           |  42 ++--
 tests/generic/201.out       |   1 -
 tests/generic/202           |  41 ++--
 tests/generic/202.out       |   1 -
 tests/generic/203           |  42 ++--
 tests/generic/203.out       |   1 -
 tests/generic/205           |  51 +++--
 tests/generic/205.out       |   1 -
 tests/generic/206           |  52 +++--
 tests/generic/206.out       |   1 -
 tests/generic/216           |  51 +++--
 tests/generic/216.out       |   1 -
 tests/generic/217           |  52 +++--
 tests/generic/217.out       |   1 -
 tests/generic/218           |  43 ++--
 tests/generic/218.out       |   1 -
 tests/generic/220           |  44 ++--
 tests/generic/220.out       |   1 -
 tests/generic/222           |  51 +++--
 tests/generic/222.out       |   1 -
 tests/generic/225           |   2 +-
 tests/generic/227           |  52 +++--
 tests/generic/227.out       |   1 -
 tests/generic/229           |  77 ++++---
 tests/generic/229.out       |   1 -
 tests/generic/238           |  78 ++++---
 tests/generic/238.out       |   1 -
 tests/generic/242           |  51 +++--
 tests/generic/242.out       |   1 -
 tests/generic/243           |  52 +++--
 tests/generic/243.out       |   1 -
 tests/generic/250           | 100 +++++++++
 tests/generic/250.out       |  10 +
 tests/generic/252           | 103 ++++++++++
 tests/generic/252.out       |  10 +
 tests/generic/253           |  90 ++++++++
 tests/generic/253.out       |  12 ++
 tests/generic/254           |  90 ++++++++
 tests/generic/254.out       |  12 ++
 tests/generic/259           |  90 ++++++++
 tests/generic/259.out       |  12 ++
 tests/generic/261           |  90 ++++++++
 tests/generic/261.out       |  12 ++
 tests/generic/262           |  93 +++++++++
 tests/generic/262.out       |  12 ++
 tests/generic/264           |  90 ++++++++
 tests/generic/264.out       |  12 ++
 tests/generic/265           |  99 +++++++++
 tests/generic/265.out       |  11 +
 tests/generic/266           |  97 +++++++++
 tests/generic/266.out       |  11 +
 tests/generic/267           | 100 +++++++++
 tests/generic/267.out       |  10 +
 tests/generic/268           | 103 ++++++++++
 tests/generic/268.out       |  12 ++
 tests/generic/271           | 100 +++++++++
 tests/generic/271.out       |  11 +
 tests/generic/272           |  98 +++++++++
 tests/generic/272.out       |  11 +
 tests/generic/276           | 101 +++++++++
 tests/generic/276.out       |  11 +
 tests/generic/278           | 104 ++++++++++
 tests/generic/278.out       |  12 ++
 tests/generic/279           | 100 +++++++++
 tests/generic/279.out       |  11 +
 tests/generic/281           |  98 +++++++++
 tests/generic/281.out       |  11 +
 tests/generic/282           | 101 +++++++++
 tests/generic/282.out       |  10 +
 tests/generic/283           | 104 ++++++++++
 tests/generic/283.out       |  12 ++
 tests/generic/284           |  89 ++++++++
 tests/generic/284.out       |  12 ++
 tests/generic/285           |   2 +-
 tests/generic/286           |   2 +-
 tests/generic/287           |  90 ++++++++
 tests/generic/287.out       |  12 ++
 tests/generic/289           |  91 +++++++++
 tests/generic/289.out       |  12 ++
 tests/generic/290           |  92 +++++++++
 tests/generic/290.out       |  12 ++
 tests/generic/291           |  91 +++++++++
 tests/generic/291.out       |  12 ++
 tests/generic/292           |  92 +++++++++
 tests/generic/292.out       |  12 ++
 tests/generic/293           |  93 +++++++++
 tests/generic/293.out       |  12 ++
 tests/generic/295           |  94 +++++++++
 tests/generic/295.out       |  12 ++
 tests/generic/296           |  90 ++++++++
 tests/generic/296.out       |  12 ++
 tests/generic/297           |  99 +++++++++
 tests/generic/297.out       |   6 +
 tests/generic/298           |  99 +++++++++
 tests/generic/298.out       |   6 +
 tests/generic/301           | 100 +++++++++
 tests/generic/301.out       |  10 +
 tests/generic/302           | 101 +++++++++
 tests/generic/302.out       |  10 +
 tests/generic/303           |  98 +++++++++
 tests/generic/303.out       |  21 ++
 tests/generic/304           |  99 +++++++++
 tests/generic/304.out       |  22 ++
 tests/generic/305           | 100 +++++++++
 tests/generic/305.out       |  22 ++
 tests/generic/311           |   2 +-
 tests/generic/326           | 101 +++++++++
 tests/generic/326.out       |  22 ++
 tests/generic/327           |  87 ++++++++
 tests/generic/327.out       |  12 ++
 tests/generic/328           | 105 ++++++++++
 tests/generic/328.out       |  25 +++
 tests/generic/329           | 102 +++++++++
 tests/generic/329.out       |  12 ++
 tests/generic/330           |  93 +++++++++
 tests/generic/330.out       |  11 +
 tests/generic/331           | 104 ++++++++++
 tests/generic/331.out       |  12 ++
 tests/generic/332           |  94 +++++++++
 tests/generic/332.out       |  11 +
 tests/generic/333           |  99 +++++++++
 tests/generic/333.out       |   4 +
 tests/generic/334           |  98 +++++++++
 tests/generic/334.out       |   4 +
 tests/generic/group         |  71 +++++--
 tests/xfs/032               |   3 +-
 tests/xfs/044               |   2 +-
 tests/xfs/122               |   3 +
 tests/xfs/122.out           |   4 +
 tests/xfs/127               |  33 ++-
 tests/xfs/127.out           |   1 -
 tests/xfs/128               |  97 +++++----
 tests/xfs/128.out           |   9 +-
 tests/xfs/129               |  33 ++-
 tests/xfs/131               |  25 +--
 tests/xfs/131.out           |   1 -
 tests/xfs/132               |  53 ++---
 tests/xfs/132.out           |  40 ++--
 tests/xfs/139               |  35 ++--
 tests/xfs/139.out           |   1 -
 tests/xfs/140               |  41 ++--
 tests/xfs/140.out           |   1 -
 tests/xfs/169               |  86 ++++++++
 tests/xfs/169.out           |   7 +
 tests/xfs/179               | 118 +++++++++++
 tests/xfs/179.out           |  10 +
 tests/xfs/180               | 106 ++++++++++
 tests/xfs/180.out           |  11 +
 tests/xfs/182               | 107 ++++++++++
 tests/xfs/182.out           |  12 ++
 tests/xfs/184               | 105 ++++++++++
 tests/xfs/184.out           |  10 +
 tests/xfs/192               | 106 ++++++++++
 tests/xfs/192.out           |  10 +
 tests/xfs/193               | 102 +++++++++
 tests/xfs/193.out           |  10 +
 tests/xfs/198               | 103 ++++++++++
 tests/xfs/198.out           |  10 +
 tests/xfs/200               | 109 ++++++++++
 tests/xfs/200.out           |  10 +
 tests/xfs/204               | 110 ++++++++++
 tests/xfs/204.out           |  10 +
 tests/xfs/207               | 101 +++++++++
 tests/xfs/207.out           |  18 ++
 tests/xfs/208               | 138 +++++++++++++
 tests/xfs/208.out           |  13 ++
 tests/xfs/209               |  82 ++++++++
 tests/xfs/209.out           |  13 ++
 tests/xfs/210               | 108 ++++++++++
 tests/xfs/210.out           |  23 +++
 tests/xfs/211               | 107 ++++++++++
 tests/xfs/211.out           |  11 +
 tests/xfs/212               |  99 +++++++++
 tests/xfs/212.out           |  13 ++
 tests/xfs/213               | 105 ++++++++++
 tests/xfs/213.out           |  22 ++
 tests/xfs/214               | 106 ++++++++++
 tests/xfs/214.out           |  22 ++
 tests/xfs/215               | 102 +++++++++
 tests/xfs/215.out           |  13 ++
 tests/xfs/218               | 101 +++++++++
 tests/xfs/218.out           |  13 ++
 tests/xfs/219               | 102 +++++++++
 tests/xfs/219.out           |  13 ++
 tests/xfs/221               | 101 +++++++++
 tests/xfs/221.out           |  13 ++
 tests/xfs/223               | 104 ++++++++++
 tests/xfs/223.out           |  13 ++
 tests/xfs/224               | 103 ++++++++++
 tests/xfs/224.out           |  13 ++
 tests/xfs/225               | 102 +++++++++
 tests/xfs/225.out           |  13 ++
 tests/xfs/226               | 101 +++++++++
 tests/xfs/226.out           |  13 ++
 tests/xfs/228               | 110 ++++++++++
 tests/xfs/228.out           |  13 ++
 tests/xfs/230               | 110 ++++++++++
 tests/xfs/230.out           |  13 ++
 tests/xfs/231               | 130 ++++++++++++
 tests/xfs/231.out           |  16 ++
 tests/xfs/232               | 132 ++++++++++++
 tests/xfs/232.out           |  16 ++
 tests/xfs/233               |  73 +++++++
 tests/xfs/233.out           |   5 +
 tests/xfs/234               |  88 ++++++++
 tests/xfs/234.out           |   6 +
 tests/xfs/235               | 108 ++++++++++
 tests/xfs/235.out           |  14 ++
 tests/xfs/236               |  88 ++++++++
 tests/xfs/236.out           |   7 +
 tests/xfs/237               | 105 ++++++++++
 tests/xfs/237.out           |  12 ++
 tests/xfs/239               |  98 +++++++++
 tests/xfs/239.out           |  11 +
 tests/xfs/240               | 110 ++++++++++
 tests/xfs/240.out           |  12 ++
 tests/xfs/241               | 100 +++++++++
 tests/xfs/241.out           |  11 +
 tests/xfs/243               | 165 +++++++++++++++
 tests/xfs/243.out           |  26 +++
 tests/xfs/245               |  95 +++++++++
 tests/xfs/245.out           |  12 ++
 tests/xfs/246               |  65 ++++++
 tests/xfs/246.out           |   6 +
 tests/xfs/247               |  57 ++++++
 tests/xfs/247.out           |   2 +
 tests/xfs/248               |  91 +++++++++
 tests/xfs/248.out           |  12 ++
 tests/xfs/249               |  92 +++++++++
 tests/xfs/249.out           |  12 ++
 tests/xfs/251               |  93 +++++++++
 tests/xfs/251.out           |  12 ++
 tests/xfs/254               |  94 +++++++++
 tests/xfs/254.out           |  12 ++
 tests/xfs/255               |  93 +++++++++
 tests/xfs/255.out           |  12 ++
 tests/xfs/256               |  94 +++++++++
 tests/xfs/256.out           |  12 ++
 tests/xfs/257               |  95 +++++++++
 tests/xfs/257.out           |  12 ++
 tests/xfs/258               |  96 +++++++++
 tests/xfs/258.out           |  12 ++
 tests/xfs/group             |  56 ++++-
 352 files changed, 13924 insertions(+), 2729 deletions(-)
 create mode 100644 src/aio-dio-regress/aiocp.c
 create mode 100644 src/punch-alternating.c
 create mode 100755 tests/generic/250
 create mode 100644 tests/generic/250.out
 create mode 100755 tests/generic/252
 create mode 100644 tests/generic/252.out
 create mode 100755 tests/generic/253
 create mode 100644 tests/generic/253.out
 create mode 100755 tests/generic/254
 create mode 100644 tests/generic/254.out
 create mode 100755 tests/generic/259
 create mode 100644 tests/generic/259.out
 create mode 100755 tests/generic/261
 create mode 100644 tests/generic/261.out
 create mode 100755 tests/generic/262
 create mode 100644 tests/generic/262.out
 create mode 100755 tests/generic/264
 create mode 100644 tests/generic/264.out
 create mode 100755 tests/generic/265
 create mode 100644 tests/generic/265.out
 create mode 100755 tests/generic/266
 create mode 100644 tests/generic/266.out
 create mode 100755 tests/generic/267
 create mode 100644 tests/generic/267.out
 create mode 100755 tests/generic/268
 create mode 100644 tests/generic/268.out
 create mode 100755 tests/generic/271
 create mode 100644 tests/generic/271.out
 create mode 100755 tests/generic/272
 create mode 100644 tests/generic/272.out
 create mode 100755 tests/generic/276
 create mode 100644 tests/generic/276.out
 create mode 100755 tests/generic/278
 create mode 100644 tests/generic/278.out
 create mode 100755 tests/generic/279
 create mode 100644 tests/generic/279.out
 create mode 100755 tests/generic/281
 create mode 100644 tests/generic/281.out
 create mode 100755 tests/generic/282
 create mode 100644 tests/generic/282.out
 create mode 100755 tests/generic/283
 create mode 100644 tests/generic/283.out
 create mode 100755 tests/generic/284
 create mode 100644 tests/generic/284.out
 create mode 100755 tests/generic/287
 create mode 100644 tests/generic/287.out
 create mode 100755 tests/generic/289
 create mode 100644 tests/generic/289.out
 create mode 100755 tests/generic/290
 create mode 100644 tests/generic/290.out
 create mode 100755 tests/generic/291
 create mode 100644 tests/generic/291.out
 create mode 100755 tests/generic/292
 create mode 100644 tests/generic/292.out
 create mode 100755 tests/generic/293
 create mode 100644 tests/generic/293.out
 create mode 100755 tests/generic/295
 create mode 100644 tests/generic/295.out
 create mode 100755 tests/generic/296
 create mode 100644 tests/generic/296.out
 create mode 100755 tests/generic/297
 create mode 100644 tests/generic/297.out
 create mode 100755 tests/generic/298
 create mode 100644 tests/generic/298.out
 create mode 100755 tests/generic/301
 create mode 100644 tests/generic/301.out
 create mode 100755 tests/generic/302
 create mode 100644 tests/generic/302.out
 create mode 100755 tests/generic/303
 create mode 100644 tests/generic/303.out
 create mode 100755 tests/generic/304
 create mode 100644 tests/generic/304.out
 create mode 100755 tests/generic/305
 create mode 100644 tests/generic/305.out
 create mode 100755 tests/generic/326
 create mode 100644 tests/generic/326.out
 create mode 100755 tests/generic/327
 create mode 100644 tests/generic/327.out
 create mode 100755 tests/generic/328
 create mode 100644 tests/generic/328.out
 create mode 100755 tests/generic/329
 create mode 100644 tests/generic/329.out
 create mode 100755 tests/generic/330
 create mode 100644 tests/generic/330.out
 create mode 100755 tests/generic/331
 create mode 100644 tests/generic/331.out
 create mode 100755 tests/generic/332
 create mode 100644 tests/generic/332.out
 create mode 100755 tests/generic/333
 create mode 100644 tests/generic/333.out
 create mode 100755 tests/generic/334
 create mode 100644 tests/generic/334.out
 create mode 100755 tests/xfs/169
 create mode 100644 tests/xfs/169.out
 create mode 100755 tests/xfs/179
 create mode 100644 tests/xfs/179.out
 create mode 100755 tests/xfs/180
 create mode 100644 tests/xfs/180.out
 create mode 100755 tests/xfs/182
 create mode 100644 tests/xfs/182.out
 create mode 100755 tests/xfs/184
 create mode 100644 tests/xfs/184.out
 create mode 100755 tests/xfs/192
 create mode 100644 tests/xfs/192.out
 create mode 100755 tests/xfs/193
 create mode 100644 tests/xfs/193.out
 create mode 100755 tests/xfs/198
 create mode 100644 tests/xfs/198.out
 create mode 100755 tests/xfs/200
 create mode 100644 tests/xfs/200.out
 create mode 100755 tests/xfs/204
 create mode 100644 tests/xfs/204.out
 create mode 100755 tests/xfs/207
 create mode 100644 tests/xfs/207.out
 create mode 100755 tests/xfs/208
 create mode 100644 tests/xfs/208.out
 create mode 100755 tests/xfs/209
 create mode 100644 tests/xfs/209.out
 create mode 100755 tests/xfs/210
 create mode 100644 tests/xfs/210.out
 create mode 100755 tests/xfs/211
 create mode 100644 tests/xfs/211.out
 create mode 100755 tests/xfs/212
 create mode 100644 tests/xfs/212.out
 create mode 100755 tests/xfs/213
 create mode 100644 tests/xfs/213.out
 create mode 100755 tests/xfs/214
 create mode 100644 tests/xfs/214.out
 create mode 100755 tests/xfs/215
 create mode 100644 tests/xfs/215.out
 create mode 100755 tests/xfs/218
 create mode 100644 tests/xfs/218.out
 create mode 100755 tests/xfs/219
 create mode 100644 tests/xfs/219.out
 create mode 100755 tests/xfs/221
 create mode 100644 tests/xfs/221.out
 create mode 100755 tests/xfs/223
 create mode 100644 tests/xfs/223.out
 create mode 100755 tests/xfs/224
 create mode 100644 tests/xfs/224.out
 create mode 100755 tests/xfs/225
 create mode 100644 tests/xfs/225.out
 create mode 100755 tests/xfs/226
 create mode 100644 tests/xfs/226.out
 create mode 100755 tests/xfs/228
 create mode 100644 tests/xfs/228.out
 create mode 100755 tests/xfs/230
 create mode 100644 tests/xfs/230.out
 create mode 100755 tests/xfs/231
 create mode 100644 tests/xfs/231.out
 create mode 100755 tests/xfs/232
 create mode 100644 tests/xfs/232.out
 create mode 100755 tests/xfs/233
 create mode 100644 tests/xfs/233.out
 create mode 100755 tests/xfs/234
 create mode 100644 tests/xfs/234.out
 create mode 100755 tests/xfs/235
 create mode 100644 tests/xfs/235.out
 create mode 100755 tests/xfs/236
 create mode 100644 tests/xfs/236.out
 create mode 100755 tests/xfs/237
 create mode 100644 tests/xfs/237.out
 create mode 100755 tests/xfs/239
 create mode 100644 tests/xfs/239.out
 create mode 100755 tests/xfs/240
 create mode 100644 tests/xfs/240.out
 create mode 100755 tests/xfs/241
 create mode 100644 tests/xfs/241.out
 create mode 100755 tests/xfs/243
 create mode 100644 tests/xfs/243.out
 create mode 100755 tests/xfs/245
 create mode 100644 tests/xfs/245.out
 create mode 100755 tests/xfs/246
 create mode 100644 tests/xfs/246.out
 create mode 100755 tests/xfs/247
 create mode 100644 tests/xfs/247.out
 create mode 100755 tests/xfs/248
 create mode 100644 tests/xfs/248.out
 create mode 100755 tests/xfs/249
 create mode 100644 tests/xfs/249.out
 create mode 100755 tests/xfs/251
 create mode 100644 tests/xfs/251.out
 create mode 100755 tests/xfs/254
 create mode 100644 tests/xfs/254.out
 create mode 100755 tests/xfs/255
 create mode 100644 tests/xfs/255.out
 create mode 100755 tests/xfs/256
 create mode 100644 tests/xfs/256.out
 create mode 100755 tests/xfs/257
 create mode 100644 tests/xfs/257.out
 create mode 100755 tests/xfs/258
 create mode 100644 tests/xfs/258.out

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

* Re: [PATCH 12/32] dio: unwritten conversion bug tests
@ 2016-02-12 17:40       ` Darrick J. Wong
  0 siblings, 0 replies; 81+ messages in thread
From: Darrick J. Wong @ 2016-02-12 17:40 UTC (permalink / raw)
  To: Dave Chinner; +Cc: fstests, linux-btrfs, xfs

On Fri, Feb 12, 2016 at 02:52:53PM +1100, Dave Chinner wrote:
> On Thu, Feb 11, 2016 at 03:40:37PM -0800, Darrick J. Wong wrote:
> > Check that we don't expose old disk contents when a directio write to
> > an unwritten extent fails due to IO errors.  This primarily affects
> > XFS and ext4.
> > 
> > Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> 
> aiocp.c: In function 'main':
> aiocp.c:407:1: warning: format '%d' expects argument of type 'int', but argument 3 has type 'off_t' [-Wformat=]
>  printf("tocopy=%d len=%d blk=%d\n", tocopy, length, aio_blksize);
>  ^
> 
> Followup patch is fine, I'll commit as is.

Ok, I'll send a cleanup patch to the mailing list.  Also see new pull req:

(I only added the aiocp cleanup, so if you've already pulled it, you can
avoid the scourge of github and pick up the one patch. ;))

---

The following changes since commit d98149c205559950c03d6b1d539e45fd35b5630e:

  Fix prerequisite packages to build fstests on Ubuntu (2016-02-08 09:27:15 +1100)

are available in the git repository at:

  https://github.com/djwong/xfstests for-dave

for you to fetch changes up to 74b326f9a616bcdc33c6439cf2a457b79de4b96f:

  aiocp: fix the gcc warnings (2016-02-12 09:39:14 -0800)

----------------------------------------------------------------
Darrick J. Wong (33):
      generic/182: this is a dedupe test, check for dedupe
      xfstests: filter whitespace in 128 and 132
      xfstests: make _scratch_mkfs_blocksized usable
      reflink: remove redundant filesystem checks from the end of the tests
      reflink: remove unnecessary umounts from test code
      common/dmerror: add some more dmerror routines
      common: create _require_test_program to look for programs in src/
      common: provide a method to repair the scratch fs
      reflink: refactor mixed block creation code
      reflink: fix style problems in existing tests
      reflink: add _require_odirect to the directio tests
      dio: unwritten conversion bug tests
      reflink: test intersecting CoW and falloc/fpunch/fzero/fcollapse/finsert/ftrunc
      reflink: test CoW behavior with IO errors
      reflink: test CoW operations against the source file
      reflink: ensure that we can handle reflinking a lot of extents
      xfs: more reflink tests
      xfs/122: support refcount/rmap data structures
      xfs: test fragmentation characteristics of copy-on-write
      reflink: high offset reflink and dedupe tests
      reflink: test xfs cow behavior when the filesystem crashes
      reflink: test quota accounting
      reflink: test CoW across a mixed range of block types with cowextsize set
      xfs: test the automatic cowextsize extent garbage collector
      xfs: test rmapbt functionality
      reflink: test aio copy on write
      xfs: aio cow tests
      xfs: test xfs_getbmapx behavior with shared extents
      reflink: test reflink+cow+enospc all at the same time
      xfs: ensure that we don't crash when freeing the ag reservations on a ro mount
      xfs: test source CoW across mixed block types with cowextsz set
      reflink: kick the slow tests out of the 'quick' group
      aiocp: fix the gcc warnings

 .gitignore                  |   2 +
 common/dmerror              |  27 ++-
 common/rc                   | 117 +++++++++++
 common/reflink              | 202 +++++++++++++++---
 src/Makefile                |   2 +-
 src/aio-dio-regress/aiocp.c | 488 ++++++++++++++++++++++++++++++++++++++++++++
 src/punch-alternating.c     |  59 ++++++
 tests/btrfs/100             |   2 +-
 tests/btrfs/101             |   2 +-
 tests/generic/010           |   2 +-
 tests/generic/094           |   2 +-
 tests/generic/110           |   2 +-
 tests/generic/111           |   2 +-
 tests/generic/115           |   2 +-
 tests/generic/116           |  44 ++--
 tests/generic/118           |  42 ++--
 tests/generic/119           | 102 ++++-----
 tests/generic/121           |  44 ++--
 tests/generic/122           |  44 ++--
 tests/generic/134           |  78 +++----
 tests/generic/136           |  78 +++----
 tests/generic/137           |  44 ++--
 tests/generic/138           | 104 +++++-----
 tests/generic/139           |  99 ++++-----
 tests/generic/140           | 104 +++++-----
 tests/generic/142           |  37 ++--
 tests/generic/143           |  38 ++--
 tests/generic/144           | 124 +++++------
 tests/generic/145           | 150 +++++++-------
 tests/generic/146           | 132 ++++++------
 tests/generic/147           | 146 ++++++-------
 tests/generic/148           |  84 ++++----
 tests/generic/149           | 132 ++++++------
 tests/generic/150           |  23 ++-
 tests/generic/151           |  35 ++--
 tests/generic/152           |  39 ++--
 tests/generic/153           |  41 ++--
 tests/generic/154           |  43 ++--
 tests/generic/155           |  40 ++--
 tests/generic/156           |  43 ++--
 tests/generic/157           |  64 +++---
 tests/generic/157.out       |   1 -
 tests/generic/158           |  66 +++---
 tests/generic/158.out       |   1 -
 tests/generic/159           |  19 +-
 tests/generic/160           |  19 +-
 tests/generic/161           |  30 ++-
 tests/generic/161.out       |   2 -
 tests/generic/162           |  36 ++--
 tests/generic/162.out       |   2 -
 tests/generic/163           |  36 ++--
 tests/generic/163.out       |   2 -
 tests/generic/164           |  40 ++--
 tests/generic/164.out       |   2 -
 tests/generic/165           |  39 ++--
 tests/generic/165.out       |   2 -
 tests/generic/166           |  36 ++--
 tests/generic/166.out       |   2 -
 tests/generic/167           |  35 ++--
 tests/generic/167.out       |   2 -
 tests/generic/168           |  37 ++--
 tests/generic/168.out       |   2 -
 tests/generic/170           |  38 ++--
 tests/generic/170.out       |   2 -
 tests/generic/171           |  62 +++---
 tests/generic/171.out       |   1 -
 tests/generic/172           |  62 +++---
 tests/generic/172.out       |   1 -
 tests/generic/173           |  54 +++--
 tests/generic/173.out       |   1 -
 tests/generic/174           |  63 +++---
 tests/generic/174.out       |   1 -
 tests/generic/175           |  47 ++---
 tests/generic/175.out       |   5 +
 tests/generic/176           |  54 +++--
 tests/generic/176.out       |   5 +-
 tests/generic/178           |  31 +--
 tests/generic/179           |  50 ++---
 tests/generic/180           |  50 ++---
 tests/generic/181           |  38 ++--
 tests/generic/182           |  89 ++++----
 tests/generic/183           |  55 +++--
 tests/generic/183.out       |   1 -
 tests/generic/185           |  54 +++--
 tests/generic/185.out       |   1 -
 tests/generic/186           |  73 ++++---
 tests/generic/186.out       |   1 -
 tests/generic/187           |  74 +++----
 tests/generic/187.out       |   1 -
 tests/generic/188           |  47 ++---
 tests/generic/188.out       |   1 -
 tests/generic/189           |  46 ++---
 tests/generic/189.out       |   1 -
 tests/generic/190           |  47 ++---
 tests/generic/190.out       |   1 -
 tests/generic/191           |  46 ++---
 tests/generic/191.out       |   1 -
 tests/generic/194           |  52 ++---
 tests/generic/194.out       |   1 -
 tests/generic/195           |  51 ++---
 tests/generic/195.out       |   1 -
 tests/generic/196           |  49 ++---
 tests/generic/196.out       |   1 -
 tests/generic/197           |  48 ++---
 tests/generic/197.out       |   1 -
 tests/generic/199           |  70 ++-----
 tests/generic/199.out       |   5 +-
 tests/generic/200           |  70 ++-----
 tests/generic/200.out       |   5 +-
 tests/generic/201           |  42 ++--
 tests/generic/201.out       |   1 -
 tests/generic/202           |  41 ++--
 tests/generic/202.out       |   1 -
 tests/generic/203           |  42 ++--
 tests/generic/203.out       |   1 -
 tests/generic/205           |  51 +++--
 tests/generic/205.out       |   1 -
 tests/generic/206           |  52 +++--
 tests/generic/206.out       |   1 -
 tests/generic/216           |  51 +++--
 tests/generic/216.out       |   1 -
 tests/generic/217           |  52 +++--
 tests/generic/217.out       |   1 -
 tests/generic/218           |  43 ++--
 tests/generic/218.out       |   1 -
 tests/generic/220           |  44 ++--
 tests/generic/220.out       |   1 -
 tests/generic/222           |  51 +++--
 tests/generic/222.out       |   1 -
 tests/generic/225           |   2 +-
 tests/generic/227           |  52 +++--
 tests/generic/227.out       |   1 -
 tests/generic/229           |  77 ++++---
 tests/generic/229.out       |   1 -
 tests/generic/238           |  78 ++++---
 tests/generic/238.out       |   1 -
 tests/generic/242           |  51 +++--
 tests/generic/242.out       |   1 -
 tests/generic/243           |  52 +++--
 tests/generic/243.out       |   1 -
 tests/generic/250           | 100 +++++++++
 tests/generic/250.out       |  10 +
 tests/generic/252           | 103 ++++++++++
 tests/generic/252.out       |  10 +
 tests/generic/253           |  90 ++++++++
 tests/generic/253.out       |  12 ++
 tests/generic/254           |  90 ++++++++
 tests/generic/254.out       |  12 ++
 tests/generic/259           |  90 ++++++++
 tests/generic/259.out       |  12 ++
 tests/generic/261           |  90 ++++++++
 tests/generic/261.out       |  12 ++
 tests/generic/262           |  93 +++++++++
 tests/generic/262.out       |  12 ++
 tests/generic/264           |  90 ++++++++
 tests/generic/264.out       |  12 ++
 tests/generic/265           |  99 +++++++++
 tests/generic/265.out       |  11 +
 tests/generic/266           |  97 +++++++++
 tests/generic/266.out       |  11 +
 tests/generic/267           | 100 +++++++++
 tests/generic/267.out       |  10 +
 tests/generic/268           | 103 ++++++++++
 tests/generic/268.out       |  12 ++
 tests/generic/271           | 100 +++++++++
 tests/generic/271.out       |  11 +
 tests/generic/272           |  98 +++++++++
 tests/generic/272.out       |  11 +
 tests/generic/276           | 101 +++++++++
 tests/generic/276.out       |  11 +
 tests/generic/278           | 104 ++++++++++
 tests/generic/278.out       |  12 ++
 tests/generic/279           | 100 +++++++++
 tests/generic/279.out       |  11 +
 tests/generic/281           |  98 +++++++++
 tests/generic/281.out       |  11 +
 tests/generic/282           | 101 +++++++++
 tests/generic/282.out       |  10 +
 tests/generic/283           | 104 ++++++++++
 tests/generic/283.out       |  12 ++
 tests/generic/284           |  89 ++++++++
 tests/generic/284.out       |  12 ++
 tests/generic/285           |   2 +-
 tests/generic/286           |   2 +-
 tests/generic/287           |  90 ++++++++
 tests/generic/287.out       |  12 ++
 tests/generic/289           |  91 +++++++++
 tests/generic/289.out       |  12 ++
 tests/generic/290           |  92 +++++++++
 tests/generic/290.out       |  12 ++
 tests/generic/291           |  91 +++++++++
 tests/generic/291.out       |  12 ++
 tests/generic/292           |  92 +++++++++
 tests/generic/292.out       |  12 ++
 tests/generic/293           |  93 +++++++++
 tests/generic/293.out       |  12 ++
 tests/generic/295           |  94 +++++++++
 tests/generic/295.out       |  12 ++
 tests/generic/296           |  90 ++++++++
 tests/generic/296.out       |  12 ++
 tests/generic/297           |  99 +++++++++
 tests/generic/297.out       |   6 +
 tests/generic/298           |  99 +++++++++
 tests/generic/298.out       |   6 +
 tests/generic/301           | 100 +++++++++
 tests/generic/301.out       |  10 +
 tests/generic/302           | 101 +++++++++
 tests/generic/302.out       |  10 +
 tests/generic/303           |  98 +++++++++
 tests/generic/303.out       |  21 ++
 tests/generic/304           |  99 +++++++++
 tests/generic/304.out       |  22 ++
 tests/generic/305           | 100 +++++++++
 tests/generic/305.out       |  22 ++
 tests/generic/311           |   2 +-
 tests/generic/326           | 101 +++++++++
 tests/generic/326.out       |  22 ++
 tests/generic/327           |  87 ++++++++
 tests/generic/327.out       |  12 ++
 tests/generic/328           | 105 ++++++++++
 tests/generic/328.out       |  25 +++
 tests/generic/329           | 102 +++++++++
 tests/generic/329.out       |  12 ++
 tests/generic/330           |  93 +++++++++
 tests/generic/330.out       |  11 +
 tests/generic/331           | 104 ++++++++++
 tests/generic/331.out       |  12 ++
 tests/generic/332           |  94 +++++++++
 tests/generic/332.out       |  11 +
 tests/generic/333           |  99 +++++++++
 tests/generic/333.out       |   4 +
 tests/generic/334           |  98 +++++++++
 tests/generic/334.out       |   4 +
 tests/generic/group         |  71 +++++--
 tests/xfs/032               |   3 +-
 tests/xfs/044               |   2 +-
 tests/xfs/122               |   3 +
 tests/xfs/122.out           |   4 +
 tests/xfs/127               |  33 ++-
 tests/xfs/127.out           |   1 -
 tests/xfs/128               |  97 +++++----
 tests/xfs/128.out           |   9 +-
 tests/xfs/129               |  33 ++-
 tests/xfs/131               |  25 +--
 tests/xfs/131.out           |   1 -
 tests/xfs/132               |  53 ++---
 tests/xfs/132.out           |  40 ++--
 tests/xfs/139               |  35 ++--
 tests/xfs/139.out           |   1 -
 tests/xfs/140               |  41 ++--
 tests/xfs/140.out           |   1 -
 tests/xfs/169               |  86 ++++++++
 tests/xfs/169.out           |   7 +
 tests/xfs/179               | 118 +++++++++++
 tests/xfs/179.out           |  10 +
 tests/xfs/180               | 106 ++++++++++
 tests/xfs/180.out           |  11 +
 tests/xfs/182               | 107 ++++++++++
 tests/xfs/182.out           |  12 ++
 tests/xfs/184               | 105 ++++++++++
 tests/xfs/184.out           |  10 +
 tests/xfs/192               | 106 ++++++++++
 tests/xfs/192.out           |  10 +
 tests/xfs/193               | 102 +++++++++
 tests/xfs/193.out           |  10 +
 tests/xfs/198               | 103 ++++++++++
 tests/xfs/198.out           |  10 +
 tests/xfs/200               | 109 ++++++++++
 tests/xfs/200.out           |  10 +
 tests/xfs/204               | 110 ++++++++++
 tests/xfs/204.out           |  10 +
 tests/xfs/207               | 101 +++++++++
 tests/xfs/207.out           |  18 ++
 tests/xfs/208               | 138 +++++++++++++
 tests/xfs/208.out           |  13 ++
 tests/xfs/209               |  82 ++++++++
 tests/xfs/209.out           |  13 ++
 tests/xfs/210               | 108 ++++++++++
 tests/xfs/210.out           |  23 +++
 tests/xfs/211               | 107 ++++++++++
 tests/xfs/211.out           |  11 +
 tests/xfs/212               |  99 +++++++++
 tests/xfs/212.out           |  13 ++
 tests/xfs/213               | 105 ++++++++++
 tests/xfs/213.out           |  22 ++
 tests/xfs/214               | 106 ++++++++++
 tests/xfs/214.out           |  22 ++
 tests/xfs/215               | 102 +++++++++
 tests/xfs/215.out           |  13 ++
 tests/xfs/218               | 101 +++++++++
 tests/xfs/218.out           |  13 ++
 tests/xfs/219               | 102 +++++++++
 tests/xfs/219.out           |  13 ++
 tests/xfs/221               | 101 +++++++++
 tests/xfs/221.out           |  13 ++
 tests/xfs/223               | 104 ++++++++++
 tests/xfs/223.out           |  13 ++
 tests/xfs/224               | 103 ++++++++++
 tests/xfs/224.out           |  13 ++
 tests/xfs/225               | 102 +++++++++
 tests/xfs/225.out           |  13 ++
 tests/xfs/226               | 101 +++++++++
 tests/xfs/226.out           |  13 ++
 tests/xfs/228               | 110 ++++++++++
 tests/xfs/228.out           |  13 ++
 tests/xfs/230               | 110 ++++++++++
 tests/xfs/230.out           |  13 ++
 tests/xfs/231               | 130 ++++++++++++
 tests/xfs/231.out           |  16 ++
 tests/xfs/232               | 132 ++++++++++++
 tests/xfs/232.out           |  16 ++
 tests/xfs/233               |  73 +++++++
 tests/xfs/233.out           |   5 +
 tests/xfs/234               |  88 ++++++++
 tests/xfs/234.out           |   6 +
 tests/xfs/235               | 108 ++++++++++
 tests/xfs/235.out           |  14 ++
 tests/xfs/236               |  88 ++++++++
 tests/xfs/236.out           |   7 +
 tests/xfs/237               | 105 ++++++++++
 tests/xfs/237.out           |  12 ++
 tests/xfs/239               |  98 +++++++++
 tests/xfs/239.out           |  11 +
 tests/xfs/240               | 110 ++++++++++
 tests/xfs/240.out           |  12 ++
 tests/xfs/241               | 100 +++++++++
 tests/xfs/241.out           |  11 +
 tests/xfs/243               | 165 +++++++++++++++
 tests/xfs/243.out           |  26 +++
 tests/xfs/245               |  95 +++++++++
 tests/xfs/245.out           |  12 ++
 tests/xfs/246               |  65 ++++++
 tests/xfs/246.out           |   6 +
 tests/xfs/247               |  57 ++++++
 tests/xfs/247.out           |   2 +
 tests/xfs/248               |  91 +++++++++
 tests/xfs/248.out           |  12 ++
 tests/xfs/249               |  92 +++++++++
 tests/xfs/249.out           |  12 ++
 tests/xfs/251               |  93 +++++++++
 tests/xfs/251.out           |  12 ++
 tests/xfs/254               |  94 +++++++++
 tests/xfs/254.out           |  12 ++
 tests/xfs/255               |  93 +++++++++
 tests/xfs/255.out           |  12 ++
 tests/xfs/256               |  94 +++++++++
 tests/xfs/256.out           |  12 ++
 tests/xfs/257               |  95 +++++++++
 tests/xfs/257.out           |  12 ++
 tests/xfs/258               |  96 +++++++++
 tests/xfs/258.out           |  12 ++
 tests/xfs/group             |  56 ++++-
 352 files changed, 13924 insertions(+), 2729 deletions(-)
 create mode 100644 src/aio-dio-regress/aiocp.c
 create mode 100644 src/punch-alternating.c
 create mode 100755 tests/generic/250
 create mode 100644 tests/generic/250.out
 create mode 100755 tests/generic/252
 create mode 100644 tests/generic/252.out
 create mode 100755 tests/generic/253
 create mode 100644 tests/generic/253.out
 create mode 100755 tests/generic/254
 create mode 100644 tests/generic/254.out
 create mode 100755 tests/generic/259
 create mode 100644 tests/generic/259.out
 create mode 100755 tests/generic/261
 create mode 100644 tests/generic/261.out
 create mode 100755 tests/generic/262
 create mode 100644 tests/generic/262.out
 create mode 100755 tests/generic/264
 create mode 100644 tests/generic/264.out
 create mode 100755 tests/generic/265
 create mode 100644 tests/generic/265.out
 create mode 100755 tests/generic/266
 create mode 100644 tests/generic/266.out
 create mode 100755 tests/generic/267
 create mode 100644 tests/generic/267.out
 create mode 100755 tests/generic/268
 create mode 100644 tests/generic/268.out
 create mode 100755 tests/generic/271
 create mode 100644 tests/generic/271.out
 create mode 100755 tests/generic/272
 create mode 100644 tests/generic/272.out
 create mode 100755 tests/generic/276
 create mode 100644 tests/generic/276.out
 create mode 100755 tests/generic/278
 create mode 100644 tests/generic/278.out
 create mode 100755 tests/generic/279
 create mode 100644 tests/generic/279.out
 create mode 100755 tests/generic/281
 create mode 100644 tests/generic/281.out
 create mode 100755 tests/generic/282
 create mode 100644 tests/generic/282.out
 create mode 100755 tests/generic/283
 create mode 100644 tests/generic/283.out
 create mode 100755 tests/generic/284
 create mode 100644 tests/generic/284.out
 create mode 100755 tests/generic/287
 create mode 100644 tests/generic/287.out
 create mode 100755 tests/generic/289
 create mode 100644 tests/generic/289.out
 create mode 100755 tests/generic/290
 create mode 100644 tests/generic/290.out
 create mode 100755 tests/generic/291
 create mode 100644 tests/generic/291.out
 create mode 100755 tests/generic/292
 create mode 100644 tests/generic/292.out
 create mode 100755 tests/generic/293
 create mode 100644 tests/generic/293.out
 create mode 100755 tests/generic/295
 create mode 100644 tests/generic/295.out
 create mode 100755 tests/generic/296
 create mode 100644 tests/generic/296.out
 create mode 100755 tests/generic/297
 create mode 100644 tests/generic/297.out
 create mode 100755 tests/generic/298
 create mode 100644 tests/generic/298.out
 create mode 100755 tests/generic/301
 create mode 100644 tests/generic/301.out
 create mode 100755 tests/generic/302
 create mode 100644 tests/generic/302.out
 create mode 100755 tests/generic/303
 create mode 100644 tests/generic/303.out
 create mode 100755 tests/generic/304
 create mode 100644 tests/generic/304.out
 create mode 100755 tests/generic/305
 create mode 100644 tests/generic/305.out
 create mode 100755 tests/generic/326
 create mode 100644 tests/generic/326.out
 create mode 100755 tests/generic/327
 create mode 100644 tests/generic/327.out
 create mode 100755 tests/generic/328
 create mode 100644 tests/generic/328.out
 create mode 100755 tests/generic/329
 create mode 100644 tests/generic/329.out
 create mode 100755 tests/generic/330
 create mode 100644 tests/generic/330.out
 create mode 100755 tests/generic/331
 create mode 100644 tests/generic/331.out
 create mode 100755 tests/generic/332
 create mode 100644 tests/generic/332.out
 create mode 100755 tests/generic/333
 create mode 100644 tests/generic/333.out
 create mode 100755 tests/generic/334
 create mode 100644 tests/generic/334.out
 create mode 100755 tests/xfs/169
 create mode 100644 tests/xfs/169.out
 create mode 100755 tests/xfs/179
 create mode 100644 tests/xfs/179.out
 create mode 100755 tests/xfs/180
 create mode 100644 tests/xfs/180.out
 create mode 100755 tests/xfs/182
 create mode 100644 tests/xfs/182.out
 create mode 100755 tests/xfs/184
 create mode 100644 tests/xfs/184.out
 create mode 100755 tests/xfs/192
 create mode 100644 tests/xfs/192.out
 create mode 100755 tests/xfs/193
 create mode 100644 tests/xfs/193.out
 create mode 100755 tests/xfs/198
 create mode 100644 tests/xfs/198.out
 create mode 100755 tests/xfs/200
 create mode 100644 tests/xfs/200.out
 create mode 100755 tests/xfs/204
 create mode 100644 tests/xfs/204.out
 create mode 100755 tests/xfs/207
 create mode 100644 tests/xfs/207.out
 create mode 100755 tests/xfs/208
 create mode 100644 tests/xfs/208.out
 create mode 100755 tests/xfs/209
 create mode 100644 tests/xfs/209.out
 create mode 100755 tests/xfs/210
 create mode 100644 tests/xfs/210.out
 create mode 100755 tests/xfs/211
 create mode 100644 tests/xfs/211.out
 create mode 100755 tests/xfs/212
 create mode 100644 tests/xfs/212.out
 create mode 100755 tests/xfs/213
 create mode 100644 tests/xfs/213.out
 create mode 100755 tests/xfs/214
 create mode 100644 tests/xfs/214.out
 create mode 100755 tests/xfs/215
 create mode 100644 tests/xfs/215.out
 create mode 100755 tests/xfs/218
 create mode 100644 tests/xfs/218.out
 create mode 100755 tests/xfs/219
 create mode 100644 tests/xfs/219.out
 create mode 100755 tests/xfs/221
 create mode 100644 tests/xfs/221.out
 create mode 100755 tests/xfs/223
 create mode 100644 tests/xfs/223.out
 create mode 100755 tests/xfs/224
 create mode 100644 tests/xfs/224.out
 create mode 100755 tests/xfs/225
 create mode 100644 tests/xfs/225.out
 create mode 100755 tests/xfs/226
 create mode 100644 tests/xfs/226.out
 create mode 100755 tests/xfs/228
 create mode 100644 tests/xfs/228.out
 create mode 100755 tests/xfs/230
 create mode 100644 tests/xfs/230.out
 create mode 100755 tests/xfs/231
 create mode 100644 tests/xfs/231.out
 create mode 100755 tests/xfs/232
 create mode 100644 tests/xfs/232.out
 create mode 100755 tests/xfs/233
 create mode 100644 tests/xfs/233.out
 create mode 100755 tests/xfs/234
 create mode 100644 tests/xfs/234.out
 create mode 100755 tests/xfs/235
 create mode 100644 tests/xfs/235.out
 create mode 100755 tests/xfs/236
 create mode 100644 tests/xfs/236.out
 create mode 100755 tests/xfs/237
 create mode 100644 tests/xfs/237.out
 create mode 100755 tests/xfs/239
 create mode 100644 tests/xfs/239.out
 create mode 100755 tests/xfs/240
 create mode 100644 tests/xfs/240.out
 create mode 100755 tests/xfs/241
 create mode 100644 tests/xfs/241.out
 create mode 100755 tests/xfs/243
 create mode 100644 tests/xfs/243.out
 create mode 100755 tests/xfs/245
 create mode 100644 tests/xfs/245.out
 create mode 100755 tests/xfs/246
 create mode 100644 tests/xfs/246.out
 create mode 100755 tests/xfs/247
 create mode 100644 tests/xfs/247.out
 create mode 100755 tests/xfs/248
 create mode 100644 tests/xfs/248.out
 create mode 100755 tests/xfs/249
 create mode 100644 tests/xfs/249.out
 create mode 100755 tests/xfs/251
 create mode 100644 tests/xfs/251.out
 create mode 100755 tests/xfs/254
 create mode 100644 tests/xfs/254.out
 create mode 100755 tests/xfs/255
 create mode 100644 tests/xfs/255.out
 create mode 100755 tests/xfs/256
 create mode 100644 tests/xfs/256.out
 create mode 100755 tests/xfs/257
 create mode 100644 tests/xfs/257.out
 create mode 100755 tests/xfs/258
 create mode 100644 tests/xfs/258.out

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

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

* [PATCH 33/32] aiocp: fix the gcc warnings
  2016-02-11 23:39 ` Darrick J. Wong
@ 2016-02-12 17:41   ` Darrick J. Wong
  -1 siblings, 0 replies; 81+ messages in thread
From: Darrick J. Wong @ 2016-02-12 17:41 UTC (permalink / raw)
  To: david; +Cc: linux-btrfs, fstests, xfs

Eliminate a debug printf that was causing warnings and fix the other two
debug printfs to avoid tripping on return value warnings.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 src/aio-dio-regress/aiocp.c |    5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/src/aio-dio-regress/aiocp.c b/src/aio-dio-regress/aiocp.c
index 1abff9c..ccab2ac 100644
--- a/src/aio-dio-regress/aiocp.c
+++ b/src/aio-dio-regress/aiocp.c
@@ -190,7 +190,7 @@ static void wr_done(io_context_t ctx, struct iocb *iocb, long res, long res2)
 	--busy;
 	free_iocb(iocb);
 	if (debug)
-		write(2, "w", 1);
+		fprintf(stderr, "w");
 }
 
 /*
@@ -225,7 +225,7 @@ static void rd_done(io_context_t ctx, struct iocb *iocb, long res, long res2)
 			io_error("io_submit write", res);
 	}
 	if (debug)
-		write(2, "r", 1);
+		fprintf(stderr, "r");
 	if (debug > 1)
 		printf("%d", iosize);
 }
@@ -404,7 +404,6 @@ int main(int argc, char *const *argv)
 	memset(&myctx, 0, sizeof(myctx));
 	io_queue_init(aio_maxio, &myctx);
 	tocopy = howmany(length, aio_blksize);
-printf("tocopy=%d len=%d blk=%d\n", tocopy, length, aio_blksize);
 	if (init_iocb(aio_maxio, aio_blksize) < 0) {
 		fprintf(stderr, "Error allocating the i/o buffers\n");
 		exit(1);

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

* [PATCH 33/32] aiocp: fix the gcc warnings
@ 2016-02-12 17:41   ` Darrick J. Wong
  0 siblings, 0 replies; 81+ messages in thread
From: Darrick J. Wong @ 2016-02-12 17:41 UTC (permalink / raw)
  To: david; +Cc: fstests, linux-btrfs, xfs

Eliminate a debug printf that was causing warnings and fix the other two
debug printfs to avoid tripping on return value warnings.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 src/aio-dio-regress/aiocp.c |    5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/src/aio-dio-regress/aiocp.c b/src/aio-dio-regress/aiocp.c
index 1abff9c..ccab2ac 100644
--- a/src/aio-dio-regress/aiocp.c
+++ b/src/aio-dio-regress/aiocp.c
@@ -190,7 +190,7 @@ static void wr_done(io_context_t ctx, struct iocb *iocb, long res, long res2)
 	--busy;
 	free_iocb(iocb);
 	if (debug)
-		write(2, "w", 1);
+		fprintf(stderr, "w");
 }
 
 /*
@@ -225,7 +225,7 @@ static void rd_done(io_context_t ctx, struct iocb *iocb, long res, long res2)
 			io_error("io_submit write", res);
 	}
 	if (debug)
-		write(2, "r", 1);
+		fprintf(stderr, "r");
 	if (debug > 1)
 		printf("%d", iosize);
 }
@@ -404,7 +404,6 @@ int main(int argc, char *const *argv)
 	memset(&myctx, 0, sizeof(myctx));
 	io_queue_init(aio_maxio, &myctx);
 	tocopy = howmany(length, aio_blksize);
-printf("tocopy=%d len=%d blk=%d\n", tocopy, length, aio_blksize);
 	if (init_iocb(aio_maxio, aio_blksize) < 0) {
 		fprintf(stderr, "Error allocating the i/o buffers\n");
 		exit(1);

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

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

* Re: [PATCH 12/32] dio: unwritten conversion bug tests
  2016-02-12 15:22       ` Theodore Ts'o
@ 2016-02-12 22:49         ` Dave Chinner
  -1 siblings, 0 replies; 81+ messages in thread
From: Dave Chinner @ 2016-02-12 22:49 UTC (permalink / raw)
  To: Theodore Ts'o; +Cc: Darrick J. Wong, linux-btrfs, fstests, xfs

On Fri, Feb 12, 2016 at 10:22:31AM -0500, Theodore Ts'o wrote:
> On Fri, Feb 12, 2016 at 02:52:53PM +1100, Dave Chinner wrote:
> > On Thu, Feb 11, 2016 at 03:40:37PM -0800, Darrick J. Wong wrote:
> > > Check that we don't expose old disk contents when a directio write to
> > > an unwritten extent fails due to IO errors.  This primarily affects
> > > XFS and ext4.
> > > 
> > > Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> > 
> > aiocp.c: In function 'main':
> > aiocp.c:407:1: warning: format '%d' expects argument of type 'int', but argument 3 has type 'off_t' [-Wformat=]
> >  printf("tocopy=%d len=%d blk=%d\n", tocopy, length, aio_blksize);
> >  ^
> > 
> > Followup patch is fine, I'll commit as is.
> 
> Dave, given that Darrick's patches is going to cause more
> _scratch_mount occurences, how quickly do you plan to commit his
> patchset?  Should I wait until he makes his change before I do the
> s/_scratch_mount/_scratch_cycle_mount/ change?  Should I make that
> change, and let you fix it up the commit?

I had to head out suddenly yestrday afternoon, just after I sent
above email. Only just got back in front of the computer, so I'll be
pushing it out once the new pull has run through a sanity check.

If you can respin the patch once I've done that, it would be greatly
appreciated.

Cheers,

Dave.
-- 
Dave Chinner
david@fromorbit.com

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

* Re: [PATCH 12/32] dio: unwritten conversion bug tests
@ 2016-02-12 22:49         ` Dave Chinner
  0 siblings, 0 replies; 81+ messages in thread
From: Dave Chinner @ 2016-02-12 22:49 UTC (permalink / raw)
  To: Theodore Ts'o; +Cc: xfs, fstests, linux-btrfs, Darrick J. Wong

On Fri, Feb 12, 2016 at 10:22:31AM -0500, Theodore Ts'o wrote:
> On Fri, Feb 12, 2016 at 02:52:53PM +1100, Dave Chinner wrote:
> > On Thu, Feb 11, 2016 at 03:40:37PM -0800, Darrick J. Wong wrote:
> > > Check that we don't expose old disk contents when a directio write to
> > > an unwritten extent fails due to IO errors.  This primarily affects
> > > XFS and ext4.
> > > 
> > > Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> > 
> > aiocp.c: In function 'main':
> > aiocp.c:407:1: warning: format '%d' expects argument of type 'int', but argument 3 has type 'off_t' [-Wformat=]
> >  printf("tocopy=%d len=%d blk=%d\n", tocopy, length, aio_blksize);
> >  ^
> > 
> > Followup patch is fine, I'll commit as is.
> 
> Dave, given that Darrick's patches is going to cause more
> _scratch_mount occurences, how quickly do you plan to commit his
> patchset?  Should I wait until he makes his change before I do the
> s/_scratch_mount/_scratch_cycle_mount/ change?  Should I make that
> change, and let you fix it up the commit?

I had to head out suddenly yestrday afternoon, just after I sent
above email. Only just got back in front of the computer, so I'll be
pushing it out once the new pull has run through a sanity check.

If you can respin the patch once I've done that, it would be greatly
appreciated.

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] 81+ messages in thread

* Re: [PATCH v4.2 00/32] xfstests: test the nfs/cifs/btrfs/xfs reflink/dedupe ioctls
  2016-02-11 23:39 ` Darrick J. Wong
@ 2016-02-13  1:26   ` Dave Chinner
  -1 siblings, 0 replies; 81+ messages in thread
From: Dave Chinner @ 2016-02-13  1:26 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: linux-btrfs, fstests, xfs

On Thu, Feb 11, 2016 at 03:39:16PM -0800, Darrick J. Wong wrote:
> Dave Chinner: I've renumbered the new tests and pushed to github[3] if
> you'd like to pull.  See the pull request at the end of this message.
> 
> This is a patch set against the reflink/dedupe test cases in xfstests.
> The first three patches fix errors in the existing reflink tests, some
> of which are from Christoph Hellwig.
> 
> The next eight patches fix style errors, refactor commonly used code,
> remove unnecessary clutter, and add missing _require* checks to the
> existing reflink tests.
> 
> Patch 12 adds a test checking that unwritten extent conversion does
> NOT happen after a directio write to an unwritten extent hits a disk
> error.   Due to a bug in the VFS directio code, ext4 can disclose
> stale disk contents if an aio dio write fails; XFS suffers this
> problem for any failing dio write to an unwritten extent.  Christoph's
> kernel patchset titled "vfs/xfs: directio updates to ease COW handling
> V2" (and a separate ext4 warning cleanup) is needed to fix this.
> 
> Patches 13-31 add more reflink tests focusing on correct CoW behavior
> particularly with the CoW extent size hint enabled.  It also provides
> a few regression tests for bugs that have been hit while running XFS
> reflink, a few tests of the quota accounting when various reflink
> operations happen, and a few tests for get_bmapx to ensure that what
> it reports is at least somewhat accurate.
> 
> Patch 25 adds a few basic reverse-mapping tests for XFS.
> 
> 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].  All tests should pass on XFS, YMWV on
> btrfs and ocfs2.
> 
> Comments and questions are, as always, welcome.

I haven't worked out which patch causes this, but:

xfs/246  - output mismatch (see /home/dave/src/xfstests-dev/results//xfs_1k/xfs/246.out.bad)
    --- tests/xfs/246.out       2016-02-13 09:46:01.419169115 +1100
    +++ /home/dave/src/xfstests-dev/results//xfs_1k/xfs/246.out.bad     2016-02-13 11:36:05.205851863 +1100
    @@ -3,4 +3,5 @@
     Create the original files
     Dump extents after sync
     Hole CoW extents:
    -SCRATCH_MNT/test-246/file1: no extents
    +bmap: invalid option -- 'c'
    +bmap [-adlpv] [-n nx] -- print block mapping for an XFS file
    ...
    (Run 'diff -u tests/xfs/246.out /home/dave/src/xfstests-dev/results//xfs_1k/xfs/246.out.bad'  to see the entire diff)

This test neds a check that the "-c" option in the bmap command
exists. Not sure if you can use '_requires_xfs_io_command "bmap -c"'
here or whether this requires more help...

Followup patch, anyway, because I'm about to push out everything
that was in your second pull req (i.e. with the aiocp fix).

Cheers,

Dave.
-- 
Dave Chinner
david@fromorbit.com

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

* Re: [PATCH v4.2 00/32] xfstests: test the nfs/cifs/btrfs/xfs reflink/dedupe ioctls
@ 2016-02-13  1:26   ` Dave Chinner
  0 siblings, 0 replies; 81+ messages in thread
From: Dave Chinner @ 2016-02-13  1:26 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: fstests, linux-btrfs, xfs

On Thu, Feb 11, 2016 at 03:39:16PM -0800, Darrick J. Wong wrote:
> Dave Chinner: I've renumbered the new tests and pushed to github[3] if
> you'd like to pull.  See the pull request at the end of this message.
> 
> This is a patch set against the reflink/dedupe test cases in xfstests.
> The first three patches fix errors in the existing reflink tests, some
> of which are from Christoph Hellwig.
> 
> The next eight patches fix style errors, refactor commonly used code,
> remove unnecessary clutter, and add missing _require* checks to the
> existing reflink tests.
> 
> Patch 12 adds a test checking that unwritten extent conversion does
> NOT happen after a directio write to an unwritten extent hits a disk
> error.   Due to a bug in the VFS directio code, ext4 can disclose
> stale disk contents if an aio dio write fails; XFS suffers this
> problem for any failing dio write to an unwritten extent.  Christoph's
> kernel patchset titled "vfs/xfs: directio updates to ease COW handling
> V2" (and a separate ext4 warning cleanup) is needed to fix this.
> 
> Patches 13-31 add more reflink tests focusing on correct CoW behavior
> particularly with the CoW extent size hint enabled.  It also provides
> a few regression tests for bugs that have been hit while running XFS
> reflink, a few tests of the quota accounting when various reflink
> operations happen, and a few tests for get_bmapx to ensure that what
> it reports is at least somewhat accurate.
> 
> Patch 25 adds a few basic reverse-mapping tests for XFS.
> 
> 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].  All tests should pass on XFS, YMWV on
> btrfs and ocfs2.
> 
> Comments and questions are, as always, welcome.

I haven't worked out which patch causes this, but:

xfs/246  - output mismatch (see /home/dave/src/xfstests-dev/results//xfs_1k/xfs/246.out.bad)
    --- tests/xfs/246.out       2016-02-13 09:46:01.419169115 +1100
    +++ /home/dave/src/xfstests-dev/results//xfs_1k/xfs/246.out.bad     2016-02-13 11:36:05.205851863 +1100
    @@ -3,4 +3,5 @@
     Create the original files
     Dump extents after sync
     Hole CoW extents:
    -SCRATCH_MNT/test-246/file1: no extents
    +bmap: invalid option -- 'c'
    +bmap [-adlpv] [-n nx] -- print block mapping for an XFS file
    ...
    (Run 'diff -u tests/xfs/246.out /home/dave/src/xfstests-dev/results//xfs_1k/xfs/246.out.bad'  to see the entire diff)

This test neds a check that the "-c" option in the bmap command
exists. Not sure if you can use '_requires_xfs_io_command "bmap -c"'
here or whether this requires more help...

Followup patch, anyway, because I'm about to push out everything
that was in your second pull req (i.e. with the aiocp fix).

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] 81+ messages in thread

* Re: [PATCH v4.2 00/32] xfstests: test the nfs/cifs/btrfs/xfs reflink/dedupe ioctls
  2016-02-13  1:26   ` Dave Chinner
@ 2016-02-13  4:38     ` Darrick J. Wong
  -1 siblings, 0 replies; 81+ messages in thread
From: Darrick J. Wong @ 2016-02-13  4:38 UTC (permalink / raw)
  To: Dave Chinner; +Cc: linux-btrfs, fstests, xfs

On Sat, Feb 13, 2016 at 12:26:59PM +1100, Dave Chinner wrote:
> On Thu, Feb 11, 2016 at 03:39:16PM -0800, Darrick J. Wong wrote:
> > Dave Chinner: I've renumbered the new tests and pushed to github[3] if
> > you'd like to pull.  See the pull request at the end of this message.
> > 
> > This is a patch set against the reflink/dedupe test cases in xfstests.
> > The first three patches fix errors in the existing reflink tests, some
> > of which are from Christoph Hellwig.
> > 
> > The next eight patches fix style errors, refactor commonly used code,
> > remove unnecessary clutter, and add missing _require* checks to the
> > existing reflink tests.
> > 
> > Patch 12 adds a test checking that unwritten extent conversion does
> > NOT happen after a directio write to an unwritten extent hits a disk
> > error.   Due to a bug in the VFS directio code, ext4 can disclose
> > stale disk contents if an aio dio write fails; XFS suffers this
> > problem for any failing dio write to an unwritten extent.  Christoph's
> > kernel patchset titled "vfs/xfs: directio updates to ease COW handling
> > V2" (and a separate ext4 warning cleanup) is needed to fix this.
> > 
> > Patches 13-31 add more reflink tests focusing on correct CoW behavior
> > particularly with the CoW extent size hint enabled.  It also provides
> > a few regression tests for bugs that have been hit while running XFS
> > reflink, a few tests of the quota accounting when various reflink
> > operations happen, and a few tests for get_bmapx to ensure that what
> > it reports is at least somewhat accurate.
> > 
> > Patch 25 adds a few basic reverse-mapping tests for XFS.
> > 
> > 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].  All tests should pass on XFS, YMWV on
> > btrfs and ocfs2.
> > 
> > Comments and questions are, as always, welcome.
> 
> I haven't worked out which patch causes this, but:
> 
> xfs/246  - output mismatch (see /home/dave/src/xfstests-dev/results//xfs_1k/xfs/246.out.bad)
>     --- tests/xfs/246.out       2016-02-13 09:46:01.419169115 +1100
>     +++ /home/dave/src/xfstests-dev/results//xfs_1k/xfs/246.out.bad     2016-02-13 11:36:05.205851863 +1100
>     @@ -3,4 +3,5 @@
>      Create the original files
>      Dump extents after sync
>      Hole CoW extents:
>     -SCRATCH_MNT/test-246/file1: no extents
>     +bmap: invalid option -- 'c'
>     +bmap [-adlpv] [-n nx] -- print block mapping for an XFS file
>     ...
>     (Run 'diff -u tests/xfs/246.out /home/dave/src/xfstests-dev/results//xfs_1k/xfs/246.out.bad'  to see the entire diff)
> 
> This test neds a check that the "-c" option in the bmap command
> exists. Not sure if you can use '_requires_xfs_io_command "bmap -c"'
> here or whether this requires more help...
> 
> Followup patch, anyway, because I'm about to push out everything
> that was in your second pull req (i.e. with the aiocp fix).

xfs_io "bmap -c" is a new switch that dumps the CoW fork of a file.
AFAICT there isn't any way to check that an xfs_io command supports
a particular switch, though it wouldn't be difficult to add a check.

--D

> 
> Cheers,
> 
> Dave.
> -- 
> Dave Chinner
> david@fromorbit.com

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

* Re: [PATCH v4.2 00/32] xfstests: test the nfs/cifs/btrfs/xfs reflink/dedupe ioctls
@ 2016-02-13  4:38     ` Darrick J. Wong
  0 siblings, 0 replies; 81+ messages in thread
From: Darrick J. Wong @ 2016-02-13  4:38 UTC (permalink / raw)
  To: Dave Chinner; +Cc: fstests, linux-btrfs, xfs

On Sat, Feb 13, 2016 at 12:26:59PM +1100, Dave Chinner wrote:
> On Thu, Feb 11, 2016 at 03:39:16PM -0800, Darrick J. Wong wrote:
> > Dave Chinner: I've renumbered the new tests and pushed to github[3] if
> > you'd like to pull.  See the pull request at the end of this message.
> > 
> > This is a patch set against the reflink/dedupe test cases in xfstests.
> > The first three patches fix errors in the existing reflink tests, some
> > of which are from Christoph Hellwig.
> > 
> > The next eight patches fix style errors, refactor commonly used code,
> > remove unnecessary clutter, and add missing _require* checks to the
> > existing reflink tests.
> > 
> > Patch 12 adds a test checking that unwritten extent conversion does
> > NOT happen after a directio write to an unwritten extent hits a disk
> > error.   Due to a bug in the VFS directio code, ext4 can disclose
> > stale disk contents if an aio dio write fails; XFS suffers this
> > problem for any failing dio write to an unwritten extent.  Christoph's
> > kernel patchset titled "vfs/xfs: directio updates to ease COW handling
> > V2" (and a separate ext4 warning cleanup) is needed to fix this.
> > 
> > Patches 13-31 add more reflink tests focusing on correct CoW behavior
> > particularly with the CoW extent size hint enabled.  It also provides
> > a few regression tests for bugs that have been hit while running XFS
> > reflink, a few tests of the quota accounting when various reflink
> > operations happen, and a few tests for get_bmapx to ensure that what
> > it reports is at least somewhat accurate.
> > 
> > Patch 25 adds a few basic reverse-mapping tests for XFS.
> > 
> > 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].  All tests should pass on XFS, YMWV on
> > btrfs and ocfs2.
> > 
> > Comments and questions are, as always, welcome.
> 
> I haven't worked out which patch causes this, but:
> 
> xfs/246  - output mismatch (see /home/dave/src/xfstests-dev/results//xfs_1k/xfs/246.out.bad)
>     --- tests/xfs/246.out       2016-02-13 09:46:01.419169115 +1100
>     +++ /home/dave/src/xfstests-dev/results//xfs_1k/xfs/246.out.bad     2016-02-13 11:36:05.205851863 +1100
>     @@ -3,4 +3,5 @@
>      Create the original files
>      Dump extents after sync
>      Hole CoW extents:
>     -SCRATCH_MNT/test-246/file1: no extents
>     +bmap: invalid option -- 'c'
>     +bmap [-adlpv] [-n nx] -- print block mapping for an XFS file
>     ...
>     (Run 'diff -u tests/xfs/246.out /home/dave/src/xfstests-dev/results//xfs_1k/xfs/246.out.bad'  to see the entire diff)
> 
> This test neds a check that the "-c" option in the bmap command
> exists. Not sure if you can use '_requires_xfs_io_command "bmap -c"'
> here or whether this requires more help...
> 
> Followup patch, anyway, because I'm about to push out everything
> that was in your second pull req (i.e. with the aiocp fix).

xfs_io "bmap -c" is a new switch that dumps the CoW fork of a file.
AFAICT there isn't any way to check that an xfs_io command supports
a particular switch, though it wouldn't be difficult to add a check.

--D

> 
> 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] 81+ messages in thread

* Re: [PATCH v4.2 00/32] xfstests: test the nfs/cifs/btrfs/xfs reflink/dedupe ioctls
  2016-02-13  4:38     ` Darrick J. Wong
@ 2016-02-13  8:03       ` Christoph Hellwig
  -1 siblings, 0 replies; 81+ messages in thread
From: Christoph Hellwig @ 2016-02-13  8:03 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: Dave Chinner, fstests, linux-btrfs, xfs

On Fri, Feb 12, 2016 at 08:38:34PM -0800, Darrick J. Wong wrote:
> > Followup patch, anyway, because I'm about to push out everything
> > that was in your second pull req (i.e. with the aiocp fix).
> 
> xfs_io "bmap -c" is a new switch that dumps the CoW fork of a file.
> AFAICT there isn't any way to check that an xfs_io command supports
> a particular switch, though it wouldn't be difficult to add a check.

Just test for it the same way we test for the existance of xfs_io
subcommmand.

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

* Re: [PATCH v4.2 00/32] xfstests: test the nfs/cifs/btrfs/xfs reflink/dedupe ioctls
@ 2016-02-13  8:03       ` Christoph Hellwig
  0 siblings, 0 replies; 81+ messages in thread
From: Christoph Hellwig @ 2016-02-13  8:03 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: linux-btrfs, fstests, xfs

On Fri, Feb 12, 2016 at 08:38:34PM -0800, Darrick J. Wong wrote:
> > Followup patch, anyway, because I'm about to push out everything
> > that was in your second pull req (i.e. with the aiocp fix).
> 
> xfs_io "bmap -c" is a new switch that dumps the CoW fork of a file.
> AFAICT there isn't any way to check that an xfs_io command supports
> a particular switch, though it wouldn't be difficult to add a check.

Just test for it the same way we test for the existance of xfs_io
subcommmand.

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

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

end of thread, other threads:[~2016-02-13  8:03 UTC | newest]

Thread overview: 81+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-02-11 23:39 [PATCH v4.2 00/32] xfstests: test the nfs/cifs/btrfs/xfs reflink/dedupe ioctls Darrick J. Wong
2016-02-11 23:39 ` Darrick J. Wong
2016-02-11 23:39 ` [PATCH 01/32] generic/182: this is a dedupe test, check for dedupe Darrick J. Wong
2016-02-11 23:39   ` Darrick J. Wong
2016-02-11 23:39 ` [PATCH 02/32] xfstests: filter whitespace in 128 and 132 Darrick J. Wong
2016-02-11 23:39   ` Darrick J. Wong
2016-02-11 23:39 ` [PATCH 03/32] xfstests: make _scratch_mkfs_blocksized usable Darrick J. Wong
2016-02-11 23:39   ` Darrick J. Wong
2016-02-11 23:39 ` [PATCH 04/32] reflink: remove redundant filesystem checks from the end of the tests Darrick J. Wong
2016-02-11 23:39   ` Darrick J. Wong
2016-02-11 23:39 ` [PATCH 05/32] reflink: remove unnecessary umounts from test code Darrick J. Wong
2016-02-11 23:39   ` Darrick J. Wong
2016-02-11 23:39 ` [PATCH 06/32] common/dmerror: add some more dmerror routines Darrick J. Wong
2016-02-11 23:39   ` Darrick J. Wong
2016-02-11 23:40 ` [PATCH 07/32] common: create _require_test_program to look for programs in src/ Darrick J. Wong
2016-02-11 23:40   ` Darrick J. Wong
2016-02-11 23:40 ` [PATCH 08/32] common: provide a method to repair the scratch fs Darrick J. Wong
2016-02-11 23:40   ` Darrick J. Wong
2016-02-11 23:40 ` [PATCH 09/32] reflink: refactor mixed block creation code Darrick J. Wong
2016-02-11 23:40   ` Darrick J. Wong
2016-02-11 23:40 ` [PATCH 10/32] reflink: fix style problems in existing tests Darrick J. Wong
2016-02-11 23:40 ` [PATCH 11/32] reflink: add _require_odirect to the directio tests Darrick J. Wong
2016-02-11 23:40   ` Darrick J. Wong
2016-02-11 23:40 ` [PATCH 12/32] dio: unwritten conversion bug tests Darrick J. Wong
2016-02-11 23:40   ` Darrick J. Wong
2016-02-12  3:52   ` Dave Chinner
2016-02-12  3:52     ` Dave Chinner
2016-02-12 15:22     ` Theodore Ts'o
2016-02-12 15:22       ` Theodore Ts'o
2016-02-12 22:49       ` Dave Chinner
2016-02-12 22:49         ` Dave Chinner
2016-02-12 17:40     ` Darrick J. Wong
2016-02-12 17:40       ` Darrick J. Wong
2016-02-11 23:40 ` [PATCH 13/32] reflink: test intersecting CoW and falloc/fpunch/fzero/fcollapse/finsert/ftrunc Darrick J. Wong
2016-02-11 23:40   ` Darrick J. Wong
2016-02-11 23:40 ` [PATCH 14/32] reflink: test CoW behavior with IO errors Darrick J. Wong
2016-02-11 23:40   ` Darrick J. Wong
2016-02-11 23:40 ` [PATCH 15/32] reflink: test CoW operations against the source file Darrick J. Wong
2016-02-11 23:40   ` Darrick J. Wong
2016-02-11 23:41 ` [PATCH 16/32] reflink: ensure that we can handle reflinking a lot of extents Darrick J. Wong
2016-02-11 23:41   ` Darrick J. Wong
2016-02-11 23:41 ` [PATCH 17/32] xfs: more reflink tests Darrick J. Wong
2016-02-11 23:41   ` Darrick J. Wong
2016-02-11 23:41 ` [PATCH 18/32] xfs/122: support refcount/rmap data structures Darrick J. Wong
2016-02-11 23:41   ` Darrick J. Wong
2016-02-11 23:41 ` [PATCH 19/32] xfs: test fragmentation characteristics of copy-on-write Darrick J. Wong
2016-02-11 23:41   ` Darrick J. Wong
2016-02-11 23:41 ` [PATCH 20/32] reflink: high offset reflink and dedupe tests Darrick J. Wong
2016-02-11 23:41   ` Darrick J. Wong
2016-02-11 23:41 ` [PATCH 21/32] reflink: test xfs cow behavior when the filesystem crashes Darrick J. Wong
2016-02-11 23:41   ` Darrick J. Wong
2016-02-11 23:41 ` [PATCH 22/32] reflink: test quota accounting Darrick J. Wong
2016-02-11 23:41   ` Darrick J. Wong
2016-02-11 23:41 ` [PATCH 23/32] reflink: test CoW across a mixed range of block types with cowextsize set Darrick J. Wong
2016-02-11 23:41   ` Darrick J. Wong
2016-02-11 23:42 ` [PATCH 24/32] xfs: test the automatic cowextsize extent garbage collector Darrick J. Wong
2016-02-11 23:42   ` Darrick J. Wong
2016-02-11 23:42 ` [PATCH 25/32] xfs: test rmapbt functionality Darrick J. Wong
2016-02-11 23:42   ` Darrick J. Wong
2016-02-11 23:42 ` [PATCH 26/32] reflink: test aio copy on write Darrick J. Wong
2016-02-11 23:42   ` Darrick J. Wong
2016-02-11 23:42 ` [PATCH 27/32] xfs: aio cow tests Darrick J. Wong
2016-02-11 23:42   ` Darrick J. Wong
2016-02-11 23:42 ` [PATCH 28/32] xfs: test xfs_getbmapx behavior with shared extents Darrick J. Wong
2016-02-11 23:42   ` Darrick J. Wong
2016-02-11 23:42 ` [PATCH 29/32] reflink: test reflink+cow+enospc all at the same time Darrick J. Wong
2016-02-11 23:42   ` Darrick J. Wong
2016-02-11 23:42 ` [PATCH 30/32] xfs: ensure that we don't crash when freeing the ag reservations on a ro mount Darrick J. Wong
2016-02-11 23:42   ` Darrick J. Wong
2016-02-11 23:42 ` [PATCH 31/32] xfs: test source CoW across mixed block types with cowextsz set Darrick J. Wong
2016-02-11 23:42   ` Darrick J. Wong
2016-02-11 23:42 ` [PATCH 32/32] reflink: kick the slow tests out of the 'quick' group Darrick J. Wong
2016-02-11 23:42   ` Darrick J. Wong
2016-02-12 17:41 ` [PATCH 33/32] aiocp: fix the gcc warnings Darrick J. Wong
2016-02-12 17:41   ` Darrick J. Wong
2016-02-13  1:26 ` [PATCH v4.2 00/32] xfstests: test the nfs/cifs/btrfs/xfs reflink/dedupe ioctls Dave Chinner
2016-02-13  1:26   ` Dave Chinner
2016-02-13  4:38   ` Darrick J. Wong
2016-02-13  4:38     ` Darrick J. Wong
2016-02-13  8:03     ` Christoph Hellwig
2016-02-13  8:03       ` Christoph Hellwig

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.