Re: make xfs sparse-warning free

Linus Torvalds
2025-11-14T17:57:10Z

On Thu, 13 Nov 2025 at 21:54, Christoph Hellwig <hch@lst.de> wrote:
>
> this series isn't really a series, but a collection of two very different
> patches toward the result of having no sparse warnings for fs/xfs/.

So I answered the wrong email (because I saw the other email first).

I think making it sparse-clean is obviously good, but as mentioned in
the other email, I think the clang context tracking is the (near)
future when it comes to static help in lock context tracking.

I know you looked at that clang context thing earlier, and assumed
that that is what triggered this work in the first place?

Anyway, iirc Chris Li already at some point indicated that he'd rather
remove the sparse context checking entirely than try to make it
smarter.

I do think that being sparse-clean for the current sparse context
tracking is a "good thing", but not really because it makes sparse
happy: it's a good thing mainly because *if* you can do it, it tends
to mean that the lock context rules are really simple and
straightforward, because sparse just doesn't do anything non-simple
very well in this area.

So when you say about patch 2:

> I actually think this improves the code, so I think this should go into
> the XFS tree.

I heartily agree. But then

> Patch 3 duplicates some XFS code to work around the lock context tracking,
> but I think it is pretty silly.

makes me go "if you have to make the code worse to make sparse happy,
maybe just look at the clang context tracking instead?"

Because I *assume* that the more complete clang context tracking
series doesn't need that?

Linus