From: Christoph Hellwig <hch@lst.de>
To: "Darrick J. Wong" <djwong@kernel.org>
Cc: Christoph Hellwig <hch@lst.de>, Jens Axboe <axboe@kernel.dk>,
Matthew Wilcox <willy@infradead.org>,
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 3/3] xfs: respect the stable writes flag on the RT device
Date: Tue, 24 Oct 2023 18:16:59 +0200 [thread overview]
Message-ID: <20231024161659.GB20546@lst.de> (raw)
In-Reply-To: <20231024150904.GA3195650@frogsfrogsfrogs>
On Tue, Oct 24, 2023 at 08:09:04AM -0700, Darrick J. Wong wrote:
> > + /*
> > + * Make the stable writes flag match that of the device the inode
> > + * resides on when flipping the RT flag.
> > + */
> > + if (S_ISREG(VFS_I(ip)->i_mode) &&
> > + XFS_IS_REALTIME_INODE(ip) != (fa->fsx_xflags & FS_XFLAG_REALTIME))
> > + xfs_update_stable_writes(ip);
>
> Hmm. Won't the masking operation here result in the if test comparing 0
> or FS_XFLAG_REALTIME to 0 or 1?
>
> Oh. FS_XFLAG_REALTIME == 1, so that's not an issue in this one case.
> That's a bit subtle though, I'd have preferred
>
> XFS_IS_REALTIME_INODE(ip) != !!(fa->fsx_xflags & FS_XFLAG_REALTIME))
>
> to make it more obvious that the if test isn't comparing apples to
> oranges.
This is all copy and pasted from a check a few lines above :)
I guess I could clean it up as well or even add a rt_flag_changed local
variable instead of duplicating the check.
> > + /*
> > + * For real-time inodes update the stable write flags to that of the RT
> > + * device instead of the data device.
> > + */
> > + if (S_ISREG(inode->i_mode) && XFS_IS_REALTIME_INODE(ip))
> > + xfs_update_stable_writes(ip);
>
> I wonder if xfs_update_stable_writes should become an empty function for
> the CONFIG_XFS_RT=n case, to avoid the atomic flags update?
>
> (The extra code is probably not worth the microoptimization.)
The compiler already eliminates the code because XFS_IS_REALTIME_INODE(ip)
has a stub for CONFIG_XFS_RT=n that always returns 0.
prev parent reply other threads:[~2023-10-24 16:17 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
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 [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=20231024161659.GB20546@lst.de \
--to=hch@lst.de \
--cc=akpm@linux-foundation.org \
--cc=axboe@kernel.dk \
--cc=djwong@kernel.org \
--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 \
--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).