Skip to content

Commit d9d8c5c

Browse files
Mike Christieaxboe
authored andcommitted
block: convert is_sync helpers to use REQ_OPs.
This patch converts the is_sync helpers to use separate variables for the operation and flags. Signed-off-by: Mike Christie <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]> Reviewed-by: Hannes Reinecke <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
1 parent 8fe0d47 commit d9d8c5c

File tree

4 files changed

+11
-11
lines changed

4 files changed

+11
-11
lines changed

block/blk-core.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -962,7 +962,7 @@ static void __freed_request(struct request_list *rl, int sync)
962962
static void freed_request(struct request_list *rl, int op, unsigned int flags)
963963
{
964964
struct request_queue *q = rl->q;
965-
int sync = rw_is_sync(op | flags);
965+
int sync = rw_is_sync(op, flags);
966966

967967
q->nr_rqs[sync]--;
968968
rl->count[sync]--;
@@ -1075,7 +1075,7 @@ static struct request *__get_request(struct request_list *rl, int op,
10751075
struct elevator_type *et = q->elevator->type;
10761076
struct io_context *ioc = rq_ioc(bio);
10771077
struct io_cq *icq = NULL;
1078-
const bool is_sync = rw_is_sync(op | op_flags) != 0;
1078+
const bool is_sync = rw_is_sync(op, op_flags) != 0;
10791079
int may_queue;
10801080

10811081
if (unlikely(blk_queue_dying(q)))
@@ -1244,7 +1244,7 @@ static struct request *get_request(struct request_queue *q, int op,
12441244
int op_flags, struct bio *bio,
12451245
gfp_t gfp_mask)
12461246
{
1247-
const bool is_sync = rw_is_sync(op | op_flags) != 0;
1247+
const bool is_sync = rw_is_sync(op, op_flags) != 0;
12481248
DEFINE_WAIT(wait);
12491249
struct request_list *rl;
12501250
struct request *rq;

block/blk-mq.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ static void blk_mq_rq_ctx_init(struct request_queue *q, struct blk_mq_ctx *ctx,
204204
rq->end_io_data = NULL;
205205
rq->next_rq = NULL;
206206

207-
ctx->rq_dispatched[rw_is_sync(op | op_flags)]++;
207+
ctx->rq_dispatched[rw_is_sync(op, op_flags)]++;
208208
}
209209

210210
static struct request *
@@ -1178,7 +1178,7 @@ static struct request *blk_mq_map_request(struct request_queue *q,
11781178
ctx = blk_mq_get_ctx(q);
11791179
hctx = q->mq_ops->map_queue(q, ctx->cpu);
11801180

1181-
if (rw_is_sync(bio->bi_rw))
1181+
if (rw_is_sync(bio_op(bio), bio->bi_rw))
11821182
op_flags |= REQ_SYNC;
11831183

11841184
trace_block_getrq(q, bio, op);
@@ -1246,7 +1246,7 @@ static int blk_mq_direct_issue_request(struct request *rq, blk_qc_t *cookie)
12461246
*/
12471247
static blk_qc_t blk_mq_make_request(struct request_queue *q, struct bio *bio)
12481248
{
1249-
const int is_sync = rw_is_sync(bio->bi_rw);
1249+
const int is_sync = rw_is_sync(bio_op(bio), bio->bi_rw);
12501250
const int is_flush_fua = bio->bi_rw & (REQ_FLUSH | REQ_FUA);
12511251
struct blk_map_ctx data;
12521252
struct request *rq;
@@ -1343,7 +1343,7 @@ static blk_qc_t blk_mq_make_request(struct request_queue *q, struct bio *bio)
13431343
*/
13441344
static blk_qc_t blk_sq_make_request(struct request_queue *q, struct bio *bio)
13451345
{
1346-
const int is_sync = rw_is_sync(bio->bi_rw);
1346+
const int is_sync = rw_is_sync(bio_op(bio), bio->bi_rw);
13471347
const int is_flush_fua = bio->bi_rw & (REQ_FLUSH | REQ_FUA);
13481348
struct blk_plug *plug;
13491349
unsigned int request_count = 0;

block/cfq-iosched.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4311,7 +4311,7 @@ static int cfq_may_queue(struct request_queue *q, int op, int op_flags)
43114311
if (!cic)
43124312
return ELV_MQUEUE_MAY;
43134313

4314-
cfqq = cic_to_cfqq(cic, rw_is_sync(op | op_flags));
4314+
cfqq = cic_to_cfqq(cic, rw_is_sync(op, op_flags));
43154315
if (cfqq) {
43164316
cfq_init_prio_data(cfqq, cic);
43174317

include/linux/blkdev.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -624,14 +624,14 @@ static inline unsigned int blk_queue_cluster(struct request_queue *q)
624624
/*
625625
* We regard a request as sync, if either a read or a sync write
626626
*/
627-
static inline bool rw_is_sync(unsigned int rw_flags)
627+
static inline bool rw_is_sync(int op, unsigned int rw_flags)
628628
{
629-
return !(rw_flags & REQ_WRITE) || (rw_flags & REQ_SYNC);
629+
return op == REQ_OP_READ || (rw_flags & REQ_SYNC);
630630
}
631631

632632
static inline bool rq_is_sync(struct request *rq)
633633
{
634-
return rw_is_sync(rq->cmd_flags);
634+
return rw_is_sync(req_op(rq), rq->cmd_flags);
635635
}
636636

637637
static inline bool blk_rl_full(struct request_list *rl, bool sync)

0 commit comments

Comments
 (0)