Re: [PATCH 2/2] zram: do not count duplicated pages as compressed

2017-05-21 Thread Minchan Kim
On Sun, May 21, 2017 at 12:04:27AM -0700, Christoph Hellwig wrote: > On Wed, May 17, 2017 at 05:32:12PM +0900, Minchan Kim wrote: > > Is block device(esp, zram which is compressed ram block device) okay to > > return garbage when ongoing overwrite IO fails? > > > > O_DIRECT write 4 block "aaa.." -

Re: [PATCH 2/2] zram: do not count duplicated pages as compressed

2017-05-21 Thread Christoph Hellwig
On Wed, May 17, 2017 at 05:32:12PM +0900, Minchan Kim wrote: > Is block device(esp, zram which is compressed ram block device) okay to > return garbage when ongoing overwrite IO fails? > > O_DIRECT write 4 block "aaa.." -> success > read 4 block "aaa.." -> success > O_DIRECT write 4 block "bbb.."

Re: [PATCH 2/2] zram: do not count duplicated pages as compressed

2017-05-17 Thread Minchan Kim
Hi Sergey, On Wed, May 17, 2017 at 06:14:23PM +0900, Sergey Senozhatsky wrote: > Hello Minchan, > > On (05/17/17 17:32), Minchan Kim wrote: > [..] > > > what we can return now is a `partially updated' data, with some new > > > and some stale pages. this is quite unlikely to end up anywhere good.

Re: [PATCH 2/2] zram: do not count duplicated pages as compressed

2017-05-17 Thread Sergey Senozhatsky
Hello Minchan, On (05/17/17 17:32), Minchan Kim wrote: [..] > > what we can return now is a `partially updated' data, with some new > > and some stale pages. this is quite unlikely to end up anywhere good. > > am I wrong? > > > > why does `rd block 4' in your case causes Oops? as a worst case sce

Re: [PATCH 2/2] zram: do not count duplicated pages as compressed

2017-05-17 Thread Minchan Kim
Hi Sergey, On Tue, May 16, 2017 at 04:36:17PM +0900, Sergey Senozhatsky wrote: > On (05/16/17 16:16), Minchan Kim wrote: > > > but would this be correct? the data is not valid - we failed to store > > > the valid one. but instead we assure application that read()/swapin/etc., > > > depending on th

Re: [PATCH 2/2] zram: do not count duplicated pages as compressed

2017-05-16 Thread Sergey Senozhatsky
On (05/16/17 16:16), Minchan Kim wrote: > > but would this be correct? the data is not valid - we failed to store > > the valid one. but instead we assure application that read()/swapin/etc., > > depending on the usage scenario, is successful (even though the data is > > not what application really

Re: [PATCH 2/2] zram: do not count duplicated pages as compressed

2017-05-16 Thread Minchan Kim
On Tue, May 16, 2017 at 02:45:33PM +0900, Sergey Senozhatsky wrote: > On (05/16/17 14:26), Minchan Kim wrote: > [..] > > > + /* > > > +* Free memory associated with this sector > > > +* before overwriting unused sectors. > > > +*/ > > > + zram_slot_lock(zram, ind

Re: [PATCH 2/2] zram: do not count duplicated pages as compressed

2017-05-15 Thread Sergey Senozhatsky
On (05/16/17 14:26), Minchan Kim wrote: [..] > > + /* > > +* Free memory associated with this sector > > +* before overwriting unused sectors. > > +*/ > > + zram_slot_lock(zram, index); > > + zram_free_page(zram, index); > > Hmm, zram_free should happen on

Re: [PATCH 2/2] zram: do not count duplicated pages as compressed

2017-05-15 Thread Minchan Kim
On Tue, May 16, 2017 at 11:36:15AM +0900, Sergey Senozhatsky wrote: > > > > @@ -794,7 +801,15 @@ static int __zram_bvec_write(struct zram *zram, > > > > struct bio_vec *bvec, u32 index) > > > > entry = zram_dedup_find(zram, page, &checksum); > > > > if (entry) { > > > >

Re: [PATCH 2/2] zram: do not count duplicated pages as compressed

2017-05-15 Thread Sergey Senozhatsky
Hello Minchan, On (05/16/17 10:59), Minchan Kim wrote: > Hi Sergey, > [..] > You mean this? > > static void zram_free_page(..) { > if (zram_test_flag(zram, index, ZRAM_SAME)) > ... > > if (!entry) > return; > > if (zram_dedup_enabled(zram

Re: [PATCH 2/2] zram: do not count duplicated pages as compressed

2017-05-15 Thread Minchan Kim
Hi Sergey, On Tue, May 16, 2017 at 10:30:22AM +0900, Sergey Senozhatsky wrote: > On (05/15/17 16:41), Minchan Kim wrote: > [..] > > diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c > > index b885356551e9..8152e405117b 100644 > > --- a/drivers/block/zram/zram_drv.c > > +++

Re: [PATCH 2/2] zram: do not count duplicated pages as compressed

2017-05-15 Thread Sergey Senozhatsky
On (05/15/17 16:41), Minchan Kim wrote: [..] > diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c > index b885356551e9..8152e405117b 100644 > --- a/drivers/block/zram/zram_drv.c > +++ b/drivers/block/zram/zram_drv.c > @@ -624,15 +624,22 @@ static void zram_free_page(struct z