Skip to content

Commit 529262d

Browse files
Christoph Hellwigaxboe
authored andcommitted
block: remove ->poll_fn
This was intended to support users like nvme multipath, but is just getting in the way and adding another indirect call. Reviewed-by: Sagi Grimberg <sagi@grimberg.me> Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent 9d6610b commit 529262d

3 files changed

Lines changed: 19 additions & 30 deletions

File tree

‎block/blk-core.c‎

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1250,29 +1250,6 @@ blk_qc_t submit_bio(struct bio *bio)
12501250
}
12511251
EXPORT_SYMBOL(submit_bio);
12521252

1253-
/**
1254-
* blk_poll - poll for IO completions
1255-
* @q: the queue
1256-
* @cookie: cookie passed back at IO submission time
1257-
* @spin: whether to spin for completions
1258-
*
1259-
* Description:
1260-
* Poll for completions on the passed in queue. Returns number of
1261-
* completed entries found. If @spin is true, then blk_poll will continue
1262-
* looping until at least one completion is found, unless the task is
1263-
* otherwise marked running (or we need to reschedule).
1264-
*/
1265-
int blk_poll(struct request_queue *q, blk_qc_t cookie, bool spin)
1266-
{
1267-
if (!q->poll_fn || !blk_qc_t_valid(cookie))
1268-
return 0;
1269-
1270-
if (current->plug)
1271-
blk_flush_plug_list(current->plug, false);
1272-
return q->poll_fn(q, cookie, spin);
1273-
}
1274-
EXPORT_SYMBOL_GPL(blk_poll);
1275-
12761253
/**
12771254
* blk_cloned_rq_check_limits - Helper function to check a cloned request
12781255
* for new the queue limits

‎block/blk-mq.c‎

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@
3838
#include "blk-mq-sched.h"
3939
#include "blk-rq-qos.h"
4040

41-
static int blk_mq_poll(struct request_queue *q, blk_qc_t cookie, bool spin);
4241
static void blk_mq_poll_stats_start(struct request_queue *q);
4342
static void blk_mq_poll_stats_fn(struct blk_stat_callback *cb);
4443

@@ -2838,8 +2837,6 @@ struct request_queue *blk_mq_init_allocated_queue(struct blk_mq_tag_set *set,
28382837
spin_lock_init(&q->requeue_lock);
28392838

28402839
blk_queue_make_request(q, blk_mq_make_request);
2841-
if (q->mq_ops->poll)
2842-
q->poll_fn = blk_mq_poll;
28432840

28442841
/*
28452842
* Do this after blk_queue_make_request() overrides it...
@@ -3400,14 +3397,30 @@ static bool blk_mq_poll_hybrid(struct request_queue *q,
34003397
return blk_mq_poll_hybrid_sleep(q, hctx, rq);
34013398
}
34023399

3403-
static int blk_mq_poll(struct request_queue *q, blk_qc_t cookie, bool spin)
3400+
/**
3401+
* blk_poll - poll for IO completions
3402+
* @q: the queue
3403+
* @cookie: cookie passed back at IO submission time
3404+
* @spin: whether to spin for completions
3405+
*
3406+
* Description:
3407+
* Poll for completions on the passed in queue. Returns number of
3408+
* completed entries found. If @spin is true, then blk_poll will continue
3409+
* looping until at least one completion is found, unless the task is
3410+
* otherwise marked running (or we need to reschedule).
3411+
*/
3412+
int blk_poll(struct request_queue *q, blk_qc_t cookie, bool spin)
34043413
{
34053414
struct blk_mq_hw_ctx *hctx;
34063415
long state;
34073416

3408-
if (!test_bit(QUEUE_FLAG_POLL, &q->queue_flags))
3417+
if (!blk_qc_t_valid(cookie) ||
3418+
!test_bit(QUEUE_FLAG_POLL, &q->queue_flags))
34093419
return 0;
34103420

3421+
if (current->plug)
3422+
blk_flush_plug_list(current->plug, false);
3423+
34113424
hctx = q->queue_hw_ctx[blk_qc_t_to_queue_num(cookie)];
34123425

34133426
/*
@@ -3448,6 +3461,7 @@ static int blk_mq_poll(struct request_queue *q, blk_qc_t cookie, bool spin)
34483461
__set_current_state(TASK_RUNNING);
34493462
return 0;
34503463
}
3464+
EXPORT_SYMBOL_GPL(blk_poll);
34513465

34523466
unsigned int blk_mq_rq_cpu(struct request *rq)
34533467
{

‎include/linux/blkdev.h‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,6 @@ static inline unsigned short req_get_ioprio(struct request *req)
283283
struct blk_queue_ctx;
284284

285285
typedef blk_qc_t (make_request_fn) (struct request_queue *q, struct bio *bio);
286-
typedef int (poll_q_fn) (struct request_queue *q, blk_qc_t, bool spin);
287286

288287
struct bio_vec;
289288
typedef int (dma_drain_needed_fn)(struct request *);
@@ -401,7 +400,6 @@ struct request_queue {
401400
struct rq_qos *rq_qos;
402401

403402
make_request_fn *make_request_fn;
404-
poll_q_fn *poll_fn;
405403
dma_drain_needed_fn *dma_drain_needed;
406404

407405
const struct blk_mq_ops *mq_ops;

0 commit comments

Comments
 (0)