aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block/ps3disk.c
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2007-09-25 06:35:59 -0400
committerJens Axboe <axboe@carl.home.kernel.dk>2007-10-10 03:25:56 -0400
commit5705f7021748a69d84d6567e68e8851dab551464 (patch)
tree5a6dbc8fc6055c0334f4a97540e36a7844b9c482 /drivers/block/ps3disk.c
parent9dfa52831e96194b8649613e3131baa2c109f7dc (diff)
Introduce rq_for_each_segment replacing rq_for_each_bio
Every usage of rq_for_each_bio wraps a usage of bio_for_each_segment, so these can be combined into rq_for_each_segment. We define "struct req_iterator" to hold the 'bio' and 'index' that are needed for the double iteration. Signed-off-by: Neil Brown <neilb@suse.de> Various compile fixes by me... Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'drivers/block/ps3disk.c')
-rw-r--r--drivers/block/ps3disk.c31
1 files changed, 16 insertions, 15 deletions
diff --git a/drivers/block/ps3disk.c b/drivers/block/ps3disk.c
index aa8b890c80d7..8953e7ce0016 100644
--- a/drivers/block/ps3disk.c
+++ b/drivers/block/ps3disk.c
@@ -91,30 +91,30 @@ static void ps3disk_scatter_gather(struct ps3_storage_device *dev,
91 struct request *req, int gather) 91 struct request *req, int gather)
92{ 92{
93 unsigned int offset = 0; 93 unsigned int offset = 0;
94 struct bio *bio; 94 struct req_iterator iter;
95 sector_t sector;
96 struct bio_vec *bvec; 95 struct bio_vec *bvec;
97 unsigned int i = 0, j; 96 unsigned int i = 0;
98 size_t size; 97 size_t size;
99 void *buf; 98 void *buf;
100 99
101 rq_for_each_bio(bio, req) { 100 rq_for_each_segment(bvec, req, iter) {
102 sector = bio->bi_sector; 101 unsigned long flags;
103 dev_dbg(&dev->sbd.core, 102 dev_dbg(&dev->sbd.core,
104 "%s:%u: bio %u: %u segs %u sectors from %lu\n", 103 "%s:%u: bio %u: %u segs %u sectors from %lu\n",
105 __func__, __LINE__, i, bio_segments(bio), 104 __func__, __LINE__, i, bio_segments(iter.bio),
106 bio_sectors(bio), sector); 105 bio_sectors(iter.bio),
107 bio_for_each_segment(bvec, bio, j) { 106 (unsigned long)iter.bio->bi_sector);
107
108 size = bvec->bv_len; 108 size = bvec->bv_len;
109 buf = __bio_kmap_atomic(bio, j, KM_IRQ0); 109 buf = bvec_kmap_irq(bvec, &flags);
110 if (gather) 110 if (gather)
111 memcpy(dev->bounce_buf+offset, buf, size); 111 memcpy(dev->bounce_buf+offset, buf, size);
112 else 112 else
113 memcpy(buf, dev->bounce_buf+offset, size); 113 memcpy(buf, dev->bounce_buf+offset, size);
114 offset += size; 114 offset += size;
115 flush_kernel_dcache_page(bio_iovec_idx(bio, j)->bv_page); 115 flush_kernel_dcache_page(bvec->bv_page);
116 __bio_kunmap_atomic(bio, KM_IRQ0); 116 bvec_kunmap_irq(bvec, &flags);
117 } 117
118 i++; 118 i++;
119 } 119 }
120} 120}
@@ -130,12 +130,13 @@ static int ps3disk_submit_request_sg(struct ps3_storage_device *dev,
130 130
131#ifdef DEBUG 131#ifdef DEBUG
132 unsigned int n = 0; 132 unsigned int n = 0;
133 struct bio *bio; 133 struct bio_vec *bv;
134 struct req_iterator iter;
134 135
135 rq_for_each_bio(bio, req) 136 rq_for_each_segment(bv, req, iter)
136 n++; 137 n++;
137 dev_dbg(&dev->sbd.core, 138 dev_dbg(&dev->sbd.core,
138 "%s:%u: %s req has %u bios for %lu sectors %lu hard sectors\n", 139 "%s:%u: %s req has %u bvecs for %lu sectors %lu hard sectors\n",
139 __func__, __LINE__, op, n, req->nr_sectors, 140 __func__, __LINE__, op, n, req->nr_sectors,
140 req->hard_nr_sectors); 141 req->hard_nr_sectors);
141#endif 142#endif