Re: [dm-devel] [PATCH v3 3/5] bitmap: Add bitmap_alloc(), bitmap_zalloc() and bitmap_free()

2018-06-26 Thread Andy Shevchenko
On Fri, 2018-06-22 at 11:46 -0700, Dmitry Torokhov wrote: > On Thu, Jun 21, 2018 at 05:13:39AM +0300, Andy Shevchenko wrote: > > On Tue, Jun 19, 2018 at 2:10 AM, Andrew Morton > > wrote: > > > On Mon, 18 Jun 2018 15:01:43 -0700 Dmitry Torokhov > > v...@gmail.com> wrote: > > > > We can't as we

Re: [dm-devel] [PATCH v3 3/5] bitmap: Add bitmap_alloc(), bitmap_zalloc() and bitmap_free()

2018-06-25 Thread Dmitry Torokhov
On Thu, Jun 21, 2018 at 05:13:39AM +0300, Andy Shevchenko wrote: > On Tue, Jun 19, 2018 at 2:10 AM, Andrew Morton > wrote: > > On Mon, 18 Jun 2018 15:01:43 -0700 Dmitry Torokhov > > wrote: > > >> We can't as we end up including bitmap.h (by the way of cpumask.h) > >> form slab.h, so we gen

Re: [dm-devel] [PATCH v3 3/5] bitmap: Add bitmap_alloc(), bitmap_zalloc() and bitmap_free()

2018-06-21 Thread Andy Shevchenko
On Tue, Jun 19, 2018 at 2:10 AM, Andrew Morton wrote: > On Mon, 18 Jun 2018 15:01:43 -0700 Dmitry Torokhov > wrote: >> We can't as we end up including bitmap.h (by the way of cpumask.h) >> form slab.h, so we gen circular dependency. > It's not just so easy. See below. > That info should have

Re: [dm-devel] [PATCH v3 3/5] bitmap: Add bitmap_alloc(), bitmap_zalloc() and bitmap_free()

2018-06-19 Thread Dmitry Torokhov
On Mon, Jun 18, 2018 at 2:14 PM Andrew Morton wrote: > > On Mon, 18 Jun 2018 16:10:01 +0300 Andy Shevchenko > wrote: > > > A lot of code become ugly because of open coding allocations for bitmaps. > > > > Introduce three helpers to allow users be more clear of intention > > and keep their code

Re: [dm-devel] [PATCH v3 3/5] bitmap: Add bitmap_alloc(), bitmap_zalloc() and bitmap_free()

2018-06-19 Thread Andy Shevchenko
On Tue, Jun 19, 2018 at 2:10 AM, Andrew Morton wrote: > On Mon, 18 Jun 2018 15:01:43 -0700 Dmitry Torokhov > wrote: > >> > > +unsigned long *bitmap_alloc(unsigned int nbits, gfp_t flags) >> > > +{ >> > > + return kmalloc_array(BITS_TO_LONGS(nbits), sizeof(unsigned long), >> > > flags); >>

Re: [dm-devel] [PATCH v3 3/5] bitmap: Add bitmap_alloc(), bitmap_zalloc() and bitmap_free()

2018-06-19 Thread Andy Shevchenko
On Tue, Jun 19, 2018 at 1:01 AM, Dmitry Torokhov wrote: > On Mon, Jun 18, 2018 at 2:14 PM Andrew Morton > wrote: >> >> On Mon, 18 Jun 2018 16:10:01 +0300 Andy Shevchenko >> wrote: >> >> > A lot of code become ugly because of open coding allocations for bitmaps. >> > >> > Introduce three

Re: [dm-devel] [PATCH v3 3/5] bitmap: Add bitmap_alloc(), bitmap_zalloc() and bitmap_free()

2018-06-18 Thread Andrew Morton
On Mon, 18 Jun 2018 15:01:43 -0700 Dmitry Torokhov wrote: > > > +unsigned long *bitmap_alloc(unsigned int nbits, gfp_t flags) > > > +{ > > > + return kmalloc_array(BITS_TO_LONGS(nbits), sizeof(unsigned long), > > > flags); > > > +} > > > +EXPORT_SYMBOL(bitmap_alloc); > > > + > > >

Re: [dm-devel] [PATCH v3 3/5] bitmap: Add bitmap_alloc(), bitmap_zalloc() and bitmap_free()

2018-06-18 Thread Andrew Morton
On Mon, 18 Jun 2018 16:10:01 +0300 Andy Shevchenko wrote: > A lot of code become ugly because of open coding allocations for bitmaps. > > Introduce three helpers to allow users be more clear of intention > and keep their code neat. > > ... > > +unsigned long *bitmap_alloc(unsigned int nbits,