dm mpath: rdac
Subsystems (2)
Alasdair G Kergon
maintainerPATCH 16/18 dm mpath: rdac
From: Mike Christie <[email protected]>
This patch from Chandra Seetharaman and updated to upstream by me, supports LSI/Engenio devices in RDAC mode. Like dm-emc
it requires userspace support. In your multipath.conf file you must have:
path_checker rdachardware_handler "1 rdac"
And you also then must have a updated multipath tools release which has rdac support.
--- drivers/md/Kconfig | 6 drivers/md/Makefile | 2 drivers/md/dm-mpath-rdac.c | 715 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 723 insertions(+)
drivers/md/Kconfig +6 -0
@@ -262,6 +262,12 @@ config DM_MULTIPATH_EMC ---help--- Multipath support for EMC CX/AX series hardware. +config DM_MULTIPATH_RDAC + tristate "LSI/Engenio RDAC multipath support (EXPERIMENTAL)" + depends on DM_MULTIPATH && BLK_DEV_DM && EXPERIMENTAL + ---help--- + Multipath support for LSI/Engenio RDAC. + config DM_DELAY tristate "I/O delaying target (EXPERIMENTAL)" depends on BLK_DEV_DM && EXPERIMENTAL
drivers/md/Makefile +2 -0
@@ -7,6 +7,7 @@ dm-mod-objs := dm.o dm-table.o dm-target dm-multipath-objs := dm-hw-handler.o dm-path-selector.o dm-mpath.o dm-snapshot-objs := dm-snap.o dm-exception-store.o dm-mirror-objs := dm-log.o dm-raid1.o +dm-rdac-objs := dm-mpath-rdac.o md-mod-objs := md.o bitmap.o raid456-objs := raid5.o raid6algos.o raid6recov.o raid6tables.o \ raid6int1.o raid6int2.o raid6int4.o \
@@ -34,6 +35,7 @@ obj-$(CONFIG_DM_CRYPT) += dm-crypt.o obj-$(CONFIG_DM_DELAY) += dm-delay.o obj-$(CONFIG_DM_MULTIPATH) += dm-multipath.o dm-round-robin.o obj-$(CONFIG_DM_MULTIPATH_EMC) += dm-emc.o +obj-$(CONFIG_DM_MULTIPATH_RDAC) += dm-rdac.o obj-$(CONFIG_DM_SNAPSHOT) += dm-snapshot.o obj-$(CONFIG_DM_MIRROR) += dm-mirror.o obj-$(CONFIG_DM_ZERO) += dm-zero.o
drivers/md/dm-mpath-rdac.c new file +715 -0
715 lines not on this page · raw message
Quoted 9 lines · On Wed, 11 Jul 2007 22:02:42 +0100 Alasdair G Kergon <[email protected]> wrote:
From: Mike Christie <[email protected]>
This patch from Chandra Seetharaman and updated to upstream by me, supports LSI/Engenio devices in RDAC mode. Like dm-emc
it requires userspace support. In your multipath.conf file you must have:
path_checkerrdachardware_handler"1 rdac"
Quoted 6 lines
And you also then must have a updated multipath tools release which has rdac support.
...
+static
spinlock_tlist_lock=SPIN_LOCK_UNLOCKED;
This defeats lockdep. Please use DEFINE_SPINLOCK.
drivers/md/dm-mpath-rdac.c line 218
Quoted 8 lines
drivers/md/dm-mpath-rdac.c new file +8
-0+#define submit_c9_inquiry (h) \ + submit_inquiry(h, 0xC9, sizeof(struct c9_inquiry), c9_inquiry_endio) +#define submit_c4_inquiry (h) \ + submit_inquiry(h, 0xC4, sizeof(struct c4_inquiry), c4_inquiry_endio) +#define submit_c8_inquiry (h) \ + submit_inquiry(h, 0xC8, sizeof(struct c8_inquiry), c8_inquiry_endio) +#define submit_c2_inquiry (h) \ + submit_inquiry(h, 0xC2, sizeof(struct c2_inquiry), c2_inquiry_endio)
These don't have to be implemented as macros.
drivers/md/dm-mpath-rdac.c line 289
Quoted 7 lines
drivers/md/dm-mpath-rdac.c new file +7
-0+static struct request *get_rdac_req (struct rdac_handler *h, +void *buffer,unsigned buflen,int rw) +{ +struct request *rq; +struct request_queue *q =bdev_get_queue (h->path->dev->bdev); + + rq =blk_get_request (q, rw,GFP_ATOMIC );
GFP_ATOMIC is unreliable. Is it really unavoidable?
Quoted 43 lines
drivers/md/dm-mpath-rdac.c new file +40
-0+if (!rq) { +DMINFO ("get_rdac_req: blk_get_request failed" ); +return NULL ; + } + +if (buflen &&blk_rq_map_kern (q, rq, buffer, buflen,GFP_ATOMIC )) { +blk_put_request (rq); +DMINFO ("get_rdac_req: blk_rq_map_kern failed" ); +return NULL ; + } + +memset (&rq->cmd,0 ,BLK_MAX_CDB ); + rq->sense = h->sense; +memset (rq->sense,0 ,SCSI_SENSE_BUFFERSIZE ); + rq->sense_len =0 ; + + rq->end_io_data = h; + rq->timeout = h->timeout; + rq->cmd_type =REQ_TYPE_BLOCK_PC ; + rq->cmd_flags =REQ_FAILFAST |REQ_NOMERGE ; +return rq; +} + + +/* Acquires h->ctlr->lock */ +static void submit_mode_select (struct rdac_handler *h) +{ +struct request *rq; +struct request_queue *q =bdev_get_queue (h->path->dev->bdev); + +spin_lock (&h->ctlr->lock); +if (h->ctlr->submitted) { +list_add (&h->entry, &h->ctlr->cmd_list); + goto drop_lock; + } + +if (!q) { +DMINFO ("submit_mode_select: no queue" ); + goto fail_path; + }
drivers/md/dm-mpath-rdac.c line 393
Quoted 10 lines
drivers/md/dm-mpath-rdac.c new file +10
-0+ + rq =rdac_failover_get (h); +if (!rq) { +DMERR ("submit_mode_select: no rq" ); + goto fail_path; + } + +DMINFO ("queueing MODE_SELECT command on %s" , h->path->dev->name); + +blk_execute_rq_nowait (q,NULL , rq,1 , mode_select_endio);
I suspect we could call this after dropping the lock?
Quoted 12 lines
drivers/md/dm-mpath-rdac.c new file +9
-0+ h->ctlr->submitted =1 ; + goto drop_lock; +fail_path: +dm_pg_init_complete (h->path,MP_FAIL_PATH ); +drop_lock: +spin_unlock (&h->ctlr->lock); +} + +static void c2_inquiry_endio (struct request *req,int error)
drivers/md/dm-mpath-rdac.c line 478
Quoted 10 lines
drivers/md/dm-mpath-rdac.c new file +10
-0+{ +struct rdac_handler *h = req->end_io_data; +struct c2_inquiry *sp; + +if (had_failures (req, error)) { +dm_pg_init_complete (h->path,MP_FAIL_PATH ); + goto done; + } + + sp = (struct c2_inquiry *)&h->inq;
That's funny-looking and un-typesafe. Why not do
sp = &h->inq.c2;
?
(Dittoes in various other places..)
Quoted 6 lines
drivers/md/dm-mpath-rdac.c new file +6
-0+ +/* If more than MODE6_MAX_LUN luns are supported, use mode select 10 */ +if (sp->max_lun_supported >=MODE6_MAX_LUN ) + h->ctlr->use_10_ms =1 ; +else + h->ctlr->use_10_ms =0 ;
drivers/md/dm-mpath-rdac.c
Quoted 10 lines
drivers/md/dm-mpath-rdac.c new file +10
-0+ + h->cmd_to_send =SEND_MODE_SELECT ; +queue_work (rdac_wkqd, &h->work); +done: +__blk_put_request (req->q, req); +} + +static void rdac_destroy (struct hw_handler *hwh) +{ +struct rdac_handler *h = (struct rdac_handler *) hwh->context;
Unneeded (and undesirable) cast of void*. Please check the whole patch(set) for this.
Quoted 6 lines
drivers/md/dm-mpath-rdac.c new file +6
-0+if (h->ctlr) +kref_put (&h->ctlr->kref, release_ctlr); +kfree (h); + hwh->context =NULL ; +} +
Quoted 12 lines · Andrew Morton
Quoted 9 lines · On Wed, 11 Jul 2007 22:02:42 +0100 Alasdair G Kergon <[email protected]> wrote:
From: Mike Christie <[email protected]>
This patch from Chandra Seetharaman and updated to upstream by me, supports LSI/Engenio devices in RDAC mode. Like dm-emc
it requires userspace support. In your multipath.conf file you must have:
path_checkerrdachardware_handler"1 rdac"
Quoted 8 lines
Quoted 6 lines
And you also then must have a updated multipath tools release which has rdac support.
...
+static
spinlock_tlist_lock=SPIN_LOCK_UNLOCKED;This defeats lockdep. Please use
DEFINE_SPINLOCK.
Will do
Quoted 11 lines
drivers/md/dm-mpath-rdac.c line 218
Quoted 9 lines
drivers/md/dm-mpath-rdac.c new file +8
-0+#define submit_c9_inquiry (h) \ + submit_inquiry(h, 0xC9, sizeof(struct c9_inquiry), c9_inquiry_endio) +#define submit_c4_inquiry (h) \ + submit_inquiry(h, 0xC4, sizeof(struct c4_inquiry), c4_inquiry_endio) +#define submit_c8_inquiry (h) \ + submit_inquiry(h, 0xC8, sizeof(struct c8_inquiry), c8_inquiry_endio) +#define submit_c2_inquiry (h) \ + submit_inquiry(h, 0xC2, sizeof(struct c2_inquiry), c2_inquiry_endio)These don't have to be implemented as macros.
They were all spanning two lines, wanted to make it look clean were it was used.
Will change.
Quoted 10 lines
drivers/md/dm-mpath-rdac.c line 289
Quoted 8 lines
drivers/md/dm-mpath-rdac.c new file +7
-0+static struct request *get_rdac_req (struct rdac_handler *h, +void *buffer,unsigned buflen,int rw) +{ +struct request *rq; +struct request_queue *q =bdev_get_queue (h->path->dev->bdev); + + rq =blk_get_request (q, rw,GFP_ATOMIC );
GFP_ATOMICis unreliable. Is it really unavoidable?
We can avoid it here.
Will change.
Quoted 48 lines
Quoted 48 lines
drivers/md/dm-mpath-rdac.c new file +44
-0+if (!rq) { +DMINFO ("get_rdac_req: blk_get_request failed" ); +return NULL ; + } + +if (buflen &&blk_rq_map_kern (q, rq, buffer, buflen,GFP_ATOMIC )) { +blk_put_request (rq); +DMINFO ("get_rdac_req: blk_rq_map_kern failed" ); +return NULL ; + } + +memset (&rq->cmd,0 ,BLK_MAX_CDB ); + rq->sense = h->sense; +memset (rq->sense,0 ,SCSI_SENSE_BUFFERSIZE ); + rq->sense_len =0 ; + + rq->end_io_data = h; + rq->timeout = h->timeout; + rq->cmd_type =REQ_TYPE_BLOCK_PC ; + rq->cmd_flags =REQ_FAILFAST |REQ_NOMERGE ; +return rq; +} + + +/* Acquires h->ctlr->lock */ +static void submit_mode_select (struct rdac_handler *h) +{ +struct request *rq; +struct request_queue *q =bdev_get_queue (h->path->dev->bdev); + +spin_lock (&h->ctlr->lock); +if (h->ctlr->submitted) { +list_add (&h->entry, &h->ctlr->cmd_list); + goto drop_lock; + } + +if (!q) { +DMINFO ("submit_mode_select: no queue" ); + goto fail_path; + } + + rq =rdac_failover_get (h); +if (!rq) { +DMERR ("submit_mode_select: no rq" );
Quoted 8 lines
drivers/md/dm-mpath-rdac.c line 393
Quoted 6 lines
drivers/md/dm-mpath-rdac.c new file +6
-0+ goto fail_path; + } + +DMINFO ("queueing MODE_SELECT command on %s" , h->path->dev->name); + +blk_execute_rq_nowait (q,NULL , rq,1 , mode_select_endio);I suspect we could call this after dropping the lock?
We could.
Will do.
Quoted 26 lines
Quoted 13 lines
drivers/md/dm-mpath-rdac.c new file +9
-0+ h->ctlr->submitted =1 ; + goto drop_lock; +fail_path: +dm_pg_init_complete (h->path,MP_FAIL_PATH ); +drop_lock: +spin_unlock (&h->ctlr->lock); +} + +static void c2_inquiry_endio (struct request *req,int error)drivers/md/dm-mpath-rdac.c line 478
Quoted 10 lines
drivers/md/dm-mpath-rdac.c new file +10
-0+{ +struct rdac_handler *h = req->end_io_data; +struct c2_inquiry *sp; + +if (had_failures (req, error)) { +dm_pg_init_complete (h->path,MP_FAIL_PATH ); + goto done; + } + + sp = (struct c2_inquiry *)&h->inq;That's funny-looking and un-typesafe. Why not do
Quoted 5 lines
sp = &h->inq.c2;?
(Dittoes in various other places..)
Will change.
Quoted 12 lines
Quoted 12 lines
drivers/md/dm-mpath-rdac.c new file +11
-0+ +/* If more than MODE6_MAX_LUN luns are supported, use mode select 10 */ +if (sp->max_lun_supported >=MODE6_MAX_LUN ) + h->ctlr->use_10_ms =1 ; +else + h->ctlr->use_10_ms =0 ; + + h->cmd_to_send =SEND_MODE_SELECT ; +queue_work (rdac_wkqd, &h->work); +done: +__blk_put_request (req->q, req);
Quoted 8 lines
drivers/md/dm-mpath-rdac.c line 642
Quoted 5 lines
drivers/md/dm-mpath-rdac.c new file +5
-0+} + +static void rdac_destroy (struct hw_handler *hwh) +{ +struct rdac_handler *h = (struct rdac_handler *) hwh->context;Unneeded (and undesirable) cast of void*. Please check the whole patch(set) for this.
Will do.
Quoted 12 lines
drivers/md/dm-mpath-rdac.c line 649
Quoted 7 lines
drivers/md/dm-mpath-rdac.c new file +6
-0+if (h->ctlr) +kref_put (&h->ctlr->kref, release_ctlr); +kfree (h); + hwh->context =NULL ; +} +--
dm-devel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/dm-devel
Signature · 4 lines
----------------------------------------------------------------------
Chandra Seetharaman | Be careful what you choose....
- [email protected] | .......you may get it.
----------------------------------------------------------------------Andrew,
Attached is the patch that addresses all your comments except moving the lock around blk_execute_rq_nowait(). Moving the lock ahead makes the function to return more than one place (which is what I was trying to avoid earlier). Let me now if you prefer it that way.
Thanks,
chandra
On Wed, 2007-07-11 at 14:43 -0700, Andrew Morton wrote:
--snip
Quoted 6 lines
Review
Quoted 3 lines
(quoted diff) +3
-0+ DMINFO("queueing MODE_SELECT command on %s", h->path->dev->name); + + blk_execute_rq_nowait(q, NULL, rq, 1, mode_select_endio);I suspect we could call this after dropping the lock?
Quoted 7 lines
Review
Quoted 7 lines
(quoted diff) +7
-0+ h->ctlr->submitted = 1; + goto drop_lock; +fail_path: + dm_pg_init_complete(h->path, MP_FAIL_PATH); +drop_lock: + spin_unlock(&h->ctlr->lock); +}
--snip--
-----------
From: Chandra Seetharaman <[email protected]>
This patch supports LSI/Engenio devices in RDAC mode. Like dm-emc it requires userspace support. In your multipath.conf file you must have:
path_checker rdachardware_handler "1 rdac"prio_callout "/sbin/mpath_prio_tpc /dev/%n"
And you also then must have a updated multipath tools release which has rdac support.
--
drivers/md/Kconfig +6 -0
@@ -262,6 +262,12 @@ config DM_MULTIPATH_EMC ---help--- Multipath support for EMC CX/AX series hardware. +config DM_MULTIPATH_RDAC + tristate "LSI/Engenio RDAC multipath support (EXPERIMENTAL)" + depends on DM_MULTIPATH && BLK_DEV_DM && EXPERIMENTAL + ---help--- + Multipath support for LSI/Engenio RDAC. + config DM_DELAY tristate "I/O delaying target (EXPERIMENTAL)" depends on BLK_DEV_DM && EXPERIMENTAL
drivers/md/Makefile +2 -0
@@ -7,6 +7,7 @@ dm-mod-objs := dm.o dm-table.o dm-target dm-multipath-objs := dm-hw-handler.o dm-path-selector.o dm-mpath.o dm-snapshot-objs := dm-snap.o dm-exception-store.o dm-mirror-objs := dm-log.o dm-raid1.o +dm-rdac-objs := dm-mpath-rdac.o md-mod-objs := md.o bitmap.o raid456-objs := raid5.o raid6algos.o raid6recov.o raid6tables.o \ raid6int1.o raid6int2.o raid6int4.o \
@@ -34,6 +35,7 @@ obj-$(CONFIG_DM_CRYPT) += dm-crypt.o obj-$(CONFIG_DM_DELAY) += dm-delay.o obj-$(CONFIG_DM_MULTIPATH) += dm-multipath.o dm-round-robin.o obj-$(CONFIG_DM_MULTIPATH_EMC) += dm-emc.o +obj-$(CONFIG_DM_MULTIPATH_RDAC) += dm-rdac.o obj-$(CONFIG_DM_SNAPSHOT) += dm-snapshot.o obj-$(CONFIG_DM_MIRROR) += dm-mirror.o obj-$(CONFIG_DM_ZERO) += dm-zero.o
drivers/md/dm-mpath-rdac.c new file +700 -0
700 lines not on this page · raw message
Signature · 4 lines
----------------------------------------------------------------------
Chandra Seetharaman | Be careful what you choose....
- [email protected] | .......you may get it.
----------------------------------------------------------------------