On Mon, Oct 01, 2018 at 10:20:05AM -0400, Brian Foster wrote: > > eof = !xfs_iext_lookup_extent(ip, ifp, offset_fsb, &icur, &got); > > - if (!eof && got.br_startoff <= offset_fsb) { > > - if (xfs_is_reflink_inode(ip)) { > > + if (eof) > > + got.br_startoff = maxbytes_fsb; > > What's the purpose of this? Can't we just continue to use eof in the > logic below and report holes up through the requested range (offset + > length) just like the other branch does (via xfs_bmapi_read())? Setting the startblock makes the code a lot simpler. But yes, we could limit the hole to the reporting range. > > > + if (got.br_startoff <= offset_fsb) { > > + if (xfs_is_reflink_inode(ip) && > > + ((flags & IOMAP_WRITE) || > > + got.br_state != XFS_EXT_UNWRITTEN)) { > > I think a small comment is useful here due to the implicit logic. For > example: > > /* reservation is required for writes and zeroing over normal extents */ Ok.