Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp2839875ybb; Sun, 5 Apr 2020 18:26:34 -0700 (PDT) X-Google-Smtp-Source: APiQypLeTnr2sxfcNF5omkL3+X1BU+E2Akc/HPER/DxbjPllxudp6MhctIaD6tsq+wBBG6PaFShQ X-Received: by 2002:aca:34c6:: with SMTP id b189mr11043483oia.63.1586136393992; Sun, 05 Apr 2020 18:26:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586136393; cv=none; d=google.com; s=arc-20160816; b=sv74e9gheGNzhUC319g1crLov2DDeloUpPLNVj3SwWQG4x+EnaoGB7EScjaSEi7hn/ SPpGER4rNZXtDwE/hlxjpLINLMgF8OUH/mj/kFVg5Dmg80RoAt3lpnKcC/UvqlOqgkBF ltmceGDIrGc2NY/lNUg/nF/G4x6A+wlyG60uPQ4+nB0BPUX4W1MPosxCYCQhVjPr/+qG a2Xtbu5VDXlcsVPOv4vwBaYc/xxKL43zdGRKDzaK4yDSbxPuGxtALvc4754cehSk35s/ o9Ms8nb3Qt6V1IEG0GRBkm8QqI3EaZTXMVuo2VqQsyqFQAJrdDUmMeqTd9sBYbeamyLU ewgQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:reply-to:message-id :subject:cc:to:from:date:dkim-signature; bh=vt1jfJ08UcjXQKwq+YyYHriAKm3jxCzbKToBskSXe3o=; b=isj9fBs2rRoCdiEwwacSunu5BWo2ioQnOWl8pvzmx9v8v23DnIGLki1hapCXzIL7nr U0SrxHt/LE9/ppxTerSPGdMo9+OrTMPUWovRbuvkKId4DUKTB6HDyUKBEO879Qa5gL2x KJltMJ55cQ9vTVMe4AQnbbF3o6xs4GmPQ36z6mvfJEgDHg3dhHwBEV0gKhVhSdSdQ4KU FcK1udUrCTHEY6SaOU066CJ8ST+UtFSSGHEtQwkJwcPZxjYCOj30xcRd7FEk5IrvRIxK wmeel88XCDizHDxB7Z8j8XRapHgFJS+rhvDLVMwajiGng3UV/abi4jH2pVVn0DqJG1XP TtUQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=agLJMsSd; 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 x33si7029040otb.48.2020.04.05.18.26.19; Sun, 05 Apr 2020 18:26:33 -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=agLJMsSd; 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 S1727254AbgDFBY4 (ORCPT + 99 others); Sun, 5 Apr 2020 21:24:56 -0400 Received: from mail-wr1-f66.google.com ([209.85.221.66]:33312 "EHLO mail-wr1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726436AbgDFBY4 (ORCPT ); Sun, 5 Apr 2020 21:24:56 -0400 Received: by mail-wr1-f66.google.com with SMTP id a25so15479894wrd.0; Sun, 05 Apr 2020 18:24:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:reply-to:references:mime-version :content-disposition:in-reply-to:user-agent; bh=vt1jfJ08UcjXQKwq+YyYHriAKm3jxCzbKToBskSXe3o=; b=agLJMsSdM0R0NH4VVIMfJFf4iY5uTObaYJ085JnQruZhy9sBJbcl+S4TyhbFR0HY3X wutWmOSqP+wfaNQwkflpL1qZJeFZM72K9W/34OHDEnwM2fK0LJEJhk1uI7UL6Bri/tv6 ujc6+JzrFUQHByiLMWzsYg0hVDcIo63pgEU0E1XjqNCdBQ44YASTC0PwKWXYypFXGNb5 QQePJtvWxpESfUe9/5vaHoZD+FRi34H5EtEaKLi0+FVk44xcNbozWPrwKJvSGJoEhvLf +6FDoh+yQec8FKrYXzBDkY98EEOdjDz6ZVVfvzE/cE3jiP+fk04382Ysvab3dqoP7KQq d+UQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:reply-to :references:mime-version:content-disposition:in-reply-to:user-agent; bh=vt1jfJ08UcjXQKwq+YyYHriAKm3jxCzbKToBskSXe3o=; b=MNjOzv5g3VJlE7Cjz11FQtKCQZUhHUP+lwh9b2oltR3KsFeWciONBCz2wgzviSTTeo 9UH4tu7eo+65Ug28kZStdSr/BEm5kIb3DGAUJn0lLAlQ9FIyvyHsnCL+mn96a8pqvxT7 ZIYEbf5j/+ctzWot4Mx76zDeIdXTSo+9KT9p3gmn2fzxoVU8PyJTOKKWUAuZiEH3Ra3b rUEkcfeyfSPgzNjjY2qXzkMb+PghoadzEAUWKq4uPJOu5YEc/4qvR5GAvBrgMbporYR5 Wz8Cu4+Ce2dn8g++CO2YBrimy3lg1w2cAJ/YhqSioLq8mOzKt7j6aeBNJmGrJZLjRq8Q HuWw== X-Gm-Message-State: AGi0PuagWcSVKlHnHi/70Hgf67vAIEPsAyxpyzBRXbpcAjNxE1CXjO6A Os6w+YoCJyuSpAjFn0KiPzA= X-Received: by 2002:adf:e848:: with SMTP id d8mr20608408wrn.209.1586136293937; Sun, 05 Apr 2020 18:24:53 -0700 (PDT) Received: from localhost ([185.92.221.13]) by smtp.gmail.com with ESMTPSA id c85sm22795194wmd.48.2020.04.05.18.24.53 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 05 Apr 2020 18:24:53 -0700 (PDT) Date: Mon, 6 Apr 2020 01:24:53 +0000 From: Wei Yang To: Matthew Wilcox Cc: Wei Yang , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 5/9] XArray: entry in last level is not expected to be a node Message-ID: <20200406012453.tthxonovxzdzoluj@master> Reply-To: Wei Yang References: <20200330123643.17120-1-richard.weiyang@gmail.com> <20200330123643.17120-6-richard.weiyang@gmail.com> <20200330124842.GY22483@bombadil.infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200330124842.GY22483@bombadil.infradead.org> User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Mar 30, 2020 at 05:48:42AM -0700, Matthew Wilcox wrote: >On Mon, Mar 30, 2020 at 12:36:39PM +0000, Wei Yang wrote: >> If an entry is at the last level, whose parent's shift is 0, it is not >> expected to be a node. We can just leverage the xa_is_node() check to >> break the loop instead of check shift additionally. > >I know you didn't run the test suite after making this change. Well, I got your point finally. From commit 76b4e5299565 ('XArray: Permit storing 2-byte-aligned pointers'), xa_is_node() will not be *ACURATE*. Those 2-byte align pointers will be treated as node too. Well, I found another thing, but not sure whether you have fixed this or not. If applying following change @@ -1461,6 +1461,11 @@ static void check_align_1(struct xarray *xa, char *name) GFP_KERNEL) != 0); XA_BUG_ON(xa, id != i); } + XA_STATE_ORDER(xas, xa, 0, 0); + entry = xas_find_conflict(&xas); xa_for_each(xa, index, entry) XA_BUG_ON(xa, xa_is_err(entry)); xa_destroy(xa); We trigger an error message. The reason is the same. And we can fix this with the same approach in xas_find_conflict(). If you think this is the proper way, I would add a patch for this. -- Wei Yang Help you, Help me