diff --git a/include/sys/dmu.h b/include/sys/dmu.h index 6a5fb5530498..5ee6704668a4 100644 --- a/include/sys/dmu.h +++ b/include/sys/dmu.h @@ -1065,7 +1065,7 @@ int dmu_offset_next(objset_t *os, uint64_t object, boolean_t hole, uint64_t *off); int dmu_read_l0_bps(objset_t *os, uint64_t object, uint64_t offset, - uint64_t length, dmu_tx_t *tx, struct blkptr *bps, size_t *nbpsp); + uint64_t length, struct blkptr *bps, size_t *nbpsp); int dmu_brt_clone(objset_t *os, uint64_t object, uint64_t offset, uint64_t length, dmu_tx_t *tx, const struct blkptr *bps, size_t nbps, boolean_t replay); diff --git a/module/zfs/dmu.c b/module/zfs/dmu.c index c1f9d02f0dd8..4e42bb3ef90c 100644 --- a/module/zfs/dmu.c +++ b/module/zfs/dmu.c @@ -2173,7 +2173,7 @@ dmu_offset_next(objset_t *os, uint64_t object, boolean_t hole, uint64_t *off) int dmu_read_l0_bps(objset_t *os, uint64_t object, uint64_t offset, uint64_t length, - dmu_tx_t *tx, blkptr_t *bps, size_t *nbpsp) + blkptr_t *bps, size_t *nbpsp) { dmu_buf_t **dbp, *dbuf; dmu_buf_impl_t *db; @@ -2235,10 +2235,6 @@ dmu_read_l0_bps(objset_t *os, uint64_t object, uint64_t offset, uint64_t length, error = SET_ERROR(EAGAIN); goto out; } - if (dmu_buf_is_dirty(dbuf, tx)) { - error = SET_ERROR(EAGAIN); - goto out; - } /* * Make sure we clone only data blocks. */ diff --git a/module/zfs/zfs_vnops.c b/module/zfs/zfs_vnops.c index 71955f90db03..dca76227a4ac 100644 --- a/module/zfs/zfs_vnops.c +++ b/module/zfs/zfs_vnops.c @@ -1246,16 +1246,10 @@ zfs_clone_range(znode_t *inzp, uint64_t *inoffp, znode_t *outzp, break; } - /* - * Start a transaction. - */ - tx = dmu_tx_create(outos); - nbps = maxblocks; - error = dmu_read_l0_bps(inos, inzp->z_id, inoff, size, tx, bps, + error = dmu_read_l0_bps(inos, inzp->z_id, inoff, size, bps, &nbps); if (error != 0) { - dmu_tx_abort(tx); /* * If we are tyring to clone a block that was created * in the current transaction group. Return an error, @@ -1276,12 +1270,15 @@ zfs_clone_range(znode_t *inzp, uint64_t *inoffp, znode_t *outzp, */ if (BP_IS_PROTECTED(&bps[0])) { if (inzfsvfs != outzfsvfs) { - dmu_tx_abort(tx); error = SET_ERROR(EXDEV); break; } } + /* + * Start a transaction. + */ + tx = dmu_tx_create(outos); 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);