From patchwork Tue Mar 20 17:02:25 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Brandenburg X-Patchwork-Id: 10297557 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 AA8B5602B3 for ; Tue, 20 Mar 2018 17:03:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 992D928113 for ; Tue, 20 Mar 2018 17:03:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8E0F128D81; Tue, 20 Mar 2018 17:03:29 +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.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,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 1725428113 for ; Tue, 20 Mar 2018 17:03:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751458AbeCTRD1 (ORCPT ); Tue, 20 Mar 2018 13:03:27 -0400 Received: from mail-qt0-f195.google.com ([209.85.216.195]:42219 "EHLO mail-qt0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751712AbeCTRC7 (ORCPT ); Tue, 20 Mar 2018 13:02:59 -0400 Received: by mail-qt0-f195.google.com with SMTP id q11so2350215qtl.9 for ; Tue, 20 Mar 2018 10:02:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=omnibond-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=yb5WV2VE1ksS0HGga6hGvRcdFvyQydpjiLMqHVJh9tI=; b=nmnIpcJH+M8GVXOQZHNginoNarEeKdSiy3gBAxIqcZdSk3nLxztPWykfRYwF46Z0oL xeEuJ6Hu8Ojhr/HjPiHzuKB9+GtwZNWgRQLL78/GKj9u+vj9P/XN4L57OSPgrqxs7M3x 0B5strWzRycTvDUqtJIOTEDWUgIAg9QnFAZUE8vOw7RApbpsS3p1ViZ2x9FAx3x6APBh w+OYJnBzWLw9nOp91RlBLEttBKKDFHoI5qSbR1Oe+ec6Vh4oCln7UMlWVAry6XsO5TaW wZKrdwJiUi5/AyU2x7U2OEZEGyEG24FF/nlJW6ppa9sASCAzYCBUq+58TXdesSSv/Qh7 +mTA== 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=yb5WV2VE1ksS0HGga6hGvRcdFvyQydpjiLMqHVJh9tI=; b=Jkbrx2tsYA7Ww2cPxvduH7WayHULX5uSMOi6YNHqmTBrHN6cFpG6EyCUZ1hmRrizCl IFI29TQXYg+JvtoQGThglcE/GkzuSGXwLqgU1vyUauynDPjsUdy/ERYsUzPAcfewGKLZ g5CFnKXyiwAH6neudgooHNBwznDDbCzgPV/19suoH86fCGPdDQAGWSswVB43DNQoR8xB udYtXtozOwavc/nU9VafmiJHXq42ITVcpeJTzk9TjDa/LN6s+InoAqGWG8Lh75Qqa9e2 UbcHz36a6JgMuVbvWzuEv8WVaj9H1kIBdnEuoZBrJqZcf4VfySFaHoyaPvR8Zx4FyWRX 4vOw== X-Gm-Message-State: AElRT7GdQQ5Db5X0CYm8a4quBPouSbA/KO9m9+d1MGXmc+sWruAX7my6 kSDO5+1zDHZkoagtnWXwYNQQBQ== X-Google-Smtp-Source: AG47ELsCkbp+b2mQ/6QQqD4geHVivFkZkQLQ3GxIqPBooD+UKSiBhXmDGxbm0BPNkIYXRYkocTBpFQ== X-Received: by 10.237.34.136 with SMTP id p8mr13057378qtc.316.1521565378317; Tue, 20 Mar 2018 10:02:58 -0700 (PDT) Received: from ip-172-31-31-212.ec2.internal (ec2-34-238-158-165.compute-1.amazonaws.com. [34.238.158.165]) by smtp.gmail.com with ESMTPSA id l1sm1587277qtb.33.2018.03.20.10.02.56 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 20 Mar 2018 10:02:57 -0700 (PDT) From: Martin Brandenburg To: hubcap@omnibond.com, linux-fsdevel@vger.kernel.org Cc: Martin Brandenburg Subject: [PATCH 15/24] orangefs: let setattr write to cached inode Date: Tue, 20 Mar 2018 17:02:25 +0000 Message-Id: <20180320170234.1412-16-martin@omnibond.com> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180320170234.1412-1-martin@omnibond.com> References: <20180320170234.1412-1-martin@omnibond.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 This is a fairly big change, but ultimately it's not a lot of code. Implement write_inode and then avoid the call to orangefs_inode_setattr within orangefs_setattr. Signed-off-by: Martin Brandenburg --- fs/orangefs/inode.c | 10 +++------- fs/orangefs/super.c | 16 ++++++++++++++++ 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/fs/orangefs/inode.c b/fs/orangefs/inode.c index d77787f7b2f3..181723e16a94 100644 --- a/fs/orangefs/inode.c +++ b/fs/orangefs/inode.c @@ -207,8 +207,8 @@ static int orangefs_setattr_size(struct inode *inode, struct iattr *iattr) */ int orangefs_setattr(struct dentry *dentry, struct iattr *iattr) { - int ret = -EINVAL; struct inode *inode = dentry->d_inode; + int ret; gossip_debug(GOSSIP_INODE_DEBUG, "orangefs_setattr: called on %pd\n", @@ -227,15 +227,11 @@ int orangefs_setattr(struct dentry *dentry, struct iattr *iattr) setattr_copy(inode, iattr); mark_inode_dirty(inode); - ret = orangefs_inode_setattr(inode, iattr); - gossip_debug(GOSSIP_INODE_DEBUG, - "orangefs_setattr: inode_setattr returned %d\n", - ret); - - if (!ret && (iattr->ia_valid & ATTR_MODE)) + if (iattr->ia_valid & ATTR_MODE) /* change mod on a file that has ACLs */ ret = posix_acl_chmod(inode, inode->i_mode); + ret = 0; out: gossip_debug(GOSSIP_INODE_DEBUG, "orangefs_setattr: returning %d\n", ret); return ret; diff --git a/fs/orangefs/super.c b/fs/orangefs/super.c index 1251d201b3c9..56e85d8c04bd 100644 --- a/fs/orangefs/super.c +++ b/fs/orangefs/super.c @@ -150,6 +150,21 @@ static void orangefs_destroy_inode(struct inode *inode) call_rcu(&inode->i_rcu, orangefs_i_callback); } +int orangefs_write_inode(struct inode *inode, struct writeback_control *wbc) +{ + struct iattr iattr; + gossip_debug(GOSSIP_SUPER_DEBUG, "orangefs_write_inode\n"); + iattr.ia_valid = ATTR_MODE | ATTR_UID | ATTR_GID | ATTR_ATIME | + ATTR_ATIME_SET | ATTR_MTIME | ATTR_MTIME_SET | ATTR_CTIME; + iattr.ia_mode = inode->i_mode; + iattr.ia_uid = inode->i_uid; + iattr.ia_gid = inode->i_gid; + iattr.ia_atime = inode->i_atime; + iattr.ia_mtime = inode->i_mtime; + iattr.ia_ctime = inode->i_ctime; + return orangefs_inode_setattr(inode, &iattr); +} + /* * NOTE: information filled in here is typically reflected in the * output of the system command 'df' @@ -307,6 +322,7 @@ void fsid_key_table_finalize(void) static const struct super_operations orangefs_s_ops = { .alloc_inode = orangefs_alloc_inode, .destroy_inode = orangefs_destroy_inode, + .write_inode = orangefs_write_inode, .drop_inode = generic_delete_inode, .statfs = orangefs_statfs, .remount_fs = orangefs_remount_fs,