Re: [PATCH v3 2/4] iomap: lift zeroed mapping handling into iomap_zero_range()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Nov 15, 2024 at 09:02:47AM -0800, Darrick J. Wong wrote:
> On Fri, Nov 15, 2024 at 09:53:14AM -0500, Brian Foster wrote:
> > On Tue, Nov 12, 2024 at 09:00:35AM -0500, Brian Foster wrote:
> > > On Sun, Nov 10, 2024 at 10:03:44PM -0800, Christoph Hellwig wrote:
> > > > On Fri, Nov 08, 2024 at 07:42:44AM -0500, Brian Foster wrote:
> > > > > In preparation for special handling of subranges, lift the zeroed
> > > > > mapping logic from the iterator into the caller.
> > > > 
> > > > What's that special code?  I don't really see anything added to this
> > > > in the new code?  In general I would prefer if all code for the
> > > > iteration would be kept in a single function in preparation for
> > > > unrolling these loops.  If you want to keep this code separate
> > > > from the write zeroes logic (which seems like a good idea) please
> > > > just just move the actual real zeroing out of iomap_zero_iter into
> > > > a separate helper similar to how we e.g. have multiple different
> > > > implementations in the dio iterator.
> > > > 
> > > 
> > > There is no special code... the special treatment is to check the dirty
> > > state of a block unaligned start in isolation to decide whether to skip
> > > or explicitly zero if dirty. The fallback logic is to check the dirty
> > > state of the entire range and if needed, flush the mapping to push all
> > > pending (dirty && unwritten) instances out to the fs so the iomap is up
> > > to date and we can safely skip iomaps that are inherently zero on disk.
> > > 
> > > Hmm.. so I see the multiple iter modes for dio, but it looks like that
> > > is inherent to the mapping type. That's not quite what I'm doing here,
> > > so I'm not totally clear on what you're asking for. FWIW, I swizzled
> > > this code around a few times and failed to ultimately find something I'd
> > > consider elegant. For example, initial versions would have something
> > > like another param to iomap_zero_iter() to skip the optimization logic
> > > (i.e. don't skip zeroed extents for this call), which I think is more in
> > > the spirit of what you're saying, but I ultimately found it cleaner to
> > > open code that part. If you had something else in mind, could you share
> > > some pseudocode or something to show the factoring..?
> > > 
> > 
> > FWIW, I'm concurrently hacking on what I'd consider a longer term fix
> > here, based on some of the earlier discussions. The idea is basically
> > iomap provides a mechanism for the fs to attach a folio_batch of dirty
> > folios to the iomap, which zero range can then use as the source of
> > truth for which subranges to zero of an unwritten mapping.
> 
> That's fun! :)
> 
> I wonder, can this mechanism stretch to the generic buffered write path?
> In which case, can you hang on to the folios long enough to issue
> writeback on them too, if it's a synchronous write?
> 

That's an interesting idea. I think it could, but that's several steps
ahead of where I'm at. My current hope is that obviously this works
generically for zero range without the need to flush or revalidate
(unless as a fallback I suppose), and then from there the same thing can
be used for seek data/hole, which has similar wonkiness wrt unwritten
mappings. 


[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux