From: Christoph Hellwig <hch@lst.de>
To: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Cc: linux-block@vger.kernel.org
Subject: [PATCH blktests 02/13] common/null_blk: allow _configure_null_blk with built-in null_blk
Date: Tue, 7 Jun 2022 14:47:28 +0200 [thread overview]
Message-ID: <20220607124739.1259977-3-hch@lst.de> (raw)
In-Reply-To: <20220607124739.1259977-1-hch@lst.de>
Test that do use _configure_null_blk already configure do not actually
require a built-in null_blk driver. Relax the check in _have_null_blk
to just require a driver instead of a module, and instead set a skip
reason instead of failing in _init_null_blk when null_blk is built-in
or otherwise not available.
Also try to load the null_blk module in _configure_null_blk as
_init_null_blk is optional now and we thus can't rely on the module
to be loaded.
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
common/null_blk | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/common/null_blk b/common/null_blk
index 6611db0..30d54c2 100644
--- a/common/null_blk
+++ b/common/null_blk
@@ -4,8 +4,10 @@
#
# null_blk helper functions.
+. common/shellcheck
+
_have_null_blk() {
- _have_modules null_blk
+ _have_driver null_blk
}
_remove_null_blk_devices() {
@@ -22,6 +24,7 @@ _init_null_blk() {
if (( RUN_FOR_ZONED )); then zoned="zoned=1"; fi
if ! modprobe -r null_blk || ! modprobe null_blk "$@" "${zoned}" ; then
+ SKIP_REASON="requires modular null_blk"
return 1
fi
@@ -32,8 +35,12 @@ _init_null_blk() {
# Configure one null_blk instance with name $1 and parameters $2..${$#}.
_configure_null_blk() {
local nullb=/sys/kernel/config/nullb/$1 param val
-
shift
+
+ if [[ ! -d /sys/module/null_blk ]]; then
+ modprobe -q null_blk
+ fi
+
mkdir "$nullb" || return $?
while [[ $# -gt 0 ]]; do
param="${1%%=*}"
@@ -46,5 +53,5 @@ _configure_null_blk() {
_exit_null_blk() {
_remove_null_blk_devices
udevadm settle
- modprobe -r null_blk
+ modprobe -r -q null_blk
}
--
2.30.2
next prev parent reply other threads:[~2022-06-07 12:47 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-07 12:47 allow to run most tests with built-in null_blk v2 Christoph Hellwig
2022-06-07 12:47 ` [PATCH blktests 01/13] common/null_blk: remove explicit queue_mode=2 parameters Christoph Hellwig
2022-06-07 12:47 ` Christoph Hellwig [this message]
2022-06-07 12:47 ` [PATCH blktests 03/13] common/null_blk: respect RUN_FOR_ZONED in _configure_null_blk Christoph Hellwig
2022-06-07 12:47 ` [PATCH blktests 04/13] block/029: don't require modular null_blk Christoph Hellwig
2022-06-07 12:47 ` [PATCH blktests 05/13] block/006: convert to use _configure_null_blk Christoph Hellwig
2022-06-07 12:47 ` [PATCH blktests 06/13] block/016: " Christoph Hellwig
2022-06-07 12:47 ` [PATCH blktests 07/13] block/017: " Christoph Hellwig
2022-06-07 12:47 ` [PATCH blktests 08/13] block/018: " Christoph Hellwig
2022-06-07 12:47 ` [PATCH blktests 09/13] block/020: " Christoph Hellwig
2022-06-07 12:47 ` [PATCH blktests 10/13] block/021: " Christoph Hellwig
2022-06-07 12:47 ` [PATCH blktests 11/13] block/023: " Christoph Hellwig
2022-06-07 12:47 ` [PATCH blktests 12/13] block/024: " Christoph Hellwig
2022-06-07 12:47 ` [PATCH blktests 13/13] zbd: allow falling back to built-in null_blk Christoph Hellwig
2022-06-08 10:15 ` allow to run most tests with built-in null_blk v2 Shinichiro Kawasaki
-- strict thread matches above, loose matches on Subject: below --
2022-06-03 4:55 allow to run most tests with built-in null_blk Christoph Hellwig
2022-06-03 4:55 ` [PATCH blktests 02/13] common/null_blk: allow _configure_null_blk " Christoph Hellwig
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=20220607124739.1259977-3-hch@lst.de \
--to=hch@lst.de \
--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