Skip to content

Commit

Permalink
zvol_write() can use dmu_tx_hold_write_by_dnode()
Browse files Browse the repository at this point in the history
We can improve the performance of writes to zvols by using
dmu_tx_hold_write_by_dnode() instead of dmu_tx_hold_write().  This
reduces lock contention on the first block of the dnode object, and also
reduces the amount of CPU needed.  The benefit will be highest with
multi-threaded async writes (i.e. writes that don't call zil_commit()).

Reviewed-by: Jorgen Lundman <lundman@lundman.net>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Tony Nguyen <tony.nguyen@delphix.com>
Signed-off-by: Matthew Ahrens <mahrens@delphix.com>
Closes openzfs#10184
  • Loading branch information
ahrens authored and jsai20 committed Mar 30, 2021
1 parent 88a88a6 commit 48d8973
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion module/os/linux/zfs/zvol_os.c
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ zvol_write(void *arg)
if (bytes > volsize - off) /* don't write past the end */
bytes = volsize - off;

dmu_tx_hold_write(tx, ZVOL_OBJ, off, bytes);
dmu_tx_hold_write_by_dnode(tx, zv->zv_dn, off, bytes);

/* This will only fail for ENOSPC */
error = dmu_tx_assign(tx, TXG_WAIT);
Expand Down

0 comments on commit 48d8973

Please sign in to comment.