From patchwork Mon Jun 20 00:27:13 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Deepa Dinamani X-Patchwork-Id: 9186417 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id BFAFD6075E for ; Mon, 20 Jun 2016 01:39:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AB84720748 for ; Mon, 20 Jun 2016 01:39:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9EC51223A1; Mon, 20 Jun 2016 01:39:39 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5389F20748 for ; Mon, 20 Jun 2016 01:39:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752281AbcFTBj3 (ORCPT ); Sun, 19 Jun 2016 21:39:29 -0400 Received: from mail-pa0-f68.google.com ([209.85.220.68]:34689 "EHLO mail-pa0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752156AbcFTBjY (ORCPT ); Sun, 19 Jun 2016 21:39:24 -0400 Received: by mail-pa0-f68.google.com with SMTP id us13so9763570pab.1; Sun, 19 Jun 2016 18:38:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=SNkSpPkntdKmUXW3JHD2DBFZsiyWOgYSGpbChkygu2Q=; b=uejF5qhVsKi85VY+XT/B70nTdQVyYtxJN8WJDkfEYfrDG5NYCLlBuxSfwMwsA1lBuW p0niABg4YazAn8HiE8EXy4htit7BlSCChfUZE9PcsHO4TGE3gXZcu2uu3V0PcxiNvi3O B2DsOKezIRRLlaYIm4qDMUWbzfXN0jlj4rpUVFfATcWm4wB8eJgl9FKc8y6oq9qmxZBB xtfs0VEpIWdqodNJGO5D83lQt0rRpqZSAkMW5ehwThfBNLGqgzYFRtx8YqlYxdK3VpGt dSU0YLSktU5vxWmx8lPXj9IYJoc3gHWPvd8sclxOiEaZAyw/q5reVL7FSBjCs5oDpuw8 2o0A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=SNkSpPkntdKmUXW3JHD2DBFZsiyWOgYSGpbChkygu2Q=; b=h9TsaXoqeSrG4DUgGI5E8j+i5BBpMH5xwgedcy0/35ww4r7ww9vtsQL0l6RNDNq6l7 y/KzlkTEHp3xJl2nG29jv/k4ZLfaVwqu8LBqRJjI6+0HS7ZWrGCYXJOBik7V2amVDTDA ZHWLQ6rAAyTquxIQ8l5G5cFK2L7SZNgFXygHlUqp6E64uxvF1AOtNefrYZrE35MgTxNn ulGO2pdTQ5TOev9yJtU6MRSVbv60oYnW41c7uOImuIj+zJbppvTCTJ8oyXuvOnVha3sU sZQsYgVUViQPgB3WCDoCOYTJQNGV4OEvv3/ccC8wcGQ9Dz90NzN+ALGAv+h33aSVQE+M gZSw== X-Gm-Message-State: ALyK8tKYd41fd4oXO1vymV5okw75JIh65PdBlLES9crxSsvZuF0Eq5q5flgUjfezwKMImw== X-Received: by 10.66.73.232 with SMTP id o8mr18549753pav.43.1466382508455; Sun, 19 Jun 2016 17:28:28 -0700 (PDT) Received: from deepa-ubuntu.hsd1.ca.comcast.net (c-73-252-251-201.hsd1.ca.comcast.net. [73.252.251.201]) by smtp.gmail.com with ESMTPSA id s12sm34984980pfj.57.2016.06.19.17.28.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 19 Jun 2016 17:28:27 -0700 (PDT) From: Deepa Dinamani To: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Cc: arnd@arndb.de, tglx@linutronix.de, torvalds@linux-foundation.org, tytso@mit.edu, viro@zeniv.linux.org.uk, y2038@lists.linaro.org, Greg Kroah-Hartman , lustre-devel@lists.lustre.org Subject: [PATCH v2 14/24] drivers: staging: lustre: Replace CURRENT_TIME with current_time() Date: Sun, 19 Jun 2016 17:27:13 -0700 Message-Id: <1466382443-11063-15-git-send-email-deepa.kernel@gmail.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1466382443-11063-1-git-send-email-deepa.kernel@gmail.com> References: <1466382443-11063-1-git-send-email-deepa.kernel@gmail.com> Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP CURRENT_TIME macro is not appropriate for filesystems as it doesn't use the right granularity for filesystem timestamps. Use current_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_time() will be extended to do range checks. Hence, it is necessary for all file system timestamps to use current_time(). Also change format string for prints so that these are valid when vfs is transitioned to use 64 bit timestamps. Signed-off-by: Deepa Dinamani Cc: Greg Kroah-Hartman Cc: lustre-devel@lists.lustre.org Acked-by: James Simmons --- drivers/staging/lustre/lustre/llite/llite_lib.c | 16 ++++++++-------- 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, 20 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..e5c44d8 100644 --- a/drivers/staging/lustre/lustre/llite/llite_lib.c +++ b/drivers/staging/lustre/lustre/llite/llite_lib.c @@ -1258,23 +1258,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_time(inode); 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_time(inode); 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_time(inode); 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 +1564,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;