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
146146 printk(KERN_INFO " sector %llu, nr/cnr %u/%u\n",
147147 (unsigned long long)blk_rq_pos(rq),
148148 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));
151151
152152 if (rq->cmd_type == REQ_TYPE_BLOCK_PC) {
153153 printk(KERN_INFO " cdb: ");
@@ -1360,7 +1360,6 @@ void blk_add_request_payload(struct request *rq, struct page *page, · 1206 unmodified lines
13601360
13611361 rq->__data_len = rq->resid_len = len;
13621362 rq->nr_phys_segments = 1;
1363− rq->buffer = bio_data(bio);
13641363 }
13651364 EXPORT_SYMBOL_GPL(blk_add_request_payload);
13661365
@@ -1402,12 +1401,6 @@ bool bio_attempt_front_merge(struct request_queue *q, struct request *req, · 35 unmodified lines
14021401 bio->bi_next = req->bio;
14031402 req->bio = bio;
14041403
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);
14111404 req->__sector = bio->bi_iter.bi_sector;
14121405 req->__data_len += bio->bi_iter.bi_size;
14131406 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
24342427 }
24352428
24362429 req->__data_len -= total_bytes;
2437− req->buffer = bio_data(req->bio);
24382430
24392431 /* update sector only for requests with clear definition of sector */
24402432 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
27522744 /* Bit 0 (R/W) is identical in rq->cmd_flags and bio->bi_rw */
27532745 rq->cmd_flags |= bio->bi_rw & REQ_WRITE;
27542746
2755− if (bio_has_data(bio)) {
2747+ if (bio_has_data(bio))
27562748 rq->nr_phys_segments = bio_phys_segments(q, bio);
2757− rq->buffer = bio_data(bio);
2758− }
2749+
27592750 rq->__data_len = bio->bi_iter.bi_size;
27602751 rq->bio = rq->biotail = bio;
27612752
@@ -2831,7 +2822,7 @@ EXPORT_SYMBOL_GPL(blk_rq_unprep_clone); · 69 unmodified lines
28312822
28322823 /*
28332824 * 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.
28352826 */
28362827 static void __blk_rq_prep_clone(struct request *dst, struct request *src)
28372828 {
@@ -2857,7 +2848,7 @@ static void __blk_rq_prep_clone(struct request *dst, struct request *src) · 19 unmodified lines
28572848 *
28582849 * Description:
28592850 * 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)
28612852 * are not copied, and copying such parts is the caller's responsibility.
28622853 * Also, pages which the original bios are pointing to are not copied
28632854 * 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
155155 if (!bio_flagged(bio, BIO_USER_MAPPED))
156156 rq->cmd_flags |= REQ_COPY_USER;
157157
158− rq->buffer = NULL;
159158 return 0;
160159 unmap_rq:
161160 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
238237 blk_queue_bounce(q, &bio);
239238 bio_get(bio);
240239 blk_rq_bio_prep(q, rq, bio);
241− rq->buffer = NULL;
242240 return 0;
243241 }
244242 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
325323 }
326324
327325 blk_queue_bounce(q, &rq->bio);
328− rq->buffer = NULL;
329326 return 0;
330327 }
331328 EXPORT_SYMBOL(blk_rq_map_kern);
drivers/block/amiflop.c+1−1
@@ -1406,7 +1406,7 @@ next_segment: · 1405 unmodified lines
14061406
14071407 track = block / (floppy->dtype->sects * floppy->type->sect_mult);
14081408 sector = block % (floppy->dtype->sects * floppy->type->sect_mult);
1409− data = rq->buffer + 512 * cnt;
1409+ data = bio_data(rq->bio) + 512 * cnt;
14101410 #ifdef DEBUG
14111411 printk("access to track %d, sector %d, with buffer at "
14121412 "0x%08lx\n", track, sector, data);
drivers/block/ataflop.c+1−1
@@ -1484,7 +1484,7 @@ repeat: · 1483 unmodified lines
14841484 ReqCnt = 0;
14851485 ReqCmd = rq_data_dir(fd_request);
14861486 ReqBlock = blk_rq_pos(fd_request);
1487− ReqBuffer = fd_request->buffer;
1487+ ReqBuffer = bio_data(fd_request->bio);
14881488 setup_req_params( drive );
14891489 do_fd_action( drive );
14901490
drivers/block/floppy.c+9−9
@@ -2351,7 +2351,7 @@ static void rw_interrupt(void) · 2350 unmodified lines
23512351 }
23522352
23532353 if (CT(COMMAND) != FD_READ ||
2354− raw_cmd->kernel_data == current_req->buffer) {
2354+ raw_cmd->kernel_data == bio_data(current_req->bio)) {
23552355 /* transfer directly from buffer */
23562356 cont->done(1);
23572357 } else if (CT(COMMAND) == FD_READ) {
@@ -2640,7 +2640,7 @@ static int make_raw_rw_request(void) · 282 unmodified lines
26402640 raw_cmd->flags &= ~FD_RAW_WRITE;
26412641 raw_cmd->flags |= FD_RAW_READ;
26422642 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) {
26442644 unsigned long dma_limit;
26452645 int direct, indirect;
26462646
@@ -2654,13 +2654,13 @@ static int make_raw_rw_request(void) · 7 unmodified lines
26542654 */
26552655 max_size = buffer_chain_size();
26562656 dma_limit = (MAX_DMA_ADDRESS -
2657− ((unsigned long)current_req->buffer)) >> 9;
2657+ ((unsigned long)bio_data(current_req->bio))) >> 9;
26582658 if ((unsigned long)max_size > dma_limit)
26592659 max_size = dma_limit;
26602660 /* 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))
26622662 max_size = (K_64 -
2663− ((unsigned long)current_req->buffer) %
2663+ ((unsigned long)bio_data(current_req->bio)) %
26642664 K_64) >> 9;
26652665 direct = transfer_size(ssize, max_sector, max_size) - fsector_t;
26662666 /*
@@ -2677,7 +2677,7 @@ static int make_raw_rw_request(void) · 10 unmodified lines
26772677 (DP->read_track & (1 << DRS->probed_format)))))) {
26782678 max_size = blk_rq_sectors(current_req);
26792679 } else {
2680− raw_cmd->kernel_data = current_req->buffer;
2680+ raw_cmd->kernel_data = bio_data(current_req->bio);
26812681 raw_cmd->length = current_count_sectors << 9;
26822682 if (raw_cmd->length == 0) {
26832683 DPRINT("%s: zero dma transfer attempted\n", __func__);
@@ -2731,7 +2731,7 @@ static int make_raw_rw_request(void) · 47 unmodified lines
27312731 raw_cmd->length = ((raw_cmd->length - 1) | (ssize - 1)) + 1;
27322732 raw_cmd->length <<= 9;
27332733 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) &&
27352735 CT(COMMAND) == FD_WRITE &&
27362736 (aligned_sector_t + (raw_cmd->length >> 9) > buffer_max ||
27372737 aligned_sector_t < buffer_min)) ||
@@ -2739,7 +2739,7 @@ static int make_raw_rw_request(void) · 1 unmodified line
27392739 raw_cmd->length <= 0 || current_count_sectors <= 0) {
27402740 DPRINT("fractionary current count b=%lx s=%lx\n",
27412741 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))
27432743 pr_info("addr=%d, length=%ld\n",
27442744 (int)((raw_cmd->kernel_data -
27452745 floppy_track_buffer) >> 9),
@@ -2756,7 +2756,7 @@ static int make_raw_rw_request(void) · 10 unmodified lines
27562756 return 0;
27572757 }
27582758
2759− if (raw_cmd->kernel_data != current_req->buffer) {
2759+ if (raw_cmd->kernel_data != bio_data(current_req->bio)) {
27602760 if (raw_cmd->kernel_data < floppy_track_buffer ||
27612761 current_count_sectors < 0 ||
27622762 raw_cmd->length < 0 ||
drivers/block/hd.c+5−5
@@ -464,11 +464,11 @@ static void read_intr(void) · 463 unmodified lines
464464
465465 ok_to_read:
466466 req = hd_req;
467− insw(HD_DATA, req->buffer, 256);
467+ insw(HD_DATA, bio_data(req->bio), 256);
468468 #ifdef DEBUG
469469 printk("%s: read: sector %ld, remaining = %u, buffer=%p\n",
470470 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);
472472 #endif
473473 if (hd_end_request(0, 512)) {
474474 SET_HANDLER(&read_intr);
@@ -505,7 +505,7 @@ static void write_intr(void) · 30 unmodified lines
505505 ok_to_write:
506506 if (hd_end_request(0, 512)) {
507507 SET_HANDLER(&write_intr);
508− outsw(HD_DATA, req->buffer, 256);
508+ outsw(HD_DATA, bio_data(req->bio), 256);
509509 return;
510510 }
511511
@@ -624,7 +624,7 @@ repeat: · 112 unmodified lines
624624 printk("%s: %sing: CHS=%d/%d/%d, sectors=%d, buffer=%p\n",
625625 req->rq_disk->disk_name,
626626 req_data_dir(req) == READ ? "read" : "writ",
627− cyl, head, sec, nsect, req->buffer);
627+ cyl, head, sec, nsect, bio_data(req->bio));
628628 #endif
629629 if (req->cmd_type == REQ_TYPE_FS) {
630630 switch (rq_data_dir(req)) {
@@ -643,7 +643,7 @@ repeat: · 12 unmodified lines
643643 bad_rw_intr();
644644 goto repeat;
645645 }
646− outsw(HD_DATA, req->buffer, 256);
646+ outsw(HD_DATA, bio_data(req->bio), 256);
647647 break;
648648 default:
649649 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
479479
480480 static void mg_read_one(struct mg_host *host, struct request *req)
481481 {
482− u16 *buff = (u16 *)req->buffer;
482+ u16 *buff = (u16 *)bio_data(req->bio);
483483 u32 i;
484484
485485 for (i = 0; i < MG_SECTOR_SIZE >> 1; i++)
@@ -496,7 +496,7 @@ static void mg_read(struct request *req) · 10 unmodified lines
496496 mg_bad_rw_intr(host);
497497
498498 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));
500500
501501 do {
502502 if (mg_wait(host, ATA_DRQ,
@@ -514,7 +514,7 @@ static void mg_read(struct request *req) · 11 unmodified lines
514514
515515 static void mg_write_one(struct mg_host *host, struct request *req)
516516 {
517− u16 *buff = (u16 *)req->buffer;
517+ u16 *buff = (u16 *)bio_data(req->bio);
518518 u32 i;
519519
520520 for (i = 0; i < MG_SECTOR_SIZE >> 1; i++)
@@ -534,7 +534,7 @@ static void mg_write(struct request *req) · 13 unmodified lines
534534 }
535535
536536 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));
538538
539539 if (mg_wait(host, ATA_DRQ,
540540 MG_TMAX_WAIT_WR_DRQ) != MG_ERR_NONE) {
@@ -585,7 +585,7 @@ ok_to_read: · 44 unmodified lines
585585 mg_read_one(host, req);
586586
587587 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));
589589
590590 /* send read confirm */
591591 outb(MG_CMD_RD_CONF, (unsigned long)host->dev_base + MG_REG_COMMAND);
@@ -624,7 +624,7 @@ ok_to_write: · 32 unmodified lines
624624 /* write 1 sector and set handler if remains */
625625 mg_write_one(host, req);
626626 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));
628628 host->mg_do_intr = mg_write_intr;
629629 mod_timer(&host->timer, jiffies + 3 * HZ);
630630 }
drivers/block/paride/pcd.c+1−1
@@ -747,7 +747,7 @@ static void do_pcd_request(struct request_queue * q) · 746 unmodified lines
747747 pcd_current = cd;
748748 pcd_sector = blk_rq_pos(pcd_req);
749749 pcd_count = blk_rq_cur_sectors(pcd_req);
750− pcd_buf = pcd_req->buffer;
750+ pcd_buf = bio_data(pcd_req->bio);
751751 pcd_busy = 1;
752752 ps_set_intr(do_pcd_read, NULL, 0, nice);
753753 return;
drivers/block/paride/pd.c+2−2
@@ -454,7 +454,7 @@ static enum action do_pd_io_start(void) · 453 unmodified lines
454454 if (pd_block + pd_count > get_capacity(pd_req->rq_disk))
455455 return Fail;
456456 pd_run = blk_rq_sectors(pd_req);
457− pd_buf = pd_req->buffer;
457+ pd_buf = bio_data(pd_req->bio);
458458 pd_retries = 0;
459459 if (pd_cmd == READ)
460460 return do_pd_read_start();
@@ -485,7 +485,7 @@ static int pd_next_buf(void) · 24 unmodified lines
485485 spin_lock_irqsave(&pd_lock, saved_flags);
486486 __blk_end_request_cur(pd_req, 0);
487487 pd_count = blk_rq_cur_sectors(pd_req);
488− pd_buf = pd_req->buffer;
488+ pd_buf = bio_data(pd_req->bio);
489489 spin_unlock_irqrestore(&pd_lock, saved_flags);
490490 return 0;
491491 }
drivers/block/paride/pf.c+2−2
@@ -795,7 +795,7 @@ repeat: · 794 unmodified lines
795795 }
796796
797797 pf_cmd = rq_data_dir(pf_req);
798− pf_buf = pf_req->buffer;
798+ pf_buf = bio_data(pf_req->bio);
799799 pf_retries = 0;
800800
801801 pf_busy = 1;
@@ -827,7 +827,7 @@ static int pf_next_buf(void) · 25 unmodified lines
827827 if (!pf_req)
828828 return 1;
829829 pf_count = blk_rq_cur_sectors(pf_req);
830− pf_buf = pf_req->buffer;
830+ pf_buf = bio_data(pf_req->bio);
831831 }
832832 return 0;
833833 }
drivers/block/skd_main.c+2−3
@@ -563,7 +563,6 @@ skd_prep_discard_cdb(struct skd_scsi_request *scsi_req, · 562 unmodified lines
563563
564564 req = skreq->req;
565565 blk_add_request_payload(req, page, len);
566− req->buffer = buf;
567566 }
568567
569568 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
856855
857856 if ((io_flags & REQ_DISCARD) &&
858857 (skreq->discard_page == 1)) {
858+ struct bio *bio = req->bio;
859859 pr_debug("%s:%s:%d, free the page!",
860860 skdev->name, __func__, __LINE__);
861− free_page((unsigned long)req->buffer);
862− req->buffer = NULL;
861+ __free_page(bio->bi_io_vec->bv_page);
863862 }
864863
865864 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
549549 case READ:
550550 err = floppy_read_sectors(fs, blk_rq_pos(req),
551551 blk_rq_cur_sectors(req),
552− req->buffer);
552+ bio_data(req->bio));
553553 break;
554554 }
555555 done:
drivers/block/swim3.c+3−3
@@ -342,7 +342,7 @@ static void start_request(struct floppy_state *fs) · 341 unmodified lines
342342 swim3_dbg("do_fd_req: dev=%s cmd=%d sec=%ld nr_sec=%u buf=%p\n",
343343 req->rq_disk->disk_name, req->cmd,
344344 (long)blk_rq_pos(req), blk_rq_sectors(req),
345− req->buffer);
345+ bio_data(req->bio));
346346 swim3_dbg(" errors=%d current_nr_sectors=%u\n",
347347 req->errors, blk_rq_cur_sectors(req));
348348 #endif
@@ -479,11 +479,11 @@ static inline void setup_transfer(struct floppy_state *fs) · 130 unmodified lines
479479 /* Set up 3 dma commands: write preamble, data, postamble */
480480 init_dma(cp, OUTPUT_MORE, write_preamble, sizeof(write_preamble));
481481 ++cp;
482− init_dma(cp, OUTPUT_MORE, req->buffer, 512);
482+ init_dma(cp, OUTPUT_MORE, bio_data(req->bio), 512);
483483 ++cp;
484484 init_dma(cp, OUTPUT_LAST, write_postamble, sizeof(write_postamble));
485485 } else {
486− init_dma(cp, INPUT_LAST, req->buffer, n * 512);
486+ init_dma(cp, INPUT_LAST, bio_data(req->bio), n * 512);
487487 }
488488 ++cp;
489489 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
612612 }
613613
614614 pr_debug("do_blk_req %p: cmd %p, sec %lx, "
615− "(%u/%u) buffer:%p [%s]\n",
615+ "(%u/%u) [%s]\n",
616616 req, req->cmd, (unsigned long)blk_rq_pos(req),
617617 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");
619619
620620 if (blkif_queue_request(req)) {
621621 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
661661 rq_data_dir(req));
662662
663663 ace->req = req;
664− ace->data_ptr = req->buffer;
664+ ace->data_ptr = bio_data(req->bio);
665665 ace->data_count = blk_rq_cur_sectors(req) * ACE_BUF_PER_SECTOR;
666666 ace_out32(ace, ACE_MPULBA, blk_rq_pos(req) & 0x0FFFFFFF);
667667
@@ -733,7 +733,7 @@ static void ace_fsm_dostate(struct ace_device *ace) · 65 unmodified lines
733733 * blk_rq_sectors(ace->req),
734734 * blk_rq_cur_sectors(ace->req));
735735 */
736− ace->data_ptr = ace->req->buffer;
736+ ace->data_ptr = bio_data(ace->req->bio);
737737 ace->data_count = blk_rq_cur_sectors(ace->req) * 16;
738738 ace_fsm_yieldirq(ace);
739739 break;
drivers/block/z2ram.c+4−2
@@ -87,13 +87,15 @@ static void do_z2_request(struct request_queue *q) · 86 unmodified lines
8787 while (len) {
8888 unsigned long addr = start & Z2RAM_CHUNKMASK;
8989 unsigned long size = Z2RAM_CHUNKSIZE - addr;
90+ void *buffer = bio_data(req->bio);
91+
9092 if (len < size)
9193 size = len;
9294 addr += z2ram_map[ start >> Z2RAM_CHUNKSHIFT ];
9395 if (rq_data_dir(req) == READ)
94− memcpy(req->buffer, (char *)addr, size);
96+ memcpy(buffer, (char *)addr, size);
9597 else
96− memcpy((char *)addr, req->buffer, size);
98+ memcpy((char *)addr, buffer, size);
9799 start += size;
98100 len -= size;
99101 }
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
188188
189189 ledtrig_ide_activity();
190190
191− pr_debug("%s: %sing: block=%llu, sectors=%u, buffer=0x%08lx\n",
191+ pr_debug("%s: %sing: block=%llu, sectors=%u\n",
192192 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));
195194
196195 if (hwif->rw_disk)
197196 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
15441544 clone->cmd = rq->cmd;
15451545 clone->cmd_len = rq->cmd_len;
15461546 clone->sense = rq->sense;
1547− clone->buffer = rq->buffer;
15481547 clone->end_io = end_clone_request;
15491548 clone->end_io_data = tio;
15501549
drivers/mtd/mtd_blkdevs.c+1−2
@@ -82,8 +82,7 @@ static int do_blktrans_request(struct mtd_blktrans_ops *tr, · 81 unmodified lines
8282
8383 block = blk_rq_pos(req) << 9 >> tr->blkshift;
8484 nsect = blk_rq_cur_bytes(req) >> tr->blkshift;
85−
86− buf = req->buffer;
85+ buf = bio_data(req->bio);
8786
8887 if (req->cmd_type != REQ_TYPE_FS)
8988 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
253253 * flash access anyway.
254254 */
255255 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);
257257 mutex_unlock(&dev->dev_mutex);
258258
259259 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
10181018 return BLKPREP_DEFER;
10191019 }
10201020
1021− req->buffer = NULL;
1022−
10231021 /*
10241022 * Next, walk the list, and fill in the addresses and sizes of
10251023 * each segment.
@@ -1156,7 +1154,6 @@ int scsi_setup_blk_pc_cmnd(struct scsi_device *sdev, struct request *req) · 130 unmodified lines
11561154 BUG_ON(blk_rq_bytes(req));
11571155
11581156 memset(&cmd->sdb, 0, sizeof(cmd->sdb));
1159− req->buffer = NULL;
11601157 }
11611158
11621159 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
739739
740740 blk_add_request_payload(rq, page, len);
741741 ret = scsi_setup_blk_pc_cmnd(sdp, rq);
742− rq->buffer = page_address(page);
743742 rq->__data_len = nr_bytes;
744743
745744 out:
746− if (ret != BLKPREP_OK) {
745+ if (ret != BLKPREP_OK)
747746 __free_page(page);
748− rq->buffer = NULL;
749− }
750747 return ret;
751748 }
752749
@@ -843,8 +840,9 @@ static void sd_unprep_fn(struct request_queue *q, struct request *rq) · 90 unmodified lines
843840 struct scsi_cmnd *SCpnt = rq->special;
844841
845842 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);
848846 }
849847 if (SCpnt->cmnd != rq->cmd) {
850848 mempool_free(SCpnt->cmnd, sd_cdb_pool);
include/linux/blkdev.h+0−1
@@ -178,7 +178,6 @@ struct request { · 177 unmodified lines
178178 unsigned short ioprio;
179179
180180 void *special; /* opaque pointer available for LLD use */
181− char *buffer; /* kaddr of the current segment if available */
182181
183182 int tag;
184183 int errors;