From: "Matthew Wilcox (Oracle)" <willy@infradead.org>
To: linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org
Cc: "Matthew Wilcox (Oracle)" <willy@infradead.org>
Subject: [PATCH 2/8] iomap: Remove iomap_writepage_ctx from iomap_can_add_to_ioend()
Date: Wed, 11 Aug 2021 03:46:41 +0100 [thread overview]
Message-ID: <20210811024647.3067739-3-willy@infradead.org> (raw)
In-Reply-To: <20210811024647.3067739-1-willy@infradead.org>
In preparation for using this function without an iomap_writepage_ctx,
pass in the iomap and ioend. Also simplify iomap_add_to_ioend() by
using the iomap & ioend directly.
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
fs/iomap/buffered-io.c | 34 +++++++++++++++++-----------------
1 file changed, 17 insertions(+), 17 deletions(-)
diff --git a/fs/iomap/buffered-io.c b/fs/iomap/buffered-io.c
index 3bf65daf55fc..5ff3369718a1 100644
--- a/fs/iomap/buffered-io.c
+++ b/fs/iomap/buffered-io.c
@@ -1239,18 +1239,17 @@ iomap_chain_bio(struct bio *prev)
return new;
}
-static bool
-iomap_can_add_to_ioend(struct iomap_writepage_ctx *wpc, loff_t offset,
- sector_t sector)
+static bool iomap_can_add_to_ioend(struct iomap *iomap,
+ struct iomap_ioend *ioend, loff_t offset, sector_t sector)
{
- if ((wpc->iomap.flags & IOMAP_F_SHARED) !=
- (wpc->ioend->io_flags & IOMAP_F_SHARED))
+ if ((iomap->flags & IOMAP_F_SHARED) !=
+ (ioend->io_flags & IOMAP_F_SHARED))
return false;
- if (wpc->iomap.type != wpc->ioend->io_type)
+ if (iomap->type != ioend->io_type)
return false;
- if (offset != wpc->ioend->io_offset + wpc->ioend->io_size)
+ if (offset != ioend->io_offset + ioend->io_size)
return false;
- if (sector != bio_end_sector(wpc->ioend->io_bio))
+ if (sector != bio_end_sector(ioend->io_bio))
return false;
return true;
}
@@ -1265,25 +1264,26 @@ iomap_add_to_ioend(struct inode *inode, loff_t offset, struct page *page,
struct writeback_control *wbc, struct list_head *iolist)
{
struct iomap *iomap = &wpc->iomap;
+ struct iomap_ioend *ioend = wpc->ioend;
sector_t sector = iomap_sector(iomap, offset);
unsigned len = i_blocksize(inode);
unsigned poff = offset & (PAGE_SIZE - 1);
- if (!wpc->ioend || !iomap_can_add_to_ioend(wpc, offset, sector)) {
- if (wpc->ioend)
- list_add(&wpc->ioend->io_list, iolist);
- wpc->ioend = iomap_alloc_ioend(inode, iomap, offset, sector,
- wbc);
+ if (!ioend || !iomap_can_add_to_ioend(iomap, ioend, offset, sector)) {
+ if (ioend)
+ list_add(&ioend->io_list, iolist);
+ ioend = iomap_alloc_ioend(inode, iomap, offset, sector, wbc);
+ wpc->ioend = ioend;
}
- if (bio_add_page(wpc->ioend->io_bio, page, len, poff) != len) {
- wpc->ioend->io_bio = iomap_chain_bio(wpc->ioend->io_bio);
- __bio_add_page(wpc->ioend->io_bio, page, len, poff);
+ if (bio_add_page(ioend->io_bio, page, len, poff) != len) {
+ ioend->io_bio = iomap_chain_bio(ioend->io_bio);
+ __bio_add_page(ioend->io_bio, page, len, poff);
}
if (iop)
atomic_add(len, &iop->write_bytes_pending);
- wpc->ioend->io_size += len;
+ ioend->io_size += len;
wbc_account_cgroup_owner(wbc, page, len);
}
--
2.30.2
next prev parent reply other threads:[~2021-08-11 2:49 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-11 2:46 [PATCH 0/8] iomap writethrough for O_SYNC writes Matthew Wilcox (Oracle)
2021-08-11 2:46 ` [PATCH 1/8] iomap: Pass struct iomap to iomap_alloc_ioend() Matthew Wilcox (Oracle)
2021-08-11 2:46 ` Matthew Wilcox (Oracle) [this message]
2021-08-11 2:46 ` [PATCH 3/8] iomap: Do not pass iomap_writepage_ctx to iomap_add_to_ioend() Matthew Wilcox (Oracle)
2021-08-11 2:46 ` [PATCH 4/8] iomap: Accept a NULL iomap_writepage_ctx in iomap_submit_ioend() Matthew Wilcox (Oracle)
2021-08-11 2:46 ` [PATCH 5/8] iomap: Pass iomap_write_ctx to iomap_write_actor() Matthew Wilcox (Oracle)
2021-08-11 2:46 ` [PATCH 6/8] iomap: Allow a NULL writeback_control argument to iomap_alloc_ioend() Matthew Wilcox (Oracle)
2021-08-11 2:46 ` [PATCH 7/8] iomap: Pass a length to iomap_add_to_ioend() Matthew Wilcox (Oracle)
2021-08-11 2:46 ` [PATCH 8/8] iomap: Add writethrough for O_SYNC Matthew Wilcox (Oracle)
2021-08-12 13:16 ` Christoph Hellwig
2021-08-12 13:28 ` Matthew Wilcox
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=20210811024647.3067739-3-willy@infradead.org \
--to=willy@infradead.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-xfs@vger.kernel.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).