diff options
Diffstat (limited to 'drivers/block')
-rw-r--r-- | drivers/block/cciss.c | 88 | ||||
-rw-r--r-- | drivers/block/cciss.h | 4 | ||||
-rw-r--r-- | drivers/block/cciss_cmd.h | 3 | ||||
-rw-r--r-- | drivers/block/loop.c | 39 | ||||
-rw-r--r-- | drivers/block/nbd.c | 10 | ||||
-rw-r--r-- | drivers/block/virtio_blk.c | 2 | ||||
-rw-r--r-- | drivers/block/xen-blkfront.c | 8 |
7 files changed, 85 insertions, 69 deletions
diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c index 9f7c543cc04b..01e69383d9c0 100644 --- a/drivers/block/cciss.c +++ b/drivers/block/cciss.c | |||
@@ -164,7 +164,7 @@ static int cciss_getgeo(struct block_device *bdev, struct hd_geometry *geo); | |||
164 | 164 | ||
165 | static int cciss_revalidate(struct gendisk *disk); | 165 | static int cciss_revalidate(struct gendisk *disk); |
166 | static int rebuild_lun_table(ctlr_info_t *h, int first_time); | 166 | static int rebuild_lun_table(ctlr_info_t *h, int first_time); |
167 | static int deregister_disk(struct gendisk *disk, drive_info_struct *drv, | 167 | static int deregister_disk(ctlr_info_t *h, int drv_index, |
168 | int clear_all); | 168 | int clear_all); |
169 | 169 | ||
170 | static void cciss_read_capacity(int ctlr, int logvol, int withirq, | 170 | static void cciss_read_capacity(int ctlr, int logvol, int withirq, |
@@ -215,31 +215,17 @@ static struct block_device_operations cciss_fops = { | |||
215 | /* | 215 | /* |
216 | * Enqueuing and dequeuing functions for cmdlists. | 216 | * Enqueuing and dequeuing functions for cmdlists. |
217 | */ | 217 | */ |
218 | static inline void addQ(CommandList_struct **Qptr, CommandList_struct *c) | 218 | static inline void addQ(struct hlist_head *list, CommandList_struct *c) |
219 | { | 219 | { |
220 | if (*Qptr == NULL) { | 220 | hlist_add_head(&c->list, list); |
221 | *Qptr = c; | ||
222 | c->next = c->prev = c; | ||
223 | } else { | ||
224 | c->prev = (*Qptr)->prev; | ||
225 | c->next = (*Qptr); | ||
226 | (*Qptr)->prev->next = c; | ||
227 | (*Qptr)->prev = c; | ||
228 | } | ||
229 | } | 221 | } |
230 | 222 | ||
231 | static inline CommandList_struct *removeQ(CommandList_struct **Qptr, | 223 | static inline void removeQ(CommandList_struct *c) |
232 | CommandList_struct *c) | ||
233 | { | 224 | { |
234 | if (c && c->next != c) { | 225 | if (WARN_ON(hlist_unhashed(&c->list))) |
235 | if (*Qptr == c) | 226 | return; |
236 | *Qptr = c->next; | 227 | |
237 | c->prev->next = c->next; | 228 | hlist_del_init(&c->list); |
238 | c->next->prev = c->prev; | ||
239 | } else { | ||
240 | *Qptr = NULL; | ||
241 | } | ||
242 | return c; | ||
243 | } | 229 | } |
244 | 230 | ||
245 | #include "cciss_scsi.c" /* For SCSI tape support */ | 231 | #include "cciss_scsi.c" /* For SCSI tape support */ |
@@ -506,6 +492,7 @@ static CommandList_struct *cmd_alloc(ctlr_info_t *h, int get_from_pool) | |||
506 | c->cmdindex = i; | 492 | c->cmdindex = i; |
507 | } | 493 | } |
508 | 494 | ||
495 | INIT_HLIST_NODE(&c->list); | ||
509 | c->busaddr = (__u32) cmd_dma_handle; | 496 | c->busaddr = (__u32) cmd_dma_handle; |
510 | temp64.val = (__u64) err_dma_handle; | 497 | temp64.val = (__u64) err_dma_handle; |
511 | c->ErrDesc.Addr.lower = temp64.val32.lower; | 498 | c->ErrDesc.Addr.lower = temp64.val32.lower; |
@@ -1492,8 +1479,7 @@ static void cciss_update_drive_info(int ctlr, int drv_index, int first_time) | |||
1492 | * which keeps the interrupt handler from starting | 1479 | * which keeps the interrupt handler from starting |
1493 | * the queue. | 1480 | * the queue. |
1494 | */ | 1481 | */ |
1495 | ret = deregister_disk(h->gendisk[drv_index], | 1482 | ret = deregister_disk(h, drv_index, 0); |
1496 | &h->drv[drv_index], 0); | ||
1497 | h->drv[drv_index].busy_configuring = 0; | 1483 | h->drv[drv_index].busy_configuring = 0; |
1498 | } | 1484 | } |
1499 | 1485 | ||
@@ -1711,8 +1697,7 @@ static int rebuild_lun_table(ctlr_info_t *h, int first_time) | |||
1711 | spin_lock_irqsave(CCISS_LOCK(h->ctlr), flags); | 1697 | spin_lock_irqsave(CCISS_LOCK(h->ctlr), flags); |
1712 | h->drv[i].busy_configuring = 1; | 1698 | h->drv[i].busy_configuring = 1; |
1713 | spin_unlock_irqrestore(CCISS_LOCK(h->ctlr), flags); | 1699 | spin_unlock_irqrestore(CCISS_LOCK(h->ctlr), flags); |
1714 | return_code = deregister_disk(h->gendisk[i], | 1700 | return_code = deregister_disk(h, i, 1); |
1715 | &h->drv[i], 1); | ||
1716 | h->drv[i].busy_configuring = 0; | 1701 | h->drv[i].busy_configuring = 0; |
1717 | } | 1702 | } |
1718 | } | 1703 | } |
@@ -1782,15 +1767,19 @@ mem_msg: | |||
1782 | * the highest_lun should be left unchanged and the LunID | 1767 | * the highest_lun should be left unchanged and the LunID |
1783 | * should not be cleared. | 1768 | * should not be cleared. |
1784 | */ | 1769 | */ |
1785 | static int deregister_disk(struct gendisk *disk, drive_info_struct *drv, | 1770 | static int deregister_disk(ctlr_info_t *h, int drv_index, |
1786 | int clear_all) | 1771 | int clear_all) |
1787 | { | 1772 | { |
1788 | int i; | 1773 | int i; |
1789 | ctlr_info_t *h = get_host(disk); | 1774 | struct gendisk *disk; |
1775 | drive_info_struct *drv; | ||
1790 | 1776 | ||
1791 | if (!capable(CAP_SYS_RAWIO)) | 1777 | if (!capable(CAP_SYS_RAWIO)) |
1792 | return -EPERM; | 1778 | return -EPERM; |
1793 | 1779 | ||
1780 | drv = &h->drv[drv_index]; | ||
1781 | disk = h->gendisk[drv_index]; | ||
1782 | |||
1794 | /* make sure logical volume is NOT is use */ | 1783 | /* make sure logical volume is NOT is use */ |
1795 | if (clear_all || (h->gendisk[0] == disk)) { | 1784 | if (clear_all || (h->gendisk[0] == disk)) { |
1796 | if (drv->usage_count > 1) | 1785 | if (drv->usage_count > 1) |
@@ -2548,7 +2537,8 @@ static void start_io(ctlr_info_t *h) | |||
2548 | { | 2537 | { |
2549 | CommandList_struct *c; | 2538 | CommandList_struct *c; |
2550 | 2539 | ||
2551 | while ((c = h->reqQ) != NULL) { | 2540 | while (!hlist_empty(&h->reqQ)) { |
2541 | c = hlist_entry(h->reqQ.first, CommandList_struct, list); | ||
2552 | /* can't do anything if fifo is full */ | 2542 | /* can't do anything if fifo is full */ |
2553 | if ((h->access.fifo_full(h))) { | 2543 | if ((h->access.fifo_full(h))) { |
2554 | printk(KERN_WARNING "cciss: fifo full\n"); | 2544 | printk(KERN_WARNING "cciss: fifo full\n"); |
@@ -2556,14 +2546,14 @@ static void start_io(ctlr_info_t *h) | |||
2556 | } | 2546 | } |
2557 | 2547 | ||
2558 | /* Get the first entry from the Request Q */ | 2548 | /* Get the first entry from the Request Q */ |
2559 | removeQ(&(h->reqQ), c); | 2549 | removeQ(c); |
2560 | h->Qdepth--; | 2550 | h->Qdepth--; |
2561 | 2551 | ||
2562 | /* Tell the controller execute command */ | 2552 | /* Tell the controller execute command */ |
2563 | h->access.submit_command(h, c); | 2553 | h->access.submit_command(h, c); |
2564 | 2554 | ||
2565 | /* Put job onto the completed Q */ | 2555 | /* Put job onto the completed Q */ |
2566 | addQ(&(h->cmpQ), c); | 2556 | addQ(&h->cmpQ, c); |
2567 | } | 2557 | } |
2568 | } | 2558 | } |
2569 | 2559 | ||
@@ -2576,7 +2566,7 @@ static inline void resend_cciss_cmd(ctlr_info_t *h, CommandList_struct *c) | |||
2576 | memset(c->err_info, 0, sizeof(ErrorInfo_struct)); | 2566 | memset(c->err_info, 0, sizeof(ErrorInfo_struct)); |
2577 | 2567 | ||
2578 | /* add it to software queue and then send it to the controller */ | 2568 | /* add it to software queue and then send it to the controller */ |
2579 | addQ(&(h->reqQ), c); | 2569 | addQ(&h->reqQ, c); |
2580 | h->Qdepth++; | 2570 | h->Qdepth++; |
2581 | if (h->Qdepth > h->maxQsinceinit) | 2571 | if (h->Qdepth > h->maxQsinceinit) |
2582 | h->maxQsinceinit = h->Qdepth; | 2572 | h->maxQsinceinit = h->Qdepth; |
@@ -2897,7 +2887,7 @@ static void do_cciss_request(struct request_queue *q) | |||
2897 | 2887 | ||
2898 | spin_lock_irq(q->queue_lock); | 2888 | spin_lock_irq(q->queue_lock); |
2899 | 2889 | ||
2900 | addQ(&(h->reqQ), c); | 2890 | addQ(&h->reqQ, c); |
2901 | h->Qdepth++; | 2891 | h->Qdepth++; |
2902 | if (h->Qdepth > h->maxQsinceinit) | 2892 | if (h->Qdepth > h->maxQsinceinit) |
2903 | h->maxQsinceinit = h->Qdepth; | 2893 | h->maxQsinceinit = h->Qdepth; |
@@ -2985,16 +2975,12 @@ static irqreturn_t do_cciss_intr(int irq, void *dev_id) | |||
2985 | a = c->busaddr; | 2975 | a = c->busaddr; |
2986 | 2976 | ||
2987 | } else { | 2977 | } else { |
2978 | struct hlist_node *tmp; | ||
2979 | |||
2988 | a &= ~3; | 2980 | a &= ~3; |
2989 | if ((c = h->cmpQ) == NULL) { | 2981 | c = NULL; |
2990 | printk(KERN_WARNING | 2982 | hlist_for_each_entry(c, tmp, &h->cmpQ, list) { |
2991 | "cciss: Completion of %08x ignored\n", | 2983 | if (c->busaddr == a) |
2992 | a1); | ||
2993 | continue; | ||
2994 | } | ||
2995 | while (c->busaddr != a) { | ||
2996 | c = c->next; | ||
2997 | if (c == h->cmpQ) | ||
2998 | break; | 2984 | break; |
2999 | } | 2985 | } |
3000 | } | 2986 | } |
@@ -3002,8 +2988,8 @@ static irqreturn_t do_cciss_intr(int irq, void *dev_id) | |||
3002 | * If we've found the command, take it off the | 2988 | * If we've found the command, take it off the |
3003 | * completion Q and free it | 2989 | * completion Q and free it |
3004 | */ | 2990 | */ |
3005 | if (c->busaddr == a) { | 2991 | if (c && c->busaddr == a) { |
3006 | removeQ(&h->cmpQ, c); | 2992 | removeQ(c); |
3007 | if (c->cmd_type == CMD_RWREQ) { | 2993 | if (c->cmd_type == CMD_RWREQ) { |
3008 | complete_command(h, c, 0); | 2994 | complete_command(h, c, 0); |
3009 | } else if (c->cmd_type == CMD_IOCTL_PEND) { | 2995 | } else if (c->cmd_type == CMD_IOCTL_PEND) { |
@@ -3423,6 +3409,8 @@ static int __devinit cciss_init_one(struct pci_dev *pdev, | |||
3423 | return -1; | 3409 | return -1; |
3424 | 3410 | ||
3425 | hba[i]->busy_initializing = 1; | 3411 | hba[i]->busy_initializing = 1; |
3412 | INIT_HLIST_HEAD(&hba[i]->cmpQ); | ||
3413 | INIT_HLIST_HEAD(&hba[i]->reqQ); | ||
3426 | 3414 | ||
3427 | if (cciss_pci_init(hba[i], pdev) != 0) | 3415 | if (cciss_pci_init(hba[i], pdev) != 0) |
3428 | goto clean1; | 3416 | goto clean1; |
@@ -3730,15 +3718,17 @@ static void fail_all_cmds(unsigned long ctlr) | |||
3730 | pci_disable_device(h->pdev); /* Make sure it is really dead. */ | 3718 | pci_disable_device(h->pdev); /* Make sure it is really dead. */ |
3731 | 3719 | ||
3732 | /* move everything off the request queue onto the completed queue */ | 3720 | /* move everything off the request queue onto the completed queue */ |
3733 | while ((c = h->reqQ) != NULL) { | 3721 | while (!hlist_empty(&h->reqQ)) { |
3734 | removeQ(&(h->reqQ), c); | 3722 | c = hlist_entry(h->reqQ.first, CommandList_struct, list); |
3723 | removeQ(c); | ||
3735 | h->Qdepth--; | 3724 | h->Qdepth--; |
3736 | addQ(&(h->cmpQ), c); | 3725 | addQ(&h->cmpQ, c); |
3737 | } | 3726 | } |
3738 | 3727 | ||
3739 | /* Now, fail everything on the completed queue with a HW error */ | 3728 | /* Now, fail everything on the completed queue with a HW error */ |
3740 | while ((c = h->cmpQ) != NULL) { | 3729 | while (!hlist_empty(&h->cmpQ)) { |
3741 | removeQ(&h->cmpQ, c); | 3730 | c = hlist_entry(h->cmpQ.first, CommandList_struct, list); |
3731 | removeQ(c); | ||
3742 | c->err_info->CommandStatus = CMD_HARDWARE_ERR; | 3732 | c->err_info->CommandStatus = CMD_HARDWARE_ERR; |
3743 | if (c->cmd_type == CMD_RWREQ) { | 3733 | if (c->cmd_type == CMD_RWREQ) { |
3744 | complete_command(h, c, 0); | 3734 | complete_command(h, c, 0); |
diff --git a/drivers/block/cciss.h b/drivers/block/cciss.h index 24a7efa993ab..15e2b84734e3 100644 --- a/drivers/block/cciss.h +++ b/drivers/block/cciss.h | |||
@@ -89,8 +89,8 @@ struct ctlr_info | |||
89 | struct access_method access; | 89 | struct access_method access; |
90 | 90 | ||
91 | /* queue and queue Info */ | 91 | /* queue and queue Info */ |
92 | CommandList_struct *reqQ; | 92 | struct hlist_head reqQ; |
93 | CommandList_struct *cmpQ; | 93 | struct hlist_head cmpQ; |
94 | unsigned int Qdepth; | 94 | unsigned int Qdepth; |
95 | unsigned int maxQsinceinit; | 95 | unsigned int maxQsinceinit; |
96 | unsigned int maxSG; | 96 | unsigned int maxSG; |
diff --git a/drivers/block/cciss_cmd.h b/drivers/block/cciss_cmd.h index 43bf5593b59b..24e22dea1a99 100644 --- a/drivers/block/cciss_cmd.h +++ b/drivers/block/cciss_cmd.h | |||
@@ -265,8 +265,7 @@ typedef struct _CommandList_struct { | |||
265 | int ctlr; | 265 | int ctlr; |
266 | int cmd_type; | 266 | int cmd_type; |
267 | long cmdindex; | 267 | long cmdindex; |
268 | struct _CommandList_struct *prev; | 268 | struct hlist_node list; |
269 | struct _CommandList_struct *next; | ||
270 | struct request * rq; | 269 | struct request * rq; |
271 | struct completion *waiting; | 270 | struct completion *waiting; |
272 | int retry_count; | 271 | int retry_count; |
diff --git a/drivers/block/loop.c b/drivers/block/loop.c index fb06ed659212..edbaac6c0573 100644 --- a/drivers/block/loop.c +++ b/drivers/block/loop.c | |||
@@ -624,20 +624,38 @@ static int loop_switch(struct loop_device *lo, struct file *file) | |||
624 | } | 624 | } |
625 | 625 | ||
626 | /* | 626 | /* |
627 | * Helper to flush the IOs in loop, but keeping loop thread running | ||
628 | */ | ||
629 | static int loop_flush(struct loop_device *lo) | ||
630 | { | ||
631 | /* loop not yet configured, no running thread, nothing to flush */ | ||
632 | if (!lo->lo_thread) | ||
633 | return 0; | ||
634 | |||
635 | return loop_switch(lo, NULL); | ||
636 | } | ||
637 | |||
638 | /* | ||
627 | * Do the actual switch; called from the BIO completion routine | 639 | * Do the actual switch; called from the BIO completion routine |
628 | */ | 640 | */ |
629 | static void do_loop_switch(struct loop_device *lo, struct switch_request *p) | 641 | static void do_loop_switch(struct loop_device *lo, struct switch_request *p) |
630 | { | 642 | { |
631 | struct file *file = p->file; | 643 | struct file *file = p->file; |
632 | struct file *old_file = lo->lo_backing_file; | 644 | struct file *old_file = lo->lo_backing_file; |
633 | struct address_space *mapping = file->f_mapping; | 645 | struct address_space *mapping; |
646 | |||
647 | /* if no new file, only flush of queued bios requested */ | ||
648 | if (!file) | ||
649 | goto out; | ||
634 | 650 | ||
651 | mapping = file->f_mapping; | ||
635 | mapping_set_gfp_mask(old_file->f_mapping, lo->old_gfp_mask); | 652 | mapping_set_gfp_mask(old_file->f_mapping, lo->old_gfp_mask); |
636 | lo->lo_backing_file = file; | 653 | lo->lo_backing_file = file; |
637 | lo->lo_blocksize = S_ISBLK(mapping->host->i_mode) ? | 654 | lo->lo_blocksize = S_ISBLK(mapping->host->i_mode) ? |
638 | mapping->host->i_bdev->bd_block_size : PAGE_SIZE; | 655 | mapping->host->i_bdev->bd_block_size : PAGE_SIZE; |
639 | lo->old_gfp_mask = mapping_gfp_mask(mapping); | 656 | lo->old_gfp_mask = mapping_gfp_mask(mapping); |
640 | mapping_set_gfp_mask(mapping, lo->old_gfp_mask & ~(__GFP_IO|__GFP_FS)); | 657 | mapping_set_gfp_mask(mapping, lo->old_gfp_mask & ~(__GFP_IO|__GFP_FS)); |
658 | out: | ||
641 | complete(&p->wait); | 659 | complete(&p->wait); |
642 | } | 660 | } |
643 | 661 | ||
@@ -901,6 +919,7 @@ static int loop_clr_fd(struct loop_device *lo, struct block_device *bdev) | |||
901 | 919 | ||
902 | kthread_stop(lo->lo_thread); | 920 | kthread_stop(lo->lo_thread); |
903 | 921 | ||
922 | lo->lo_queue->unplug_fn = NULL; | ||
904 | lo->lo_backing_file = NULL; | 923 | lo->lo_backing_file = NULL; |
905 | 924 | ||
906 | loop_release_xfer(lo); | 925 | loop_release_xfer(lo); |
@@ -1345,11 +1364,25 @@ static int lo_release(struct gendisk *disk, fmode_t mode) | |||
1345 | struct loop_device *lo = disk->private_data; | 1364 | struct loop_device *lo = disk->private_data; |
1346 | 1365 | ||
1347 | mutex_lock(&lo->lo_ctl_mutex); | 1366 | mutex_lock(&lo->lo_ctl_mutex); |
1348 | --lo->lo_refcnt; | ||
1349 | 1367 | ||
1350 | if ((lo->lo_flags & LO_FLAGS_AUTOCLEAR) && !lo->lo_refcnt) | 1368 | if (--lo->lo_refcnt) |
1369 | goto out; | ||
1370 | |||
1371 | if (lo->lo_flags & LO_FLAGS_AUTOCLEAR) { | ||
1372 | /* | ||
1373 | * In autoclear mode, stop the loop thread | ||
1374 | * and remove configuration after last close. | ||
1375 | */ | ||
1351 | loop_clr_fd(lo, NULL); | 1376 | loop_clr_fd(lo, NULL); |
1377 | } else { | ||
1378 | /* | ||
1379 | * Otherwise keep thread (if running) and config, | ||
1380 | * but flush possible ongoing bios in thread. | ||
1381 | */ | ||
1382 | loop_flush(lo); | ||
1383 | } | ||
1352 | 1384 | ||
1385 | out: | ||
1353 | mutex_unlock(&lo->lo_ctl_mutex); | 1386 | mutex_unlock(&lo->lo_ctl_mutex); |
1354 | 1387 | ||
1355 | return 0; | 1388 | return 0; |
diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c index d3a91cacee8c..7bcc1d8bc967 100644 --- a/drivers/block/nbd.c +++ b/drivers/block/nbd.c | |||
@@ -722,7 +722,6 @@ static int __init nbd_init(void) | |||
722 | 722 | ||
723 | for (i = 0; i < nbds_max; i++) { | 723 | for (i = 0; i < nbds_max; i++) { |
724 | struct gendisk *disk = alloc_disk(1 << part_shift); | 724 | struct gendisk *disk = alloc_disk(1 << part_shift); |
725 | elevator_t *old_e; | ||
726 | if (!disk) | 725 | if (!disk) |
727 | goto out; | 726 | goto out; |
728 | nbd_dev[i].disk = disk; | 727 | nbd_dev[i].disk = disk; |
@@ -736,11 +735,10 @@ static int __init nbd_init(void) | |||
736 | put_disk(disk); | 735 | put_disk(disk); |
737 | goto out; | 736 | goto out; |
738 | } | 737 | } |
739 | old_e = disk->queue->elevator; | 738 | /* |
740 | if (elevator_init(disk->queue, "deadline") == 0 || | 739 | * Tell the block layer that we are not a rotational device |
741 | elevator_init(disk->queue, "noop") == 0) { | 740 | */ |
742 | elevator_exit(old_e); | 741 | queue_flag_set_unlocked(QUEUE_FLAG_NONROT, disk->queue); |
743 | } | ||
744 | } | 742 | } |
745 | 743 | ||
746 | if (register_blkdev(NBD_MAJOR, "nbd")) { | 744 | if (register_blkdev(NBD_MAJOR, "nbd")) { |
diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c index 300078b02e5d..5d34764c8a87 100644 --- a/drivers/block/virtio_blk.c +++ b/drivers/block/virtio_blk.c | |||
@@ -249,6 +249,8 @@ static int virtblk_probe(struct virtio_device *vdev) | |||
249 | goto out_put_disk; | 249 | goto out_put_disk; |
250 | } | 250 | } |
251 | 251 | ||
252 | queue_flag_set_unlocked(QUEUE_FLAG_VIRT, vblk->disk->queue); | ||
253 | |||
252 | if (index < 26) { | 254 | if (index < 26) { |
253 | sprintf(vblk->disk->disk_name, "vd%c", 'a' + index % 26); | 255 | sprintf(vblk->disk->disk_name, "vd%c", 'a' + index % 26); |
254 | } else if (index < (26 + 1) * 26) { | 256 | } else if (index < (26 + 1) * 26) { |
diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c index 2d19f0cc47f2..918ef725de41 100644 --- a/drivers/block/xen-blkfront.c +++ b/drivers/block/xen-blkfront.c | |||
@@ -338,18 +338,12 @@ wait: | |||
338 | static int xlvbd_init_blk_queue(struct gendisk *gd, u16 sector_size) | 338 | static int xlvbd_init_blk_queue(struct gendisk *gd, u16 sector_size) |
339 | { | 339 | { |
340 | struct request_queue *rq; | 340 | struct request_queue *rq; |
341 | elevator_t *old_e; | ||
342 | 341 | ||
343 | rq = blk_init_queue(do_blkif_request, &blkif_io_lock); | 342 | rq = blk_init_queue(do_blkif_request, &blkif_io_lock); |
344 | if (rq == NULL) | 343 | if (rq == NULL) |
345 | return -1; | 344 | return -1; |
346 | 345 | ||
347 | old_e = rq->elevator; | 346 | queue_flag_set_unlocked(QUEUE_FLAG_VIRT, rq); |
348 | if (IS_ERR_VALUE(elevator_init(rq, "noop"))) | ||
349 | printk(KERN_WARNING | ||
350 | "blkfront: Switch elevator failed, use default\n"); | ||
351 | else | ||
352 | elevator_exit(old_e); | ||
353 | 347 | ||
354 | /* Hard sector size and max sectors impersonate the equiv. hardware. */ | 348 | /* Hard sector size and max sectors impersonate the equiv. hardware. */ |
355 | blk_queue_hardsect_size(rq, sector_size); | 349 | blk_queue_hardsect_size(rq, sector_size); |