From: Matthew Wilcox <willy@infradead.org>
To: Christoph Hellwig <hch@infradead.org>
Cc: linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH 8/8] iomap: Add writethrough for O_SYNC
Date: Thu, 12 Aug 2021 14:28:26 +0100 [thread overview]
Message-ID: <YRUh+tKuGI192qpc@casper.infradead.org> (raw)
In-Reply-To: <YRUfE5GH7LbyBnSM@infradead.org>
On Thu, Aug 12, 2021 at 02:16:03PM +0100, Christoph Hellwig wrote:
> On Wed, Aug 11, 2021 at 03:46:47AM +0100, Matthew Wilcox (Oracle) wrote:
> > For O_SYNC writes, if the filesystem has already allocated blocks for
> > the range, we can avoid marking the page as dirty and skip straight to
> > marking the page as writeback.
>
> So this just optimizes O_SYNC overwrites. How common are those for
> bufered I/O? I know databases use them a lot with direct I/O, but for
> buffere I/O this seems like an odd I/O pattern.
As the comment says:
+ /* Can't allocate blocks here because we don't have ->prepare_ioend */
Give me a way to allocate blocks and it can do better! I didn't realise
this was going to be a problem when I embarked on this, but attempting
to do IO to wild addresses made me realise that most appending O_SYNC
writes are IOMAP_DELALLOC and so don't have allocated blocks.
And it's not just overwrites. If you open(O_SYNC|O_TRUNC) and then
write ten bytes at a time, the first write to each block will cause us
to fall back to writeback pages, but subsequent writes to a block will
writethrough.
prev parent reply other threads:[~2021-08-12 13:29 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 ` [PATCH 2/8] iomap: Remove iomap_writepage_ctx from iomap_can_add_to_ioend() Matthew Wilcox (Oracle)
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 [this message]
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=YRUh+tKuGI192qpc@casper.infradead.org \
--to=willy@infradead.org \
--cc=hch@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).