From: David Howells <dhowells@redhat.com>
To: Stephen Rothwell <sfr@canb.auug.org.au>
Cc: dhowells@redhat.com, Matthew Wilcox <willy@infradead.org>,
"Vishal Moola (Oracle)" <vishal.moola@gmail.com>,
Andrew Morton <akpm@linux-foundation.org>,
Steve French <smfrench@gmail.com>,
Steve French <stfrench@microsoft.com>,
Shyam Prasad N <nspmangalore@gmail.com>,
Rohith Surabattula <rohiths.msft@gmail.com>,
Tom Talpey <tom@talpey.com>, Paulo Alcantara <pc@cjr.nz>,
Jeff Layton <jlayton@kernel.org>,
linux-cifs@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-next@vger.kernel.org
Subject: Re: linux-next: manual merge of the mm-stable tree with the cifs tree
Date: Tue, 21 Feb 2023 14:39:24 +0000 [thread overview]
Message-ID: <2885897.1676990364@warthog.procyon.org.uk> (raw)
In-Reply-To: <20230221184225.0e734f0e@canb.auug.org.au>
Stephen Rothwell <sfr@canb.auug.org.au> wrote:
> Andrew has already asked for it to be merged, so its up to Linus.
>
> You could fetch it yourself and do a trial merge and send me your
> resolution ..
>
> git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm tags/mm-stable-2023-02-20-13-37
Okay, did that. See attached. Also here:
https://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs.git/log/?h=iov-cifs-mm
David
---
commit 71ad4f67439e60fe04bbf7aed8870e6f83a5d15e
Author: David Howells <dhowells@redhat.com>
Date: Tue Feb 21 13:23:05 2023 +0000
cifs: Handle transition to filemap_get_folios_tag()
filemap_get_folios_tag() is being added and find_get_pages_range_tag() is
being removed in effectively a single event. This causes a problem for
the:
cifs: Change the I/O paths to use an iterator rather than a page list
patch[1] on the cifs/for-next branch as it's adding a new user of the
latter (which is going away), but can't yet be converted to using the
former (which doesn't yet exist upstream).
Here's a conversion patch that could be applied at merge time to deal with
this. The new cifs_writepages_region() is based directly on
afs_writepages_region() and the AFS changes in the mm tree[2]:
commit acc8d8588cb7e3e64b0d2fa611dad06574cd67b1
Author: Vishal Moola (Oracle) <vishal.moola@gmail.com>
afs: convert afs_writepages_region() to use filemap_get_folios_tag()
can be replicated in cifs almost exactly.
Signed-off-by: David Howells <dhowells@redhat.com>
cc: Stephen Rothwell <sfr@canb.auug.org.au>
cc: Steve French <sfrench@samba.org>
cc: Shyam Prasad N <nspmangalore@gmail.com>
cc: Rohith Surabattula <rohiths.msft@gmail.com>
cc: Tom Talpey <tom@talpey.com>
cc: Paulo Alcantara <pc@cjr.nz>
cc: Jeff Layton <jlayton@kernel.org>
cc: linux-cifs@vger.kernel.org
cc: Vishal Moola (Oracle) <vishal.moola@gmail.com>
Link: https://lore.kernel.org/r/20230216214745.3985496-15-dhowells@redhat.com/ [1]
Link: https://lore.kernel.org/r/20230104211448.4804-6-vishal.moola@gmail.com/ [2]
diff --git a/fs/cifs/file.c b/fs/cifs/file.c
index 58801d39213a..52af9cf93c65 100644
--- a/fs/cifs/file.c
+++ b/fs/cifs/file.c
@@ -2856,78 +2856,85 @@ static int cifs_writepages_region(struct address_space *mapping,
struct writeback_control *wbc,
loff_t start, loff_t end, loff_t *_next)
{
+ struct folio_batch fbatch;
struct folio *folio;
- struct page *head_page;
+ unsigned int i;
ssize_t ret;
int n, skips = 0;
+ folio_batch_init(&fbatch);
+
do {
pgoff_t index = start / PAGE_SIZE;
- n = find_get_pages_range_tag(mapping, &index, end / PAGE_SIZE,
- PAGECACHE_TAG_DIRTY, 1, &head_page);
+ n = filemap_get_folios_tag(mapping, &index, end / PAGE_SIZE,
+ PAGECACHE_TAG_DIRTY, &fbatch);
if (!n)
break;
- folio = page_folio(head_page);
- start = folio_pos(folio); /* May regress with THPs */
+ for (i = 0; i < n; i++) {
+ folio = fbatch.folios[i];
+ start = folio_pos(folio); /* May regress with THPs */
- /* At this point we hold neither the i_pages lock nor the
- * page lock: the page may be truncated or invalidated
- * (changing page->mapping to NULL), or even swizzled
- * back from swapper_space to tmpfs file mapping
- */
- if (wbc->sync_mode != WB_SYNC_NONE) {
- ret = folio_lock_killable(folio);
- if (ret < 0) {
- folio_put(folio);
- return ret;
- }
- } else {
- if (!folio_trylock(folio)) {
- folio_put(folio);
- return 0;
+ /* At this point we hold neither the i_pages lock nor the
+ * page lock: the page may be truncated or invalidated
+ * (changing page->mapping to NULL), or even swizzled
+ * back from swapper_space to tmpfs file mapping
+ */
+ if (wbc->sync_mode != WB_SYNC_NONE) {
+ ret = folio_lock_killable(folio);
+ if (ret < 0) {
+ folio_batch_release(&fbatch);
+ return ret;
+ }
+ } else {
+ if (!folio_trylock(folio))
+ continue;
}
- }
- if (folio_mapping(folio) != mapping ||
- !folio_test_dirty(folio)) {
- start += folio_size(folio);
- folio_unlock(folio);
- folio_put(folio);
- continue;
- }
+ if (folio->mapping != mapping ||
+ !folio_test_dirty(folio)) {
+ start += folio_size(folio);
+ folio_unlock(folio);
+ continue;
+ }
- if (folio_test_writeback(folio) ||
- folio_test_fscache(folio)) {
- folio_unlock(folio);
- if (wbc->sync_mode != WB_SYNC_NONE) {
- folio_wait_writeback(folio);
+ if (folio_test_writeback(folio) ||
+ folio_test_fscache(folio)) {
+ folio_unlock(folio);
+ if (wbc->sync_mode != WB_SYNC_NONE) {
+ folio_wait_writeback(folio);
#ifdef CONFIG_CIFS_FSCACHE
- folio_wait_fscache(folio);
+ folio_wait_fscache(folio);
#endif
- } else {
- start += folio_size(folio);
- }
- folio_put(folio);
- if (wbc->sync_mode == WB_SYNC_NONE) {
- if (skips >= 5 || need_resched())
- break;
- skips++;
+ } else {
+ start += folio_size(folio);
+ }
+ if (wbc->sync_mode == WB_SYNC_NONE) {
+ if (skips >= 5 || need_resched()) {
+ *_next = start;
+ return 0;
+ }
+ skips++;
+ }
+ continue;
}
- continue;
- }
- if (!folio_clear_dirty_for_io(folio))
- /* We hold the page lock - it should've been dirty. */
- WARN_ON(1);
+ if (!folio_clear_dirty_for_io(folio))
+ /* We hold the page lock - it should've been dirty. */
+ WARN_ON(1);
- ret = cifs_write_back_from_locked_folio(mapping, wbc, folio, start, end);
- folio_put(folio);
- if (ret < 0)
- return ret;
+ ret = cifs_write_back_from_locked_folio(mapping, wbc,
+ folio, start, end);
+ if (ret < 0) {
+ folio_batch_release(&fbatch);
+ return ret;
+ }
+
+ start += ret;
+ }
- start += ret;
+ folio_batch_release(&fbatch);
cond_resched();
} while (wbc->nr_to_write > 0);
next prev parent reply other threads:[~2023-02-21 14:40 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-20 4:29 linux-next: manual merge of the mm-stable tree with the cifs tree Stephen Rothwell
2023-02-20 13:58 ` Matthew Wilcox
2023-02-20 8:01 ` Stephen Rothwell
2023-02-20 20:58 ` Matthew Wilcox
2023-02-21 6:44 ` Stephen Rothwell
2023-02-21 7:19 ` David Howells
2023-02-21 7:42 ` Stephen Rothwell
2023-02-21 14:39 ` David Howells [this message]
2023-02-21 14:55 ` Matthew Wilcox
2023-02-21 15:05 ` David Howells
2023-02-21 15:26 ` Matthew Wilcox
2023-02-21 15:20 ` David Howells
2023-02-21 15:30 ` Obsolete comment on page swizzling (written by Hugh)? David Howells
[not found] ` <2890066.1676993700@warthog.procyon.org.uk>
2023-02-21 22:41 ` Hugh Dickins
2023-02-22 2:49 ` linux-next: manual merge of the mm-stable tree with the cifs tree Stephen Rothwell
2023-02-22 8:27 ` David Howells
2023-02-22 12:13 ` Stephen Rothwell
2023-02-20 21:00 ` Steve French
2023-02-21 6:50 ` Stephen Rothwell
2023-02-20 14:29 ` David Howells
2023-02-20 15:12 ` Matthew Wilcox
2023-02-20 8:05 ` Stephen Rothwell
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=2885897.1676990364@warthog.procyon.org.uk \
--to=dhowells@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=jlayton@kernel.org \
--cc=linux-cifs@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-next@vger.kernel.org \
--cc=nspmangalore@gmail.com \
--cc=pc@cjr.nz \
--cc=rohiths.msft@gmail.com \
--cc=sfr@canb.auug.org.au \
--cc=smfrench@gmail.com \
--cc=stfrench@microsoft.com \
--cc=tom@talpey.com \
--cc=vishal.moola@gmail.com \
--cc=willy@infradead.org \
/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;
as well as URLs for NNTP newsgroup(s).