On Thu, Feb 06, 2020 at 03:36:27PM +0100, Jan Kara wrote: > Yeah, that's why I'd prefer if NULL was not "special value" at all and if > someone wanted to remove index from xarray he'd always have to use a > special function. My patches go towards that direction but not the full way > because there's still xa_cmpxchg() whose users use the fact that NULL is in > fact 'erase'. IMHO, this is more appealing. The fact that xa_store(NULL) on non-allocating arrays changes marks seems very surprising/counter intuitive. It feels wise to avoid subtle differences like this between allocating/non-allocating mode. So, it would be more uniform if xa_store and xa_cmpxchg never altered marks. I suppose in practice this means that xa_store(NULL) has to store a XA_ZERO_ENTRY even for non-allocating arrays, and related. Perhaps xa_cmp_erase() could be introduced to take the place of cmpxchg(NULL), and the distinction between erase and store NULL is that erase has the mark-destroying property and guarentees the tree can be pruned. Jason