Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost

Pull virtio fix from Michael Tsirkin:
"A last minute revert to fix a regression"

* tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost:
Revert "virtio-blk: support completion batching for the IRQ path"

+37 -45
+37 -45
drivers/block/virtio_blk.c
··· 348 348 blk_mq_end_request(req, status); 349 349 } 350 350 351 - static void virtblk_complete_batch(struct io_comp_batch *iob) 352 - { 353 - struct request *req; 354 - 355 - rq_list_for_each(&iob->req_list, req) { 356 - virtblk_unmap_data(req, blk_mq_rq_to_pdu(req)); 357 - virtblk_cleanup_cmd(req); 358 - } 359 - blk_mq_end_request_batch(iob); 360 - } 361 - 362 - static int virtblk_handle_req(struct virtio_blk_vq *vq, 363 - struct io_comp_batch *iob) 364 - { 365 - struct virtblk_req *vbr; 366 - int req_done = 0; 367 - unsigned int len; 368 - 369 - while ((vbr = virtqueue_get_buf(vq->vq, &len)) != NULL) { 370 - struct request *req = blk_mq_rq_from_pdu(vbr); 371 - 372 - if (likely(!blk_should_fake_timeout(req->q)) && 373 - !blk_mq_complete_request_remote(req) && 374 - !blk_mq_add_to_batch(req, iob, virtblk_vbr_status(vbr), 375 - virtblk_complete_batch)) 376 - virtblk_request_done(req); 377 - req_done++; 378 - } 379 - 380 - return req_done; 381 - } 382 - 383 351 static void virtblk_done(struct virtqueue *vq) 384 352 { 385 353 struct virtio_blk *vblk = vq->vdev->priv; 386 - struct virtio_blk_vq *vblk_vq = &vblk->vqs[vq->index]; 387 - int req_done = 0; 354 + bool req_done = false; 355 + int qid = vq->index; 356 + struct virtblk_req *vbr; 388 357 unsigned long flags; 389 - DEFINE_IO_COMP_BATCH(iob); 358 + unsigned int len; 390 359 391 - spin_lock_irqsave(&vblk_vq->lock, flags); 360 + spin_lock_irqsave(&vblk->vqs[qid].lock, flags); 392 361 do { 393 362 virtqueue_disable_cb(vq); 394 - req_done += virtblk_handle_req(vblk_vq, &iob); 363 + while ((vbr = virtqueue_get_buf(vblk->vqs[qid].vq, &len)) != NULL) { 364 + struct request *req = blk_mq_rq_from_pdu(vbr); 395 365 366 + if (likely(!blk_should_fake_timeout(req->q))) 367 + blk_mq_complete_request(req); 368 + req_done = true; 369 + } 396 370 if (unlikely(virtqueue_is_broken(vq))) 397 371 break; 398 372 } while (!virtqueue_enable_cb(vq)); 399 373 400 - if (req_done) { 401 - if (!rq_list_empty(iob.req_list)) 402 - iob.complete(&iob); 403 - 404 - /* In case queue is stopped waiting for more buffers. */ 374 + /* In case queue is stopped waiting for more buffers. */ 375 + if (req_done) 405 376 blk_mq_start_stopped_hw_queues(vblk->disk->queue, true); 406 - } 407 - spin_unlock_irqrestore(&vblk_vq->lock, flags); 377 + spin_unlock_irqrestore(&vblk->vqs[qid].lock, flags); 408 378 } 409 379 410 380 static void virtio_commit_rqs(struct blk_mq_hw_ctx *hctx) ··· 1253 1283 } 1254 1284 } 1255 1285 1286 + static void virtblk_complete_batch(struct io_comp_batch *iob) 1287 + { 1288 + struct request *req; 1289 + 1290 + rq_list_for_each(&iob->req_list, req) { 1291 + virtblk_unmap_data(req, blk_mq_rq_to_pdu(req)); 1292 + virtblk_cleanup_cmd(req); 1293 + } 1294 + blk_mq_end_request_batch(iob); 1295 + } 1296 + 1256 1297 static int virtblk_poll(struct blk_mq_hw_ctx *hctx, struct io_comp_batch *iob) 1257 1298 { 1258 1299 struct virtio_blk *vblk = hctx->queue->queuedata; 1259 1300 struct virtio_blk_vq *vq = get_virtio_blk_vq(hctx); 1301 + struct virtblk_req *vbr; 1260 1302 unsigned long flags; 1303 + unsigned int len; 1261 1304 int found = 0; 1262 1305 1263 1306 spin_lock_irqsave(&vq->lock, flags); 1264 - found = virtblk_handle_req(vq, iob); 1307 + 1308 + while ((vbr = virtqueue_get_buf(vq->vq, &len)) != NULL) { 1309 + struct request *req = blk_mq_rq_from_pdu(vbr); 1310 + 1311 + found++; 1312 + if (!blk_mq_complete_request_remote(req) && 1313 + !blk_mq_add_to_batch(req, iob, virtblk_vbr_status(vbr), 1314 + virtblk_complete_batch)) 1315 + virtblk_request_done(req); 1316 + } 1265 1317 1266 1318 if (found) 1267 1319 blk_mq_start_stopped_hw_queues(vblk->disk->queue, true);