[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Mon, 11 Jan 2021 15:52:40 +0100
From: Jan Kara <jack@...e.cz>
To: Eric Biggers <ebiggers@...nel.org>
Cc: linux-fsdevel@...r.kernel.org, linux-xfs@...r.kernel.org,
linux-ext4@...r.kernel.org, linux-f2fs-devel@...ts.sourceforge.net,
Theodore Ts'o <tytso@....edu>, Christoph Hellwig <hch@....de>
Subject: Re: [PATCH v2 04/12] fat: only specify I_DIRTY_TIME when needed in
fat_update_time()
On Fri 08-01-21 23:58:55, Eric Biggers wrote:
> From: Eric Biggers <ebiggers@...gle.com>
>
> As was done for generic_update_time(), only pass I_DIRTY_TIME to
> __mark_inode_dirty() when the inode's timestamps were actually updated
> and lazytime is enabled. This avoids a weird edge case where
> I_DIRTY_TIME could be set in i_state when lazytime isn't enabled.
>
> Signed-off-by: Eric Biggers <ebiggers@...gle.com>
Looks good to me. You can add:
Reviewed-by: Jan Kara <jack@...e.cz>
Honza
> ---
> fs/fat/misc.c | 23 ++++++++++++-----------
> 1 file changed, 12 insertions(+), 11 deletions(-)
>
> diff --git a/fs/fat/misc.c b/fs/fat/misc.c
> index f1b2a1fc2a6a4..18a50a46b57f8 100644
> --- a/fs/fat/misc.c
> +++ b/fs/fat/misc.c
> @@ -329,22 +329,23 @@ EXPORT_SYMBOL_GPL(fat_truncate_time);
>
> int fat_update_time(struct inode *inode, struct timespec64 *now, int flags)
> {
> - int iflags = I_DIRTY_TIME;
> - bool dirty = false;
> + int dirty_flags = 0;
>
> if (inode->i_ino == MSDOS_ROOT_INO)
> return 0;
>
> - fat_truncate_time(inode, now, flags);
> - if (flags & S_VERSION)
> - dirty = inode_maybe_inc_iversion(inode, false);
> - if ((flags & (S_ATIME | S_CTIME | S_MTIME)) &&
> - !(inode->i_sb->s_flags & SB_LAZYTIME))
> - dirty = true;
> + if (flags & (S_ATIME | S_CTIME | S_MTIME)) {
> + fat_truncate_time(inode, now, flags);
> + if (inode->i_sb->s_flags & SB_LAZYTIME)
> + dirty_flags |= I_DIRTY_TIME;
> + else
> + dirty_flags |= I_DIRTY_SYNC;
> + }
> +
> + if ((flags & S_VERSION) && inode_maybe_inc_iversion(inode, false))
> + dirty_flags |= I_DIRTY_SYNC;
>
> - if (dirty)
> - iflags |= I_DIRTY_SYNC;
> - __mark_inode_dirty(inode, iflags);
> + __mark_inode_dirty(inode, dirty_flags);
> return 0;
> }
> EXPORT_SYMBOL_GPL(fat_update_time);
> --
> 2.30.0
>
--
Jan Kara <jack@...e.com>
SUSE Labs, CR
Powered by blists - more mailing lists