> +static void brd_free_page_rcu(struct rcu_head *head)
> +{
> +     struct page *page = container_of(head, struct page, rcu_head);
> +     __free_page(page);

Nit: missing empty line here.  Although I see no point in the local
variable anyay.

> +}
> +
> +static void brd_free_page(struct brd_device *brd, sector_t sector)
> +{
> +     struct page *page;
> +     pgoff_t idx;
> +
> +     idx = sector >> PAGE_SECTORS_SHIFT;
> +     page = xa_erase(&brd->brd_pages, idx);
> +
> +     if (page) {
> +             BUG_ON(page->index != idx);
> +             call_rcu(&page->rcu_head, brd_free_page_rcu);
> +     }

Doing one call_rcu per page is horribly inefficient.  Please look into
batching this up.

> +static bool discard = false;
> +module_param(discard, bool, 0444);
> +MODULE_PARM_DESC(discard, "Support discard");

Doing this as a global paramter that can't even be changed at run time
does not feel very user friendly.

--
dm-devel mailing list
dm-devel@redhat.com
https://listman.redhat.com/mailman/listinfo/dm-devel

Reply via email to