aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBoaz Harrosh <bharrosh@panasas.com>2009-05-24 13:02:22 -0400
committerJames Bottomley <James.Bottomley@HansenPartnership.com>2009-06-10 09:57:07 -0400
commit0e35afbc8b054e04a35faa796c72abb3b82bd33b (patch)
tree004a19d25dfc45cbbc88464e4e9d711b2027a668
parentde6b20385b1c14f97ccdf7da173b4c9a7405083b (diff)
[SCSI] libosd: osd_req_{read,write}_kern new API
By popular demand, define usefull wrappers for osd_req_read/write that recieve kernel pointers. All users had their own. Also remove these from exofs Signed-off-by: Boaz Harrosh <bharrosh@panasas.com> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
-rw-r--r--drivers/scsi/osd/osd_initiator.c28
-rw-r--r--fs/exofs/common.h6
-rw-r--r--fs/exofs/osd.c26
-rw-r--r--include/scsi/osd_initiator.h4
4 files changed, 32 insertions, 32 deletions
diff --git a/drivers/scsi/osd/osd_initiator.c b/drivers/scsi/osd/osd_initiator.c
index 15f0bbc19c9c..c98153bfb36d 100644
--- a/drivers/scsi/osd/osd_initiator.c
+++ b/drivers/scsi/osd/osd_initiator.c
@@ -789,6 +789,20 @@ void osd_req_write(struct osd_request *or,
789} 789}
790EXPORT_SYMBOL(osd_req_write); 790EXPORT_SYMBOL(osd_req_write);
791 791
792int osd_req_write_kern(struct osd_request *or,
793 const struct osd_obj_id *obj, u64 offset, void* buff, u64 len)
794{
795 struct request_queue *req_q = or->osd_dev->scsi_device->request_queue;
796 struct bio *bio = bio_map_kern(req_q, buff, len, GFP_KERNEL);
797
798 if (IS_ERR(bio))
799 return PTR_ERR(bio);
800
801 osd_req_write(or, obj, bio, offset);
802 return 0;
803}
804EXPORT_SYMBOL(osd_req_write_kern);
805
792/*TODO: void osd_req_append(struct osd_request *, 806/*TODO: void osd_req_append(struct osd_request *,
793 const struct osd_obj_id *, struct bio *data_out); */ 807 const struct osd_obj_id *, struct bio *data_out); */
794/*TODO: void osd_req_create_write(struct osd_request *, 808/*TODO: void osd_req_create_write(struct osd_request *,
@@ -824,6 +838,20 @@ void osd_req_read(struct osd_request *or,
824} 838}
825EXPORT_SYMBOL(osd_req_read); 839EXPORT_SYMBOL(osd_req_read);
826 840
841int osd_req_read_kern(struct osd_request *or,
842 const struct osd_obj_id *obj, u64 offset, void* buff, u64 len)
843{
844 struct request_queue *req_q = or->osd_dev->scsi_device->request_queue;
845 struct bio *bio = bio_map_kern(req_q, buff, len, GFP_KERNEL);
846
847 if (IS_ERR(bio))
848 return PTR_ERR(bio);
849
850 osd_req_read(or, obj, bio, offset);
851 return 0;
852}
853EXPORT_SYMBOL(osd_req_read_kern);
854
827void osd_req_get_attributes(struct osd_request *or, 855void osd_req_get_attributes(struct osd_request *or,
828 const struct osd_obj_id *obj) 856 const struct osd_obj_id *obj)
829{ 857{
diff --git a/fs/exofs/common.h b/fs/exofs/common.h
index b1512c4bb8c7..24667eedc023 100644
--- a/fs/exofs/common.h
+++ b/fs/exofs/common.h
@@ -175,10 +175,4 @@ int exofs_async_op(struct osd_request *or,
175 175
176int extract_attr_from_req(struct osd_request *or, struct osd_attr *attr); 176int extract_attr_from_req(struct osd_request *or, struct osd_attr *attr);
177 177
178int osd_req_read_kern(struct osd_request *or,
179 const struct osd_obj_id *obj, u64 offset, void *buff, u64 len);
180
181int osd_req_write_kern(struct osd_request *or,
182 const struct osd_obj_id *obj, u64 offset, void *buff, u64 len);
183
184#endif /*ifndef __EXOFS_COM_H__*/ 178#endif /*ifndef __EXOFS_COM_H__*/
diff --git a/fs/exofs/osd.c b/fs/exofs/osd.c
index b249ae97fb15..48cc4d11d3fb 100644
--- a/fs/exofs/osd.c
+++ b/fs/exofs/osd.c
@@ -125,29 +125,3 @@ int extract_attr_from_req(struct osd_request *or, struct osd_attr *attr)
125 125
126 return -EIO; 126 return -EIO;
127} 127}
128
129int osd_req_read_kern(struct osd_request *or,
130 const struct osd_obj_id *obj, u64 offset, void* buff, u64 len)
131{
132 struct request_queue *req_q = or->osd_dev->scsi_device->request_queue;
133 struct bio *bio = bio_map_kern(req_q, buff, len, GFP_KERNEL);
134
135 if (!bio)
136 return -ENOMEM;
137
138 osd_req_read(or, obj, bio, offset);
139 return 0;
140}
141
142int osd_req_write_kern(struct osd_request *or,
143 const struct osd_obj_id *obj, u64 offset, void* buff, u64 len)
144{
145 struct request_queue *req_q = or->osd_dev->scsi_device->request_queue;
146 struct bio *bio = bio_map_kern(req_q, buff, len, GFP_KERNEL);
147
148 if (!bio)
149 return -ENOMEM;
150
151 osd_req_write(or, obj, bio, offset);
152 return 0;
153}
diff --git a/include/scsi/osd_initiator.h b/include/scsi/osd_initiator.h
index b24d9616eb46..6132790d678f 100644
--- a/include/scsi/osd_initiator.h
+++ b/include/scsi/osd_initiator.h
@@ -364,6 +364,8 @@ void osd_req_remove_object(struct osd_request *or, struct osd_obj_id *);
364 364
365void osd_req_write(struct osd_request *or, 365void osd_req_write(struct osd_request *or,
366 const struct osd_obj_id *, struct bio *data_out, u64 offset); 366 const struct osd_obj_id *, struct bio *data_out, u64 offset);
367int osd_req_write_kern(struct osd_request *or,
368 const struct osd_obj_id *obj, u64 offset, void *buff, u64 len);
367void osd_req_append(struct osd_request *or, 369void osd_req_append(struct osd_request *or,
368 const struct osd_obj_id *, struct bio *data_out);/* NI */ 370 const struct osd_obj_id *, struct bio *data_out);/* NI */
369void osd_req_create_write(struct osd_request *or, 371void osd_req_create_write(struct osd_request *or,
@@ -379,6 +381,8 @@ void osd_req_flush_object(struct osd_request *or,
379 381
380void osd_req_read(struct osd_request *or, 382void osd_req_read(struct osd_request *or,
381 const struct osd_obj_id *, struct bio *data_in, u64 offset); 383 const struct osd_obj_id *, struct bio *data_in, u64 offset);
384int osd_req_read_kern(struct osd_request *or,
385 const struct osd_obj_id *obj, u64 offset, void *buff, u64 len);
382 386
383/* 387/*
384 * Root/Partition/Collection/Object Attributes commands 388 * Root/Partition/Collection/Object Attributes commands