aboutsummaryrefslogtreecommitdiffstats
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
parentbc1c56fde6dd1c85e2047c276456c07bd4508b5c (diff)
Fixup rq_for_each_segment() indentation
Remove one level of nesting where appropriate. Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
-rw-r--r--block/ll_rw_blk.c34
-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
-rw-r--r--drivers/ide/ide-floppy.c36
-rw-r--r--drivers/s390/block/dasd_diag.c28
-rw-r--r--drivers/s390/block/dasd_eckd.c13
-rw-r--r--drivers/s390/block/dasd_fba.c13
-rw-r--r--drivers/s390/char/tape_34xx.c19
-rw-r--r--drivers/s390/char/tape_3590.c23
11 files changed, 134 insertions, 143 deletions
diff --git a/block/ll_rw_blk.c b/block/ll_rw_blk.c
index e0608c4ecc23..c6b2a477d33e 100644
--- a/block/ll_rw_blk.c
+++ b/block/ll_rw_blk.c
@@ -1364,28 +1364,28 @@ int blk_rq_map_sg(struct request_queue *q, struct request *rq,
1364 */ 1364 */
1365 bvprv = NULL; 1365 bvprv = NULL;
1366 rq_for_each_segment(bvec, rq, iter) { 1366 rq_for_each_segment(bvec, rq, iter) {
1367 int nbytes = bvec->bv_len; 1367 int nbytes = bvec->bv_len;
1368 1368
1369 if (bvprv && cluster) { 1369 if (bvprv && cluster) {
1370 if (sg[nsegs - 1].length + nbytes > q->max_segment_size) 1370 if (sg[nsegs - 1].length + nbytes > q->max_segment_size)
1371 goto new_segment; 1371 goto new_segment;
1372 1372
1373 if (!BIOVEC_PHYS_MERGEABLE(bvprv, bvec)) 1373 if (!BIOVEC_PHYS_MERGEABLE(bvprv, bvec))
1374 goto new_segment; 1374 goto new_segment;
1375 if (!BIOVEC_SEG_BOUNDARY(q, bvprv, bvec)) 1375 if (!BIOVEC_SEG_BOUNDARY(q, bvprv, bvec))
1376 goto new_segment; 1376 goto new_segment;
1377 1377
1378 sg[nsegs - 1].length += nbytes; 1378 sg[nsegs - 1].length += nbytes;
1379 } else { 1379 } else {
1380new_segment: 1380new_segment:
1381 memset(&sg[nsegs],0,sizeof(struct scatterlist)); 1381 memset(&sg[nsegs],0,sizeof(struct scatterlist));
1382 sg[nsegs].page = bvec->bv_page; 1382 sg[nsegs].page = bvec->bv_page;
1383 sg[nsegs].length = nbytes; 1383 sg[nsegs].length = nbytes;
1384 sg[nsegs].offset = bvec->bv_offset; 1384 sg[nsegs].offset = bvec->bv_offset;
1385 1385
1386 nsegs++; 1386 nsegs++;
1387 } 1387 }
1388 bvprv = bvec; 1388 bvprv = bvec;
1389 } /* segments in rq */ 1389 } /* segments in rq */
1390 1390
1391 return nsegs; 1391 return nsegs;
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++;
diff --git a/drivers/ide/ide-floppy.c b/drivers/ide/ide-floppy.c
index a775450d7a38..04a357808f2e 100644
--- a/drivers/ide/ide-floppy.c
+++ b/drivers/ide/ide-floppy.c
@@ -612,18 +612,18 @@ static void idefloppy_input_buffers (ide_drive_t *drive, idefloppy_pc_t *pc, uns
612 int count, done = 0; 612 int count, done = 0;
613 613
614 rq_for_each_segment(bvec, rq, iter) { 614 rq_for_each_segment(bvec, rq, iter) {
615 if (!bcount) 615 if (!bcount)
616 break; 616 break;
617 617
618 count = min(bvec->bv_len, bcount); 618 count = min(bvec->bv_len, bcount);
619 619
620 data = bvec_kmap_irq(bvec, &flags); 620 data = bvec_kmap_irq(bvec, &flags);
621 drive->hwif->atapi_input_bytes(drive, data, count); 621 drive->hwif->atapi_input_bytes(drive, data, count);
622 bvec_kunmap_irq(data, &flags); 622 bvec_kunmap_irq(data, &flags);
623 623
624 bcount -= count; 624 bcount -= count;
625 pc->b_count += count; 625 pc->b_count += count;
626 done += count; 626 done += count;
627 } 627 }
628 628
629 idefloppy_do_end_request(drive, 1, done >> 9); 629 idefloppy_do_end_request(drive, 1, done >> 9);
@@ -644,18 +644,18 @@ static void idefloppy_output_buffers (ide_drive_t *drive, idefloppy_pc_t *pc, un
644 char *data; 644 char *data;
645 645
646 rq_for_each_segment(bvec, rq, iter) { 646 rq_for_each_segment(bvec, rq, iter) {
647 if (!bcount) 647 if (!bcount)
648 break; 648 break;
649 649
650 count = min(bvec->bv_len, bcount); 650 count = min(bvec->bv_len, bcount);
651 651
652 data = bvec_kmap_irq(bvec, &flags); 652 data = bvec_kmap_irq(bvec, &flags);
653 drive->hwif->atapi_output_bytes(drive, data, count); 653 drive->hwif->atapi_output_bytes(drive, data, count);
654 bvec_kunmap_irq(data, &flags); 654 bvec_kunmap_irq(data, &flags);
655 655
656 bcount -= count; 656 bcount -= count;
657 pc->b_count += count; 657 pc->b_count += count;
658 done += count; 658 done += count;
659 } 659 }
660 660
661 idefloppy_do_end_request(drive, 1, done >> 9); 661 idefloppy_do_end_request(drive, 1, done >> 9);
diff --git a/drivers/s390/block/dasd_diag.c b/drivers/s390/block/dasd_diag.c
index 6bb9676f203e..571320ab9e1a 100644
--- a/drivers/s390/block/dasd_diag.c
+++ b/drivers/s390/block/dasd_diag.c
@@ -493,10 +493,10 @@ dasd_diag_build_cp(struct dasd_device * device, struct request *req)
493 /* Check struct bio and count the number of blocks for the request. */ 493 /* Check struct bio and count the number of blocks for the request. */
494 count = 0; 494 count = 0;
495 rq_for_each_segment(bv, req, iter) { 495 rq_for_each_segment(bv, req, iter) {
496 if (bv->bv_len & (blksize - 1)) 496 if (bv->bv_len & (blksize - 1))
497 /* Fba can only do full blocks. */ 497 /* Fba can only do full blocks. */
498 return ERR_PTR(-EINVAL); 498 return ERR_PTR(-EINVAL);
499 count += bv->bv_len >> (device->s2b_shift + 9); 499 count += bv->bv_len >> (device->s2b_shift + 9);
500 } 500 }
501 /* Paranoia. */ 501 /* Paranoia. */
502 if (count != last_rec - first_rec + 1) 502 if (count != last_rec - first_rec + 1)
@@ -514,16 +514,16 @@ dasd_diag_build_cp(struct dasd_device * device, struct request *req)
514 dbio = dreq->bio; 514 dbio = dreq->bio;
515 recid = first_rec; 515 recid = first_rec;
516 rq_for_each_segment(bv, req, iter) { 516 rq_for_each_segment(bv, req, iter) {
517 dst = page_address(bv->bv_page) + bv->bv_offset; 517 dst = page_address(bv->bv_page) + bv->bv_offset;
518 for (off = 0; off < bv->bv_len; off += blksize) { 518 for (off = 0; off < bv->bv_len; off += blksize) {
519 memset(dbio, 0, sizeof (struct dasd_diag_bio)); 519 memset(dbio, 0, sizeof (struct dasd_diag_bio));
520 dbio->type = rw_cmd; 520 dbio->type = rw_cmd;
521 dbio->block_number = recid + 1; 521 dbio->block_number = recid + 1;
522 dbio->buffer = dst; 522 dbio->buffer = dst;
523 dbio++; 523 dbio++;
524 dst += blksize; 524 dst += blksize;
525 recid++; 525 recid++;
526 } 526 }
527 } 527 }
528 cqr->retries = DIAG_MAX_RETRIES; 528 cqr->retries = DIAG_MAX_RETRIES;
529 cqr->buildclk = get_clock(); 529 cqr->buildclk = get_clock();
diff --git a/drivers/s390/block/dasd_eckd.c b/drivers/s390/block/dasd_eckd.c
index 36ba45849874..44adf8496bda 100644
--- a/drivers/s390/block/dasd_eckd.c
+++ b/drivers/s390/block/dasd_eckd.c
@@ -1206,14 +1206,13 @@ dasd_eckd_build_cp(struct dasd_device * device, struct request *req)
1206 count = 0; 1206 count = 0;
1207 cidaw = 0; 1207 cidaw = 0;
1208 rq_for_each_segment(bv, req, iter) { 1208 rq_for_each_segment(bv, req, iter) {
1209 if (bv->bv_len & (blksize - 1)) 1209 if (bv->bv_len & (blksize - 1))
1210 /* Eckd can only do full blocks. */ 1210 /* Eckd can only do full blocks. */
1211 return ERR_PTR(-EINVAL); 1211 return ERR_PTR(-EINVAL);
1212 count += bv->bv_len >> (device->s2b_shift + 9); 1212 count += bv->bv_len >> (device->s2b_shift + 9);
1213#if defined(CONFIG_64BIT) 1213#if defined(CONFIG_64BIT)
1214 if (idal_is_needed (page_address(bv->bv_page), 1214 if (idal_is_needed (page_address(bv->bv_page), bv->bv_len))
1215 bv->bv_len)) 1215 cidaw += bv->bv_len >> (device->s2b_shift + 9);
1216 cidaw += bv->bv_len >> (device->s2b_shift + 9);
1217#endif 1216#endif
1218 } 1217 }
1219 /* Paranoia. */ 1218 /* Paranoia. */
diff --git a/drivers/s390/block/dasd_fba.c b/drivers/s390/block/dasd_fba.c
index 119b8d2d5f17..1d95822e0b8e 100644
--- a/drivers/s390/block/dasd_fba.c
+++ b/drivers/s390/block/dasd_fba.c
@@ -257,14 +257,13 @@ dasd_fba_build_cp(struct dasd_device * device, struct request *req)
257 count = 0; 257 count = 0;
258 cidaw = 0; 258 cidaw = 0;
259 rq_for_each_segment(bv, req, iter) { 259 rq_for_each_segment(bv, req, iter) {
260 if (bv->bv_len & (blksize - 1)) 260 if (bv->bv_len & (blksize - 1))
261 /* Fba can only do full blocks. */ 261 /* Fba can only do full blocks. */
262 return ERR_PTR(-EINVAL); 262 return ERR_PTR(-EINVAL);
263 count += bv->bv_len >> (device->s2b_shift + 9); 263 count += bv->bv_len >> (device->s2b_shift + 9);
264#if defined(CONFIG_64BIT) 264#if defined(CONFIG_64BIT)
265 if (idal_is_needed (page_address(bv->bv_page), 265 if (idal_is_needed (page_address(bv->bv_page), bv->bv_len))
266 bv->bv_len)) 266 cidaw += bv->bv_len / blksize;
267 cidaw += bv->bv_len / blksize;
268#endif 267#endif
269 } 268 }
270 /* Paranoia. */ 269 /* Paranoia. */
diff --git a/drivers/s390/char/tape_34xx.c b/drivers/s390/char/tape_34xx.c
index ea3e6a345c89..5b47e9cce75f 100644
--- a/drivers/s390/char/tape_34xx.c
+++ b/drivers/s390/char/tape_34xx.c
@@ -1173,16 +1173,15 @@ tape_34xx_bread(struct tape_device *device, struct request *req)
1173 ccw = tape_ccw_cc(ccw, NOP, 0, NULL); 1173 ccw = tape_ccw_cc(ccw, NOP, 0, NULL);
1174 1174
1175 rq_for_each_segment(bv, req, iter) { 1175 rq_for_each_segment(bv, req, iter) {
1176 dst = kmap(bv->bv_page) + bv->bv_offset; 1176 dst = kmap(bv->bv_page) + bv->bv_offset;
1177 for (off = 0; off < bv->bv_len; 1177 for (off = 0; off < bv->bv_len; off += TAPEBLOCK_HSEC_SIZE) {
1178 off += TAPEBLOCK_HSEC_SIZE) { 1178 ccw->flags = CCW_FLAG_CC;
1179 ccw->flags = CCW_FLAG_CC; 1179 ccw->cmd_code = READ_FORWARD;
1180 ccw->cmd_code = READ_FORWARD; 1180 ccw->count = TAPEBLOCK_HSEC_SIZE;
1181 ccw->count = TAPEBLOCK_HSEC_SIZE; 1181 set_normalized_cda(ccw, (void*) __pa(dst));
1182 set_normalized_cda(ccw, (void*) __pa(dst)); 1182 ccw++;
1183 ccw++; 1183 dst += TAPEBLOCK_HSEC_SIZE;
1184 dst += TAPEBLOCK_HSEC_SIZE; 1184 }
1185 }
1186 } 1185 }
1187 1186
1188 ccw = tape_ccw_end(ccw, NOP, 0, NULL); 1187 ccw = tape_ccw_end(ccw, NOP, 0, NULL);
diff --git a/drivers/s390/char/tape_3590.c b/drivers/s390/char/tape_3590.c
index b16ad7a7631d..9f244c591eeb 100644
--- a/drivers/s390/char/tape_3590.c
+++ b/drivers/s390/char/tape_3590.c
@@ -652,18 +652,17 @@ tape_3590_bread(struct tape_device *device, struct request *req)
652 ccw = tape_ccw_cc(ccw, NOP, 0, NULL); 652 ccw = tape_ccw_cc(ccw, NOP, 0, NULL);
653 653
654 rq_for_each_segment(bv, req, iter) { 654 rq_for_each_segment(bv, req, iter) {
655 dst = page_address(bv->bv_page) + bv->bv_offset; 655 dst = page_address(bv->bv_page) + bv->bv_offset;
656 for (off = 0; off < bv->bv_len; 656 for (off = 0; off < bv->bv_len; off += TAPEBLOCK_HSEC_SIZE) {
657 off += TAPEBLOCK_HSEC_SIZE) { 657 ccw->flags = CCW_FLAG_CC;
658 ccw->flags = CCW_FLAG_CC; 658 ccw->cmd_code = READ_FORWARD;
659 ccw->cmd_code = READ_FORWARD; 659 ccw->count = TAPEBLOCK_HSEC_SIZE;
660 ccw->count = TAPEBLOCK_HSEC_SIZE; 660 set_normalized_cda(ccw, (void *) __pa(dst));
661 set_normalized_cda(ccw, (void *) __pa(dst)); 661 ccw++;
662 ccw++; 662 dst += TAPEBLOCK_HSEC_SIZE;
663 dst += TAPEBLOCK_HSEC_SIZE; 663 }
664 } 664 if (off > bv->bv_len)
665 if (off > bv->bv_len) 665 BUG();
666 BUG();
667 } 666 }
668 ccw = tape_ccw_end(ccw, NOP, 0, NULL); 667 ccw = tape_ccw_end(ccw, NOP, 0, NULL);
669 DBF_EVENT(6, "xBREDccwg\n"); 668 DBF_EVENT(6, "xBREDccwg\n");