From nobody Wed Feb 11 06:30:41 2026 Received: from mail-pl1-f201.google.com (mail-pl1-f201.google.com [209.85.214.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AAE682FD689 for ; Sat, 31 Jan 2026 00:15:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769818550; cv=none; b=tTthdUe6dxt75QetUJ5qEy1zHJbRkyHXufo/n1ujz24F5d0dMiyVjIYG2wNOVS6fkIps7goLGTdM/H7Eb4g17PC6DzTPmpbi5NtC3X+Uz5/u6Gtgnt35jvYsqK/ZdLyREh8MPwa+eD+0zzXDHYhitxapnrlOGxQ0eHCCJ/Kwu/8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769818550; c=relaxed/simple; bh=Q8Y+tcP14cPGX6nVnrUC5A0/e39HqBX0TIbiYWHDZtg=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=ouqspy8hA8n/Wqm12v27pWit+jiF0s3wu9EW0BWlrHABUNPysulL2LWKBxV6IIZeCmPXzI5MBlK7n2LfPsGJsPdE+XVy0eorsNdluEYbSTu26zxo9n4Tjc0MHZymXwA+8URPgRzrNqzELqUXdqmK47vYNdM6EBCRPJ9OWSfJVqc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--ackerleytng.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=UZZJQ9dA; arc=none smtp.client-ip=209.85.214.201 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--ackerleytng.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="UZZJQ9dA" Received: by mail-pl1-f201.google.com with SMTP id d9443c01a7336-2a351686c17so22514775ad.0 for ; Fri, 30 Jan 2026 16:15:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1769818549; x=1770423349; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=V0zRl8ckmsYXJA9hzzqbqYRhq63sxmBlwiujRl/vITs=; b=UZZJQ9dAcXGoeuD3dwu0ovCYyTSWwDUwtrQi73gWo6F3V2lZ3zk81gs7T8lqgAufUJ DJOcopcFstdAQbHwbuSaWZgbHKKp00qYnqGvPHo+5hAYoJqKx8iw2bHveUKpwCfT+mL9 uVbHtM1L+5Ud4g3MeG0Q2xXyZa6f8S8t1TUk0WDjromp1FoICIlVU7YhyZRUbyBBMYS0 sa//lEeajyX/XQC7O3MLbc+vG9paCRR68cuvmwKMTtAKq8Nf5LOKNAg+TSwKeMz8Ehwl nU7GCKu2YVVykvUMV6oZ46l9d4fQ8x2TmNrGV/X5CXHFlFJJk/ghZUgcigdhcZcRcz6T QdqA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769818549; x=1770423349; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=V0zRl8ckmsYXJA9hzzqbqYRhq63sxmBlwiujRl/vITs=; b=ULfaz3w5uku3j/SXOkhHtnt97ABRq4ol7LpTezKhvYI2VOz6ImDcscBKPo4aJYinwa Y7/NnUKaYCopoQ7YwugH8EeBGwoyY0JjhXzyuuSu8eLVDxMczBd1bDEr4zP2AyeAYHqV RdFi04F4YBHzmpeqngsUasFk9M3WE2gDeq5JhC1Ocj7RhD0IICVYwWnu30XykRj/nyeb 4vW27LP7GA6uwdbeM9l/H0qKMuehccEgKFQ20xO15UU104WaQIf1whi17vOUgb3PNH2t nWLtcfaKsIgJyJR3nWSVjQUU15cwrxy2xo9EDcWrz2GNVapkCzfSTUGzJmvUVQO0wlD6 2Sgg== X-Forwarded-Encrypted: i=1; AJvYcCVEVMr9QZQEpbDUxK5zdbt4knXwRjO5SCb1H0oY0ynTC/ZgIfcUumtUMFk3qc29xlAVBRua4uP3bFQX/c0=@vger.kernel.org X-Gm-Message-State: AOJu0YwHcgS0C8+cEz2EFYvwMm28eYT4J6nQbMFva0aiKSR+0XDeqH6u Shj0LhDq6btA9R9PdpHJbb+RFDrl0rmpwnz0OVEwoZKcAR7hxp9pZ000dymrIHz+HPgUYqvoLQh wG1XBakJlW5BRDkcxxFF+nRLG7w== X-Received: from plsm24.prod.google.com ([2002:a17:902:bb98:b0:2a0:974c:2e6e]) (user=ackerleytng job=prod-delivery.src-stubby-dispatcher) by 2002:a17:903:2442:b0:267:a95d:7164 with SMTP id d9443c01a7336-2a8d9a7e152mr44013535ad.60.1769818548948; Fri, 30 Jan 2026 16:15:48 -0800 (PST) Date: Fri, 30 Jan 2026 16:15:38 -0800 In-Reply-To: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: X-Mailer: git-send-email 2.53.0.rc1.225.gd81095ad13-goog Message-ID: Subject: [RFC PATCH v1 2/2] XArray tests: Verify xa_erase behavior in check_split From: Ackerley Tng To: willy@infradead.org, akpm@linux-foundation.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: david@redhat.com, michael.roth@amd.com, dev.jain@arm.com, vannapurve@google.com, Ackerley Tng Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Both __xa_store() and xa_erase() use xas_store() under the hood, but when the entry being stored is NULL (as in the case of xa_erase()), xas->xa_sibs (and max) is only checked if the next entry is not a sibling, hence allowing xas_store() to keep iterating, hence updating node->nr_values correctly. Add xa_erase() to check_split tests that verify functionality, with the added intent to illustrate the usage differences between __xa_store(), xas_store() and xa_erase() with regard to multi-index XArrays. Signed-off-by: Ackerley Tng --- lib/test_xarray.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/test_xarray.c b/lib/test_xarray.c index e71e8ff76900..bb9471a3df65 100644 --- a/lib/test_xarray.c +++ b/lib/test_xarray.c @@ -1874,6 +1874,10 @@ static void check_split_1(struct xarray *xa, unsigne= d long index, rcu_read_unlock(); XA_BUG_ON(xa, found !=3D 1 << (order - new_order)); =20 + for (i =3D 0; i < (1 << order); i +=3D (1 << new_order)) + xa_erase(xa, index + i); + XA_BUG_ON(xa, !xa_empty(xa)); + xa_destroy(xa); } =20 @@ -1926,6 +1930,10 @@ static void check_split_2(struct xarray *xa, unsigne= d long index, } rcu_read_unlock(); XA_BUG_ON(xa, found !=3D 1 << (order - new_order)); + + for (i =3D 0; i < (1 << order); i +=3D (1 << new_order)) + xa_erase(xa, index + i); + XA_BUG_ON(xa, !xa_empty(xa)); out: xas_destroy(&xas); xa_destroy(xa); --=20 2.53.0.rc1.225.gd81095ad13-goog