Commit bc38bf10 authored by Boaz Harrosh's avatar Boaz Harrosh Committed by Jens Axboe

libosd: Use new blk_rq_map_kern

Now that blk_rq_map_kern will append the buffer onto the
request we can use it easily for adding extra segments
(eg. attributes)

This patch is dependent on a block layer patch titled:
   [BLOCK] allow blk_rq_map_kern to append to requests
Signed-off-by: default avatarBoaz Harrosh <bharrosh@panasas.com>
Signed-off-by: default avatarJens Axboe <jens.axboe@oracle.com>
parent 3a5a3927
...@@ -826,26 +826,6 @@ int osd_req_add_set_attr_list(struct osd_request *or, ...@@ -826,26 +826,6 @@ int osd_req_add_set_attr_list(struct osd_request *or,
} }
EXPORT_SYMBOL(osd_req_add_set_attr_list); EXPORT_SYMBOL(osd_req_add_set_attr_list);
static int _append_map_kern(struct request *req,
void *buff, unsigned len, gfp_t flags)
{
struct bio *bio;
int ret;
bio = bio_map_kern(req->q, buff, len, flags);
if (IS_ERR(bio)) {
OSD_ERR("Failed bio_map_kern(%p, %d) => %ld\n", buff, len,
PTR_ERR(bio));
return PTR_ERR(bio);
}
ret = blk_rq_append_bio(req->q, req, bio);
if (ret) {
OSD_ERR("Failed blk_rq_append_bio(%p) => %d\n", bio, ret);
bio_put(bio);
}
return ret;
}
static int _req_append_segment(struct osd_request *or, static int _req_append_segment(struct osd_request *or,
unsigned padding, struct _osd_req_data_segment *seg, unsigned padding, struct _osd_req_data_segment *seg,
struct _osd_req_data_segment *last_seg, struct _osd_io_info *io) struct _osd_req_data_segment *last_seg, struct _osd_io_info *io)
...@@ -861,14 +841,14 @@ static int _req_append_segment(struct osd_request *or, ...@@ -861,14 +841,14 @@ static int _req_append_segment(struct osd_request *or,
else else
pad_buff = io->pad_buff; pad_buff = io->pad_buff;
ret = _append_map_kern(io->req, pad_buff, padding, ret = blk_rq_map_kern(io->req->q, io->req, pad_buff, padding,
or->alloc_flags); or->alloc_flags);
if (ret) if (ret)
return ret; return ret;
io->total_bytes += padding; io->total_bytes += padding;
} }
ret = _append_map_kern(io->req, seg->buff, seg->total_bytes, ret = blk_rq_map_kern(io->req->q, io->req, seg->buff, seg->total_bytes,
or->alloc_flags); or->alloc_flags);
if (ret) if (ret)
return ret; return ret;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment