On 5/23/13 10:09 PM, Eryu Guan wrote: > On Thu, May 23, 2013 at 11:36:32AM -0500, Eric Sandeen wrote: >> From: Koen De Wit <koen.de.wit@xxxxxxxxxx> >> >> # Tests file clone functionality of btrfs ("reflinks"): >> # - Reflink a file >> # - Reflink the reflinked file >> # - Modify the original file >> # - Modify the reflinked file >> >> [sandeen: add helpers, make several mostly-cosmetic >> changes to the original testcase] >> >> Signed-off-by: Koen De Wit <koen.de.wit@xxxxxxxxxx> >> Signed-off-by: Eric Sandeen <sandeen@xxxxxxxxxx> >> --- >> >> Originally submitted as test 297 >> >> diff --git a/common/rc b/common/rc >> index fe6bbfc..4560715 100644 >> --- a/common/rc >> +++ b/common/rc >> @@ -2098,6 +2098,27 @@ _require_dumpe2fs() >> fi >> } >> >> +_require_cp_reflink() >> +{ >> + cp --help | grep -q reflink || \ >> + _notrun "This test requires a cp with --reflink support." >> +} >> + >> +# Given 2 files, verify that they have the same mapping but different >> +# inodes - i.e. an undisturbed reflink >> +# Silent if so, make noise if not >> +_verify_reflink() >> +{ >> + # not a hard link or symlink? >> + cmp -s <(stat -c '%i' $1) <(stat -c '%i' $2) \ >> + && echo "$1 and $2 are not reflinks: same inode number" >> + >> + # same mapping? >> + diff -u <($XFS_IO_PROG -F -c "fiemap" $1 | grep -v $1) \ >> + <($XFS_IO_PROG -F -c "fiemap" $2 | grep -v $2) \ >> + || echo "$1 and $2 are not reflinks: different extents" > > I'm not sure if "-F" is still needed after commit > 96fce07 xfstests: automatically add -F to xfs_io on non-xfs Right, it's not, oops. :( Old habits (and old patch, TBH) I can fix & resend all of them I guess. Thanks, -Eric _______________________________________________ xfs mailing list xfs@xxxxxxxxxxx http://oss.sgi.com/mailman/listinfo/xfs