From: Anand Jain <anand.jain@oracle.com>
To: fstests@vger.kernel.org
Cc: linux-btrfs@vger.kernel.org
Subject: [PATCH RFC] fstests: add configuration option for executing post mkfs commands
Date: Thu, 27 Jul 2023 17:04:29 +0800 [thread overview]
Message-ID: <9c6d36835c04f18a59005a8994ba128970bac20a.1690446808.git.anand.jain@oracle.com> (raw)
This patch introduces a new configuration file parameter, POST_MKFS_CMD,
which, when set, will run immediately it after the mkfs command for the
FSTYP btrfs.
For example:
POST_MKFS_CMD="btrfstune -m"
Currently, only btrfstune's '-m' option is tested. However, there may be
more btrfstune options, so having this parameter as a config makes sense.
Additionally, there can be other commands besides btrfstune.
The mkfs helper functions in common/rc sends the SCRATCH_DEV as an argument
to the set POST_MKFS_CMD, which may not be compatible with other commands.
However, as of now, since those usecases are still unknown, we can modify
it later. For now, I'm marking this as RFC, I'm open to feedback if any.
Signed-off-by: Anand Jain <anand.jain@oracle.com>
---
common/rc | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/common/rc b/common/rc
index 5c4429ed0425..3e3c84259f38 100644
--- a/common/rc
+++ b/common/rc
@@ -667,6 +667,9 @@ _mkfs_dev()
exit 1
fi
rm -f $tmp.mkfserr $tmp.mkfsstd
+ if [[ -v POST_MKFS_CMD ]]; then
+ $POST_MKFS_CMD $(echo $* | $AWK_PROG '{print $1}')
+ fi
}
# remove all files in $SCRATCH_MNT, useful when testing on NFS/AFS/CIFS
@@ -757,6 +760,9 @@ _scratch_mkfs()
esac
_scratch_do_mkfs "$mkfs_cmd" "$mkfs_filter" $*
+ if [[ -v POST_MKFS_CMD ]]; then
+ $POST_MKFS_CMD $SCRATCH_DEV
+ fi
return $?
}
@@ -878,7 +884,11 @@ _scratch_pool_mkfs()
{
case $FSTYP in
btrfs)
- $MKFS_BTRFS_PROG $MKFS_OPTIONS $* $SCRATCH_DEV_POOL > /dev/null
+ $MKFS_BTRFS_PROG $MKFS_OPTIONS $* $SCRATCH_DEV_POOL
+ if [[ -v POST_MKFS_CMD ]]; then
+ $POST_MKFS_CMD $(echo $SCRATCH_DEV_POOL |\
+ $AWK_PROG '{print $1}')
+ fi
;;
*)
echo "_scratch_pool_mkfs is not implemented for $FSTYP" 1>&2
--
2.39.3
WARNING: multiple messages have this Message-ID (diff)
From: Anand Jain <anand.jain@oracle.com>
To: fstests@vger.kernel.org
Cc: linux-btrfs@vger.kernel.org, zlang@redhat.com
Subject: [PATCH v1] fstests: add configuration option for executing post mkfs commands
Date: Thu, 14 Sep 2023 23:07:43 +0800 [thread overview]
Message-ID: <9c6d36835c04f18a59005a8994ba128970bac20a.1690446808.git.anand.jain@oracle.com> (raw)
Message-ID: <20230914150743.Wfk9rxTQni99ffkS8wmBnHgFjzwKi6BnC4zJCaeNDnQ@z> (raw)
This patch introduces a new configuration file parameter, POST_MKFS_CMD,
which, when set, will run immediately it after the mkfs command for the
FSTYP btrfs.
For example:
POST_MKFS_CMD="btrfstune -m"
Currently, only btrfstune's '-m' option is tested. However, there may be
more btrfstune options, so having this parameter as a config makes sense.
Additionally, there can be other commands besides btrfstune.
The mkfs helper functions in common/rc passes the SCRATCH_DEV as an argument
to the set POST_MKFS_CMD, which may not be compatible with other configurable
commands in the future. However, as of now, since those usecases are still
unknown, we can modify it later.
Signed-off-by: Anand Jain <anand.jain@oracle.com>
---
RFC -> v1:
No code changes, only commit log updated.
This feature has been a great help in spotting new bugs, and it's set to
be really handy for testing the upcoming feature. So, I'd like to bump it
up to v1. I'm open to feedback if any. Thanks
common/rc | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/common/rc b/common/rc
index 5c4429ed0425..3e3c84259f38 100644
--- a/common/rc
+++ b/common/rc
@@ -667,6 +667,9 @@ _mkfs_dev()
exit 1
fi
rm -f $tmp.mkfserr $tmp.mkfsstd
+ if [[ -v POST_MKFS_CMD ]]; then
+ $POST_MKFS_CMD $(echo $* | $AWK_PROG '{print $1}')
+ fi
}
# remove all files in $SCRATCH_MNT, useful when testing on NFS/AFS/CIFS
@@ -757,6 +760,9 @@ _scratch_mkfs()
esac
_scratch_do_mkfs "$mkfs_cmd" "$mkfs_filter" $*
+ if [[ -v POST_MKFS_CMD ]]; then
+ $POST_MKFS_CMD $SCRATCH_DEV
+ fi
return $?
}
@@ -878,7 +884,11 @@ _scratch_pool_mkfs()
{
case $FSTYP in
btrfs)
- $MKFS_BTRFS_PROG $MKFS_OPTIONS $* $SCRATCH_DEV_POOL > /dev/null
+ $MKFS_BTRFS_PROG $MKFS_OPTIONS $* $SCRATCH_DEV_POOL
+ if [[ -v POST_MKFS_CMD ]]; then
+ $POST_MKFS_CMD $(echo $SCRATCH_DEV_POOL |\
+ $AWK_PROG '{print $1}')
+ fi
;;
*)
echo "_scratch_pool_mkfs is not implemented for $FSTYP" 1>&2
--
2.39.3
next reply other threads:[~2023-07-27 9:14 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-27 9:04 Anand Jain [this message]
2023-09-14 15:07 ` [PATCH v1] fstests: add configuration option for executing post mkfs commands Anand Jain
2023-09-15 1:59 ` Dave Chinner
2023-09-17 11:58 ` Anand Jain
2023-09-18 1:18 ` Dave Chinner
2023-09-28 5:19 ` Anand Jain
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=9c6d36835c04f18a59005a8994ba128970bac20a.1690446808.git.anand.jain@oracle.com \
--to=anand.jain@oracle.com \
--cc=fstests@vger.kernel.org \
--cc=linux-btrfs@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 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).