On Sun, Oct 23, 2022 at 06:48:13AM +0000, yangx.jy@xxxxxxxxxxx wrote: > It is unnecssary to always create a log-writes device based on > the size of the entire underlying device. > > Signed-off-by: Xiao Yang <yangx.jy@xxxxxxxxxxx> > --- > common/dmlogwrites | 12 ++++++++++-- > 1 file changed, 10 insertions(+), 2 deletions(-) > > diff --git a/common/dmlogwrites b/common/dmlogwrites > index 9fa1c977..d7b23cec 100644 > --- a/common/dmlogwrites > +++ b/common/dmlogwrites > @@ -61,12 +61,20 @@ _require_log_writes_dax_mountopt() > > _log_writes_init() > { > - blkdev=$1 > + local blkdev=$1 > + local range=$2 Range is a length in ... bytes? The unit ought to be recorded in a comment for this function. With that fixed, this looks ok to me Reviewed-by: Darrick J. Wong <djwong@xxxxxxxxxx> --D > + local BLK_DEV_SIZE > > [ -z "$blkdev" ] && _fail \ > "block dev must be specified for _log_writes_init" > > - local BLK_DEV_SIZE=`blockdev --getsz $blkdev` > + if [ -z "$range" ]; then > + BLK_DEV_SIZE=`blockdev --getsz $blkdev` > + else > + local blksz=`blockdev --getss $blkdev` > + BLK_DEV_SIZE=$((range / blksz)) > + fi > + > LOGWRITES_NAME=logwrites-test > LOGWRITES_DMDEV=/dev/mapper/$LOGWRITES_NAME > LOGWRITES_TABLE="0 $BLK_DEV_SIZE log-writes $blkdev $LOGWRITES_DEV" > -- > 2.34.1