From 0c966214589b9767fd8771b71328f83bac58cb25 Mon Sep 17 00:00:00 2001 From: Ed Cashin Date: Thu, 4 Oct 2012 17:16:40 -0700 Subject: aoe: support more AoE addresses with dynamic block device minor numbers The ATA over Ethernet protocol uses a major (shelf) and minor (slot) address to identify a particular storage target. These changes remove an artificial limitation the aoe driver imposes on the use of AoE addresses. For example, without these changes, the slot address has a maximum of 15, but users commonly use slot numbers much greater than that. The AoE shelf and slot address space is often used sparsely. Instead of using a static mapping between AoE addresses and the block device minor number, the block device minor numbers are now allocated on demand. Signed-off-by: Ed Cashin Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/block/aoe/aoecmd.c | 25 ++++++++----------------- 1 file changed, 8 insertions(+), 17 deletions(-) (limited to 'drivers/block/aoe/aoecmd.c') diff --git a/drivers/block/aoe/aoecmd.c b/drivers/block/aoe/aoecmd.c index 39dacdbda7f..94e810c36de 100644 --- a/drivers/block/aoe/aoecmd.c +++ b/drivers/block/aoe/aoecmd.c @@ -1149,7 +1149,7 @@ aoecmd_ata_rsp(struct sk_buff *skb) h = (struct aoe_hdr *) skb->data; aoemajor = be16_to_cpu(get_unaligned(&h->major)); - d = aoedev_by_aoeaddr(aoemajor, h->minor); + d = aoedev_by_aoeaddr(aoemajor, h->minor, 0); if (d == NULL) { snprintf(ebuf, sizeof ebuf, "aoecmd_ata_rsp: ata response " "for unknown device %d.%d\n", @@ -1330,7 +1330,7 @@ aoecmd_cfg_rsp(struct sk_buff *skb) struct aoe_hdr *h; struct aoe_cfghdr *ch; struct aoetgt *t; - ulong flags, sysminor, aoemajor; + ulong flags, aoemajor; struct sk_buff *sl; struct sk_buff_head queue; u16 n; @@ -1349,18 +1349,15 @@ aoecmd_cfg_rsp(struct sk_buff *skb) "Check shelf dip switches.\n"); return; } - if (h->minor >= NPERSHELF) { - pr_err("aoe: e%ld.%d %s, %d\n", - aoemajor, h->minor, - "slot number larger than the maximum", - NPERSHELF-1); + if (aoemajor > AOE_MAXSHELF) { + pr_info("aoe: e%ld.%d: shelf number too large\n", + aoemajor, (int) h->minor); return; } - sysminor = SYSMINOR(aoemajor, h->minor); - if (sysminor * AOE_PARTITIONS + AOE_PARTITIONS > MINORMASK) { - printk(KERN_INFO "aoe: e%ld.%d: minor number too large\n", - aoemajor, (int) h->minor); + d = aoedev_by_aoeaddr(aoemajor, h->minor, 1); + if (d == NULL) { + pr_info("aoe: device allocation failure\n"); return; } @@ -1368,12 +1365,6 @@ aoecmd_cfg_rsp(struct sk_buff *skb) if (n > aoe_maxout) /* keep it reasonable */ n = aoe_maxout; - d = aoedev_by_sysminor_m(sysminor); - if (d == NULL) { - printk(KERN_INFO "aoe: device sysminor_m failure\n"); - return; - } - spin_lock_irqsave(&d->lock, flags); t = gettgt(d, h->src); -- cgit v1.2.3