return pol && test_bit(pol->plid, q->blkcg_pols);
}
-static void blkg_free_workfn(struct work_struct *work)
+static void blkg_free(struct blkcg_gq *blkg)
{
- struct blkcg_gq *blkg = container_of(work, struct blkcg_gq,
- free_work);
struct request_queue *q = blkg->q;
int i;
kfree(blkg);
}
-/**
- * blkg_free - free a blkg
- * @blkg: blkg to free
- *
- * Free @blkg which may be partially allocated.
- */
-static void blkg_free(struct blkcg_gq *blkg)
+static void blkg_free_workfn(struct work_struct *work)
{
- if (!blkg)
- return;
-
- /*
- * Both ->pd_free_fn() and request queue's release handler may
- * sleep, so free us by scheduling one work func
- */
- INIT_WORK(&blkg->free_work, blkg_free_workfn);
- schedule_work(&blkg->free_work);
+ blkg_free(container_of(work, struct blkcg_gq, free_work));
}
static void __blkg_release(struct rcu_head *rcu)
/* release the blkcg and parent blkg refs this blkg has been holding */
css_put(&blkg->blkcg->css);
- blkg_free(blkg);
+
+ /* ->pd_free_fn() may sleep, so free from a work queue */
+ INIT_WORK(&blkg->free_work, blkg_free_workfn);
+ schedule_work(&blkg->free_work);
}
/*