diff options
-rw-r--r-- | drivers/scsi/osd/osd_initiator.c | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/drivers/scsi/osd/osd_initiator.c b/drivers/scsi/osd/osd_initiator.c index b37c8a3c1bb0..86afb13f1e79 100644 --- a/drivers/scsi/osd/osd_initiator.c +++ b/drivers/scsi/osd/osd_initiator.c | |||
@@ -1005,11 +1005,23 @@ int osd_req_read_sg(struct osd_request *or, | |||
1005 | const struct osd_sg_entry *sglist, unsigned numentries) | 1005 | const struct osd_sg_entry *sglist, unsigned numentries) |
1006 | { | 1006 | { |
1007 | u64 len; | 1007 | u64 len; |
1008 | int ret = _add_sg_continuation_descriptor(or, sglist, numentries, &len); | 1008 | u64 off; |
1009 | int ret; | ||
1009 | 1010 | ||
1010 | if (ret) | 1011 | if (numentries > 1) { |
1011 | return ret; | 1012 | off = 0; |
1012 | osd_req_read(or, obj, 0, bio, len); | 1013 | ret = _add_sg_continuation_descriptor(or, sglist, numentries, |
1014 | &len); | ||
1015 | if (ret) | ||
1016 | return ret; | ||
1017 | } else { | ||
1018 | /* Optimize the case of single segment, read_sg is a | ||
1019 | * bidi operation. | ||
1020 | */ | ||
1021 | len = sglist->len; | ||
1022 | off = sglist->offset; | ||
1023 | } | ||
1024 | osd_req_read(or, obj, off, bio, len); | ||
1013 | 1025 | ||
1014 | return 0; | 1026 | return 0; |
1015 | } | 1027 | } |