[PATCH v2,01/89] fs: new accessor methods for atime and mtime

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

 



I found this patch had been mainlined, but sorry, I have comments for it.

> +static inline struct timespec64 inode_set_atime_to_ts(struct inode *inode,
> +						      struct timespec64 ts)
> +{
> +	inode->i_atime = ts;
> +	return ts;
> +}
> 
> +static inline struct timespec64 inode_set_atime(struct inode *inode,
> +						time64_t sec, long nsec)
> +{
> +	struct timespec64 ts = { .tv_sec  = sec,
> +				 .tv_nsec = nsec };
> +	return inode_set_atime_to_ts(inode, ts);
> +}

1. Function name "inode_set_atime_to_ts" may lead to misunderstanding that this function sets inode->i_atime to ts.
2. It is better to change argument ts to "const struct timespec64 *ts".
3. It is not needed to return ts.

I think the functions should be

static inline void inode_set_atime_by_ts(struct inode *inode, const struct timespec64 *ts)
{
	inode->i_atime = *ts;
}

static inline void inode_set_atime(struct inode *inode,
						time64_t sec, long nsec)
{
	struct timespec64 ts = { .tv_sec  = sec,
				 .tv_nsec = nsec };
	inode_set_atime_to_ts(inode, &ts);
}

The comments are also for inode_set_mtime_to_ts()/inode_set_mtime_to_ts().




[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