diff options
author | Ed Cashin <ecashin@coraid.com> | 2012-12-18 04:04:11 +0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-12-18 05:15:25 +0400 |
commit | 71114ec45f09eb6ef6f9d41c98d4ab6455086e58 (patch) | |
tree | 3f25f6e70364656b06387955764cd61e08148d3f /drivers/block/aoe/aoedev.c | |
parent | e52a29326462badd9ceec90a9eb2ac2a8550e02e (diff) | |
download | linux-71114ec45f09eb6ef6f9d41c98d4ab6455086e58.tar.xz |
aoe: use dynamic number of remote ports for AoE storage target
Many AoE targets have four or fewer network ports, but some existing
storage devices have many, and the AoE protocol sets no limit.
This patch allows the use of more than eight remote MAC addresses per AoE
target, while reducing the amount of memory used by the aoe driver in
cases where there are many AoE targets with fewer than eight MAC addresses
each.
Signed-off-by: Ed Cashin <ecashin@coraid.com>
Cc: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/block/aoe/aoedev.c')
-rw-r--r-- | drivers/block/aoe/aoedev.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/drivers/block/aoe/aoedev.c b/drivers/block/aoe/aoedev.c index 3776715eb255..e66ccbf41a50 100644 --- a/drivers/block/aoe/aoedev.c +++ b/drivers/block/aoe/aoedev.c @@ -214,7 +214,7 @@ aoedev_downdev(struct aoedev *d) /* reset window dressings */ tt = d->targets; - te = tt + NTARGETS; + te = tt + d->ntargets; for (; tt < te && (t = *tt); tt++) { aoecmd_wreset(t); t->nout = 0; @@ -284,7 +284,7 @@ freedev(struct aoedev *d) blk_cleanup_queue(d->blkq); } t = d->targets; - e = t + NTARGETS; + e = t + d->ntargets; for (; t < e && *t; t++) freetgt(d, *t); if (d->bufpool) @@ -376,6 +376,8 @@ restart: dd = &d->next; } spin_unlock(&d->lock); + if (doomed) + kfree(doomed->targets); kfree(doomed); } spin_unlock_irqrestore(&devlist_lock, flags); @@ -456,6 +458,12 @@ aoedev_by_aoeaddr(ulong maj, int min, int do_alloc) d = kcalloc(1, sizeof *d, GFP_ATOMIC); if (!d) goto out; + d->targets = kcalloc(NTARGETS, sizeof(*d->targets), GFP_ATOMIC); + if (!d->targets) { + kfree(d); + goto out; + } + d->ntargets = NTARGETS; INIT_WORK(&d->work, aoecmd_sleepwork); spin_lock_init(&d->lock); skb_queue_head_init(&d->skbpool); |