Commit 6c92e699b56287da582ccb12a64b959b6d6109ba

Authored by Jens Axboe
Committed by Jens Axboe
1 parent bc1c56fde6

Fixup rq_for_each_segment() indentation

Remove one level of nesting where appropriate.

Signed-off-by: Jens Axboe <jens.axboe@oracle.com>

Showing 11 changed files with 134 additions and 143 deletions Side-by-side Diff

... ... @@ -1364,28 +1364,28 @@
1364 1364 */
1365 1365 bvprv = NULL;
1366 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) {
1370   - if (sg[nsegs - 1].length + nbytes > q->max_segment_size)
1371   - goto new_segment;
  1369 + if (bvprv && cluster) {
  1370 + if (sg[nsegs - 1].length + nbytes > q->max_segment_size)
  1371 + goto new_segment;
1372 1372  
1373   - if (!BIOVEC_PHYS_MERGEABLE(bvprv, bvec))
1374   - goto new_segment;
1375   - if (!BIOVEC_SEG_BOUNDARY(q, bvprv, bvec))
1376   - goto new_segment;
  1373 + if (!BIOVEC_PHYS_MERGEABLE(bvprv, bvec))
  1374 + goto new_segment;
  1375 + if (!BIOVEC_SEG_BOUNDARY(q, bvprv, bvec))
  1376 + goto new_segment;
1377 1377  
1378   - sg[nsegs - 1].length += nbytes;
1379   - } else {
  1378 + sg[nsegs - 1].length += nbytes;
  1379 + } else {
1380 1380 new_segment:
1381   - memset(&sg[nsegs],0,sizeof(struct scatterlist));
1382   - sg[nsegs].page = bvec->bv_page;
1383   - sg[nsegs].length = nbytes;
1384   - sg[nsegs].offset = bvec->bv_offset;
  1381 + memset(&sg[nsegs],0,sizeof(struct scatterlist));
  1382 + sg[nsegs].page = bvec->bv_page;
  1383 + sg[nsegs].length = nbytes;
  1384 + sg[nsegs].offset = bvec->bv_offset;
1385 1385  
1386   - nsegs++;
1387   - }
1388   - bvprv = bvec;
  1386 + nsegs++;
  1387 + }
  1388 + bvprv = bvec;
1389 1389 } /* segments in rq */
1390 1390  
1391 1391 return nsegs;
drivers/block/lguest_blk.c
... ... @@ -147,18 +147,18 @@
147 147 struct bio_vec *bvec;
148 148  
149 149 rq_for_each_segment(bvec, req, iter) {
150   - /* We told the block layer not to give us too many. */
151   - BUG_ON(i == LGUEST_MAX_DMA_SECTIONS);
152   - /* If we had a zero-length segment, it would look like
153   - * the end of the data referred to by the "struct
154   - * lguest_dma", so make sure that doesn't happen. */
155   - BUG_ON(!bvec->bv_len);
156   - /* Convert page & offset to a physical address */
157   - dma->addr[i] = page_to_phys(bvec->bv_page)
158   - + bvec->bv_offset;
159   - dma->len[i] = bvec->bv_len;
160   - len += bvec->bv_len;
161   - i++;
  150 + /* We told the block layer not to give us too many. */
  151 + BUG_ON(i == LGUEST_MAX_DMA_SECTIONS);
  152 + /* If we had a zero-length segment, it would look like
  153 + * the end of the data referred to by the "struct
  154 + * lguest_dma", so make sure that doesn't happen. */
  155 + BUG_ON(!bvec->bv_len);
  156 + /* Convert page & offset to a physical address */
  157 + dma->addr[i] = page_to_phys(bvec->bv_page)
  158 + + bvec->bv_offset;
  159 + dma->len[i] = bvec->bv_len;
  160 + len += bvec->bv_len;
  161 + i++;
162 162 }
163 163 /* If the array isn't full, we mark the end with a 0 length */
164 164 if (i < LGUEST_MAX_DMA_SECTIONS)
... ... @@ -212,19 +212,17 @@
212 212 * whether to set MSG_MORE or not...
213 213 */
214 214 rq_for_each_segment(bvec, req, iter) {
215   - flags = 0;
216   - if (!rq_iter_last(req, iter))
217   - flags = MSG_MORE;
218   - dprintk(DBG_TX, "%s: request %p: sending %d bytes data\n",
219   - lo->disk->disk_name, req,
220   - bvec->bv_len);
221   - result = sock_send_bvec(sock, bvec, flags);
222   - if (result <= 0) {
223   - printk(KERN_ERR "%s: Send data failed (result %d)\n",
224   - lo->disk->disk_name,
225   - result);
226   - goto error_out;
227   - }
  215 + flags = 0;
  216 + if (!rq_iter_last(req, iter))
  217 + flags = MSG_MORE;
  218 + dprintk(DBG_TX, "%s: request %p: sending %d bytes data\n",
  219 + lo->disk->disk_name, req, bvec->bv_len);
  220 + result = sock_send_bvec(sock, bvec, flags);
  221 + if (result <= 0) {
  222 + printk(KERN_ERR "%s: Send data failed (result %d)\n",
  223 + lo->disk->disk_name, result);
  224 + goto error_out;
  225 + }
228 226 }
229 227 }
230 228 return 0;
... ... @@ -323,16 +321,15 @@
323 321 struct bio_vec *bvec;
324 322  
325 323 rq_for_each_segment(bvec, req, iter) {
326   - result = sock_recv_bvec(sock, bvec);
327   - if (result <= 0) {
328   - printk(KERN_ERR "%s: Receive data failed (result %d)\n",
329   - lo->disk->disk_name,
330   - result);
331   - req->errors++;
332   - return req;
333   - }
334   - dprintk(DBG_RX, "%s: request %p: got %d bytes data\n",
335   - lo->disk->disk_name, req, bvec->bv_len);
  324 + result = sock_recv_bvec(sock, bvec);
  325 + if (result <= 0) {
  326 + printk(KERN_ERR "%s: Receive data failed (result %d)\n",
  327 + lo->disk->disk_name, result);
  328 + req->errors++;
  329 + return req;
  330 + }
  331 + dprintk(DBG_RX, "%s: request %p: got %d bytes data\n",
  332 + lo->disk->disk_name, req, bvec->bv_len);
336 333 }
337 334 }
338 335 return req;
drivers/block/ps3disk.c
... ... @@ -105,16 +105,15 @@
105 105 bio_sectors(iter.bio),
106 106 (unsigned long)iter.bio->bi_sector);
107 107  
108   - size = bvec->bv_len;
109   - buf = bvec_kmap_irq(bvec, &flags);
110   - if (gather)
111   - memcpy(dev->bounce_buf+offset, buf, size);
112   - else
113   - memcpy(buf, dev->bounce_buf+offset, size);
114   - offset += size;
115   - flush_kernel_dcache_page(bvec->bv_page);
116   - bvec_kunmap_irq(bvec, &flags);
117   -
  108 + size = bvec->bv_len;
  109 + buf = bvec_kmap_irq(bvec, &flags);
  110 + if (gather)
  111 + memcpy(dev->bounce_buf+offset, buf, size);
  112 + else
  113 + memcpy(buf, dev->bounce_buf+offset, size);
  114 + offset += size;
  115 + flush_kernel_dcache_page(bvec->bv_page);
  116 + bvec_kunmap_irq(bvec, &flags);
118 117 i++;
119 118 }
120 119 }
drivers/block/xen-blkfront.c
... ... @@ -186,31 +186,30 @@
186 186  
187 187 ring_req->nr_segments = 0;
188 188 rq_for_each_segment(bvec, req, iter) {
189   - BUG_ON(ring_req->nr_segments
190   - == BLKIF_MAX_SEGMENTS_PER_REQUEST);
191   - buffer_mfn = pfn_to_mfn(page_to_pfn(bvec->bv_page));
192   - fsect = bvec->bv_offset >> 9;
193   - lsect = fsect + (bvec->bv_len >> 9) - 1;
194   - /* install a grant reference. */
195   - ref = gnttab_claim_grant_reference(&gref_head);
196   - BUG_ON(ref == -ENOSPC);
  189 + BUG_ON(ring_req->nr_segments == BLKIF_MAX_SEGMENTS_PER_REQUEST);
  190 + buffer_mfn = pfn_to_mfn(page_to_pfn(bvec->bv_page));
  191 + fsect = bvec->bv_offset >> 9;
  192 + lsect = fsect + (bvec->bv_len >> 9) - 1;
  193 + /* install a grant reference. */
  194 + ref = gnttab_claim_grant_reference(&gref_head);
  195 + BUG_ON(ref == -ENOSPC);
197 196  
198   - gnttab_grant_foreign_access_ref(
  197 + gnttab_grant_foreign_access_ref(
199 198 ref,
200 199 info->xbdev->otherend_id,
201 200 buffer_mfn,
202 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 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 207 (struct blkif_request_segment) {
209 208 .gref = ref,
210 209 .first_sect = fsect,
211 210 .last_sect = lsect };
212 211  
213   - ring_req->nr_segments++;
  212 + ring_req->nr_segments++;
214 213 }
215 214  
216 215 info->ring.req_prod_pvt++;
drivers/ide/ide-floppy.c
... ... @@ -612,18 +612,18 @@
612 612 int count, done = 0;
613 613  
614 614 rq_for_each_segment(bvec, rq, iter) {
615   - if (!bcount)
616   - break;
  615 + if (!bcount)
  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);
621   - drive->hwif->atapi_input_bytes(drive, data, count);
622   - bvec_kunmap_irq(data, &flags);
  620 + data = bvec_kmap_irq(bvec, &flags);
  621 + drive->hwif->atapi_input_bytes(drive, data, count);
  622 + bvec_kunmap_irq(data, &flags);
623 623  
624   - bcount -= count;
625   - pc->b_count += count;
626   - done += count;
  624 + bcount -= count;
  625 + pc->b_count += count;
  626 + done += count;
627 627 }
628 628  
629 629 idefloppy_do_end_request(drive, 1, done >> 9);
630 630  
631 631  
632 632  
... ... @@ -644,18 +644,18 @@
644 644 char *data;
645 645  
646 646 rq_for_each_segment(bvec, rq, iter) {
647   - if (!bcount)
648   - break;
  647 + if (!bcount)
  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);
653   - drive->hwif->atapi_output_bytes(drive, data, count);
654   - bvec_kunmap_irq(data, &flags);
  652 + data = bvec_kmap_irq(bvec, &flags);
  653 + drive->hwif->atapi_output_bytes(drive, data, count);
  654 + bvec_kunmap_irq(data, &flags);
655 655  
656   - bcount -= count;
657   - pc->b_count += count;
658   - done += count;
  656 + bcount -= count;
  657 + pc->b_count += count;
  658 + done += count;
659 659 }
660 660  
661 661 idefloppy_do_end_request(drive, 1, done >> 9);
drivers/s390/block/dasd_diag.c
... ... @@ -493,10 +493,10 @@
493 493 /* Check struct bio and count the number of blocks for the request. */
494 494 count = 0;
495 495 rq_for_each_segment(bv, req, iter) {
496   - if (bv->bv_len & (blksize - 1))
497   - /* Fba can only do full blocks. */
498   - return ERR_PTR(-EINVAL);
499   - count += bv->bv_len >> (device->s2b_shift + 9);
  496 + if (bv->bv_len & (blksize - 1))
  497 + /* Fba can only do full blocks. */
  498 + return ERR_PTR(-EINVAL);
  499 + count += bv->bv_len >> (device->s2b_shift + 9);
500 500 }
501 501 /* Paranoia. */
502 502 if (count != last_rec - first_rec + 1)
... ... @@ -514,16 +514,16 @@
514 514 dbio = dreq->bio;
515 515 recid = first_rec;
516 516 rq_for_each_segment(bv, req, iter) {
517   - dst = page_address(bv->bv_page) + bv->bv_offset;
518   - for (off = 0; off < bv->bv_len; off += blksize) {
519   - memset(dbio, 0, sizeof (struct dasd_diag_bio));
520   - dbio->type = rw_cmd;
521   - dbio->block_number = recid + 1;
522   - dbio->buffer = dst;
523   - dbio++;
524   - dst += blksize;
525   - recid++;
526   - }
  517 + dst = page_address(bv->bv_page) + bv->bv_offset;
  518 + for (off = 0; off < bv->bv_len; off += blksize) {
  519 + memset(dbio, 0, sizeof (struct dasd_diag_bio));
  520 + dbio->type = rw_cmd;
  521 + dbio->block_number = recid + 1;
  522 + dbio->buffer = dst;
  523 + dbio++;
  524 + dst += blksize;
  525 + recid++;
  526 + }
527 527 }
528 528 cqr->retries = DIAG_MAX_RETRIES;
529 529 cqr->buildclk = get_clock();
drivers/s390/block/dasd_eckd.c
... ... @@ -1206,14 +1206,13 @@
1206 1206 count = 0;
1207 1207 cidaw = 0;
1208 1208 rq_for_each_segment(bv, req, iter) {
1209   - if (bv->bv_len & (blksize - 1))
1210   - /* Eckd can only do full blocks. */
1211   - return ERR_PTR(-EINVAL);
1212   - count += bv->bv_len >> (device->s2b_shift + 9);
  1209 + if (bv->bv_len & (blksize - 1))
  1210 + /* Eckd can only do full blocks. */
  1211 + return ERR_PTR(-EINVAL);
  1212 + count += bv->bv_len >> (device->s2b_shift + 9);
1213 1213 #if defined(CONFIG_64BIT)
1214   - if (idal_is_needed (page_address(bv->bv_page),
1215   - bv->bv_len))
1216   - cidaw += bv->bv_len >> (device->s2b_shift + 9);
  1214 + if (idal_is_needed (page_address(bv->bv_page), bv->bv_len))
  1215 + cidaw += bv->bv_len >> (device->s2b_shift + 9);
1217 1216 #endif
1218 1217 }
1219 1218 /* Paranoia. */
drivers/s390/block/dasd_fba.c
... ... @@ -257,14 +257,13 @@
257 257 count = 0;
258 258 cidaw = 0;
259 259 rq_for_each_segment(bv, req, iter) {
260   - if (bv->bv_len & (blksize - 1))
261   - /* Fba can only do full blocks. */
262   - return ERR_PTR(-EINVAL);
263   - count += bv->bv_len >> (device->s2b_shift + 9);
  260 + if (bv->bv_len & (blksize - 1))
  261 + /* Fba can only do full blocks. */
  262 + return ERR_PTR(-EINVAL);
  263 + count += bv->bv_len >> (device->s2b_shift + 9);
264 264 #if defined(CONFIG_64BIT)
265   - if (idal_is_needed (page_address(bv->bv_page),
266   - bv->bv_len))
267   - cidaw += bv->bv_len / blksize;
  265 + if (idal_is_needed (page_address(bv->bv_page), bv->bv_len))
  266 + cidaw += bv->bv_len / blksize;
268 267 #endif
269 268 }
270 269 /* Paranoia. */
drivers/s390/char/tape_34xx.c
... ... @@ -1173,16 +1173,15 @@
1173 1173 ccw = tape_ccw_cc(ccw, NOP, 0, NULL);
1174 1174  
1175 1175 rq_for_each_segment(bv, req, iter) {
1176   - dst = kmap(bv->bv_page) + bv->bv_offset;
1177   - for (off = 0; off < bv->bv_len;
1178   - off += TAPEBLOCK_HSEC_SIZE) {
1179   - ccw->flags = CCW_FLAG_CC;
1180   - ccw->cmd_code = READ_FORWARD;
1181   - ccw->count = TAPEBLOCK_HSEC_SIZE;
1182   - set_normalized_cda(ccw, (void*) __pa(dst));
1183   - ccw++;
1184   - dst += TAPEBLOCK_HSEC_SIZE;
1185   - }
  1176 + dst = kmap(bv->bv_page) + bv->bv_offset;
  1177 + for (off = 0; off < bv->bv_len; off += TAPEBLOCK_HSEC_SIZE) {
  1178 + ccw->flags = CCW_FLAG_CC;
  1179 + ccw->cmd_code = READ_FORWARD;
  1180 + ccw->count = TAPEBLOCK_HSEC_SIZE;
  1181 + set_normalized_cda(ccw, (void*) __pa(dst));
  1182 + ccw++;
  1183 + dst += TAPEBLOCK_HSEC_SIZE;
  1184 + }
1186 1185 }
1187 1186  
1188 1187 ccw = tape_ccw_end(ccw, NOP, 0, NULL);
drivers/s390/char/tape_3590.c
... ... @@ -652,18 +652,17 @@
652 652 ccw = tape_ccw_cc(ccw, NOP, 0, NULL);
653 653  
654 654 rq_for_each_segment(bv, req, iter) {
655   - dst = page_address(bv->bv_page) + bv->bv_offset;
656   - for (off = 0; off < bv->bv_len;
657   - off += TAPEBLOCK_HSEC_SIZE) {
658   - ccw->flags = CCW_FLAG_CC;
659   - ccw->cmd_code = READ_FORWARD;
660   - ccw->count = TAPEBLOCK_HSEC_SIZE;
661   - set_normalized_cda(ccw, (void *) __pa(dst));
662   - ccw++;
663   - dst += TAPEBLOCK_HSEC_SIZE;
664   - }
665   - if (off > bv->bv_len)
666   - BUG();
  655 + dst = page_address(bv->bv_page) + bv->bv_offset;
  656 + for (off = 0; off < bv->bv_len; off += TAPEBLOCK_HSEC_SIZE) {
  657 + ccw->flags = CCW_FLAG_CC;
  658 + ccw->cmd_code = READ_FORWARD;
  659 + ccw->count = TAPEBLOCK_HSEC_SIZE;
  660 + set_normalized_cda(ccw, (void *) __pa(dst));
  661 + ccw++;
  662 + dst += TAPEBLOCK_HSEC_SIZE;
  663 + }
  664 + if (off > bv->bv_len)
  665 + BUG();
667 666 }
668 667 ccw = tape_ccw_end(ccw, NOP, 0, NULL);
669 668 DBF_EVENT(6, "xBREDccwg\n");