summaryrefslogtreecommitdiffstats
path: root/drivers/target
diff options
context:
space:
mode:
authorMing Lei <tom.leiming@gmail.com>2016-11-11 20:05:32 +0800
committerJens Axboe <axboe@fb.com>2016-11-22 08:57:55 -0700
commit84c8590646d5b35804bac60eb58b145839b5893e (patch)
tree0f465eebb030ac1b2a5295b6c13d1c8d92c9b0c2 /drivers/target
parent2c73a603cd0722c0594afc9efa0a617204303348 (diff)
downloadop-kernel-dev-84c8590646d5b35804bac60eb58b145839b5893e.zip
op-kernel-dev-84c8590646d5b35804bac60eb58b145839b5893e.tar.gz
target: avoid accessing .bi_vcnt directly
When the bio is full, bio_add_pc_page() will return zero, so use this information tell when the bio is full. Also replace access to .bi_vcnt for pr_debug() with bio_segments(). Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Ming Lei <tom.leiming@gmail.com> Reviewed-by: Sagi Grimberg <sagi@grimberg.me> Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'drivers/target')
-rw-r--r--drivers/target/target_core_pscsi.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/drivers/target/target_core_pscsi.c b/drivers/target/target_core_pscsi.c
index 9125d93..04d7aa7 100644
--- a/drivers/target/target_core_pscsi.c
+++ b/drivers/target/target_core_pscsi.c
@@ -935,13 +935,9 @@ pscsi_map_sg(struct se_cmd *cmd, struct scatterlist *sgl, u32 sgl_nents,
rc = bio_add_pc_page(pdv->pdv_sd->request_queue,
bio, page, bytes, off);
- if (rc != bytes)
- goto fail;
-
pr_debug("PSCSI: bio->bi_vcnt: %d nr_vecs: %d\n",
- bio->bi_vcnt, nr_vecs);
-
- if (bio->bi_vcnt > nr_vecs) {
+ bio_segments(bio), nr_vecs);
+ if (rc != bytes) {
pr_debug("PSCSI: Reached bio->bi_vcnt max:"
" %d i: %d bio: %p, allocating another"
" bio\n", bio->bi_vcnt, i, bio);
OpenPOWER on IntegriCloud