diff options
Diffstat (limited to 'block')
| -rw-r--r-- | block/blk-cgroup.h | 8 | ||||
| -rw-r--r-- | block/blk-flush.c | 19 | ||||
| -rw-r--r-- | block/blk-mq.c | 30 | ||||
| -rw-r--r-- | block/partitions/efi.c | 5 |
4 files changed, 28 insertions, 34 deletions
diff --git a/block/blk-cgroup.h b/block/blk-cgroup.h index 1610b22edf09..86154eab9523 100644 --- a/block/blk-cgroup.h +++ b/block/blk-cgroup.h | |||
| @@ -435,9 +435,9 @@ static inline uint64_t blkg_stat_read(struct blkg_stat *stat) | |||
| 435 | uint64_t v; | 435 | uint64_t v; |
| 436 | 436 | ||
| 437 | do { | 437 | do { |
| 438 | start = u64_stats_fetch_begin(&stat->syncp); | 438 | start = u64_stats_fetch_begin_bh(&stat->syncp); |
| 439 | v = stat->cnt; | 439 | v = stat->cnt; |
| 440 | } while (u64_stats_fetch_retry(&stat->syncp, start)); | 440 | } while (u64_stats_fetch_retry_bh(&stat->syncp, start)); |
| 441 | 441 | ||
| 442 | return v; | 442 | return v; |
| 443 | } | 443 | } |
| @@ -508,9 +508,9 @@ static inline struct blkg_rwstat blkg_rwstat_read(struct blkg_rwstat *rwstat) | |||
| 508 | struct blkg_rwstat tmp; | 508 | struct blkg_rwstat tmp; |
| 509 | 509 | ||
| 510 | do { | 510 | do { |
| 511 | start = u64_stats_fetch_begin(&rwstat->syncp); | 511 | start = u64_stats_fetch_begin_bh(&rwstat->syncp); |
| 512 | tmp = *rwstat; | 512 | tmp = *rwstat; |
| 513 | } while (u64_stats_fetch_retry(&rwstat->syncp, start)); | 513 | } while (u64_stats_fetch_retry_bh(&rwstat->syncp, start)); |
| 514 | 514 | ||
| 515 | return tmp; | 515 | return tmp; |
| 516 | } | 516 | } |
diff --git a/block/blk-flush.c b/block/blk-flush.c index 331e627301ea..fb6f3c0ffa49 100644 --- a/block/blk-flush.c +++ b/block/blk-flush.c | |||
| @@ -502,15 +502,6 @@ void blk_abort_flushes(struct request_queue *q) | |||
| 502 | } | 502 | } |
| 503 | } | 503 | } |
| 504 | 504 | ||
| 505 | static void bio_end_flush(struct bio *bio, int err) | ||
| 506 | { | ||
| 507 | if (err) | ||
| 508 | clear_bit(BIO_UPTODATE, &bio->bi_flags); | ||
| 509 | if (bio->bi_private) | ||
| 510 | complete(bio->bi_private); | ||
| 511 | bio_put(bio); | ||
| 512 | } | ||
| 513 | |||
| 514 | /** | 505 | /** |
| 515 | * blkdev_issue_flush - queue a flush | 506 | * blkdev_issue_flush - queue a flush |
| 516 | * @bdev: blockdev to issue flush for | 507 | * @bdev: blockdev to issue flush for |
| @@ -526,7 +517,6 @@ static void bio_end_flush(struct bio *bio, int err) | |||
| 526 | int blkdev_issue_flush(struct block_device *bdev, gfp_t gfp_mask, | 517 | int blkdev_issue_flush(struct block_device *bdev, gfp_t gfp_mask, |
| 527 | sector_t *error_sector) | 518 | sector_t *error_sector) |
| 528 | { | 519 | { |
| 529 | DECLARE_COMPLETION_ONSTACK(wait); | ||
| 530 | struct request_queue *q; | 520 | struct request_queue *q; |
| 531 | struct bio *bio; | 521 | struct bio *bio; |
| 532 | int ret = 0; | 522 | int ret = 0; |
| @@ -548,13 +538,9 @@ int blkdev_issue_flush(struct block_device *bdev, gfp_t gfp_mask, | |||
| 548 | return -ENXIO; | 538 | return -ENXIO; |
| 549 | 539 | ||
| 550 | bio = bio_alloc(gfp_mask, 0); | 540 | bio = bio_alloc(gfp_mask, 0); |
| 551 | bio->bi_end_io = bio_end_flush; | ||
| 552 | bio->bi_bdev = bdev; | 541 | bio->bi_bdev = bdev; |
| 553 | bio->bi_private = &wait; | ||
| 554 | 542 | ||
| 555 | bio_get(bio); | 543 | ret = submit_bio_wait(WRITE_FLUSH, bio); |
| 556 | submit_bio(WRITE_FLUSH, bio); | ||
| 557 | wait_for_completion_io(&wait); | ||
| 558 | 544 | ||
| 559 | /* | 545 | /* |
| 560 | * The driver must store the error location in ->bi_sector, if | 546 | * The driver must store the error location in ->bi_sector, if |
| @@ -564,9 +550,6 @@ int blkdev_issue_flush(struct block_device *bdev, gfp_t gfp_mask, | |||
| 564 | if (error_sector) | 550 | if (error_sector) |
| 565 | *error_sector = bio->bi_sector; | 551 | *error_sector = bio->bi_sector; |
| 566 | 552 | ||
| 567 | if (!bio_flagged(bio, BIO_UPTODATE)) | ||
| 568 | ret = -EIO; | ||
| 569 | |||
| 570 | bio_put(bio); | 553 | bio_put(bio); |
| 571 | return ret; | 554 | return ret; |
| 572 | } | 555 | } |
diff --git a/block/blk-mq.c b/block/blk-mq.c index 862f458d4760..c79126e11030 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c | |||
| @@ -171,9 +171,12 @@ bool blk_mq_can_queue(struct blk_mq_hw_ctx *hctx) | |||
| 171 | } | 171 | } |
| 172 | EXPORT_SYMBOL(blk_mq_can_queue); | 172 | EXPORT_SYMBOL(blk_mq_can_queue); |
| 173 | 173 | ||
| 174 | static void blk_mq_rq_ctx_init(struct blk_mq_ctx *ctx, struct request *rq, | 174 | static void blk_mq_rq_ctx_init(struct request_queue *q, struct blk_mq_ctx *ctx, |
| 175 | unsigned int rw_flags) | 175 | struct request *rq, unsigned int rw_flags) |
| 176 | { | 176 | { |
| 177 | if (blk_queue_io_stat(q)) | ||
| 178 | rw_flags |= REQ_IO_STAT; | ||
| 179 | |||
| 177 | rq->mq_ctx = ctx; | 180 | rq->mq_ctx = ctx; |
| 178 | rq->cmd_flags = rw_flags; | 181 | rq->cmd_flags = rw_flags; |
| 179 | ctx->rq_dispatched[rw_is_sync(rw_flags)]++; | 182 | ctx->rq_dispatched[rw_is_sync(rw_flags)]++; |
| @@ -197,12 +200,14 @@ static struct request *blk_mq_alloc_request_pinned(struct request_queue *q, | |||
| 197 | 200 | ||
| 198 | rq = __blk_mq_alloc_request(hctx, gfp & ~__GFP_WAIT, reserved); | 201 | rq = __blk_mq_alloc_request(hctx, gfp & ~__GFP_WAIT, reserved); |
| 199 | if (rq) { | 202 | if (rq) { |
| 200 | blk_mq_rq_ctx_init(ctx, rq, rw); | 203 | blk_mq_rq_ctx_init(q, ctx, rq, rw); |
| 201 | break; | ||
| 202 | } else if (!(gfp & __GFP_WAIT)) | ||
| 203 | break; | 204 | break; |
| 205 | } | ||
| 204 | 206 | ||
| 205 | blk_mq_put_ctx(ctx); | 207 | blk_mq_put_ctx(ctx); |
| 208 | if (!(gfp & __GFP_WAIT)) | ||
| 209 | break; | ||
| 210 | |||
| 206 | __blk_mq_run_hw_queue(hctx); | 211 | __blk_mq_run_hw_queue(hctx); |
| 207 | blk_mq_wait_for_tags(hctx->tags); | 212 | blk_mq_wait_for_tags(hctx->tags); |
| 208 | } while (1); | 213 | } while (1); |
| @@ -219,7 +224,8 @@ struct request *blk_mq_alloc_request(struct request_queue *q, int rw, | |||
| 219 | return NULL; | 224 | return NULL; |
| 220 | 225 | ||
| 221 | rq = blk_mq_alloc_request_pinned(q, rw, gfp, reserved); | 226 | rq = blk_mq_alloc_request_pinned(q, rw, gfp, reserved); |
| 222 | blk_mq_put_ctx(rq->mq_ctx); | 227 | if (rq) |
| 228 | blk_mq_put_ctx(rq->mq_ctx); | ||
| 223 | return rq; | 229 | return rq; |
| 224 | } | 230 | } |
| 225 | 231 | ||
| @@ -232,7 +238,8 @@ struct request *blk_mq_alloc_reserved_request(struct request_queue *q, int rw, | |||
| 232 | return NULL; | 238 | return NULL; |
| 233 | 239 | ||
| 234 | rq = blk_mq_alloc_request_pinned(q, rw, gfp, true); | 240 | rq = blk_mq_alloc_request_pinned(q, rw, gfp, true); |
| 235 | blk_mq_put_ctx(rq->mq_ctx); | 241 | if (rq) |
| 242 | blk_mq_put_ctx(rq->mq_ctx); | ||
| 236 | return rq; | 243 | return rq; |
| 237 | } | 244 | } |
| 238 | EXPORT_SYMBOL(blk_mq_alloc_reserved_request); | 245 | EXPORT_SYMBOL(blk_mq_alloc_reserved_request); |
| @@ -305,12 +312,12 @@ void blk_mq_complete_request(struct request *rq, int error) | |||
| 305 | 312 | ||
| 306 | blk_account_io_completion(rq, bytes); | 313 | blk_account_io_completion(rq, bytes); |
| 307 | 314 | ||
| 315 | blk_account_io_done(rq); | ||
| 316 | |||
| 308 | if (rq->end_io) | 317 | if (rq->end_io) |
| 309 | rq->end_io(rq, error); | 318 | rq->end_io(rq, error); |
| 310 | else | 319 | else |
| 311 | blk_mq_free_request(rq); | 320 | blk_mq_free_request(rq); |
| 312 | |||
| 313 | blk_account_io_done(rq); | ||
| 314 | } | 321 | } |
| 315 | 322 | ||
| 316 | void __blk_mq_end_io(struct request *rq, int error) | 323 | void __blk_mq_end_io(struct request *rq, int error) |
| @@ -718,6 +725,8 @@ static void __blk_mq_insert_request(struct blk_mq_hw_ctx *hctx, | |||
| 718 | { | 725 | { |
| 719 | struct blk_mq_ctx *ctx = rq->mq_ctx; | 726 | struct blk_mq_ctx *ctx = rq->mq_ctx; |
| 720 | 727 | ||
| 728 | trace_block_rq_insert(hctx->queue, rq); | ||
| 729 | |||
| 721 | list_add_tail(&rq->queuelist, &ctx->rq_list); | 730 | list_add_tail(&rq->queuelist, &ctx->rq_list); |
| 722 | blk_mq_hctx_mark_pending(hctx, ctx); | 731 | blk_mq_hctx_mark_pending(hctx, ctx); |
| 723 | 732 | ||
| @@ -921,7 +930,7 @@ static void blk_mq_make_request(struct request_queue *q, struct bio *bio) | |||
| 921 | trace_block_getrq(q, bio, rw); | 930 | trace_block_getrq(q, bio, rw); |
| 922 | rq = __blk_mq_alloc_request(hctx, GFP_ATOMIC, false); | 931 | rq = __blk_mq_alloc_request(hctx, GFP_ATOMIC, false); |
| 923 | if (likely(rq)) | 932 | if (likely(rq)) |
| 924 | blk_mq_rq_ctx_init(ctx, rq, rw); | 933 | blk_mq_rq_ctx_init(q, ctx, rq, rw); |
| 925 | else { | 934 | else { |
| 926 | blk_mq_put_ctx(ctx); | 935 | blk_mq_put_ctx(ctx); |
| 927 | trace_block_sleeprq(q, bio, rw); | 936 | trace_block_sleeprq(q, bio, rw); |
| @@ -1377,6 +1386,7 @@ struct request_queue *blk_mq_init_queue(struct blk_mq_reg *reg, | |||
| 1377 | q->queue_hw_ctx = hctxs; | 1386 | q->queue_hw_ctx = hctxs; |
| 1378 | 1387 | ||
| 1379 | q->mq_ops = reg->ops; | 1388 | q->mq_ops = reg->ops; |
| 1389 | q->queue_flags |= QUEUE_FLAG_MQ_DEFAULT; | ||
| 1380 | 1390 | ||
| 1381 | blk_queue_make_request(q, blk_mq_make_request); | 1391 | blk_queue_make_request(q, blk_mq_make_request); |
| 1382 | blk_queue_rq_timed_out(q, reg->ops->timeout); | 1392 | blk_queue_rq_timed_out(q, reg->ops->timeout); |
diff --git a/block/partitions/efi.c b/block/partitions/efi.c index a8287b49d062..dc51f467a560 100644 --- a/block/partitions/efi.c +++ b/block/partitions/efi.c | |||
| @@ -96,6 +96,7 @@ | |||
| 96 | * - Code works, detects all the partitions. | 96 | * - Code works, detects all the partitions. |
| 97 | * | 97 | * |
| 98 | ************************************************************/ | 98 | ************************************************************/ |
| 99 | #include <linux/kernel.h> | ||
| 99 | #include <linux/crc32.h> | 100 | #include <linux/crc32.h> |
| 100 | #include <linux/ctype.h> | 101 | #include <linux/ctype.h> |
| 101 | #include <linux/math64.h> | 102 | #include <linux/math64.h> |
| @@ -715,8 +716,8 @@ int efi_partition(struct parsed_partitions *state) | |||
| 715 | efi_guid_unparse(&ptes[i].unique_partition_guid, info->uuid); | 716 | efi_guid_unparse(&ptes[i].unique_partition_guid, info->uuid); |
| 716 | 717 | ||
| 717 | /* Naively convert UTF16-LE to 7 bits. */ | 718 | /* Naively convert UTF16-LE to 7 bits. */ |
| 718 | label_max = min(sizeof(info->volname) - 1, | 719 | label_max = min(ARRAY_SIZE(info->volname) - 1, |
| 719 | sizeof(ptes[i].partition_name)); | 720 | ARRAY_SIZE(ptes[i].partition_name)); |
| 720 | info->volname[label_max] = 0; | 721 | info->volname[label_max] = 0; |
| 721 | while (label_count < label_max) { | 722 | while (label_count < label_max) { |
| 722 | u8 c = ptes[i].partition_name[label_count] & 0xff; | 723 | u8 c = ptes[i].partition_name[label_count] & 0xff; |
