Messages in this thread | | | Date | Thu, 17 Aug 2023 12:45:23 +0300 | From | Andy Shevchenko <> | Subject | Re: [PATCH v3 3/8] bitmap: fix opencoded bitmap_allocate_region() |
| |
On Tue, Aug 15, 2023 at 04:36:23PM -0700, Yury Norov wrote: > bitmap_find_region() opencodes bitmap_allocate_region(). Fix it.
...
> for (pos = 0; (end = pos + BIT(order)) <= bits; pos = end) { > - if (!__reg_op(bitmap, pos, order, REG_OP_ISFREE)) > - continue; > - __reg_op(bitmap, pos, order, REG_OP_ALLOC); > - return pos; > + if (!bitmap_allocate_region(bitmap, pos, order)) > + return pos;
You can also leave more code untouched, by replacing only first conditional with
if (bitmap_allocate_region(bitmap, pos, order)) continue; return pos;
> } > return -ENOMEM;
-- With Best Regards, Andy Shevchenko
| |