History

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.

Jens Axboe committed 12 years ago

Commit b4f42e21 parent f89e0dd23 files · +55 −75Browse files

Unified · Split

23 files
  1. block/blk-core.c +6 −15
  2. block/blk-map.c +0 −3
  3. drivers/block/amiflop.c +1 −1
  4. drivers/block/ataflop.c +1 −1
  5. drivers/block/floppy.c +9 −9
  6. drivers/block/hd.c +5 −5
  7. drivers/block/mg_disk.c +6 −6
  8. drivers/block/paride/pcd.c +1 −1
  9. drivers/block/paride/pd.c +2 −2
  10. drivers/block/paride/pf.c +2 −2
  11. drivers/block/skd_main.c +2 −3
  12. drivers/block/swim.c +1 −1
  13. drivers/block/swim3.c +3 −3
  14. drivers/block/xen-blkfront.c +2 −2
  15. drivers/block/xsysace.c +2 −2
  16. drivers/block/z2ram.c +4 −2
  17. drivers/ide/ide-disk.c +2 −3
  18. drivers/md/dm.c +0 −1
  19. drivers/mtd/mtd_blkdevs.c +1 −2
  20. drivers/mtd/ubi/block.c +1 −1
  21. drivers/scsi/scsi_lib.c +0 −3
  22. drivers/scsi/sd.c +4 −6
  23. include/linux/blkdev.h +0 −1
block/blk-core.c+6−15
@@ -146,8 +146,8 @@ void blk_dump_rq_flags(struct request *rq, char *msg) · 145 unmodified lines
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, · 1206 unmodified lines
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}
1365EXPORT_SYMBOL_GPL(blk_add_request_payload);1364EXPORT_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 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) · 1020 unmodified lines
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, · 311 unmodified lines
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); · 69 unmodified lines
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 */
2836static void __blk_rq_prep_clone(struct request *dst, struct request *src)2827static 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 * 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 copied2853 * 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.
block/blk-map.c+0−3
@@ -155,7 +155,6 @@ int blk_rq_map_user(struct request_queue *q, struct request *rq, · 154 unmodified lines
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;
160unmap_rq:159unmap_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, · 76 unmodified lines
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}
244EXPORT_SYMBOL(blk_rq_map_user_iov);242EXPORT_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 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}
331EXPORT_SYMBOL(blk_rq_map_kern);328EXPORT_SYMBOL(blk_rq_map_kern);
drivers/block/amiflop.c+1−1
@@ -1406,7 +1406,7 @@ next_segment: · 1405 unmodified lines
1406 1406
1407 track = block / (floppy->dtype->sects * floppy->type->sect_mult);1407 track = block / (floppy->dtype->sects * floppy->type->sect_mult);
1408 sector = block % (floppy->dtype->sects * floppy->type->sect_mult);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#ifdef DEBUG1410#ifdef DEBUG
1411 printk("access to track %d, sector %d, with buffer at "1411 printk("access to track %d, sector %d, with buffer at "
1412 "0x%08lx\n", track, sector, data);1412 "0x%08lx\n", track, sector, data);
drivers/block/ataflop.c+1−1
@@ -1484,7 +1484,7 @@ repeat: · 1483 unmodified lines
1484 ReqCnt = 0;1484 ReqCnt = 0;
1485 ReqCmd = rq_data_dir(fd_request);1485 ReqCmd = rq_data_dir(fd_request);
1486 ReqBlock = blk_rq_pos(fd_request);1486 ReqBlock = blk_rq_pos(fd_request);
1487 ReqBuffer = fd_request->buffer;1487 ReqBuffer = bio_data(fd_request->bio);
1488 setup_req_params( drive );1488 setup_req_params( drive );
1489 do_fd_action( drive );1489 do_fd_action( drive );
1490 1490
drivers/block/floppy.c+9−9
@@ -2351,7 +2351,7 @@ static void rw_interrupt(void) · 2350 unmodified lines
2351 }2351 }
2352 2352
2353 if (CT(COMMAND) != FD_READ ||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 /* transfer directly from buffer */2355 /* transfer directly from buffer */
2356 cont->done(1);2356 cont->done(1);
2357 } else if (CT(COMMAND) == FD_READ) {2357 } else if (CT(COMMAND) == FD_READ) {
@@ -2640,7 +2640,7 @@ static int make_raw_rw_request(void) · 282 unmodified lines
2640 raw_cmd->flags &= ~FD_RAW_WRITE;2640 raw_cmd->flags &= ~FD_RAW_WRITE;
2641 raw_cmd->flags |= FD_RAW_READ;2641 raw_cmd->flags |= FD_RAW_READ;
2642 COMMAND = FM_MODE(_floppy, FD_READ);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 unsigned long dma_limit;2644 unsigned long dma_limit;
2645 int direct, indirect;2645 int direct, indirect;
2646 2646
@@ -2654,13 +2654,13 @@ static int make_raw_rw_request(void) · 7 unmodified lines
2654 */2654 */
2655 max_size = buffer_chain_size();2655 max_size = buffer_chain_size();
2656 dma_limit = (MAX_DMA_ADDRESS -2656 dma_limit = (MAX_DMA_ADDRESS -
2657 ((unsigned long)current_req->buffer)) >> 9;2657 ((unsigned long)bio_data(current_req->bio))) >> 9;
2658 if ((unsigned long)max_size > dma_limit)2658 if ((unsigned long)max_size > dma_limit)
2659 max_size = dma_limit;2659 max_size = dma_limit;
2660 /* 64 kb boundaries */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 max_size = (K_64 -2662 max_size = (K_64 -
2663 ((unsigned long)current_req->buffer) %2663 ((unsigned long)bio_data(current_req->bio)) %
2664 K_64) >> 9;2664 K_64) >> 9;
2665 direct = transfer_size(ssize, max_sector, max_size) - fsector_t;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 (DP->read_track & (1 << DRS->probed_format)))))) {2677 (DP->read_track & (1 << DRS->probed_format)))))) {
2678 max_size = blk_rq_sectors(current_req);2678 max_size = blk_rq_sectors(current_req);
2679 } else {2679 } else {
2680 raw_cmd->kernel_data = current_req->buffer;2680 raw_cmd->kernel_data = bio_data(current_req->bio);
2681 raw_cmd->length = current_count_sectors << 9;2681 raw_cmd->length = current_count_sectors << 9;
2682 if (raw_cmd->length == 0) {2682 if (raw_cmd->length == 0) {
2683 DPRINT("%s: zero dma transfer attempted\n", __func__);2683 DPRINT("%s: zero dma transfer attempted\n", __func__);
@@ -2731,7 +2731,7 @@ static int make_raw_rw_request(void) · 47 unmodified lines
2731 raw_cmd->length = ((raw_cmd->length - 1) | (ssize - 1)) + 1;2731 raw_cmd->length = ((raw_cmd->length - 1) | (ssize - 1)) + 1;
2732 raw_cmd->length <<= 9;2732 raw_cmd->length <<= 9;
2733 if ((raw_cmd->length < current_count_sectors << 9) ||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 CT(COMMAND) == FD_WRITE &&2735 CT(COMMAND) == FD_WRITE &&
2736 (aligned_sector_t + (raw_cmd->length >> 9) > buffer_max ||2736 (aligned_sector_t + (raw_cmd->length >> 9) > buffer_max ||
2737 aligned_sector_t < buffer_min)) ||2737 aligned_sector_t < buffer_min)) ||
@@ -2739,7 +2739,7 @@ static int make_raw_rw_request(void) · 1 unmodified line
2739 raw_cmd->length <= 0 || current_count_sectors <= 0) {2739 raw_cmd->length <= 0 || current_count_sectors <= 0) {
2740 DPRINT("fractionary current count b=%lx s=%lx\n",2740 DPRINT("fractionary current count b=%lx s=%lx\n",
2741 raw_cmd->length, current_count_sectors);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 pr_info("addr=%d, length=%ld\n",2743 pr_info("addr=%d, length=%ld\n",
2744 (int)((raw_cmd->kernel_data -2744 (int)((raw_cmd->kernel_data -
2745 floppy_track_buffer) >> 9),2745 floppy_track_buffer) >> 9),
@@ -2756,7 +2756,7 @@ static int make_raw_rw_request(void) · 10 unmodified lines
2756 return 0;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 if (raw_cmd->kernel_data < floppy_track_buffer ||2760 if (raw_cmd->kernel_data < floppy_track_buffer ||
2761 current_count_sectors < 0 ||2761 current_count_sectors < 0 ||
2762 raw_cmd->length < 0 ||2762 raw_cmd->length < 0 ||
drivers/block/hd.c+5−5
@@ -464,11 +464,11 @@ static void read_intr(void) · 463 unmodified lines
464 464
465ok_to_read:465ok_to_read:
466 req = hd_req;466 req = hd_req;
467 insw(HD_DATA, req->buffer, 256);467 insw(HD_DATA, bio_data(req->bio), 256);
468#ifdef DEBUG468#ifdef DEBUG
469 printk("%s: read: sector %ld, remaining = %u, buffer=%p\n",469 printk("%s: read: sector %ld, remaining = %u, buffer=%p\n",
470 req->rq_disk->disk_name, blk_rq_pos(req) + 1,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#endif472#endif
473 if (hd_end_request(0, 512)) {473 if (hd_end_request(0, 512)) {
474 SET_HANDLER(&read_intr);474 SET_HANDLER(&read_intr);
@@ -505,7 +505,7 @@ static void write_intr(void) · 30 unmodified lines
505ok_to_write:505ok_to_write:
506 if (hd_end_request(0, 512)) {506 if (hd_end_request(0, 512)) {
507 SET_HANDLER(&write_intr);507 SET_HANDLER(&write_intr);
508 outsw(HD_DATA, req->buffer, 256);508 outsw(HD_DATA, bio_data(req->bio), 256);
509 return;509 return;
510 }510 }
511 511
@@ -624,7 +624,7 @@ repeat: · 112 unmodified lines
624 printk("%s: %sing: CHS=%d/%d/%d, sectors=%d, buffer=%p\n",624 printk("%s: %sing: CHS=%d/%d/%d, sectors=%d, buffer=%p\n",
625 req->rq_disk->disk_name,625 req->rq_disk->disk_name,
626 req_data_dir(req) == READ ? "read" : "writ",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#endif628#endif
629 if (req->cmd_type == REQ_TYPE_FS) {629 if (req->cmd_type == REQ_TYPE_FS) {
630 switch (rq_data_dir(req)) {630 switch (rq_data_dir(req)) {
@@ -643,7 +643,7 @@ repeat: · 12 unmodified lines
643 bad_rw_intr();643 bad_rw_intr();
644 goto repeat;644 goto repeat;
645 }645 }
646 outsw(HD_DATA, req->buffer, 256);646 outsw(HD_DATA, bio_data(req->bio), 256);
647 break;647 break;
648 default:648 default:
649 printk("unknown hd-command\n");649 printk("unknown hd-command\n");
drivers/block/mg_disk.c+6−6
@@ -479,7 +479,7 @@ static unsigned int mg_out(struct mg_host *host, · 478 unmodified lines
479 479
480static void mg_read_one(struct mg_host *host, struct request *req)480static 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 u32 i;483 u32 i;
484 484
485 for (i = 0; i < MG_SECTOR_SIZE >> 1; i++)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 mg_bad_rw_intr(host);496 mg_bad_rw_intr(host);
497 497
498 MG_DBG("requested %d sects (from %ld), buffer=0x%p\n",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 do {501 do {
502 if (mg_wait(host, ATA_DRQ,502 if (mg_wait(host, ATA_DRQ,
@@ -514,7 +514,7 @@ static void mg_read(struct request *req) · 11 unmodified lines
514 514
515static void mg_write_one(struct mg_host *host, struct request *req)515static 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 u32 i;518 u32 i;
519 519
520 for (i = 0; i < MG_SECTOR_SIZE >> 1; i++)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 MG_DBG("requested %d sects (from %ld), buffer=0x%p\n",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 if (mg_wait(host, ATA_DRQ,539 if (mg_wait(host, ATA_DRQ,
540 MG_TMAX_WAIT_WR_DRQ) != MG_ERR_NONE) {540 MG_TMAX_WAIT_WR_DRQ) != MG_ERR_NONE) {
@@ -585,7 +585,7 @@ ok_to_read: · 44 unmodified lines
585 mg_read_one(host, req);585 mg_read_one(host, req);
586 586
587 MG_DBG("sector %ld, remaining=%ld, buffer=0x%p\n",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 /* send read confirm */590 /* send read confirm */
591 outb(MG_CMD_RD_CONF, (unsigned long)host->dev_base + MG_REG_COMMAND);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 /* write 1 sector and set handler if remains */624 /* write 1 sector and set handler if remains */
625 mg_write_one(host, req);625 mg_write_one(host, req);
626 MG_DBG("sector %ld, remaining=%ld, buffer=0x%p\n",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 host->mg_do_intr = mg_write_intr;628 host->mg_do_intr = mg_write_intr;
629 mod_timer(&host->timer, jiffies + 3 * HZ);629 mod_timer(&host->timer, jiffies + 3 * HZ);
630 }630 }
drivers/block/paride/pcd.c+1−1
@@ -747,7 +747,7 @@ static void do_pcd_request(struct request_queue * q) · 746 unmodified lines
747 pcd_current = cd;747 pcd_current = cd;
748 pcd_sector = blk_rq_pos(pcd_req);748 pcd_sector = blk_rq_pos(pcd_req);
749 pcd_count = blk_rq_cur_sectors(pcd_req);749 pcd_count = blk_rq_cur_sectors(pcd_req);
750 pcd_buf = pcd_req->buffer;750 pcd_buf = bio_data(pcd_req->bio);
751 pcd_busy = 1;751 pcd_busy = 1;
752 ps_set_intr(do_pcd_read, NULL, 0, nice);752 ps_set_intr(do_pcd_read, NULL, 0, nice);
753 return;753 return;
drivers/block/paride/pd.c+2−2
@@ -454,7 +454,7 @@ static enum action do_pd_io_start(void) · 453 unmodified lines
454 if (pd_block + pd_count > get_capacity(pd_req->rq_disk))454 if (pd_block + pd_count > get_capacity(pd_req->rq_disk))
455 return Fail;455 return Fail;
456 pd_run = blk_rq_sectors(pd_req);456 pd_run = blk_rq_sectors(pd_req);
457 pd_buf = pd_req->buffer;457 pd_buf = bio_data(pd_req->bio);
458 pd_retries = 0;458 pd_retries = 0;
459 if (pd_cmd == READ)459 if (pd_cmd == READ)
460 return do_pd_read_start();460 return do_pd_read_start();
@@ -485,7 +485,7 @@ static int pd_next_buf(void) · 24 unmodified lines
485 spin_lock_irqsave(&pd_lock, saved_flags);485 spin_lock_irqsave(&pd_lock, saved_flags);
486 __blk_end_request_cur(pd_req, 0);486 __blk_end_request_cur(pd_req, 0);
487 pd_count = blk_rq_cur_sectors(pd_req);487 pd_count = blk_rq_cur_sectors(pd_req);
488 pd_buf = pd_req->buffer;488 pd_buf = bio_data(pd_req->bio);
489 spin_unlock_irqrestore(&pd_lock, saved_flags);489 spin_unlock_irqrestore(&pd_lock, saved_flags);
490 return 0;490 return 0;
491}491}
drivers/block/paride/pf.c+2−2
@@ -795,7 +795,7 @@ repeat: · 794 unmodified lines
795 }795 }
796 796
797 pf_cmd = rq_data_dir(pf_req);797 pf_cmd = rq_data_dir(pf_req);
798 pf_buf = pf_req->buffer;798 pf_buf = bio_data(pf_req->bio);
799 pf_retries = 0;799 pf_retries = 0;
800 800
801 pf_busy = 1;801 pf_busy = 1;
@@ -827,7 +827,7 @@ static int pf_next_buf(void) · 25 unmodified lines
827 if (!pf_req)827 if (!pf_req)
828 return 1;828 return 1;
829 pf_count = blk_rq_cur_sectors(pf_req);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 return 0;832 return 0;
833}833}
drivers/block/skd_main.c+2−3
@@ -563,7 +563,6 @@ skd_prep_discard_cdb(struct skd_scsi_request *scsi_req, · 562 unmodified lines
563 563
564 req = skreq->req;564 req = skreq->req;
565 blk_add_request_payload(req, page, len);565 blk_add_request_payload(req, page, len);
566 req->buffer = buf;
567}566}
568 567
569static void skd_request_fn_not_online(struct request_queue *q);568static 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 if ((io_flags & REQ_DISCARD) &&856 if ((io_flags & REQ_DISCARD) &&
858 (skreq->discard_page == 1)) {857 (skreq->discard_page == 1)) {
858 struct bio *bio = req->bio;
859 pr_debug("%s:%s:%d, free the page!",859 pr_debug("%s:%s:%d, free the page!",
860 skdev->name, __func__, __LINE__);860 skdev->name, __func__, __LINE__);
861 free_page((unsigned long)req->buffer);861 __free_page(bio->bi_io_vec->bv_page);
862 req->buffer = NULL;
863 }862 }
864 863
865 if (unlikely(error)) {864 if (unlikely(error)) {
drivers/block/swim.c+1−1
@@ -549,7 +549,7 @@ static void redo_fd_request(struct request_queue *q) · 548 unmodified lines
549 case READ:549 case READ:
550 err = floppy_read_sectors(fs, blk_rq_pos(req),550 err = floppy_read_sectors(fs, blk_rq_pos(req),
551 blk_rq_cur_sectors(req),551 blk_rq_cur_sectors(req),
552 req->buffer);552 bio_data(req->bio));
553 break;553 break;
554 }554 }
555 done:555 done:
drivers/block/swim3.c+3−3
@@ -342,7 +342,7 @@ static void start_request(struct floppy_state *fs) · 341 unmodified lines
342 swim3_dbg("do_fd_req: dev=%s cmd=%d sec=%ld nr_sec=%u buf=%p\n",342 swim3_dbg("do_fd_req: dev=%s cmd=%d sec=%ld nr_sec=%u buf=%p\n",
343 req->rq_disk->disk_name, req->cmd,343 req->rq_disk->disk_name, req->cmd,
344 (long)blk_rq_pos(req), blk_rq_sectors(req),344 (long)blk_rq_pos(req), blk_rq_sectors(req),
345 req->buffer);345 bio_data(req->bio));
346 swim3_dbg(" errors=%d current_nr_sectors=%u\n",346 swim3_dbg(" errors=%d current_nr_sectors=%u\n",
347 req->errors, blk_rq_cur_sectors(req));347 req->errors, blk_rq_cur_sectors(req));
348#endif348#endif
@@ -479,11 +479,11 @@ static inline void setup_transfer(struct floppy_state *fs) · 130 unmodified lines
479 /* Set up 3 dma commands: write preamble, data, postamble */479 /* Set up 3 dma commands: write preamble, data, postamble */
480 init_dma(cp, OUTPUT_MORE, write_preamble, sizeof(write_preamble));480 init_dma(cp, OUTPUT_MORE, write_preamble, sizeof(write_preamble));
481 ++cp;481 ++cp;
482 init_dma(cp, OUTPUT_MORE, req->buffer, 512);482 init_dma(cp, OUTPUT_MORE, bio_data(req->bio), 512);
483 ++cp;483 ++cp;
484 init_dma(cp, OUTPUT_LAST, write_postamble, sizeof(write_postamble));484 init_dma(cp, OUTPUT_LAST, write_postamble, sizeof(write_postamble));
485 } else {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 ++cp;488 ++cp;
489 out_le16(&cp->command, DBDMA_STOP);489 out_le16(&cp->command, DBDMA_STOP);
drivers/block/xen-blkfront.c+2−2
@@ -612,10 +612,10 @@ static void do_blkif_request(struct request_queue *rq) · 611 unmodified lines
612 }612 }
613 613
614 pr_debug("do_blk_req %p: cmd %p, sec %lx, "614 pr_debug("do_blk_req %p: cmd %p, sec %lx, "
615 "(%u/%u) buffer:%p [%s]\n",615 "(%u/%u) [%s]\n",
616 req, req->cmd, (unsigned long)blk_rq_pos(req),616 req, req->cmd, (unsigned long)blk_rq_pos(req),
617 blk_rq_cur_sectors(req), blk_rq_sectors(req),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 if (blkif_queue_request(req)) {620 if (blkif_queue_request(req)) {
621 blk_requeue_request(rq, req);621 blk_requeue_request(rq, req);
drivers/block/xsysace.c+2−2
@@ -661,7 +661,7 @@ static void ace_fsm_dostate(struct ace_device *ace) · 660 unmodified lines
661 rq_data_dir(req));661 rq_data_dir(req));
662 662
663 ace->req = req;663 ace->req = req;
664 ace->data_ptr = req->buffer;664 ace->data_ptr = bio_data(req->bio);
665 ace->data_count = blk_rq_cur_sectors(req) * ACE_BUF_PER_SECTOR;665 ace->data_count = blk_rq_cur_sectors(req) * ACE_BUF_PER_SECTOR;
666 ace_out32(ace, ACE_MPULBA, blk_rq_pos(req) & 0x0FFFFFFF);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 * blk_rq_sectors(ace->req),733 * blk_rq_sectors(ace->req),
734 * blk_rq_cur_sectors(ace->req));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 ace->data_count = blk_rq_cur_sectors(ace->req) * 16;737 ace->data_count = blk_rq_cur_sectors(ace->req) * 16;
738 ace_fsm_yieldirq(ace);738 ace_fsm_yieldirq(ace);
739 break;739 break;
drivers/block/z2ram.c+4−2
@@ -87,13 +87,15 @@ static void do_z2_request(struct request_queue *q) · 86 unmodified lines
87 while (len) {87 while (len) {
88 unsigned long addr = start & Z2RAM_CHUNKMASK;88 unsigned long addr = start & Z2RAM_CHUNKMASK;
89 unsigned long size = Z2RAM_CHUNKSIZE - addr;89 unsigned long size = Z2RAM_CHUNKSIZE - addr;
90 void *buffer = bio_data(req->bio);
91
90 if (len < size)92 if (len < size)
91 size = len;93 size = len;
92 addr += z2ram_map[ start >> Z2RAM_CHUNKSHIFT ];94 addr += z2ram_map[ start >> Z2RAM_CHUNKSHIFT ];
93 if (rq_data_dir(req) == READ)95 if (rq_data_dir(req) == READ)
94 memcpy(req->buffer, (char *)addr, size);96 memcpy(buffer, (char *)addr, size);
95 else97 else
96 memcpy((char *)addr, req->buffer, size);98 memcpy((char *)addr, buffer, size);
97 start += size;99 start += size;
98 len -= size;100 len -= size;
99 }101 }
drivers/ide/ide-disk.c+2−3
@@ -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 ledtrig_ide_activity();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 drive->name, rq_data_dir(rq) == READ ? "read" : "writ",192 drive->name, rq_data_dir(rq) == READ ? "read" : "writ",
193 (unsigned long long)block, blk_rq_sectors(rq),193 (unsigned long long)block, blk_rq_sectors(rq));
194 (unsigned long)rq->buffer);
195 194
196 if (hwif->rw_disk)195 if (hwif->rw_disk)
197 hwif->rw_disk(drive, rq);196 hwif->rw_disk(drive, rq);
drivers/md/dm.c+0−1
@@ -1544,7 +1544,6 @@ static int setup_clone(struct request *clone, struct request *rq, · 1543 unmodified lines
1544 clone->cmd = rq->cmd;1544 clone->cmd = rq->cmd;
1545 clone->cmd_len = rq->cmd_len;1545 clone->cmd_len = rq->cmd_len;
1546 clone->sense = rq->sense;1546 clone->sense = rq->sense;
1547 clone->buffer = rq->buffer;
1548 clone->end_io = end_clone_request;1547 clone->end_io = end_clone_request;
1549 clone->end_io_data = tio;1548 clone->end_io_data = tio;
1550 1549
drivers/mtd/mtd_blkdevs.c+1−2
@@ -82,8 +82,7 @@ static int do_blktrans_request(struct mtd_blktrans_ops *tr, · 81 unmodified lines
82 82
83 block = blk_rq_pos(req) << 9 >> tr->blkshift;83 block = blk_rq_pos(req) << 9 >> tr->blkshift;
84 nsect = blk_rq_cur_bytes(req) >> tr->blkshift;84 nsect = blk_rq_cur_bytes(req) >> tr->blkshift;
85 85 buf = bio_data(req->bio);
86 buf = req->buffer;
87 86
88 if (req->cmd_type != REQ_TYPE_FS)87 if (req->cmd_type != REQ_TYPE_FS)
89 return -EIO;88 return -EIO;
drivers/mtd/ubi/block.c+1−1
@@ -253,7 +253,7 @@ static int do_ubiblock_request(struct ubiblock *dev, struct request *req) · 252 unmodified lines
253 * flash access anyway.253 * flash access anyway.
254 */254 */
255 mutex_lock(&dev->dev_mutex);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 mutex_unlock(&dev->dev_mutex);257 mutex_unlock(&dev->dev_mutex);
258 258
259 return ret;259 return ret;
drivers/scsi/scsi_lib.c+0−3
@@ -1018,8 +1018,6 @@ static int scsi_init_sgtable(struct request *req, struct scsi_data_buffer *sdb, · 1017 unmodified lines
1018 return BLKPREP_DEFER;1018 return BLKPREP_DEFER;
1019 }1019 }
1020 1020
1021 req->buffer = NULL;
1022
1023 /* 1021 /*
1024 * Next, walk the list, and fill in the addresses and sizes of1022 * Next, walk the list, and fill in the addresses and sizes of
1025 * each segment.1023 * each segment.
@@ -1156,7 +1154,6 @@ int scsi_setup_blk_pc_cmnd(struct scsi_device *sdev, struct request *req) · 130 unmodified lines
1156 BUG_ON(blk_rq_bytes(req));1154 BUG_ON(blk_rq_bytes(req));
1157 1155
1158 memset(&cmd->sdb, 0, sizeof(cmd->sdb));1156 memset(&cmd->sdb, 0, sizeof(cmd->sdb));
1159 req->buffer = NULL;
1160 }1157 }
1161 1158
1162 cmd->cmd_len = req->cmd_len;1159 cmd->cmd_len = req->cmd_len;
drivers/scsi/sd.c+4−6
@@ -739,14 +739,11 @@ static int sd_setup_discard_cmnd(struct scsi_device *sdp, struct request *rq) · 738 unmodified lines
739 739
740 blk_add_request_payload(rq, page, len);740 blk_add_request_payload(rq, page, len);
741 ret = scsi_setup_blk_pc_cmnd(sdp, rq);741 ret = scsi_setup_blk_pc_cmnd(sdp, rq);
742 rq->buffer = page_address(page);
743 rq->__data_len = nr_bytes;742 rq->__data_len = nr_bytes;
744 743
745out:744out:
746 if (ret != BLKPREP_OK) {745 if (ret != BLKPREP_OK)
747 __free_page(page);746 __free_page(page);
748 rq->buffer = NULL;
749 }
750 return ret;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 struct scsi_cmnd *SCpnt = rq->special;840 struct scsi_cmnd *SCpnt = rq->special;
844 841
845 if (rq->cmd_flags & REQ_DISCARD) {842 if (rq->cmd_flags & REQ_DISCARD) {
846 free_page((unsigned long)rq->buffer);843 struct bio *bio = rq->bio;
847 rq->buffer = NULL;844
845 __free_page(bio->bi_io_vec->bv_page);
848 }846 }
849 if (SCpnt->cmnd != rq->cmd) {847 if (SCpnt->cmnd != rq->cmd) {
850 mempool_free(SCpnt->cmnd, sd_cdb_pool);848 mempool_free(SCpnt->cmnd, sd_cdb_pool);
include/linux/blkdev.h+0−1
@@ -178,7 +178,6 @@ struct request { · 177 unmodified lines
178 unsigned short ioprio;178 unsigned short ioprio;
179 179
180 void *special; /* opaque pointer available for LLD use */180 void *special; /* opaque pointer available for LLD use */
181 char *buffer; /* kaddr of the current segment if available */
182 181
183 int tag;182 int tag;
184 int errors;183 int errors;