As part of looking at WT-12153, I noticed some small fixes that could be made:
First, the macro WT_HANDLE_CAN_REOPEN is written:
(!F_ISSET(dhandle, WT_DHANDLE_DEAD | WT_DHANDLE_DROPPED) && F_ISSET(dhandle, WT_DHANDLE_OPEN))
This compiles (ARM/gcc/release) to having two tests and two branches.
But I think if we write it as:
(F_MASK(dhandle, WT_DHANDLE_DEAD | WT_DHANDLE_DROPPED | WT_DHANDLE_OPEN) == WT_DHANDLE_OPEN)
it should compile to a single branch.
Second, __wt_session_lock_dhandle returns a "is_dead" value. That's redundant
with the WT_DHANDLE_DEAD flag in dhandle->flags. We check it in the same if conditional, so it's a redundant check, I don't think the compiler can detect that.
Third, __wt_cursor_reopen checks to see if dhandle is NULL. I believe it cannot be null, we can change the check to an assert.
I think that these together may get rid of 3 branches.