diff mbox series

ide: set missing QUEUE_FLAG_ADD_RANDOM

Message ID 20210209081013.38979-1-jefflexu@linux.alibaba.com
State New
Headers show
Series ide: set missing QUEUE_FLAG_ADD_RANDOM | expand

Commit Message

JeffleXu Feb. 9, 2021, 8:10 a.m. UTC
While the whole block layer has migrated to mq framework,
QUEUE_FLAG_ADD_RANDOM is not included in QUEUE_FLAG_MQ_DEFAULT as the
default flags.

Keep 'blk_queue_flag_clear(QUEUE_FLAG_ADD_RANDOM, ...)' there as the
statement is self explanatory. Besides it can make the code stronger
to keep a complete if-clear-else-set statement, no matter how
QUEUE_FLAG_MQ_DEFAULT could be refactored.

Signed-off-by: Jeffle Xu <jefflexu@linux.alibaba.com>
---
 drivers/ide/ide-disk.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Christoph Hellwig Feb. 9, 2021, 8:32 a.m. UTC | #1
On Tue, Feb 09, 2021 at 04:10:13PM +0800, Jeffle Xu wrote:
> While the whole block layer has migrated to mq framework,
> QUEUE_FLAG_ADD_RANDOM is not included in QUEUE_FLAG_MQ_DEFAULT as the
> default flags.

If you are using the legacy ide code anywhere please switch to libata
ASAP as it is about to go away.
JeffleXu Feb. 9, 2021, 9 a.m. UTC | #2
On 2/9/21 4:32 PM, Christoph Hellwig wrote:
> On Tue, Feb 09, 2021 at 04:10:13PM +0800, Jeffle Xu wrote:
>> While the whole block layer has migrated to mq framework,
>> QUEUE_FLAG_ADD_RANDOM is not included in QUEUE_FLAG_MQ_DEFAULT as the
>> default flags.
> 
> If you are using the legacy ide code anywhere please switch to libata
> ASAP as it is about to go away.
> 

Thanks for replying. I have not encountered any trouble in reality
world. Actually I just find that this code can't work well when I'm
search QUEUE_FLAG_ADD_RANDOM. I'm not familiar with ide world. Please
let me know if I miss something.

Also there are several device drivers still calling
'blk_queue_flag_clear(QUEUE_FLAG_ADD_RANDOM, q)', though they have
migrated to mq and have no need clearing QUEUE_FLAG_ADD_RANDOM.
diff mbox series

Patch

diff --git a/drivers/ide/ide-disk.c b/drivers/ide/ide-disk.c
index 34b9441084f8..7f19af48a6e7 100644
--- a/drivers/ide/ide-disk.c
+++ b/drivers/ide/ide-disk.c
@@ -688,6 +688,9 @@  static void ide_disk_setup(ide_drive_t *drive)
 	if (ata_id_is_ssd(id)) {
 		blk_queue_flag_set(QUEUE_FLAG_NONROT, q);
 		blk_queue_flag_clear(QUEUE_FLAG_ADD_RANDOM, q);
+	} else {
+		blk_queue_flag_clear(QUEUE_FLAG_NONROT, q);
+		blk_queue_flag_set(QUEUE_FLAG_ADD_RANDOM, q);
 	}
 
 	/* calculate drive capacity, and select LBA if possible */