linux/fs/netfs
David Howells e00827a4d0
netfs: Fix read progress reporting
For really big read RPC ops that span multiple folios, netfslib allows the
filesystem to give progress notifications to wake up the collector thread
to do a collection of folios that have now been fetched, even if the RPC is
still ongoing, thereby allowing the application to make progress.

This works by taking the current rreq->cleaned_to value (which indicates
which folios have been unlocked) and adding the stashed size of the next
folio to it.  cleaned_to, however, is subject to 64-bit tearing on a 32-bit
arch.

Fix this by stashing the next progress notification point as a size_t
(which won't tear) to be added to rreq->start (which won't change), with
the collector thread calculating that from cleaned_to plus the next folio
size.

Further, however, if the folios are small, the collector thread gets
constantly woken up - which has a negative performance impact on the
system.

Fix that too by setting a minimum trigger of 256KiB or the size of the
folio at the front of the queue, whichever is larger.  Note that this has
an issue that different subreqs have different need-to-be-cached
properties; this is solved by a preceding patch that marks the property on
the folios whilst issuing subreqs rather than when collecting them.

Also, make sure rreq->cleaned_to is initialised up front, along with
rreq->collected_to and stream->collected_to.

Fixes: e2d46f2ec3 ("netfs: Change the read result collector to only use one work item")
Link: https://sashiko.dev/#/patchset/20260804100224.2748935-1-dhowells%40redhat.com
Signed-off-by: David Howells <dhowells@redhat.com>
Link: https://patch.msgid.link/20260827134304.2075713-10-dhowells@redhat.com
Acked-by: Paulo Alcantara <pc@manguebit.org>
cc: Paulo Alcantara <pc@manguebit.org>
cc: netfs@lists.linux.dev
cc: linux-fsdevel@vger.kernel.org
Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
2026-08-31 09:54:38 +02:00
..
buffered_read.c netfs: Fix read progress reporting 2026-08-31 09:54:38 +02:00
buffered_write.c netfs: Fix decision whether to disallow write-streaming due to fscache use 2026-07-01 15:26:28 +02:00
direct_read.c netfs: Fix cancellation of a DIO and single read subrequests 2026-05-12 14:42:29 +02:00
direct_write.c netfs: break unbuffered write when netfs_alloc_subrequest() fails 2026-08-31 09:54:38 +02:00
fscache_cache.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
fscache_cookie.c netfs: Mark __nonstring lookup tables 2025-04-17 10:13:46 +02:00
fscache_internal.h netfs, fscache: Combine fscache with netfs 2023-12-24 15:08:46 +00:00
fscache_io.c treewide: Replace kmalloc with kmalloc_obj for non-scalar types 2026-02-21 01:02:28 -08:00
fscache_main.c fscache: delete fscache_cookie_lru_timer when fscache exits to avoid UAF 2024-09-01 10:30:25 +02:00
fscache_proc.c netfs: Fix proc/fs/fscache symlink to point to "netfs" not "../netfs" 2024-01-04 13:15:32 +00:00
fscache_stats.c netfs: Fix interaction between write-streaming and cachefiles culling 2024-01-05 15:42:25 +00:00
fscache_volume.c Convert 'alloc_flex' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
internal.h netfs: Fix read progress reporting 2026-08-31 09:54:38 +02:00
iterator.c netfs: Fix overrun check in netfs_extract_user_iter() 2026-05-12 14:42:30 +02:00
Kconfig netfs: clean up after renaming FSCACHE_DEBUG config 2024-08-12 22:03:26 +02:00
locking.c netfs: Replace wb_lock with a bit lock for asynchronicity 2026-07-01 15:26:29 +02:00
main.c netfs: Fix folio_queue ENOMEM in writeback by adding a mempool 2026-07-28 15:42:31 +02:00
Makefile netfs: Add support for caching single monolithic objects such as AFS dirs 2024-12-20 22:34:06 +01:00
misc.c netfs: Fix readahead synchronisation issues by loading all folios upfront 2026-08-31 09:54:38 +02:00
objects.c netfs: Fix read progress reporting 2026-08-31 09:54:38 +02:00
read_collect.c netfs: Fix read progress reporting 2026-08-31 09:54:38 +02:00
read_pgpriv2.c netfs: Mark folios with COPY_TO_CACHE whilst issuing subreqs 2026-08-31 09:54:38 +02:00
read_retry.c netfs: Mark folios with COPY_TO_CACHE whilst issuing subreqs 2026-08-31 09:54:38 +02:00
read_single.c netfs: Fix read progress reporting 2026-08-31 09:54:38 +02:00
rolling_buffer.c netfs: Fix readahead synchronisation issues by loading all folios upfront 2026-08-31 09:54:38 +02:00
stats.c netfs: Add retry stat counters 2025-02-13 16:00:48 +01:00
write_collect.c netfs: Replace wb_lock with a bit lock for asynchronicity 2026-07-01 15:26:29 +02:00
write_issue.c netfs: break unbuffered write when netfs_alloc_subrequest() fails 2026-08-31 09:54:38 +02:00
write_retry.c netfs: Fix barriering when walking subrequest list 2026-07-03 11:52:41 +02:00