lkml.org 
[lkml]   [2023]   [Aug]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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
>

\
 
 \ /
  Last update: 2023-08-29 03:42    [W:0.084 / U:0.080 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site