diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2011-07-25 13:38:18 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-07-25 13:38:18 -0400 |
commit | 8ded371f81fba8b38a049f8c5f30ce6438fc7b75 (patch) | |
tree | 0684d176cb6f35c92c4bf0185b1af9f5380077eb | |
parent | 096a705bbc080a4041636d07514560da8d78acbe (diff) | |
parent | 07d0c38e7d84f911c72058a124c7f17b3c779a65 (diff) |
Merge branch 'for-3.1/drivers' of git://git.kernel.dk/linux-block
* 'for-3.1/drivers' of git://git.kernel.dk/linux-block:
cciss: do not attempt to read from a write-only register
xen/blkback: Add module alias for autoloading
xen/blkback: Don't let in-flight requests defer pending ones.
bsg: fix address space warning from sparse
bsg: remove unnecessary conditional expressions
bsg: fix bsg_poll() to return POLLOUT properly
-rw-r--r-- | block/bsg.c | 18 | ||||
-rw-r--r-- | drivers/block/cciss.h | 2 | ||||
-rw-r--r-- | drivers/block/xen-blkback/blkback.c | 37 |
3 files changed, 30 insertions, 27 deletions
diff --git a/block/bsg.c b/block/bsg.c index 0c8b64a16484..702f1316bb8f 100644 --- a/block/bsg.c +++ b/block/bsg.c | |||
@@ -182,7 +182,7 @@ static int blk_fill_sgv4_hdr_rq(struct request_queue *q, struct request *rq, | |||
182 | return -ENOMEM; | 182 | return -ENOMEM; |
183 | } | 183 | } |
184 | 184 | ||
185 | if (copy_from_user(rq->cmd, (void *)(unsigned long)hdr->request, | 185 | if (copy_from_user(rq->cmd, (void __user *)(unsigned long)hdr->request, |
186 | hdr->request_len)) | 186 | hdr->request_len)) |
187 | return -EFAULT; | 187 | return -EFAULT; |
188 | 188 | ||
@@ -249,7 +249,7 @@ bsg_map_hdr(struct bsg_device *bd, struct sg_io_v4 *hdr, fmode_t has_write_perm, | |||
249 | struct request *rq, *next_rq = NULL; | 249 | struct request *rq, *next_rq = NULL; |
250 | int ret, rw; | 250 | int ret, rw; |
251 | unsigned int dxfer_len; | 251 | unsigned int dxfer_len; |
252 | void *dxferp = NULL; | 252 | void __user *dxferp = NULL; |
253 | struct bsg_class_device *bcd = &q->bsg_dev; | 253 | struct bsg_class_device *bcd = &q->bsg_dev; |
254 | 254 | ||
255 | /* if the LLD has been removed then the bsg_unregister_queue will | 255 | /* if the LLD has been removed then the bsg_unregister_queue will |
@@ -291,7 +291,7 @@ bsg_map_hdr(struct bsg_device *bd, struct sg_io_v4 *hdr, fmode_t has_write_perm, | |||
291 | rq->next_rq = next_rq; | 291 | rq->next_rq = next_rq; |
292 | next_rq->cmd_type = rq->cmd_type; | 292 | next_rq->cmd_type = rq->cmd_type; |
293 | 293 | ||
294 | dxferp = (void*)(unsigned long)hdr->din_xferp; | 294 | dxferp = (void __user *)(unsigned long)hdr->din_xferp; |
295 | ret = blk_rq_map_user(q, next_rq, NULL, dxferp, | 295 | ret = blk_rq_map_user(q, next_rq, NULL, dxferp, |
296 | hdr->din_xfer_len, GFP_KERNEL); | 296 | hdr->din_xfer_len, GFP_KERNEL); |
297 | if (ret) | 297 | if (ret) |
@@ -300,10 +300,10 @@ bsg_map_hdr(struct bsg_device *bd, struct sg_io_v4 *hdr, fmode_t has_write_perm, | |||
300 | 300 | ||
301 | if (hdr->dout_xfer_len) { | 301 | if (hdr->dout_xfer_len) { |
302 | dxfer_len = hdr->dout_xfer_len; | 302 | dxfer_len = hdr->dout_xfer_len; |
303 | dxferp = (void*)(unsigned long)hdr->dout_xferp; | 303 | dxferp = (void __user *)(unsigned long)hdr->dout_xferp; |
304 | } else if (hdr->din_xfer_len) { | 304 | } else if (hdr->din_xfer_len) { |
305 | dxfer_len = hdr->din_xfer_len; | 305 | dxfer_len = hdr->din_xfer_len; |
306 | dxferp = (void*)(unsigned long)hdr->din_xferp; | 306 | dxferp = (void __user *)(unsigned long)hdr->din_xferp; |
307 | } else | 307 | } else |
308 | dxfer_len = 0; | 308 | dxfer_len = 0; |
309 | 309 | ||
@@ -445,7 +445,7 @@ static int blk_complete_sgv4_hdr_rq(struct request *rq, struct sg_io_v4 *hdr, | |||
445 | int len = min_t(unsigned int, hdr->max_response_len, | 445 | int len = min_t(unsigned int, hdr->max_response_len, |
446 | rq->sense_len); | 446 | rq->sense_len); |
447 | 447 | ||
448 | ret = copy_to_user((void*)(unsigned long)hdr->response, | 448 | ret = copy_to_user((void __user *)(unsigned long)hdr->response, |
449 | rq->sense, len); | 449 | rq->sense, len); |
450 | if (!ret) | 450 | if (!ret) |
451 | hdr->response_len = len; | 451 | hdr->response_len = len; |
@@ -606,7 +606,7 @@ bsg_read(struct file *file, char __user *buf, size_t count, loff_t *ppos) | |||
606 | ret = __bsg_read(buf, count, bd, NULL, &bytes_read); | 606 | ret = __bsg_read(buf, count, bd, NULL, &bytes_read); |
607 | *ppos = bytes_read; | 607 | *ppos = bytes_read; |
608 | 608 | ||
609 | if (!bytes_read || (bytes_read && err_block_err(ret))) | 609 | if (!bytes_read || err_block_err(ret)) |
610 | bytes_read = ret; | 610 | bytes_read = ret; |
611 | 611 | ||
612 | return bytes_read; | 612 | return bytes_read; |
@@ -686,7 +686,7 @@ bsg_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos) | |||
686 | /* | 686 | /* |
687 | * return bytes written on non-fatal errors | 687 | * return bytes written on non-fatal errors |
688 | */ | 688 | */ |
689 | if (!bytes_written || (bytes_written && err_block_err(ret))) | 689 | if (!bytes_written || err_block_err(ret)) |
690 | bytes_written = ret; | 690 | bytes_written = ret; |
691 | 691 | ||
692 | dprintk("%s: returning %Zd\n", bd->name, bytes_written); | 692 | dprintk("%s: returning %Zd\n", bd->name, bytes_written); |
@@ -878,7 +878,7 @@ static unsigned int bsg_poll(struct file *file, poll_table *wait) | |||
878 | spin_lock_irq(&bd->lock); | 878 | spin_lock_irq(&bd->lock); |
879 | if (!list_empty(&bd->done_list)) | 879 | if (!list_empty(&bd->done_list)) |
880 | mask |= POLLIN | POLLRDNORM; | 880 | mask |= POLLIN | POLLRDNORM; |
881 | if (bd->queued_cmds >= bd->max_queue) | 881 | if (bd->queued_cmds < bd->max_queue) |
882 | mask |= POLLOUT; | 882 | mask |= POLLOUT; |
883 | spin_unlock_irq(&bd->lock); | 883 | spin_unlock_irq(&bd->lock); |
884 | 884 | ||
diff --git a/drivers/block/cciss.h b/drivers/block/cciss.h index 16b4d58d84dd..c049548e68b7 100644 --- a/drivers/block/cciss.h +++ b/drivers/block/cciss.h | |||
@@ -223,7 +223,7 @@ static void SA5_submit_command( ctlr_info_t *h, CommandList_struct *c) | |||
223 | h->ctlr, c->busaddr); | 223 | h->ctlr, c->busaddr); |
224 | #endif /* CCISS_DEBUG */ | 224 | #endif /* CCISS_DEBUG */ |
225 | writel(c->busaddr, h->vaddr + SA5_REQUEST_PORT_OFFSET); | 225 | writel(c->busaddr, h->vaddr + SA5_REQUEST_PORT_OFFSET); |
226 | readl(h->vaddr + SA5_REQUEST_PORT_OFFSET); | 226 | readl(h->vaddr + SA5_SCRATCHPAD_OFFSET); |
227 | h->commands_outstanding++; | 227 | h->commands_outstanding++; |
228 | if ( h->commands_outstanding > h->max_outstanding) | 228 | if ( h->commands_outstanding > h->max_outstanding) |
229 | h->max_outstanding = h->commands_outstanding; | 229 | h->max_outstanding = h->commands_outstanding; |
diff --git a/drivers/block/xen-blkback/blkback.c b/drivers/block/xen-blkback/blkback.c index 5cf2993a8338..2330a9ad5e95 100644 --- a/drivers/block/xen-blkback/blkback.c +++ b/drivers/block/xen-blkback/blkback.c | |||
@@ -458,7 +458,8 @@ static void end_block_io_op(struct bio *bio, int error) | |||
458 | * (which has the sectors we want, number of them, grant references, etc), | 458 | * (which has the sectors we want, number of them, grant references, etc), |
459 | * and transmute it to the block API to hand it over to the proper block disk. | 459 | * and transmute it to the block API to hand it over to the proper block disk. |
460 | */ | 460 | */ |
461 | static int do_block_io_op(struct xen_blkif *blkif) | 461 | static int |
462 | __do_block_io_op(struct xen_blkif *blkif) | ||
462 | { | 463 | { |
463 | union blkif_back_rings *blk_rings = &blkif->blk_rings; | 464 | union blkif_back_rings *blk_rings = &blkif->blk_rings; |
464 | struct blkif_request req; | 465 | struct blkif_request req; |
@@ -515,6 +516,23 @@ static int do_block_io_op(struct xen_blkif *blkif) | |||
515 | return more_to_do; | 516 | return more_to_do; |
516 | } | 517 | } |
517 | 518 | ||
519 | static int | ||
520 | do_block_io_op(struct xen_blkif *blkif) | ||
521 | { | ||
522 | union blkif_back_rings *blk_rings = &blkif->blk_rings; | ||
523 | int more_to_do; | ||
524 | |||
525 | do { | ||
526 | more_to_do = __do_block_io_op(blkif); | ||
527 | if (more_to_do) | ||
528 | break; | ||
529 | |||
530 | RING_FINAL_CHECK_FOR_REQUESTS(&blk_rings->common, more_to_do); | ||
531 | } while (more_to_do); | ||
532 | |||
533 | return more_to_do; | ||
534 | } | ||
535 | |||
518 | /* | 536 | /* |
519 | * Transmutation of the 'struct blkif_request' to a proper 'struct bio' | 537 | * Transmutation of the 'struct blkif_request' to a proper 'struct bio' |
520 | * and call the 'submit_bio' to pass it to the underlying storage. | 538 | * and call the 'submit_bio' to pass it to the underlying storage. |
@@ -700,7 +718,6 @@ static void make_response(struct xen_blkif *blkif, u64 id, | |||
700 | struct blkif_response resp; | 718 | struct blkif_response resp; |
701 | unsigned long flags; | 719 | unsigned long flags; |
702 | union blkif_back_rings *blk_rings = &blkif->blk_rings; | 720 | union blkif_back_rings *blk_rings = &blkif->blk_rings; |
703 | int more_to_do = 0; | ||
704 | int notify; | 721 | int notify; |
705 | 722 | ||
706 | resp.id = id; | 723 | resp.id = id; |
@@ -727,22 +744,7 @@ static void make_response(struct xen_blkif *blkif, u64 id, | |||
727 | } | 744 | } |
728 | blk_rings->common.rsp_prod_pvt++; | 745 | blk_rings->common.rsp_prod_pvt++; |
729 | RING_PUSH_RESPONSES_AND_CHECK_NOTIFY(&blk_rings->common, notify); | 746 | RING_PUSH_RESPONSES_AND_CHECK_NOTIFY(&blk_rings->common, notify); |
730 | if (blk_rings->common.rsp_prod_pvt == blk_rings->common.req_cons) { | ||
731 | /* | ||
732 | * Tail check for pending requests. Allows frontend to avoid | ||
733 | * notifications if requests are already in flight (lower | ||
734 | * overheads and promotes batching). | ||
735 | */ | ||
736 | RING_FINAL_CHECK_FOR_REQUESTS(&blk_rings->common, more_to_do); | ||
737 | |||
738 | } else if (RING_HAS_UNCONSUMED_REQUESTS(&blk_rings->common)) { | ||
739 | more_to_do = 1; | ||
740 | } | ||
741 | |||
742 | spin_unlock_irqrestore(&blkif->blk_ring_lock, flags); | 747 | spin_unlock_irqrestore(&blkif->blk_ring_lock, flags); |
743 | |||
744 | if (more_to_do) | ||
745 | blkif_notify_work(blkif); | ||
746 | if (notify) | 748 | if (notify) |
747 | notify_remote_via_irq(blkif->irq); | 749 | notify_remote_via_irq(blkif->irq); |
748 | } | 750 | } |
@@ -824,3 +826,4 @@ static int __init xen_blkif_init(void) | |||
824 | module_init(xen_blkif_init); | 826 | module_init(xen_blkif_init); |
825 | 827 | ||
826 | MODULE_LICENSE("Dual BSD/GPL"); | 828 | MODULE_LICENSE("Dual BSD/GPL"); |
829 | MODULE_ALIAS("xen-backend:vbd"); | ||