mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-28 17:39:23 +03:00
Improve block cloning transactions accounting
Previous dmu_tx_count_clone() was broken, stating that cloning is similar to free. While they might be from some points, cloning is not net-free. It will likely consume space and memory, and unlike free it will do it no matter whether the destination has the blocks or not (usually not, so previous code did nothing). Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Alexander Motin <mav@FreeBSD.org> Sponsored by: iXsystems, Inc. Closes #17431
This commit is contained in:
committed by
Brian Behlendorf
parent
23fad19818
commit
0c9cdd1606
@@ -1657,7 +1657,8 @@ zfs_clone_range(znode_t *inzp, uint64_t *inoffp, znode_t *outzp,
|
||||
dmu_tx_hold_sa(tx, outzp->z_sa_hdl, B_FALSE);
|
||||
db = (dmu_buf_impl_t *)sa_get_db(outzp->z_sa_hdl);
|
||||
DB_DNODE_ENTER(db);
|
||||
dmu_tx_hold_clone_by_dnode(tx, DB_DNODE(db), outoff, size);
|
||||
dmu_tx_hold_clone_by_dnode(tx, DB_DNODE(db), outoff, size,
|
||||
inblksz);
|
||||
DB_DNODE_EXIT(db);
|
||||
zfs_sa_upgrade_txholds(tx, outzp);
|
||||
error = dmu_tx_assign(tx, DMU_TX_WAIT);
|
||||
@@ -1824,7 +1825,7 @@ zfs_clone_range_replay(znode_t *zp, uint64_t off, uint64_t len, uint64_t blksz,
|
||||
dmu_tx_hold_sa(tx, zp->z_sa_hdl, B_FALSE);
|
||||
db = (dmu_buf_impl_t *)sa_get_db(zp->z_sa_hdl);
|
||||
DB_DNODE_ENTER(db);
|
||||
dmu_tx_hold_clone_by_dnode(tx, DB_DNODE(db), off, len);
|
||||
dmu_tx_hold_clone_by_dnode(tx, DB_DNODE(db), off, len, blksz);
|
||||
DB_DNODE_EXIT(db);
|
||||
zfs_sa_upgrade_txholds(tx, zp);
|
||||
error = dmu_tx_assign(tx, DMU_TX_WAIT);
|
||||
|
||||
Reference in New Issue
Block a user