Message ID | CAHc6FU5a5E9K_AizwWkoPjb4cCWzqKspjc9YDVOzpCxcsDnKeA@mail.gmail.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Thu, May 24, 2018 at 08:05:03PM +0200, Andreas Gruenbacher wrote: > Approach (1) is quite trivial: > > --- a/fs/buffer.c > +++ b/fs/buffer.c > @@ -1908,7 +1908,7 @@ iomap_to_bh(struct inode *inode, sector_t, > struct buffer_head *bh, > set_buffer_unwritten(bh); > /* FALLTHRU */ > case IOMAP_MAPPED: > - if (offset >= i_size_read(inode)) > + if ((iomap->flags & IOMAP_F_NEW) || offset >= > i_size_read(inode)) > set_buffer_new(bh); > bh->b_blocknr = (iomap->addr + offset - iomap->offset) >> > inode->i_blkbits; > This is the right thing to do. We just didn't need to do it for XFS as we'll never allocate normal blocks in write_begin. You'll probably need similar tweaks in my new iomap write code, which you're hopefully lookin into as well.
On 24 May 2018 at 20:13, Christoph Hellwig <hch@lst.de> wrote: > On Thu, May 24, 2018 at 08:05:03PM +0200, Andreas Gruenbacher wrote: >> Approach (1) is quite trivial: >> >> --- a/fs/buffer.c >> +++ b/fs/buffer.c >> @@ -1908,7 +1908,7 @@ iomap_to_bh(struct inode *inode, sector_t, >> struct buffer_head *bh, >> set_buffer_unwritten(bh); >> /* FALLTHRU */ >> case IOMAP_MAPPED: >> - if (offset >= i_size_read(inode)) >> + if ((iomap->flags & IOMAP_F_NEW) || offset >= >> i_size_read(inode)) >> set_buffer_new(bh); >> bh->b_blocknr = (iomap->addr + offset - iomap->offset) >> >> inode->i_blkbits; >> > > This is the right thing to do. We just didn't need to do it for XFS > as we'll never allocate normal blocks in write_begin. Okay, that's easy. > You'll probably need similar tweaks in my new iomap write code, which > you're hopefully looking into as well. Didn't get very far with your bh removal patches so far. Thanks, Andreas
On Thu, May 24, 2018 at 08:25:55PM +0200, Andreas Gruenbacher wrote:
> Didn't get very far with your bh removal patches so far.
I think we could probably lift the whole XFS writeback code to iomap.c
once it stabilizes a little. It just needs to use struct iomap
instead of the xfs-specific xfs_bmbt_irec, and the file system would
have to provide the map_blocks and end_io hooks.
--- a/fs/buffer.c +++ b/fs/buffer.c @@ -1908,7 +1908,7 @@ iomap_to_bh(struct inode *inode, sector_t, struct buffer_head *bh, set_buffer_unwritten(bh); /* FALLTHRU */ case IOMAP_MAPPED: - if (offset >= i_size_read(inode)) + if ((iomap->flags & IOMAP_F_NEW) || offset >= i_size_read(inode)) set_buffer_new(bh);