2006-09-21 02:36:48 +08:00
|
|
|
/* Copyright (c) 2006 Coraid, Inc. See COPYING for GPL terms. */
|
2005-04-17 06:20:36 +08:00
|
|
|
/*
|
|
|
|
* aoedev.c
|
|
|
|
* AoE device utility functions; maintains device list.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <linux/hdreg.h>
|
|
|
|
#include <linux/blkdev.h>
|
|
|
|
#include <linux/netdevice.h>
|
|
|
|
#include "aoe.h"
|
|
|
|
|
2008-02-08 20:20:03 +08:00
|
|
|
static void dummy_timer(ulong);
|
|
|
|
static void aoedev_freedev(struct aoedev *);
|
|
|
|
static void freetgt(struct aoetgt *t);
|
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
static struct aoedev *devlist;
|
|
|
|
static spinlock_t devlist_lock;
|
|
|
|
|
2006-01-20 02:46:19 +08:00
|
|
|
int
|
|
|
|
aoedev_isbusy(struct aoedev *d)
|
|
|
|
{
|
aoe: handle multiple network paths to AoE device
A remote AoE device is something can process ATA commands and is identified by
an AoE shelf number and an AoE slot number. Such a device might have more
than one network interface, and it might be reachable by more than one local
network interface. This patch tracks the available network paths available to
each AoE device, allowing them to be used more efficiently.
Andrew Morton asked about the call to msleep_interruptible in the revalidate
function. Yes, if a signal is pending, then msleep_interruptible will not
return 0. That means we will not loop but will call aoenet_xmit with a NULL
skb, which is a noop. If the system is too low on memory or the aoe driver is
too low on frames, then the user can hit control-C to interrupt the attempt to
do a revalidate. I have added a comment to the code summarizing that.
Andrew Morton asked whether the allocation performed inside addtgt could use a
more relaxed allocation like GFP_KERNEL, but addtgt is called when the aoedev
lock has been locked with spin_lock_irqsave. It would be nice to allocate the
memory under fewer restrictions, but targets are only added when the device is
being discovered, and if the target can't be added right now, we can try again
in a minute when then next AoE config query broadcast goes out.
Andrew Morton pointed out that the "too many targets" message could be printed
for failing GFP_ATOMIC allocations. The last patch in this series makes the
messages more specific.
Signed-off-by: Ed L. Cashin <ecashin@coraid.com>
Cc: Greg KH <greg@kroah.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-02-08 20:20:00 +08:00
|
|
|
struct aoetgt **t, **te;
|
2006-01-20 02:46:19 +08:00
|
|
|
struct frame *f, *e;
|
|
|
|
|
aoe: handle multiple network paths to AoE device
A remote AoE device is something can process ATA commands and is identified by
an AoE shelf number and an AoE slot number. Such a device might have more
than one network interface, and it might be reachable by more than one local
network interface. This patch tracks the available network paths available to
each AoE device, allowing them to be used more efficiently.
Andrew Morton asked about the call to msleep_interruptible in the revalidate
function. Yes, if a signal is pending, then msleep_interruptible will not
return 0. That means we will not loop but will call aoenet_xmit with a NULL
skb, which is a noop. If the system is too low on memory or the aoe driver is
too low on frames, then the user can hit control-C to interrupt the attempt to
do a revalidate. I have added a comment to the code summarizing that.
Andrew Morton asked whether the allocation performed inside addtgt could use a
more relaxed allocation like GFP_KERNEL, but addtgt is called when the aoedev
lock has been locked with spin_lock_irqsave. It would be nice to allocate the
memory under fewer restrictions, but targets are only added when the device is
being discovered, and if the target can't be added right now, we can try again
in a minute when then next AoE config query broadcast goes out.
Andrew Morton pointed out that the "too many targets" message could be printed
for failing GFP_ATOMIC allocations. The last patch in this series makes the
messages more specific.
Signed-off-by: Ed L. Cashin <ecashin@coraid.com>
Cc: Greg KH <greg@kroah.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-02-08 20:20:00 +08:00
|
|
|
t = d->targets;
|
|
|
|
te = t + NTARGETS;
|
|
|
|
for (; t < te && *t; t++) {
|
|
|
|
f = (*t)->frames;
|
|
|
|
e = f + (*t)->nframes;
|
|
|
|
for (; f < e; f++)
|
|
|
|
if (f->tag != FREETAG)
|
|
|
|
return 1;
|
|
|
|
}
|
2006-01-20 02:46:19 +08:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
struct aoedev *
|
2005-04-19 13:00:18 +08:00
|
|
|
aoedev_by_aoeaddr(int maj, int min)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
|
|
|
struct aoedev *d;
|
|
|
|
ulong flags;
|
|
|
|
|
|
|
|
spin_lock_irqsave(&devlist_lock, flags);
|
|
|
|
|
|
|
|
for (d=devlist; d; d=d->next)
|
2005-04-19 13:00:18 +08:00
|
|
|
if (d->aoemajor == maj && d->aoeminor == min)
|
2005-04-17 06:20:36 +08:00
|
|
|
break;
|
|
|
|
|
|
|
|
spin_unlock_irqrestore(&devlist_lock, flags);
|
|
|
|
return d;
|
|
|
|
}
|
|
|
|
|
2006-01-20 02:46:19 +08:00
|
|
|
static void
|
|
|
|
dummy_timer(ulong vp)
|
|
|
|
{
|
|
|
|
struct aoedev *d;
|
|
|
|
|
|
|
|
d = (struct aoedev *)vp;
|
|
|
|
if (d->flags & DEVFL_TKILL)
|
|
|
|
return;
|
|
|
|
d->timer.expires = jiffies + HZ;
|
|
|
|
add_timer(&d->timer);
|
|
|
|
}
|
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
void
|
|
|
|
aoedev_downdev(struct aoedev *d)
|
|
|
|
{
|
aoe: handle multiple network paths to AoE device
A remote AoE device is something can process ATA commands and is identified by
an AoE shelf number and an AoE slot number. Such a device might have more
than one network interface, and it might be reachable by more than one local
network interface. This patch tracks the available network paths available to
each AoE device, allowing them to be used more efficiently.
Andrew Morton asked about the call to msleep_interruptible in the revalidate
function. Yes, if a signal is pending, then msleep_interruptible will not
return 0. That means we will not loop but will call aoenet_xmit with a NULL
skb, which is a noop. If the system is too low on memory or the aoe driver is
too low on frames, then the user can hit control-C to interrupt the attempt to
do a revalidate. I have added a comment to the code summarizing that.
Andrew Morton asked whether the allocation performed inside addtgt could use a
more relaxed allocation like GFP_KERNEL, but addtgt is called when the aoedev
lock has been locked with spin_lock_irqsave. It would be nice to allocate the
memory under fewer restrictions, but targets are only added when the device is
being discovered, and if the target can't be added right now, we can try again
in a minute when then next AoE config query broadcast goes out.
Andrew Morton pointed out that the "too many targets" message could be printed
for failing GFP_ATOMIC allocations. The last patch in this series makes the
messages more specific.
Signed-off-by: Ed L. Cashin <ecashin@coraid.com>
Cc: Greg KH <greg@kroah.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-02-08 20:20:00 +08:00
|
|
|
struct aoetgt **t, **te;
|
2005-04-17 06:20:36 +08:00
|
|
|
struct frame *f, *e;
|
|
|
|
struct buf *buf;
|
|
|
|
struct bio *bio;
|
|
|
|
|
aoe: handle multiple network paths to AoE device
A remote AoE device is something can process ATA commands and is identified by
an AoE shelf number and an AoE slot number. Such a device might have more
than one network interface, and it might be reachable by more than one local
network interface. This patch tracks the available network paths available to
each AoE device, allowing them to be used more efficiently.
Andrew Morton asked about the call to msleep_interruptible in the revalidate
function. Yes, if a signal is pending, then msleep_interruptible will not
return 0. That means we will not loop but will call aoenet_xmit with a NULL
skb, which is a noop. If the system is too low on memory or the aoe driver is
too low on frames, then the user can hit control-C to interrupt the attempt to
do a revalidate. I have added a comment to the code summarizing that.
Andrew Morton asked whether the allocation performed inside addtgt could use a
more relaxed allocation like GFP_KERNEL, but addtgt is called when the aoedev
lock has been locked with spin_lock_irqsave. It would be nice to allocate the
memory under fewer restrictions, but targets are only added when the device is
being discovered, and if the target can't be added right now, we can try again
in a minute when then next AoE config query broadcast goes out.
Andrew Morton pointed out that the "too many targets" message could be printed
for failing GFP_ATOMIC allocations. The last patch in this series makes the
messages more specific.
Signed-off-by: Ed L. Cashin <ecashin@coraid.com>
Cc: Greg KH <greg@kroah.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-02-08 20:20:00 +08:00
|
|
|
t = d->targets;
|
|
|
|
te = t + NTARGETS;
|
|
|
|
for (; t < te && *t; t++) {
|
|
|
|
f = (*t)->frames;
|
|
|
|
e = f + (*t)->nframes;
|
|
|
|
for (; f < e; f->tag = FREETAG, f->buf = NULL, f++) {
|
|
|
|
if (f->tag == FREETAG || f->buf == NULL)
|
|
|
|
continue;
|
|
|
|
buf = f->buf;
|
|
|
|
bio = buf->bio;
|
|
|
|
if (--buf->nframesout == 0
|
|
|
|
&& buf != d->inprocess) {
|
|
|
|
mempool_free(buf, d->bufpool);
|
|
|
|
bio_endio(bio, -EIO);
|
|
|
|
}
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
aoe: handle multiple network paths to AoE device
A remote AoE device is something can process ATA commands and is identified by
an AoE shelf number and an AoE slot number. Such a device might have more
than one network interface, and it might be reachable by more than one local
network interface. This patch tracks the available network paths available to
each AoE device, allowing them to be used more efficiently.
Andrew Morton asked about the call to msleep_interruptible in the revalidate
function. Yes, if a signal is pending, then msleep_interruptible will not
return 0. That means we will not loop but will call aoenet_xmit with a NULL
skb, which is a noop. If the system is too low on memory or the aoe driver is
too low on frames, then the user can hit control-C to interrupt the attempt to
do a revalidate. I have added a comment to the code summarizing that.
Andrew Morton asked whether the allocation performed inside addtgt could use a
more relaxed allocation like GFP_KERNEL, but addtgt is called when the aoedev
lock has been locked with spin_lock_irqsave. It would be nice to allocate the
memory under fewer restrictions, but targets are only added when the device is
being discovered, and if the target can't be added right now, we can try again
in a minute when then next AoE config query broadcast goes out.
Andrew Morton pointed out that the "too many targets" message could be printed
for failing GFP_ATOMIC allocations. The last patch in this series makes the
messages more specific.
Signed-off-by: Ed L. Cashin <ecashin@coraid.com>
Cc: Greg KH <greg@kroah.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-02-08 20:20:00 +08:00
|
|
|
(*t)->maxout = (*t)->nframes;
|
|
|
|
(*t)->nout = 0;
|
|
|
|
}
|
|
|
|
buf = d->inprocess;
|
|
|
|
if (buf) {
|
|
|
|
bio = buf->bio;
|
|
|
|
mempool_free(buf, d->bufpool);
|
|
|
|
bio_endio(bio, -EIO);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
d->inprocess = NULL;
|
aoe: handle multiple network paths to AoE device
A remote AoE device is something can process ATA commands and is identified by
an AoE shelf number and an AoE slot number. Such a device might have more
than one network interface, and it might be reachable by more than one local
network interface. This patch tracks the available network paths available to
each AoE device, allowing them to be used more efficiently.
Andrew Morton asked about the call to msleep_interruptible in the revalidate
function. Yes, if a signal is pending, then msleep_interruptible will not
return 0. That means we will not loop but will call aoenet_xmit with a NULL
skb, which is a noop. If the system is too low on memory or the aoe driver is
too low on frames, then the user can hit control-C to interrupt the attempt to
do a revalidate. I have added a comment to the code summarizing that.
Andrew Morton asked whether the allocation performed inside addtgt could use a
more relaxed allocation like GFP_KERNEL, but addtgt is called when the aoedev
lock has been locked with spin_lock_irqsave. It would be nice to allocate the
memory under fewer restrictions, but targets are only added when the device is
being discovered, and if the target can't be added right now, we can try again
in a minute when then next AoE config query broadcast goes out.
Andrew Morton pointed out that the "too many targets" message could be printed
for failing GFP_ATOMIC allocations. The last patch in this series makes the
messages more specific.
Signed-off-by: Ed L. Cashin <ecashin@coraid.com>
Cc: Greg KH <greg@kroah.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-02-08 20:20:00 +08:00
|
|
|
d->htgt = NULL;
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
while (!list_empty(&d->bufq)) {
|
|
|
|
buf = container_of(d->bufq.next, struct buf, bufs);
|
|
|
|
list_del(d->bufq.next);
|
|
|
|
bio = buf->bio;
|
|
|
|
mempool_free(buf, d->bufpool);
|
2007-09-27 18:47:43 +08:00
|
|
|
bio_endio(bio, -EIO);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
if (d->gd)
|
|
|
|
d->gd->capacity = 0;
|
|
|
|
|
aoe: handle multiple network paths to AoE device
A remote AoE device is something can process ATA commands and is identified by
an AoE shelf number and an AoE slot number. Such a device might have more
than one network interface, and it might be reachable by more than one local
network interface. This patch tracks the available network paths available to
each AoE device, allowing them to be used more efficiently.
Andrew Morton asked about the call to msleep_interruptible in the revalidate
function. Yes, if a signal is pending, then msleep_interruptible will not
return 0. That means we will not loop but will call aoenet_xmit with a NULL
skb, which is a noop. If the system is too low on memory or the aoe driver is
too low on frames, then the user can hit control-C to interrupt the attempt to
do a revalidate. I have added a comment to the code summarizing that.
Andrew Morton asked whether the allocation performed inside addtgt could use a
more relaxed allocation like GFP_KERNEL, but addtgt is called when the aoedev
lock has been locked with spin_lock_irqsave. It would be nice to allocate the
memory under fewer restrictions, but targets are only added when the device is
being discovered, and if the target can't be added right now, we can try again
in a minute when then next AoE config query broadcast goes out.
Andrew Morton pointed out that the "too many targets" message could be printed
for failing GFP_ATOMIC allocations. The last patch in this series makes the
messages more specific.
Signed-off-by: Ed L. Cashin <ecashin@coraid.com>
Cc: Greg KH <greg@kroah.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-02-08 20:20:00 +08:00
|
|
|
d->flags &= ~DEVFL_UP;
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
2008-02-08 20:20:03 +08:00
|
|
|
static void
|
|
|
|
aoedev_freedev(struct aoedev *d)
|
|
|
|
{
|
|
|
|
struct aoetgt **t, **e;
|
|
|
|
|
|
|
|
if (d->gd) {
|
|
|
|
aoedisk_rm_sysfs(d);
|
|
|
|
del_gendisk(d->gd);
|
|
|
|
put_disk(d->gd);
|
|
|
|
}
|
|
|
|
t = d->targets;
|
|
|
|
e = t + NTARGETS;
|
|
|
|
for (; t < e && *t; t++)
|
|
|
|
freetgt(*t);
|
|
|
|
if (d->bufpool)
|
|
|
|
mempool_destroy(d->bufpool);
|
|
|
|
kfree(d);
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
aoedev_flush(const char __user *str, size_t cnt)
|
|
|
|
{
|
|
|
|
ulong flags;
|
|
|
|
struct aoedev *d, **dd;
|
|
|
|
struct aoedev *rmd = NULL;
|
|
|
|
char buf[16];
|
|
|
|
int all = 0;
|
|
|
|
|
|
|
|
if (cnt >= 3) {
|
|
|
|
if (cnt > sizeof buf)
|
|
|
|
cnt = sizeof buf;
|
|
|
|
if (copy_from_user(buf, str, cnt))
|
|
|
|
return -EFAULT;
|
|
|
|
all = !strncmp(buf, "all", 3);
|
|
|
|
}
|
|
|
|
|
|
|
|
flush_scheduled_work();
|
|
|
|
spin_lock_irqsave(&devlist_lock, flags);
|
|
|
|
dd = &devlist;
|
|
|
|
while ((d = *dd)) {
|
|
|
|
spin_lock(&d->lock);
|
|
|
|
if ((!all && (d->flags & DEVFL_UP))
|
|
|
|
|| (d->flags & (DEVFL_GDALLOC|DEVFL_NEWSIZE))
|
|
|
|
|| d->nopen) {
|
|
|
|
spin_unlock(&d->lock);
|
|
|
|
dd = &d->next;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
*dd = d->next;
|
|
|
|
aoedev_downdev(d);
|
|
|
|
d->flags |= DEVFL_TKILL;
|
|
|
|
spin_unlock(&d->lock);
|
|
|
|
d->next = rmd;
|
|
|
|
rmd = d;
|
|
|
|
}
|
|
|
|
spin_unlock_irqrestore(&devlist_lock, flags);
|
|
|
|
while ((d = rmd)) {
|
|
|
|
rmd = d->next;
|
|
|
|
del_timer_sync(&d->timer);
|
|
|
|
aoedev_freedev(d); /* must be able to sleep */
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2006-01-20 02:46:19 +08:00
|
|
|
/* find it or malloc it */
|
2005-04-17 06:20:36 +08:00
|
|
|
struct aoedev *
|
aoe: handle multiple network paths to AoE device
A remote AoE device is something can process ATA commands and is identified by
an AoE shelf number and an AoE slot number. Such a device might have more
than one network interface, and it might be reachable by more than one local
network interface. This patch tracks the available network paths available to
each AoE device, allowing them to be used more efficiently.
Andrew Morton asked about the call to msleep_interruptible in the revalidate
function. Yes, if a signal is pending, then msleep_interruptible will not
return 0. That means we will not loop but will call aoenet_xmit with a NULL
skb, which is a noop. If the system is too low on memory or the aoe driver is
too low on frames, then the user can hit control-C to interrupt the attempt to
do a revalidate. I have added a comment to the code summarizing that.
Andrew Morton asked whether the allocation performed inside addtgt could use a
more relaxed allocation like GFP_KERNEL, but addtgt is called when the aoedev
lock has been locked with spin_lock_irqsave. It would be nice to allocate the
memory under fewer restrictions, but targets are only added when the device is
being discovered, and if the target can't be added right now, we can try again
in a minute when then next AoE config query broadcast goes out.
Andrew Morton pointed out that the "too many targets" message could be printed
for failing GFP_ATOMIC allocations. The last patch in this series makes the
messages more specific.
Signed-off-by: Ed L. Cashin <ecashin@coraid.com>
Cc: Greg KH <greg@kroah.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-02-08 20:20:00 +08:00
|
|
|
aoedev_by_sysminor_m(ulong sysminor)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
|
|
|
struct aoedev *d;
|
|
|
|
ulong flags;
|
|
|
|
|
|
|
|
spin_lock_irqsave(&devlist_lock, flags);
|
|
|
|
|
|
|
|
for (d=devlist; d; d=d->next)
|
2005-04-29 22:24:22 +08:00
|
|
|
if (d->sysminor == sysminor)
|
2005-04-17 06:20:36 +08:00
|
|
|
break;
|
aoe: handle multiple network paths to AoE device
A remote AoE device is something can process ATA commands and is identified by
an AoE shelf number and an AoE slot number. Such a device might have more
than one network interface, and it might be reachable by more than one local
network interface. This patch tracks the available network paths available to
each AoE device, allowing them to be used more efficiently.
Andrew Morton asked about the call to msleep_interruptible in the revalidate
function. Yes, if a signal is pending, then msleep_interruptible will not
return 0. That means we will not loop but will call aoenet_xmit with a NULL
skb, which is a noop. If the system is too low on memory or the aoe driver is
too low on frames, then the user can hit control-C to interrupt the attempt to
do a revalidate. I have added a comment to the code summarizing that.
Andrew Morton asked whether the allocation performed inside addtgt could use a
more relaxed allocation like GFP_KERNEL, but addtgt is called when the aoedev
lock has been locked with spin_lock_irqsave. It would be nice to allocate the
memory under fewer restrictions, but targets are only added when the device is
being discovered, and if the target can't be added right now, we can try again
in a minute when then next AoE config query broadcast goes out.
Andrew Morton pointed out that the "too many targets" message could be printed
for failing GFP_ATOMIC allocations. The last patch in this series makes the
messages more specific.
Signed-off-by: Ed L. Cashin <ecashin@coraid.com>
Cc: Greg KH <greg@kroah.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-02-08 20:20:00 +08:00
|
|
|
if (d)
|
|
|
|
goto out;
|
|
|
|
d = kcalloc(1, sizeof *d, GFP_ATOMIC);
|
|
|
|
if (!d)
|
|
|
|
goto out;
|
|
|
|
INIT_WORK(&d->work, aoecmd_sleepwork);
|
|
|
|
spin_lock_init(&d->lock);
|
|
|
|
init_timer(&d->timer);
|
|
|
|
d->timer.data = (ulong) d;
|
|
|
|
d->timer.function = dummy_timer;
|
|
|
|
d->timer.expires = jiffies + HZ;
|
|
|
|
add_timer(&d->timer);
|
|
|
|
d->bufpool = NULL; /* defer to aoeblk_gdalloc */
|
|
|
|
d->tgt = d->targets;
|
|
|
|
INIT_LIST_HEAD(&d->bufq);
|
|
|
|
d->sysminor = sysminor;
|
|
|
|
d->aoemajor = AOEMAJOR(sysminor);
|
|
|
|
d->aoeminor = AOEMINOR(sysminor);
|
|
|
|
d->mintimer = MINTIMER;
|
|
|
|
d->next = devlist;
|
|
|
|
devlist = d;
|
|
|
|
out:
|
2006-01-20 02:46:19 +08:00
|
|
|
spin_unlock_irqrestore(&devlist_lock, flags);
|
2005-04-17 06:20:36 +08:00
|
|
|
return d;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
aoe: handle multiple network paths to AoE device
A remote AoE device is something can process ATA commands and is identified by
an AoE shelf number and an AoE slot number. Such a device might have more
than one network interface, and it might be reachable by more than one local
network interface. This patch tracks the available network paths available to
each AoE device, allowing them to be used more efficiently.
Andrew Morton asked about the call to msleep_interruptible in the revalidate
function. Yes, if a signal is pending, then msleep_interruptible will not
return 0. That means we will not loop but will call aoenet_xmit with a NULL
skb, which is a noop. If the system is too low on memory or the aoe driver is
too low on frames, then the user can hit control-C to interrupt the attempt to
do a revalidate. I have added a comment to the code summarizing that.
Andrew Morton asked whether the allocation performed inside addtgt could use a
more relaxed allocation like GFP_KERNEL, but addtgt is called when the aoedev
lock has been locked with spin_lock_irqsave. It would be nice to allocate the
memory under fewer restrictions, but targets are only added when the device is
being discovered, and if the target can't be added right now, we can try again
in a minute when then next AoE config query broadcast goes out.
Andrew Morton pointed out that the "too many targets" message could be printed
for failing GFP_ATOMIC allocations. The last patch in this series makes the
messages more specific.
Signed-off-by: Ed L. Cashin <ecashin@coraid.com>
Cc: Greg KH <greg@kroah.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-02-08 20:20:00 +08:00
|
|
|
freetgt(struct aoetgt *t)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
2006-09-21 02:36:49 +08:00
|
|
|
struct frame *f, *e;
|
|
|
|
|
aoe: handle multiple network paths to AoE device
A remote AoE device is something can process ATA commands and is identified by
an AoE shelf number and an AoE slot number. Such a device might have more
than one network interface, and it might be reachable by more than one local
network interface. This patch tracks the available network paths available to
each AoE device, allowing them to be used more efficiently.
Andrew Morton asked about the call to msleep_interruptible in the revalidate
function. Yes, if a signal is pending, then msleep_interruptible will not
return 0. That means we will not loop but will call aoenet_xmit with a NULL
skb, which is a noop. If the system is too low on memory or the aoe driver is
too low on frames, then the user can hit control-C to interrupt the attempt to
do a revalidate. I have added a comment to the code summarizing that.
Andrew Morton asked whether the allocation performed inside addtgt could use a
more relaxed allocation like GFP_KERNEL, but addtgt is called when the aoedev
lock has been locked with spin_lock_irqsave. It would be nice to allocate the
memory under fewer restrictions, but targets are only added when the device is
being discovered, and if the target can't be added right now, we can try again
in a minute when then next AoE config query broadcast goes out.
Andrew Morton pointed out that the "too many targets" message could be printed
for failing GFP_ATOMIC allocations. The last patch in this series makes the
messages more specific.
Signed-off-by: Ed L. Cashin <ecashin@coraid.com>
Cc: Greg KH <greg@kroah.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-02-08 20:20:00 +08:00
|
|
|
f = t->frames;
|
|
|
|
e = f + t->nframes;
|
|
|
|
for (; f < e; f++) {
|
|
|
|
skb_shinfo(f->skb)->nr_frags = 0;
|
|
|
|
dev_kfree_skb(f->skb);
|
|
|
|
}
|
|
|
|
kfree(t->frames);
|
|
|
|
kfree(t);
|
|
|
|
}
|
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
void
|
|
|
|
aoedev_exit(void)
|
|
|
|
{
|
|
|
|
struct aoedev *d;
|
|
|
|
ulong flags;
|
|
|
|
|
|
|
|
flush_scheduled_work();
|
|
|
|
|
|
|
|
while ((d = devlist)) {
|
|
|
|
devlist = d->next;
|
|
|
|
|
|
|
|
spin_lock_irqsave(&d->lock, flags);
|
|
|
|
aoedev_downdev(d);
|
2006-01-20 02:46:19 +08:00
|
|
|
d->flags |= DEVFL_TKILL;
|
2005-04-17 06:20:36 +08:00
|
|
|
spin_unlock_irqrestore(&d->lock, flags);
|
|
|
|
|
|
|
|
del_timer_sync(&d->timer);
|
|
|
|
aoedev_freedev(d);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
int __init
|
|
|
|
aoedev_init(void)
|
|
|
|
{
|
|
|
|
spin_lock_init(&devlist_lock);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|