Re: [PATCH V3 1/9] dax: fix misleading comment about share/index union in dax_folio_reset_order()

From: Alison Schofield

Date: Tue Jun 02 2026 - 20:12:30 EST


On Sat, May 30, 2026 at 04:50:35PM +0000, John Groves wrote:
> From: John Groves <John@xxxxxxxxxx>
>
> The comment in dax_folio_reset_order() claims that DAX maintains an
> invariant where folio->share != 0 only when folio->mapping == NULL,
> implying folio->share is zero whenever mapping is non-NULL. This is
> misleading because folio->share and folio->index are a union -- for
> non-shared folios with mapping != NULL, reading folio->share returns
> the file page offset (folio->index), which is typically non-zero.
>
> Reword the comment to accurately describe the union aliasing: the
> assignment clears whichever interpretation of the union word is active
> (index for non-shared folios, share for shared folios), which is correct
> because the folio is being released in either case.
>
> No functional change -- the code was already correct, only the
> justification was wrong.
>
> Fixes: 59eb73b98ae0b ("dax: Factor out dax_folio_reset_order() helper")
>
> Reviewed-by: Jonathan Cameron <jic23@xxxxxxxxxx>
> Signed-off-by: John Groves <john@xxxxxxxxxx>

Reviewed-by: Alison Schofield <alison.schofield@xxxxxxxxx>