Skip to content

Commit fff762e

Browse files
amotinmmatuska
authored andcommitted
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 openzfs#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 openzfs#15612
1 parent d9e110a commit fff762e

File tree

1 file changed

+1
-55
lines changed

1 file changed

+1
-55
lines changed

module/zfs/zvol.c

Lines changed: 1 addition & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -482,60 +482,6 @@ zvol_replay_write(void *arg1, void *arg2, boolean_t byteswap)
482482
return (error);
483483
}
484484

485-
/*
486-
* Replay a TX_CLONE_RANGE ZIL transaction that didn't get committed
487-
* after a system failure.
488-
*
489-
* TODO: For now we drop block cloning transations for ZVOLs as they are
490-
* unsupported, but we still need to inform BRT about that as we
491-
* claimed them during pool import.
492-
* This situation can occur when we try to import a pool from a ZFS
493-
* version supporting block cloning for ZVOLs into a system that
494-
* has this ZFS version, that doesn't support block cloning for ZVOLs.
495-
*/
496-
static int
497-
zvol_replay_clone_range(void *arg1, void *arg2, boolean_t byteswap)
498-
{
499-
char name[ZFS_MAX_DATASET_NAME_LEN];
500-
zvol_state_t *zv = arg1;
501-
objset_t *os = zv->zv_objset;
502-
lr_clone_range_t *lr = arg2;
503-
blkptr_t *bp;
504-
dmu_tx_t *tx;
505-
spa_t *spa;
506-
uint_t ii;
507-
int error;
508-
509-
dmu_objset_name(os, name);
510-
cmn_err(CE_WARN, "ZFS dropping block cloning transaction for %s.",
511-
name);
512-
513-
if (byteswap)
514-
byteswap_uint64_array(lr, sizeof (*lr));
515-
516-
tx = dmu_tx_create(os);
517-
error = dmu_tx_assign(tx, TXG_WAIT);
518-
if (error) {
519-
dmu_tx_abort(tx);
520-
return (error);
521-
}
522-
523-
spa = os->os_spa;
524-
525-
for (ii = 0; ii < lr->lr_nbps; ii++) {
526-
bp = &lr->lr_bps[ii];
527-
528-
if (!BP_IS_HOLE(bp)) {
529-
zio_free(spa, dmu_tx_get_txg(tx), bp);
530-
}
531-
}
532-
533-
(void) zil_replaying(zv->zv_zilog, tx);
534-
dmu_tx_commit(tx);
535-
536-
return (0);
537-
}
538-
539485
static int
540486
zvol_replay_err(void *arg1, void *arg2, boolean_t byteswap)
541487
{
@@ -570,7 +516,7 @@ zil_replay_func_t *const zvol_replay_vector[TX_MAX_TYPE] = {
570516
zvol_replay_err, /* TX_SETSAXATTR */
571517
zvol_replay_err, /* TX_RENAME_EXCHANGE */
572518
zvol_replay_err, /* TX_RENAME_WHITEOUT */
573-
zvol_replay_clone_range /* TX_CLONE_RANGE */
519+
zvol_replay_err, /* TX_CLONE_RANGE */
574520
};
575521

576522
/*

0 commit comments

Comments
 (0)