diff options
Diffstat (limited to 'block')
-rw-r--r-- | block/blk-map.c | 6 | ||||
-rw-r--r-- | block/blk-merge.c | 2 | ||||
-rw-r--r-- | block/blk-mq-tag.c | 6 | ||||
-rw-r--r-- | block/blk-mq.c | 4 | ||||
-rw-r--r-- | block/blk-settings.c | 6 | ||||
-rw-r--r-- | block/scsi_ioctl.c | 12 |
6 files changed, 17 insertions, 19 deletions
diff --git a/block/blk-map.c b/block/blk-map.c index b8d2725324a6..da310a105429 100644 --- a/block/blk-map.c +++ b/block/blk-map.c | |||
@@ -124,10 +124,10 @@ int blk_rq_map_user(struct request_queue *q, struct request *rq, | |||
124 | { | 124 | { |
125 | struct iovec iov; | 125 | struct iovec iov; |
126 | struct iov_iter i; | 126 | struct iov_iter i; |
127 | int ret = import_single_range(rq_data_dir(rq), ubuf, len, &iov, &i); | ||
127 | 128 | ||
128 | iov.iov_base = ubuf; | 129 | if (unlikely(ret < 0)) |
129 | iov.iov_len = len; | 130 | return ret; |
130 | iov_iter_init(&i, rq_data_dir(rq), &iov, 1, len); | ||
131 | 131 | ||
132 | return blk_rq_map_user_iov(q, rq, map_data, &i, gfp_mask); | 132 | return blk_rq_map_user_iov(q, rq, map_data, &i, gfp_mask); |
133 | } | 133 | } |
diff --git a/block/blk-merge.c b/block/blk-merge.c index fc1ff3b1ea1f..fd3fee81c23c 100644 --- a/block/blk-merge.c +++ b/block/blk-merge.c | |||
@@ -592,7 +592,7 @@ bool blk_rq_merge_ok(struct request *rq, struct bio *bio) | |||
592 | if (q->queue_flags & (1 << QUEUE_FLAG_SG_GAPS)) { | 592 | if (q->queue_flags & (1 << QUEUE_FLAG_SG_GAPS)) { |
593 | struct bio_vec *bprev; | 593 | struct bio_vec *bprev; |
594 | 594 | ||
595 | bprev = &rq->biotail->bi_io_vec[bio->bi_vcnt - 1]; | 595 | bprev = &rq->biotail->bi_io_vec[rq->biotail->bi_vcnt - 1]; |
596 | if (bvec_gap_to_prev(bprev, bio->bi_io_vec[0].bv_offset)) | 596 | if (bvec_gap_to_prev(bprev, bio->bi_io_vec[0].bv_offset)) |
597 | return false; | 597 | return false; |
598 | } | 598 | } |
diff --git a/block/blk-mq-tag.c b/block/blk-mq-tag.c index d53a764b05ea..be3290cc0644 100644 --- a/block/blk-mq-tag.c +++ b/block/blk-mq-tag.c | |||
@@ -278,9 +278,11 @@ static int bt_get(struct blk_mq_alloc_data *data, | |||
278 | /* | 278 | /* |
279 | * We're out of tags on this hardware queue, kick any | 279 | * We're out of tags on this hardware queue, kick any |
280 | * pending IO submits before going to sleep waiting for | 280 | * pending IO submits before going to sleep waiting for |
281 | * some to complete. | 281 | * some to complete. Note that hctx can be NULL here for |
282 | * reserved tag allocation. | ||
282 | */ | 283 | */ |
283 | blk_mq_run_hw_queue(hctx, false); | 284 | if (hctx) |
285 | blk_mq_run_hw_queue(hctx, false); | ||
284 | 286 | ||
285 | /* | 287 | /* |
286 | * Retry tag allocation after running the hardware queue, | 288 | * Retry tag allocation after running the hardware queue, |
diff --git a/block/blk-mq.c b/block/blk-mq.c index 0b49e42e5310..c82de08f3721 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c | |||
@@ -1460,7 +1460,7 @@ static struct blk_mq_tags *blk_mq_init_rq_map(struct blk_mq_tag_set *set, | |||
1460 | 1460 | ||
1461 | do { | 1461 | do { |
1462 | page = alloc_pages_node(set->numa_node, | 1462 | page = alloc_pages_node(set->numa_node, |
1463 | GFP_KERNEL | __GFP_NOWARN | __GFP_NORETRY, | 1463 | GFP_KERNEL | __GFP_NOWARN | __GFP_NORETRY | __GFP_ZERO, |
1464 | this_order); | 1464 | this_order); |
1465 | if (page) | 1465 | if (page) |
1466 | break; | 1466 | break; |
@@ -1482,8 +1482,6 @@ static struct blk_mq_tags *blk_mq_init_rq_map(struct blk_mq_tag_set *set, | |||
1482 | left -= to_do * rq_size; | 1482 | left -= to_do * rq_size; |
1483 | for (j = 0; j < to_do; j++) { | 1483 | for (j = 0; j < to_do; j++) { |
1484 | tags->rqs[i] = p; | 1484 | tags->rqs[i] = p; |
1485 | tags->rqs[i]->atomic_flags = 0; | ||
1486 | tags->rqs[i]->cmd_flags = 0; | ||
1487 | if (set->ops->init_request) { | 1485 | if (set->ops->init_request) { |
1488 | if (set->ops->init_request(set->driver_data, | 1486 | if (set->ops->init_request(set->driver_data, |
1489 | tags->rqs[i], hctx_idx, i, | 1487 | tags->rqs[i], hctx_idx, i, |
diff --git a/block/blk-settings.c b/block/blk-settings.c index 6ed2cbe5e8c9..12600bfffca9 100644 --- a/block/blk-settings.c +++ b/block/blk-settings.c | |||
@@ -585,7 +585,7 @@ int blk_stack_limits(struct queue_limits *t, struct queue_limits *b, | |||
585 | b->physical_block_size); | 585 | b->physical_block_size); |
586 | 586 | ||
587 | t->io_min = max(t->io_min, b->io_min); | 587 | t->io_min = max(t->io_min, b->io_min); |
588 | t->io_opt = lcm(t->io_opt, b->io_opt); | 588 | t->io_opt = lcm_not_zero(t->io_opt, b->io_opt); |
589 | 589 | ||
590 | t->cluster &= b->cluster; | 590 | t->cluster &= b->cluster; |
591 | t->discard_zeroes_data &= b->discard_zeroes_data; | 591 | t->discard_zeroes_data &= b->discard_zeroes_data; |
@@ -616,7 +616,7 @@ int blk_stack_limits(struct queue_limits *t, struct queue_limits *b, | |||
616 | b->raid_partial_stripes_expensive); | 616 | b->raid_partial_stripes_expensive); |
617 | 617 | ||
618 | /* Find lowest common alignment_offset */ | 618 | /* Find lowest common alignment_offset */ |
619 | t->alignment_offset = lcm(t->alignment_offset, alignment) | 619 | t->alignment_offset = lcm_not_zero(t->alignment_offset, alignment) |
620 | % max(t->physical_block_size, t->io_min); | 620 | % max(t->physical_block_size, t->io_min); |
621 | 621 | ||
622 | /* Verify that new alignment_offset is on a logical block boundary */ | 622 | /* Verify that new alignment_offset is on a logical block boundary */ |
@@ -643,7 +643,7 @@ int blk_stack_limits(struct queue_limits *t, struct queue_limits *b, | |||
643 | b->max_discard_sectors); | 643 | b->max_discard_sectors); |
644 | t->discard_granularity = max(t->discard_granularity, | 644 | t->discard_granularity = max(t->discard_granularity, |
645 | b->discard_granularity); | 645 | b->discard_granularity); |
646 | t->discard_alignment = lcm(t->discard_alignment, alignment) % | 646 | t->discard_alignment = lcm_not_zero(t->discard_alignment, alignment) % |
647 | t->discard_granularity; | 647 | t->discard_granularity; |
648 | } | 648 | } |
649 | 649 | ||
diff --git a/block/scsi_ioctl.c b/block/scsi_ioctl.c index e1f71c396193..55b6f15dac90 100644 --- a/block/scsi_ioctl.c +++ b/block/scsi_ioctl.c | |||
@@ -335,16 +335,14 @@ static int sg_io(struct request_queue *q, struct gendisk *bd_disk, | |||
335 | struct iov_iter i; | 335 | struct iov_iter i; |
336 | struct iovec *iov = NULL; | 336 | struct iovec *iov = NULL; |
337 | 337 | ||
338 | ret = rw_copy_check_uvector(-1, hdr->dxferp, hdr->iovec_count, | 338 | ret = import_iovec(rq_data_dir(rq), |
339 | 0, NULL, &iov); | 339 | hdr->dxferp, hdr->iovec_count, |
340 | if (ret < 0) { | 340 | 0, &iov, &i); |
341 | kfree(iov); | 341 | if (ret < 0) |
342 | goto out_free_cdb; | 342 | goto out_free_cdb; |
343 | } | ||
344 | 343 | ||
345 | /* SG_IO howto says that the shorter of the two wins */ | 344 | /* SG_IO howto says that the shorter of the two wins */ |
346 | iov_iter_init(&i, rq_data_dir(rq), iov, hdr->iovec_count, | 345 | iov_iter_truncate(&i, hdr->dxfer_len); |
347 | min_t(unsigned, ret, hdr->dxfer_len)); | ||
348 | 346 | ||
349 | ret = blk_rq_map_user_iov(q, rq, NULL, &i, GFP_KERNEL); | 347 | ret = blk_rq_map_user_iov(q, rq, NULL, &i, GFP_KERNEL); |
350 | kfree(iov); | 348 | kfree(iov); |