Re: [RFC PATCH V3] iomap: add support to track dirty state of sub pages

2020-08-22 Thread Christoph Hellwig
On Sat, Aug 22, 2020 at 03:24:14PM +0100, Matthew Wilcox wrote: > The case I was worrying about: > > fill a filesystem so that free space is very fragmented > readahead into a hole > hole is large, don't allocate an iop > writeback the page > don't have an iop, can't track the write count > > I'd

Re: [RFC PATCH V3] iomap: add support to track dirty state of sub pages

2020-08-22 Thread Matthew Wilcox
On Sat, Aug 22, 2020 at 07:03:45AM +0100, Christoph Hellwig wrote: > On Fri, Aug 21, 2020 at 02:36:57PM +0100, Matthew Wilcox wrote: > > On Fri, Aug 21, 2020 at 07:12:34AM +0100, Christoph Hellwig wrote: > > > iomap sets PagePrivate if a iomap_page structure is allocated. Right > > > now that mean

Re: [RFC PATCH V3] iomap: add support to track dirty state of sub pages

2020-08-21 Thread Christoph Hellwig
On Fri, Aug 21, 2020 at 02:36:57PM +0100, Matthew Wilcox wrote: > On Fri, Aug 21, 2020 at 07:12:34AM +0100, Christoph Hellwig wrote: > > iomap sets PagePrivate if a iomap_page structure is allocated. Right > > now that means for all pages on a file system with a block size smaller > > than the pag

Re: [RFC PATCH V3] iomap: add support to track dirty state of sub pages

2020-08-21 Thread Matthew Wilcox
On Fri, Aug 21, 2020 at 07:12:34AM +0100, Christoph Hellwig wrote: > iomap sets PagePrivate if a iomap_page structure is allocated. Right > now that means for all pages on a file system with a block size smaller > than the page size, although I hope we reduce that scope a little. I was thinking a

Re: [RFC PATCH V3] iomap: add support to track dirty state of sub pages

2020-08-20 Thread Christoph Hellwig
> diff --git a/fs/iomap/buffered-io.c b/fs/iomap/buffered-io.c > index bcfc288dba3f..b6a7457d8581 100644 > --- a/fs/iomap/buffered-io.c > +++ b/fs/iomap/buffered-io.c > @@ -21,15 +21,20 @@ > > #include "../internal.h" > > +#define DIRTY_BITS(x)((x) + PAGE_SIZE / SECTOR_SIZE) > /* Nit

Re: [RFC PATCH V3] iomap: add support to track dirty state of sub pages

2020-08-20 Thread Christoph Hellwig
On Thu, Aug 20, 2020 at 09:38:53AM +0800, yukuai (C) wrote: > > > +iomap_set_range_dirty(struct page *page, unsigned int off, > > > + unsigned int len) > > > +{ > > > + if (PageError(page)) > > > + return; > > > + > > > + if (page_has_private(page)) > > > + iomap_iop_set_ran

Re: [RFC PATCH V3] iomap: add support to track dirty state of sub pages

2020-08-19 Thread yukuai (C)
On 2020/8/19 20:56, Gao Xiang wrote: On Wed, Aug 19, 2020 at 08:05:42PM +0800, Yu Kuai wrote: ... +static void +iomap_iop_set_range_dirty(struct page *page, unsigned int off, + unsigned int len) +{ + struct iomap_page *iop = to_iomap_page(page); + struct inode *inode

Re: [RFC PATCH V3] iomap: add support to track dirty state of sub pages

2020-08-19 Thread Gao Xiang
On Wed, Aug 19, 2020 at 08:05:42PM +0800, Yu Kuai wrote: ... > +static void > +iomap_iop_set_range_dirty(struct page *page, unsigned int off, > + unsigned int len) > +{ > + struct iomap_page *iop = to_iomap_page(page); > + struct inode *inode = page->mapping->host; > + uns

[RFC PATCH V3] iomap: add support to track dirty state of sub pages

2020-08-19 Thread Yu Kuai
changes from v2: as suggested by Mathew: - move iomap_set_page_dirty() into iomap_set_range_dirty() - add DIRTY_BITS() - move ioamp_set_rannge_dirty() from iomap_page_mkwrite_actor() to iomap_page_mkwrite() - clear the dirty bits of entire page in iomap_writepage_map changes from v1: - se