Re: [PATCH v2 43/54] fs: change inode_is_dirtytime_only to use refcount

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Aug 26, 2025 at 11:39:43AM -0400, Josef Bacik wrote:
> We don't need the I_WILL_FREE|I_FREEING check, we can use the refcount
> to see if the inode is valid.
> 
> Signed-off-by: Josef Bacik <josef@xxxxxxxxxxxxxx>
> ---
>  include/linux/fs.h | 14 +++++++-------
>  1 file changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/include/linux/fs.h b/include/linux/fs.h
> index b13d057ad0d7..531a6d0afa75 100644
> --- a/include/linux/fs.h
> +++ b/include/linux/fs.h
> @@ -2628,6 +2628,11 @@ static inline void mark_inode_dirty_sync(struct inode *inode)
>  	__mark_inode_dirty(inode, I_DIRTY_SYNC);
>  }
>  
> +static inline int icount_read(const struct inode *inode)
> +{
> +	return refcount_read(&inode->i_count);
> +}
> +
>  /*
>   * Returns true if the given inode itself only has dirty timestamps (its pages
>   * may still be dirty) and isn't currently being allocated or freed.
> @@ -2639,8 +2644,8 @@ static inline void mark_inode_dirty_sync(struct inode *inode)
>   */
>  static inline bool inode_is_dirtytime_only(struct inode *inode)
>  {
> -	return (inode->i_state & (I_DIRTY_TIME | I_NEW |
> -				  I_FREEING | I_WILL_FREE)) == I_DIRTY_TIME;
> +	return (inode->i_state & (I_DIRTY_TIME | I_NEW)) == I_DIRTY_TIME &&
> +	       icount_read(inode);
>  }
>  
>  extern void inc_nlink(struct inode *inode);
> @@ -3432,11 +3437,6 @@ static inline void __iget(struct inode *inode)
>  	refcount_inc(&inode->i_count);
>  }
>  
> -static inline int icount_read(const struct inode *inode)
> -{
> -	return refcount_read(&inode->i_count);
> -}
> -
>  extern void iget_failed(struct inode *);
>  extern void clear_inode(struct inode *);
>  extern void __destroy_inode(struct inode *);
> -- 
> 2.49.0
> 

nit: I would change the diff introducing icount_read() to already place
it in the right spot. As is this is going to mess with blame for no good
reason.




[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux