On Tue, Oct 19, 2021 at 10:38:42AM -0700, Dan Williams wrote:
> > So we can just delete the detection of the page size and rely on the
> > zap code to wipe out the entire level, not split it. Which is what we
> > have today already.
>
> As Joao points out, userspace wants to know the blast radius of the
> unmap for historical reasons. I do think it's worth deprecating that
> somehow... providing a better error management interface is part of
> the DAX-reflink enabling.
OK, it makes sense.
I have a less invasive idea though - emulate what zap is doing:
if (!pud_present(*pud))
return 0;
if (pud_leaf(*pud))
return PUD_SHIFT;
if (!pmd_present(*pud))
return 0;
if (pmd_leaf(*pud))
return PMD_SHIFT;
return PAGE_SHIFT;
Which would return the "blast radius" of the unmap_mapping_range()
when it rounds up to the left page level that contains the VA.
Now it doesn't need the pte_devmap test..
And when both DAX's learn to use compound_head this can be deleted.
Jason