提交 3818c190 编写于 作者: D Deepa Dinamani

timestamp_truncate: Replace users of timespec64_trunc

Update the inode timestamp updates to use timestamp_truncate()
instead of timespec64_trunc().

The change was mostly generated by the following coccinelle
script.

virtual context
virtual patch

@r1 depends on patch forall@
struct inode *inode;
identifier i_xtime =~ "^i_[acm]time$";
expression e;
@@

inode->i_xtime =
- timespec64_trunc(
+ timestamp_truncate(
...,
- e);
+ inode);
Signed-off-by: NDeepa Dinamani <deepa.kernel@gmail.com>
Acked-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Acked-by: NJeff Layton <jlayton@kernel.org>
Cc: adrian.hunter@intel.com
Cc: dedekind1@gmail.com
Cc: gregkh@linuxfoundation.org
Cc: hch@lst.de
Cc: jaegeuk@kernel.org
Cc: jlbec@evilplan.org
Cc: richard@nod.at
Cc: tj@kernel.org
Cc: yuchao0@huawei.com
Cc: linux-f2fs-devel@lists.sourceforge.net
Cc: linux-ntfs-dev@lists.sourceforge.net
Cc: linux-mtd@lists.infradead.org
上级 50e17c00
......@@ -183,15 +183,18 @@ void setattr_copy(struct inode *inode, const struct iattr *attr)
inode->i_uid = attr->ia_uid;
if (ia_valid & ATTR_GID)
inode->i_gid = attr->ia_gid;
if (ia_valid & ATTR_ATIME)
inode->i_atime = timespec64_trunc(attr->ia_atime,
inode->i_sb->s_time_gran);
if (ia_valid & ATTR_MTIME)
inode->i_mtime = timespec64_trunc(attr->ia_mtime,
inode->i_sb->s_time_gran);
if (ia_valid & ATTR_CTIME)
inode->i_ctime = timespec64_trunc(attr->ia_ctime,
inode->i_sb->s_time_gran);
if (ia_valid & ATTR_ATIME) {
inode->i_atime = timestamp_truncate(attr->ia_atime,
inode);
}
if (ia_valid & ATTR_MTIME) {
inode->i_mtime = timestamp_truncate(attr->ia_mtime,
inode);
}
if (ia_valid & ATTR_CTIME) {
inode->i_ctime = timestamp_truncate(attr->ia_ctime,
inode);
}
if (ia_valid & ATTR_MODE) {
umode_t mode = attr->ia_mode;
......
......@@ -76,14 +76,14 @@ int configfs_setattr(struct dentry * dentry, struct iattr * iattr)
if (ia_valid & ATTR_GID)
sd_iattr->ia_gid = iattr->ia_gid;
if (ia_valid & ATTR_ATIME)
sd_iattr->ia_atime = timespec64_trunc(iattr->ia_atime,
inode->i_sb->s_time_gran);
sd_iattr->ia_atime = timestamp_truncate(iattr->ia_atime,
inode);
if (ia_valid & ATTR_MTIME)
sd_iattr->ia_mtime = timespec64_trunc(iattr->ia_mtime,
inode->i_sb->s_time_gran);
sd_iattr->ia_mtime = timestamp_truncate(iattr->ia_mtime,
inode);
if (ia_valid & ATTR_CTIME)
sd_iattr->ia_ctime = timespec64_trunc(iattr->ia_ctime,
inode->i_sb->s_time_gran);
sd_iattr->ia_ctime = timestamp_truncate(iattr->ia_ctime,
inode);
if (ia_valid & ATTR_MODE) {
umode_t mode = iattr->ia_mode;
......
......@@ -741,15 +741,18 @@ static void __setattr_copy(struct inode *inode, const struct iattr *attr)
inode->i_uid = attr->ia_uid;
if (ia_valid & ATTR_GID)
inode->i_gid = attr->ia_gid;
if (ia_valid & ATTR_ATIME)
inode->i_atime = timespec64_trunc(attr->ia_atime,
inode->i_sb->s_time_gran);
if (ia_valid & ATTR_MTIME)
inode->i_mtime = timespec64_trunc(attr->ia_mtime,
inode->i_sb->s_time_gran);
if (ia_valid & ATTR_CTIME)
inode->i_ctime = timespec64_trunc(attr->ia_ctime,
inode->i_sb->s_time_gran);
if (ia_valid & ATTR_ATIME) {
inode->i_atime = timestamp_truncate(attr->ia_atime,
inode);
}
if (ia_valid & ATTR_MTIME) {
inode->i_mtime = timestamp_truncate(attr->ia_mtime,
inode);
}
if (ia_valid & ATTR_CTIME) {
inode->i_ctime = timestamp_truncate(attr->ia_ctime,
inode);
}
if (ia_valid & ATTR_MODE) {
umode_t mode = attr->ia_mode;
......
......@@ -158,12 +158,11 @@ static inline void set_default_inode_attr(struct inode *inode, umode_t mode)
static inline void set_inode_attr(struct inode *inode,
struct kernfs_iattrs *attrs)
{
struct super_block *sb = inode->i_sb;
inode->i_uid = attrs->ia_uid;
inode->i_gid = attrs->ia_gid;
inode->i_atime = timespec64_trunc(attrs->ia_atime, sb->s_time_gran);
inode->i_mtime = timespec64_trunc(attrs->ia_mtime, sb->s_time_gran);
inode->i_ctime = timespec64_trunc(attrs->ia_ctime, sb->s_time_gran);
inode->i_atime = timestamp_truncate(attrs->ia_atime, inode);
inode->i_mtime = timestamp_truncate(attrs->ia_mtime, inode);
inode->i_ctime = timestamp_truncate(attrs->ia_ctime, inode);
}
static void kernfs_refresh_inode(struct kernfs_node *kn, struct inode *inode)
......
......@@ -2899,15 +2899,18 @@ int ntfs_setattr(struct dentry *dentry, struct iattr *attr)
ia_valid |= ATTR_MTIME | ATTR_CTIME;
}
}
if (ia_valid & ATTR_ATIME)
vi->i_atime = timespec64_trunc(attr->ia_atime,
vi->i_sb->s_time_gran);
if (ia_valid & ATTR_MTIME)
vi->i_mtime = timespec64_trunc(attr->ia_mtime,
vi->i_sb->s_time_gran);
if (ia_valid & ATTR_CTIME)
vi->i_ctime = timespec64_trunc(attr->ia_ctime,
vi->i_sb->s_time_gran);
if (ia_valid & ATTR_ATIME) {
vi->i_atime = timestamp_truncate(attr->ia_atime,
vi);
}
if (ia_valid & ATTR_MTIME) {
vi->i_mtime = timestamp_truncate(attr->ia_mtime,
vi);
}
if (ia_valid & ATTR_CTIME) {
vi->i_ctime = timestamp_truncate(attr->ia_ctime,
vi);
}
mark_inode_dirty(vi);
out:
return err;
......
......@@ -1078,15 +1078,18 @@ static void do_attr_changes(struct inode *inode, const struct iattr *attr)
inode->i_uid = attr->ia_uid;
if (attr->ia_valid & ATTR_GID)
inode->i_gid = attr->ia_gid;
if (attr->ia_valid & ATTR_ATIME)
inode->i_atime = timespec64_trunc(attr->ia_atime,
inode->i_sb->s_time_gran);
if (attr->ia_valid & ATTR_MTIME)
inode->i_mtime = timespec64_trunc(attr->ia_mtime,
inode->i_sb->s_time_gran);
if (attr->ia_valid & ATTR_CTIME)
inode->i_ctime = timespec64_trunc(attr->ia_ctime,
inode->i_sb->s_time_gran);
if (attr->ia_valid & ATTR_ATIME) {
inode->i_atime = timestamp_truncate(attr->ia_atime,
inode);
}
if (attr->ia_valid & ATTR_MTIME) {
inode->i_mtime = timestamp_truncate(attr->ia_mtime,
inode);
}
if (attr->ia_valid & ATTR_CTIME) {
inode->i_ctime = timestamp_truncate(attr->ia_ctime,
inode);
}
if (attr->ia_valid & ATTR_MODE) {
umode_t mode = attr->ia_mode;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册