From patchwork Wed Dec 18 15:46:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kemeng Shi X-Patchwork-Id: 13913108 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id CD4B9E77188 for ; Wed, 18 Dec 2024 06:48:21 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6C1266B0096; Wed, 18 Dec 2024 01:48:18 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 5C3266B0095; Wed, 18 Dec 2024 01:48:18 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 261336B0092; Wed, 18 Dec 2024 01:48:18 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id E606E6B0095 for ; Wed, 18 Dec 2024 01:48:17 -0500 (EST) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 962711C6E28 for ; Wed, 18 Dec 2024 06:48:17 +0000 (UTC) X-FDA: 82907149710.22.4F42434 Received: from dggsgout12.his.huawei.com (dggsgout12.his.huawei.com [45.249.212.56]) by imf26.hostedemail.com (Postfix) with ESMTP id B3365140002 for ; Wed, 18 Dec 2024 06:47:49 +0000 (UTC) Authentication-Results: imf26.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf26.hostedemail.com: domain of shikemeng@huaweicloud.com designates 45.249.212.56 as permitted sender) smtp.mailfrom=shikemeng@huaweicloud.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1734504481; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=YVrUUmNB/6qCylmXgGwaFI/+5BomZYbmrTRX2XpHfnA=; b=BdfVhKTexvo5NTOWfXm53GB4YOA7Pr5RLv3bYGTV/H90EyPsTe5csKujDlP+ogZRDsCfQo RLSGLJYHVjSkY525wSlHV6HSu0sA4cTz8fEb9bsqwsFG3hEKlcUlMk8TVTcY6mBqhBfv1Z eqIBNmhTHsnOv+UsqmliWihVk3RUP5U= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1734504481; a=rsa-sha256; cv=none; b=yxhS4YsL2mIgaF6AAOgwwEd0gybOlU6A+WKXPkj7mgkUHJrQpqf4Lg+XwSJ/8q3I2s3j0J Iqr/EEh5CmpZNOdKuoUSFCpRuaJH5de2vBYZ51IhOsuixrIpMj5UTx+qXTwsC1AWML4wgP jTD1OjX6ui4WAxp/IUOsEdExAJ2pwEc= ARC-Authentication-Results: i=1; imf26.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf26.hostedemail.com: domain of shikemeng@huaweicloud.com designates 45.249.212.56 as permitted sender) smtp.mailfrom=shikemeng@huaweicloud.com Received: from mail.maildlp.com (unknown [172.19.163.235]) by dggsgout12.his.huawei.com (SkyGuard) with ESMTP id 4YCkl96lq0z4f3kFt for ; Wed, 18 Dec 2024 14:47:49 +0800 (CST) Received: from mail02.huawei.com (unknown [10.116.40.112]) by mail.maildlp.com (Postfix) with ESMTP id 6F8911A0568 for ; Wed, 18 Dec 2024 14:48:09 +0800 (CST) Received: from huaweicloud.com (unknown [10.175.101.6]) by APP1 (Coremail) with SMTP id cCh0CgA33a4mcGJnxKU7Ew--.4083S7; Wed, 18 Dec 2024 14:48:09 +0800 (CST) From: Kemeng Shi To: akpm@linux-foundation.org, willy@infradead.org Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-nfs@vger.kernel.org Subject: [PATCH v4 5/5] Xarray: use xa_mark_t in xas_squash_marks() to keep code consistent Date: Wed, 18 Dec 2024 23:46:13 +0800 Message-Id: <20241218154613.58754-6-shikemeng@huaweicloud.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20241218154613.58754-1-shikemeng@huaweicloud.com> References: <20241218154613.58754-1-shikemeng@huaweicloud.com> MIME-Version: 1.0 X-CM-TRANSID: cCh0CgA33a4mcGJnxKU7Ew--.4083S7 X-Coremail-Antispam: 1UD129KBjvJXoW7Cw1UuF13JryrGFWxCFyfWFg_yoW8GrWkpF 97C3s8Ka1xA3WUKrnFvan7t345Ja1kK3yjyr4xGwnayFZ8Gr1Yqay7tryjqFnxGFy8ZFy3 Cr1Fg3y5Wa1UZw7anT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUPab4IE77IF4wAFF20E14v26rWj6s0DM7CY07I20VC2zVCF04k2 6cxKx2IYs7xG6rWj6s0DM7CIcVAFz4kK6r1j6r18M280x2IEY4vEnII2IxkI6r1a6r45M2 8IrcIa0xkI8VA2jI8067AKxVWUAVCq3wA2048vs2IY020Ec7CjxVAFwI0_Xr0E3s1l8cAv FVAK0II2c7xJM28CjxkF64kEwVA0rcxSw2x7M28EF7xvwVC0I7IYx2IY67AKxVW7JVWDJw A2z4x0Y4vE2Ix0cI8IcVCY1x0267AKxVW8Jr0_Cr1UM28EF7xvwVC2z280aVAFwI0_GcCE 3s1l84ACjcxK6I8E87Iv6xkF7I0E14v26rxl6s0DM2AIxVAIcxkEcVAq07x20xvEncxIr2 1l5I8CrVACY4xI64kE6c02F40Ex7xfMcIj6xIIjxv20xvE14v26r1j6r18McIj6I8E87Iv 67AKxVWUJVW8JwAm72CE4IkC6x0Yz7v_Jr0_Gr1lF7xvr2IYc2Ij64vIr41lc7CjxVAaw2 AFwI0_JF0_Jw1l42xK82IYc2Ij64vIr41l4I8I3I0E4IkC6x0Y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ONKXnb5ZSlNsYjba7CquYfFB2NNhMhYZa3exFTsgYEqOx+VinOyUh58hE6QMNmpUN60AZZBPm02VLTfvxanUkb7wooRidksbhFnaJv6DiR/LhlhfRESZl4iMn8JvLPRqp3bDV0LffWcf3o/lhnQ+bjzYnqi4tpOvL3EScejYXVdrjzlQMj7+7WpnBKftqNR9ncfGNLGaRPI5zHRwoPhwv9+epUNa2v8K532RVHL9529ORBxw5YWQp3oAUWOKHAt0Gwmtd6J+pfs97DxR7hlntcD5cpTbMZYk4pyW2y7lr67xgMxSiRX/aZ+mtc7fPydlnRUTYS6Ndu+4rfyky+oDBDSdESUJrYUIbnTHxPO1pHOsdNwVo997IroGdu G33y9vve Gic82gVHoqAA2lXOjqGIxH/5YaYeBK4DpmacYoiHBqUvH0RMgO/azkn3fppGREnFyUWTuYZw1akQbkgiOEKUM5TH9KyuyK7D9WrP+xHX4SH0pHdBWeTWVhuGIDfhUDiPbRIvNnQ+XzBGVXj3iAD2whPcA9UGf1wvtGW8s2ZWusqhVtXwlSZsM4+Wv2RseJ/6LRuZGUJYU5qFARJ5Eg8sbhyueNw== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Besides xas_squash_marks(), all functions use xa_mark_t type to iterate all possible marks. Use xa_mark_t in xas_squash_marks() to keep code consistent. Signed-off-by: Kemeng Shi --- lib/xarray.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/lib/xarray.c b/lib/xarray.c index 4231af284bd8..a74795911f1c 100644 --- a/lib/xarray.c +++ b/lib/xarray.c @@ -125,16 +125,20 @@ static inline void node_mark_all(struct xa_node *node, xa_mark_t mark) */ static void xas_squash_marks(const struct xa_state *xas) { - unsigned int mark = 0; + xa_mark_t mark = 0; unsigned int limit = xas->xa_offset + xas->xa_sibs + 1; - do { - unsigned long *marks = xas->xa_node->marks[mark]; - if (find_next_bit(marks, limit, xas->xa_offset + 1) == limit) - continue; - __set_bit(xas->xa_offset, marks); - bitmap_clear(marks, xas->xa_offset + 1, xas->xa_sibs); - } while (mark++ != (__force unsigned)XA_MARK_MAX); + for (;;) { + unsigned long *marks = node_marks(xas->xa_node, mark); + + if (find_next_bit(marks, limit, xas->xa_offset + 1) != limit) { + __set_bit(xas->xa_offset, marks); + bitmap_clear(marks, xas->xa_offset + 1, xas->xa_sibs); + } + if (mark == XA_MARK_MAX) + break; + mark_inc(mark); + } } /* extracts the offset within this node from the index */