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.