[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ghtgokkzdo7owrkfkpittqlc6xvjhr5w4eprbq5gcszqpmy7z3@7m3ecvlqfrzu>
Date: Wed, 17 Dec 2025 13:30:18 +0100
From: Jan Kara <jack@...e.cz>
To: Christoph Hellwig <hch@....de>
Cc: Christian Brauner <brauner@...nel.org>,
Al Viro <viro@...iv.linux.org.uk>, David Sterba <dsterba@...e.com>, Jan Kara <jack@...e.cz>,
Mike Marshall <hubcap@...ibond.com>, Martin Brandenburg <martin@...ibond.com>,
Carlos Maiolino <cem@...nel.org>, Stefan Roesch <shr@...com>, Jeff Layton <jlayton@...nel.org>,
linux-kernel@...r.kernel.org, linux-btrfs@...r.kernel.org, linux-fsdevel@...r.kernel.org,
gfs2@...ts.linux.dev, io-uring@...r.kernel.org, devel@...ts.orangefs.org,
linux-unionfs@...r.kernel.org, linux-mtd@...ts.infradead.org, linux-xfs@...r.kernel.org,
linux-nfs@...r.kernel.org
Subject: Re: [PATCH 07/10] fs: add a ->sync_lazytime method
On Wed 17-12-25 07:09:40, Christoph Hellwig wrote:
> Allow the file system to explicitly implement lazytime syncing instead
> of pigging back on generic inode dirtying. This allows to simplify
> the XFS implementation and prepares for non-blocking lazytime timestamp
> updates.
>
> Signed-off-by: Christoph Hellwig <hch@....de>
> Reviewed-by: Jeff Layton <jlayton@...nel.org>
...
> if (flags & I_DIRTY_INODE) {
> + bool was_dirty_time =
> + inode_state_read_once(inode) & I_DIRTY_TIME;
> +
> /*
> * Inode timestamp update will piggback on this dirtying.
> * We tell ->dirty_inode callback that timestamps need to
> * be updated by setting I_DIRTY_TIME in flags.
> */
> - if (inode_state_read_once(inode) & I_DIRTY_TIME) {
> + if (was_dirty_time) {
> spin_lock(&inode->i_lock);
> if (inode_state_read(inode) & I_DIRTY_TIME) {
> inode_state_clear(inode, I_DIRTY_TIME);
> flags |= I_DIRTY_TIME;
> + was_dirty_time = true;
This looks bogus. was_dirty_time is already true here. What I think you
wanted here is to set it to false if locked I_DIRTY_TIME check failed.
Otherwise the patch looks good.
Honza
> }
> spin_unlock(&inode->i_lock);
> }
> @@ -2591,9 +2598,12 @@ void __mark_inode_dirty(struct inode *inode, int flags)
> * for just I_DIRTY_PAGES or I_DIRTY_TIME.
> */
> trace_writeback_dirty_inode_start(inode, flags);
> - if (sb->s_op->dirty_inode)
> + if (sb->s_op->dirty_inode) {
> sb->s_op->dirty_inode(inode,
> flags & (I_DIRTY_INODE | I_DIRTY_TIME));
> + } else if (was_dirty_time && inode->i_op->sync_lazytime) {
> + inode->i_op->sync_lazytime(inode);
> + }
> trace_writeback_dirty_inode(inode, flags);
>
> /* I_DIRTY_INODE supersedes I_DIRTY_TIME. */
> diff --git a/include/linux/fs.h b/include/linux/fs.h
> index 75d5f38b08c9..255eb3b42d1d 100644
> --- a/include/linux/fs.h
> +++ b/include/linux/fs.h
> @@ -2011,6 +2011,7 @@ struct inode_operations {
> int (*fiemap)(struct inode *, struct fiemap_extent_info *, u64 start,
> u64 len);
> int (*update_time)(struct inode *, int);
> + void (*sync_lazytime)(struct inode *inode);
> int (*atomic_open)(struct inode *, struct dentry *,
> struct file *, unsigned open_flag,
> umode_t create_mode);
> --
> 2.47.3
>
--
Jan Kara <jack@...e.com>
SUSE Labs, CR
Powered by blists - more mailing lists