Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit dd6cf3e1 authored by Shaohua Li's avatar Shaohua Li Committed by Jens Axboe
Browse files

blk: clean up plug



Current code looks like inner plug gets flushed with a
blk_finish_plug(). Actually it's a nop. All requests/callbacks are added
to current->plug, while only outmost plug is assigned to current->plug.
So inner plug always has empty request/callback list, which makes
blk_flush_plug_list() a nop. This tries to make the code more clear.

Signed-off-by: default avatarShaohua Li <shli@fb.com>
Reviewed-by: default avatarJeff Moyer <jmoyer@redhat.com>
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarJens Axboe <axboe@fb.com>
parent 9dc6c806
Loading
Loading
Loading
Loading
+12 −12
Original line number Original line Diff line number Diff line
@@ -3032,22 +3032,21 @@ void blk_start_plug(struct blk_plug *plug)
{
{
	struct task_struct *tsk = current;
	struct task_struct *tsk = current;


	/*
	 * If this is a nested plug, don't actually assign it.
	 */
	if (tsk->plug)
		return;

	INIT_LIST_HEAD(&plug->list);
	INIT_LIST_HEAD(&plug->list);
	INIT_LIST_HEAD(&plug->mq_list);
	INIT_LIST_HEAD(&plug->mq_list);
	INIT_LIST_HEAD(&plug->cb_list);
	INIT_LIST_HEAD(&plug->cb_list);

	/*
	 * If this is a nested plug, don't actually assign it. It will be
	 * flushed on its own.
	 */
	if (!tsk->plug) {
	/*
	/*
	 * Store ordering should not be needed here, since a potential
	 * Store ordering should not be needed here, since a potential
	 * preempt will imply a full memory barrier
	 * preempt will imply a full memory barrier
	 */
	 */
	tsk->plug = plug;
	tsk->plug = plug;
}
}
}
EXPORT_SYMBOL(blk_start_plug);
EXPORT_SYMBOL(blk_start_plug);


static int plug_rq_cmp(void *priv, struct list_head *a, struct list_head *b)
static int plug_rq_cmp(void *priv, struct list_head *a, struct list_head *b)
@@ -3193,9 +3192,10 @@ void blk_flush_plug_list(struct blk_plug *plug, bool from_schedule)


void blk_finish_plug(struct blk_plug *plug)
void blk_finish_plug(struct blk_plug *plug)
{
{
	if (plug != current->plug)
		return;
	blk_flush_plug_list(plug, false);
	blk_flush_plug_list(plug, false);


	if (plug == current->plug)
	current->plug = NULL;
	current->plug = NULL;
}
}
EXPORT_SYMBOL(blk_finish_plug);
EXPORT_SYMBOL(blk_finish_plug);