diff options
author | Boaz Harrosh <bharrosh@panasas.com> | 2009-05-17 11:56:17 -0400 |
---|---|---|
committer | Jens Axboe <jens.axboe@oracle.com> | 2009-05-19 06:14:55 -0400 |
commit | bc38bf106c967389a465d926be22c7371abba69d (patch) | |
tree | 069d23dcff9160559d66d7ebfcf9b522b9bba093 /drivers/scsi | |
parent | 3a5a39276d2a32b05b1ee25b384516805b17cf87 (diff) |
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: Boaz Harrosh <bharrosh@panasas.com>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'drivers/scsi')
-rw-r--r-- | drivers/scsi/osd/osd_initiator.c | 24 |
1 files changed, 2 insertions, 22 deletions
diff --git a/drivers/scsi/osd/osd_initiator.c b/drivers/scsi/osd/osd_initiator.c index d178a8b799ec..bf66e301866f 100644 --- a/drivers/scsi/osd/osd_initiator.c +++ b/drivers/scsi/osd/osd_initiator.c | |||
@@ -826,26 +826,6 @@ int osd_req_add_set_attr_list(struct osd_request *or, | |||
826 | } | 826 | } |
827 | EXPORT_SYMBOL(osd_req_add_set_attr_list); | 827 | EXPORT_SYMBOL(osd_req_add_set_attr_list); |
828 | 828 | ||
829 | static int _append_map_kern(struct request *req, | ||
830 | void *buff, unsigned len, gfp_t flags) | ||
831 | { | ||
832 | struct bio *bio; | ||
833 | int ret; | ||
834 | |||
835 | bio = bio_map_kern(req->q, buff, len, flags); | ||
836 | if (IS_ERR(bio)) { | ||
837 | OSD_ERR("Failed bio_map_kern(%p, %d) => %ld\n", buff, len, | ||
838 | PTR_ERR(bio)); | ||
839 | return PTR_ERR(bio); | ||
840 | } | ||
841 | ret = blk_rq_append_bio(req->q, req, bio); | ||
842 | if (ret) { | ||
843 | OSD_ERR("Failed blk_rq_append_bio(%p) => %d\n", bio, ret); | ||
844 | bio_put(bio); | ||
845 | } | ||
846 | return ret; | ||
847 | } | ||
848 | |||
849 | static int _req_append_segment(struct osd_request *or, | 829 | static int _req_append_segment(struct osd_request *or, |
850 | unsigned padding, struct _osd_req_data_segment *seg, | 830 | unsigned padding, struct _osd_req_data_segment *seg, |
851 | struct _osd_req_data_segment *last_seg, struct _osd_io_info *io) | 831 | 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 | else | 841 | else |
862 | pad_buff = io->pad_buff; | 842 | pad_buff = io->pad_buff; |
863 | 843 | ||
864 | ret = _append_map_kern(io->req, pad_buff, padding, | 844 | ret = blk_rq_map_kern(io->req->q, io->req, pad_buff, padding, |
865 | or->alloc_flags); | 845 | or->alloc_flags); |
866 | if (ret) | 846 | if (ret) |
867 | return ret; | 847 | return ret; |
868 | io->total_bytes += padding; | 848 | io->total_bytes += padding; |
869 | } | 849 | } |
870 | 850 | ||
871 | ret = _append_map_kern(io->req, seg->buff, seg->total_bytes, | 851 | ret = blk_rq_map_kern(io->req->q, io->req, seg->buff, seg->total_bytes, |
872 | or->alloc_flags); | 852 | or->alloc_flags); |
873 | if (ret) | 853 | if (ret) |
874 | return ret; | 854 | return ret; |