aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block
diff options
context:
space:
mode:
authorJens Axboe <jens.axboe@oracle.com>2007-08-16 07:43:12 -0400
committerJens Axboe <axboe@carl.home.kernel.dk>2007-10-10 03:25:56 -0400
commit6c92e699b56287da582ccb12a64b959b6d6109ba (patch)
treeac8c9f26640ff8b35cd96f8222f8ce84ba2c53e5 /drivers/block
parentbc1c56fde6dd1c85e2047c276456c07bd4508b5c (diff)
Fixup rq_for_each_segment() indentation
Remove one level of nesting where appropriate. Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'drivers/block')
-rw-r--r--drivers/block/lguest_blk.c24
-rw-r--r--drivers/block/nbd.c43
-rw-r--r--drivers/block/ps3disk.c19
-rw-r--r--drivers/block/xen-blkfront.c25
4 files changed, 53 insertions, 58 deletions
diff --git a/drivers/block/lguest_blk.c b/drivers/block/lguest_blk.c
index 1e838ae60a60..fa8e42341b87 100644
--- a/drivers/block/lguest_blk.c
+++ b/drivers/block/lguest_blk.c
@@ -147,18 +147,18 @@ static unsigned int req_to_dma(struct request *req, struct lguest_dma *dma)
147 struct bio_vec *bvec; 147 struct bio_vec *bvec;
148 148
149 rq_for_each_segment(bvec, req, iter) { 149 rq_for_each_segment(bvec, req, iter) {
150 /* We told the block layer not to give us too many. */ 150 /* We told the block layer not to give us too many. */
151 BUG_ON(i == LGUEST_MAX_DMA_SECTIONS); 151 BUG_ON(i == LGUEST_MAX_DMA_SECTIONS);
152 /* If we had a zero-length segment, it would look like 152 /* If we had a zero-length segment, it would look like
153 * the end of the data referred to by the "struct 153 * the end of the data referred to by the "struct
154 * lguest_dma", so make sure that doesn't happen. */ 154 * lguest_dma", so make sure that doesn't happen. */
155 BUG_ON(!bvec->bv_len); 155 BUG_ON(!bvec->bv_len);
156 /* Convert page & offset to a physical address */ 156 /* Convert page & offset to a physical address */
157 dma->addr[i] = page_to_phys(bvec->bv_page) 157 dma->addr[i] = page_to_phys(bvec->bv_page)
158 + bvec->bv_offset; 158 + bvec->bv_offset;
159 dma->len[i] = bvec->bv_len; 159 dma->len[i] = bvec->bv_len;
160 len += bvec->bv_len; 160 len += bvec->bv_len;
161 i++; 161 i++;
162 } 162 }
163 /* If the array isn't full, we mark the end with a 0 length */ 163 /* If the array isn't full, we mark the end with a 0 length */
164 if (i < LGUEST_MAX_DMA_SECTIONS) 164 if (i < LGUEST_MAX_DMA_SECTIONS)
diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
index 228b2ff577aa..be5ec3a9b1fc 100644
--- a/drivers/block/nbd.c
+++ b/drivers/block/nbd.c
@@ -212,19 +212,17 @@ static int nbd_send_req(struct nbd_device *lo, struct request *req)
212 * whether to set MSG_MORE or not... 212 * whether to set MSG_MORE or not...
213 */ 213 */
214 rq_for_each_segment(bvec, req, iter) { 214 rq_for_each_segment(bvec, req, iter) {
215 flags = 0; 215 flags = 0;
216 if (!rq_iter_last(req, iter)) 216 if (!rq_iter_last(req, iter))
217 flags = MSG_MORE; 217 flags = MSG_MORE;
218 dprintk(DBG_TX, "%s: request %p: sending %d bytes data\n", 218 dprintk(DBG_TX, "%s: request %p: sending %d bytes data\n",
219 lo->disk->disk_name, req, 219 lo->disk->disk_name, req, bvec->bv_len);
220 bvec->bv_len); 220 result = sock_send_bvec(sock, bvec, flags);
221 result = sock_send_bvec(sock, bvec, flags); 221 if (result <= 0) {
222 if (result <= 0) { 222 printk(KERN_ERR "%s: Send data failed (result %d)\n",
223 printk(KERN_ERR "%s: Send data failed (result %d)\n", 223 lo->disk->disk_name, result);
224 lo->disk->disk_name, 224 goto error_out;
225 result); 225 }
226 goto error_out;
227 }
228 } 226 }
229 } 227 }
230 return 0; 228 return 0;
@@ -323,16 +321,15 @@ static struct request *nbd_read_stat(struct nbd_device *lo)
323 struct bio_vec *bvec; 321 struct bio_vec *bvec;
324 322
325 rq_for_each_segment(bvec, req, iter) { 323 rq_for_each_segment(bvec, req, iter) {
326 result = sock_recv_bvec(sock, bvec); 324 result = sock_recv_bvec(sock, bvec);
327 if (result <= 0) { 325 if (result <= 0) {
328 printk(KERN_ERR "%s: Receive data failed (result %d)\n", 326 printk(KERN_ERR "%s: Receive data failed (result %d)\n",
329 lo->disk->disk_name, 327 lo->disk->disk_name, result);
330 result); 328 req->errors++;
331 req->errors++; 329 return req;
332 return req; 330 }
333 } 331 dprintk(DBG_RX, "%s: request %p: got %d bytes data\n",
334 dprintk(DBG_RX, "%s: request %p: got %d bytes data\n", 332 lo->disk->disk_name, req, bvec->bv_len);
335 lo->disk->disk_name, req, bvec->bv_len);
336 } 333 }
337 } 334 }
338 return req; 335 return req;
diff --git a/drivers/block/ps3disk.c b/drivers/block/ps3disk.c
index 8953e7ce0016..06d0552cf49c 100644
--- a/drivers/block/ps3disk.c
+++ b/drivers/block/ps3disk.c
@@ -105,16 +105,15 @@ static void ps3disk_scatter_gather(struct ps3_storage_device *dev,
105 bio_sectors(iter.bio), 105 bio_sectors(iter.bio),
106 (unsigned long)iter.bio->bi_sector); 106 (unsigned long)iter.bio->bi_sector);
107 107
108 size = bvec->bv_len; 108 size = bvec->bv_len;
109 buf = bvec_kmap_irq(bvec, &flags); 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(bvec->bv_page); 115 flush_kernel_dcache_page(bvec->bv_page);
116 bvec_kunmap_irq(bvec, &flags); 116 bvec_kunmap_irq(bvec, &flags);
117
118 i++; 117 i++;
119 } 118 }
120} 119}
diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c
index 6af250113c2a..2bdebcb3ff16 100644
--- a/drivers/block/xen-blkfront.c
+++ b/drivers/block/xen-blkfront.c
@@ -186,31 +186,30 @@ static int blkif_queue_request(struct request *req)
186 186
187 ring_req->nr_segments = 0; 187 ring_req->nr_segments = 0;
188 rq_for_each_segment(bvec, req, iter) { 188 rq_for_each_segment(bvec, req, iter) {
189 BUG_ON(ring_req->nr_segments 189 BUG_ON(ring_req->nr_segments == BLKIF_MAX_SEGMENTS_PER_REQUEST);
190 == BLKIF_MAX_SEGMENTS_PER_REQUEST); 190 buffer_mfn = pfn_to_mfn(page_to_pfn(bvec->bv_page));
191 buffer_mfn = pfn_to_mfn(page_to_pfn(bvec->bv_page)); 191 fsect = bvec->bv_offset >> 9;
192 fsect = bvec->bv_offset >> 9; 192 lsect = fsect + (bvec->bv_len >> 9) - 1;
193 lsect = fsect + (bvec->bv_len >> 9) - 1; 193 /* install a grant reference. */
194 /* install a grant reference. */ 194 ref = gnttab_claim_grant_reference(&gref_head);
195 ref = gnttab_claim_grant_reference(&gref_head); 195 BUG_ON(ref == -ENOSPC);
196 BUG_ON(ref == -ENOSPC); 196
197 197 gnttab_grant_foreign_access_ref(
198 gnttab_grant_foreign_access_ref(
199 ref, 198 ref,
200 info->xbdev->otherend_id, 199 info->xbdev->otherend_id,
201 buffer_mfn, 200 buffer_mfn,
202 rq_data_dir(req) ); 201 rq_data_dir(req) );
203 202
204 info->shadow[id].frame[ring_req->nr_segments] = 203 info->shadow[id].frame[ring_req->nr_segments] =
205 mfn_to_pfn(buffer_mfn); 204 mfn_to_pfn(buffer_mfn);
206 205
207 ring_req->seg[ring_req->nr_segments] = 206 ring_req->seg[ring_req->nr_segments] =
208 (struct blkif_request_segment) { 207 (struct blkif_request_segment) {
209 .gref = ref, 208 .gref = ref,
210 .first_sect = fsect, 209 .first_sect = fsect,
211 .last_sect = lsect }; 210 .last_sect = lsect };
212 211
213 ring_req->nr_segments++; 212 ring_req->nr_segments++;
214 } 213 }
215 214
216 info->ring.req_prod_pvt++; 215 info->ring.req_prod_pvt++;