aoedev.c (c25141062a82ae8bddced1b3ce2b57a1c0efabe0) aoedev.c (0e0cc9df86bc56e5d55a72e0adf530d6f7fe8628)
1/* Copyright (c) 2013 Coraid, Inc. See COPYING for GPL terms. */
2/*
3 * aoedev.c
4 * AoE device utility functions; maintains device list.
5 */
6
7#include <linux/hdreg.h>
8#include <linux/blkdev.h>
9#include <linux/netdevice.h>
10#include <linux/delay.h>
11#include <linux/slab.h>
12#include <linux/bitmap.h>
13#include <linux/kdev_t.h>
14#include <linux/moduleparam.h>
15#include <linux/string.h>
16#include "aoe.h"
17
1/* Copyright (c) 2013 Coraid, Inc. See COPYING for GPL terms. */
2/*
3 * aoedev.c
4 * AoE device utility functions; maintains device list.
5 */
6
7#include <linux/hdreg.h>
8#include <linux/blkdev.h>
9#include <linux/netdevice.h>
10#include <linux/delay.h>
11#include <linux/slab.h>
12#include <linux/bitmap.h>
13#include <linux/kdev_t.h>
14#include <linux/moduleparam.h>
15#include <linux/string.h>
16#include "aoe.h"
17
18static void dummy_timer(ulong);
19static void freetgt(struct aoedev *d, struct aoetgt *t);
20static void skbpoolfree(struct aoedev *d);
21
22static int aoe_dyndevs = 1;
23module_param(aoe_dyndevs, int, 0644);
24MODULE_PARM_DESC(aoe_dyndevs, "Use dynamic minor numbers for devices.");
25
26static struct aoedev *devlist;

--- 114 unchanged lines hidden (view full) ---

141 ulong flags;
142
143 spin_lock_irqsave(&devlist_lock, flags);
144 d->ref--;
145 spin_unlock_irqrestore(&devlist_lock, flags);
146}
147
148static void
18static void freetgt(struct aoedev *d, struct aoetgt *t);
19static void skbpoolfree(struct aoedev *d);
20
21static int aoe_dyndevs = 1;
22module_param(aoe_dyndevs, int, 0644);
23MODULE_PARM_DESC(aoe_dyndevs, "Use dynamic minor numbers for devices.");
24
25static struct aoedev *devlist;

--- 114 unchanged lines hidden (view full) ---

140 ulong flags;
141
142 spin_lock_irqsave(&devlist_lock, flags);
143 d->ref--;
144 spin_unlock_irqrestore(&devlist_lock, flags);
145}
146
147static void
149dummy_timer(ulong vp)
148dummy_timer(struct timer_list *t)
150{
151 struct aoedev *d;
152
149{
150 struct aoedev *d;
151
153 d = (struct aoedev *)vp;
152 d = from_timer(d, t, timer);
154 if (d->flags & DEVFL_TKILL)
155 return;
156 d->timer.expires = jiffies + HZ;
157 add_timer(&d->timer);
158}
159
160static void
161aoe_failip(struct aoedev *d)

--- 299 unchanged lines hidden (view full) ---

461 kfree(d);
462 d = NULL;
463 goto out;
464 }
465 d->ntargets = NTARGETS;
466 INIT_WORK(&d->work, aoecmd_sleepwork);
467 spin_lock_init(&d->lock);
468 skb_queue_head_init(&d->skbpool);
153 if (d->flags & DEVFL_TKILL)
154 return;
155 d->timer.expires = jiffies + HZ;
156 add_timer(&d->timer);
157}
158
159static void
160aoe_failip(struct aoedev *d)

--- 299 unchanged lines hidden (view full) ---

460 kfree(d);
461 d = NULL;
462 goto out;
463 }
464 d->ntargets = NTARGETS;
465 INIT_WORK(&d->work, aoecmd_sleepwork);
466 spin_lock_init(&d->lock);
467 skb_queue_head_init(&d->skbpool);
469 init_timer(&d->timer);
470 d->timer.data = (ulong) d;
471 d->timer.function = dummy_timer;
468 timer_setup(&d->timer, dummy_timer, 0);
472 d->timer.expires = jiffies + HZ;
473 add_timer(&d->timer);
474 d->bufpool = NULL; /* defer to aoeblk_gdalloc */
475 d->tgt = d->targets;
476 d->ref = 1;
477 for (i = 0; i < NFACTIVE; i++)
478 INIT_LIST_HEAD(&d->factive[i]);
479 INIT_LIST_HEAD(&d->rexmitq);

--- 47 unchanged lines hidden ---
469 d->timer.expires = jiffies + HZ;
470 add_timer(&d->timer);
471 d->bufpool = NULL; /* defer to aoeblk_gdalloc */
472 d->tgt = d->targets;
473 d->ref = 1;
474 for (i = 0; i < NFACTIVE; i++)
475 INIT_LIST_HEAD(&d->factive[i]);
476 INIT_LIST_HEAD(&d->rexmitq);

--- 47 unchanged lines hidden ---