Patchworkβ [05/13] sysfs: Simplify iattr time assignments

login
register
about
Submitter Eric W. Biederman
Date 2009-11-03 11:57:01
Message ID <1257249429-12384-5-git-send-email-ebiederm@xmission.com>
Download mbox | patch
Permalink /patch/57283/
State New
Headers show

Comments

Eric W. Biederman - 2009-11-03 11:57:01
From: Eric W. Biederman <ebiederm@xmission.com>

The granularity of sysfs time when we keep it is 1 ns.  Which
when passed to timestamp_trunc results in a nop.  So remove
the unnecessary function call making sysfs_setattr slightly
easier to read.

Acked-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Eric W. Biederman <ebiederm@aristanetworks.com>
---
 fs/sysfs/inode.c |    9 +++------
 1 files changed, 3 insertions(+), 6 deletions(-)
Serge E. Hallyn - 2009-11-04 02:57:18
Quoting Eric W. Biederman (ebiederm@xmission.com):
> From: Eric W. Biederman <ebiederm@xmission.com>
> 
> The granularity of sysfs time when we keep it is 1 ns.  Which
> when passed to timestamp_trunc results in a nop.  So remove
> the unnecessary function call making sysfs_setattr slightly
> easier to read.
> 
> Acked-by: Tejun Heo <tj@kernel.org>
> Signed-off-by: Eric W. Biederman <ebiederm@aristanetworks.com>

Acked-by: Serge Hallyn <serue@us.ibm.com>

> ---
>  fs/sysfs/inode.c |    9 +++------
>  1 files changed, 3 insertions(+), 6 deletions(-)
> 
> diff --git a/fs/sysfs/inode.c b/fs/sysfs/inode.c
> index 8a08250..fed7a74 100644
> --- a/fs/sysfs/inode.c
> +++ b/fs/sysfs/inode.c
> @@ -103,14 +103,11 @@ int sysfs_setattr(struct dentry * dentry, struct iattr * iattr)
>  		if (ia_valid & ATTR_GID)
>  			iattrs->ia_gid = iattr->ia_gid;
>  		if (ia_valid & ATTR_ATIME)
> -			iattrs->ia_atime = timespec_trunc(iattr->ia_atime,
> -					inode->i_sb->s_time_gran);
> +			iattrs->ia_atime = iattr->ia_atime;
>  		if (ia_valid & ATTR_MTIME)
> -			iattrs->ia_mtime = timespec_trunc(iattr->ia_mtime,
> -					inode->i_sb->s_time_gran);
> +			iattrs->ia_mtime = iattr->ia_mtime;
>  		if (ia_valid & ATTR_CTIME)
> -			iattrs->ia_ctime = timespec_trunc(iattr->ia_ctime,
> -					inode->i_sb->s_time_gran);
> +			iattrs->ia_ctime = iattr->ia_ctime;
>  		if (ia_valid & ATTR_MODE) {
>  			umode_t mode = iattr->ia_mode;
> 
> -- 
> 1.6.5.2.143.g8cc62
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Patch

diff --git a/fs/sysfs/inode.c b/fs/sysfs/inode.c
index 8a08250..fed7a74 100644
--- a/fs/sysfs/inode.c
+++ b/fs/sysfs/inode.c
@@ -103,14 +103,11 @@  int sysfs_setattr(struct dentry * dentry, struct iattr * iattr)
 		if (ia_valid & ATTR_GID)
 			iattrs->ia_gid = iattr->ia_gid;
 		if (ia_valid & ATTR_ATIME)
-			iattrs->ia_atime = timespec_trunc(iattr->ia_atime,
-					inode->i_sb->s_time_gran);
+			iattrs->ia_atime = iattr->ia_atime;
 		if (ia_valid & ATTR_MTIME)
-			iattrs->ia_mtime = timespec_trunc(iattr->ia_mtime,
-					inode->i_sb->s_time_gran);
+			iattrs->ia_mtime = iattr->ia_mtime;
 		if (ia_valid & ATTR_CTIME)
-			iattrs->ia_ctime = timespec_trunc(iattr->ia_ctime,
-					inode->i_sb->s_time_gran);
+			iattrs->ia_ctime = iattr->ia_ctime;
 		if (ia_valid & ATTR_MODE) {
 			umode_t mode = iattr->ia_mode;