diff options
author | 2024-05-31 15:48:29 +0100 | |
---|---|---|
committer | 2024-09-05 11:00:41 +0200 | |
commit | ef966d73fb7cab5736407998a4ae42577bb34a3b (patch) | |
tree | 21c8fdbd665898a85ce68f2b3450e1ea61b8ef89 /fs/netfs/write_issue.c | |
parent | netfs: Adjust labels in /proc/fs/netfs/stats (diff) | |
download | wireguard-linux-ef966d73fb7cab5736407998a4ae42577bb34a3b.tar.xz wireguard-linux-ef966d73fb7cab5736407998a4ae42577bb34a3b.zip |
netfs: Record contention stats for writeback lock
Record statistics for contention upon the writeback serialisation lock that
prevents racing writeback calls from causing each other to interleave their
writebacks. These can be viewed in /proc/fs/netfs/stats on the WbLock line,
with skip=N indicating the number of non-SYNC writebacks skipped and wait=N
indicating the number of SYNC writebacks that waited.
Signed-off-by: David Howells <dhowells@redhat.com>
cc: Jeff Layton <jlayton@kernel.org>
cc: Steve French <sfrench@samba.org>
cc: netfs@lists.linux.dev
cc: linux-fsdevel@vger.kernel.org
Link: https://lore.kernel.org/r/20240814203850.2240469-5-dhowells@redhat.com/ # v2
Signed-off-by: Christian Brauner <brauner@kernel.org>
Diffstat (limited to 'fs/netfs/write_issue.c')
-rw-r--r-- | fs/netfs/write_issue.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/fs/netfs/write_issue.c b/fs/netfs/write_issue.c index 3f7e37e50c7d..44f35a0faaca 100644 --- a/fs/netfs/write_issue.c +++ b/fs/netfs/write_issue.c @@ -505,10 +505,14 @@ int netfs_writepages(struct address_space *mapping, struct folio *folio; int error = 0; - if (wbc->sync_mode == WB_SYNC_ALL) + if (!mutex_trylock(&ictx->wb_lock)) { + if (wbc->sync_mode == WB_SYNC_NONE) { + netfs_stat(&netfs_n_wb_lock_skip); + return 0; + } + netfs_stat(&netfs_n_wb_lock_wait); mutex_lock(&ictx->wb_lock); - else if (!mutex_trylock(&ictx->wb_lock)) - return 0; + } /* Need the first folio to be able to set up the op. */ folio = writeback_iter(mapping, wbc, NULL, &error); |