blkcg: make ->cpd_init_fn() optional
authorTejun Heo <tj@kernel.org>
Wed, 28 Aug 2019 22:05:52 +0000 (15:05 -0700)
committerJens Axboe <axboe@kernel.dk>
Thu, 29 Aug 2019 03:17:03 +0000 (21:17 -0600)
For policies which can do enough initialization from ->cpd_alloc_fn(),
make ->cpd_init_fn() optional.

Signed-off-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
block/blk-cgroup.c

index 6a82ca3fb5cf72fb7b53b87fd1db3a03872540b3..78ccbdcfe7236cca0f6eeda44e61faa29fcb38df 100644 (file)
@@ -1475,7 +1475,8 @@ int blkcg_policy_register(struct blkcg_policy *pol)
                        blkcg->cpd[pol->plid] = cpd;
                        cpd->blkcg = blkcg;
                        cpd->plid = pol->plid;
-                       pol->cpd_init_fn(cpd);
+                       if (pol->cpd_init_fn)
+                               pol->cpd_init_fn(cpd);
                }
        }