From: David Howells <dhowells@redhat.com>
To: Linus Torvalds <torvalds@linux-foundation.org>,
Steve French <stfrench@microsoft.com>
Cc: dhowells@redhat.com, Vishal Moola <vishal.moola@gmail.com>,
Andrew Morton <akpm@linux-foundation.org>,
Jan Kara <jack@suse.cz>, Paulo Alcantara <pc@cjr.nz>,
Matthew Wilcox <willy@infradead.org>,
Huang Ying <ying.huang@intel.com>,
Baolin Wang <baolin.wang@linux.alibaba.com>,
Xin Hao <xhao@linux.alibaba.com>,
linux-mm@kvack.org, mm-commits@vger.kernel.org,
linux-cifs@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [RFC][PATCH] cifs: Improve use of filemap_get_folios_tag()
Date: Fri, 24 Feb 2023 15:13:06 +0000 [thread overview]
Message-ID: <2244151.1677251586@warthog.procyon.org.uk> (raw)
In-Reply-To: <2213409.1677249075@warthog.procyon.org.uk>
[This additional to the "cifs: Fix cifs_writepages_region()" patch that I
posted]
The inefficiency derived from filemap_get_folios_tag() get a batch of
contiguous folios in Vishal's change to afs that got copied into cifs can
be reduced by skipping over those folios that have been passed by the start
position rather than going through the process of locking, checking and
trying to write them.
A similar change would need to be made in afs, in addition to fixing the bugs
there.
There's also a fix in cifs_write_back_from_locked_folio() where it doesn't
return the amount of data dispatched to the server as ->async_writev() just
returns 0 on success.
Signed-off-by: David Howells <dhowells@redhat.com>
---
diff --git a/fs/cifs/file.c b/fs/cifs/file.c
index ebfcaae8c437..bae1a9709e32 100644
--- a/fs/cifs/file.c
+++ b/fs/cifs/file.c
@@ -2839,6 +2839,7 @@ static ssize_t cifs_write_back_from_locked_folio(struct address_space *mapping,
free_xid(xid);
if (rc == 0) {
wbc->nr_to_write = count;
+ rc = len;
} else if (is_retryable_error(rc)) {
cifs_pages_write_redirty(inode, start, len);
} else {
@@ -2873,6 +2874,13 @@ static int cifs_writepages_region(struct address_space *mapping,
for (int i = 0; i < nr; i++) {
ssize_t ret;
struct folio *folio = fbatch.folios[i];
+ unsigned long long fstart;
+
+ fstart = folio_pos(folio); /* May go backwards with THPs */
+ if (fstart < start &&
+ folio_size(folio) <= start - fstart)
+ continue;
+ start = fstart;
redo_folio:
start = folio_pos(folio); /* May regress with THPs */
next prev parent reply other threads:[~2023-02-24 15:13 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-20 21:52 [GIT PULL] MM updates for 6.3-rc1 Andrew Morton
2023-02-21 23:36 ` Andrew Morton
2023-02-24 1:33 ` pr-tracker-bot
2023-02-24 1:33 ` Linus Torvalds
2023-02-24 1:56 ` Andrew Morton
2023-02-24 3:01 ` Huang, Ying
2023-02-24 9:04 ` David Howells
2023-02-24 12:12 ` David Howells
2023-02-24 14:31 ` [RFC][PATCH] cifs: Fix cifs_writepages_region() David Howells
2023-02-24 16:06 ` Linus Torvalds
2023-02-24 16:11 ` Matthew Wilcox
2023-02-24 17:15 ` David Howells
2023-02-24 18:44 ` Matthew Wilcox
2023-02-24 20:13 ` David Howells
2023-02-24 20:16 ` Linus Torvalds
2023-02-24 20:45 ` Matthew Wilcox
2023-02-27 13:20 ` David Howells
2023-02-24 20:58 ` David Howells
2023-02-24 17:19 ` David Howells
2023-02-24 18:58 ` Linus Torvalds
2023-02-24 19:05 ` Linus Torvalds
2023-02-24 22:11 ` [EXTERNAL] " Steven French
2023-03-01 18:32 ` Steven French
2023-02-24 14:48 ` [RFC][PATCH] cifs, afs: Revert changes to {cifs,afs}_writepages_region() David Howells
2023-02-24 16:13 ` Linus Torvalds
2023-02-24 15:13 ` David Howells [this message]
2023-02-24 16:22 ` [RFC][PATCH] cifs: Improve use of filemap_get_folios_tag() Linus Torvalds
2023-02-24 17:22 ` David Howells
2023-02-26 2:43 ` [GIT PULL] MM updates for 6.3-rc1 Linus Torvalds
2023-02-26 3:27 ` Linus Torvalds
2023-02-26 3:53 ` Linus Torvalds
2023-02-26 3:57 ` Andrew Morton
2023-02-26 4:03 ` Linus Torvalds
2023-02-26 4:12 ` Linus Torvalds
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2244151.1677251586@warthog.procyon.org.uk \
--to=dhowells@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=baolin.wang@linux.alibaba.com \
--cc=jack@suse.cz \
--cc=linux-cifs@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mm-commits@vger.kernel.org \
--cc=pc@cjr.nz \
--cc=stfrench@microsoft.com \
--cc=torvalds@linux-foundation.org \
--cc=vishal.moola@gmail.com \
--cc=willy@infradead.org \
--cc=xhao@linux.alibaba.com \
--cc=ying.huang@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox