Re: Tagged pointers in the XArray
From: Gao Xiang
Date: Tue Aug 28 2018 - 19:31:12 EST
On 2018/8/29 6:27, Matthew Wilcox wrote:
> I find myself caught between two traditions.
> On the one hand, the radix tree has been calling the page cache dirty &
> writeback bits "tags" for over a decade.
> On the other hand, using some of the bits _in a pointer_ as a tag has been
> common practice since at least the 1960s.
> https://en.wikipedia.org/wiki/Tagged_pointer and
Personally I think this topic makes sense. These two `tags' are totally
> EROFS wants to use tagged pointers in the radix tree / xarray. Right now,
> they're building them by hand, which is predictably grotty-looking.
> I think it's reasonable to provide this functionality as part of the
> XArray API, _but_ it's confusing to have two different things called tags.
> I've done my best to document my way around this, but if we want to rename
> the things that the radix tree called tags to avoid the problem entirely,
> now is the time to do it. Anybody got a Good Idea?
As Matthew pointed out, it is a good chance to rename one of them.
In addition to that, I am also looking forward to a better general
implementation to wrap up operations for all these tags and restrict the
number of tag bits
at compile time. It is also useful to mark its usage and clean up these
though the implementation could look a bit simple.
If you folks think the general tagged pointer is meaningless, please
ignore my words....
However according to my EROFS coding experience, code with different
kind of tagged
pointers by hand (directly use magic masks) will be in a mess, but it
unnecessary to introduce independent operations for each kind of tagged
In the end, I also hope someone interested in this topic and thanks in