Re: [dm-devel] dm thin: superblock may write succeed before other metadata blocks because of wirting metadata in async mode.

2018-06-19 Thread Mike Snitzer
On Mon, May 21 2018 at 8:53pm -0400, Monty Pavel wrote: > > If dm_bufio_write_dirty_buffers func is called by __commit_transaction > func and power loss happens during executing it, coincidencely > superblock wrote correctly but some metadata blocks didn't. The reason > is we write all

Re: [dm-devel] dm thin: superblock may write succeed before other metadata blocks because of wirting metadata in async mode.

2018-06-19 Thread Joe Thornber
On Tue, Jun 19, 2018 at 09:11:06AM -0400, Mike Snitzer wrote: > On Mon, May 21 2018 at 8:53pm -0400, > Monty Pavel wrote: > > > > > If dm_bufio_write_dirty_buffers func is called by __commit_transaction > > func and power loss happens during executing it, coincidencely > > superblock wrote

Re: [dm-devel] dm thin: superblock may write succeed before other metadata blocks because of wirting metadata in async mode.

2018-06-19 Thread Mike Snitzer
On Tue, Jun 19 2018 at 10:43am -0400, Joe Thornber wrote: > On Tue, Jun 19, 2018 at 09:11:06AM -0400, Mike Snitzer wrote: > > On Mon, May 21 2018 at 8:53pm -0400, > > Monty Pavel wrote: > > > > > > > > If dm_bufio_write_dirty_buffers func is called by __commit_transaction > > > func and

Re: [dm-devel] dm thin: superblock may write succeed before other metadata blocks because of wirting metadata in async mode.

2018-06-19 Thread monty
On Tue, Jun 19, 2018 at 11:00:32AM -0400, Mike Snitzer wrote: > > On Tue, Jun 19 2018 at 10:43am -0400, > Joe Thornber wrote: > > > On Tue, Jun 19, 2018 at 09:11:06AM -0400, Mike Snitzer wrote: > > > On Mon, May 21 2018 at 8:53pm -0400, > > > Monty Pavel wrote: > > > > > > > > > > > If

[dm-devel] [PATCH v3 0/5] bitmap: Introduce alloc/free helpers

2018-06-19 Thread Andy Shevchenko
A lot of code is using allocation of bitmaps using BITS_PER_LONG() macro and sizeof(unsigned long) operator. The readability suffers because of this. The series introduces three helpers, i.e. bitmap_alloc(), bitmap_zalloc() and bitmap_free(), to make it more cleaner. Patch 1 is a preparatory to

[dm-devel] [PATCH v3 4/5] Input: gpio-keys - Switch to bitmap_zalloc()

2018-06-19 Thread Andy Shevchenko
Switch to bitmap_zalloc() to show clearly what we are allocating. Besides that it returns pointer of bitmap type instead of opaque void *. Acked-by: Dmitry Torokhov Signed-off-by: Andy Shevchenko --- drivers/input/keyboard/gpio_keys.c | 8 1 file changed, 4 insertions(+), 4

[dm-devel] [PATCH v3 2/5] bitmap: Drop unnecessary 0 check for u32 array operations

2018-06-19 Thread Andy Shevchenko
The nbits == 0 is safe to be supplied to the function body, so, remove unnecessary checks in bitmap_to_arr32() and bitmap_from_arr32(). Acked-by: Yury Norov Signed-off-by: Andy Shevchenko --- lib/bitmap.c | 9 + 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/lib/bitmap.c

[dm-devel] [PATCH v3 1/5] md: Avoid namespace collision with bitmap API

2018-06-19 Thread Andy Shevchenko
bitmap API (include/linux/bitmap.h) has 'bitmap' prefix for its methods. On the other hand MD bitmap API is special case. Adding 'md' prefix to it to avoid name space collision. No functional changes intended. Signed-off-by: Andy Shevchenko --- drivers/md/dm-raid.c |

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); >>

[dm-devel] [PATCH v3 5/5] Input: evdev - Switch to bitmap API

2018-06-19 Thread Andy Shevchenko
Switch to bitmap API, i.e. bitmap_alloc(), bitmap_zalloc(), to show clearly what we are allocating. Besides that it returns pointer of bitmap type instead of opaque void *. While here, replace memcpy() with bitmap_copy() for sake of consistency. Acked-by: Dmitry Torokhov Signed-off-by: Andy

Re: [dm-devel] [PATCH v2 5/5] Input: evdev - Switch to bitmap_zalloc()

2018-06-19 Thread Andy Shevchenko
On Sat, 2018-06-16 at 12:16 -0700, Joe Perches wrote: > On Sat, 2018-06-16 at 21:45 +0300, Andy Shevchenko wrote: > > On Sat, Jun 16, 2018 at 12:46 AM Yury Norov > om> wrote: > > > On Fri, Jun 15, 2018 at 04:20:17PM +0300, Andy Shevchenko wrote: > > > > Switch to bitmap_zalloc() to show clearly

Re: [dm-devel] [PATCH v3 1/5] md: Avoid namespace collision with bitmap API

2018-06-19 Thread Andy Shevchenko
On Mon, 2018-06-18 at 09:44 -0400, Mike Snitzer wrote: > On Mon, Jun 18 2018 at 9:09am -0400, > Andy Shevchenko wrote: > > > bitmap API (include/linux/bitmap.h) has 'bitmap' prefix for its > > methods. > > > > On the other hand MD bitmap API is special case. > > Adding 'md' prefix to it to

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-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

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

2018-06-19 Thread Andy Shevchenko
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. Signed-off-by: Andy Shevchenko --- include/linux/bitmap.h | 8 lib/bitmap.c | 19 +++ 2

Re: [dm-devel] [PATCH 2/6] bcache: don't clone bio in bch_data_verify

2018-06-19 Thread Coly Li
On 2018/6/19 12:52 PM, Christoph Hellwig wrote: > We immediately overwrite the biovec array, so instead just allocate > a new bio and copy over the disk, setor and size. > > Signed-off-by: Christoph Hellwig It looks good to me. Acked-by: Coly Li Thanks. Coly Li > --- >