Messages in this thread | | | Date | Mon, 28 Aug 2023 18:36:18 -0700 | From | Yury Norov <> | Subject | Re: [PATCH v3 3/8] bitmap: fix opencoded bitmap_allocate_region() |
| |
On Thu, Aug 17, 2023 at 12:45:23PM +0300, Andy Shevchenko wrote: > 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;
This looks weird, and doesn't help preserving history because the following patch moves everything from c-file to the header. I'd prefer to keep this as is.
> > > } > > return -ENOMEM; > > -- > With Best Regards, > Andy Shevchenko >
| |