[dm-devel] [PATCH 1/6] dax: Define a helper dax_pgoff() which takes in dax_offset as argument
Matthew Wilcox
willy at infradead.org
Mon Feb 17 13:37:47 UTC 2020
On Wed, Feb 12, 2020 at 12:07:28PM -0500, Vivek Goyal wrote:
> +int dax_pgoff(sector_t dax_offset, sector_t sector, size_t size, pgoff_t *pgoff)
> +{
> + phys_addr_t phys_off = (dax_offset + sector) * 512;
> +
> + if (pgoff)
> + *pgoff = PHYS_PFN(phys_off);
> + if (phys_off % PAGE_SIZE || size % PAGE_SIZE)
> + return -EINVAL;
> + return 0;
This is why we have IS_ERR_VALUE(). Just make this function return
a pgoff_t.
More information about the dm-devel
mailing list