History

block: Deprecate QUEUE_FLAG_CLUSTER and use queue_limits instead

When stacking devices, a request_queue is not always available. This forced us to have a no_cluster flag in the queue_limits that could be used as a carrier until the request_queue had been set up for a metadevice. There were several problems with that approach. First of all it was up to the stacking device to remember to set queue flag after stacking had completed. Also, the queue flag and the queue limits had to be kept in sync at all times. We got that wrong, which could lead to us issuing commands that went beyond the max scatterlist limit set by the driver. The proper fix is to avoid having two flags for tracking the same thing. We deprecate QUEUE_FLAG_CLUSTER and use the queue limit directly in the block layer merging functions. The queue_limit 'no_cluster' is turned into 'cluster' to avoid double negatives and to ease stacking. Clustering defaults to being enabled as before. The queue flag logic is removed from the stacking function, and explicitly setting the cluster flag is no longer necessary in DM and MD.

Martin K. Petersen committed 15 years ago

Commit e692cb61 parent 04a6b517 files · +13 −40Browse files

Showing the changes to include/linux (1 of 7 files). Show all

Unified · Split

include/linux/blkdev.h+6−3
@@ -250,7 +250,7 @@ struct queue_limits { · 249 unmodified lines
250250
251251 unsigned char misaligned;
252252 unsigned char discard_misaligned;
253− unsigned char no_cluster;
253+ unsigned char cluster;
254254 signed char discard_zeroes_data;
255255 };
256256
@@ -380,7 +380,6 @@ struct request_queue · 123 unmodified lines
380380 #endif
381381 };
382382
383−#define QUEUE_FLAG_CLUSTER 0 /* cluster several segments into 1 */
384383 #define QUEUE_FLAG_QUEUED 1 /* uses generic tag queueing */
385384 #define QUEUE_FLAG_STOPPED 2 /* queue is stopped */
386385 #define QUEUE_FLAG_SYNCFULL 3 /* read queue has been filled */
@@ -403,7 +402,6 @@ struct request_queue · 16 unmodified lines
403402 #define QUEUE_FLAG_SECDISCARD 19 /* supports SECDISCARD */
404403
405404 #define QUEUE_FLAG_DEFAULT ((1 << QUEUE_FLAG_IO_STAT) | \
406− (1 << QUEUE_FLAG_CLUSTER) | \
407405 (1 << QUEUE_FLAG_STACKABLE) | \
408406 (1 << QUEUE_FLAG_SAME_COMP) | \
409407 (1 << QUEUE_FLAG_ADD_RANDOM))
@@ -510,6 +508,11 @@ static inline void queue_flag_clear(unsigned int flag, struct request_queue *q) · 100 unmodified lines
510508
511509 #define rq_data_dir(rq) ((rq)->cmd_flags & 1)
512510
511+static inline unsigned int blk_queue_cluster(struct request_queue *q)
512+{
513+ return q->limits.cluster;
514+}
515+
513516 /*
514517 * We regard a request as sync, if either a read or a sync write
515518 */