Add warning for external consumers of dmu_tx_callback_register

While reading some code @grwilson came across the above function that
seemingly had no consumers besides a ztest callback that ensures that
the tx_callback infrastructure works correctly. It turns out that Lustre
is the main (and potentially the only) consumer of this. Refer to
`osd_trans_commit_cb` of `lustre/osd-zfs/osd_handler.c` in the Lustre
repo for more info. Let's add a comment highlighting this before someone
removes it by mistake.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Tony Hutter <hutter2@llnl.gov>
Reviewed-by: Alexander Motin <mav@FreeBSD.org>
Signed-off-by: Serapheim Dimitropoulos <serapheimd@gmail.com>
Closes #16698
This commit is contained in:
Serapheim Dimitropoulos 2024-10-30 17:11:40 -07:00 committed by GitHub
parent 6187b19434
commit ae93aeb849
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1377,6 +1377,13 @@ dmu_tx_pool(dmu_tx_t *tx)
return (tx->tx_pool);
}
/*
* Register a callback to be executed at the end of a TXG.
*
* Note: This currently exists for outside consumers, specifically the ZFS OSD
* for Lustre. Please do not remove before checking that project. For examples
* on how to use this see `ztest_commit_callback`.
*/
void
dmu_tx_callback_register(dmu_tx_t *tx, dmu_tx_callback_func_t *func, void *data)
{