linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Yu Zhao <yuzhao@google.com>
To: Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>
Cc: Dan Streetman <ddstreet@ieee.org>,
	Seth Jennings <sjenning@redhat.com>,
	Minchan Kim <minchan@kernel.org>, Nitin Gupta <ngupta@vflare.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] zswap: only save zswap header if zpool is shrinkable
Date: Tue, 9 Jan 2018 03:01:41 -0800	[thread overview]
Message-ID: <20180109110141.GA91365@google.com> (raw)
In-Reply-To: <20180109044817.GB6953@jagdpanzerIV>

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?

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  reply	other threads:[~2018-01-09 11:01 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-08 22:51 [PATCH] zswap: only save zswap header if zpool is shrinkable Yu Zhao
2018-01-09  2:35 ` Sergey Senozhatsky
2018-01-09  4:48 ` Sergey Senozhatsky
2018-01-09 11:01   ` Yu Zhao [this message]
2018-01-09 18:25 ` Dan Streetman
2018-01-09 22:47   ` Yu Zhao
2018-01-10 20:06     ` Dan Streetman
2018-01-10 22:23       ` Yu Zhao
2018-01-11  6:57       ` Sergey Senozhatsky
2018-01-10 22:47 ` [PATCH v2] zswap: only save zswap header when necessary Yu Zhao
2018-01-10 22:56   ` [PATCH v3] " Yu Zhao
2018-01-11  7:04     ` Sergey Senozhatsky
2018-01-11 21:59     ` Dan Streetman
2018-01-10 23:00   ` [PATCH v2] " Yu Zhao

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180109110141.GA91365@google.com \
    --to=yuzhao@google.com \
    --cc=akpm@linux-foundation.org \
    --cc=ddstreet@ieee.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=minchan@kernel.org \
    --cc=ngupta@vflare.org \
    --cc=sergey.senozhatsky.work@gmail.com \
    --cc=sjenning@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).