aboutsummaryrefslogtreecommitdiffstats
path: root/block
diff options
context:
space:
mode:
authorNamhyung Kim <namhyung@gmail.com>2011-05-24 04:23:21 -0400
committerJens Axboe <jaxboe@fusionio.com>2011-05-24 04:23:21 -0400
commit229836bd63c5413a4f8eed93d610b432be141e9b (patch)
treea55fa492dbcde4c8f179d58d07165bdff872c34e /block
parentb9f8ce059940064a732da49b5d6e618381dad956 (diff)
cfq-iosched: reduce bit operations in cfq_choose_req()
Reduce the number of bit operations in cfq_choose_req() on average (and worst) cases. Signed-off-by: Namhyung Kim <namhyung@gmail.com> Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
Diffstat (limited to 'block')
-rw-r--r--block/cfq-iosched.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c
index 00763e510228..7ffceddee420 100644
--- a/block/cfq-iosched.c
+++ b/block/cfq-iosched.c
@@ -667,15 +667,11 @@ cfq_choose_req(struct cfq_data *cfqd, struct request *rq1, struct request *rq2,
667 if (rq2 == NULL) 667 if (rq2 == NULL)
668 return rq1; 668 return rq1;
669 669
670 if (rq_is_sync(rq1) && !rq_is_sync(rq2)) 670 if (rq_is_sync(rq1) != rq_is_sync(rq2))
671 return rq1; 671 return rq_is_sync(rq1) ? rq1 : rq2;
672 else if (rq_is_sync(rq2) && !rq_is_sync(rq1)) 672
673 return rq2; 673 if ((rq1->cmd_flags ^ rq2->cmd_flags) & REQ_META)
674 if ((rq1->cmd_flags & REQ_META) && !(rq2->cmd_flags & REQ_META)) 674 return rq1->cmd_flags & REQ_META ? rq1 : rq2;
675 return rq1;
676 else if ((rq2->cmd_flags & REQ_META) &&
677 !(rq1->cmd_flags & REQ_META))
678 return rq2;
679 675
680 s1 = blk_rq_pos(rq1); 676 s1 = blk_rq_pos(rq1);
681 s2 = blk_rq_pos(rq2); 677 s2 = blk_rq_pos(rq2);