diff options
Diffstat (limited to 'block/elevator.c')
-rw-r--r-- | block/elevator.c | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/block/elevator.c b/block/elevator.c index c0063f345c5d..62c7a3069d3a 100644 --- a/block/elevator.c +++ b/block/elevator.c | |||
@@ -51,6 +51,21 @@ static const int elv_hash_shift = 6; | |||
51 | #define ELV_ON_HASH(rq) (!hlist_unhashed(&(rq)->hash)) | 51 | #define ELV_ON_HASH(rq) (!hlist_unhashed(&(rq)->hash)) |
52 | 52 | ||
53 | /* | 53 | /* |
54 | * Query io scheduler to see if the current process issuing bio may be | ||
55 | * merged with rq. | ||
56 | */ | ||
57 | static int elv_iosched_allow_merge(struct request *rq, struct bio *bio) | ||
58 | { | ||
59 | request_queue_t *q = rq->q; | ||
60 | elevator_t *e = q->elevator; | ||
61 | |||
62 | if (e->ops->elevator_allow_merge_fn) | ||
63 | return e->ops->elevator_allow_merge_fn(q, rq, bio); | ||
64 | |||
65 | return 1; | ||
66 | } | ||
67 | |||
68 | /* | ||
54 | * can we safely merge with this request? | 69 | * can we safely merge with this request? |
55 | */ | 70 | */ |
56 | inline int elv_rq_merge_ok(struct request *rq, struct bio *bio) | 71 | inline int elv_rq_merge_ok(struct request *rq, struct bio *bio) |
@@ -65,12 +80,15 @@ inline int elv_rq_merge_ok(struct request *rq, struct bio *bio) | |||
65 | return 0; | 80 | return 0; |
66 | 81 | ||
67 | /* | 82 | /* |
68 | * same device and no special stuff set, merge is ok | 83 | * must be same device and not a special request |
69 | */ | 84 | */ |
70 | if (rq->rq_disk == bio->bi_bdev->bd_disk && !rq->special) | 85 | if (rq->rq_disk != bio->bi_bdev->bd_disk || !rq->special) |
71 | return 1; | 86 | return 0; |
72 | 87 | ||
73 | return 0; | 88 | if (!elv_iosched_allow_merge(rq, bio)) |
89 | return 0; | ||
90 | |||
91 | return 1; | ||
74 | } | 92 | } |
75 | EXPORT_SYMBOL(elv_rq_merge_ok); | 93 | EXPORT_SYMBOL(elv_rq_merge_ok); |
76 | 94 | ||