On Tue, Nov 15, 2022 at 03:05:10PM +0800, Yang, Xiao/杨 晓 wrote: > On 2022/11/14 22:56, Zorro Lang wrote: > > On Mon, Nov 14, 2022 at 08:35:02AM +0000, Xiao Yang wrote: > > > It is unnecssary to always create a dm-log-writes device > > > based on the entire size of the target/underlying device. > > > > > > Signed-off-by: Xiao Yang <yangx.jy@xxxxxxxxxxx> > > > --- > > > > Darrick has given his RVB [1]: > > > > Reviewed-by: Darrick J. Wong <djwong@xxxxxxxxxx> > > > > I think you can keep it in this V2 patch. > > Hi Zorro, > > Thanks for your reminder. np, I've tested and merged this patchset, and will push this weekend. Thanks, Zorro > > As Darrick suggested, I actually added a comment to explain the blkdev and > length arguments. So I hope Darrick can review it again. > > Fortunately, Darrick has added reviewed-by on the v2 patch set. ^_^ > > Best Regards, > Xiao Yang > > > > Thanks, > > Zorro > > > > [1] > > https://lore.kernel.org/fstests/Y3EvUgtux4tP1tdY@magnolia/T/#m83b97790ba6570874f36cd0601747e1b6b155de2 > > > > > common/dmlogwrites | 18 ++++++++++++++++-- > > > 1 file changed, 16 insertions(+), 2 deletions(-) > > > > > > diff --git a/common/dmlogwrites b/common/dmlogwrites > > > index 9fa1c977..c1c85de9 100644 > > > --- a/common/dmlogwrites > > > +++ b/common/dmlogwrites > > > @@ -59,14 +59,28 @@ _require_log_writes_dax_mountopt() > > > fi > > > } > > > +# Set up a dm-log-writes device > > > +# > > > +# blkdev: the specified target device > > > +# length(optional): the mapped length in bytes > > > +# Note that the entire size of the target device will be used > > > +# if length is not specified. > > > _log_writes_init() > > > { > > > - blkdev=$1 > > > + local blkdev=$1 > > > + local length=$2 > > > + 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 "$length" ]; then > > > + BLK_DEV_SIZE=`blockdev --getsz $blkdev` > > > + else > > > + local blksz=`blockdev --getss $blkdev` > > > + BLK_DEV_SIZE=$((length / 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 > > > > > >