Re: [PATCH v6 3/3] xfs: add support for FALLOC_FL_WRITE_ZEROES
"Pankaj Raghav (Samsung)" <[email protected]> Thu, 18 Jun 2026 15:57:59 +0200
| Newsgroups | org.kernel.vger.linux-api,org.kernel.vger.linux-fsdevel,org.kernel.vger.linux-xfs |
|---|---|
| Message-ID | <4qxthszoqxeccbor7je2vdrgzsyz6omj32v6kiypl5ogrmbjpc@qsynowbvvaz3> |
On Thu, Jun 18, 2026 at 06:37:54AM -0700, Christoph Hellwig wrote: > On Thu, Jun 18, 2026 at 03:26:14PM +0200, Pankaj Raghav (Samsung) wrote: > > existing code **does not** overwrite any user data. Here is why: > > > > - xfs_free_file_space (punch hole) punches inward (offset_ru -> end_rd) > > and zeroes out from (offset -> offset_ru) and (end_rd -> end) with > > xfs_zero_range > > Ah, right. > > > - Luckily, even though we consider offset_rd to end_ru in > > alloc_file_space, XFS_BMAPI_ZERO will skip zeroing already written > > edge blocks and only offset_ru -> end_rd are zeroed using unmap zero range. > > ( (offset -> offset_ru) -> EXT_NORM, (offset_ru -> end_rd) -> HOLE, > > (end_rd -> end) -> EXT_NORM) > > Oh. So this was lucky because of the corner cases. I still think doing > the proper alignment in the higher level code and only calling down for > the area that we really want to zero would be benefitial here, if only > to make the code easier to follow. I agree. I will do the changes and document some of the nuances in the code. Thanks! -- Pankaj