block: cleanup the block plug helper functions
It's a bit of a mess currently. task->plug is being cleared and reset in __blk_finish_plug(), and blk_finish_plug() is testing for a NULL plug which cannot happen even from schedule() anymore since it uses blk_needs_flush_plug() to determine whether to call into this function at all. So get rid of some of the cruft. Signed-off-by: Jens Axboe <jaxboe@fusionio.com>hifive-unleashed-5.1
parent
80656b67b3
commit
88b996cd06
|
@ -2671,7 +2671,7 @@ static void queue_unplugged(struct request_queue *q, unsigned int depth)
|
||||||
q->unplugged_fn(q);
|
q->unplugged_fn(q);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void flush_plug_list(struct blk_plug *plug)
|
void blk_flush_plug_list(struct blk_plug *plug)
|
||||||
{
|
{
|
||||||
struct request_queue *q;
|
struct request_queue *q;
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
|
@ -2733,29 +2733,17 @@ static void flush_plug_list(struct blk_plug *plug)
|
||||||
|
|
||||||
local_irq_restore(flags);
|
local_irq_restore(flags);
|
||||||
}
|
}
|
||||||
|
EXPORT_SYMBOL(blk_flush_plug_list);
|
||||||
static void __blk_finish_plug(struct task_struct *tsk, struct blk_plug *plug)
|
|
||||||
{
|
|
||||||
flush_plug_list(plug);
|
|
||||||
|
|
||||||
if (plug == tsk->plug)
|
|
||||||
tsk->plug = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
void blk_finish_plug(struct blk_plug *plug)
|
void blk_finish_plug(struct blk_plug *plug)
|
||||||
{
|
{
|
||||||
if (plug)
|
blk_flush_plug_list(plug);
|
||||||
__blk_finish_plug(current, plug);
|
|
||||||
|
if (plug == current->plug)
|
||||||
|
current->plug = NULL;
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(blk_finish_plug);
|
EXPORT_SYMBOL(blk_finish_plug);
|
||||||
|
|
||||||
void __blk_flush_plug(struct task_struct *tsk, struct blk_plug *plug)
|
|
||||||
{
|
|
||||||
__blk_finish_plug(tsk, plug);
|
|
||||||
tsk->plug = plug;
|
|
||||||
}
|
|
||||||
EXPORT_SYMBOL(__blk_flush_plug);
|
|
||||||
|
|
||||||
int __init blk_dev_init(void)
|
int __init blk_dev_init(void)
|
||||||
{
|
{
|
||||||
BUILD_BUG_ON(__REQ_NR_BITS > 8 *
|
BUILD_BUG_ON(__REQ_NR_BITS > 8 *
|
||||||
|
|
|
@ -865,14 +865,14 @@ struct blk_plug {
|
||||||
|
|
||||||
extern void blk_start_plug(struct blk_plug *);
|
extern void blk_start_plug(struct blk_plug *);
|
||||||
extern void blk_finish_plug(struct blk_plug *);
|
extern void blk_finish_plug(struct blk_plug *);
|
||||||
extern void __blk_flush_plug(struct task_struct *, struct blk_plug *);
|
extern void blk_flush_plug_list(struct blk_plug *);
|
||||||
|
|
||||||
static inline void blk_flush_plug(struct task_struct *tsk)
|
static inline void blk_flush_plug(struct task_struct *tsk)
|
||||||
{
|
{
|
||||||
struct blk_plug *plug = tsk->plug;
|
struct blk_plug *plug = tsk->plug;
|
||||||
|
|
||||||
if (unlikely(plug))
|
if (plug)
|
||||||
__blk_flush_plug(tsk, plug);
|
blk_flush_plug_list(plug);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline bool blk_needs_flush_plug(struct task_struct *tsk)
|
static inline bool blk_needs_flush_plug(struct task_struct *tsk)
|
||||||
|
|
Loading…
Reference in New Issue