diff options
Diffstat (limited to 'block')
-rw-r--r-- | block/blk-merge.c | 5 | ||||
-rw-r--r-- | block/elevator.c | 4 | ||||
-rw-r--r-- | block/scsi_ioctl.c | 3 |
3 files changed, 7 insertions, 5 deletions
diff --git a/block/blk-merge.c b/block/blk-merge.c index ba99351c0f58..b3ac40aef46b 100644 --- a/block/blk-merge.c +++ b/block/blk-merge.c | |||
@@ -99,16 +99,17 @@ void blk_recount_segments(struct request_queue *q, struct bio *bio) | |||
99 | { | 99 | { |
100 | bool no_sg_merge = !!test_bit(QUEUE_FLAG_NO_SG_MERGE, | 100 | bool no_sg_merge = !!test_bit(QUEUE_FLAG_NO_SG_MERGE, |
101 | &q->queue_flags); | 101 | &q->queue_flags); |
102 | bool merge_not_need = bio->bi_vcnt < queue_max_segments(q); | ||
102 | 103 | ||
103 | if (no_sg_merge && !bio_flagged(bio, BIO_CLONED) && | 104 | if (no_sg_merge && !bio_flagged(bio, BIO_CLONED) && |
104 | bio->bi_vcnt < queue_max_segments(q)) | 105 | merge_not_need) |
105 | bio->bi_phys_segments = bio->bi_vcnt; | 106 | bio->bi_phys_segments = bio->bi_vcnt; |
106 | else { | 107 | else { |
107 | struct bio *nxt = bio->bi_next; | 108 | struct bio *nxt = bio->bi_next; |
108 | 109 | ||
109 | bio->bi_next = NULL; | 110 | bio->bi_next = NULL; |
110 | bio->bi_phys_segments = __blk_recalc_rq_segments(q, bio, | 111 | bio->bi_phys_segments = __blk_recalc_rq_segments(q, bio, |
111 | no_sg_merge); | 112 | no_sg_merge && merge_not_need); |
112 | bio->bi_next = nxt; | 113 | bio->bi_next = nxt; |
113 | } | 114 | } |
114 | 115 | ||
diff --git a/block/elevator.c b/block/elevator.c index 24c28b659bb3..afa3b037a17c 100644 --- a/block/elevator.c +++ b/block/elevator.c | |||
@@ -229,7 +229,9 @@ int elevator_init(struct request_queue *q, char *name) | |||
229 | } | 229 | } |
230 | 230 | ||
231 | err = e->ops.elevator_init_fn(q, e); | 231 | err = e->ops.elevator_init_fn(q, e); |
232 | return 0; | 232 | if (err) |
233 | elevator_put(e); | ||
234 | return err; | ||
233 | } | 235 | } |
234 | EXPORT_SYMBOL(elevator_init); | 236 | EXPORT_SYMBOL(elevator_init); |
235 | 237 | ||
diff --git a/block/scsi_ioctl.c b/block/scsi_ioctl.c index abb2e65b24cc..1e053d911240 100644 --- a/block/scsi_ioctl.c +++ b/block/scsi_ioctl.c | |||
@@ -508,7 +508,7 @@ int sg_scsi_ioctl(struct request_queue *q, struct gendisk *disk, fmode_t mode, | |||
508 | 508 | ||
509 | if (bytes && blk_rq_map_kern(q, rq, buffer, bytes, __GFP_WAIT)) { | 509 | if (bytes && blk_rq_map_kern(q, rq, buffer, bytes, __GFP_WAIT)) { |
510 | err = DRIVER_ERROR << 24; | 510 | err = DRIVER_ERROR << 24; |
511 | goto out; | 511 | goto error; |
512 | } | 512 | } |
513 | 513 | ||
514 | memset(sense, 0, sizeof(sense)); | 514 | memset(sense, 0, sizeof(sense)); |
@@ -517,7 +517,6 @@ int sg_scsi_ioctl(struct request_queue *q, struct gendisk *disk, fmode_t mode, | |||
517 | 517 | ||
518 | blk_execute_rq(q, disk, rq, 0); | 518 | blk_execute_rq(q, disk, rq, 0); |
519 | 519 | ||
520 | out: | ||
521 | err = rq->errors & 0xff; /* only 8 bit SCSI status */ | 520 | err = rq->errors & 0xff; /* only 8 bit SCSI status */ |
522 | if (err) { | 521 | if (err) { |
523 | if (rq->sense_len && rq->sense) { | 522 | if (rq->sense_len && rq->sense) { |