linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: James Simmons <jsimmons@infradead.org>
To: Deepa Dinamani <deepa.kernel@gmail.com>
Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
	Arnd Bergmann <arnd@arndb.de>,
	y2038@lists.linaro.org,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Al Viro <viro@zeniv.linux.org.uk>,
	Thomas Gleixner <tglx@linutronix.de>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	lustre-devel@lists.lustre.org
Subject: Re: [lustre-devel] [PATCH 11/21] drivers: staging: lustre: Replace CURRENT_TIME with current_fs_time()
Date: Sat, 11 Jun 2016 01:36:06 +0100 (BST)	[thread overview]
Message-ID: <alpine.LFD.2.20.1606110135340.17937@casper.infradead.org> (raw)
In-Reply-To: <1465448705-25055-12-git-send-email-deepa.kernel@gmail.com>


> CURRENT_TIME macro is not appropriate for filesystems as it
> doesn't use the right granularity for filesystem timestamps.
> Use current_fs_time() instead.
> 
> This is also in preparation for the patch that transitions
> vfs timestamps to use 64 bit time and hence make them
> y2038 safe. As part of the effort current_fs_time() will be
> extended to do range checks. Hence, it is necessary for all
> file system timestamps to use current_fs_time().
> 
> Also change format string for prints so that these are valid
> when vfs is transitioned to use 64 bit timestamps.

Acked-by: James Simmons <jsimmons@infradead.org>
 
> Signed-off-by: Deepa Dinamani <deepa.kernel@gmail.com>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Cc: lustre-devel@lists.lustre.org
> ---
>  drivers/staging/lustre/lustre/llite/llite_lib.c         | 17 +++++++++--------
>  drivers/staging/lustre/lustre/llite/namei.c             |  4 ++--
>  drivers/staging/lustre/lustre/mdc/mdc_reint.c           |  6 +++---
>  .../staging/lustre/lustre/obdclass/linux/linux-obdo.c   |  6 +++---
>  drivers/staging/lustre/lustre/obdclass/obdo.c           |  6 +++---
>  drivers/staging/lustre/lustre/osc/osc_io.c              |  2 +-
>  6 files changed, 21 insertions(+), 20 deletions(-)
> 
> diff --git a/drivers/staging/lustre/lustre/llite/llite_lib.c b/drivers/staging/lustre/lustre/llite/llite_lib.c
> index 96c7e9f..919748f 100644
> --- a/drivers/staging/lustre/lustre/llite/llite_lib.c
> +++ b/drivers/staging/lustre/lustre/llite/llite_lib.c
> @@ -1219,6 +1219,7 @@ static int ll_setattr_done_writing(struct inode *inode,
>  int ll_setattr_raw(struct dentry *dentry, struct iattr *attr, bool hsm_import)
>  {
>  	struct inode *inode = d_inode(dentry);
> +	struct super_block *sb = inode->i_sb;
>  	struct ll_inode_info *lli = ll_i2info(inode);
>  	struct md_op_data *op_data = NULL;
>  	struct md_open_data *mod = NULL;
> @@ -1258,23 +1259,23 @@ int ll_setattr_raw(struct dentry *dentry, struct iattr *attr, bool hsm_import)
>  
>  	/* We mark all of the fields "set" so MDS/OST does not re-set them */
>  	if (attr->ia_valid & ATTR_CTIME) {
> -		attr->ia_ctime = CURRENT_TIME;
> +		attr->ia_ctime = current_fs_time(sb);
>  		attr->ia_valid |= ATTR_CTIME_SET;
>  	}
>  	if (!(attr->ia_valid & ATTR_ATIME_SET) &&
>  	    (attr->ia_valid & ATTR_ATIME)) {
> -		attr->ia_atime = CURRENT_TIME;
> +		attr->ia_atime = current_fs_time(sb);
>  		attr->ia_valid |= ATTR_ATIME_SET;
>  	}
>  	if (!(attr->ia_valid & ATTR_MTIME_SET) &&
>  	    (attr->ia_valid & ATTR_MTIME)) {
> -		attr->ia_mtime = CURRENT_TIME;
> +		attr->ia_mtime = current_fs_time(sb);
>  		attr->ia_valid |= ATTR_MTIME_SET;
>  	}
>  
>  	if (attr->ia_valid & (ATTR_MTIME | ATTR_CTIME))
> -		CDEBUG(D_INODE, "setting mtime %lu, ctime %lu, now = %llu\n",
> -		       LTIME_S(attr->ia_mtime), LTIME_S(attr->ia_ctime),
> +		CDEBUG(D_INODE, "setting mtime %llu, ctime %llu, now = %llu\n",
> +		       (long long)LTIME_S(attr->ia_mtime), (long long)LTIME_S(attr->ia_ctime),
>  		       (s64)ktime_get_real_seconds());
>  
>  	/* We always do an MDS RPC, even if we're only changing the size;
> @@ -1564,9 +1565,9 @@ void ll_update_inode(struct inode *inode, struct lustre_md *md)
>  	}
>  	if (body->valid & OBD_MD_FLMTIME) {
>  		if (body->mtime > LTIME_S(inode->i_mtime)) {
> -			CDEBUG(D_INODE, "setting ino %lu mtime from %lu to %llu\n",
> -			       inode->i_ino, LTIME_S(inode->i_mtime),
> -			       body->mtime);
> +			CDEBUG(D_INODE, "setting ino %lu mtime from %llu to %llu\n",
> +			       inode->i_ino, (unsigned long long)LTIME_S(inode->i_mtime),
> +			       (unsigned long long)body->mtime);
>  			LTIME_S(inode->i_mtime) = body->mtime;
>  		}
>  		lli->lli_mtime = body->mtime;
> diff --git a/drivers/staging/lustre/lustre/llite/namei.c b/drivers/staging/lustre/lustre/llite/namei.c
> index 5eba0eb..48ed1ce 100644
> --- a/drivers/staging/lustre/lustre/llite/namei.c
> +++ b/drivers/staging/lustre/lustre/llite/namei.c
> @@ -731,8 +731,8 @@ static void ll_update_times(struct ptlrpc_request *request,
>  	LASSERT(body);
>  	if (body->valid & OBD_MD_FLMTIME &&
>  	    body->mtime > LTIME_S(inode->i_mtime)) {
> -		CDEBUG(D_INODE, "setting fid "DFID" mtime from %lu to %llu\n",
> -		       PFID(ll_inode2fid(inode)), LTIME_S(inode->i_mtime),
> +		CDEBUG(D_INODE, "setting fid "DFID" mtime from %llu to %llu\n",
> +		       PFID(ll_inode2fid(inode)), (unsigned long long)LTIME_S(inode->i_mtime),
>  		       body->mtime);
>  		LTIME_S(inode->i_mtime) = body->mtime;
>  	}
> diff --git a/drivers/staging/lustre/lustre/mdc/mdc_reint.c b/drivers/staging/lustre/lustre/mdc/mdc_reint.c
> index 4ef3db1..9980f3a 100644
> --- a/drivers/staging/lustre/lustre/mdc/mdc_reint.c
> +++ b/drivers/staging/lustre/lustre/mdc/mdc_reint.c
> @@ -143,9 +143,9 @@ int mdc_setattr(struct obd_export *exp, struct md_op_data *op_data,
>  	rpc_lock = obd->u.cli.cl_rpc_lock;
>  
>  	if (op_data->op_attr.ia_valid & (ATTR_MTIME | ATTR_CTIME))
> -		CDEBUG(D_INODE, "setting mtime %ld, ctime %ld\n",
> -		       LTIME_S(op_data->op_attr.ia_mtime),
> -		       LTIME_S(op_data->op_attr.ia_ctime));
> +		CDEBUG(D_INODE, "setting mtime %lld, ctime %lld\n",
> +		       (long long)LTIME_S(op_data->op_attr.ia_mtime),
> +		       (long long)LTIME_S(op_data->op_attr.ia_ctime));
>  	mdc_setattr_pack(req, op_data, ea, ealen, ea2, ea2len);
>  
>  	ptlrpc_request_set_replen(req);
> diff --git a/drivers/staging/lustre/lustre/obdclass/linux/linux-obdo.c b/drivers/staging/lustre/lustre/obdclass/linux/linux-obdo.c
> index b41b65e..ccd2b7b 100644
> --- a/drivers/staging/lustre/lustre/obdclass/linux/linux-obdo.c
> +++ b/drivers/staging/lustre/lustre/obdclass/linux/linux-obdo.c
> @@ -54,9 +54,9 @@ void obdo_refresh_inode(struct inode *dst, struct obdo *src, u32 valid)
>  
>  	if (valid & (OBD_MD_FLCTIME | OBD_MD_FLMTIME))
>  		CDEBUG(D_INODE,
> -		       "valid %#llx, cur time %lu/%lu, new %llu/%llu\n",
> -		       src->o_valid, LTIME_S(dst->i_mtime),
> -		       LTIME_S(dst->i_ctime), src->o_mtime, src->o_ctime);
> +		       "valid %#llx, cur time %llu/%llu, new %llu/%llu\n",
> +		       src->o_valid, (unsigned long long)LTIME_S(dst->i_mtime),
> +		       (unsigned long long)LTIME_S(dst->i_ctime), src->o_mtime, src->o_ctime);
>  
>  	if (valid & OBD_MD_FLATIME && src->o_atime > LTIME_S(dst->i_atime))
>  		LTIME_S(dst->i_atime) = src->o_atime;
> diff --git a/drivers/staging/lustre/lustre/obdclass/obdo.c b/drivers/staging/lustre/lustre/obdclass/obdo.c
> index 748e33f..973fa4c 100644
> --- a/drivers/staging/lustre/lustre/obdclass/obdo.c
> +++ b/drivers/staging/lustre/lustre/obdclass/obdo.c
> @@ -62,9 +62,9 @@ void obdo_from_inode(struct obdo *dst, struct inode *src, u32 valid)
>  	u32 newvalid = 0;
>  
>  	if (valid & (OBD_MD_FLCTIME | OBD_MD_FLMTIME))
> -		CDEBUG(D_INODE, "valid %x, new time %lu/%lu\n",
> -		       valid, LTIME_S(src->i_mtime),
> -		       LTIME_S(src->i_ctime));
> +		CDEBUG(D_INODE, "valid %x, new time %llu/%llu\n",
> +		       valid, (unsigned long long)LTIME_S(src->i_mtime),
> +		       (unsigned long long)LTIME_S(src->i_ctime));
>  
>  	if (valid & OBD_MD_FLATIME) {
>  		dst->o_atime = LTIME_S(src->i_atime);
> diff --git a/drivers/staging/lustre/lustre/osc/osc_io.c b/drivers/staging/lustre/lustre/osc/osc_io.c
> index d534b0e..99f69bb 100644
> --- a/drivers/staging/lustre/lustre/osc/osc_io.c
> +++ b/drivers/staging/lustre/lustre/osc/osc_io.c
> @@ -221,7 +221,7 @@ static void osc_page_touch_at(const struct lu_env *env,
>  	       kms > loi->loi_kms ? "" : "not ", loi->loi_kms, kms,
>  	       loi->loi_lvb.lvb_size);
>  
> -	attr->cat_mtime = attr->cat_ctime = LTIME_S(CURRENT_TIME);
> +	attr->cat_mtime = attr->cat_ctime = ktime_get_real_seconds();
>  	valid = CAT_MTIME | CAT_CTIME;
>  	if (kms > loi->loi_kms) {
>  		attr->cat_kms = kms;
> -- 
> 1.9.1
> 
> _______________________________________________
> lustre-devel mailing list
> lustre-devel@lists.lustre.org
> http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org
> 

  reply	other threads:[~2016-06-11  0:36 UTC|newest]

Thread overview: 54+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-09  5:04 [PATCH 00/21] Delete CURRENT_TIME and CURRENT_TIME_SEC macros Deepa Dinamani
2016-06-09  5:04 ` [PATCH 01/21] fs: Replace CURRENT_TIME_SEC with current_fs_time() Deepa Dinamani
2016-06-09  7:35   ` Jan Kara
2016-06-09 19:15     ` Linus Torvalds
2016-06-09 20:41       ` Deepa Dinamani
2016-06-09 12:31   ` Bob Copeland
2016-06-10 22:21   ` Arnd Bergmann
2016-06-11  5:03     ` Deepa Dinamani
2016-06-11 20:55       ` Arnd Bergmann
2016-06-09  5:04 ` [PATCH 02/21] fs: ext4: Use current_fs_time() for inode timestamps Deepa Dinamani
2016-06-09 18:45   ` Linus Torvalds
2016-06-09 18:55     ` Linus Torvalds
2016-06-10 22:19     ` [Y2038] " Arnd Bergmann
2016-06-14 17:55       ` Deepa Dinamani
2016-06-14 20:59         ` Arnd Bergmann
2016-06-09  5:04 ` [PATCH 03/21] fs: ubifs: " Deepa Dinamani
2016-06-09  5:04 ` [PATCH 05/21] fs: jfs: Replace CURRENT_TIME_SEC by current_fs_time() Deepa Dinamani
2016-06-09  5:04 ` [PATCH 06/21] fs: udf: Replace CURRENT_TIME with current_fs_time() Deepa Dinamani
2016-06-09  7:41   ` Jan Kara
2016-06-10  0:53     ` Deepa Dinamani
2016-06-09  5:04 ` [PATCH 07/21] fs: cifs: Replace CURRENT_TIME by current_fs_time() Deepa Dinamani
2016-06-09  5:04 ` [PATCH 08/21] fs: cifs: Replace CURRENT_TIME with ktime_get_real_ts() Deepa Dinamani
2016-06-09  5:04 ` [PATCH 09/21] fs: cifs: Replace CURRENT_TIME by get_seconds Deepa Dinamani
2016-06-09  5:04 ` [PATCH 10/21] fs: f2fs: Use ktime_get_real_seconds for sit_info times Deepa Dinamani
2016-06-09  5:04 ` [PATCH 11/21] drivers: staging: lustre: Replace CURRENT_TIME with current_fs_time() Deepa Dinamani
2016-06-11  0:36   ` James Simmons [this message]
2016-06-11  1:53     ` [lustre-devel] " Andreas Dilger
2016-06-09  5:04 ` [PATCH 12/21] block: rbd: Replace non inode " Deepa Dinamani
2016-06-09  5:04 ` [PATCH 13/21] fs: ocfs2: Use time64_t to represent orphan scan times Deepa Dinamani
2016-06-09  5:04 ` [PATCH 14/21] fs: ocfs2: Replace CURRENT_TIME with ktime_get_real_seconds() Deepa Dinamani
2016-06-09  5:04 ` [PATCH 15/21] time: Add time64_to_tm() Deepa Dinamani
2016-06-14 21:18   ` John Stultz
2016-06-15 17:44     ` Deepa Dinamani
2016-06-17 20:52       ` John Stultz
2016-06-17 20:59         ` Deepa Dinamani
2016-06-17 21:06           ` Arnd Bergmann
2016-06-09  5:05 ` [PATCH 16/21] fnic: Use time64_t to represent trace timestamps Deepa Dinamani
2016-06-09  5:05 ` [PATCH 17/21] audit: Use timespec64 to represent audit timestamps Deepa Dinamani
2016-06-09 14:31   ` Steve Grubb
2016-06-09 23:59     ` Richard Guy Briggs
2016-06-10  0:19       ` Steve Grubb
2016-06-10  1:44         ` Richard Guy Briggs
2016-06-15 21:23       ` Paul Moore
2016-06-10  0:45     ` Deepa Dinamani
2016-06-09  5:05 ` [PATCH 18/21] fs: nfs: Make nfs boot time y2038 safe Deepa Dinamani
2016-06-09 19:23   ` Trond Myklebust
2016-06-09 21:10     ` Deepa Dinamani
2016-06-10 13:12       ` Anna Schumaker
2016-06-10 14:02         ` Trond Myklebust
2016-06-09  5:05 ` [PATCH 19/21] libceph: Remove CURRENT_TIME references Deepa Dinamani
2016-06-09  5:05 ` [PATCH 20/21] libceph: Replace CURRENT_TIME with ktime_get_real_ts Deepa Dinamani
2016-06-09  5:05 ` [PATCH 21/21] time: Delete CURRENT_TIME_SEC and CURRENT_TIME macro Deepa Dinamani
2016-06-14 21:20   ` John Stultz
2016-06-09  7:51 ` [PATCH 00/21] Delete CURRENT_TIME and CURRENT_TIME_SEC macros Felipe Balbi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.LFD.2.20.1606110135340.17937@casper.infradead.org \
    --to=jsimmons@infradead.org \
    --cc=arnd@arndb.de \
    --cc=deepa.kernel@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lustre-devel@lists.lustre.org \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.org \
    --cc=viro@zeniv.linux.org.uk \
    --cc=y2038@lists.linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).