public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] _scratch_mkfs_geom(): Filter out 'k' suffix from fs block size
@ 2021-02-09 16:12 Chandan Babu R
  2021-02-09 16:36 ` Darrick J. Wong
  0 siblings, 1 reply; 2+ messages in thread
From: Chandan Babu R @ 2021-02-09 16:12 UTC (permalink / raw)
  To: fstests; +Cc: Chandan Babu R, linux-xfs, guan

If the original value of $MKFS_OPTIONS contained a block size value having 'k'
as a suffix (e.g. -b size=4k), then the newly constructed value of
$MKFS_OPTIONS will have 'k' suffixed to the value of $blocksize.  $blocksize
itself is specified in units of bytes. Hence having 'k' suffixed to this value
will result in an incorrect block size.

This commit fixes the bug by conditionally filtering out the 'k' suffix from
block size option present in the original value of $MKFS_OPTIONS.

Signed-off-by: Chandan Babu R <chandanrlinux@gmail.com>
---
 common/rc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/common/rc b/common/rc
index 649b1cfd..0ec7fe1a 100644
--- a/common/rc
+++ b/common/rc
@@ -1062,7 +1062,7 @@ _scratch_mkfs_geom()
     case $FSTYP in
     xfs)
 	if echo "$MKFS_OPTIONS" | egrep -q "b?size="; then
-		MKFS_OPTIONS=$(echo "$MKFS_OPTIONS" | sed -r "s/(b?size=)[0-9]+/\1$blocksize/")
+		MKFS_OPTIONS=$(echo "$MKFS_OPTIONS" | sed -r "s/(b?size=)[0-9]+k?/\1$blocksize/")
 	else
 		MKFS_OPTIONS+=" -b size=$blocksize"
 	fi
-- 
2.29.2


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

end of thread, other threads:[~2021-02-09 16:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-02-09 16:12 [PATCH] _scratch_mkfs_geom(): Filter out 'k' suffix from fs block size Chandan Babu R
2021-02-09 16:36 ` 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