From patchwork Sun Aug 18 16:58:00 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Deepa Dinamani X-Patchwork-Id: 11099749 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B9F12912 for ; Sun, 18 Aug 2019 17:01:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A1DF11FE8D for ; Sun, 18 Aug 2019 17:01:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 95A07228C8; Sun, 18 Aug 2019 17:01:05 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 DEEC71FE8D for ; Sun, 18 Aug 2019 17:01:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726994AbfHRQ7j (ORCPT ); Sun, 18 Aug 2019 12:59:39 -0400 Received: from mail-pg1-f193.google.com ([209.85.215.193]:42984 "EHLO mail-pg1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726988AbfHRQ7i (ORCPT ); Sun, 18 Aug 2019 12:59:38 -0400 Received: by mail-pg1-f193.google.com with SMTP id p3so5500828pgb.9; Sun, 18 Aug 2019 09:59:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=XBoGugkhUC7RzEVn8NEyVinAwt3h5A3UJUwpo03Y32I=; b=mlw3BTHmR65CECBGBfXGXHjTZ5nyHwdI6R8Rp5DQ3oO8pXG6+/TVmoY/X1eUUe7m4M NywGeGa506MTS3HvJq+RKK7t3qeBzAy0zkmEjQJUw3iRS7ZGFvkA54/44d4skmg4mKPp 9BM+1IdlEpQwrbDb0bEN9VuGlPsG04Lgn7VDjI80Je7xwzN/p4ERNoksd0iHF6EWwxJ9 yscfg30lVzUcx3ZCiC0DGkrfUzoJicdlyogkoyW98sWY9bVjzwIJaV4mduy5FAvxqsxn +J4B9McSFexn31/NZCFP74SXSJo58mjK/ALWOZExwDIlSqEGlWhsWa+t49PyLth6Z1T9 fn5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=XBoGugkhUC7RzEVn8NEyVinAwt3h5A3UJUwpo03Y32I=; b=T9u9AT05zA7wYXCJZjFC93FiQVnaJbdLx4d9LYrLFfUpo4/0nAk5KQydWDGbtfoGGN j50kbYnaDa4hQSCf64gp6AMJRhJXivF6EEEKqfy5uzOOEk4eSRxy+MgaX2YHn5UzIbQG Hv36ZXy71Zcz44THR2+RGflCxNXR+nHjVNCfqlyMQuv73ZGyYKPH/db1ywtXJ1YbzBH1 IzO0hzRmxxE0XRiqmwfAPz42KreyKiyflxCNc7W98k3ssCA4ITUXKIN/cnwEsT2AUwzh vj+oMpbzdvFi5O72a6wO5mMlDFSkYHDL2NwdAfs6WF/KMqayP/1x3UEvPFaJ/4wtBoFx rbzw== X-Gm-Message-State: APjAAAWfCGK9XNYMTxSiZOYDQQQ++CXvDo71qchwwP6GlaxxG8/1+57d KyYKmq9E13djD/bJVYKwHCbighMIEaU= X-Google-Smtp-Source: APXvYqyMocWQPnOEOvETytOVzxJTuHH9RsqGxnRaQNh5G1nPmvEKz71Glx/Lb38BKq0xU4X4UktRWA== X-Received: by 2002:a63:e20a:: with SMTP id q10mr16098732pgh.24.1566147577789; Sun, 18 Aug 2019 09:59:37 -0700 (PDT) Received: from deepa-ubuntu.lan (c-98-234-52-230.hsd1.ca.comcast.net. [98.234.52.230]) by smtp.gmail.com with ESMTPSA id b136sm15732831pfb.73.2019.08.18.09.59.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 18 Aug 2019 09:59:37 -0700 (PDT) From: Deepa Dinamani To: viro@zeniv.linux.org.uk, linux-kernel@vger.kernel.org Cc: linux-fsdevel@vger.kernel.org, y2038@lists.linaro.org, arnd@arndb.de, adrian.hunter@intel.com, dedekind1@gmail.com, gregkh@linuxfoundation.org, hch@lst.de, jaegeuk@kernel.org, jlbec@evilplan.org, richard@nod.at, tj@kernel.org, yuchao0@huawei.com, linux-f2fs-devel@lists.sourceforge.net, linux-ntfs-dev@lists.sourceforge.net, linux-mtd@lists.infradead.org Subject: [PATCH v8 03/20] timestamp_truncate: Replace users of timespec64_trunc Date: Sun, 18 Aug 2019 09:58:00 -0700 Message-Id: <20190818165817.32634-4-deepa.kernel@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190818165817.32634-1-deepa.kernel@gmail.com> References: <20190818165817.32634-1-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 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: Deepa Dinamani 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 --- fs/attr.c | 21 ++++++++++++--------- fs/configfs/inode.c | 12 ++++++------ fs/f2fs/file.c | 21 ++++++++++++--------- fs/kernfs/inode.c | 7 +++---- fs/ntfs/inode.c | 21 ++++++++++++--------- fs/ubifs/file.c | 21 ++++++++++++--------- 6 files changed, 57 insertions(+), 46 deletions(-) diff --git a/fs/attr.c b/fs/attr.c index 1fcfdcc5b367..97b60ad7f419 100644 --- a/fs/attr.c +++ b/fs/attr.c @@ -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; diff --git a/fs/configfs/inode.c b/fs/configfs/inode.c index ab0284321912..884dcf06cfbe 100644 --- a/fs/configfs/inode.c +++ b/fs/configfs/inode.c @@ -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; diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c index 89a9ee22296d..af8cdd345f3d 100644 --- a/fs/f2fs/file.c +++ b/fs/f2fs/file.c @@ -749,15 +749,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; diff --git a/fs/kernfs/inode.c b/fs/kernfs/inode.c index f3f3984cce80..f3eaa8869f42 100644 --- a/fs/kernfs/inode.c +++ b/fs/kernfs/inode.c @@ -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) diff --git a/fs/ntfs/inode.c b/fs/ntfs/inode.c index 8baa34baf548..6c7388430ad3 100644 --- a/fs/ntfs/inode.c +++ b/fs/ntfs/inode.c @@ -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; diff --git a/fs/ubifs/file.c b/fs/ubifs/file.c index 400970d740bb..cd52585c8f4f 100644 --- a/fs/ubifs/file.c +++ b/fs/ubifs/file.c @@ -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;