Skip to content

Commit 20f2878

Browse files
authored
zvol_write() can use dmu_tx_hold_write_by_dnode()
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 <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: Tony Nguyen <[email protected]> Signed-off-by: Matthew Ahrens <[email protected]> Closes #10184
1 parent 8080848 commit 20f2878

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

module/os/linux/zfs/zvol_os.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ zvol_write(void *arg)
143143
if (bytes > volsize - off) /* don't write past the end */
144144
bytes = volsize - off;
145145

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

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

0 commit comments

Comments
 (0)