[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAPDyKFqvYhPTenGEH=LZyJXb5rJKbyeds4rH+aRN=u6JH_eJ5A@mail.gmail.com>
Date: Thu, 17 Feb 2022 16:39:15 +0100
From: Ulf Hansson <ulf.hansson@...aro.org>
To: Yury Norov <yury.norov@...il.com>
Cc: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
Rasmus Villemoes <linux@...musvillemoes.dk>,
Andrew Morton <akpm@...ux-foundation.org>,
Michał Mirosław <mirq-linux@...e.qmqm.pl>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Peter Zijlstra <peterz@...radead.org>,
David Laight <david.laight@...lab.com>,
Joe Perches <joe@...ches.com>, Dennis Zhou <dennis@...nel.org>,
Emil Renner Berthing <kernel@...il.dk>,
Nicholas Piggin <npiggin@...il.com>,
Matti Vaittinen <matti.vaittinen@...rohmeurope.com>,
Alexey Klimov <aklimov@...hat.com>,
linux-kernel@...r.kernel.org,
Maxim Levitsky <maximlevitsky@...il.com>,
Alex Dubov <oakad@...oo.com>, Jens Axboe <axboe@...nel.dk>,
Luis Chamberlain <mcgrof@...nel.org>,
Colin Ian King <colin.king@...el.com>,
Arnd Bergmann <arnd@...db.de>,
Shubhankar Kuranagatti <shubhankarvk@...il.com>,
linux-mmc@...r.kernel.org,
Shubhankar Kuranagatti <shubhankar.vk@...il.com>
Subject: Re: [PATCH 29/49] memstick: replace bitmap_weight with
bitmap_weight_eq where appropriate
On Fri, 11 Feb 2022 at 00:55, Yury Norov <yury.norov@...il.com> wrote:
>
> msb_validate_used_block_bitmap() calls bitmap_weight() to compare the
> weight of bitmap with a given number. We can do it more efficiently with
> bitmap_weight_eq because conditional bitmap_weight may stop traversing the
> bitmap earlier, as soon as condition is (or can't be) met.
>
> Signed-off-by: Yury Norov <yury.norov@...il.com>
> Acked-by: Ulf Hansson <ulf.hansson@...aro.org>
> Acked-by: Shubhankar Kuranagatti <shubhankar.vk@...il.com>
Applied for next, thanks!
Kind regards
Uffe
> ---
> drivers/memstick/core/ms_block.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/memstick/core/ms_block.c b/drivers/memstick/core/ms_block.c
> index 0cda6c6baefc..5cdd987e78f7 100644
> --- a/drivers/memstick/core/ms_block.c
> +++ b/drivers/memstick/core/ms_block.c
> @@ -155,8 +155,8 @@ static int msb_validate_used_block_bitmap(struct msb_data *msb)
> for (i = 0; i < msb->zone_count; i++)
> total_free_blocks += msb->free_block_count[i];
>
> - if (msb->block_count - bitmap_weight(msb->used_blocks_bitmap,
> - msb->block_count) == total_free_blocks)
> + if (bitmap_weight_eq(msb->used_blocks_bitmap, msb->block_count,
> + msb->block_count - total_free_blocks))
> return 0;
>
> pr_err("BUG: free block counts don't match the bitmap");
> --
> 2.32.0
>
Powered by blists - more mailing lists