Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp2408767ybb; Mon, 30 Mar 2020 05:38:43 -0700 (PDT) X-Google-Smtp-Source: ADFU+vugm1E71lGdvQ6B9g6hhdH6KnF3AaNdgQY2KpoYebQjJSg2kbR0vbvSmyYi2BWCk/r0p84I X-Received: by 2002:a9d:6c4c:: with SMTP id g12mr8347700otq.351.1585571923581; Mon, 30 Mar 2020 05:38:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585571923; cv=none; d=google.com; s=arc-20160816; b=d3vaz22h74ftA/CX/dVziB4vzoA2Uu0BUnHJVA/WtKgfdiqd0a2w12NDh0XjF+VxWI Xv8RADukmGz+G30jZZDMRAQQBgSqg+Bn+zZN+7+H4MyF1agrQ3rzMxzLR1yErKQ7LrSg f+was4UkSiXnEqVE6efghAoiq0IvWhAtsxf9fqdNTo41oxG6mOCgZ9FCRzFZp/GMY2yE X0R12dY96eSegaNYh9aWw7OTpErYMafCmzhZsFJO+6zdltP0qXOr9sl3T7YtkbMnLEdF twH3tL3m51+cuGO29KpPUguyB1JajrEmz5rwIAIgwTiBMB3T9RneEKQ/RC2MyzMQePEs KhHw== 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:dkim-signature; bh=VUsSnudtXdVgGkOCyPuKO1wMS8K2vY7BbsC18XQpp2g=; b=V+HyE7MfTxDD13/s4jRA3XPdsljlg+kOu/O+F1YDLUXEZe55dANMJeVgbFuQypn8Wo VgNpTWMBGKaewbZdDdGVB6AmTwaG1V60T1XIuXW4x2pUedpLnt+Xec2LjHz5srpmnZT4 ALxWDIrUPSfrlR2NLa9I6DV+mAw2HFoAf0ERgp4lcIxZf/ybz52qbaMQi7I4+JUxhC0/ gNgWaasxYbDMa/fMYJTF0XDdacTC1fSpVHO7deQQiqgBLqhKnFuOe/zGVjr3gQDHmGr9 yKsi08CutUKmrM4jBCP46bZESoVLk1j4RPoPWANaGUU+Mgk37HEdZ8dmiAY2GJ7IkJm+ LGTw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=aN8OnYUQ; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x25si6133462otk.160.2020.03.30.05.38.30; Mon, 30 Mar 2020 05:38:43 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=aN8OnYUQ; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730204AbgC3Mhl (ORCPT + 99 others); Mon, 30 Mar 2020 08:37:41 -0400 Received: from mail-wr1-f65.google.com ([209.85.221.65]:40606 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730248AbgC3MhR (ORCPT ); Mon, 30 Mar 2020 08:37:17 -0400 Received: by mail-wr1-f65.google.com with SMTP id u10so21399034wro.7; Mon, 30 Mar 2020 05:37:17 -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=VUsSnudtXdVgGkOCyPuKO1wMS8K2vY7BbsC18XQpp2g=; b=aN8OnYUQaUjPiOUuMlAxIGuQ6G3wHwnuIjlY3p4OSIY1c2DN9n8SLU4fAqlo0E7IN8 RI1EPry+Caixn7t7rv0ssg4EQv5zbdwoU2deXDjR2z0/uET5Y6rWC3fckZYvlOprVLl+ 0vTTBYx3WlPCPZbBmwKOGbzIzq9VN0V1NpQLuvpYPNeK9y9MQLJuTC+YGdCN1+mr7Fs0 8GSIreW082aAxa//gqq9ri5laowIC+G9PgaexacIXU2IyIFEu9p4GHMUHwvS6j8vBBm9 UA/Pj0v7PntuudvdI3pexhOKTrxoF1pSOe5kzudbh0QHQKPxVJU3RGYB6gf6mqS3KijS AD5A== 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=VUsSnudtXdVgGkOCyPuKO1wMS8K2vY7BbsC18XQpp2g=; b=rhC4BEKzRtx8/lGCmVoGY8XJtXaHn66iJ9ODg1WbQ4ZgZaOLTELK69LDOG0x9qph6X lHF5hwnoO1vmDOTDPwrf7VapzzuxFO9qmn/fnPQuqvkpS5L9nYKjabaKkWMMnNsMh6UZ Xs5OCQ2AMNAsDBYdGyZBfr2Ff833k+QOTI/5gpIxPI2+dk/IPotGfF2wVcKLHyIx43sJ OT+CtXVSrg+3XSOIyibmGYBVfCCypRT6J4iObT6i3cB6zfJZteRA8Y2nohS+Cs7Hy9fk OdhjF1lAxboV8wPVItpUUPZn/78jPi8FZ61rX7Vrj/rhaw7X9iOH0Wl5EBwD5buqydhQ F5rw== X-Gm-Message-State: ANhLgQ2jWfuyEAkPj3sNT8To6fqsAcdGF8x3p2XaU4IZgawml4XjX67r 2O9eJLiBhsLCsSCZYX3gvDS4u2rn X-Received: by 2002:a05:6000:4d:: with SMTP id k13mr14908570wrx.356.1585571836590; Mon, 30 Mar 2020 05:37:16 -0700 (PDT) Received: from localhost ([185.92.221.13]) by smtp.gmail.com with ESMTPSA id h5sm21671884wro.83.2020.03.30.05.37.16 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 30 Mar 2020 05:37:16 -0700 (PDT) From: Wei Yang To: willy@infradead.org Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Wei Yang Subject: [PATCH 7/9] XArray: the NULL xa_node condition is handled in xas_top Date: Mon, 30 Mar 2020 12:36:41 +0000 Message-Id: <20200330123643.17120-8-richard.weiyang@gmail.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20200330123643.17120-1-richard.weiyang@gmail.com> References: <20200330123643.17120-1-richard.weiyang@gmail.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From the last if/else check, it handles the NULL/non-NULL xa_node mutually exclusively. While the NULL xa_node case is handled in the first condition xas_top(). Just remove the redundant handling for NULL xa_node. Signed-off-by: Wei Yang --- lib/xarray.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/lib/xarray.c b/lib/xarray.c index 0c5b44def3aa..82570bbbf2a5 100644 --- a/lib/xarray.c +++ b/lib/xarray.c @@ -650,16 +650,12 @@ static void *xas_create(struct xa_state *xas, bool allow_root) slot = &xa->xa_head; } else if (xas_error(xas)) { return NULL; - } else if (node) { + } else { unsigned int offset = xas->xa_offset; shift = node->shift; entry = xa_entry_locked(xa, node, offset); slot = &node->slots[offset]; - } else { - shift = 0; - entry = xa_head_locked(xa); - slot = &xa->xa_head; } while (shift > order) { -- 2.23.0