Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp3288616imm; Sun, 29 Jul 2018 15:07:36 -0700 (PDT) X-Google-Smtp-Source: AAOMgpc7bZbcGwwTWxQARnrTyCyebpKruYEAHb6i8FjrZBq8u/XHim2/7ac3+nBbQxrXsgBxLEcS X-Received: by 2002:a62:9b57:: with SMTP id r84-v6mr15241760pfd.6.1532902056350; Sun, 29 Jul 2018 15:07:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532902056; cv=none; d=google.com; s=arc-20160816; b=hXAxGTxHFXa6mI/Q1ltlggiRrcPWXgvQT3GBaOEPjg1/xXfcQ6dk2Y2jlXmaQNLE4a qxs2Ng7EmZ/5pmhCrlgfK3be1TSMDJJzGhOBMetaxF+f4FHVCrmFzq5CrSPI4mo9JjXy Am1bYnmIYTj5w23u0fUKUxfAnnhNk6FKnyw2il+r2TqfQCbdKGH0RgRiHpYwXsoGb34j VRFYrcQvGEL8tHtJWRcFo8x/5rwjxDrf5Gvclc/X28juRi/E2Kdp5ulTJn+w2STcTr2F I9ZUAE9DhEMs/MqsXLUnTSZUP1uCF9ApMJISpIj5ShHWJsM2NI7vI50Lsgfk/3EtvlhS zUYw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=mWQWIwu56qU/l6jUXFhyopo0tBwvggSfhlmiMAUCXxE=; b=GoEKKwhwi2t6pTFmDKgFhI7KuAuDFn7sBVMkkpLYiuecH1e0Sua7Kg1hTaK9buChQS 0hKqEdkA7LlHzhbifIpEDFKUE8WpmRILUjz9gsPKmsBzQ3os3el/aZ4jCh48RV71mtyI baY785WGKDtUkWMnpb4IgNFyL6R0kYudOhu8l46AEwlWJnowe3EpYmU9eijiRVI8BDxe wxGYlkKW98iseJ7uuf3FsJdWx3eGQH6bXwZHc8iqKCgW43JxKr/682OaggrOArgEO4dQ 1S2PvFHNPfwcPCCqvVEuImk1KIjUQOynpPeIeZGncC8nP4lHSLRPL+51ILLlcO7/i92t 74AQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o3-v6si8771987pld.281.2018.07.29.15.07.22; Sun, 29 Jul 2018 15:07:36 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732339AbeG2Xhr (ORCPT + 99 others); Sun, 29 Jul 2018 19:37:47 -0400 Received: from zeniv.linux.org.uk ([195.92.253.2]:51632 "EHLO ZenIV.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729576AbeG2Xg4 (ORCPT ); Sun, 29 Jul 2018 19:36:56 -0400 Received: from viro by ZenIV.linux.org.uk with local (Exim 4.87 #1 (Red Hat Linux)) id 1fjto7-0003Wb-9y; Sun, 29 Jul 2018 22:04:55 +0000 From: Al Viro To: linux-fsdevel@vger.kernel.org Cc: Linus Torvalds , linux-kernel@vger.kernel.org, Miklos Szeredi Subject: [PATCH 14/16] btrfs: simplify btrfs_iget() Date: Sun, 29 Jul 2018 23:04:51 +0100 Message-Id: <20180729220453.13431-14-viro@ZenIV.linux.org.uk> X-Mailer: git-send-email 2.9.5 In-Reply-To: <20180729220453.13431-1-viro@ZenIV.linux.org.uk> References: <20180729220317.GB30522@ZenIV.linux.org.uk> <20180729220453.13431-1-viro@ZenIV.linux.org.uk> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Al Viro don't open-code iget_failed(), don't bother with btrfs_free_path(NULL), move handling of positive return values of btrfs_lookup_inode() from btrfs_read_locked_inode() to btrfs_iget() and kill now obviously pointless ASSERT() in there. Signed-off-by: Al Viro --- fs/btrfs/inode.c | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 8f0b2592feb0..388b2dba68a0 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -3610,18 +3610,15 @@ static int btrfs_read_locked_inode(struct inode *inode) filled = true; path = btrfs_alloc_path(); - if (!path) { - ret = -ENOMEM; - goto make_bad; - } + if (!path) + return -ENOMEM; memcpy(&location, &BTRFS_I(inode)->location, sizeof(location)); ret = btrfs_lookup_inode(NULL, root, path, &location, 0); if (ret) { - if (ret > 0) - ret = -ENOENT; - goto make_bad; + btrfs_free_path(path); + return ret; } leaf = path->nodes[0]; @@ -3774,10 +3771,6 @@ static int btrfs_read_locked_inode(struct inode *inode) btrfs_sync_inode_flags_to_i_flags(inode); return 0; - -make_bad: - btrfs_free_path(path); - return ret; } /* @@ -5713,11 +5706,10 @@ struct inode *btrfs_iget(struct super_block *s, struct btrfs_key *location, if (new) *new = 1; } else { - make_bad_inode(inode); - unlock_new_inode(inode); - iput(inode); - ASSERT(ret < 0); - inode = ERR_PTR(ret < 0 ? ret : -ESTALE); + iget_failed(inode); + if (ret > 0) + ret = -ENOENT; + inode = ERR_PTR(ret); } } -- 2.11.0