Commit 644b2d99b7a8677a56909a7b1fde31677eba4471

Authored by Jens Axboe
Committed by Linus Torvalds
1 parent 4194b1eaf1

block: enabling plugging on SSD devices that don't do queuing

For the older SSD devices that don't do command queuing, we do want to
enable plugging to get better merging.

Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

Showing 1 changed file with 11 additions and 2 deletions Side-by-side Diff

... ... @@ -1136,6 +1136,15 @@
1136 1136 blk_rq_bio_prep(req->q, req, bio);
1137 1137 }
1138 1138  
  1139 +/*
  1140 + * Only disabling plugging for non-rotational devices if it does tagging
  1141 + * as well, otherwise we do need the proper merging
  1142 + */
  1143 +static inline bool queue_should_plug(struct request_queue *q)
  1144 +{
  1145 + return !(blk_queue_nonrot(q) && blk_queue_tagged(q));
  1146 +}
  1147 +
1139 1148 static int __make_request(struct request_queue *q, struct bio *bio)
1140 1149 {
1141 1150 struct request *req;
1142 1151  
... ... @@ -1242,11 +1251,11 @@
1242 1251 if (test_bit(QUEUE_FLAG_SAME_COMP, &q->queue_flags) ||
1243 1252 bio_flagged(bio, BIO_CPU_AFFINE))
1244 1253 req->cpu = blk_cpu_to_group(smp_processor_id());
1245   - if (!blk_queue_nonrot(q) && elv_queue_empty(q))
  1254 + if (queue_should_plug(q) && elv_queue_empty(q))
1246 1255 blk_plug_device(q);
1247 1256 add_request(q, req);
1248 1257 out:
1249   - if (unplug || blk_queue_nonrot(q))
  1258 + if (unplug || !queue_should_plug(q))
1250 1259 __generic_unplug_device(q);
1251 1260 spin_unlock_irq(q->queue_lock);
1252 1261 return 0;