On Sun, Oct 13, 2019 at 08:11:37PM +0800, Eryu Guan wrote: > On Fri, Oct 11, 2019 at 02:41:20PM -0700, Darrick J. Wong wrote: > > From: Darrick J. Wong <darrick.wong@xxxxxxxxxx> > > > > Add a test to make sure that we can handle multiple memory mappings to a > > physical storage extent shared by multiple files, and that we can handle > > the copy on write operation without error. Make sure we can also handle > > mappings at different offsets in the page cache. > > > > Signed-off-by: Darrick J. Wong <darrick.wong@xxxxxxxxxx> > > --- > > v2: test at different offsets > > --- > > src/Makefile | 2 - > > src/mmap-write-concurrent.c | 155 +++++++++++++++++++++++++++++++++++++++++++ > > I added an entry in .gitignore file. Thanks! <snip> > > + > > +# real QA test starts here > > +_supported_os Linux > > +_supported_fs generic > > +_require_command "$FILEFRAG_PROG" filefrag > > Also added > > _require_test_program "mmap-write-concurrent" > > > +echo "mwrite all copies" | tee -a $seqres.full > > +off=$(( (filesz / 2) - 168 )) > > +len=337 > > +./src/mmap-write-concurrent $len \ > > And used "$here/src/mmap-write-concurrent .." here. Old habits die hard, I guess. :( Thanks for fixing those up on commit... --D > Thanks, > Eryu > > > + $off $testdir/file1 \ > > + $off $testdir/file2 \ > > + $off $testdir/file3 \ > > + $off $testdir/file4 \ > > + $((off + blksz)) $testdir/file5 \ > > + $((off + (blksz * 2))) $testdir/file6 \ > > + $((off + (blksz * 3))) $testdir/file7 \ > > + $((off + (blksz * 4))) $testdir/file8 \ > > + 168 $testdir/file1 \ > > + $((blksz - 168)) $testdir/file2 \ > > + $((filesz - 777)) $testdir/file3 \ > > + $(((blksz * 3) - 168)) $testdir/file4 \ > > + > > + > > +echo "Compare files before remount" | tee -a $seqres.full > > +compare > > +_test_cycle_mount > > + > > +echo "Compare files after remount" | tee -a $seqres.full > > +compare > > + > > +echo "Check for non-shared extents" | tee -a $seqres.full > > +$FILEFRAG_PROG -v $testdir/file1 $testdir/file2 $testdir/file3 $testdir/file4 \ > > + $testdir/file5 $testdir/file6 $testdir/file7 $testdir/file8 \ > > + | grep '^[[:space:]]*[0-9]*:' > $testdir/fiemap > > +cat $testdir/fiemap >> $seqres.full > > +grep -q 'shared' $testdir/fiemap || \ > > + echo "Expected to find shared extents" > > + > > +grep -q -v 'shared' $testdir/fiemap || \ > > + echo "Expected to find non-shared extents" > > + > > +# success, all done > > +status=0 > > +exit > > diff --git a/tests/generic/945.out b/tests/generic/945.out > > new file mode 100644 > > index 00000000..ad1e21ff > > --- /dev/null > > +++ b/tests/generic/945.out > > @@ -0,0 +1,31 @@ > > +QA output created by 945 > > +Create the original files > > +Compare files before cow > > +c946b71bb69c07daf25470742c967e7c TEST_DIR/test-945/file1 > > +c946b71bb69c07daf25470742c967e7c TEST_DIR/test-945/file2 > > +c946b71bb69c07daf25470742c967e7c TEST_DIR/test-945/file3 > > +c946b71bb69c07daf25470742c967e7c TEST_DIR/test-945/file4 > > +74e6b9b1a03fdf09293c089b002800f8 TEST_DIR/test-945/file5 > > +c14f20b97155e3fc11a17532d02ad9df TEST_DIR/test-945/file6 > > +22eb46e0f4a3742c8d86346845b7bc80 TEST_DIR/test-945/file7 > > +4d292f06cec9d3f1bece4822cd5ef532 TEST_DIR/test-945/file8 > > +mwrite all copies > > +Compare files before remount > > +c1b46135a2620ae6da21bbfd4cbb3cba TEST_DIR/test-945/file1 > > +16f0bc0f97c42d2ad903c519095b8126 TEST_DIR/test-945/file2 > > +eb71e3135ca2abf33bb9081e2b49a876 TEST_DIR/test-945/file3 > > +2678dfcb77bed4dc29e19836bef82e5b TEST_DIR/test-945/file4 > > +2802d75dbee4f29d62124aa7b473edca TEST_DIR/test-945/file5 > > +acd58cf3d33ef905e26800a0e049223c TEST_DIR/test-945/file6 > > +1b68d203e5a1c1b45a9510bedcd1e126 TEST_DIR/test-945/file7 > > +9479709b697ced2e3a57c17bc1b97373 TEST_DIR/test-945/file8 > > +Compare files after remount > > +c1b46135a2620ae6da21bbfd4cbb3cba TEST_DIR/test-945/file1 > > +16f0bc0f97c42d2ad903c519095b8126 TEST_DIR/test-945/file2 > > +eb71e3135ca2abf33bb9081e2b49a876 TEST_DIR/test-945/file3 > > +2678dfcb77bed4dc29e19836bef82e5b TEST_DIR/test-945/file4 > > +2802d75dbee4f29d62124aa7b473edca TEST_DIR/test-945/file5 > > +acd58cf3d33ef905e26800a0e049223c TEST_DIR/test-945/file6 > > +1b68d203e5a1c1b45a9510bedcd1e126 TEST_DIR/test-945/file7 > > +9479709b697ced2e3a57c17bc1b97373 TEST_DIR/test-945/file8 > > +Check for non-shared extents > > diff --git a/tests/generic/group b/tests/generic/group > > index 4584667f..f77c5b21 100644 > > --- a/tests/generic/group > > +++ b/tests/generic/group > > @@ -576,3 +576,4 @@ > > 715 dangerous_norepair > > 716 dangerous_norepair > > 720 dangerous_norepair > > +945 auto quick rw clone