• David Howells's avatar
    netfs: Simplify the writeback code · 983cdcf8
    David Howells authored
    Use the new folio_queue structures to simplify the writeback code.  The
    problem with referring to the i_pages xarray directly is that we may have
    gaps in the sequence of folios we're writing from that we need to skip when
    we're removing the writeback mark from the folios we're writing back from.
    
    At the moment the code tries to deal with this by carefully tracking the
    gaps in each writeback stream (eg. write to server and write to cache) and
    divining when there's a gap that spans folios (something that's not helped
    by folios not being a consistent size).
    
    Instead, the folio_queue buffer contains pointers only the folios we're
    dealing with, has them in ascending order and indicates a gap by placing
    non-consequitive folios next to each other.  This makes it possible to
    track where we need to clean up to by just keeping track of where we've
    processed to on each stream and taking the minimum.
    
    Note that the I/O iterator is always rounded up to the end of the folio,
    even if that is beyond the EOF position, so that the cache can do DIO from
    the page.  The excess space is cleared, though mmapped writes clobber it.
    Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
    cc: Jeff Layton <jlayton@kernel.org>
    cc: netfs@lists.linux.dev
    cc: linux-fsdevel@vger.kernel.org
    Link: https://lore.kernel.org/r/20240814203850.2240469-18-dhowells@redhat.com/ # v2
    Signed-off-by: default avatarChristian Brauner <brauner@kernel.org>
    983cdcf8
netfs.h 20.4 KB