Linux-EROFS Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 39/92] erofs: convert to ctime accessor functions
       [not found] ` <20230705190309.579783-1-jlayton@kernel.org>
@ 2023-07-05 19:01   ` Jeff Layton
  2023-07-06 11:00     ` Jan Kara
  0 siblings, 1 reply; 4+ messages in thread
From: Jeff Layton @ 2023-07-05 19:01 UTC (permalink / raw)
  To: Christian Brauner, Gao Xiang, Chao Yu, Yue Hu, Jeffle Xu
  Cc: linux-fsdevel, linux-erofs, Jan Kara, Al Viro, linux-kernel

In later patches, we're going to change how the inode's ctime field is
used. Switch to using accessor functions instead of raw accesses of
inode->i_ctime.

Acked-by: Gao Xiang <xiang@kernel.org>
Signed-off-by: Jeff Layton <jlayton@kernel.org>
---
 fs/erofs/inode.c | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/fs/erofs/inode.c b/fs/erofs/inode.c
index d70b12b81507..806374d866d1 100644
--- a/fs/erofs/inode.c
+++ b/fs/erofs/inode.c
@@ -105,8 +105,8 @@ static void *erofs_read_inode(struct erofs_buf *buf,
 		set_nlink(inode, le32_to_cpu(die->i_nlink));
 
 		/* extended inode has its own timestamp */
-		inode->i_ctime.tv_sec = le64_to_cpu(die->i_mtime);
-		inode->i_ctime.tv_nsec = le32_to_cpu(die->i_mtime_nsec);
+		inode_set_ctime(inode, le64_to_cpu(die->i_mtime),
+				le32_to_cpu(die->i_mtime_nsec));
 
 		inode->i_size = le64_to_cpu(die->i_size);
 
@@ -148,8 +148,7 @@ static void *erofs_read_inode(struct erofs_buf *buf,
 		set_nlink(inode, le16_to_cpu(dic->i_nlink));
 
 		/* use build time for compact inodes */
-		inode->i_ctime.tv_sec = sbi->build_time;
-		inode->i_ctime.tv_nsec = sbi->build_time_nsec;
+		inode_set_ctime(inode, sbi->build_time, sbi->build_time_nsec);
 
 		inode->i_size = le32_to_cpu(dic->i_size);
 		if (erofs_inode_is_data_compressed(vi->datalayout))
@@ -176,10 +175,10 @@ static void *erofs_read_inode(struct erofs_buf *buf,
 		vi->chunkbits = sb->s_blocksize_bits +
 			(vi->chunkformat & EROFS_CHUNK_FORMAT_BLKBITS_MASK);
 	}
-	inode->i_mtime.tv_sec = inode->i_ctime.tv_sec;
-	inode->i_atime.tv_sec = inode->i_ctime.tv_sec;
-	inode->i_mtime.tv_nsec = inode->i_ctime.tv_nsec;
-	inode->i_atime.tv_nsec = inode->i_ctime.tv_nsec;
+	inode->i_mtime.tv_sec = inode_get_ctime(inode).tv_sec;
+	inode->i_atime.tv_sec = inode_get_ctime(inode).tv_sec;
+	inode->i_mtime.tv_nsec = inode_get_ctime(inode).tv_nsec;
+	inode->i_atime.tv_nsec = inode_get_ctime(inode).tv_nsec;
 
 	inode->i_flags &= ~S_DAX;
 	if (test_opt(&sbi->opt, DAX_ALWAYS) && S_ISREG(inode->i_mode) &&
-- 
2.41.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v2 39/92] erofs: convert to ctime accessor functions
  2023-07-05 19:01   ` [PATCH v2 39/92] erofs: convert to ctime accessor functions Jeff Layton
@ 2023-07-06 11:00     ` Jan Kara
  2023-07-06 11:53       ` Jeff Layton
  2023-07-06 15:12       ` Gao Xiang
  0 siblings, 2 replies; 4+ messages in thread
From: Jan Kara @ 2023-07-06 11:00 UTC (permalink / raw)
  To: Jeff Layton
  Cc: Christian Brauner, Jan Kara, linux-kernel, linux-fsdevel, Yue Hu,
	Al Viro, linux-erofs

On Wed 05-07-23 15:01:04, Jeff Layton wrote:
> In later patches, we're going to change how the inode's ctime field is
> used. Switch to using accessor functions instead of raw accesses of
> inode->i_ctime.
> 
> Acked-by: Gao Xiang <xiang@kernel.org>
> Signed-off-by: Jeff Layton <jlayton@kernel.org>

Just one nit below:

> @@ -176,10 +175,10 @@ static void *erofs_read_inode(struct erofs_buf *buf,
>  		vi->chunkbits = sb->s_blocksize_bits +
>  			(vi->chunkformat & EROFS_CHUNK_FORMAT_BLKBITS_MASK);
>  	}
> -	inode->i_mtime.tv_sec = inode->i_ctime.tv_sec;
> -	inode->i_atime.tv_sec = inode->i_ctime.tv_sec;
> -	inode->i_mtime.tv_nsec = inode->i_ctime.tv_nsec;
> -	inode->i_atime.tv_nsec = inode->i_ctime.tv_nsec;
> +	inode->i_mtime.tv_sec = inode_get_ctime(inode).tv_sec;
> +	inode->i_atime.tv_sec = inode_get_ctime(inode).tv_sec;
> +	inode->i_mtime.tv_nsec = inode_get_ctime(inode).tv_nsec;
> +	inode->i_atime.tv_nsec = inode_get_ctime(inode).tv_nsec;

Isn't this just longer way to write:

	inode->i_atime = inode->i_mtime = inode_get_ctime(inode);

?

								Honza
-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2 39/92] erofs: convert to ctime accessor functions
  2023-07-06 11:00     ` Jan Kara
@ 2023-07-06 11:53       ` Jeff Layton
  2023-07-06 15:12       ` Gao Xiang
  1 sibling, 0 replies; 4+ messages in thread
From: Jeff Layton @ 2023-07-06 11:53 UTC (permalink / raw)
  To: Jan Kara
  Cc: Christian Brauner, linux-kernel, linux-fsdevel, Yue Hu, Al Viro,
	linux-erofs

On Thu, 2023-07-06 at 13:00 +0200, Jan Kara wrote:
> On Wed 05-07-23 15:01:04, Jeff Layton wrote:
> > In later patches, we're going to change how the inode's ctime field is
> > used. Switch to using accessor functions instead of raw accesses of
> > inode->i_ctime.
> > 
> > Acked-by: Gao Xiang <xiang@kernel.org>
> > Signed-off-by: Jeff Layton <jlayton@kernel.org>
> 
> Just one nit below:
> 
> > @@ -176,10 +175,10 @@ static void *erofs_read_inode(struct erofs_buf *buf,
> >  		vi->chunkbits = sb->s_blocksize_bits +
> >  			(vi->chunkformat & EROFS_CHUNK_FORMAT_BLKBITS_MASK);
> >  	}
> > -	inode->i_mtime.tv_sec = inode->i_ctime.tv_sec;
> > -	inode->i_atime.tv_sec = inode->i_ctime.tv_sec;
> > -	inode->i_mtime.tv_nsec = inode->i_ctime.tv_nsec;
> > -	inode->i_atime.tv_nsec = inode->i_ctime.tv_nsec;
> > +	inode->i_mtime.tv_sec = inode_get_ctime(inode).tv_sec;
> > +	inode->i_atime.tv_sec = inode_get_ctime(inode).tv_sec;
> > +	inode->i_mtime.tv_nsec = inode_get_ctime(inode).tv_nsec;
> > +	inode->i_atime.tv_nsec = inode_get_ctime(inode).tv_nsec;
> 
> Isn't this just longer way to write:
> 
> 	inode->i_atime = inode->i_mtime = inode_get_ctime(inode);
> 
> ?
> 
> 								Honza

Yes. Chalk that one up to coccinelle. Fixed in my tree.
-- 
Jeff Layton <jlayton@kernel.org>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2 39/92] erofs: convert to ctime accessor functions
  2023-07-06 11:00     ` Jan Kara
  2023-07-06 11:53       ` Jeff Layton
@ 2023-07-06 15:12       ` Gao Xiang
  1 sibling, 0 replies; 4+ messages in thread
From: Gao Xiang @ 2023-07-06 15:12 UTC (permalink / raw)
  To: Jan Kara, Jeff Layton
  Cc: Christian Brauner, linux-kernel, linux-fsdevel, Yue Hu, Al Viro,
	linux-erofs

Hi Jan,

On 2023/7/6 19:00, Jan Kara wrote:
> On Wed 05-07-23 15:01:04, Jeff Layton wrote:
>> In later patches, we're going to change how the inode's ctime field is
>> used. Switch to using accessor functions instead of raw accesses of
>> inode->i_ctime.
>>
>> Acked-by: Gao Xiang <xiang@kernel.org>
>> Signed-off-by: Jeff Layton <jlayton@kernel.org>
> 
> Just one nit below:
> 
>> @@ -176,10 +175,10 @@ static void *erofs_read_inode(struct erofs_buf *buf,
>>   		vi->chunkbits = sb->s_blocksize_bits +
>>   			(vi->chunkformat & EROFS_CHUNK_FORMAT_BLKBITS_MASK);
>>   	}
>> -	inode->i_mtime.tv_sec = inode->i_ctime.tv_sec;
>> -	inode->i_atime.tv_sec = inode->i_ctime.tv_sec;
>> -	inode->i_mtime.tv_nsec = inode->i_ctime.tv_nsec;
>> -	inode->i_atime.tv_nsec = inode->i_ctime.tv_nsec;
>> +	inode->i_mtime.tv_sec = inode_get_ctime(inode).tv_sec;
>> +	inode->i_atime.tv_sec = inode_get_ctime(inode).tv_sec;
>> +	inode->i_mtime.tv_nsec = inode_get_ctime(inode).tv_nsec;
>> +	inode->i_atime.tv_nsec = inode_get_ctime(inode).tv_nsec;
> 
> Isn't this just longer way to write:
> 
> 	inode->i_atime = inode->i_mtime = inode_get_ctime(inode);

I'm fine with this.  I think we could use this (although I'm not sure
if checkpatch will complain but personally I'm fine.)

Thanks,
Gao Xiang

> 
> ?
> 
> 								Honza

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-07-06 15:12 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20230705185755.579053-1-jlayton@kernel.org>
     [not found] ` <20230705190309.579783-1-jlayton@kernel.org>
2023-07-05 19:01   ` [PATCH v2 39/92] erofs: convert to ctime accessor functions Jeff Layton
2023-07-06 11:00     ` Jan Kara
2023-07-06 11:53       ` Jeff Layton
2023-07-06 15:12       ` Gao Xiang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox