Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756794AbcDDU1e (ORCPT ); Mon, 4 Apr 2016 16:27:34 -0400 Received: from mail-yw0-f174.google.com ([209.85.161.174]:34707 "EHLO mail-yw0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756398AbcDDU0o (ORCPT ); Mon, 4 Apr 2016 16:26:44 -0400 From: Martin Brandenburg X-Google-Original-From: Martin Brandenburg To: hubcap@omnibond.com Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, Martin Brandenburg Subject: [PATCH 1/3] orangefs: clean up truncate ctime and mtime setting Date: Mon, 4 Apr 2016 16:26:36 -0400 Message-Id: <1459801598-12757-1-git-send-email-martin@martinbrandenburg.com> X-Mailer: git-send-email 2.7.4 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1450 Lines: 44 From: Martin Brandenburg The ctime and mtime are always updated on a successful ftruncate and only updated on a successful truncate where the size changed. We handle the ``if the size changed'' bit. This matches FUSE's behavior. Signed-off-by: Martin Brandenburg --- fs/orangefs/inode.c | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/fs/orangefs/inode.c b/fs/orangefs/inode.c index 2382e26..975a796 100644 --- a/fs/orangefs/inode.c +++ b/fs/orangefs/inode.c @@ -204,22 +204,8 @@ static int orangefs_setattr_size(struct inode *inode, struct iattr *iattr) if (ret != 0) return ret; - /* - * Only change the c/mtime if we are changing the size or we are - * explicitly asked to change it. This handles the semantic difference - * between truncate() and ftruncate() as implemented in the VFS. - * - * The regular truncate() case without ATTR_CTIME and ATTR_MTIME is a - * special case where we need to update the times despite not having - * these flags set. For all other operations the VFS set these flags - * explicitly if it wants a timestamp update. - */ - if (orig_size != i_size_read(inode) && - !(iattr->ia_valid & (ATTR_CTIME | ATTR_MTIME))) { - iattr->ia_ctime = iattr->ia_mtime = - current_fs_time(inode->i_sb); + if (orig_size != i_size_read(inode)) iattr->ia_valid |= ATTR_CTIME | ATTR_MTIME; - } return ret; } -- 2.7.4