Message ID | 20210105005452.92521-9-ebiggers@kernel.org (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | lazytime fixes and cleanups | expand |
On Mon 04-01-21 16:54:47, Eric Biggers wrote: > From: Eric Biggers <ebiggers@google.com> > > Since I_DIRTY_TIME and I_DIRTY_INODE are mutually exclusive in i_state, > there's no need to check for I_DIRTY_TIME && !I_DIRTY_INODE. Just check > for I_DIRTY_TIME. > > Signed-off-by: Eric Biggers <ebiggers@google.com> > --- > fs/ext4/inode.c | 8 +++----- > 1 file changed, 3 insertions(+), 5 deletions(-) > > diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c > index 4cc6c7834312f..9e34541715968 100644 > --- a/fs/ext4/inode.c > +++ b/fs/ext4/inode.c > @@ -4962,14 +4962,12 @@ static void __ext4_update_other_inode_time(struct super_block *sb, > return; > > if ((inode->i_state & (I_FREEING | I_WILL_FREE | I_NEW | > - I_DIRTY_INODE)) || > - ((inode->i_state & I_DIRTY_TIME) == 0)) > + I_DIRTY_TIME)) != I_DIRTY_TIME) > return; This is OK. > spin_lock(&inode->i_lock); > - if (((inode->i_state & (I_FREEING | I_WILL_FREE | I_NEW | > - I_DIRTY_INODE)) == 0) && > - (inode->i_state & I_DIRTY_TIME)) { > + if ((inode->i_state & (I_FREEING | I_WILL_FREE | I_NEW | > + I_DIRTY_TIME)) != I_DIRTY_TIME) { But this condition is negated AFAICT. We should have == I_DIRTY_TIME here AFAICT. Honza
On Thu, Jan 07, 2021 at 02:24:12PM +0100, Jan Kara wrote: > On Mon 04-01-21 16:54:47, Eric Biggers wrote: > > From: Eric Biggers <ebiggers@google.com> > > > > Since I_DIRTY_TIME and I_DIRTY_INODE are mutually exclusive in i_state, > > there's no need to check for I_DIRTY_TIME && !I_DIRTY_INODE. Just check > > for I_DIRTY_TIME. > > > > Signed-off-by: Eric Biggers <ebiggers@google.com> > > --- > > fs/ext4/inode.c | 8 +++----- > > 1 file changed, 3 insertions(+), 5 deletions(-) > > > > diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c > > index 4cc6c7834312f..9e34541715968 100644 > > --- a/fs/ext4/inode.c > > +++ b/fs/ext4/inode.c > > @@ -4962,14 +4962,12 @@ static void __ext4_update_other_inode_time(struct super_block *sb, > > return; > > > > if ((inode->i_state & (I_FREEING | I_WILL_FREE | I_NEW | > > - I_DIRTY_INODE)) || > > - ((inode->i_state & I_DIRTY_TIME) == 0)) > > + I_DIRTY_TIME)) != I_DIRTY_TIME) > > return; > > This is OK. > > > spin_lock(&inode->i_lock); > > - if (((inode->i_state & (I_FREEING | I_WILL_FREE | I_NEW | > > - I_DIRTY_INODE)) == 0) && > > - (inode->i_state & I_DIRTY_TIME)) { > > + if ((inode->i_state & (I_FREEING | I_WILL_FREE | I_NEW | > > + I_DIRTY_TIME)) != I_DIRTY_TIME) { > > But this condition is negated AFAICT. We should have == I_DIRTY_TIME here > AFAICT. Indeed, I'll fix that. Thanks for catching this! - Eric
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index 4cc6c7834312f..9e34541715968 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c @@ -4962,14 +4962,12 @@ static void __ext4_update_other_inode_time(struct super_block *sb, return; if ((inode->i_state & (I_FREEING | I_WILL_FREE | I_NEW | - I_DIRTY_INODE)) || - ((inode->i_state & I_DIRTY_TIME) == 0)) + I_DIRTY_TIME)) != I_DIRTY_TIME) return; spin_lock(&inode->i_lock); - if (((inode->i_state & (I_FREEING | I_WILL_FREE | I_NEW | - I_DIRTY_INODE)) == 0) && - (inode->i_state & I_DIRTY_TIME)) { + if ((inode->i_state & (I_FREEING | I_WILL_FREE | I_NEW | + I_DIRTY_TIME)) != I_DIRTY_TIME) { struct ext4_inode_info *ei = EXT4_I(inode); inode->i_state &= ~I_DIRTY_TIME;