Linux-Block Archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/5] block/drivers: don't clear the flag that is not set
@ 2023-04-24  7:30 Chaitanya Kulkarni
  2023-04-24  7:30 ` [PATCH 1/5] null_blk: " Chaitanya Kulkarni
                   ` (6 more replies)
  0 siblings, 7 replies; 11+ messages in thread
From: Chaitanya Kulkarni @ 2023-04-24  7:30 UTC (permalink / raw
  To: linux-block, linux-bcache
  Cc: axboe, josef, minchan, senozhatsky, colyli, kent.overstreet,
	dlemoal, kch, johannes.thumshirn, bvanassche, vincent.fu,
	akinobu.mita, shinichiro.kawasaki, nbd

Hi,

The drivers in this patch-series tries to clear the
QUEUE_FLAG_ADD_RANDOM that is not set at all in the queue allocation
and initialization path in :-

drivers/block/mtip32xx/mtip32xx.c:	blk_queue_flag_clear(QUEUE_FLAG_ADD_RANDOM, dd->queue);
drivers/block/null_blk/main.c:	blk_queue_flag_clear(QUEUE_FLAG_ADD_RANDOM, nullb->q);
drivers/block/rbd.c:	/* QUEUE_FLAG_ADD_RANDOM is off by default for blk-mq */
drivers/block/zram/zram_drv.c:	blk_queue_flag_clear(QUEUE_FLAG_ADD_RANDOM, zram->disk->queue);
drivers/block/nbd.c:	blk_queue_flag_clear(QUEUE_FLAG_ADD_RANDOM, disk->queue);
drivers/block/brd.c:	blk_queue_flag_clear(QUEUE_FLAG_ADD_RANDOM, disk->queue);
drivers/md/bcache/super.c:	blk_queue_flag_clear(QUEUE_FLAG_ADD_RANDOM, d->disk->queue);
drivers/md/dm-table.c:	 * Clear QUEUE_FLAG_ADD_RANDOM if any underlying device does not
drivers/md/dm-table.c:		blk_queue_flag_clear(QUEUE_FLAG_ADD_RANDOM, q);
drivers/mmc/core/queue.c:	blk_queue_flag_clear(QUEUE_FLAG_ADD_RANDOM, mq->queue);
drivers/mtd/mtd_blkdevs.c:	blk_queue_flag_clear(QUEUE_FLAG_ADD_RANDOM, new->rq);
drivers/s390/block/scm_blk.c:	blk_queue_flag_clear(QUEUE_FLAG_ADD_RANDOM, rq);
drivers/scsi/sd.c:		blk_queue_flag_clear(QUEUE_FLAG_ADD_RANDOM, q);
drivers/scsi/sd.c:		blk_queue_flag_set(QUEUE_FLAG_ADD_RANDOM, q);
include/linux/blkdev.h:#define QUEUE_FLAG_ADD_RANDOM	10	/* Contributes to random pool */
include/linux/blkdev.h:#define blk_queue_add_random(q)	test_bit(QUEUE_FLAG_ADD_RANDOM, &(q)->queue_flags)

Since sd is the only driver that sets this flag:-

drivers/scsi/sd.c: blk_queue_flag_clear(QUEUE_FLAG_ADD_RANDOM, q);
drivers/scsi/sd.c: blk_queue_flag_set(QUEUE_FLAG_ADD_RANDOM, q);

it is unclear how it will be set for null_blk, brd. nbd, zram, and
bcache in the allocation path so we have to clear it explicitly.

Remove the call to clear QUEUE_FLAG_ADD_RANDOM. Below is testlog for :-

null_blk
brd
nbd
zram
bcache

Below is the test log.

-ck

Chaitanya Kulkarni (5):
  null_blk: don't clear the flag that is not set
  brd: don't clear the flag that is not set
  nbd: don't clear the flag that is not set
  zram: don't clear the flag that is not set
  bcache: don't clear the flag that is not set

 drivers/block/brd.c           | 1 -
 drivers/block/nbd.c           | 1 -
 drivers/block/null_blk/main.c | 1 -
 drivers/block/zram/zram_drv.c | 1 -
 drivers/md/bcache/super.c     | 1 -
 5 files changed, 5 deletions(-)


* NULL_BLK:-
-----------------------------------------------------------------------

With this debug patch :-
@@ -2128,7 +2128,11 @@ static int null_add_dev(struct nullb_device *dev)
 
 	nullb->q->queuedata = nullb;
 	blk_queue_flag_set(QUEUE_FLAG_NONROT, nullb->q);
+	pr_info("%s %d BEFORE ADD RANDOM = %s\n", __func__, __LINE__,
+			blk_queue_add_random(nullb->q) ? "TRUE" : "FALSE" );
 	blk_queue_flag_clear(QUEUE_FLAG_ADD_RANDOM, nullb->q);
+	pr_info("%s %d AFTER ADD RANDOM = %s\n", __func__, __LINE__,
+			blk_queue_add_random(nullb->q) ? "TRUE" : "FALSE" );
 
 	mutex_lock(&lock);
 	rv = ida_simple_get(&nullb_indexes, 0, 0, GFP_KERNEL);

+ modprobe -r null_blk
+ lsmod
+ grep null_blk
++ nproc
+ make -j 48 M=drivers/block modules
+ HOST=drivers/block/null_blk/
++ uname -r
+ HOST_DEST=/lib/modules/6.3.0-rc7lblk+/kernel/drivers/block/null_blk/
+ cp drivers/block/null_blk//null_blk.ko /lib/modules/6.3.0-rc7lblk+/kernel/drivers/block/null_blk//
+ ls -lrth /lib/modules/6.3.0-rc7lblk+/kernel/drivers/block/null_blk//null_blk.ko
-rw-r--r--. 2 root root 1.2M Apr 23 13:00 /lib/modules/6.3.0-rc7lblk+/kernel/drivers/block/null_blk//null_blk.ko
+ sleep 1
+ dmesg -c
+ modprobe null_blk queue_mode=0
+ dmesg -c
[33316.880281] null_blk: null_add_dev 2147 BEFORE ADD RANDOM = FALSE
[33316.880288] null_blk: null_add_dev 2150 AFTER ADD RANDOM = FALSE
[33316.880705] null_blk: disk nullb0 created
[33316.880707] null_blk: module loaded
+ modprobe -r null_blk
+ modprobe null_blk queue_mode=2
+ dmesg -c
[33316.920977] null_blk: null_add_dev 2147 BEFORE ADD RANDOM = FALSE
[33316.920981] null_blk: null_add_dev 2150 AFTER ADD RANDOM = FALSE
[33316.922640] null_blk: disk nullb0 created
[33316.922643] null_blk: module loaded
+ modprobe -r null_blk

+ modprobe -r null_blk
+ lsmod
+ grep null_blk
++ nproc
+ make -j 48 M=drivers/block modules
+ HOST=drivers/block/null_blk/
++ uname -r
+ HOST_DEST=/lib/modules/6.3.0-rc7lblk+/kernel/drivers/block/null_blk/
+ cp drivers/block/null_blk//null_blk.ko /lib/modules/6.3.0-rc7lblk+/kernel/drivers/block/null_blk//
+ ls -lrth /lib/modules/6.3.0-rc7lblk+/kernel/drivers/block/null_blk//null_blk.ko
-rw-r--r--. 2 root root 1.2M Apr 23 13:00 /lib/modules/6.3.0-rc7lblk+/kernel/drivers/block/null_blk//null_blk.ko
+ sleep 1
+ dmesg -c
+ modprobe null_blk queue_mode=0
+ dmesg -c
[33316.880281] null_blk: null_add_dev 2147 BEFORE ADD RANDOM = FALSE
[33316.880288] null_blk: null_add_dev 2150 AFTER ADD RANDOM = FALSE
[33316.880705] null_blk: disk nullb0 created
[33316.880707] null_blk: module loaded
+ modprobe -r null_blk
+ modprobe null_blk queue_mode=2
+ dmesg -c
[33316.920977] null_blk: null_add_dev 2147 BEFORE ADD RANDOM = FALSE
[33316.920981] null_blk: null_add_dev 2150 AFTER ADD RANDOM = FALSE
[33316.922640] null_blk: disk nullb0 created
[33316.922643] null_blk: module loaded
+ modprobe -r null_blk


* BRD:-
-----------------------------------------------------------------------

With this debug patch :-
@@ -404,7 +404,11 @@ static int brd_alloc(int i)
 	/* Tell the block layer that this is not a rotational device */
 	blk_queue_flag_set(QUEUE_FLAG_NONROT, disk->queue);
 	blk_queue_flag_set(QUEUE_FLAG_SYNCHRONOUS, disk->queue);
+	pr_info("%s %d BEFORE ADD RANDOM = %s\n", __func__, __LINE__,
+			blk_queue_add_random(disk->queue) ? "TRUE" : "FALSE" );
 	blk_queue_flag_clear(QUEUE_FLAG_ADD_RANDOM, disk->queue);
+	pr_info("%s %d AFTER ADD RANDOM = %s\n", __func__, __LINE__,
+			blk_queue_add_random(disk->queue) ? "TRUE" : "FALSE" );
 	blk_queue_flag_set(QUEUE_FLAG_NOWAIT, disk->queue);
 	err = add_disk(disk);
 	if (err)

+ modprobe -r brd
+ lsmod
+ grep brd
++ nproc
+ make -j 48 M=drivers/block modules
+ HOST=drivers/block/brd.ko
++ uname -r
+ HOST_DEST=/lib/modules/6.3.0-rc7lblk+/kernel/drivers/block/
+ cp drivers/block/brd.ko /lib/modules/6.3.0-rc7lblk+/kernel/drivers/block//
+ ls -lrth /lib/modules/6.3.0-rc7lblk+/kernel/drivers/block//brd.ko
-rw-r--r--. 1 root root 381K Apr 23 14:09 /lib/modules/6.3.0-rc7lblk+/kernel/drivers/block//brd.ko
+ dmesg -c
+ lsmod
+ grep brd
+ modprobe brd
+ dmesg -c
[ 3785.884916] brd_alloc 407 BEFORE ADD RANDOM = FALSE
[ 3785.884921] brd_alloc 410 AFTER ADD RANDOM = FALSE
[ 3785.885320] brd_alloc 407 BEFORE ADD RANDOM = FALSE
[ 3785.885322] brd_alloc 410 AFTER ADD RANDOM = FALSE
[ 3785.885662] brd_alloc 407 BEFORE ADD RANDOM = FALSE
[ 3785.885664] brd_alloc 410 AFTER ADD RANDOM = FALSE
[ 3785.886270] brd_alloc 407 BEFORE ADD RANDOM = FALSE
[ 3785.886272] brd_alloc 410 AFTER ADD RANDOM = FALSE
[ 3785.886451] brd_alloc 407 BEFORE ADD RANDOM = FALSE
[ 3785.886452] brd_alloc 410 AFTER ADD RANDOM = FALSE
[ 3785.886621] brd_alloc 407 BEFORE ADD RANDOM = FALSE
[ 3785.886622] brd_alloc 410 AFTER ADD RANDOM = FALSE
[ 3785.886831] brd_alloc 407 BEFORE ADD RANDOM = FALSE
[ 3785.886833] brd_alloc 410 AFTER ADD RANDOM = FALSE
[ 3785.886990] brd_alloc 407 BEFORE ADD RANDOM = FALSE
[ 3785.886991] brd_alloc 410 AFTER ADD RANDOM = FALSE
[ 3785.887176] brd_alloc 407 BEFORE ADD RANDOM = FALSE
[ 3785.887177] brd_alloc 410 AFTER ADD RANDOM = FALSE
[ 3785.887368] brd_alloc 407 BEFORE ADD RANDOM = FALSE
[ 3785.887369] brd_alloc 410 AFTER ADD RANDOM = FALSE
[ 3785.888011] brd_alloc 407 BEFORE ADD RANDOM = FALSE
[ 3785.888013] brd_alloc 410 AFTER ADD RANDOM = FALSE
[ 3785.888212] brd_alloc 407 BEFORE ADD RANDOM = FALSE
[ 3785.888214] brd_alloc 410 AFTER ADD RANDOM = FALSE
[ 3785.888687] brd_alloc 407 BEFORE ADD RANDOM = FALSE
[ 3785.888689] brd_alloc 410 AFTER ADD RANDOM = FALSE
[ 3785.888911] brd_alloc 407 BEFORE ADD RANDOM = FALSE
[ 3785.888913] brd_alloc 410 AFTER ADD RANDOM = FALSE
[ 3785.889390] brd_alloc 407 BEFORE ADD RANDOM = FALSE
[ 3785.889392] brd_alloc 410 AFTER ADD RANDOM = FALSE
[ 3785.889585] brd_alloc 407 BEFORE ADD RANDOM = FALSE
[ 3785.889586] brd_alloc 410 AFTER ADD RANDOM = FALSE
[ 3785.890099] brd: module loaded
+ modprobe -r brd

* NBD :-
-----------------------------------------------------------------------

With this debug patch :-
@@ -1805,7 +1805,11 @@ static struct nbd_device *nbd_dev_add(int index, unsigned int refs)
 	 * Tell the block layer that we are not a rotational device
 	 */
 	blk_queue_flag_set(QUEUE_FLAG_NONROT, disk->queue);
+	pr_info("%s %d BEFORE ADD RANDOM = %s\n", __func__, __LINE__,
+			blk_queue_add_random(disk->queue) ? "TRUE" : "FALSE" );
 	blk_queue_flag_clear(QUEUE_FLAG_ADD_RANDOM, disk->queue);
+	pr_info("%s %d AFTER ADD RANDOM = %s\n", __func__, __LINE__,
+			blk_queue_add_random(disk->queue) ? "TRUE" : "FALSE" );
 	disk->queue->limits.discard_granularity = 0;
 	blk_queue_max_discard_sectors(disk->queue, 0);
 	blk_queue_max_segment_size(disk->queue, UINT_MAX);

+ modprobe -r nbd
+ lsmod
+ grep nbd
++ nproc
+ make -j 48 M=drivers/block modules
+ HOST=drivers/block/nbd.ko
++ uname -r
+ HOST_DEST=/lib/modules/6.3.0-rc7lblk+/kernel/drivers/block/
+ cp drivers/block/nbd.ko /lib/modules/6.3.0-rc7lblk+/kernel/drivers/block//
+ ls -lrth /lib/modules/6.3.0-rc7lblk+/kernel/drivers/block//nbd.ko
-rw-r--r--. 1 root root 998K Apr 23 14:09 /lib/modules/6.3.0-rc7lblk+/kernel/drivers/block//nbd.ko
+ dmesg -c
+ lsmod
+ grep nbd
+ modprobe nbd
+ dmesg -c
[ 3786.953726] nbd: nbd_dev_add 1808 BEFORE ADD RANDOM = FALSE
[ 3786.953731] nbd: nbd_dev_add 1811 AFTER ADD RANDOM = FALSE
[ 3786.954877] nbd: nbd_dev_add 1808 BEFORE ADD RANDOM = FALSE
[ 3786.954880] nbd: nbd_dev_add 1811 AFTER ADD RANDOM = FALSE
[ 3786.956753] nbd: nbd_dev_add 1808 BEFORE ADD RANDOM = FALSE
[ 3786.956759] nbd: nbd_dev_add 1811 AFTER ADD RANDOM = FALSE
[ 3786.958118] nbd: nbd_dev_add 1808 BEFORE ADD RANDOM = FALSE
[ 3786.958121] nbd: nbd_dev_add 1811 AFTER ADD RANDOM = FALSE
[ 3786.959372] nbd: nbd_dev_add 1808 BEFORE ADD RANDOM = FALSE
[ 3786.959374] nbd: nbd_dev_add 1811 AFTER ADD RANDOM = FALSE
[ 3786.960139] nbd: nbd_dev_add 1808 BEFORE ADD RANDOM = FALSE
[ 3786.960141] nbd: nbd_dev_add 1811 AFTER ADD RANDOM = FALSE
[ 3786.960878] nbd: nbd_dev_add 1808 BEFORE ADD RANDOM = FALSE
[ 3786.960880] nbd: nbd_dev_add 1811 AFTER ADD RANDOM = FALSE
[ 3786.961558] nbd: nbd_dev_add 1808 BEFORE ADD RANDOM = FALSE
[ 3786.961560] nbd: nbd_dev_add 1811 AFTER ADD RANDOM = FALSE
[ 3786.962303] nbd: nbd_dev_add 1808 BEFORE ADD RANDOM = FALSE
[ 3786.962305] nbd: nbd_dev_add 1811 AFTER ADD RANDOM = FALSE
[ 3786.963063] nbd: nbd_dev_add 1808 BEFORE ADD RANDOM = FALSE
[ 3786.963065] nbd: nbd_dev_add 1811 AFTER ADD RANDOM = FALSE
[ 3786.963821] nbd: nbd_dev_add 1808 BEFORE ADD RANDOM = FALSE
[ 3786.963824] nbd: nbd_dev_add 1811 AFTER ADD RANDOM = FALSE
[ 3786.964573] nbd: nbd_dev_add 1808 BEFORE ADD RANDOM = FALSE
[ 3786.964575] nbd: nbd_dev_add 1811 AFTER ADD RANDOM = FALSE
[ 3786.965282] nbd: nbd_dev_add 1808 BEFORE ADD RANDOM = FALSE
[ 3786.965284] nbd: nbd_dev_add 1811 AFTER ADD RANDOM = FALSE
[ 3786.966067] nbd: nbd_dev_add 1808 BEFORE ADD RANDOM = FALSE
[ 3786.966069] nbd: nbd_dev_add 1811 AFTER ADD RANDOM = FALSE
[ 3786.966851] nbd: nbd_dev_add 1808 BEFORE ADD RANDOM = FALSE
[ 3786.966854] nbd: nbd_dev_add 1811 AFTER ADD RANDOM = FALSE
[ 3786.967544] nbd: nbd_dev_add 1808 BEFORE ADD RANDOM = FALSE
[ 3786.967545] nbd: nbd_dev_add 1811 AFTER ADD RANDOM = FALSE
+ modprobe -r nbd

* ZRAM:-
-----------------------------------------------------------------------

With this debug patch :-
@@ -2323,7 +2323,11 @@ static int zram_add(void)
        /* zram devices sort of resembles non-rotational disks */
        blk_queue_flag_set(QUEUE_FLAG_NONROT, zram->disk->queue);
        blk_queue_flag_set(QUEUE_FLAG_SYNCHRONOUS, zram->disk->queue);
+       pr_info("%s %d BEFORE ADD RANDOM = %s\n", __func__, __LINE__,
+                       blk_queue_add_random(zram->disk->queue) ? "TRUE" : "FALSE" );
        blk_queue_flag_clear(QUEUE_FLAG_ADD_RANDOM, zram->disk->queue);
+       pr_info("%s %d AFTER ADD RANDOM = %s\n", __func__, __LINE__,
+                       blk_queue_add_random(zram->disk->queue) ? "TRUE" : "FALSE" );
 
        /*
         * To ensure that we always get PAGE_SIZE aligned

[    9.020829] zram: loading out-of-tree module taints kernel.
[    9.030043] zram: zram_add 2326 BEFORE ADD RANDOM = FALSE
[    9.030047] zram: zram_add 2329 AFTER ADD RANDOM = FALSE
[    9.030579] zram: Added device: zram0
[    9.168858] systemd[1]: Created slice system-systemd\x2dzram\x2dsetup.slice.
[    9.544414] zram0: detected capacity change from 0 to 16777216
[    9.600893] Adding 8388604k swap on /dev/zram0.  Priority:100 extents:1 across:8388604k SSFS


* BCACHE:-
-----------------------------------------------------------------------

With this debug patch :-
@@ -971,7 +971,11 @@ static int bcache_device_init(struct bcache_device *d, unsigned int block_size,
 	}
 
 	blk_queue_flag_set(QUEUE_FLAG_NONROT, d->disk->queue);
+	pr_info("%s %d BEFORE ADD RANDOM = %s\n", __func__, __LINE__,
+			blk_queue_add_random(d->disk->queue) ? "TRUE" : "FALSE" );
 	blk_queue_flag_clear(QUEUE_FLAG_ADD_RANDOM, d->disk->queue);
+	pr_info("%s %d AFTER ADD RANDOM = %s\n", __func__, __LINE__,
+			blk_queue_add_random(d->disk->queue) ? "TRUE" : "FALSE" );
 
 	blk_queue_write_cache(q, true, true);

+ makej M=drivers/md/bcache
+ modprobe null_blk queue_mode=2 nr_devices=2 memory_backed=1 gb=1
+ insmod drivers/md/bcache/bcache.ko
+ bcache make -B /dev/nullb0 -C /dev/nullb1
Name			/dev/nullb1
Label			
Type			cache
UUID:			0694b66e-970e-49e2-ab2c-791f84a53b8e
Set UUID:		e8be54f6-18c9-4965-b406-63e602201395
version:		0
nbuckets:		2048
block_size_in_sectors:	1
bucket_size_in_sectors:	1024
nr_in_set:		1
nr_this_dev:		0
first_bucket:		1
                                ...
Name			/dev/nullb0
Label			
Type			data
UUID:			8a64d20c-12ce-4ca5-a9fb-f978bfba52df
Set UUID:		e8be54f6-18c9-4965-b406-63e602201395
version:		1
block_size_in_sectors:	1
data_offset_in_sectors:	16

+ echo /dev/nullb0
+ echo /dev/nullb1
+ dmesg -c
[ 3788.828220] null_blk: null_add_dev 2147 BEFORE ADD RANDOM = FALSE
[ 3788.828227] null_blk: null_add_dev 2150 AFTER ADD RANDOM = FALSE
[ 3788.829617] null_blk: disk nullb0 created
[ 3788.829699] null_blk: null_add_dev 2147 BEFORE ADD RANDOM = FALSE
[ 3788.829701] null_blk: null_add_dev 2150 AFTER ADD RANDOM = FALSE
[ 3788.830484] null_blk: disk nullb1 created
[ 3788.830485] null_blk: module loaded
[ 3788.863458] bcache: bcache_device_init() bcache_device_init 974 BEFORE ADD RANDOM = FALSE
[ 3788.863462] bcache: bcache_device_init() bcache_device_init 977 AFTER ADD RANDOM = FALSE
[ 3788.863491] bcache: register_bdev() registered backing device nullb0
[ 3788.864156] bcache: run_cache_set() invalidating existing data
[ 3788.866970] bcache: bch_cached_dev_run() cached dev nullb0 is running already
[ 3788.866976] bcache: bch_cached_dev_attach() Caching nullb0 as bcache0 on set e8be54f6-18c9-4965-b406-63e602201395
[ 3788.866990] bcache: register_cache() registered cache device nullb1
+ sleep 1
+ bcache unregister /dev/nullb0
+ bcache unregister /dev/nullb1
+ sleep 1
+ modprobe -r bcache
+ modprobe -r null_blk

-- 
2.40.0


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH 1/5] null_blk: don't clear the flag that is not set
  2023-04-24  7:30 [PATCH 0/5] block/drivers: don't clear the flag that is not set Chaitanya Kulkarni
@ 2023-04-24  7:30 ` Chaitanya Kulkarni
  2023-04-24  7:30 ` [PATCH 2/5] brd: " Chaitanya Kulkarni
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 11+ messages in thread
From: Chaitanya Kulkarni @ 2023-04-24  7:30 UTC (permalink / raw
  To: linux-block, linux-bcache
  Cc: axboe, josef, minchan, senozhatsky, colyli, kent.overstreet,
	dlemoal, kch, johannes.thumshirn, bvanassche, vincent.fu,
	akinobu.mita, shinichiro.kawasaki, nbd

QUEUE_FLAG_ADD_RANDOM is not set in null_add_dev() before we clear it.
There is no point in clearing the flag that is not set.
Remove blk_queue_flag_clear() for QUEUE_FLAG_ADD_RANDOM.

Signed-off-by: Chaitanya Kulkarni <kch@nvidia.com>
---
 drivers/block/null_blk/main.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/block/null_blk/main.c b/drivers/block/null_blk/main.c
index b195b8b9fe32..b3fedafe301e 100644
--- a/drivers/block/null_blk/main.c
+++ b/drivers/block/null_blk/main.c
@@ -2144,7 +2144,6 @@ static int null_add_dev(struct nullb_device *dev)
 
 	nullb->q->queuedata = nullb;
 	blk_queue_flag_set(QUEUE_FLAG_NONROT, nullb->q);
-	blk_queue_flag_clear(QUEUE_FLAG_ADD_RANDOM, nullb->q);
 
 	mutex_lock(&lock);
 	rv = ida_simple_get(&nullb_indexes, 0, 0, GFP_KERNEL);
-- 
2.40.0


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 2/5] brd: don't clear the flag that is not set
  2023-04-24  7:30 [PATCH 0/5] block/drivers: don't clear the flag that is not set Chaitanya Kulkarni
  2023-04-24  7:30 ` [PATCH 1/5] null_blk: " Chaitanya Kulkarni
@ 2023-04-24  7:30 ` Chaitanya Kulkarni
  2023-04-24  7:30 ` [PATCH 3/5] nbd: " Chaitanya Kulkarni
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 11+ messages in thread
From: Chaitanya Kulkarni @ 2023-04-24  7:30 UTC (permalink / raw
  To: linux-block, linux-bcache
  Cc: axboe, josef, minchan, senozhatsky, colyli, kent.overstreet,
	dlemoal, kch, johannes.thumshirn, bvanassche, vincent.fu,
	akinobu.mita, shinichiro.kawasaki, nbd

QUEUE_FLAG_ADD_RANDOM is not set in brd_alloc() before we clear it.
There is no point in clearing the flag that is not set.
Remove blk_queue_flag_clear() for QUEUE_FLAG_ADD_RANDOM.

Signed-off-by: Chaitanya Kulkarni <kch@nvidia.com>
---
 drivers/block/brd.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/block/brd.c b/drivers/block/brd.c
index 34177f1bd97d..bcad9b926b0c 100644
--- a/drivers/block/brd.c
+++ b/drivers/block/brd.c
@@ -404,7 +404,6 @@ static int brd_alloc(int i)
 	/* Tell the block layer that this is not a rotational device */
 	blk_queue_flag_set(QUEUE_FLAG_NONROT, disk->queue);
 	blk_queue_flag_set(QUEUE_FLAG_SYNCHRONOUS, disk->queue);
-	blk_queue_flag_clear(QUEUE_FLAG_ADD_RANDOM, disk->queue);
 	blk_queue_flag_set(QUEUE_FLAG_NOWAIT, disk->queue);
 	err = add_disk(disk);
 	if (err)
-- 
2.40.0


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 3/5] nbd: don't clear the flag that is not set
  2023-04-24  7:30 [PATCH 0/5] block/drivers: don't clear the flag that is not set Chaitanya Kulkarni
  2023-04-24  7:30 ` [PATCH 1/5] null_blk: " Chaitanya Kulkarni
  2023-04-24  7:30 ` [PATCH 2/5] brd: " Chaitanya Kulkarni
@ 2023-04-24  7:30 ` Chaitanya Kulkarni
  2023-04-24  7:30 ` [PATCH 4/5] zram: " Chaitanya Kulkarni
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 11+ messages in thread
From: Chaitanya Kulkarni @ 2023-04-24  7:30 UTC (permalink / raw
  To: linux-block, linux-bcache
  Cc: axboe, josef, minchan, senozhatsky, colyli, kent.overstreet,
	dlemoal, kch, johannes.thumshirn, bvanassche, vincent.fu,
	akinobu.mita, shinichiro.kawasaki, nbd

QUEUE_FLAG_ADD_RANDOM is not set in nbd_dev_add() before we clear it.
There is no point in clearing the flag that is not set.
Remove blk_queue_flag_clear() for QUEUE_FLAG_ADD_RANDOM.

Signed-off-by: Chaitanya Kulkarni <kch@nvidia.com>
---
 drivers/block/nbd.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
index d445fd0934bd..7c96ec4e99df 100644
--- a/drivers/block/nbd.c
+++ b/drivers/block/nbd.c
@@ -1805,7 +1805,6 @@ static struct nbd_device *nbd_dev_add(int index, unsigned int refs)
 	 * Tell the block layer that we are not a rotational device
 	 */
 	blk_queue_flag_set(QUEUE_FLAG_NONROT, disk->queue);
-	blk_queue_flag_clear(QUEUE_FLAG_ADD_RANDOM, disk->queue);
 	disk->queue->limits.discard_granularity = 0;
 	blk_queue_max_discard_sectors(disk->queue, 0);
 	blk_queue_max_segment_size(disk->queue, UINT_MAX);
-- 
2.40.0


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 4/5] zram: don't clear the flag that is not set
  2023-04-24  7:30 [PATCH 0/5] block/drivers: don't clear the flag that is not set Chaitanya Kulkarni
                   ` (2 preceding siblings ...)
  2023-04-24  7:30 ` [PATCH 3/5] nbd: " Chaitanya Kulkarni
@ 2023-04-24  7:30 ` Chaitanya Kulkarni
  2023-04-24  7:30 ` [PATCH 5/5] bcache: " Chaitanya Kulkarni
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 11+ messages in thread
From: Chaitanya Kulkarni @ 2023-04-24  7:30 UTC (permalink / raw
  To: linux-block, linux-bcache
  Cc: axboe, josef, minchan, senozhatsky, colyli, kent.overstreet,
	dlemoal, kch, johannes.thumshirn, bvanassche, vincent.fu,
	akinobu.mita, shinichiro.kawasaki, nbd

QUEUE_FLAG_ADD_RANDOM is not set in zram_add() before we clear it.
There is no point in clearing the flag that is not set.
Remove blk_queue_flag_clear() for QUEUE_FLAG_ADD_RANDOM.

Signed-off-by: Chaitanya Kulkarni <kch@nvidia.com>
---
 drivers/block/zram/zram_drv.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c
index aa490da3cef2..f7d4c0d5ad0d 100644
--- a/drivers/block/zram/zram_drv.c
+++ b/drivers/block/zram/zram_drv.c
@@ -2323,7 +2323,6 @@ static int zram_add(void)
 	/* zram devices sort of resembles non-rotational disks */
 	blk_queue_flag_set(QUEUE_FLAG_NONROT, zram->disk->queue);
 	blk_queue_flag_set(QUEUE_FLAG_SYNCHRONOUS, zram->disk->queue);
-	blk_queue_flag_clear(QUEUE_FLAG_ADD_RANDOM, zram->disk->queue);
 
 	/*
 	 * To ensure that we always get PAGE_SIZE aligned
-- 
2.40.0


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 5/5] bcache: don't clear the flag that is not set
  2023-04-24  7:30 [PATCH 0/5] block/drivers: don't clear the flag that is not set Chaitanya Kulkarni
                   ` (3 preceding siblings ...)
  2023-04-24  7:30 ` [PATCH 4/5] zram: " Chaitanya Kulkarni
@ 2023-04-24  7:30 ` Chaitanya Kulkarni
  2023-04-24 10:19   ` [PATCH 5/5] bcache: don't clear the flag that is not set^[ Coly Li
       [not found] ` <CGME20230424092940epcas5p3407002e7d5c79593ffbafc38f2b49e51@epcas5p3.samsung.com>
  2023-04-24 16:39 ` Jens Axboe
  6 siblings, 1 reply; 11+ messages in thread
From: Chaitanya Kulkarni @ 2023-04-24  7:30 UTC (permalink / raw
  To: linux-block, linux-bcache
  Cc: axboe, josef, minchan, senozhatsky, colyli, kent.overstreet,
	dlemoal, kch, johannes.thumshirn, bvanassche, vincent.fu,
	akinobu.mita, shinichiro.kawasaki, nbd

QUEUE_FLAG_ADD_RANDOM is not set in bcache_device_init() before we clear
it. There is no point in clearing the flag that is not set.
Remove blk_queue_flag_clear() for QUEUE_FLAG_ADD_RANDOM.

Signed-off-by: Chaitanya Kulkarni <kch@nvidia.com>
---
 drivers/md/bcache/super.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c
index ba3909bb6bea..7e9d19fd21dd 100644
--- a/drivers/md/bcache/super.c
+++ b/drivers/md/bcache/super.c
@@ -971,7 +971,6 @@ static int bcache_device_init(struct bcache_device *d, unsigned int block_size,
 	}
 
 	blk_queue_flag_set(QUEUE_FLAG_NONROT, d->disk->queue);
-	blk_queue_flag_clear(QUEUE_FLAG_ADD_RANDOM, d->disk->queue);
 
 	blk_queue_write_cache(q, true, true);
 
-- 
2.40.0


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATCH 0/5] block/drivers: don't clear the flag that is not set
       [not found] ` <CGME20230424092940epcas5p3407002e7d5c79593ffbafc38f2b49e51@epcas5p3.samsung.com>
@ 2023-04-24  9:26   ` Nitesh Shetty
  2023-04-24 10:25     ` Chaitanya Kulkarni
  0 siblings, 1 reply; 11+ messages in thread
From: Nitesh Shetty @ 2023-04-24  9:26 UTC (permalink / raw
  To: Chaitanya Kulkarni
  Cc: linux-block, linux-bcache, axboe, josef, minchan, senozhatsky,
	colyli, kent.overstreet, dlemoal, johannes.thumshirn, bvanassche,
	vincent.fu, akinobu.mita, shinichiro.kawasaki, nbd, Jason

[-- Attachment #1: Type: text/plain, Size: 298 bytes --]

On 23/04/24 12:30AM, Chaitanya Kulkarni wrote:
>null_blk
>brd
>nbd
>zram
>bcache

Any particular reason for leaving out mtip and s390 drivers ?

Will it be better to use the flag similar to scsi devices and
use it for random number generation ?

Otherwise looks good to me.

Regards,
Nitesh Shetty

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 5/5] bcache: don't clear the flag that is not   set^[
  2023-04-24  7:30 ` [PATCH 5/5] bcache: " Chaitanya Kulkarni
@ 2023-04-24 10:19   ` Coly Li
  0 siblings, 0 replies; 11+ messages in thread
From: Coly Li @ 2023-04-24 10:19 UTC (permalink / raw
  To: Chaitanya Kulkarni
  Cc: linux-block, linux-bcache, axboe, josef, minchan, senozhatsky,
	Kent Overstreet, dlemoal, johannes.thumshirn, bvanassche,
	vincent.fu, akinobu.mita, shinichiro.kawasaki, nbd

On Mon, Apr 24, 2023 at 12:30:23AM -0700, Chaitanya Kulkarni wrote:
> QUEUE_FLAG_ADD_RANDOM is not set in bcache_device_init() before we clear
> it. There is no point in clearing the flag that is not set.
> Remove blk_queue_flag_clear() for QUEUE_FLAG_ADD_RANDOM.
> 
> Signed-off-by: Chaitanya Kulkarni <kch@nvidia.com>

Acked-by: Coly Li <colyli@suse.de>

Thanks.

> ---
> drivers/md/bcache/super.c | 1 -
> 1 file changed, 1 deletion(-)
> 
> diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c
> index ba3909bb6bea..7e9d19fd21dd 100644
> --- a/drivers/md/bcache/super.c
> +++ b/drivers/md/bcache/super.c
> @@ -971,7 +971,6 @@ static int bcache_device_init(struct bcache_device *d, unsigned int block_size,
> 	}
> 
> 	blk_queue_flag_set(QUEUE_FLAG_NONROT, d->disk->queue);
> -	blk_queue_flag_clear(QUEUE_FLAG_ADD_RANDOM, d->disk->queue);
> 
> 	blk_queue_write_cache(q, true, true);
> 
> -- 
> 2.40.0
> 

-- 
Coly Li

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 0/5] block/drivers: don't clear the flag that is not set
  2023-04-24  9:26   ` [PATCH 0/5] block/drivers: don't clear the flag that is not set Nitesh Shetty
@ 2023-04-24 10:25     ` Chaitanya Kulkarni
  2023-04-24 10:40       ` Nitesh Shetty
  0 siblings, 1 reply; 11+ messages in thread
From: Chaitanya Kulkarni @ 2023-04-24 10:25 UTC (permalink / raw
  To: Nitesh Shetty, Chaitanya Kulkarni
  Cc: linux-block@vger.kernel.org, linux-bcache@vger.kernel.org,
	axboe@kernel.dk, josef@toxicpanda.com, minchan@kernel.org,
	senozhatsky@chromium.org, colyli@suse.de,
	kent.overstreet@gmail.com, dlemoal@kernel.org,
	johannes.thumshirn@wdc.com, bvanassche@acm.org,
	vincent.fu@samsung.com, akinobu.mita@gmail.com,
	shinichiro.kawasaki@wdc.com, nbd@other.debian.org,
	Jason@zx2c4.com

On 4/24/23 02:26, Nitesh Shetty wrote:
> On 23/04/24 12:30AM, Chaitanya Kulkarni wrote:
>> null_blk
>> brd
>> nbd
>> zram
>> bcache
>
> Any particular reason for leaving out mtip and s390 drivers ?
>

I didn't find why this flag is clear at first place,
if this gets accepted I'll others gradually..

> Will it be better to use the flag similar to scsi devices and
> use it for random number generation ?
>

I didn't understand this comment.

> Otherwise looks good to me.
>
> Regards,
> Nitesh Shetty
>

-ck



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 0/5] block/drivers: don't clear the flag that is not set
  2023-04-24 10:25     ` Chaitanya Kulkarni
@ 2023-04-24 10:40       ` Nitesh Shetty
  0 siblings, 0 replies; 11+ messages in thread
From: Nitesh Shetty @ 2023-04-24 10:40 UTC (permalink / raw
  To: Chaitanya Kulkarni
  Cc: linux-block@vger.kernel.org, linux-bcache@vger.kernel.org,
	axboe@kernel.dk, josef@toxicpanda.com, minchan@kernel.org,
	senozhatsky@chromium.org, colyli@suse.de,
	kent.overstreet@gmail.com, dlemoal@kernel.org,
	johannes.thumshirn@wdc.com, bvanassche@acm.org,
	vincent.fu@samsung.com, akinobu.mita@gmail.com,
	shinichiro.kawasaki@wdc.com, nbd@other.debian.org,
	Jason@zx2c4.com

[-- Attachment #1: Type: text/plain, Size: 756 bytes --]

On Mon, Apr 24, 2023 at 10:25:34AM +0000, Chaitanya Kulkarni wrote:
> On 4/24/23 02:26, Nitesh Shetty wrote:
> > On 23/04/24 12:30AM, Chaitanya Kulkarni wrote:
> >> null_blk
> >> brd
> >> nbd
> >> zram
> >> bcache
> >
> > Any particular reason for leaving out mtip and s390 drivers ?
> >
> 
> I didn't find why this flag is clear at first place,
> if this gets accepted I'll others gradually..
> 
> > Will it be better to use the flag similar to scsi devices and
> > use it for random number generation ?
> >
> 
> I didn't understand this comment.
> 

My bad. I intended, may be we can set QUEUE_FLAG_ADD_RANDOM flag.
Similar to scsi once the request completes, using function
add_disc_randomness() random generator can be updated.

Regards,
Nitesh Shetty

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 0/5] block/drivers: don't clear the flag that is not set
  2023-04-24  7:30 [PATCH 0/5] block/drivers: don't clear the flag that is not set Chaitanya Kulkarni
                   ` (5 preceding siblings ...)
       [not found] ` <CGME20230424092940epcas5p3407002e7d5c79593ffbafc38f2b49e51@epcas5p3.samsung.com>
@ 2023-04-24 16:39 ` Jens Axboe
  6 siblings, 0 replies; 11+ messages in thread
From: Jens Axboe @ 2023-04-24 16:39 UTC (permalink / raw
  To: Chaitanya Kulkarni, linux-block, linux-bcache
  Cc: josef, minchan, senozhatsky, colyli, kent.overstreet, dlemoal,
	johannes.thumshirn, bvanassche, vincent.fu, akinobu.mita,
	shinichiro.kawasaki, nbd

On 4/24/23 1:30?AM, Chaitanya Kulkarni wrote:
> Hi,
> 
> The drivers in this patch-series tries to clear the
> QUEUE_FLAG_ADD_RANDOM that is not set at all in the queue allocation
> and initialization path in :-

Just roll this into one, as it should be a non-functional change since
we don't default to ADD_RANDOM with MQ ops. And then change the title to
something meaningful, ala:

block/drivers: remove dead clear of QUEUE_FLAG_ADD_RANDOM

or something like that, as your title currently makes very little sense
(eg it's hard to parse and it doesn't really say what is being done).

-- 
Jens Axboe


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2023-04-24 16:39 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-04-24  7:30 [PATCH 0/5] block/drivers: don't clear the flag that is not set Chaitanya Kulkarni
2023-04-24  7:30 ` [PATCH 1/5] null_blk: " Chaitanya Kulkarni
2023-04-24  7:30 ` [PATCH 2/5] brd: " Chaitanya Kulkarni
2023-04-24  7:30 ` [PATCH 3/5] nbd: " Chaitanya Kulkarni
2023-04-24  7:30 ` [PATCH 4/5] zram: " Chaitanya Kulkarni
2023-04-24  7:30 ` [PATCH 5/5] bcache: " Chaitanya Kulkarni
2023-04-24 10:19   ` [PATCH 5/5] bcache: don't clear the flag that is not set^[ Coly Li
     [not found] ` <CGME20230424092940epcas5p3407002e7d5c79593ffbafc38f2b49e51@epcas5p3.samsung.com>
2023-04-24  9:26   ` [PATCH 0/5] block/drivers: don't clear the flag that is not set Nitesh Shetty
2023-04-24 10:25     ` Chaitanya Kulkarni
2023-04-24 10:40       ` Nitesh Shetty
2023-04-24 16:39 ` Jens Axboe

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 read-only IMAP folder(s) and NNTP newsgroup(s).