On 1/15/24 19:39, Shin'ichiro Kawasaki wrote: > Allow setting shared_tags through configfs, which could only be set as a > module parameter. For that purpose, delay tag_set initialization from > null_init() to null_add_dev(). Introduce the flag tag_set_initialized to > manage the initialization status of tag_set. > > The following parameters can not be set through configfs yet: > > timeout > requeue > init_hctx > > Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@xxxxxxx> > --- > This patch will allow running the blktests test cases block/010 and block/022 > using the built-in null_blk driver. Corresponding blktests side changes are > drafted here [1]. > > [1] https://github.com/kawasaki/blktests/tree/shared_tags > > drivers/block/null_blk/main.c | 38 ++++++++++++++++--------------- > drivers/block/null_blk/null_blk.h | 1 + > 2 files changed, 21 insertions(+), 18 deletions(-) > > diff --git a/drivers/block/null_blk/main.c b/drivers/block/null_blk/main.c > index 36755f263e8e..c3361e521564 100644 > --- a/drivers/block/null_blk/main.c > +++ b/drivers/block/null_blk/main.c > @@ -69,6 +69,7 @@ static LIST_HEAD(nullb_list); > static struct mutex lock; > static int null_major; > static DEFINE_IDA(nullb_indexes); > +static bool tag_set_initialized = false; explicit initializing global bool to false really needed ? unless I did something see [1]. -ck [1] nvme (nvme-6.8) # git diff drivers/block/null_blk/ diff --git a/drivers/block/null_blk/main.c b/drivers/block/null_blk/main.c index 9f7695f00c2d..12686aeaae38 100644 --- a/drivers/block/null_blk/main.c +++ b/drivers/block/null_blk/main.c @@ -68,6 +68,8 @@ struct nullb_page { static LIST_HEAD(nullb_list); static struct mutex lock; static int null_major; +static bool abcd; +static bool abcd_init = false; static DEFINE_IDA(nullb_indexes); static struct blk_mq_tag_set tag_set; @@ -2280,6 +2282,7 @@ static int __init null_init(void) unsigned int i; struct nullb *nullb; + pr_info("%s %d abcd %d abcd_init %d\n", __func__, __LINE__, abcd, abcd_init); if (g_bs > PAGE_SIZE) { pr_warn("invalid block size\n"); pr_warn("defaults block size to %lu\n", PAGE_SIZE); nvme (nvme-6.8) # makej M=drivers/block/ clean CLEAN drivers/block/Module.symvers nvme (nvme-6.8) # makej M=drivers/block/ CC [M] drivers/block/floppy.o CC [M] drivers/block/brd.o CC [M] drivers/block/loop.o CC [M] drivers/block/nbd.o CC [M] drivers/block/virtio_blk.o CC [M] drivers/block/xen-blkback/blkback.o CC [M] drivers/block/xen-blkfront.o CC [M] drivers/block/rbd.o CC [M] drivers/block/xen-blkback/xenbus.o CC [M] drivers/block/zram/zcomp.o CC [M] drivers/block/mtip32xx/mtip32xx.o CC [M] drivers/block/drbd/drbd_bitmap.o CC [M] drivers/block/drbd/drbd_buildtag.o CC [M] drivers/block/zram/zram_drv.o CC [M] drivers/block/drbd/drbd_proc.o CC [M] drivers/block/drbd/drbd_worker.o CC [M] drivers/block/drbd/drbd_receiver.o CC [M] drivers/block/null_blk/main.o CC [M] drivers/block/drbd/drbd_req.o CC [M] drivers/block/null_blk/trace.o CC [M] drivers/block/drbd/drbd_actlog.o CC [M] drivers/block/drbd/drbd_main.o CC [M] drivers/block/null_blk/zoned.o CC [M] drivers/block/drbd/drbd_strings.o CC [M] drivers/block/drbd/drbd_nl.o CC [M] drivers/block/drbd/drbd_interval.o CC [M] drivers/block/drbd/drbd_state.o CC [M] drivers/block/drbd/drbd_nla.o CC [M] drivers/block/drbd/drbd_debugfs.o LD [M] drivers/block/zram/zram.o LD [M] drivers/block/xen-blkback/xen-blkback.o LD [M] drivers/block/null_blk/null_blk.o LD [M] drivers/block/drbd/drbd.o MODPOST drivers/block/Module.symvers CC [M] drivers/block/floppy.mod.o CC [M] drivers/block/brd.mod.o CC [M] drivers/block/loop.mod.o CC [M] drivers/block/nbd.mod.o CC [M] drivers/block/virtio_blk.mod.o CC [M] drivers/block/xen-blkfront.mod.o CC [M] drivers/block/xen-blkback/xen-blkback.mod.o CC [M] drivers/block/drbd/drbd.mod.o CC [M] drivers/block/rbd.mod.o CC [M] drivers/block/mtip32xx/mtip32xx.mod.o CC [M] drivers/block/zram/zram.mod.o CC [M] drivers/block/null_blk/null_blk.mod.o LD [M] drivers/block/brd.ko LD [M] drivers/block/xen-blkback/xen-blkback.ko LD [M] drivers/block/drbd/drbd.ko LD [M] drivers/block/loop.ko LD [M] drivers/block/floppy.ko LD [M] drivers/block/virtio_blk.ko LD [M] drivers/block/null_blk/null_blk.ko LD [M] drivers/block/rbd.ko LD [M] drivers/block/mtip32xx/mtip32xx.ko LD [M] drivers/block/zram/zram.ko LD [M] drivers/block/nbd.ko LD [M] drivers/block/xen-blkfront.ko nvme (nvme-6.8) # insmod drivers/block/null_blk/null_blk.ko nvme (nvme-6.8) # dmesg -c [23228.355423] null_blk: null_init 2285 abcd 0 abcd_init 0 [23228.357571] null_blk: disk nullb0 created [23228.357574] null_blk: module loaded nvme (nvme-6.8) #