mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-18 19:07:03 +07:00
[SCSI] libosd: osd_req_read_sg, optimize the single entry case
Since sg-read is a bidi operation, it is a gain to convert a single sg entry into a regular read. Better do this in the generic layer then force each caller to do so. Signed-off-by: Boaz Harrosh <bharrosh@panasas.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
This commit is contained in:
parent
1e34c83873
commit
4977c82504
@ -1005,11 +1005,23 @@ int osd_req_read_sg(struct osd_request *or,
|
|||||||
const struct osd_sg_entry *sglist, unsigned numentries)
|
const struct osd_sg_entry *sglist, unsigned numentries)
|
||||||
{
|
{
|
||||||
u64 len;
|
u64 len;
|
||||||
int ret = _add_sg_continuation_descriptor(or, sglist, numentries, &len);
|
u64 off;
|
||||||
|
int ret;
|
||||||
|
|
||||||
if (ret)
|
if (numentries > 1) {
|
||||||
return ret;
|
off = 0;
|
||||||
osd_req_read(or, obj, 0, bio, len);
|
ret = _add_sg_continuation_descriptor(or, sglist, numentries,
|
||||||
|
&len);
|
||||||
|
if (ret)
|
||||||
|
return ret;
|
||||||
|
} else {
|
||||||
|
/* Optimize the case of single segment, read_sg is a
|
||||||
|
* bidi operation.
|
||||||
|
*/
|
||||||
|
len = sglist->len;
|
||||||
|
off = sglist->offset;
|
||||||
|
}
|
||||||
|
osd_req_read(or, obj, off, bio, len);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user