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.
Unified · Split
| @@ -146,8 +146,8 @@ void blk_dump_rq_flags(struct request *rq, char *msg) · 145 unmodified lines | ||
| 146 | 146 | printk(KERN_INFO " sector %llu, nr/cnr %u/%u\n", |
| 147 | 147 | (unsigned long long)blk_rq_pos(rq), |
| 148 | 148 | blk_rq_sectors(rq), blk_rq_cur_sectors(rq)); |
| 149 | − printk(KERN_INFO " bio %p, biotail %p, buffer %p, len %u\n", | |
| 150 | − rq->bio, rq->biotail, rq->buffer, blk_rq_bytes(rq)); | |
| 149 | + printk(KERN_INFO " bio %p, biotail %p, len %u\n", | |
| 150 | + rq->bio, rq->biotail, blk_rq_bytes(rq)); | |
| 151 | 151 | |
| 152 | 152 | if (rq->cmd_type == REQ_TYPE_BLOCK_PC) { |
| 153 | 153 | printk(KERN_INFO " cdb: "); |
| @@ -1360,7 +1360,6 @@ void blk_add_request_payload(struct request *rq, struct page *page, · 1206 unmodified lines | ||
| 1360 | 1360 | |
| 1361 | 1361 | rq->__data_len = rq->resid_len = len; |
| 1362 | 1362 | rq->nr_phys_segments = 1; |
| 1363 | − rq->buffer = bio_data(bio); | |
| 1364 | 1363 | } |
| 1365 | 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, · 35 unmodified lines | ||
| 1402 | 1401 | bio->bi_next = req->bio; |
| 1403 | 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 | 1404 | req->__sector = bio->bi_iter.bi_sector; |
| 1412 | 1405 | req->__data_len += bio->bi_iter.bi_size; |
| 1413 | 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) · 1020 unmodified lines | ||
| 2434 | 2427 | } |
| 2435 | 2428 | |
| 2436 | 2429 | req->__data_len -= total_bytes; |
| 2437 | − req->buffer = bio_data(req->bio); | |
| 2438 | 2430 | |
| 2439 | 2431 | /* update sector only for requests with clear definition of sector */ |
| 2440 | 2432 | if (req->cmd_type == REQ_TYPE_FS) |
| @@ -2752,10 +2744,9 @@ void blk_rq_bio_prep(struct request_queue *q, struct request *rq, · 311 unmodified lines | ||
| 2752 | 2744 | /* Bit 0 (R/W) is identical in rq->cmd_flags and bio->bi_rw */ |
| 2753 | 2745 | rq->cmd_flags |= bio->bi_rw & REQ_WRITE; |
| 2754 | 2746 | |
| 2755 | − if (bio_has_data(bio)) { | |
| 2747 | + if (bio_has_data(bio)) | |
| 2756 | 2748 | rq->nr_phys_segments = bio_phys_segments(q, bio); |
| 2757 | − rq->buffer = bio_data(bio); | |
| 2758 | − } | |
| 2749 | + | |
| 2759 | 2750 | rq->__data_len = bio->bi_iter.bi_size; |
| 2760 | 2751 | rq->bio = rq->biotail = bio; |
| 2761 | 2752 | |
| @@ -2831,7 +2822,7 @@ EXPORT_SYMBOL_GPL(blk_rq_unprep_clone); · 69 unmodified lines | ||
| 2831 | 2822 | |
| 2832 | 2823 | /* |
| 2833 | 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 | 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) · 19 unmodified lines | ||
| 2857 | 2848 | * |
| 2858 | 2849 | * Description: |
| 2859 | 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 | 2852 | * are not copied, and copying such parts is the caller's responsibility. |
| 2862 | 2853 | * Also, pages which the original bios are pointing to are not copied |
| 2863 | 2854 | * and the cloned bios just point same pages. |
| @@ -155,7 +155,6 @@ int blk_rq_map_user(struct request_queue *q, struct request *rq, · 154 unmodified lines | ||
| 155 | 155 | if (!bio_flagged(bio, BIO_USER_MAPPED)) |
| 156 | 156 | rq->cmd_flags |= REQ_COPY_USER; |
| 157 | 157 | |
| 158 | − rq->buffer = NULL; | |
| 159 | 158 | return 0; |
| 160 | 159 | unmap_rq: |
| 161 | 160 | blk_rq_unmap_user(bio); |
| @@ -238,7 +237,6 @@ int blk_rq_map_user_iov(struct request_queue *q, struct request *rq, · 76 unmodified lines | ||
| 238 | 237 | blk_queue_bounce(q, &bio); |
| 239 | 238 | bio_get(bio); |
| 240 | 239 | blk_rq_bio_prep(q, rq, bio); |
| 241 | − rq->buffer = NULL; | |
| 242 | 240 | return 0; |
| 243 | 241 | } |
| 244 | 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, · 80 unmodified lines | ||
| 325 | 323 | } |
| 326 | 324 | |
| 327 | 325 | blk_queue_bounce(q, &rq->bio); |
| 328 | − rq->buffer = NULL; | |
| 329 | 326 | return 0; |
| 330 | 327 | } |
| 331 | 328 | EXPORT_SYMBOL(blk_rq_map_kern); |
| @@ -1406,7 +1406,7 @@ next_segment: · 1405 unmodified lines | ||
| 1406 | 1406 | |
| 1407 | 1407 | track = block / (floppy->dtype->sects * floppy->type->sect_mult); |
| 1408 | 1408 | sector = block % (floppy->dtype->sects * floppy->type->sect_mult); |
| 1409 | − data = rq->buffer + 512 * cnt; | |
| 1409 | + data = bio_data(rq->bio) + 512 * cnt; | |
| 1410 | 1410 | #ifdef DEBUG |
| 1411 | 1411 | printk("access to track %d, sector %d, with buffer at " |
| 1412 | 1412 | "0x%08lx\n", track, sector, data); |
| @@ -1484,7 +1484,7 @@ repeat: · 1483 unmodified lines | ||
| 1484 | 1484 | ReqCnt = 0; |
| 1485 | 1485 | ReqCmd = rq_data_dir(fd_request); |
| 1486 | 1486 | ReqBlock = blk_rq_pos(fd_request); |
| 1487 | − ReqBuffer = fd_request->buffer; | |
| 1487 | + ReqBuffer = bio_data(fd_request->bio); | |
| 1488 | 1488 | setup_req_params( drive ); |
| 1489 | 1489 | do_fd_action( drive ); |
| 1490 | 1490 | |
| @@ -2351,7 +2351,7 @@ static void rw_interrupt(void) · 2350 unmodified lines | ||
| 2351 | 2351 | } |
| 2352 | 2352 | |
| 2353 | 2353 | if (CT(COMMAND) != FD_READ || |
| 2354 | − raw_cmd->kernel_data == current_req->buffer) { | |
| 2354 | + raw_cmd->kernel_data == bio_data(current_req->bio)) { | |
| 2355 | 2355 | /* transfer directly from buffer */ |
| 2356 | 2356 | cont->done(1); |
| 2357 | 2357 | } else if (CT(COMMAND) == FD_READ) { |
| @@ -2640,7 +2640,7 @@ static int make_raw_rw_request(void) · 282 unmodified lines | ||
| 2640 | 2640 | raw_cmd->flags &= ~FD_RAW_WRITE; |
| 2641 | 2641 | raw_cmd->flags |= FD_RAW_READ; |
| 2642 | 2642 | COMMAND = FM_MODE(_floppy, FD_READ); |
| 2643 | − } else if ((unsigned long)current_req->buffer < MAX_DMA_ADDRESS) { | |
| 2643 | + } else if ((unsigned long)bio_data(current_req->bio) < MAX_DMA_ADDRESS) { | |
| 2644 | 2644 | unsigned long dma_limit; |
| 2645 | 2645 | int direct, indirect; |
| 2646 | 2646 | |
| @@ -2654,13 +2654,13 @@ static int make_raw_rw_request(void) · 7 unmodified lines | ||
| 2654 | 2654 | */ |
| 2655 | 2655 | max_size = buffer_chain_size(); |
| 2656 | 2656 | dma_limit = (MAX_DMA_ADDRESS - |
| 2657 | − ((unsigned long)current_req->buffer)) >> 9; | |
| 2657 | + ((unsigned long)bio_data(current_req->bio))) >> 9; | |
| 2658 | 2658 | if ((unsigned long)max_size > dma_limit) |
| 2659 | 2659 | max_size = dma_limit; |
| 2660 | 2660 | /* 64 kb boundaries */ |
| 2661 | − if (CROSS_64KB(current_req->buffer, max_size << 9)) | |
| 2661 | + if (CROSS_64KB(bio_data(current_req->bio), max_size << 9)) | |
| 2662 | 2662 | max_size = (K_64 - |
| 2663 | − ((unsigned long)current_req->buffer) % | |
| 2663 | + ((unsigned long)bio_data(current_req->bio)) % | |
| 2664 | 2664 | K_64) >> 9; |
| 2665 | 2665 | direct = transfer_size(ssize, max_sector, max_size) - fsector_t; |
| 2666 | 2666 | /* |
| @@ -2677,7 +2677,7 @@ static int make_raw_rw_request(void) · 10 unmodified lines | ||
| 2677 | 2677 | (DP->read_track & (1 << DRS->probed_format)))))) { |
| 2678 | 2678 | max_size = blk_rq_sectors(current_req); |
| 2679 | 2679 | } else { |
| 2680 | − raw_cmd->kernel_data = current_req->buffer; | |
| 2680 | + raw_cmd->kernel_data = bio_data(current_req->bio); | |
| 2681 | 2681 | raw_cmd->length = current_count_sectors << 9; |
| 2682 | 2682 | if (raw_cmd->length == 0) { |
| 2683 | 2683 | DPRINT("%s: zero dma transfer attempted\n", __func__); |
| @@ -2731,7 +2731,7 @@ static int make_raw_rw_request(void) · 47 unmodified lines | ||
| 2731 | 2731 | raw_cmd->length = ((raw_cmd->length - 1) | (ssize - 1)) + 1; |
| 2732 | 2732 | raw_cmd->length <<= 9; |
| 2733 | 2733 | if ((raw_cmd->length < current_count_sectors << 9) || |
| 2734 | − (raw_cmd->kernel_data != current_req->buffer && | |
| 2734 | + (raw_cmd->kernel_data != bio_data(current_req->bio) && | |
| 2735 | 2735 | CT(COMMAND) == FD_WRITE && |
| 2736 | 2736 | (aligned_sector_t + (raw_cmd->length >> 9) > buffer_max || |
| 2737 | 2737 | aligned_sector_t < buffer_min)) || |
| @@ -2739,7 +2739,7 @@ static int make_raw_rw_request(void) · 1 unmodified line | ||
| 2739 | 2739 | raw_cmd->length <= 0 || current_count_sectors <= 0) { |
| 2740 | 2740 | DPRINT("fractionary current count b=%lx s=%lx\n", |
| 2741 | 2741 | raw_cmd->length, current_count_sectors); |
| 2742 | − if (raw_cmd->kernel_data != current_req->buffer) | |
| 2742 | + if (raw_cmd->kernel_data != bio_data(current_req->bio)) | |
| 2743 | 2743 | pr_info("addr=%d, length=%ld\n", |
| 2744 | 2744 | (int)((raw_cmd->kernel_data - |
| 2745 | 2745 | floppy_track_buffer) >> 9), |
| @@ -2756,7 +2756,7 @@ static int make_raw_rw_request(void) · 10 unmodified lines | ||
| 2756 | 2756 | return 0; |
| 2757 | 2757 | } |
| 2758 | 2758 | |
| 2759 | − if (raw_cmd->kernel_data != current_req->buffer) { | |
| 2759 | + if (raw_cmd->kernel_data != bio_data(current_req->bio)) { | |
| 2760 | 2760 | if (raw_cmd->kernel_data < floppy_track_buffer || |
| 2761 | 2761 | current_count_sectors < 0 || |
| 2762 | 2762 | raw_cmd->length < 0 || |
| @@ -464,11 +464,11 @@ static void read_intr(void) · 463 unmodified lines | ||
| 464 | 464 | |
| 465 | 465 | ok_to_read: |
| 466 | 466 | req = hd_req; |
| 467 | − insw(HD_DATA, req->buffer, 256); | |
| 467 | + insw(HD_DATA, bio_data(req->bio), 256); | |
| 468 | 468 | #ifdef DEBUG |
| 469 | 469 | printk("%s: read: sector %ld, remaining = %u, buffer=%p\n", |
| 470 | 470 | req->rq_disk->disk_name, blk_rq_pos(req) + 1, |
| 471 | − blk_rq_sectors(req) - 1, req->buffer+512); | |
| 471 | + blk_rq_sectors(req) - 1, bio_data(req->bio)+512); | |
| 472 | 472 | #endif |
| 473 | 473 | if (hd_end_request(0, 512)) { |
| 474 | 474 | SET_HANDLER(&read_intr); |
| @@ -505,7 +505,7 @@ static void write_intr(void) · 30 unmodified lines | ||
| 505 | 505 | ok_to_write: |
| 506 | 506 | if (hd_end_request(0, 512)) { |
| 507 | 507 | SET_HANDLER(&write_intr); |
| 508 | − outsw(HD_DATA, req->buffer, 256); | |
| 508 | + outsw(HD_DATA, bio_data(req->bio), 256); | |
| 509 | 509 | return; |
| 510 | 510 | } |
| 511 | 511 | |
| @@ -624,7 +624,7 @@ repeat: · 112 unmodified lines | ||
| 624 | 624 | printk("%s: %sing: CHS=%d/%d/%d, sectors=%d, buffer=%p\n", |
| 625 | 625 | req->rq_disk->disk_name, |
| 626 | 626 | req_data_dir(req) == READ ? "read" : "writ", |
| 627 | − cyl, head, sec, nsect, req->buffer); | |
| 627 | + cyl, head, sec, nsect, bio_data(req->bio)); | |
| 628 | 628 | #endif |
| 629 | 629 | if (req->cmd_type == REQ_TYPE_FS) { |
| 630 | 630 | switch (rq_data_dir(req)) { |
| @@ -643,7 +643,7 @@ repeat: · 12 unmodified lines | ||
| 643 | 643 | bad_rw_intr(); |
| 644 | 644 | goto repeat; |
| 645 | 645 | } |
| 646 | − outsw(HD_DATA, req->buffer, 256); | |
| 646 | + outsw(HD_DATA, bio_data(req->bio), 256); | |
| 647 | 647 | break; |
| 648 | 648 | default: |
| 649 | 649 | printk("unknown hd-command\n"); |
| @@ -479,7 +479,7 @@ static unsigned int mg_out(struct mg_host *host, · 478 unmodified lines | ||
| 479 | 479 | |
| 480 | 480 | static void mg_read_one(struct mg_host *host, struct request *req) |
| 481 | 481 | { |
| 482 | − u16 *buff = (u16 *)req->buffer; | |
| 482 | + u16 *buff = (u16 *)bio_data(req->bio); | |
| 483 | 483 | u32 i; |
| 484 | 484 | |
| 485 | 485 | for (i = 0; i < MG_SECTOR_SIZE >> 1; i++) |
| @@ -496,7 +496,7 @@ static void mg_read(struct request *req) · 10 unmodified lines | ||
| 496 | 496 | mg_bad_rw_intr(host); |
| 497 | 497 | |
| 498 | 498 | MG_DBG("requested %d sects (from %ld), buffer=0x%p\n", |
| 499 | − blk_rq_sectors(req), blk_rq_pos(req), req->buffer); | |
| 499 | + blk_rq_sectors(req), blk_rq_pos(req), bio_data(req->bio)); | |
| 500 | 500 | |
| 501 | 501 | do { |
| 502 | 502 | if (mg_wait(host, ATA_DRQ, |
| @@ -514,7 +514,7 @@ static void mg_read(struct request *req) · 11 unmodified lines | ||
| 514 | 514 | |
| 515 | 515 | static void mg_write_one(struct mg_host *host, struct request *req) |
| 516 | 516 | { |
| 517 | − u16 *buff = (u16 *)req->buffer; | |
| 517 | + u16 *buff = (u16 *)bio_data(req->bio); | |
| 518 | 518 | u32 i; |
| 519 | 519 | |
| 520 | 520 | for (i = 0; i < MG_SECTOR_SIZE >> 1; i++) |
| @@ -534,7 +534,7 @@ static void mg_write(struct request *req) · 13 unmodified lines | ||
| 534 | 534 | } |
| 535 | 535 | |
| 536 | 536 | MG_DBG("requested %d sects (from %ld), buffer=0x%p\n", |
| 537 | − rem, blk_rq_pos(req), req->buffer); | |
| 537 | + rem, blk_rq_pos(req), bio_data(req->bio)); | |
| 538 | 538 | |
| 539 | 539 | if (mg_wait(host, ATA_DRQ, |
| 540 | 540 | MG_TMAX_WAIT_WR_DRQ) != MG_ERR_NONE) { |
| @@ -585,7 +585,7 @@ ok_to_read: · 44 unmodified lines | ||
| 585 | 585 | mg_read_one(host, req); |
| 586 | 586 | |
| 587 | 587 | MG_DBG("sector %ld, remaining=%ld, buffer=0x%p\n", |
| 588 | − blk_rq_pos(req), blk_rq_sectors(req) - 1, req->buffer); | |
| 588 | + blk_rq_pos(req), blk_rq_sectors(req) - 1, bio_data(req->bio)); | |
| 589 | 589 | |
| 590 | 590 | /* send read confirm */ |
| 591 | 591 | outb(MG_CMD_RD_CONF, (unsigned long)host->dev_base + MG_REG_COMMAND); |
| @@ -624,7 +624,7 @@ ok_to_write: · 32 unmodified lines | ||
| 624 | 624 | /* write 1 sector and set handler if remains */ |
| 625 | 625 | mg_write_one(host, req); |
| 626 | 626 | MG_DBG("sector %ld, remaining=%ld, buffer=0x%p\n", |
| 627 | − blk_rq_pos(req), blk_rq_sectors(req), req->buffer); | |
| 627 | + blk_rq_pos(req), blk_rq_sectors(req), bio_data(req->bio)); | |
| 628 | 628 | host->mg_do_intr = mg_write_intr; |
| 629 | 629 | mod_timer(&host->timer, jiffies + 3 * HZ); |
| 630 | 630 | } |
| @@ -747,7 +747,7 @@ static void do_pcd_request(struct request_queue * q) · 746 unmodified lines | ||
| 747 | 747 | pcd_current = cd; |
| 748 | 748 | pcd_sector = blk_rq_pos(pcd_req); |
| 749 | 749 | pcd_count = blk_rq_cur_sectors(pcd_req); |
| 750 | − pcd_buf = pcd_req->buffer; | |
| 750 | + pcd_buf = bio_data(pcd_req->bio); | |
| 751 | 751 | pcd_busy = 1; |
| 752 | 752 | ps_set_intr(do_pcd_read, NULL, 0, nice); |
| 753 | 753 | return; |
| @@ -454,7 +454,7 @@ static enum action do_pd_io_start(void) · 453 unmodified lines | ||
| 454 | 454 | if (pd_block + pd_count > get_capacity(pd_req->rq_disk)) |
| 455 | 455 | return Fail; |
| 456 | 456 | pd_run = blk_rq_sectors(pd_req); |
| 457 | − pd_buf = pd_req->buffer; | |
| 457 | + pd_buf = bio_data(pd_req->bio); | |
| 458 | 458 | pd_retries = 0; |
| 459 | 459 | if (pd_cmd == READ) |
| 460 | 460 | return do_pd_read_start(); |
| @@ -485,7 +485,7 @@ static int pd_next_buf(void) · 24 unmodified lines | ||
| 485 | 485 | spin_lock_irqsave(&pd_lock, saved_flags); |
| 486 | 486 | __blk_end_request_cur(pd_req, 0); |
| 487 | 487 | pd_count = blk_rq_cur_sectors(pd_req); |
| 488 | − pd_buf = pd_req->buffer; | |
| 488 | + pd_buf = bio_data(pd_req->bio); | |
| 489 | 489 | spin_unlock_irqrestore(&pd_lock, saved_flags); |
| 490 | 490 | return 0; |
| 491 | 491 | } |
| @@ -795,7 +795,7 @@ repeat: · 794 unmodified lines | ||
| 795 | 795 | } |
| 796 | 796 | |
| 797 | 797 | pf_cmd = rq_data_dir(pf_req); |
| 798 | − pf_buf = pf_req->buffer; | |
| 798 | + pf_buf = bio_data(pf_req->bio); | |
| 799 | 799 | pf_retries = 0; |
| 800 | 800 | |
| 801 | 801 | pf_busy = 1; |
| @@ -827,7 +827,7 @@ static int pf_next_buf(void) · 25 unmodified lines | ||
| 827 | 827 | if (!pf_req) |
| 828 | 828 | return 1; |
| 829 | 829 | pf_count = blk_rq_cur_sectors(pf_req); |
| 830 | − pf_buf = pf_req->buffer; | |
| 830 | + pf_buf = bio_data(pf_req->bio); | |
| 831 | 831 | } |
| 832 | 832 | return 0; |
| 833 | 833 | } |
| @@ -563,7 +563,6 @@ skd_prep_discard_cdb(struct skd_scsi_request *scsi_req, · 562 unmodified lines | ||
| 563 | 563 | |
| 564 | 564 | req = skreq->req; |
| 565 | 565 | blk_add_request_payload(req, page, len); |
| 566 | − req->buffer = buf; | |
| 567 | 566 | } |
| 568 | 567 | |
| 569 | 568 | static void skd_request_fn_not_online(struct request_queue *q); |
| @@ -856,10 +855,10 @@ static void skd_end_request(struct skd_device *skdev, · 286 unmodified lines | ||
| 856 | 855 | |
| 857 | 856 | if ((io_flags & REQ_DISCARD) && |
| 858 | 857 | (skreq->discard_page == 1)) { |
| 858 | + struct bio *bio = req->bio; | |
| 859 | 859 | pr_debug("%s:%s:%d, free the page!", |
| 860 | 860 | skdev->name, __func__, __LINE__); |
| 861 | − free_page((unsigned long)req->buffer); | |
| 862 | − req->buffer = NULL; | |
| 861 | + __free_page(bio->bi_io_vec->bv_page); | |
| 863 | 862 | } |
| 864 | 863 | |
| 865 | 864 | if (unlikely(error)) { |
| @@ -549,7 +549,7 @@ static void redo_fd_request(struct request_queue *q) · 548 unmodified lines | ||
| 549 | 549 | case READ: |
| 550 | 550 | err = floppy_read_sectors(fs, blk_rq_pos(req), |
| 551 | 551 | blk_rq_cur_sectors(req), |
| 552 | − req->buffer); | |
| 552 | + bio_data(req->bio)); | |
| 553 | 553 | break; |
| 554 | 554 | } |
| 555 | 555 | done: |
| @@ -342,7 +342,7 @@ static void start_request(struct floppy_state *fs) · 341 unmodified lines | ||
| 342 | 342 | swim3_dbg("do_fd_req: dev=%s cmd=%d sec=%ld nr_sec=%u buf=%p\n", |
| 343 | 343 | req->rq_disk->disk_name, req->cmd, |
| 344 | 344 | (long)blk_rq_pos(req), blk_rq_sectors(req), |
| 345 | − req->buffer); | |
| 345 | + bio_data(req->bio)); | |
| 346 | 346 | swim3_dbg(" errors=%d current_nr_sectors=%u\n", |
| 347 | 347 | req->errors, blk_rq_cur_sectors(req)); |
| 348 | 348 | #endif |
| @@ -479,11 +479,11 @@ static inline void setup_transfer(struct floppy_state *fs) · 130 unmodified lines | ||
| 479 | 479 | /* Set up 3 dma commands: write preamble, data, postamble */ |
| 480 | 480 | init_dma(cp, OUTPUT_MORE, write_preamble, sizeof(write_preamble)); |
| 481 | 481 | ++cp; |
| 482 | − init_dma(cp, OUTPUT_MORE, req->buffer, 512); | |
| 482 | + init_dma(cp, OUTPUT_MORE, bio_data(req->bio), 512); | |
| 483 | 483 | ++cp; |
| 484 | 484 | init_dma(cp, OUTPUT_LAST, write_postamble, sizeof(write_postamble)); |
| 485 | 485 | } else { |
| 486 | − init_dma(cp, INPUT_LAST, req->buffer, n * 512); | |
| 486 | + init_dma(cp, INPUT_LAST, bio_data(req->bio), n * 512); | |
| 487 | 487 | } |
| 488 | 488 | ++cp; |
| 489 | 489 | out_le16(&cp->command, DBDMA_STOP); |
| @@ -612,10 +612,10 @@ static void do_blkif_request(struct request_queue *rq) · 611 unmodified lines | ||
| 612 | 612 | } |
| 613 | 613 | |
| 614 | 614 | pr_debug("do_blk_req %p: cmd %p, sec %lx, " |
| 615 | − "(%u/%u) buffer:%p [%s]\n", | |
| 615 | + "(%u/%u) [%s]\n", | |
| 616 | 616 | req, req->cmd, (unsigned long)blk_rq_pos(req), |
| 617 | 617 | blk_rq_cur_sectors(req), blk_rq_sectors(req), |
| 618 | − req->buffer, rq_data_dir(req) ? "write" : "read"); | |
| 618 | + rq_data_dir(req) ? "write" : "read"); | |
| 619 | 619 | |
| 620 | 620 | if (blkif_queue_request(req)) { |
| 621 | 621 | blk_requeue_request(rq, req); |
| @@ -661,7 +661,7 @@ static void ace_fsm_dostate(struct ace_device *ace) · 660 unmodified lines | ||
| 661 | 661 | rq_data_dir(req)); |
| 662 | 662 | |
| 663 | 663 | ace->req = req; |
| 664 | − ace->data_ptr = req->buffer; | |
| 664 | + ace->data_ptr = bio_data(req->bio); | |
| 665 | 665 | ace->data_count = blk_rq_cur_sectors(req) * ACE_BUF_PER_SECTOR; |
| 666 | 666 | ace_out32(ace, ACE_MPULBA, blk_rq_pos(req) & 0x0FFFFFFF); |
| 667 | 667 | |
| @@ -733,7 +733,7 @@ static void ace_fsm_dostate(struct ace_device *ace) · 65 unmodified lines | ||
| 733 | 733 | * blk_rq_sectors(ace->req), |
| 734 | 734 | * blk_rq_cur_sectors(ace->req)); |
| 735 | 735 | */ |
| 736 | − ace->data_ptr = ace->req->buffer; | |
| 736 | + ace->data_ptr = bio_data(ace->req->bio); | |
| 737 | 737 | ace->data_count = blk_rq_cur_sectors(ace->req) * 16; |
| 738 | 738 | ace_fsm_yieldirq(ace); |
| 739 | 739 | break; |
| @@ -87,13 +87,15 @@ static void do_z2_request(struct request_queue *q) · 86 unmodified lines | ||
| 87 | 87 | while (len) { |
| 88 | 88 | unsigned long addr = start & Z2RAM_CHUNKMASK; |
| 89 | 89 | unsigned long size = Z2RAM_CHUNKSIZE - addr; |
| 90 | + void *buffer = bio_data(req->bio); | |
| 91 | + | |
| 90 | 92 | if (len < size) |
| 91 | 93 | size = len; |
| 92 | 94 | addr += z2ram_map[ start >> Z2RAM_CHUNKSHIFT ]; |
| 93 | 95 | if (rq_data_dir(req) == READ) |
| 94 | − memcpy(req->buffer, (char *)addr, size); | |
| 96 | + memcpy(buffer, (char *)addr, size); | |
| 95 | 97 | else |
| 96 | − memcpy((char *)addr, req->buffer, size); | |
| 98 | + memcpy((char *)addr, buffer, size); | |
| 97 | 99 | start += size; |
| 98 | 100 | len -= size; |
| 99 | 101 | } |
| @@ -188,10 +188,9 @@ static ide_startstop_t ide_do_rw_disk(ide_drive_t *drive, struct request *rq, · 187 unmodified lines | ||
| 188 | 188 | |
| 189 | 189 | ledtrig_ide_activity(); |
| 190 | 190 | |
| 191 | − pr_debug("%s: %sing: block=%llu, sectors=%u, buffer=0x%08lx\n", | |
| 191 | + pr_debug("%s: %sing: block=%llu, sectors=%u\n", | |
| 192 | 192 | drive->name, rq_data_dir(rq) == READ ? "read" : "writ", |
| 193 | − (unsigned long long)block, blk_rq_sectors(rq), | |
| 194 | − (unsigned long)rq->buffer); | |
| 193 | + (unsigned long long)block, blk_rq_sectors(rq)); | |
| 195 | 194 | |
| 196 | 195 | if (hwif->rw_disk) |
| 197 | 196 | hwif->rw_disk(drive, rq); |
| @@ -1544,7 +1544,6 @@ static int setup_clone(struct request *clone, struct request *rq, · 1543 unmodified lines | ||
| 1544 | 1544 | clone->cmd = rq->cmd; |
| 1545 | 1545 | clone->cmd_len = rq->cmd_len; |
| 1546 | 1546 | clone->sense = rq->sense; |
| 1547 | − clone->buffer = rq->buffer; | |
| 1548 | 1547 | clone->end_io = end_clone_request; |
| 1549 | 1548 | clone->end_io_data = tio; |
| 1550 | 1549 | |
| @@ -82,8 +82,7 @@ static int do_blktrans_request(struct mtd_blktrans_ops *tr, · 81 unmodified lines | ||
| 82 | 82 | |
| 83 | 83 | block = blk_rq_pos(req) << 9 >> tr->blkshift; |
| 84 | 84 | nsect = blk_rq_cur_bytes(req) >> tr->blkshift; |
| 85 | − | |
| 86 | − buf = req->buffer; | |
| 85 | + buf = bio_data(req->bio); | |
| 87 | 86 | |
| 88 | 87 | if (req->cmd_type != REQ_TYPE_FS) |
| 89 | 88 | return -EIO; |
| @@ -253,7 +253,7 @@ static int do_ubiblock_request(struct ubiblock *dev, struct request *req) · 252 unmodified lines | ||
| 253 | 253 | * flash access anyway. |
| 254 | 254 | */ |
| 255 | 255 | mutex_lock(&dev->dev_mutex); |
| 256 | − ret = ubiblock_read(dev, req->buffer, sec, len); | |
| 256 | + ret = ubiblock_read(dev, bio_data(req->bio), sec, len); | |
| 257 | 257 | mutex_unlock(&dev->dev_mutex); |
| 258 | 258 | |
| 259 | 259 | return ret; |
| @@ -1018,8 +1018,6 @@ static int scsi_init_sgtable(struct request *req, struct scsi_data_buffer *sdb, · 1017 unmodified lines | ||
| 1018 | 1018 | return BLKPREP_DEFER; |
| 1019 | 1019 | } |
| 1020 | 1020 | |
| 1021 | − req->buffer = NULL; | |
| 1022 | − | |
| 1023 | 1021 | /* |
| 1024 | 1022 | * Next, walk the list, and fill in the addresses and sizes of |
| 1025 | 1023 | * each segment. |
| @@ -1156,7 +1154,6 @@ int scsi_setup_blk_pc_cmnd(struct scsi_device *sdev, struct request *req) · 130 unmodified lines | ||
| 1156 | 1154 | BUG_ON(blk_rq_bytes(req)); |
| 1157 | 1155 | |
| 1158 | 1156 | memset(&cmd->sdb, 0, sizeof(cmd->sdb)); |
| 1159 | − req->buffer = NULL; | |
| 1160 | 1157 | } |
| 1161 | 1158 | |
| 1162 | 1159 | cmd->cmd_len = req->cmd_len; |
| @@ -739,14 +739,11 @@ static int sd_setup_discard_cmnd(struct scsi_device *sdp, struct request *rq) · 738 unmodified lines | ||
| 739 | 739 | |
| 740 | 740 | blk_add_request_payload(rq, page, len); |
| 741 | 741 | ret = scsi_setup_blk_pc_cmnd(sdp, rq); |
| 742 | − rq->buffer = page_address(page); | |
| 743 | 742 | rq->__data_len = nr_bytes; |
| 744 | 743 | |
| 745 | 744 | out: |
| 746 | − if (ret != BLKPREP_OK) { | |
| 745 | + if (ret != BLKPREP_OK) | |
| 747 | 746 | __free_page(page); |
| 748 | − rq->buffer = NULL; | |
| 749 | − } | |
| 750 | 747 | return ret; |
| 751 | 748 | } |
| 752 | 749 | |
| @@ -843,8 +840,9 @@ static void sd_unprep_fn(struct request_queue *q, struct request *rq) · 90 unmodified lines | ||
| 843 | 840 | struct scsi_cmnd *SCpnt = rq->special; |
| 844 | 841 | |
| 845 | 842 | if (rq->cmd_flags & REQ_DISCARD) { |
| 846 | − free_page((unsigned long)rq->buffer); | |
| 847 | − rq->buffer = NULL; | |
| 843 | + struct bio *bio = rq->bio; | |
| 844 | + | |
| 845 | + __free_page(bio->bi_io_vec->bv_page); | |
| 848 | 846 | } |
| 849 | 847 | if (SCpnt->cmnd != rq->cmd) { |
| 850 | 848 | mempool_free(SCpnt->cmnd, sd_cdb_pool); |
| @@ -178,7 +178,6 @@ struct request { · 177 unmodified lines | ||
| 178 | 178 | unsigned short ioprio; |
| 179 | 179 | |
| 180 | 180 | void *special; /* opaque pointer available for LLD use */ |
| 181 | − char *buffer; /* kaddr of the current segment if available */ | |
| 182 | 181 | |
| 183 | 182 | int tag; |
| 184 | 183 | int errors; |