blk-mq.c (1e7f32f776089af32b6ec9b801fe976778c8448b) blk-mq.c (248c793359daacd826a7507a258ffe41653efef7)
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * Block multiqueue core code
4 *
5 * Copyright (C) 2013-2014 Jens Axboe
6 * Copyright (C) 2013-2014 Christoph Hellwig
7 */
8#include <linux/kernel.h>

--- 775 unchanged lines hidden (view full) ---

784
785#ifdef CONFIG_BLK_DEV_INTEGRITY
786 if (blk_integrity_rq(req) && req_op(req) == REQ_OP_READ &&
787 error == BLK_STS_OK)
788 req->q->integrity.profile->complete_fn(req, nr_bytes);
789#endif
790
791 if (unlikely(error && !blk_rq_is_passthrough(req) &&
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * Block multiqueue core code
4 *
5 * Copyright (C) 2013-2014 Jens Axboe
6 * Copyright (C) 2013-2014 Christoph Hellwig
7 */
8#include <linux/kernel.h>

--- 775 unchanged lines hidden (view full) ---

784
785#ifdef CONFIG_BLK_DEV_INTEGRITY
786 if (blk_integrity_rq(req) && req_op(req) == REQ_OP_READ &&
787 error == BLK_STS_OK)
788 req->q->integrity.profile->complete_fn(req, nr_bytes);
789#endif
790
791 if (unlikely(error && !blk_rq_is_passthrough(req) &&
792 !(req->rq_flags & RQF_QUIET)))
792 !(req->rq_flags & RQF_QUIET))) {
793 blk_print_req_error(req, error);
793 blk_print_req_error(req, error);
794 trace_block_rq_error(req, error, nr_bytes);
795 }
794
795 blk_account_io_completion(req, nr_bytes);
796
797 total_bytes = 0;
798 while (req->bio) {
799 struct bio *bio = req->bio;
800 unsigned bio_bytes = min(bio->bi_iter.bi_size, nr_bytes);
801

--- 2031 unchanged lines hidden (view full) ---

2833 (rq->mq_hctx->dispatch_busy &&
2834 (q->nr_hw_queues == 1 || !is_sync)))
2835 blk_mq_sched_insert_request(rq, false, true, true);
2836 else
2837 blk_mq_run_dispatch_ops(rq->q,
2838 blk_mq_try_issue_directly(rq->mq_hctx, rq));
2839}
2840
796
797 blk_account_io_completion(req, nr_bytes);
798
799 total_bytes = 0;
800 while (req->bio) {
801 struct bio *bio = req->bio;
802 unsigned bio_bytes = min(bio->bi_iter.bi_size, nr_bytes);
803

--- 2031 unchanged lines hidden (view full) ---

2835 (rq->mq_hctx->dispatch_busy &&
2836 (q->nr_hw_queues == 1 || !is_sync)))
2837 blk_mq_sched_insert_request(rq, false, true, true);
2838 else
2839 blk_mq_run_dispatch_ops(rq->q,
2840 blk_mq_try_issue_directly(rq->mq_hctx, rq));
2841}
2842
2843#ifdef CONFIG_BLK_MQ_STACKING
2841/**
2842 * blk_cloned_rq_check_limits - Helper function to check a cloned request
2843 * for the new queue limits
2844 * @q: the queue
2845 * @rq: the request being checked
2846 *
2847 * Description:
2848 * @rq may have been made based on weaker limitations of upper-level queues

--- 121 unchanged lines hidden (view full) ---

2970 void *data)
2971{
2972 struct bio *bio, *bio_src;
2973
2974 if (!bs)
2975 bs = &fs_bio_set;
2976
2977 __rq_for_each_bio(bio_src, rq_src) {
2844/**
2845 * blk_cloned_rq_check_limits - Helper function to check a cloned request
2846 * for the new queue limits
2847 * @q: the queue
2848 * @rq: the request being checked
2849 *
2850 * Description:
2851 * @rq may have been made based on weaker limitations of upper-level queues

--- 121 unchanged lines hidden (view full) ---

2973 void *data)
2974{
2975 struct bio *bio, *bio_src;
2976
2977 if (!bs)
2978 bs = &fs_bio_set;
2979
2980 __rq_for_each_bio(bio_src, rq_src) {
2978 bio = bio_clone_fast(bio_src, gfp_mask, bs);
2981 bio = bio_alloc_clone(rq->q->disk->part0, bio_src, gfp_mask,
2982 bs);
2979 if (!bio)
2980 goto free_and_out;
2983 if (!bio)
2984 goto free_and_out;
2981 bio->bi_bdev = rq->q->disk->part0;
2982
2983 if (bio_ctr && bio_ctr(bio, bio_src, data))
2984 goto free_and_out;
2985
2986 if (rq->bio) {
2987 rq->biotail->bi_next = bio;
2988 rq->biotail = bio;
2989 } else {

--- 20 unchanged lines hidden (view full) ---

3010free_and_out:
3011 if (bio)
3012 bio_put(bio);
3013 blk_rq_unprep_clone(rq);
3014
3015 return -ENOMEM;
3016}
3017EXPORT_SYMBOL_GPL(blk_rq_prep_clone);
2985
2986 if (bio_ctr && bio_ctr(bio, bio_src, data))
2987 goto free_and_out;
2988
2989 if (rq->bio) {
2990 rq->biotail->bi_next = bio;
2991 rq->biotail = bio;
2992 } else {

--- 20 unchanged lines hidden (view full) ---

3013free_and_out:
3014 if (bio)
3015 bio_put(bio);
3016 blk_rq_unprep_clone(rq);
3017
3018 return -ENOMEM;
3019}
3020EXPORT_SYMBOL_GPL(blk_rq_prep_clone);
3021#endif /* CONFIG_BLK_MQ_STACKING */
3018
3019/*
3020 * Steal bios from a request and add them to a bio list.
3021 * The request must not have been partially completed before.
3022 */
3023void blk_steal_bios(struct bio_list *list, struct request *rq)
3024{
3025 if (rq->bio) {

--- 1734 unchanged lines hidden ---
3022
3023/*
3024 * Steal bios from a request and add them to a bio list.
3025 * The request must not have been partially completed before.
3026 */
3027void blk_steal_bios(struct bio_list *list, struct request *rq)
3028{
3029 if (rq->bio) {

--- 1734 unchanged lines hidden ---