From: Matthew Wilcox <willy@infradead.org>
To: Christoph Hellwig <hch@lst.de>
Cc: Jens Axboe <axboe@kernel.dk>, Ilya Dryomov <idryomov@gmail.com>,
Andrew Morton <akpm@linux-foundation.org>,
linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org,
linux-xfs@vger.kernel.org, linux-mm@kvack.org
Subject: Re: [PATCH 1/3] filemap: add a per-mapping stable writes flag
Date: Tue, 24 Oct 2023 12:43:03 +0100 [thread overview]
Message-ID: <ZTetxytPcOyZTr1A@casper.infradead.org> (raw)
In-Reply-To: <20231024064416.897956-2-hch@lst.de>
On Tue, Oct 24, 2023 at 08:44:14AM +0200, Christoph Hellwig wrote:
> folio_wait_stable waits for writeback to finish before modifying the
> contents of a folio again, e.g. to support check summing of the data
> in the block integrity code.
>
> Currently this behavior is controlled by the SB_I_STABLE_WRITES flag
> on the super_block, which means it is uniform for the entire file system.
> This is wrong for the block device pseudofs which is shared by all
> block devices, or file systems that can use multiple devices like XFS
> witht the RT subvolume or btrfs (although btrfs currently reimplements
> folio_wait_stable anyway).
>
> Add a per-address_space AS_STABLE_WRITES flag to control the behavior
> in a more fine grained way. The existing SB_I_STABLE_WRITES is kept
> to initialize AS_STABLE_WRITES to the existing default which covers
> most cases.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Matthew Wilcox (Oracle) <willy@infradead.org>
> +++ b/mm/page-writeback.c
> @@ -3110,7 +3110,7 @@ EXPORT_SYMBOL_GPL(folio_wait_writeback_killable);
> */
> void folio_wait_stable(struct folio *folio)
> {
> - if (folio_inode(folio)->i_sb->s_iflags & SB_I_STABLE_WRITES)
> + if (mapping_stable_writes(folio_mapping(folio)))
> folio_wait_writeback(folio);
What I really like about this is that we've gone from
folio->mapping->host->i_sb->s_iflags
to
folio->mapping->flags
which saves us two pointer dereferences. Sure, probably cached, but
maybe not, and cache misses are expensive.
next prev parent reply other threads:[~2023-10-24 11:43 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-24 6:44 add and use a per-mapping stable writes flag Christoph Hellwig
2023-10-24 6:44 ` [PATCH 1/3] filemap: add " Christoph Hellwig
2023-10-24 11:43 ` Matthew Wilcox [this message]
2023-10-24 12:03 ` Ilya Dryomov
2023-10-24 12:09 ` Matthew Wilcox
2023-10-24 12:45 ` Ilya Dryomov
2023-10-24 15:00 ` Darrick J. Wong
2023-10-24 15:10 ` Matthew Wilcox
2023-10-24 16:14 ` Christoph Hellwig
2023-10-24 6:44 ` [PATCH 2/3] block: update the stable_writes flag in bdev_add Christoph Hellwig
2023-10-24 12:04 ` Ilya Dryomov
2023-10-24 15:01 ` Darrick J. Wong
2023-10-24 6:44 ` [PATCH 3/3] xfs: respect the stable writes flag on the RT device Christoph Hellwig
2023-10-24 15:09 ` Darrick J. Wong
2023-10-24 15:14 ` Matthew Wilcox
2023-10-24 16:16 ` Christoph Hellwig
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=ZTetxytPcOyZTr1A@casper.infradead.org \
--to=willy@infradead.org \
--cc=akpm@linux-foundation.org \
--cc=axboe@kernel.dk \
--cc=hch@lst.de \
--cc=idryomov@gmail.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-mm@kvack.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).