Skip to content

Commit

Permalink
block: fix a build error
Browse files Browse the repository at this point in the history
The code is only for blkcg not for all cgroups

Fixes: d4478e9 ("block/loop: make loop cgroup aware")
Reported-by: kbuild test robot <[email protected]>
Signed-off-by: Shaohua Li <[email protected]>
Signed-off-by: Jens Axboe <[email protected]>
  • Loading branch information
shligit authored and axboe committed Sep 26, 2017
1 parent 9979d54 commit 0b508bc
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion drivers/block/loop.c
Original file line number Diff line number Diff line change
Expand Up @@ -1692,7 +1692,7 @@ static blk_status_t loop_queue_rq(struct blk_mq_hw_ctx *hctx,
}

/* always use the first bio's css */
#ifdef CONFIG_CGROUPS
#ifdef CONFIG_BLK_CGROUP
if (cmd->use_aio && cmd->rq->bio && cmd->rq->bio->bi_css) {
cmd->css = cmd->rq->bio->bi_css;
css_get(cmd->css);
Expand Down
2 changes: 1 addition & 1 deletion include/linux/kthread.h
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ bool kthread_cancel_delayed_work_sync(struct kthread_delayed_work *work);

void kthread_destroy_worker(struct kthread_worker *worker);

#ifdef CONFIG_CGROUPS
#ifdef CONFIG_BLK_CGROUP
void kthread_associate_blkcg(struct cgroup_subsys_state *css);
struct cgroup_subsys_state *kthread_blkcg(void);
#else
Expand Down
8 changes: 4 additions & 4 deletions kernel/kthread.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ struct kthread {
void *data;
struct completion parked;
struct completion exited;
#ifdef CONFIG_CGROUPS
#ifdef CONFIG_BLK_CGROUP
struct cgroup_subsys_state *blkcg_css;
#endif
};
Expand Down Expand Up @@ -83,7 +83,7 @@ void free_kthread_struct(struct task_struct *k)
* or if kmalloc() in kthread() failed.
*/
kthread = to_kthread(k);
#ifdef CONFIG_CGROUPS
#ifdef CONFIG_BLK_CGROUP
WARN_ON_ONCE(kthread && kthread->blkcg_css);
#endif
kfree(kthread);
Expand Down Expand Up @@ -224,7 +224,7 @@ static int kthread(void *_create)
self->data = data;
init_completion(&self->exited);
init_completion(&self->parked);
#ifdef CONFIG_CGROUPS
#ifdef CONFIG_BLK_CGROUP
self->blkcg_css = NULL;
#endif
current->vfork_done = &self->exited;
Expand Down Expand Up @@ -1166,7 +1166,7 @@ void kthread_destroy_worker(struct kthread_worker *worker)
}
EXPORT_SYMBOL(kthread_destroy_worker);

#ifdef CONFIG_CGROUPS
#ifdef CONFIG_BLK_CGROUP
/**
* kthread_associate_blkcg - associate blkcg to current kthread
* @css: the cgroup info
Expand Down

0 comments on commit 0b508bc

Please sign in to comment.