git://ftp.safe.ca
/
safe
/
jmp
/
linux-2.6
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'v4l_for_2.6.35' of git://git.kernel.org/pub/scm/linux/kernel/git/mcheha...
[safe/jmp/linux-2.6]
/
block
/
blk-map.c
diff --git
a/block/blk-map.c
b/block/blk-map.c
index
694fefa
..
9083cf0
100644
(file)
--- a/
block/blk-map.c
+++ b/
block/blk-map.c
@@
-20,11
+20,10
@@
int blk_rq_append_bio(struct request_queue *q, struct request *rq,
rq->biotail->bi_next = bio;
rq->biotail = bio;
rq->biotail->bi_next = bio;
rq->biotail = bio;
- rq->data_len += bio->bi_size;
+ rq->
__
data_len += bio->bi_size;
}
return 0;
}
}
return 0;
}
-EXPORT_SYMBOL(blk_rq_append_bio);
static int __blk_rq_unmap_user(struct bio *bio)
{
static int __blk_rq_unmap_user(struct bio *bio)
{
@@
-116,7
+115,7
@@
int blk_rq_map_user(struct request_queue *q, struct request *rq,
struct bio *bio = NULL;
int ret;
struct bio *bio = NULL;
int ret;
- if (len > (q
->max_hw_sectors
<< 9))
+ if (len > (q
ueue_max_hw_sectors(q)
<< 9))
return -EINVAL;
if (!len)
return -EINVAL;
return -EINVAL;
if (!len)
return -EINVAL;
@@
-282,7
+281,8
@@
EXPORT_SYMBOL(blk_rq_unmap_user);
*
* Description:
* Data will be mapped directly if possible. Otherwise a bounce
*
* Description:
* Data will be mapped directly if possible. Otherwise a bounce
- * buffer is used.
+ * buffer is used. Can be called multple times to append multple
+ * buffers.
*/
int blk_rq_map_kern(struct request_queue *q, struct request *rq, void *kbuf,
unsigned int len, gfp_t gfp_mask)
*/
int blk_rq_map_kern(struct request_queue *q, struct request *rq, void *kbuf,
unsigned int len, gfp_t gfp_mask)
@@
-290,8
+290,9
@@
int blk_rq_map_kern(struct request_queue *q, struct request *rq, void *kbuf,
int reading = rq_data_dir(rq) == READ;
int do_copy = 0;
struct bio *bio;
int reading = rq_data_dir(rq) == READ;
int do_copy = 0;
struct bio *bio;
+ int ret;
- if (len > (q
->max_hw_sectors
<< 9))
+ if (len > (q
ueue_max_hw_sectors(q)
<< 9))
return -EINVAL;
if (!len || !kbuf)
return -EINVAL;
return -EINVAL;
if (!len || !kbuf)
return -EINVAL;
@@
-311,7
+312,13
@@
int blk_rq_map_kern(struct request_queue *q, struct request *rq, void *kbuf,
if (do_copy)
rq->cmd_flags |= REQ_COPY_USER;
if (do_copy)
rq->cmd_flags |= REQ_COPY_USER;
- blk_rq_bio_prep(q, rq, bio);
+ ret = blk_rq_append_bio(q, rq, bio);
+ if (unlikely(ret)) {
+ /* request is too big */
+ bio_put(bio);
+ return ret;
+ }
+
blk_queue_bounce(q, &rq->bio);
rq->buffer = NULL;
return 0;
blk_queue_bounce(q, &rq->bio);
rq->buffer = NULL;
return 0;