dm table: clear add_random unless all devices have it set
The QUEUE_FLAG_ADD_RANDOM specifies if queue IO timings contribute
to random pool.
For bio based target is this flag always 0 because target
has no real queue.
For request-based device was this flag always set to 1 (default).
Set it according to flags on underlying devices (if there is at least
one device which should not contribute, set flag to zero).
If device is not suitable (fast SSD storage) for collecting entropy,
request base queue stacked over it will not be either.
Because checking logic is exactly same as for rotational flag,
create one common function which take iteration function
- if (dm_table_is_nonrot(t))
+ /* Ensure that all underlying device are non-rotational. */
+ if (dm_table_all_devices_attribute(t, device_is_nonrot))
@@ -1404,6 +1413,13 @@ void dm_table_set_restrictions(struct dm_table *t, struct request_queue *q,
+ * Ensure that all devices contributes to entropy pool.
+ * It can be set only for request-based target.
+ if (blk_queue_add_random(q) && dm_table_all_devices_attribute(t, device_no_random))
+ queue_flag_clear_unlocked(QUEUE_FLAG_ADD_RANDOM, q);
* QUEUE_FLAG_STACKABLE must be set after all queue settings are
* visible to other CPUs because, once the flag is set, incoming bios
* are processed by request-based dm, which refers to the queue
dm-devel mailing list