fstests.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH RESEND 1/2] common/dmlogwrites: Extend _log_writes_init() to accept the specified size
@ 2022-10-23  6:48 yangx.jy
  2022-10-23  6:48 ` [PATCH RESEND 2/2] generic/470: Replace thin volume with blkdiscard -z yangx.jy
  2022-11-13 17:54 ` [PATCH RESEND 1/2] common/dmlogwrites: Extend _log_writes_init() to accept the specified size Darrick J. Wong
  0 siblings, 2 replies; 10+ messages in thread
From: yangx.jy @ 2022-10-23  6:48 UTC (permalink / raw)
  To: djwong, zlang; +Cc: fstests, bfoster, Yasunori Gotou (Fujitsu), yangx.jy

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

^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2022-11-14  8:38 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 ` [PATCH RESEND 1/2] common/dmlogwrites: Extend _log_writes_init() to accept the specified size Darrick J. Wong

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