summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--block/blk-core.c21
-rw-r--r--include/linux/blkdev.h1
2 files changed, 7 insertions, 15 deletions
diff --git a/block/blk-core.c b/block/blk-core.c
index 5131993b23a1..a0af4043dda2 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -2114,7 +2114,8 @@ blk_qc_t submit_bio(int rw, struct bio *bio)
2114EXPORT_SYMBOL(submit_bio); 2114EXPORT_SYMBOL(submit_bio);
2115 2115
2116/** 2116/**
2117 * blk_rq_check_limits - Helper function to check a request for the queue limit 2117 * blk_cloned_rq_check_limits - Helper function to check a cloned request
2118 * for new the queue limits
2118 * @q: the queue 2119 * @q: the queue
2119 * @rq: the request being checked 2120 * @rq: the request being checked
2120 * 2121 *
@@ -2125,20 +2126,13 @@ EXPORT_SYMBOL(submit_bio);
2125 * after it is inserted to @q, it should be checked against @q before 2126 * after it is inserted to @q, it should be checked against @q before
2126 * the insertion using this generic function. 2127 * the insertion using this generic function.
2127 * 2128 *
2128 * This function should also be useful for request stacking drivers
2129 * in some cases below, so export this function.
2130 * Request stacking drivers like request-based dm may change the queue 2129 * Request stacking drivers like request-based dm may change the queue
2131 * limits while requests are in the queue (e.g. dm's table swapping). 2130 * limits when retrying requests on other queues. Those requests need
2132 * Such request stacking drivers should check those requests against 2131 * to be checked against the new queue limits again during dispatch.
2133 * the new queue limits again when they dispatch those requests,
2134 * although such checkings are also done against the old queue limits
2135 * when submitting requests.
2136 */ 2132 */
2137int blk_rq_check_limits(struct request_queue *q, struct request *rq) 2133static int blk_cloned_rq_check_limits(struct request_queue *q,
2134 struct request *rq)
2138{ 2135{
2139 if (!rq_mergeable(rq))
2140 return 0;
2141
2142 if (blk_rq_sectors(rq) > blk_queue_get_max_sectors(q, rq->cmd_flags)) { 2136 if (blk_rq_sectors(rq) > blk_queue_get_max_sectors(q, rq->cmd_flags)) {
2143 printk(KERN_ERR "%s: over max size limit.\n", __func__); 2137 printk(KERN_ERR "%s: over max size limit.\n", __func__);
2144 return -EIO; 2138 return -EIO;
@@ -2158,7 +2152,6 @@ int blk_rq_check_limits(struct request_queue *q, struct request *rq)
2158 2152
2159 return 0; 2153 return 0;
2160} 2154}
2161EXPORT_SYMBOL_GPL(blk_rq_check_limits);
2162 2155
2163/** 2156/**
2164 * blk_insert_cloned_request - Helper for stacking drivers to submit a request 2157 * blk_insert_cloned_request - Helper for stacking drivers to submit a request
@@ -2170,7 +2163,7 @@ int blk_insert_cloned_request(struct request_queue *q, struct request *rq)
2170 unsigned long flags; 2163 unsigned long flags;
2171 int where = ELEVATOR_INSERT_BACK; 2164 int where = ELEVATOR_INSERT_BACK;
2172 2165
2173 if (blk_rq_check_limits(q, rq)) 2166 if (blk_cloned_rq_check_limits(q, rq))
2174 return -EIO; 2167 return -EIO;
2175 2168
2176 if (rq->rq_disk && 2169 if (rq->rq_disk &&
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index c0d2b7927c1f..c06f8eaa42ff 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -773,7 +773,6 @@ extern void blk_rq_set_block_pc(struct request *);
773extern void blk_requeue_request(struct request_queue *, struct request *); 773extern void blk_requeue_request(struct request_queue *, struct request *);
774extern void blk_add_request_payload(struct request *rq, struct page *page, 774extern void blk_add_request_payload(struct request *rq, struct page *page,
775 unsigned int len); 775 unsigned int len);
776extern int blk_rq_check_limits(struct request_queue *q, struct request *rq);
777extern int blk_lld_busy(struct request_queue *q); 776extern int blk_lld_busy(struct request_queue *q);
778extern int blk_rq_prep_clone(struct request *rq, struct request *rq_src, 777extern int blk_rq_prep_clone(struct request *rq, struct request *rq_src,
779 struct bio_set *bs, gfp_t gfp_mask, 778 struct bio_set *bs, gfp_t gfp_mask,