[PATCH 07/10] fs: add a ->sync_lazytime method
Jan Kara
jack at suse.cz
Wed Dec 17 04:30:18 PST 2025
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 at lst.de>
> Reviewed-by: Jeff Layton <jlayton at kernel.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 at suse.com>
SUSE Labs, CR
More information about the linux-mtd
mailing list