lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180109110141.GA91365@google.com>
Date:   Tue, 9 Jan 2018 03:01:41 -0800
From:   Yu Zhao <yuzhao@...gle.com>
To:     Sergey Senozhatsky <sergey.senozhatsky.work@...il.com>
Cc:     Dan Streetman <ddstreet@...e.org>,
        Seth Jennings <sjenning@...hat.com>,
        Minchan Kim <minchan@...nel.org>,
        Nitin Gupta <ngupta@...are.org>,
        Andrew Morton <akpm@...ux-foundation.org>, linux-mm@...ck.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH] zswap: only save zswap header if zpool is shrinkable

On Tue, Jan 09, 2018 at 01:48:17PM +0900, Sergey Senozhatsky wrote:
> On (01/08/18 14:51), Yu Zhao wrote:
> [..]
> >  int zpool_shrink(struct zpool *zpool, unsigned int pages,
> >  			unsigned int *reclaimed)
> >  {
> > -	return zpool->driver->shrink(zpool->pool, pages, reclaimed);
> > +	return zpool_shrinkable(zpool) ?
> > +	       zpool->driver->shrink(zpool->pool, pages, reclaimed) : -EINVAL;
> >  }
> >  
> >  /**
> > @@ -355,6 +356,20 @@ u64 zpool_get_total_size(struct zpool *zpool)
> >  	return zpool->driver->total_size(zpool->pool);
> >  }
> >  
> > +/**
> > + * zpool_shrinkable() - Test if zpool is shrinkable
> > + * @pool	The zpool to test
> > + *
> > + * Zpool is only shrinkable when it's created with struct
> > + * zpool_ops.evict and its driver implements struct zpool_driver.shrink.
> > + *
> > + * Returns: true if shrinkable; false otherwise.
> > + */
> > +bool zpool_shrinkable(struct zpool *zpool)
> > +{
> > +	return zpool->ops && zpool->ops->evict && zpool->driver->shrink;
> > +}
> 
> just a side note,
> it might be a bit confusing and maybe there is a better
> name for it. zsmalloc is shrinkable (we register a shrinker
> callback), but not in the way zpool defines it.

Thanks. Do zpool_evictable() and zpool->driver->evict make more sense?

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ