Skip to content

Commit

Permalink
cfq-iosched: reduce bit operations in cfq_choose_req()
Browse files Browse the repository at this point in the history
Reduce the number of bit operations in cfq_choose_req() on average
(and worst) cases.

Signed-off-by: Namhyung Kim <[email protected]>
Signed-off-by: Jens Axboe <[email protected]>
  • Loading branch information
namhyung authored and Jens Axboe committed May 24, 2011
1 parent b9f8ce0 commit 229836b
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions block/cfq-iosched.c
Original file line number Diff line number Diff line change
Expand Up @@ -667,15 +667,11 @@ cfq_choose_req(struct cfq_data *cfqd, struct request *rq1, struct request *rq2,
if (rq2 == NULL)
return rq1;

if (rq_is_sync(rq1) && !rq_is_sync(rq2))
return rq1;
else if (rq_is_sync(rq2) && !rq_is_sync(rq1))
return rq2;
if ((rq1->cmd_flags & REQ_META) && !(rq2->cmd_flags & REQ_META))
return rq1;
else if ((rq2->cmd_flags & REQ_META) &&
!(rq1->cmd_flags & REQ_META))
return rq2;
if (rq_is_sync(rq1) != rq_is_sync(rq2))
return rq_is_sync(rq1) ? rq1 : rq2;

if ((rq1->cmd_flags ^ rq2->cmd_flags) & REQ_META)
return rq1->cmd_flags & REQ_META ? rq1 : rq2;

s1 = blk_rq_pos(rq1);
s2 = blk_rq_pos(rq2);
Expand Down

0 comments on commit 229836b

Please sign in to comment.