block: remove struct request buffer member
authorJens Axboe <axboe@fb.com>
Thu, 10 Apr 2014 15:46:28 +0000 (09:46 -0600)
committerJens Axboe <axboe@fb.com>
Tue, 15 Apr 2014 20:03:02 +0000 (14:03 -0600)
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>
23 files changed:
block/blk-core.c
block/blk-map.c
drivers/block/amiflop.c
drivers/block/ataflop.c
drivers/block/floppy.c
drivers/block/hd.c
drivers/block/mg_disk.c
drivers/block/paride/pcd.c
drivers/block/paride/pd.c
drivers/block/paride/pf.c
drivers/block/skd_main.c
drivers/block/swim.c
drivers/block/swim3.c
drivers/block/xen-blkfront.c
drivers/block/xsysace.c
drivers/block/z2ram.c
drivers/ide/ide-disk.c
drivers/md/dm.c
drivers/mtd/mtd_blkdevs.c
drivers/mtd/ubi/block.c
drivers/scsi/scsi_lib.c
drivers/scsi/sd.c
include/linux/blkdev.h

index 1fe9ff6e68025621cfeb396a6fc9f45a77312e2e..ae6227fd07aa16fc25925ab983f32b8aecb6ef2f 100644 (file)
@@ -146,8 +146,8 @@ void blk_dump_rq_flags(struct request *rq, char *msg)
        printk(KERN_INFO "  sector %llu, nr/cnr %u/%u\n",
               (unsigned long long)blk_rq_pos(rq),
               blk_rq_sectors(rq), blk_rq_cur_sectors(rq));
-       printk(KERN_INFO "  bio %p, biotail %p, buffer %p, len %u\n",
-              rq->bio, rq->biotail, rq->buffer, blk_rq_bytes(rq));
+       printk(KERN_INFO "  bio %p, biotail %p, len %u\n",
+              rq->bio, rq->biotail, blk_rq_bytes(rq));
 
        if (rq->cmd_type == REQ_TYPE_BLOCK_PC) {
                printk(KERN_INFO "  cdb: ");
@@ -1360,7 +1360,6 @@ void blk_add_request_payload(struct request *rq, struct page *page,
 
        rq->__data_len = rq->resid_len = len;
        rq->nr_phys_segments = 1;
-       rq->buffer = bio_data(bio);
 }
 EXPORT_SYMBOL_GPL(blk_add_request_payload);
 
@@ -1402,12 +1401,6 @@ bool bio_attempt_front_merge(struct request_queue *q, struct request *req,
        bio->bi_next = req->bio;
        req->bio = bio;
 
-       /*
-        * may not be valid. if the low level driver said
-        * it didn't need a bounce buffer then it better
-        * not touch req->buffer either...
-        */
-       req->buffer = bio_data(bio);
        req->__sector = bio->bi_iter.bi_sector;
        req->__data_len += bio->bi_iter.bi_size;
        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)
        }
 
        req->__data_len -= total_bytes;
-       req->buffer = bio_data(req->bio);
 
        /* update sector only for requests with clear definition of sector */
        if (req->cmd_type == REQ_TYPE_FS)
@@ -2752,10 +2744,9 @@ void blk_rq_bio_prep(struct request_queue *q, struct request *rq,
        /* Bit 0 (R/W) is identical in rq->cmd_flags and bio->bi_rw */
        rq->cmd_flags |= bio->bi_rw & REQ_WRITE;
 
-       if (bio_has_data(bio)) {
+       if (bio_has_data(bio))
                rq->nr_phys_segments = bio_phys_segments(q, bio);
-               rq->buffer = bio_data(bio);
-       }
+
        rq->__data_len = bio->bi_iter.bi_size;
        rq->bio = rq->biotail = bio;
 
@@ -2831,7 +2822,7 @@ EXPORT_SYMBOL_GPL(blk_rq_unprep_clone);
 
 /*
  * Copy attributes of the original request to the clone request.
- * The actual data parts (e.g. ->cmd, ->buffer, ->sense) are not copied.
+ * The actual data parts (e.g. ->cmd, ->sense) are not copied.
  */
 static void __blk_rq_prep_clone(struct request *dst, struct request *src)
 {
@@ -2857,7 +2848,7 @@ static void __blk_rq_prep_clone(struct request *dst, struct request *src)
  *
  * Description:
  *     Clones bios in @rq_src to @rq, and copies attributes of @rq_src to @rq.
- *     The actual data parts of @rq_src (e.g. ->cmd, ->buffer, ->sense)
+ *     The actual data parts of @rq_src (e.g. ->cmd, ->sense)
  *     are not copied, and copying such parts is the caller's responsibility.
  *     Also, pages which the original bios are pointing to are not copied
  *     and the cloned bios just point same pages.
index f7b22bc215180d4b7f467135faeaf52975a77013..f890d4345b0cb63f9faa88e70d466a3cec3e6b3f 100644 (file)
@@ -155,7 +155,6 @@ int blk_rq_map_user(struct request_queue *q, struct request *rq,
        if (!bio_flagged(bio, BIO_USER_MAPPED))
                rq->cmd_flags |= REQ_COPY_USER;
 
-       rq->buffer = NULL;
        return 0;
 unmap_rq:
        blk_rq_unmap_user(bio);
@@ -238,7 +237,6 @@ int blk_rq_map_user_iov(struct request_queue *q, struct request *rq,
        blk_queue_bounce(q, &bio);
        bio_get(bio);
        blk_rq_bio_prep(q, rq, bio);
-       rq->buffer = NULL;
        return 0;
 }
 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,
        }
 
        blk_queue_bounce(q, &rq->bio);
-       rq->buffer = NULL;
        return 0;
 }
 EXPORT_SYMBOL(blk_rq_map_kern);
index 748dea4f34dc1e18b089557478a2b00221bd83c5..758da2287d9a3d01143c1d588c6f28dbbf0d8c14 100644 (file)
@@ -1406,7 +1406,7 @@ next_segment:
 
                track = block / (floppy->dtype->sects * floppy->type->sect_mult);
                sector = block % (floppy->dtype->sects * floppy->type->sect_mult);
-               data = rq->buffer + 512 * cnt;
+               data = bio_data(rq->bio) + 512 * cnt;
 #ifdef DEBUG
                printk("access to track %d, sector %d, with buffer at "
                       "0x%08lx\n", track, sector, data);
index 96b629e1f0c9b0d887187b9a529ecee2c19d9945..7e8a55f8917cb9bbe3c84aabc3a4eb1da9d627fe 100644 (file)
@@ -1484,7 +1484,7 @@ repeat:
        ReqCnt = 0;
        ReqCmd = rq_data_dir(fd_request);
        ReqBlock = blk_rq_pos(fd_request);
-       ReqBuffer = fd_request->buffer;
+       ReqBuffer = bio_data(fd_request->bio);
        setup_req_params( drive );
        do_fd_action( drive );
 
index 8f5565bf34cda31504e526ccc3d79d4e7fe20fd2..5f69c910c3ac5776a4ec576f82532d545a95418e 100644 (file)
@@ -2351,7 +2351,7 @@ static void rw_interrupt(void)
        }
 
        if (CT(COMMAND) != FD_READ ||
-           raw_cmd->kernel_data == current_req->buffer) {
+           raw_cmd->kernel_data == bio_data(current_req->bio)) {
                /* transfer directly from buffer */
                cont->done(1);
        } else if (CT(COMMAND) == FD_READ) {
@@ -2640,7 +2640,7 @@ static int make_raw_rw_request(void)
                raw_cmd->flags &= ~FD_RAW_WRITE;
                raw_cmd->flags |= FD_RAW_READ;
                COMMAND = FM_MODE(_floppy, FD_READ);
-       } else if ((unsigned long)current_req->buffer < MAX_DMA_ADDRESS) {
+       } else if ((unsigned long)bio_data(current_req->bio) < MAX_DMA_ADDRESS) {
                unsigned long dma_limit;
                int direct, indirect;
 
@@ -2654,13 +2654,13 @@ static int make_raw_rw_request(void)
                 */
                max_size = buffer_chain_size();
                dma_limit = (MAX_DMA_ADDRESS -
-                            ((unsigned long)current_req->buffer)) >> 9;
+                            ((unsigned long)bio_data(current_req->bio))) >> 9;
                if ((unsigned long)max_size > dma_limit)
                        max_size = dma_limit;
                /* 64 kb boundaries */
-               if (CROSS_64KB(current_req->buffer, max_size << 9))
+               if (CROSS_64KB(bio_data(current_req->bio), max_size << 9))
                        max_size = (K_64 -
-                                   ((unsigned long)current_req->buffer) %
+                                   ((unsigned long)bio_data(current_req->bio)) %
                                    K_64) >> 9;
                direct = transfer_size(ssize, max_sector, max_size) - fsector_t;
                /*
@@ -2677,7 +2677,7 @@ static int make_raw_rw_request(void)
                       (DP->read_track & (1 << DRS->probed_format)))))) {
                        max_size = blk_rq_sectors(current_req);
                } else {
-                       raw_cmd->kernel_data = current_req->buffer;
+                       raw_cmd->kernel_data = bio_data(current_req->bio);
                        raw_cmd->length = current_count_sectors << 9;
                        if (raw_cmd->length == 0) {
                                DPRINT("%s: zero dma transfer attempted\n", __func__);
@@ -2731,7 +2731,7 @@ static int make_raw_rw_request(void)
        raw_cmd->length = ((raw_cmd->length - 1) | (ssize - 1)) + 1;
        raw_cmd->length <<= 9;
        if ((raw_cmd->length < current_count_sectors << 9) ||
-           (raw_cmd->kernel_data != current_req->buffer &&
+           (raw_cmd->kernel_data != bio_data(current_req->bio) &&
             CT(COMMAND) == FD_WRITE &&
             (aligned_sector_t + (raw_cmd->length >> 9) > buffer_max ||
              aligned_sector_t < buffer_min)) ||
@@ -2739,7 +2739,7 @@ static int make_raw_rw_request(void)
            raw_cmd->length <= 0 || current_count_sectors <= 0) {
                DPRINT("fractionary current count b=%lx s=%lx\n",
                       raw_cmd->length, current_count_sectors);
-               if (raw_cmd->kernel_data != current_req->buffer)
+               if (raw_cmd->kernel_data != bio_data(current_req->bio))
                        pr_info("addr=%d, length=%ld\n",
                                (int)((raw_cmd->kernel_data -
                                       floppy_track_buffer) >> 9),
@@ -2756,7 +2756,7 @@ static int make_raw_rw_request(void)
                return 0;
        }
 
-       if (raw_cmd->kernel_data != current_req->buffer) {
+       if (raw_cmd->kernel_data != bio_data(current_req->bio)) {
                if (raw_cmd->kernel_data < floppy_track_buffer ||
                    current_count_sectors < 0 ||
                    raw_cmd->length < 0 ||
index bf397bf108b75de4ef302dc7b8f66f45303b891f..8a290c08262f26079ecd53235b3ee8c5bc43f681 100644 (file)
@@ -464,11 +464,11 @@ static void read_intr(void)
 
 ok_to_read:
        req = hd_req;
-       insw(HD_DATA, req->buffer, 256);
+       insw(HD_DATA, bio_data(req->bio), 256);
 #ifdef DEBUG
        printk("%s: read: sector %ld, remaining = %u, buffer=%p\n",
               req->rq_disk->disk_name, blk_rq_pos(req) + 1,
-              blk_rq_sectors(req) - 1, req->buffer+512);
+              blk_rq_sectors(req) - 1, bio_data(req->bio)+512);
 #endif
        if (hd_end_request(0, 512)) {
                SET_HANDLER(&read_intr);
@@ -505,7 +505,7 @@ static void write_intr(void)
 ok_to_write:
        if (hd_end_request(0, 512)) {
                SET_HANDLER(&write_intr);
-               outsw(HD_DATA, req->buffer, 256);
+               outsw(HD_DATA, bio_data(req->bio), 256);
                return;
        }
 
@@ -624,7 +624,7 @@ repeat:
        printk("%s: %sing: CHS=%d/%d/%d, sectors=%d, buffer=%p\n",
                req->rq_disk->disk_name,
                req_data_dir(req) == READ ? "read" : "writ",
-               cyl, head, sec, nsect, req->buffer);
+               cyl, head, sec, nsect, bio_data(req->bio));
 #endif
        if (req->cmd_type == REQ_TYPE_FS) {
                switch (rq_data_dir(req)) {
@@ -643,7 +643,7 @@ repeat:
                                bad_rw_intr();
                                goto repeat;
                        }
-                       outsw(HD_DATA, req->buffer, 256);
+                       outsw(HD_DATA, bio_data(req->bio), 256);
                        break;
                default:
                        printk("unknown hd-command\n");
index eb59b124136690e217897dd6003473e09e5bd64a..e352cac707e82f5193324c1feafc6296d86bd219 100644 (file)
@@ -479,7 +479,7 @@ static unsigned int mg_out(struct mg_host *host,
 
 static void mg_read_one(struct mg_host *host, struct request *req)
 {
-       u16 *buff = (u16 *)req->buffer;
+       u16 *buff = (u16 *)bio_data(req->bio);
        u32 i;
 
        for (i = 0; i < MG_SECTOR_SIZE >> 1; i++)
@@ -496,7 +496,7 @@ static void mg_read(struct request *req)
                mg_bad_rw_intr(host);
 
        MG_DBG("requested %d sects (from %ld), buffer=0x%p\n",
-              blk_rq_sectors(req), blk_rq_pos(req), req->buffer);
+              blk_rq_sectors(req), blk_rq_pos(req), bio_data(req->bio));
 
        do {
                if (mg_wait(host, ATA_DRQ,
@@ -514,7 +514,7 @@ static void mg_read(struct request *req)
 
 static void mg_write_one(struct mg_host *host, struct request *req)
 {
-       u16 *buff = (u16 *)req->buffer;
+       u16 *buff = (u16 *)bio_data(req->bio);
        u32 i;
 
        for (i = 0; i < MG_SECTOR_SIZE >> 1; i++)
@@ -534,7 +534,7 @@ static void mg_write(struct request *req)
        }
 
        MG_DBG("requested %d sects (from %ld), buffer=0x%p\n",
-              rem, blk_rq_pos(req), req->buffer);
+              rem, blk_rq_pos(req), bio_data(req->bio));
 
        if (mg_wait(host, ATA_DRQ,
                    MG_TMAX_WAIT_WR_DRQ) != MG_ERR_NONE) {
@@ -585,7 +585,7 @@ ok_to_read:
        mg_read_one(host, req);
 
        MG_DBG("sector %ld, remaining=%ld, buffer=0x%p\n",
-              blk_rq_pos(req), blk_rq_sectors(req) - 1, req->buffer);
+              blk_rq_pos(req), blk_rq_sectors(req) - 1, bio_data(req->bio));
 
        /* send read confirm */
        outb(MG_CMD_RD_CONF, (unsigned long)host->dev_base + MG_REG_COMMAND);
@@ -624,7 +624,7 @@ ok_to_write:
                /* write 1 sector and set handler if remains */
                mg_write_one(host, req);
                MG_DBG("sector %ld, remaining=%ld, buffer=0x%p\n",
-                      blk_rq_pos(req), blk_rq_sectors(req), req->buffer);
+                      blk_rq_pos(req), blk_rq_sectors(req), bio_data(req->bio));
                host->mg_do_intr = mg_write_intr;
                mod_timer(&host->timer, jiffies + 3 * HZ);
        }
index e76bdc074dbe5678e52a33463a743a8b55335555..719cb1bc16401640a535ee1a0c3ae65de7f08e1c 100644 (file)
@@ -747,7 +747,7 @@ static void do_pcd_request(struct request_queue * q)
                        pcd_current = cd;
                        pcd_sector = blk_rq_pos(pcd_req);
                        pcd_count = blk_rq_cur_sectors(pcd_req);
-                       pcd_buf = pcd_req->buffer;
+                       pcd_buf = bio_data(pcd_req->bio);
                        pcd_busy = 1;
                        ps_set_intr(do_pcd_read, NULL, 0, nice);
                        return;
index 19ad8f0c83efe6942eb2dbabc95a978a41f05cd9..fea7e76a00de66e7d20dd6859ad851d8ecb40a35 100644 (file)
@@ -454,7 +454,7 @@ static enum action do_pd_io_start(void)
                if (pd_block + pd_count > get_capacity(pd_req->rq_disk))
                        return Fail;
                pd_run = blk_rq_sectors(pd_req);
-               pd_buf = pd_req->buffer;
+               pd_buf = bio_data(pd_req->bio);
                pd_retries = 0;
                if (pd_cmd == READ)
                        return do_pd_read_start();
@@ -485,7 +485,7 @@ static int pd_next_buf(void)
        spin_lock_irqsave(&pd_lock, saved_flags);
        __blk_end_request_cur(pd_req, 0);
        pd_count = blk_rq_cur_sectors(pd_req);
-       pd_buf = pd_req->buffer;
+       pd_buf = bio_data(pd_req->bio);
        spin_unlock_irqrestore(&pd_lock, saved_flags);
        return 0;
 }
index f5c86d523ba0c8fe3a6154737f010246d67540d0..9a15fd3c9349403a19c518e278cf547d63733504 100644 (file)
@@ -795,7 +795,7 @@ repeat:
        }
 
        pf_cmd = rq_data_dir(pf_req);
-       pf_buf = pf_req->buffer;
+       pf_buf = bio_data(pf_req->bio);
        pf_retries = 0;
 
        pf_busy = 1;
@@ -827,7 +827,7 @@ static int pf_next_buf(void)
                if (!pf_req)
                        return 1;
                pf_count = blk_rq_cur_sectors(pf_req);
-               pf_buf = pf_req->buffer;
+               pf_buf = bio_data(pf_req->bio);
        }
        return 0;
 }
index a69dd93d1bd553d0b756407ea9cbb83df4f22c88..36bcedfd930c82196031526d1617061df1f265ed 100644 (file)
@@ -563,7 +563,6 @@ skd_prep_discard_cdb(struct skd_scsi_request *scsi_req,
 
        req = skreq->req;
        blk_add_request_payload(req, page, len);
-       req->buffer = buf;
 }
 
 static void skd_request_fn_not_online(struct request_queue *q);
@@ -856,10 +855,10 @@ static void skd_end_request(struct skd_device *skdev,
 
        if ((io_flags & REQ_DISCARD) &&
                (skreq->discard_page == 1)) {
+               struct bio *bio = req->bio;
                pr_debug("%s:%s:%d, free the page!",
                         skdev->name, __func__, __LINE__);
-               free_page((unsigned long)req->buffer);
-               req->buffer = NULL;
+               __free_page(bio->bi_io_vec->bv_page);
        }
 
        if (unlikely(error)) {
index b02d53a399f37818f58950fd50e2184b43c216ba..6b44bbe528b7b1089296f52d54d9c6aa8ed90f81 100644 (file)
@@ -549,7 +549,7 @@ static void redo_fd_request(struct request_queue *q)
                case READ:
                        err = floppy_read_sectors(fs, blk_rq_pos(req),
                                                  blk_rq_cur_sectors(req),
-                                                 req->buffer);
+                                                 bio_data(req->bio));
                        break;
                }
        done:
index c74f7b56e7c40106ddd5ebde357d161cf7929361..523ee8fd4c150e7671ab776368e8a0a017d3287e 100644 (file)
@@ -342,7 +342,7 @@ static void start_request(struct floppy_state *fs)
                swim3_dbg("do_fd_req: dev=%s cmd=%d sec=%ld nr_sec=%u buf=%p\n",
                          req->rq_disk->disk_name, req->cmd,
                          (long)blk_rq_pos(req), blk_rq_sectors(req),
-                         req->buffer);
+                         bio_data(req->bio));
                swim3_dbg("           errors=%d current_nr_sectors=%u\n",
                          req->errors, blk_rq_cur_sectors(req));
 #endif
@@ -479,11 +479,11 @@ static inline void setup_transfer(struct floppy_state *fs)
                /* Set up 3 dma commands: write preamble, data, postamble */
                init_dma(cp, OUTPUT_MORE, write_preamble, sizeof(write_preamble));
                ++cp;
-               init_dma(cp, OUTPUT_MORE, req->buffer, 512);
+               init_dma(cp, OUTPUT_MORE, bio_data(req->bio), 512);
                ++cp;
                init_dma(cp, OUTPUT_LAST, write_postamble, sizeof(write_postamble));
        } else {
-               init_dma(cp, INPUT_LAST, req->buffer, n * 512);
+               init_dma(cp, INPUT_LAST, bio_data(req->bio), n * 512);
        }
        ++cp;
        out_le16(&cp->command, DBDMA_STOP);
index efe1b4761735a79faa30867ad625fdd51e043081..283a30e88287b6bbec1be6b683a87d52fc997b59 100644 (file)
@@ -612,10 +612,10 @@ static void do_blkif_request(struct request_queue *rq)
                }
 
                pr_debug("do_blk_req %p: cmd %p, sec %lx, "
-                        "(%u/%u) buffer:%p [%s]\n",
+                        "(%u/%u) [%s]\n",
                         req, req->cmd, (unsigned long)blk_rq_pos(req),
                         blk_rq_cur_sectors(req), blk_rq_sectors(req),
-                        req->buffer, rq_data_dir(req) ? "write" : "read");
+                        rq_data_dir(req) ? "write" : "read");
 
                if (blkif_queue_request(req)) {
                        blk_requeue_request(rq, req);
index 1393b8871a281a82ef4e613fc096ce4f0e933cfa..ab3ea62e5dfc70dc0e62488290688f468d69cbcc 100644 (file)
@@ -661,7 +661,7 @@ static void ace_fsm_dostate(struct ace_device *ace)
                        rq_data_dir(req));
 
                ace->req = req;
-               ace->data_ptr = req->buffer;
+               ace->data_ptr = bio_data(req->bio);
                ace->data_count = blk_rq_cur_sectors(req) * ACE_BUF_PER_SECTOR;
                ace_out32(ace, ACE_MPULBA, blk_rq_pos(req) & 0x0FFFFFFF);
 
@@ -733,7 +733,7 @@ static void ace_fsm_dostate(struct ace_device *ace)
                         *      blk_rq_sectors(ace->req),
                         *      blk_rq_cur_sectors(ace->req));
                         */
-                       ace->data_ptr = ace->req->buffer;
+                       ace->data_ptr = bio_data(ace->req->bio);
                        ace->data_count = blk_rq_cur_sectors(ace->req) * 16;
                        ace_fsm_yieldirq(ace);
                        break;
index 27de5046708a233cbc99e42a4349387f9f5157cb..968f9e52effa8c401a66e11b4de8bae9f23756ec 100644 (file)
@@ -87,13 +87,15 @@ static void do_z2_request(struct request_queue *q)
                while (len) {
                        unsigned long addr = start & Z2RAM_CHUNKMASK;
                        unsigned long size = Z2RAM_CHUNKSIZE - addr;
+                       void *buffer = bio_data(req->bio);
+
                        if (len < size)
                                size = len;
                        addr += z2ram_map[ start >> Z2RAM_CHUNKSHIFT ];
                        if (rq_data_dir(req) == READ)
-                               memcpy(req->buffer, (char *)addr, size);
+                               memcpy(buffer, (char *)addr, size);
                        else
-                               memcpy((char *)addr, req->buffer, size);
+                               memcpy((char *)addr, buffer, size);
                        start += size;
                        len -= size;
                }
index 16f69be820c7bb13da94f253b5e7bb33c831fea5..ee880382e3bce50b03775e9ab48504febb4ab6b3 100644 (file)
@@ -188,10 +188,9 @@ static ide_startstop_t ide_do_rw_disk(ide_drive_t *drive, struct request *rq,
 
        ledtrig_ide_activity();
 
-       pr_debug("%s: %sing: block=%llu, sectors=%u, buffer=0x%08lx\n",
+       pr_debug("%s: %sing: block=%llu, sectors=%u\n",
                 drive->name, rq_data_dir(rq) == READ ? "read" : "writ",
-                (unsigned long long)block, blk_rq_sectors(rq),
-                (unsigned long)rq->buffer);
+                (unsigned long long)block, blk_rq_sectors(rq));
 
        if (hwif->rw_disk)
                hwif->rw_disk(drive, rq);
index 455e6491649889d1970cd8ef3425e93f2ea6a93c..6a71bc7c9133a1d5e63ec13493593449a22f1044 100644 (file)
@@ -1544,7 +1544,6 @@ static int setup_clone(struct request *clone, struct request *rq,
        clone->cmd = rq->cmd;
        clone->cmd_len = rq->cmd_len;
        clone->sense = rq->sense;
-       clone->buffer = rq->buffer;
        clone->end_io = end_clone_request;
        clone->end_io_data = tio;
 
index 0b2ccb68c0d0240efdb9c5de9189f8e89a4ca890..4dbfaee9aa9583c41508b27a0e993480a265ebc2 100644 (file)
@@ -82,8 +82,7 @@ static int do_blktrans_request(struct mtd_blktrans_ops *tr,
 
        block = blk_rq_pos(req) << 9 >> tr->blkshift;
        nsect = blk_rq_cur_bytes(req) >> tr->blkshift;
-
-       buf = req->buffer;
+       buf = bio_data(req->bio);
 
        if (req->cmd_type != REQ_TYPE_FS)
                return -EIO;
index 7ff473c871a9a249bd02007c2176ec5c471d7626..ee774ba3728dfc27196aa9e491b2803738390ca5 100644 (file)
@@ -253,7 +253,7 @@ static int do_ubiblock_request(struct ubiblock *dev, struct request *req)
         * flash access anyway.
         */
        mutex_lock(&dev->dev_mutex);
-       ret = ubiblock_read(dev, req->buffer, sec, len);
+       ret = ubiblock_read(dev, bio_data(req->bio), sec, len);
        mutex_unlock(&dev->dev_mutex);
 
        return ret;
index 0f3bddcb6b1aa1dd705f30b510fcb0d05705278f..3cc82d3dec7849e00a8a418ae736c65864e62306 100644 (file)
@@ -1018,8 +1018,6 @@ static int scsi_init_sgtable(struct request *req, struct scsi_data_buffer *sdb,
                return BLKPREP_DEFER;
        }
 
-       req->buffer = NULL;
-
        /* 
         * Next, walk the list, and fill in the addresses and sizes of
         * each segment.
@@ -1156,7 +1154,6 @@ int scsi_setup_blk_pc_cmnd(struct scsi_device *sdev, struct request *req)
                BUG_ON(blk_rq_bytes(req));
 
                memset(&cmd->sdb, 0, sizeof(cmd->sdb));
-               req->buffer = NULL;
        }
 
        cmd->cmd_len = req->cmd_len;
index efcbcd182863318f296936bc7fa16c96bc58efe5..06d154d20faa087480e60f52d10fe7558e5421b8 100644 (file)
@@ -739,14 +739,11 @@ static int sd_setup_discard_cmnd(struct scsi_device *sdp, struct request *rq)
 
        blk_add_request_payload(rq, page, len);
        ret = scsi_setup_blk_pc_cmnd(sdp, rq);
-       rq->buffer = page_address(page);
        rq->__data_len = nr_bytes;
 
 out:
-       if (ret != BLKPREP_OK) {
+       if (ret != BLKPREP_OK)
                __free_page(page);
-               rq->buffer = NULL;
-       }
        return ret;
 }
 
@@ -843,8 +840,9 @@ static void sd_unprep_fn(struct request_queue *q, struct request *rq)
        struct scsi_cmnd *SCpnt = rq->special;
 
        if (rq->cmd_flags & REQ_DISCARD) {
-               free_page((unsigned long)rq->buffer);
-               rq->buffer = NULL;
+               struct bio *bio = rq->bio;
+
+               __free_page(bio->bi_io_vec->bv_page);
        }
        if (SCpnt->cmnd != rq->cmd) {
                mempool_free(SCpnt->cmnd, sd_cdb_pool);
index 86a8df13a5fe5ec0ceb0944d70c017518176c278..eb5e948038920df22fb8fcb1930859e5dbd4fba8 100644 (file)
@@ -178,7 +178,6 @@ struct request {
        unsigned short ioprio;
 
        void *special;          /* opaque pointer available for LLD use */
-       char *buffer;           /* kaddr of the current segment if available */
 
        int tag;
        int errors;