diff options
author | Jens Axboe <axboe@fb.com> | 2014-04-10 11:46:28 -0400 |
---|---|---|
committer | Jens Axboe <axboe@fb.com> | 2014-04-15 16:03:02 -0400 |
commit | b4f42e2831ff9b9fa19252265d7c8985d47eefb9 (patch) | |
tree | 6b4e9790eac3b9ca4b37eb140d7027f034411c8a /block | |
parent | f89e0dd9d1a72fdf6b8958bcadfa6abf84f3cae0 (diff) |
block: remove struct request buffer member
This was used in the olden days, back when onions were proper
yellow. Basically it mapped to the current buffer to be
transferred. With highmem being added more than a decade ago,
most drivers map pages out of a bio, and rq->buffer isn't
pointing at anything valid.
Convert old style drivers to just use bio_data().
For the discard payload use case, just reference the page
in the bio.
Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'block')
-rw-r--r-- | block/blk-core.c | 21 | ||||
-rw-r--r-- | block/blk-map.c | 3 |
2 files changed, 6 insertions, 18 deletions
diff --git a/block/blk-core.c b/block/blk-core.c index 1fe9ff6e6802..ae6227fd07aa 100644 --- a/block/blk-core.c +++ b/block/blk-core.c | |||
@@ -146,8 +146,8 @@ void blk_dump_rq_flags(struct request *rq, char *msg) | |||
146 | printk(KERN_INFO " sector %llu, nr/cnr %u/%u\n", | 146 | printk(KERN_INFO " sector %llu, nr/cnr %u/%u\n", |
147 | (unsigned long long)blk_rq_pos(rq), | 147 | (unsigned long long)blk_rq_pos(rq), |
148 | blk_rq_sectors(rq), blk_rq_cur_sectors(rq)); | 148 | blk_rq_sectors(rq), blk_rq_cur_sectors(rq)); |
149 | printk(KERN_INFO " bio %p, biotail %p, buffer %p, len %u\n", | 149 | printk(KERN_INFO " bio %p, biotail %p, len %u\n", |
150 | rq->bio, rq->biotail, rq->buffer, blk_rq_bytes(rq)); | 150 | rq->bio, rq->biotail, blk_rq_bytes(rq)); |
151 | 151 | ||
152 | if (rq->cmd_type == REQ_TYPE_BLOCK_PC) { | 152 | if (rq->cmd_type == REQ_TYPE_BLOCK_PC) { |
153 | printk(KERN_INFO " cdb: "); | 153 | printk(KERN_INFO " cdb: "); |
@@ -1360,7 +1360,6 @@ void blk_add_request_payload(struct request *rq, struct page *page, | |||
1360 | 1360 | ||
1361 | rq->__data_len = rq->resid_len = len; | 1361 | rq->__data_len = rq->resid_len = len; |
1362 | rq->nr_phys_segments = 1; | 1362 | rq->nr_phys_segments = 1; |
1363 | rq->buffer = bio_data(bio); | ||
1364 | } | 1363 | } |
1365 | EXPORT_SYMBOL_GPL(blk_add_request_payload); | 1364 | EXPORT_SYMBOL_GPL(blk_add_request_payload); |
1366 | 1365 | ||
@@ -1402,12 +1401,6 @@ bool bio_attempt_front_merge(struct request_queue *q, struct request *req, | |||
1402 | bio->bi_next = req->bio; | 1401 | bio->bi_next = req->bio; |
1403 | req->bio = bio; | 1402 | req->bio = bio; |
1404 | 1403 | ||
1405 | /* | ||
1406 | * may not be valid. if the low level driver said | ||
1407 | * it didn't need a bounce buffer then it better | ||
1408 | * not touch req->buffer either... | ||
1409 | */ | ||
1410 | req->buffer = bio_data(bio); | ||
1411 | req->__sector = bio->bi_iter.bi_sector; | 1404 | req->__sector = bio->bi_iter.bi_sector; |
1412 | req->__data_len += bio->bi_iter.bi_size; | 1405 | req->__data_len += bio->bi_iter.bi_size; |
1413 | req->ioprio = ioprio_best(req->ioprio, bio_prio(bio)); | 1406 | req->ioprio = ioprio_best(req->ioprio, bio_prio(bio)); |
@@ -2434,7 +2427,6 @@ bool blk_update_request(struct request *req, int error, unsigned int nr_bytes) | |||
2434 | } | 2427 | } |
2435 | 2428 | ||
2436 | req->__data_len -= total_bytes; | 2429 | req->__data_len -= total_bytes; |
2437 | req->buffer = bio_data(req->bio); | ||
2438 | 2430 | ||
2439 | /* update sector only for requests with clear definition of sector */ | 2431 | /* update sector only for requests with clear definition of sector */ |
2440 | if (req->cmd_type == REQ_TYPE_FS) | 2432 | if (req->cmd_type == REQ_TYPE_FS) |
@@ -2752,10 +2744,9 @@ void blk_rq_bio_prep(struct request_queue *q, struct request *rq, | |||
2752 | /* Bit 0 (R/W) is identical in rq->cmd_flags and bio->bi_rw */ | 2744 | /* Bit 0 (R/W) is identical in rq->cmd_flags and bio->bi_rw */ |
2753 | rq->cmd_flags |= bio->bi_rw & REQ_WRITE; | 2745 | rq->cmd_flags |= bio->bi_rw & REQ_WRITE; |
2754 | 2746 | ||
2755 | if (bio_has_data(bio)) { | 2747 | if (bio_has_data(bio)) |
2756 | rq->nr_phys_segments = bio_phys_segments(q, bio); | 2748 | rq->nr_phys_segments = bio_phys_segments(q, bio); |
2757 | rq->buffer = bio_data(bio); | 2749 | |
2758 | } | ||
2759 | rq->__data_len = bio->bi_iter.bi_size; | 2750 | rq->__data_len = bio->bi_iter.bi_size; |
2760 | rq->bio = rq->biotail = bio; | 2751 | rq->bio = rq->biotail = bio; |
2761 | 2752 | ||
@@ -2831,7 +2822,7 @@ EXPORT_SYMBOL_GPL(blk_rq_unprep_clone); | |||
2831 | 2822 | ||
2832 | /* | 2823 | /* |
2833 | * Copy attributes of the original request to the clone request. | 2824 | * Copy attributes of the original request to the clone request. |
2834 | * The actual data parts (e.g. ->cmd, ->buffer, ->sense) are not copied. | 2825 | * The actual data parts (e.g. ->cmd, ->sense) are not copied. |
2835 | */ | 2826 | */ |
2836 | static void __blk_rq_prep_clone(struct request *dst, struct request *src) | 2827 | static void __blk_rq_prep_clone(struct request *dst, struct request *src) |
2837 | { | 2828 | { |
@@ -2857,7 +2848,7 @@ static void __blk_rq_prep_clone(struct request *dst, struct request *src) | |||
2857 | * | 2848 | * |
2858 | * Description: | 2849 | * Description: |
2859 | * Clones bios in @rq_src to @rq, and copies attributes of @rq_src to @rq. | 2850 | * Clones bios in @rq_src to @rq, and copies attributes of @rq_src to @rq. |
2860 | * The actual data parts of @rq_src (e.g. ->cmd, ->buffer, ->sense) | 2851 | * The actual data parts of @rq_src (e.g. ->cmd, ->sense) |
2861 | * are not copied, and copying such parts is the caller's responsibility. | 2852 | * are not copied, and copying such parts is the caller's responsibility. |
2862 | * Also, pages which the original bios are pointing to are not copied | 2853 | * Also, pages which the original bios are pointing to are not copied |
2863 | * and the cloned bios just point same pages. | 2854 | * and the cloned bios just point same pages. |
diff --git a/block/blk-map.c b/block/blk-map.c index f7b22bc21518..f890d4345b0c 100644 --- a/block/blk-map.c +++ b/block/blk-map.c | |||
@@ -155,7 +155,6 @@ int blk_rq_map_user(struct request_queue *q, struct request *rq, | |||
155 | if (!bio_flagged(bio, BIO_USER_MAPPED)) | 155 | if (!bio_flagged(bio, BIO_USER_MAPPED)) |
156 | rq->cmd_flags |= REQ_COPY_USER; | 156 | rq->cmd_flags |= REQ_COPY_USER; |
157 | 157 | ||
158 | rq->buffer = NULL; | ||
159 | return 0; | 158 | return 0; |
160 | unmap_rq: | 159 | unmap_rq: |
161 | blk_rq_unmap_user(bio); | 160 | blk_rq_unmap_user(bio); |
@@ -238,7 +237,6 @@ int blk_rq_map_user_iov(struct request_queue *q, struct request *rq, | |||
238 | blk_queue_bounce(q, &bio); | 237 | blk_queue_bounce(q, &bio); |
239 | bio_get(bio); | 238 | bio_get(bio); |
240 | blk_rq_bio_prep(q, rq, bio); | 239 | blk_rq_bio_prep(q, rq, bio); |
241 | rq->buffer = NULL; | ||
242 | return 0; | 240 | return 0; |
243 | } | 241 | } |
244 | EXPORT_SYMBOL(blk_rq_map_user_iov); | 242 | EXPORT_SYMBOL(blk_rq_map_user_iov); |
@@ -325,7 +323,6 @@ int blk_rq_map_kern(struct request_queue *q, struct request *rq, void *kbuf, | |||
325 | } | 323 | } |
326 | 324 | ||
327 | blk_queue_bounce(q, &rq->bio); | 325 | blk_queue_bounce(q, &rq->bio); |
328 | rq->buffer = NULL; | ||
329 | return 0; | 326 | return 0; |
330 | } | 327 | } |
331 | EXPORT_SYMBOL(blk_rq_map_kern); | 328 | EXPORT_SYMBOL(blk_rq_map_kern); |