Re: [PATCH v2 15/25] iomap: Support large pages in iomap_adjust_read_range

From: Christoph Hellwig
Date: Wed Feb 12 2020 - 03:11:51 EST


> __iomap_write_begin(struct inode *inode, loff_t pos, unsigned len, int flags,
> struct page *page, struct iomap *srcmap)
> {
> - struct iomap_page *iop = iomap_page_create(inode, page);
> loff_t block_size = i_blocksize(inode);
> loff_t block_start = pos & ~(block_size - 1);
> loff_t block_end = (pos + len + block_size - 1) & ~(block_size - 1);
> @@ -556,9 +557,10 @@ __iomap_write_begin(struct inode *inode, loff_t pos, unsigned len, int flags,
>
> if (PageUptodate(page))
> return 0;
> + iomap_page_create(inode, page);

FYI, I have a similar change in a pending series that only creates
the iomap_page if a page isn't actually mapped by a contiguous extent.
Lets see which series goes in first, but the conflicts shouldn't be too
bad.

> diff --git a/include/linux/mm.h b/include/linux/mm.h
> index 52269e56c514..b4bf86590096 100644
> --- a/include/linux/mm.h
> +++ b/include/linux/mm.h
> @@ -1387,6 +1387,8 @@ static inline void clear_page_pfmemalloc(struct page *page)
> extern void pagefault_out_of_memory(void);
>
> #define offset_in_page(p) ((unsigned long)(p) & ~PAGE_MASK)
> +#define offset_in_this_page(page, p) \
> + ((unsigned long)(p) & (thp_size(page) - 1))

I think this should go int oa separate patch.