public inbox for fstests@vger.kernel.org
 help / color / mirror / Atom feed
From: Zorro Lang <zlang@redhat.com>
To: Xiao Yang <yangx.jy@fujitsu.com>
Cc: djwong@kernel.org, fstests@vger.kernel.org, bfoster@redhat.com,
	y-goto@fujitsu.com
Subject: Re: [PATCH v2 1/2] common/dmlogwrites: Extend _log_writes_init() to accept the specified length
Date: Mon, 14 Nov 2022 22:56:56 +0800	[thread overview]
Message-ID: <20221114145656.cn5bnvllpwaud2px@zlang-mailbox> (raw)
In-Reply-To: <1668414903-13-1-git-send-email-yangx.jy@fujitsu.com>

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@fujitsu.com>
> ---

Darrick has given his RVB [1]:

Reviewed-by: Darrick J. Wong <djwong@kernel.org>

I think you can keep it in this V2 patch.

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
> 


  parent reply	other threads:[~2022-11-14 14:58 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-14  8:35 [PATCH v2 1/2] common/dmlogwrites: Extend _log_writes_init() to accept the specified length Xiao Yang
2022-11-14  8:35 ` [PATCH v2 2/2] generic/470: Replace thin volume with blkdiscard -z Xiao Yang
2022-11-14 19:19   ` Darrick J. Wong
2022-11-14 14:56 ` Zorro Lang [this message]
2022-11-15  7:05   ` [PATCH v2 1/2] common/dmlogwrites: Extend _log_writes_init() to accept the specified length Yang, Xiao/杨 晓
2022-11-15 10:29     ` Zorro Lang
2022-11-14 19:19 ` Darrick J. Wong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221114145656.cn5bnvllpwaud2px@zlang-mailbox \
    --to=zlang@redhat.com \
    --cc=bfoster@redhat.com \
    --cc=djwong@kernel.org \
    --cc=fstests@vger.kernel.org \
    --cc=y-goto@fujitsu.com \
    --cc=yangx.jy@fujitsu.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox