aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block/xen-blkback/blkback.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/block/xen-blkback/blkback.c')
-rw-r--r--drivers/block/xen-blkback/blkback.c26
1 files changed, 12 insertions, 14 deletions
diff --git a/drivers/block/xen-blkback/blkback.c b/drivers/block/xen-blkback/blkback.c
index 726c32e35db9..0e824091a12f 100644
--- a/drivers/block/xen-blkback/blkback.c
+++ b/drivers/block/xen-blkback/blkback.c
@@ -609,8 +609,6 @@ int xen_blkif_schedule(void *arg)
609 unsigned long timeout; 609 unsigned long timeout;
610 int ret; 610 int ret;
611 611
612 xen_blkif_get(blkif);
613
614 set_freezable(); 612 set_freezable();
615 while (!kthread_should_stop()) { 613 while (!kthread_should_stop()) {
616 if (try_to_freeze()) 614 if (try_to_freeze())
@@ -665,7 +663,6 @@ purge_gnt_list:
665 print_stats(ring); 663 print_stats(ring);
666 664
667 ring->xenblkd = NULL; 665 ring->xenblkd = NULL;
668 xen_blkif_put(blkif);
669 666
670 return 0; 667 return 0;
671} 668}
@@ -1436,34 +1433,35 @@ static int dispatch_rw_block_io(struct xen_blkif_ring *ring,
1436static void make_response(struct xen_blkif_ring *ring, u64 id, 1433static void make_response(struct xen_blkif_ring *ring, u64 id,
1437 unsigned short op, int st) 1434 unsigned short op, int st)
1438{ 1435{
1439 struct blkif_response resp; 1436 struct blkif_response *resp;
1440 unsigned long flags; 1437 unsigned long flags;
1441 union blkif_back_rings *blk_rings; 1438 union blkif_back_rings *blk_rings;
1442 int notify; 1439 int notify;
1443 1440
1444 resp.id = id;
1445 resp.operation = op;
1446 resp.status = st;
1447
1448 spin_lock_irqsave(&ring->blk_ring_lock, flags); 1441 spin_lock_irqsave(&ring->blk_ring_lock, flags);
1449 blk_rings = &ring->blk_rings; 1442 blk_rings = &ring->blk_rings;
1450 /* Place on the response ring for the relevant domain. */ 1443 /* Place on the response ring for the relevant domain. */
1451 switch (ring->blkif->blk_protocol) { 1444 switch (ring->blkif->blk_protocol) {
1452 case BLKIF_PROTOCOL_NATIVE: 1445 case BLKIF_PROTOCOL_NATIVE:
1453 memcpy(RING_GET_RESPONSE(&blk_rings->native, blk_rings->native.rsp_prod_pvt), 1446 resp = RING_GET_RESPONSE(&blk_rings->native,
1454 &resp, sizeof(resp)); 1447 blk_rings->native.rsp_prod_pvt);
1455 break; 1448 break;
1456 case BLKIF_PROTOCOL_X86_32: 1449 case BLKIF_PROTOCOL_X86_32:
1457 memcpy(RING_GET_RESPONSE(&blk_rings->x86_32, blk_rings->x86_32.rsp_prod_pvt), 1450 resp = RING_GET_RESPONSE(&blk_rings->x86_32,
1458 &resp, sizeof(resp)); 1451 blk_rings->x86_32.rsp_prod_pvt);
1459 break; 1452 break;
1460 case BLKIF_PROTOCOL_X86_64: 1453 case BLKIF_PROTOCOL_X86_64:
1461 memcpy(RING_GET_RESPONSE(&blk_rings->x86_64, blk_rings->x86_64.rsp_prod_pvt), 1454 resp = RING_GET_RESPONSE(&blk_rings->x86_64,
1462 &resp, sizeof(resp)); 1455 blk_rings->x86_64.rsp_prod_pvt);
1463 break; 1456 break;
1464 default: 1457 default:
1465 BUG(); 1458 BUG();
1466 } 1459 }
1460
1461 resp->id = id;
1462 resp->operation = op;
1463 resp->status = st;
1464
1467 blk_rings->common.rsp_prod_pvt++; 1465 blk_rings->common.rsp_prod_pvt++;
1468 RING_PUSH_RESPONSES_AND_CHECK_NOTIFY(&blk_rings->common, notify); 1466 RING_PUSH_RESPONSES_AND_CHECK_NOTIFY(&blk_rings->common, notify);
1469 spin_unlock_irqrestore(&ring->blk_ring_lock, flags); 1467 spin_unlock_irqrestore(&ring->blk_ring_lock, flags);