Re: [PATCH] zswap: only save zswap header if zpool is shrinkable

From: Sergey Senozhatsky
Date: Thu Jan 11 2018 - 01:58:08 EST


Hello,

Yu Zhao, Dan, sorry for the delay


On (01/10/18 15:06), Dan Streetman wrote:
[..]
> Well, I think shrink vs evict an implementation detail, isn't it?
> That is, from zswap's perspective, there should be:
>
> zpool_evictable()
> if true, zswap needs to include the header on each compressed page,
> because the zpool may callback zpool->ops->evict() which calls
> zswap_writeback_entry() which expects the entry to start with a zswap
> header.
> if false, zswap doesn't need to include the header, because the zpool
> will never, ever call zpool->ops->evict
>
> zpool_shrink()
> this will try to shrink the zpool, using whatever
> zpool-implementation-specific shrinking method. If zpool_evictable()
> is true for this zpool, then zpool_shrink() *might* callback to
> zpool->ops->evict(), although it doesn't have to if it can shrink
> without evictions. If zpool_evictable() is false, then zpool_shrink()
> will never callback to zpool->ops->evict().

ACK on this!

-ss