On Wed, Aug 23, 2017 at 6:49 PM, Amir Goldstein <amir73il@xxxxxxxxx> wrote: > Cherry-picked the relevant common bits from commit 70d41e17164b > in Josef Bacik's fstests tree (https://github.com/josefbacik/fstests). > Quoting from Josef's commit message: > > This patch adds the supporting code for using the dm-log-writes > target. The dmlogwrites code is similar to the dmflakey code, it just > gives us functions to build and tear down a dm-log-writes target. We > add a new LOGWRITES_DEV variable to take in the device we will use as > the log and add checks for that. > > [Amir:] > - Removed unneeded _test_falloc_support > - Moved _require_log_writes to dmlogwrites > - Document _require_log_writes > > Cc: Josef Bacik <jbacik@xxxxxx> > Signed-off-by: Amir Goldstein <amir73il@xxxxxxxxx> > --- > README | 2 ++ > common/dmlogwrites | 86 ++++++++++++++++++++++++++++++++++++++++++++ > doc/requirement-checking.txt | 20 +++++++++++ > 3 files changed, 108 insertions(+) > create mode 100644 common/dmlogwrites > ... > + > +_init_log_writes() > +{ > + local BLK_DEV_SIZE=`blockdev --getsz $SCRATCH_DEV` > + LOGWRITES_NAME=logwrites-test > + LOGWRITES_DMDEV=/dev/mapper/$LOGWRITES_NAME > + LOGWRITES_TABLE="0 $BLK_DEV_SIZE log-writes $SCRATCH_DEV $LOGWRITES_DEV" > + $DMSETUP_PROG create $LOGWRITES_NAME --table "$LOGWRITES_TABLE" || \ > + _fatal "failed to create log-writes device" > + $DMSETUP_PROG mknodes > /dev/null 2>&1 > +} > + ... > +_cleanup_log_writes() > +{ > + # If dmsetup load fails then we need to make sure to do resume here > + # otherwise the umount will hang Josef, Care to explain this comment? What do you mean by "resume" here? is this a real concern? > + $UMOUNT_PROG $SCRATCH_MNT > /dev/null 2>&1 > + _log_writes_remove > +}