From c88e038b0242d287fb83ecf8afa25983047d2d31 Mon Sep 17 00:00:00 2001 From: Matthew Dillon Date: Fri, 8 Sep 2017 08:47:47 -0700 Subject: [PATCH] hammer2 - Do not use transaction for bulkfree pass * Remove the remaining transaction layer in bulkfree passes. Do not update the modify_tid. Generally speaking, what this code does is allow bulkfree to operate independent of normal flushes, which means it no longer stalls flushes (or vise-versa). Theoretically it should be ok for a normal flush to 'catch' bulkfree modifications in the middle of their work. --- sys/vfs/hammer2/hammer2_bulkfree.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/sys/vfs/hammer2/hammer2_bulkfree.c b/sys/vfs/hammer2/hammer2_bulkfree.c index f6987cd742..5357428048 100644 --- a/sys/vfs/hammer2/hammer2_bulkfree.c +++ b/sys/vfs/hammer2/hammer2_bulkfree.c @@ -401,9 +401,23 @@ hammer2_bulkfree_pass(hammer2_dev_t *hmp, hammer2_chain_t *vchain, /* * Scan topology for stuff inside this range. + * + * NOTE - By not using a transaction the operation can + * run concurrent with the frontend as well as + * with flushes. + * + * We cannot safely set a mtid without a transaction, + * and in fact we don't want to set one anyway. We + * want the bulkfree to be passive and no interfere + * with crash recovery. */ +#undef HAMMER2_BULKFREE_TRANS /* undef - don't use transaction */ +#ifdef HAMMER2_BULKFREE_TRANS hammer2_trans_init(hmp->spmp, 0); cbinfo.mtid = hammer2_trans_sub(hmp->spmp); +#else + cbinfo.mtid = 0; +#endif cbinfo.pri = 0; error |= hammer2_bulk_scan(vchain, h2_bulkfree_callback, &cbinfo); @@ -446,7 +460,9 @@ hammer2_bulkfree_pass(hammer2_dev_t *hmp, hammer2_chain_t *vchain, /* * Cleanup for next loop. */ +#ifdef HAMMER2_BULKFREE_TRANS hammer2_trans_done(hmp->spmp); +#endif if (error) break; cbinfo.sbase = cbinfo.sstop; -- 2.11.4.GIT