Commit fc2fac5b authored by Boaz Harrosh's avatar Boaz Harrosh Committed by James Bottomley

[SCSI] libosd: Define an osd_dev wrapper to retrieve the request_queue

libosd users that need to work with bios, must sometime use
the request_queue associated with the osd_dev. Make a wrapper for
that, and convert all in-tree users.
Signed-off-by: default avatarBoaz Harrosh <bharrosh@panasas.com>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@HansenPartnership.com>
parent 62f469b5
...@@ -670,7 +670,7 @@ static int _osd_req_list_objects(struct osd_request *or, ...@@ -670,7 +670,7 @@ static int _osd_req_list_objects(struct osd_request *or,
__be16 action, const struct osd_obj_id *obj, osd_id initial_id, __be16 action, const struct osd_obj_id *obj, osd_id initial_id,
struct osd_obj_id_list *list, unsigned nelem) struct osd_obj_id_list *list, unsigned nelem)
{ {
struct request_queue *q = or->osd_dev->scsi_device->request_queue; struct request_queue *q = osd_request_queue(or->osd_dev);
u64 len = nelem * sizeof(osd_id) + sizeof(*list); u64 len = nelem * sizeof(osd_id) + sizeof(*list);
struct bio *bio; struct bio *bio;
...@@ -793,7 +793,7 @@ EXPORT_SYMBOL(osd_req_write); ...@@ -793,7 +793,7 @@ EXPORT_SYMBOL(osd_req_write);
int osd_req_write_kern(struct osd_request *or, int osd_req_write_kern(struct osd_request *or,
const struct osd_obj_id *obj, u64 offset, void* buff, u64 len) const struct osd_obj_id *obj, u64 offset, void* buff, u64 len)
{ {
struct request_queue *req_q = or->osd_dev->scsi_device->request_queue; struct request_queue *req_q = osd_request_queue(or->osd_dev);
struct bio *bio = bio_map_kern(req_q, buff, len, GFP_KERNEL); struct bio *bio = bio_map_kern(req_q, buff, len, GFP_KERNEL);
if (IS_ERR(bio)) if (IS_ERR(bio))
...@@ -844,7 +844,7 @@ EXPORT_SYMBOL(osd_req_read); ...@@ -844,7 +844,7 @@ EXPORT_SYMBOL(osd_req_read);
int osd_req_read_kern(struct osd_request *or, int osd_req_read_kern(struct osd_request *or,
const struct osd_obj_id *obj, u64 offset, void* buff, u64 len) const struct osd_obj_id *obj, u64 offset, void* buff, u64 len)
{ {
struct request_queue *req_q = or->osd_dev->scsi_device->request_queue; struct request_queue *req_q = osd_request_queue(or->osd_dev);
struct bio *bio = bio_map_kern(req_q, buff, len, GFP_KERNEL); struct bio *bio = bio_map_kern(req_q, buff, len, GFP_KERNEL);
if (IS_ERR(bio)) if (IS_ERR(bio))
......
...@@ -59,10 +59,9 @@ static void _pcol_init(struct page_collect *pcol, unsigned expected_pages, ...@@ -59,10 +59,9 @@ static void _pcol_init(struct page_collect *pcol, unsigned expected_pages,
struct inode *inode) struct inode *inode)
{ {
struct exofs_sb_info *sbi = inode->i_sb->s_fs_info; struct exofs_sb_info *sbi = inode->i_sb->s_fs_info;
struct request_queue *req_q = sbi->s_dev->scsi_device->request_queue;
pcol->sbi = sbi; pcol->sbi = sbi;
pcol->req_q = req_q; pcol->req_q = osd_request_queue(sbi->s_dev);
pcol->inode = inode; pcol->inode = inode;
pcol->expected_pages = expected_pages; pcol->expected_pages = expected_pages;
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
#include "osd_types.h" #include "osd_types.h"
#include <linux/blkdev.h> #include <linux/blkdev.h>
#include <scsi/scsi_device.h>
/* Note: "NI" in comments below means "Not Implemented yet" */ /* Note: "NI" in comments below means "Not Implemented yet" */
...@@ -69,6 +70,10 @@ void osd_dev_fini(struct osd_dev *od); ...@@ -69,6 +70,10 @@ void osd_dev_fini(struct osd_dev *od);
/* some hi level device operations */ /* some hi level device operations */
int osd_auto_detect_ver(struct osd_dev *od, void *caps); /* GFP_KERNEL */ int osd_auto_detect_ver(struct osd_dev *od, void *caps); /* GFP_KERNEL */
static inline struct request_queue *osd_request_queue(struct osd_dev *od)
{
return od->scsi_device->request_queue;
}
/* we might want to use function vector in the future */ /* we might want to use function vector in the future */
static inline void osd_dev_set_ver(struct osd_dev *od, enum osd_std_version v) static inline void osd_dev_set_ver(struct osd_dev *od, enum osd_std_version v)
......
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