usr/src/uts/common/fs/zfs/zil.c
changeset 4935 c80bf0e6f4aa
parent 4527 5d5b6ba91b17
child 5223 ca2e1fd5ee29
--- a/usr/src/uts/common/fs/zfs/zil.c	Thu Aug 23 11:15:39 2007 -0700
+++ b/usr/src/uts/common/fs/zfs/zil.c	Thu Aug 23 12:02:19 2007 -0700
@@ -454,6 +454,32 @@
 	ASSERT(BP_IS_HOLE(&zh->zh_log));
 }
 
+/*
+ * zil_rollback_destroy() is only called by the rollback code.
+ * We already have a syncing tx. Rollback has exclusive access to the
+ * dataset, so we don't have to worry about concurrent zil access.
+ * The actual freeing of any log blocks occurs in zil_sync() later in
+ * this txg syncing phase.
+ */
+void
+zil_rollback_destroy(zilog_t *zilog, dmu_tx_t *tx)
+{
+	const zil_header_t *zh = zilog->zl_header;
+	uint64_t txg;
+
+	if (BP_IS_HOLE(&zh->zh_log))
+		return;
+
+	txg = dmu_tx_get_txg(tx);
+	ASSERT3U(zilog->zl_destroy_txg, <, txg);
+	zilog->zl_destroy_txg = txg;
+	zilog->zl_keep_first = B_FALSE;
+
+	ASSERT(list_is_empty(&zilog->zl_lwb_list));
+	(void) zil_parse(zilog, zil_free_log_block, zil_free_log_record,
+	    tx, zh->zh_claim_txg);
+}
+
 int
 zil_claim(char *osname, void *txarg)
 {