Skip to content

Commit bcd83cc

Browse files
authored
ZIL: Remove TX_CLONE_RANGE replay for ZVOLs.
zil_claim_clone_range() takes references on cloned blocks before ZIL replay. Later zil_free_clone_range() drops them after replay or on dataset destroy. The total balance is neutral. It means we do not need to do anything (drop the references) for not implemented yet TX_CLONE_RANGE replay for ZVOLs. This is a logical follow up to #15603. Reviewed-by: Kay Pedersen <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Alexander Motin <[email protected]> Sponsored by: iXsystems, Inc. Closes #15612
1 parent adcea23 commit bcd83cc

File tree

1 file changed

+1
-59
lines changed

1 file changed

+1
-59
lines changed

module/zfs/zvol.c

Lines changed: 1 addition & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -515,64 +515,6 @@ zvol_replay_write(void *arg1, void *arg2, boolean_t byteswap)
515515
return (error);
516516
}
517517

518-
/*
519-
* Replay a TX_CLONE_RANGE ZIL transaction that didn't get committed
520-
* after a system failure.
521-
*
522-
* TODO: For now we drop block cloning transations for ZVOLs as they are
523-
* unsupported, but we still need to inform BRT about that as we
524-
* claimed them during pool import.
525-
* This situation can occur when we try to import a pool from a ZFS
526-
* version supporting block cloning for ZVOLs into a system that
527-
* has this ZFS version, that doesn't support block cloning for ZVOLs.
528-
*/
529-
static int
530-
zvol_replay_clone_range(void *arg1, void *arg2, boolean_t byteswap)
531-
{
532-
char name[ZFS_MAX_DATASET_NAME_LEN];
533-
zvol_state_t *zv = arg1;
534-
objset_t *os = zv->zv_objset;
535-
lr_clone_range_t *lr = arg2;
536-
blkptr_t *bp;
537-
dmu_tx_t *tx;
538-
spa_t *spa;
539-
uint_t ii;
540-
int error;
541-
542-
ASSERT3U(lr->lr_common.lrc_reclen, >=, sizeof (*lr));
543-
ASSERT3U(lr->lr_common.lrc_reclen, >=, offsetof(lr_clone_range_t,
544-
lr_bps[lr->lr_nbps]));
545-
546-
dmu_objset_name(os, name);
547-
cmn_err(CE_WARN, "ZFS dropping block cloning transaction for %s.",
548-
name);
549-
550-
if (byteswap)
551-
byteswap_uint64_array(lr, sizeof (*lr));
552-
553-
tx = dmu_tx_create(os);
554-
error = dmu_tx_assign(tx, TXG_WAIT);
555-
if (error) {
556-
dmu_tx_abort(tx);
557-
return (error);
558-
}
559-
560-
spa = os->os_spa;
561-
562-
for (ii = 0; ii < lr->lr_nbps; ii++) {
563-
bp = &lr->lr_bps[ii];
564-
565-
if (!BP_IS_HOLE(bp)) {
566-
zio_free(spa, dmu_tx_get_txg(tx), bp);
567-
}
568-
}
569-
570-
(void) zil_replaying(zv->zv_zilog, tx);
571-
dmu_tx_commit(tx);
572-
573-
return (0);
574-
}
575-
576518
static int
577519
zvol_replay_err(void *arg1, void *arg2, boolean_t byteswap)
578520
{
@@ -607,7 +549,7 @@ zil_replay_func_t *const zvol_replay_vector[TX_MAX_TYPE] = {
607549
zvol_replay_err, /* TX_SETSAXATTR */
608550
zvol_replay_err, /* TX_RENAME_EXCHANGE */
609551
zvol_replay_err, /* TX_RENAME_WHITEOUT */
610-
zvol_replay_clone_range /* TX_CLONE_RANGE */
552+
zvol_replay_err, /* TX_CLONE_RANGE */
611553
};
612554

613555
/*

0 commit comments

Comments
 (0)