From: Bart Van Assche <bvanassche@acm.org>
To: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>,
linux-block@vger.kernel.org
Subject: Re: [PATCH blktests v2 1/2] common/null_blk: introduce _have_null_blk_feature
Date: Tue, 9 Jan 2024 12:14:53 -0800 [thread overview]
Message-ID: <89abe7cd-298b-4bd4-9a08-e183ffa7af44@acm.org> (raw)
In-Reply-To: <20240109104453.3764096-2-shinichiro.kawasaki@wdc.com>
On 1/9/24 02:44, Shin'ichiro Kawasaki wrote:
> Introduce a helper function _have_null_blk_feature which checks
> /sys/kernel/config/features. It allows test cases to adapt to null_blk
> feature support status.
>
> Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
> ---
> common/null_blk | 15 +++++++++++++++
> 1 file changed, 15 insertions(+)
>
> diff --git a/common/null_blk b/common/null_blk
> index 91b78d4..164125d 100644
> --- a/common/null_blk
> +++ b/common/null_blk
> @@ -10,6 +10,21 @@ _have_null_blk() {
> _have_driver null_blk
> }
>
> +_have_null_blk_feature() {
> + # Ensure that null_blk driver is built-in or loaded
> + if ! [[ -d /sys/module/null_blk ]]; then
> + if ! modprobe -q null_blk; then
> + return 1
> + fi
> + if [[ ! "${MODULES_TO_UNLOAD[*]}" =~ null_blk ]]; then
> + MODULES_TO_UNLOAD+=(null_blk)
> + fi
> + fi
> +
> + # Check that null_blk has the specified feature
> + grep -qe "$1" /sys/kernel/config/nullb/features
> +}
> +
> _remove_null_blk_devices() {
> if [[ -d /sys/kernel/config/nullb ]]; then
> find /sys/kernel/config/nullb -mindepth 1 -maxdepth 1 \
Shouldn't _have_null_blk_feature() unload the null_blk kernel module if it
loads that kernel module? That will allow to simplify the next patch in this
series.
Thanks,
Bart.
next prev parent reply other threads:[~2024-01-09 20:14 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-09 10:44 [PATCH blktests v2 0/2] block/031: allow to run with built-in null_blk driver Shin'ichiro Kawasaki
2024-01-09 10:44 ` [PATCH blktests v2 1/2] common/null_blk: introduce _have_null_blk_feature Shin'ichiro Kawasaki
2024-01-09 19:20 ` Chaitanya Kulkarni
2024-01-09 20:14 ` Bart Van Assche [this message]
2024-01-09 10:44 ` [PATCH blktests v2 2/2] block/031: allow to run with built-in null_blk driver Shin'ichiro Kawasaki
2024-01-09 19:34 ` Chaitanya Kulkarni
2024-01-09 20:19 ` Bart Van Assche
2024-01-10 2:19 ` Shinichiro Kawasaki
2024-01-10 17:50 ` Bart Van Assche
2024-01-11 7:34 ` Shinichiro Kawasaki
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=89abe7cd-298b-4bd4-9a08-e183ffa7af44@acm.org \
--to=bvanassche@acm.org \
--cc=linux-block@vger.kernel.org \
--cc=shinichiro.kawasaki@wdc.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