From patchwork Mon Feb 22 15:17:48 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Deepa Dinamani X-Patchwork-Id: 8378771 Return-Path: X-Original-To: patchwork-linux-fsdevel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 78EE9C0553 for ; Mon, 22 Feb 2016 15:21:59 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 894DE20253 for ; Mon, 22 Feb 2016 15:21:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7C54E201B9 for ; Mon, 22 Feb 2016 15:21:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752492AbcBVPVn (ORCPT ); Mon, 22 Feb 2016 10:21:43 -0500 Received: from mail-pa0-f46.google.com ([209.85.220.46]:35427 "EHLO mail-pa0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751873AbcBVPVm (ORCPT ); Mon, 22 Feb 2016 10:21:42 -0500 Received: by mail-pa0-f46.google.com with SMTP id ho8so95151109pac.2; Mon, 22 Feb 2016 07:21:41 -0800 (PST) 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=08ixhJ0FI7x+UrqA6hx19AJm2ARDCVWFFN0466/o+sw=; b=xyTLW6ebZRQj5ls6GbL1u5g0PjpP2ByJx7v0B4m4Vwvvm8AdyZwgzraOXjeewEOOh9 5Ng0/ofPO2RVyIyZyFFJKR9xCfUL8OHFuRWVTNf4rR4EPbQ/5Ih99SG//hp5lTywPf+G l09i4dWxye2djETpr8VXeI2QPj2G9w5EfdBXi+yldSn5CTxjTXsdh/yEMaggctRh+2LC 4XpCTkaP1epbXn/jfOfhZUAn4bLdD/PVCkVJsEjROGeKWDBMOfc2wQzLJAvteNf7OTwS Rvm6fNv2c/0y3HbKIoFOaHzR5MRV26Xfb7/4zCDBLh6RJdQgRsc93cPUF2mVVFUcpdi9 3YOQ== 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=08ixhJ0FI7x+UrqA6hx19AJm2ARDCVWFFN0466/o+sw=; b=LW2dpneoAfcXdqrKB0kX6PY4XEAAwBYt2H4RBnBI9wHQhsdWcqPP7FphBw2u40amG3 fWXxyU9hxBnrHyoAlZwKSAwdQ4l+Zig+YLhjr0Lf95YUsIcS7LYVX0OXK7pjn8nWTmyK tDSchaHqreldle6uD9Pgv7MQ/DHxz8DKcryUeMkSD08BQyqy3j8GkbwXEt9+QO5m3foh mjg8hYiY5vsHJAozhNW4+vn/XVlgJq5PlwXCnQScJ0hP9QzdwD9xblvvCftVKx5Infa6 Y946dhY5BAPqwV4ItxIn8a1blrbi3mLp3Usc2EEzkKyk9gNI5h3rMKWlwgha50yuUXCm IMvw== X-Gm-Message-State: AG10YOTYITvIxW5/wMwwPD9jMqJ7JAJZgao0ifpOdReyEQcCOpA3MesC5W9b4LEzQKHilg== X-Received: by 10.66.228.97 with SMTP id sh1mr31868376pac.77.1456154501300; Mon, 22 Feb 2016 07:21:41 -0800 (PST) Received: from localhost.localdomain ([106.51.225.115]) by smtp.gmail.com with ESMTPSA id z3sm37888603par.17.2016.02.22.07.21.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 22 Feb 2016 07:21:40 -0800 (PST) From: Deepa Dinamani To: linux-fsdevel@vger.kernel.org, y2038@lists.linaro.org Cc: Arnd Bergmann , linux-kernel@vger.kernel.org, Joern Engel , Prasad Joshi , logfs@logfs.org Subject: [PATCH 2/8] fs: logfs: Replace CURRENT_TIME by current_fs_time() Date: Mon, 22 Feb 2016 07:17:48 -0800 Message-Id: <1456154274-30487-3-git-send-email-deepa.kernel@gmail.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1456154274-30487-1-git-send-email-deepa.kernel@gmail.com> References: <1456154274-30487-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-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.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_fs_time() instead. Signed-off-by: Deepa Dinamani Cc: Joern Engel Cc: Prasad Joshi Cc: logfs@logfs.org --- fs/logfs/dir.c | 11 +++++++---- fs/logfs/file.c | 2 +- fs/logfs/inode.c | 3 +-- fs/logfs/readwrite.c | 7 ++++--- 4 files changed, 13 insertions(+), 10 deletions(-) diff --git a/fs/logfs/dir.c b/fs/logfs/dir.c index 542468e..3b5f279 100644 --- a/fs/logfs/dir.c +++ b/fs/logfs/dir.c @@ -212,7 +212,8 @@ static void abort_transaction(struct inode *inode, struct logfs_transaction *ta) static int logfs_unlink(struct inode *dir, struct dentry *dentry) { - struct logfs_super *super = logfs_super(dir->i_sb); + struct super_block *sb = dir->i_sb; + struct logfs_super *super = logfs_super(sb); struct inode *inode = d_inode(dentry); struct logfs_transaction *ta; struct page *page; @@ -226,7 +227,8 @@ static int logfs_unlink(struct inode *dir, struct dentry *dentry) ta->state = UNLINK_1; ta->ino = inode->i_ino; - inode->i_ctime = dir->i_ctime = dir->i_mtime = CURRENT_TIME; + inode->i_ctime = dir->i_ctime = + dir->i_mtime = current_fs_time(sb); page = logfs_get_dd_page(dir, dentry); if (!page) { @@ -540,7 +542,8 @@ static int logfs_link(struct dentry *old_dentry, struct inode *dir, { struct inode *inode = d_inode(old_dentry); - inode->i_ctime = dir->i_ctime = dir->i_mtime = CURRENT_TIME; + inode->i_ctime = dir->i_ctime = + dir->i_mtime = current_fs_time(dir->i_sb); ihold(inode); inc_nlink(inode); mark_inode_dirty_sync(inode); @@ -573,7 +576,7 @@ static int logfs_delete_dd(struct inode *dir, loff_t pos) * (crc-protected) journal. */ BUG_ON(beyond_eof(dir, pos)); - dir->i_ctime = dir->i_mtime = CURRENT_TIME; + dir->i_ctime = dir->i_mtime = current_fs_time(dir->i_sb); log_dir(" Delete dentry (%lx, %llx)\n", dir->i_ino, pos); return logfs_delete(dir, pos, NULL); } diff --git a/fs/logfs/file.c b/fs/logfs/file.c index 61eaeb1..339ae40 100644 --- a/fs/logfs/file.c +++ b/fs/logfs/file.c @@ -211,7 +211,7 @@ long logfs_ioctl(struct file *file, unsigned int cmd, unsigned long arg) li->li_flags = flags; inode_unlock(inode); - inode->i_ctime = CURRENT_TIME; + inode->i_ctime = current_fs_time(inode->i_sb); mark_inode_dirty_sync(inode); return 0; diff --git a/fs/logfs/inode.c b/fs/logfs/inode.c index db9cfc5..65eaf09 100644 --- a/fs/logfs/inode.c +++ b/fs/logfs/inode.c @@ -213,8 +213,7 @@ static void logfs_init_inode(struct super_block *sb, struct inode *inode) i_gid_write(inode, 0); inode->i_size = 0; inode->i_blocks = 0; - inode->i_ctime = CURRENT_TIME; - inode->i_mtime = CURRENT_TIME; + inode->i_ctime = inode->i_mtime = current_fs_time(sb); li->li_refcount = 1; INIT_LIST_HEAD(&li->li_freeing_list); diff --git a/fs/logfs/readwrite.c b/fs/logfs/readwrite.c index 20973c9..361a2d0 100644 --- a/fs/logfs/readwrite.c +++ b/fs/logfs/readwrite.c @@ -1539,14 +1539,15 @@ static int grow_inode(struct inode *inode, u64 bix, level_t level) static int __logfs_write_buf(struct inode *inode, struct page *page, long flags) { - struct logfs_super *super = logfs_super(inode->i_sb); + struct super_block *sb = inode->i_sb; + struct logfs_super *super = logfs_super(sb); pgoff_t index = page->index; u64 bix; level_t level; int err; flags |= WF_WRITE | WF_DELETE; - inode->i_ctime = inode->i_mtime = CURRENT_TIME; + inode->i_ctime = inode->i_mtime = current_fs_time(sb); logfs_unpack_index(index, &bix, &level); if (logfs_block(page) && logfs_block(page)->reserved_bytes) @@ -1578,7 +1579,7 @@ static int __logfs_delete(struct inode *inode, struct page *page) long flags = WF_DELETE; int err; - inode->i_ctime = inode->i_mtime = CURRENT_TIME; + inode->i_ctime = inode->i_mtime = current_fs_time(inode->i_sb); if (page->index < I0_BLOCKS) return logfs_write_direct(inode, page, flags);