fstests.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <djwong@kernel.org>
To: "yangx.jy@fujitsu.com" <yangx.jy@fujitsu.com>
Cc: "zlang@redhat.com" <zlang@redhat.com>,
	"fstests@vger.kernel.org" <fstests@vger.kernel.org>,
	"bfoster@redhat.com" <bfoster@redhat.com>,
	"Yasunori Gotou (Fujitsu)" <y-goto@fujitsu.com>
Subject: Re: [PATCH RESEND 1/2] common/dmlogwrites: Extend _log_writes_init() to accept the specified size
Date: Sun, 13 Nov 2022 09:54:26 -0800	[thread overview]
Message-ID: <Y3EvUgtux4tP1tdY@magnolia> (raw)
In-Reply-To: <20221023064810.847110-1-yangx.jy@fujitsu.com>

On Sun, Oct 23, 2022 at 06:48:13AM +0000, yangx.jy@fujitsu.com 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@fujitsu.com>
> ---
>  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@kernel.org>

--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

      parent reply	other threads:[~2022-11-13 17:54 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-23  6:48 [PATCH RESEND 1/2] common/dmlogwrites: Extend _log_writes_init() to accept the specified size yangx.jy
2022-10-23  6:48 ` [PATCH RESEND 2/2] generic/470: Replace thin volume with blkdiscard -z yangx.jy
2022-10-24  4:09   ` Darrick J. Wong
2022-10-24  7:15     ` Yang, Xiao/杨 晓
2022-10-30  7:30       ` yangx.jy
2022-11-01  3:48         ` Darrick J. Wong
2022-11-12  5:48           ` Yang, Xiao/杨 晓
2022-11-13 17:57   ` Darrick J. Wong
2022-11-14  8:38     ` Yang, Xiao/杨 晓
2022-11-13 17:54 ` Darrick J. Wong [this message]

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=Y3EvUgtux4tP1tdY@magnolia \
    --to=djwong@kernel.org \
    --cc=bfoster@redhat.com \
    --cc=fstests@vger.kernel.org \
    --cc=y-goto@fujitsu.com \
    --cc=yangx.jy@fujitsu.com \
    --cc=zlang@redhat.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;
as well as URLs for NNTP newsgroup(s).