Skip to contentSkip to conversation

ide: set missing QUEUE_FLAG_ADD_RANDOM

PATCH In review Jeffle Xu 2 participants 3 messages Feb 9, 2021 libata

lore
Share & tools
lore

Jeffle Xu

author
#0 lore raw

PATCH 1/1 ide: set missing QUEUE_FLAG_ADD_RANDOM

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.

---
 drivers/ide/ide-disk.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/ide/ide-disk.c +3 -0
index 34b9441084f8..7f19af48a6e7 100644
@@ -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 */
Signature · 1 line
2.27.0
#1 lore raw
Quoted 3 lines · Jeffle Xu

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.

author
#2 lore raw
Quoted 8 lines · Christoph Hellwig
Quoted 3 lines · Jeffle Xu

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.

Signature · 2 lines
Thanks,
Jeffle