[dm-devel] [PATCH 5/6] dm cache: add remove_cblock method to policy interface

Alasdair G Kergon agk at redhat.com
Tue Nov 12 00:18:52 UTC 2013


On Mon, Nov 11, 2013 at 12:20:47PM -0500, Mike Snitzer wrote:
> From: Joe Thornber <ejt at redhat.com>
 
> +static struct entry *epool_find(struct entry_pool *ep, dm_cblock_t cblock)
> +{
> +	struct entry *e = ep->entries + from_cblock(cblock);
> +	return e->hlist.pprev ? e : NULL;

Please use hlist_unhashed() rather than accessing pprev explicitly where possible.

static inline int hlist_unhashed(const struct hlist_node *h)
{
        return !h->pprev;
}

> +++ b/drivers/md/dm-cache-policy.h
> @@ -135,9 +135,6 @@ struct dm_cache_policy {
>  	 */
>  	int (*lookup)(struct dm_cache_policy *p, dm_oblock_t oblock, dm_cblock_t *cblock);
>  
> -	/*
> -	 * oblock must be a mapped block.  Must not block.
> -	 */
>  	void (*set_dirty)(struct dm_cache_policy *p, dm_oblock_t oblock);
>  	void (*clear_dirty)(struct dm_cache_policy *p, dm_oblock_t oblock);
  
So a policy can no longer assume oblock is a mapped block, and these functions
may block?

Is this consistent with 
          BUG_ON(!e || !in_cache(mq, e));
in __mq_set_clear_dirty?

Alasdair




More information about the dm-devel mailing list