On Tue, Jun 07, 2022 at 03:53:35PM +0900, Damien Le Moal wrote: > >> + else if (offset < isize) > >> length = min(length, isize - offset); > > > > So you still report an IOMAP_UNWRITTEN extent for the whole size of > > the requst past EOF? Looking at XFS we do return the whole requested > > length, but do return it as HOLE. Maybe we need to clarify the behavior > > here and document it. > > Yes, I checked xfs and saw that. But in zonefs case, since the file blocks are > always preallocated, blocks after the write pointer are indeed UNWRITTEN. I did > check that iomap read processing treats UNWRITTEN and HOLE similarly, that is, > ignore the value of length and stop issuing IOs when either type is seen. But I > may have missed something. > > Note that initially I wrote the patch below to fix the problem. But it is very > large and should probably be a cleanup for the next cycle. It separates the > begin op for read and write, which makes things easier to understand. I much prefer this more extensive fix.