From patchwork Fri Dec 13 12:25:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kemeng Shi X-Patchwork-Id: 13906413 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 18D62E7716A for ; Fri, 13 Dec 2024 03:27:26 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E0E516B0095; Thu, 12 Dec 2024 22:27:20 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id AE9F96B009A; Thu, 12 Dec 2024 22:27:20 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 976B06B0099; Thu, 12 Dec 2024 22:27:20 -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 EC1D26B0095 for ; Thu, 12 Dec 2024 22:27:19 -0500 (EST) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 90F6DAF148 for ; Fri, 13 Dec 2024 03:27:19 +0000 (UTC) X-FDA: 82888499358.21.0AFF751 Received: from dggsgout12.his.huawei.com (dggsgout12.his.huawei.com [45.249.212.56]) by imf13.hostedemail.com (Postfix) with ESMTP id 626D120009 for ; Fri, 13 Dec 2024 03:26:51 +0000 (UTC) Authentication-Results: imf13.hostedemail.com; dkim=none; spf=pass (imf13.hostedemail.com: domain of shikemeng@huaweicloud.com designates 45.249.212.56 as permitted sender) smtp.mailfrom=shikemeng@huaweicloud.com; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1734060420; 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=LF8+HTWahPc0W0FMadf544Y7AesIwah8r6akN/LAR6ZOJ1lJthl6CeLkZwm8IcWkkHCsot 63kXlLUznSMN9uKQ63B/Aw4Rs2ctBwFYgCg2NQ8F9zC7b9LIx1ECmbueUgYpFsM+3/b/un 5d/+LlsyIY8jHJdAZNsGPkmvpQWjKgk= ARC-Authentication-Results: i=1; imf13.hostedemail.com; dkim=none; spf=pass (imf13.hostedemail.com: domain of shikemeng@huaweicloud.com designates 45.249.212.56 as permitted sender) smtp.mailfrom=shikemeng@huaweicloud.com; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1734060420; a=rsa-sha256; cv=none; b=xM67X03lq0WF87RbWEZx2wOMTWMuhwR2e/lFQcN3vOGhmaxVJpaj6gT4cRDobBVgyc3ZKh gfnI9e5ZZVSf7Em7OENR/Q+emULhNqf8H49cbQurOM4debGvgZmebGUJMVoqbzEjcW777C fu8UN6crWK2JxmqpD3J5r1Iie1k4mq0= Received: from mail.maildlp.com (unknown [172.19.93.142]) by dggsgout12.his.huawei.com (SkyGuard) with ESMTP id 4Y8ZWb5mBQz4f3jHy for ; Fri, 13 Dec 2024 11:26:51 +0800 (CST) Received: from mail02.huawei.com (unknown [10.116.40.128]) by mail.maildlp.com (Postfix) with ESMTP id 244CD1A018D for ; Fri, 13 Dec 2024 11:27:11 +0800 (CST) Received: from huaweicloud.com (unknown [10.175.101.6]) by APP4 (Coremail) with SMTP id gCh0CgBHcISMqVtnfJ3KEQ--.55430S7; Fri, 13 Dec 2024 11:27:11 +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 Subject: [PATCH v3 5/5] Xarray: use xa_mark_t in xas_squash_marks() to keep code consistent Date: Fri, 13 Dec 2024 20:25:23 +0800 Message-Id: <20241213122523.12764-6-shikemeng@huaweicloud.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20241213122523.12764-1-shikemeng@huaweicloud.com> References: <20241213122523.12764-1-shikemeng@huaweicloud.com> MIME-Version: 1.0 X-CM-TRANSID: gCh0CgBHcISMqVtnfJ3KEQ--.55430S7 X-Coremail-Antispam: 1UD129KBjvJXoW7Cw1UuF13JryrGFWxCFyfWFg_yoW8GrWkpF 97C3s8Ka1xA3WUKrnFvan7t345Ja1kK3yjyr4xGwnayFZ8Gr1Yqay7tryjqFnxGFy8ZFy3 Cr1Fg3y5Wa1UZw7anT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUPIb4IE77IF4wAFF20E14v26rWj6s0DM7CY07I20VC2zVCF04k2 6cxKx2IYs7xG6rWj6s0DM7CIcVAFz4kK6r1j6r18M280x2IEY4vEnII2IxkI6r1a6r45M2 8IrcIa0xkI8VA2jI8067AKxVWUAVCq3wA2048vs2IY020Ec7CjxVAFwI0_Xr0E3s1l8cAv FVAK0II2c7xJM28CjxkF64kEwVA0rcxSw2x7M28EF7xvwVC0I7IYx2IY67AKxVW5JVW7Jw A2z4x0Y4vE2Ix0cI8IcVCY1x0267AKxVWxJVW8Jr1l84ACjcxK6I8E87Iv67AKxVW0oVCq 3wA2z4x0Y4vEx4A2jsIEc7CjxVAFwI0_GcCE3s1le2I262IYc4CY6c8Ij28IcVAaY2xG8w Aqx4xG64xvF2IEw4CE5I8CrVC2j2WlYx0E2Ix0cI8IcVAFwI0_Jr0_Jr4lYx0Ex4A2jsIE 14v26r1j6r4UMcvjeVCFs4IE7xkEbVWUJVW8JwACjcxG0xvY0x0EwIxGrwCY1x0262kKe7 AKxVWUAVWUtwCF04k20xvY0x0EwIxGrwCFx2IqxVCFs4IE7xkEbVWUJVW8JwC20s026c02 F40E14v26r1j6r18MI8I3I0E7480Y4vE14v26r106r1rMI8E67AF67kF1VAFwI0_JF0_Jw 1lIxkGc2Ij64vIr41lIxAIcVC0I7IYx2IY67AKxVWUCVW8JwCI42IY6xIIjxv20xvEc7Cj xVAFwI0_Gr0_Cr1lIxAIcVCF04k26cxKx2IYs7xG6r1j6r1xMIIF0xvEx4A2jsIE14v26r 1j6r4UMIIF0xvEx4A2jsIEc7CjxVAFwI0_Gr0_Gr1UYxBIdaVFxhVjvjDU0xZFpf9x07ja g4hUUUUU= X-CM-SenderInfo: 5vklyvpphqwq5kxd4v5lfo033gof0z/ X-Rspamd-Server: rspam05 X-Stat-Signature: bq9y7k1djri7ue9geqoywab4jh4iwy8o X-Rspamd-Queue-Id: 626D120009 X-Rspam-User: X-HE-Tag: 1734060411-537960 X-HE-Meta: U2FsdGVkX1+7RkvTE8u1Fhh4lAyoihuxNbT+Ufd0TaIGFuvPRLkiWh5cyqd1L/39SHeGDGIwRA38q+wwSBxzneuYjxsh/o26Hu3XIv1AzYnFRhuuHhazAjnDmXsUEoAAAYMMlbLZUaj8xvDAv9bUcORBRYeomCa7atSCNhuYL5j/mx3Fpfyaa/y6yqQJCVkwZB6Re7vfgeTDu3JVL3iV12XX8E3rA+MuaUsT93X6hxkBvgccGL2FSPVW/eUqauvrN4aZMJhxDnpp1ZrFBT7+ACGcGQvprZBiP3Yw6RTFZttC6PHkG59zEU1OtNDE1rkcS+YSknKCLjz7TaCgdeqr+UXE4ibnfRL6wwrjwHg59jKqbwNWMaU3axRMt6BHjIrtlcbqVu+PhFG+vK6XHjcfWlYhH724dZIvb7koazoyOCulRunohN9LYdE+eUeO7QnFSQgKLnzOxEHx0JokPz6Xyr56wwRl11Qeo0DuNr9eez6oJalUwzGQQw/gVo/m7ek/BrTNry097avcvdTdq14ECivX9QiJDPPlAuqXW5qoYCQ4qW7HE7eOsdkuiB+xU13tqBVwKJbHTfITT4Jwkzey3OzWZFL2/ZMFQAkkhIDWwip9BApADBLt8vWQJFDRdgprfiNSqUR5JthwqMD5LaODYha0lgMcnZXDJFtxvvuQJg52/yeLkDV5AROeTNP0Z2wRTkXb9e2/7TN2FKXnOic280tOVFOy8SbxN3vuJYHz8lyEzkRM3iTwARPTB/drJeBeANnaR9O/wIYZTJ0mRTHfV8X7fF3xyYoay7KBAOdGUwfXppFUkUwdniKHbeNqztlPeuTwDddQvLqeOnrKQxJDVGcCtj5XCqkh2DjnT9KJ/+zbjxYMg7ENe9KSAyVdgcq6y0ZjzxUFQsnGZ8iW5/DbEg4ZqTuH2WV/uTI1nlJ6+g/2jl6KxWdtEFT+4ddNoxk+7IzCLMS1HUiJ4XfPkQ5 5zefoghq T7uDDtBr4AzvAi7Mm/7jtO4dciaOY1B7h0XDNA6n0gidtXzkAV7YNodbX0wi2ouI62Xl3b3NfTJBzpmTp3Io2KcLjToigmZmxF+uVctebINpHasGjPtl2XRh0DvOkbskTMkHBgSRNOhiehPncJg12mWe88K0dWuklVAGdCttGuuEMVSGkbCg2zogkKeUGwSeccV+Vy9Q7DAY/6ChS0Fp8yYomKQ== 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 */