All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chandan Babu R <chandanrlinux@gmail.com>
To: fstests@vger.kernel.org
Cc: Chandan Babu R <chandanrlinux@gmail.com>,
	linux-xfs@vger.kernel.org, guan@eryu.me
Subject: [PATCH] _scratch_mkfs_geom(): Filter out 'k' suffix from fs block size
Date: Tue,  9 Feb 2021 21:42:52 +0530	[thread overview]
Message-ID: <20210209161252.17901-1-chandanrlinux@gmail.com> (raw)

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


             reply	other threads:[~2021-02-09 16:13 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-09 16:12 Chandan Babu R [this message]
2021-02-09 16:36 ` [PATCH] _scratch_mkfs_geom(): Filter out 'k' suffix from fs block size 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=20210209161252.17901-1-chandanrlinux@gmail.com \
    --to=chandanrlinux@gmail.com \
    --cc=fstests@vger.kernel.org \
    --cc=guan@eryu.me \
    --cc=linux-xfs@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.