aboutsummaryrefslogtreecommitdiffstats
path: root/block/ll_rw_blk.c
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2007-08-16 13:31:27 +0200
committerJens Axboe <axboe@carl.home.kernel.dk>2007-10-10 09:25:56 +0200
commit3001ca77128273cc5634d79f5306ce2e5a14ec41 (patch)
tree0e5904fc170afb6c01f8f0930e3c4a4ae20b19b2 /block/ll_rw_blk.c
parenteea9befaccb8d43ce89585d612159761c978f056 (diff)
downloadkernel_samsung_crespo-3001ca77128273cc5634d79f5306ce2e5a14ec41.zip
kernel_samsung_crespo-3001ca77128273cc5634d79f5306ce2e5a14ec41.tar.gz
kernel_samsung_crespo-3001ca77128273cc5634d79f5306ce2e5a14ec41.tar.bz2
New function blk_req_append_bio
ll_back_merge_fn is currently exported to SCSI where is it used, together with blk_rq_bio_prep, in exactly the same way these functions are used in __blk_rq_map_user. So move the common code into a new function (blk_rq_append_bio), and don't export ll_back_merge_fn any longer. Signed-off-by: Neil Brown <neilb@suse.de> diff .prev/block/ll_rw_blk.c ./block/ll_rw_blk.c Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'block/ll_rw_blk.c')
-rw-r--r--block/ll_rw_blk.c38
1 files changed, 22 insertions, 16 deletions
diff --git a/block/ll_rw_blk.c b/block/ll_rw_blk.c
index 094c0fa..2de9bad 100644
--- a/block/ll_rw_blk.c
+++ b/block/ll_rw_blk.c
@@ -1441,7 +1441,8 @@ static inline int ll_new_hw_segment(struct request_queue *q,
return 1;
}
-int ll_back_merge_fn(struct request_queue *q, struct request *req, struct bio *bio)
+static int ll_back_merge_fn(struct request_queue *q, struct request *req,
+ struct bio *bio)
{
unsigned short max_sectors;
int len;
@@ -1477,7 +1478,6 @@ int ll_back_merge_fn(struct request_queue *q, struct request *req, struct bio *b
return ll_new_hw_segment(q, req, bio);
}
-EXPORT_SYMBOL(ll_back_merge_fn);
static int ll_front_merge_fn(struct request_queue *q, struct request *req,
struct bio *bio)
@@ -2367,6 +2367,23 @@ static int __blk_rq_unmap_user(struct bio *bio)
return ret;
}
+int blk_rq_append_bio(struct request_queue *q, struct request *rq,
+ struct bio *bio)
+{
+ if (!rq->bio)
+ blk_rq_bio_prep(q, rq, bio);
+ else if (!ll_back_merge_fn(q, rq, bio))
+ return -EINVAL;
+ else {
+ rq->biotail->bi_next = bio;
+ rq->biotail = bio;
+
+ rq->data_len += bio->bi_size;
+ }
+ return 0;
+}
+EXPORT_SYMBOL(blk_rq_append_bio);
+
static int __blk_rq_map_user(struct request_queue *q, struct request *rq,
void __user *ubuf, unsigned int len)
{
@@ -2398,21 +2415,10 @@ static int __blk_rq_map_user(struct request_queue *q, struct request *rq,
*/
bio_get(bio);
- if (!rq->bio)
- blk_rq_bio_prep(q, rq, bio);
- else if (!ll_back_merge_fn(q, rq, bio)) {
- ret = -EINVAL;
- goto unmap_bio;
- } else {
- rq->biotail->bi_next = bio;
- rq->biotail = bio;
-
- rq->data_len += bio->bi_size;
- }
-
- return bio->bi_size;
+ ret = blk_rq_append_bio(q, rq, bio);
+ if (!ret)
+ return bio->bi_size;
-unmap_bio:
/* if it was boucned we must call the end io function */
bio_endio(bio, bio->bi_size, 0);
__blk_rq_unmap_user(orig_bio);