Call dmu_read_uio_dbuf() in zvol_read()

The difference between `dmu_read_uio()` and `dmu_read_uio_dbuf()` is
that the former takes a hold while the latter uses an existing hold.
`zfs_read()` in the ZPL will use `dmu_read_uio_dbuf()` while
our analogous `zvol_write()` will use `dmu_write_uio_dbuf()`, but for no
apparent reason, we inherited a `zvol_read()` function from
OpenSolaris that does `dmu_read_uio()`. illumos-gate also still
uses `dmu_read_uio()` to this day. Lets switch to `dmu_read_uio_dbuf()`,
which is more performant.

Signed-off-by: Richard Yao <ryao@gentoo.org>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Tim Chase <tim@chase2k.com>
Signed-off-by: Chunwei Chen <tuxoko@gmail.com>
Closes #4316
This commit is contained in:
Richard Yao 2016-02-05 23:10:13 -05:00 committed by Brian Behlendorf
parent a765a34a31
commit 19a47cb1c2

View File

@ -731,7 +731,7 @@ zvol_read(zvol_state_t *zv, uio_t *uio)
if (bytes > volsize - uio->uio_loffset) if (bytes > volsize - uio->uio_loffset)
bytes = volsize - uio->uio_loffset; bytes = volsize - uio->uio_loffset;
error = dmu_read_uio(zv->zv_objset, ZVOL_OBJ, uio, bytes); error = dmu_read_uio_dbuf(zv->zv_dbuf, uio, bytes);
if (error) { if (error) {
/* convert checksum errors into IO errors */ /* convert checksum errors into IO errors */
if (error == ECKSUM) if (error == ECKSUM)