mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 19:21:31 -04:00
Fixup rq_for_each_segment() indentation
Remove one level of nesting where appropriate. Signed-off-by: Jens Axboe <[email protected]>
This commit is contained in:
parent
bc1c56fde6
commit
6c92e699b5
11 changed files with 134 additions and 143 deletions
|
|
@ -147,18 +147,18 @@ static unsigned int req_to_dma(struct request *req, struct lguest_dma *dma)
|
|||
struct bio_vec *bvec;
|
||||
|
||||
rq_for_each_segment(bvec, req, iter) {
|
||||
/* We told the block layer not to give us too many. */
|
||||
BUG_ON(i == LGUEST_MAX_DMA_SECTIONS);
|
||||
/* If we had a zero-length segment, it would look like
|
||||
* the end of the data referred to by the "struct
|
||||
* lguest_dma", so make sure that doesn't happen. */
|
||||
BUG_ON(!bvec->bv_len);
|
||||
/* Convert page & offset to a physical address */
|
||||
dma->addr[i] = page_to_phys(bvec->bv_page)
|
||||
+ bvec->bv_offset;
|
||||
dma->len[i] = bvec->bv_len;
|
||||
len += bvec->bv_len;
|
||||
i++;
|
||||
/* We told the block layer not to give us too many. */
|
||||
BUG_ON(i == LGUEST_MAX_DMA_SECTIONS);
|
||||
/* If we had a zero-length segment, it would look like
|
||||
* the end of the data referred to by the "struct
|
||||
* lguest_dma", so make sure that doesn't happen. */
|
||||
BUG_ON(!bvec->bv_len);
|
||||
/* Convert page & offset to a physical address */
|
||||
dma->addr[i] = page_to_phys(bvec->bv_page)
|
||||
+ bvec->bv_offset;
|
||||
dma->len[i] = bvec->bv_len;
|
||||
len += bvec->bv_len;
|
||||
i++;
|
||||
}
|
||||
/* If the array isn't full, we mark the end with a 0 length */
|
||||
if (i < LGUEST_MAX_DMA_SECTIONS)
|
||||
|
|
|
|||
|
|
@ -212,19 +212,17 @@ static int nbd_send_req(struct nbd_device *lo, struct request *req)
|
|||
* whether to set MSG_MORE or not...
|
||||
*/
|
||||
rq_for_each_segment(bvec, req, iter) {
|
||||
flags = 0;
|
||||
if (!rq_iter_last(req, iter))
|
||||
flags = MSG_MORE;
|
||||
dprintk(DBG_TX, "%s: request %p: sending %d bytes data\n",
|
||||
lo->disk->disk_name, req,
|
||||
bvec->bv_len);
|
||||
result = sock_send_bvec(sock, bvec, flags);
|
||||
if (result <= 0) {
|
||||
printk(KERN_ERR "%s: Send data failed (result %d)\n",
|
||||
lo->disk->disk_name,
|
||||
result);
|
||||
goto error_out;
|
||||
}
|
||||
flags = 0;
|
||||
if (!rq_iter_last(req, iter))
|
||||
flags = MSG_MORE;
|
||||
dprintk(DBG_TX, "%s: request %p: sending %d bytes data\n",
|
||||
lo->disk->disk_name, req, bvec->bv_len);
|
||||
result = sock_send_bvec(sock, bvec, flags);
|
||||
if (result <= 0) {
|
||||
printk(KERN_ERR "%s: Send data failed (result %d)\n",
|
||||
lo->disk->disk_name, result);
|
||||
goto error_out;
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
|
@ -323,16 +321,15 @@ static struct request *nbd_read_stat(struct nbd_device *lo)
|
|||
struct bio_vec *bvec;
|
||||
|
||||
rq_for_each_segment(bvec, req, iter) {
|
||||
result = sock_recv_bvec(sock, bvec);
|
||||
if (result <= 0) {
|
||||
printk(KERN_ERR "%s: Receive data failed (result %d)\n",
|
||||
lo->disk->disk_name,
|
||||
result);
|
||||
req->errors++;
|
||||
return req;
|
||||
}
|
||||
dprintk(DBG_RX, "%s: request %p: got %d bytes data\n",
|
||||
lo->disk->disk_name, req, bvec->bv_len);
|
||||
result = sock_recv_bvec(sock, bvec);
|
||||
if (result <= 0) {
|
||||
printk(KERN_ERR "%s: Receive data failed (result %d)\n",
|
||||
lo->disk->disk_name, result);
|
||||
req->errors++;
|
||||
return req;
|
||||
}
|
||||
dprintk(DBG_RX, "%s: request %p: got %d bytes data\n",
|
||||
lo->disk->disk_name, req, bvec->bv_len);
|
||||
}
|
||||
}
|
||||
return req;
|
||||
|
|
|
|||
|
|
@ -105,16 +105,15 @@ static void ps3disk_scatter_gather(struct ps3_storage_device *dev,
|
|||
bio_sectors(iter.bio),
|
||||
(unsigned long)iter.bio->bi_sector);
|
||||
|
||||
size = bvec->bv_len;
|
||||
buf = bvec_kmap_irq(bvec, &flags);
|
||||
if (gather)
|
||||
memcpy(dev->bounce_buf+offset, buf, size);
|
||||
else
|
||||
memcpy(buf, dev->bounce_buf+offset, size);
|
||||
offset += size;
|
||||
flush_kernel_dcache_page(bvec->bv_page);
|
||||
bvec_kunmap_irq(bvec, &flags);
|
||||
|
||||
size = bvec->bv_len;
|
||||
buf = bvec_kmap_irq(bvec, &flags);
|
||||
if (gather)
|
||||
memcpy(dev->bounce_buf+offset, buf, size);
|
||||
else
|
||||
memcpy(buf, dev->bounce_buf+offset, size);
|
||||
offset += size;
|
||||
flush_kernel_dcache_page(bvec->bv_page);
|
||||
bvec_kunmap_irq(bvec, &flags);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -186,31 +186,30 @@ static int blkif_queue_request(struct request *req)
|
|||
|
||||
ring_req->nr_segments = 0;
|
||||
rq_for_each_segment(bvec, req, iter) {
|
||||
BUG_ON(ring_req->nr_segments
|
||||
== BLKIF_MAX_SEGMENTS_PER_REQUEST);
|
||||
buffer_mfn = pfn_to_mfn(page_to_pfn(bvec->bv_page));
|
||||
fsect = bvec->bv_offset >> 9;
|
||||
lsect = fsect + (bvec->bv_len >> 9) - 1;
|
||||
/* install a grant reference. */
|
||||
ref = gnttab_claim_grant_reference(&gref_head);
|
||||
BUG_ON(ref == -ENOSPC);
|
||||
BUG_ON(ring_req->nr_segments == BLKIF_MAX_SEGMENTS_PER_REQUEST);
|
||||
buffer_mfn = pfn_to_mfn(page_to_pfn(bvec->bv_page));
|
||||
fsect = bvec->bv_offset >> 9;
|
||||
lsect = fsect + (bvec->bv_len >> 9) - 1;
|
||||
/* install a grant reference. */
|
||||
ref = gnttab_claim_grant_reference(&gref_head);
|
||||
BUG_ON(ref == -ENOSPC);
|
||||
|
||||
gnttab_grant_foreign_access_ref(
|
||||
gnttab_grant_foreign_access_ref(
|
||||
ref,
|
||||
info->xbdev->otherend_id,
|
||||
buffer_mfn,
|
||||
rq_data_dir(req) );
|
||||
|
||||
info->shadow[id].frame[ring_req->nr_segments] =
|
||||
info->shadow[id].frame[ring_req->nr_segments] =
|
||||
mfn_to_pfn(buffer_mfn);
|
||||
|
||||
ring_req->seg[ring_req->nr_segments] =
|
||||
ring_req->seg[ring_req->nr_segments] =
|
||||
(struct blkif_request_segment) {
|
||||
.gref = ref,
|
||||
.first_sect = fsect,
|
||||
.last_sect = lsect };
|
||||
|
||||
ring_req->nr_segments++;
|
||||
ring_req->nr_segments++;
|
||||
}
|
||||
|
||||
info->ring.req_prod_pvt++;
|
||||
|
|
|
|||
Loading…
Reference in a new issue