Re: [PATCH 3/7] xfs: protect S_DAX transitions in XFS read path

From: Dan Williams
Date: Tue Sep 26 2017 - 09:59:44 EST


On Mon, Sep 25, 2017 at 11:32 PM, Christoph Hellwig <hch@xxxxxx> wrote:
> We can't just take locking one level up, as we need differnet locking
> for different kinds of I/O.
>
> I think you probably want an IOCB_DAX flag to check IS_DAX once and
> then stick to it, similar to what we do for direct I/O.

I wonder if this works better with a reference count mechanism
per-file so that we don't need a hold a lock over the whole
transition. Similar to request_queue reference counting, when DAX is
being turned off we block new references and drain the in-flight ones.