netfs: Make netfs_read_folio() handle streaming-write pages
authorDavid Howells <dhowells@redhat.com>
Mon, 2 Oct 2023 11:51:19 +0000 (12:51 +0100)
committerDavid Howells <dhowells@redhat.com>
Thu, 28 Dec 2023 09:45:22 +0000 (09:45 +0000)
commit7f84a7b9892d1c9429a6f5d6f67916c61b3fc183
treee5234e5c233c8f3053ba02050336a2bf04eb7818
parentc38f4e96e605f17990e871214e6ea1496bc4e65f
netfs: Make netfs_read_folio() handle streaming-write pages

netfs_read_folio() needs to handle partially-valid pages that are marked
dirty, but not uptodate in the event that someone tries to read a page was
used to cache data by a streaming write.

In such a case, make netfs_read_folio() set up a bvec iterator that points
to the parts of the folio that need filling and to a sink page for the data
that should be discarded and use that instead of i_pages as the iterator to
be written to.

This requires netfs_rreq_unlock_folios() to convert the page into a normal
dirty uptodate page, getting rid of the partial write record and bumping
the group pointer over to folio->private.

Signed-off-by: David Howells <dhowells@redhat.com>
Reviewed-by: Jeff Layton <jlayton@kernel.org>
cc: linux-cachefs@redhat.com
cc: linux-fsdevel@vger.kernel.org
cc: linux-mm@kvack.org
fs/netfs/buffered_read.c
include/trace/events/netfs.h