Skip to contentSkip to conversation

AOE fixes and update for 2.6.19-rc2

PATCH New Greg KH 2 participants 16 messages Oct 18, 2006

Subsystems (2)
lore
Share & tools
lore

Greg KH

author
#0 lore raw

PATCH 1/1 AOE fixes and update for 2.6.19-rc2

Here are some ATA over Ethernet patches against your current git tree. They all have been in the -mm tree for a few months.

Please pull from:

	rsync://rsync.kernel.org/pub/scm/linux/kernel/git/gregkh/aoe-2.6.git/
or from:
	master.kernel.org:/pub/scm/linux/kernel/git/gregkh/aoe-2.6.git/

if it isn't synced up yet.

The full patch series will sent to the linux-kernel mailing list, if anyone wants to see them.

thanks,

greg k-h

 drivers/block/aoe/aoe.h     |   30 ++--
 drivers/block/aoe/aoeblk.c  |   44 +++---
 drivers/block/aoe/aoechr.c  |   18 +--
 drivers/block/aoe/aoecmd.c  |  303 ++++++++++++++++++++++++++++---------------
 drivers/block/aoe/aoedev.c  |   52 +++++--
 drivers/block/aoe/aoemain.c |   10 +
 drivers/block/aoe/aoenet.c  |    9 +
 7 files changed, 287 insertions(+), 179 deletions(-)

---------------

Ed L Cashin:
aoe: eliminate isbusy message
aoe: update copyright date
aoe: remove unused NARGS enum
aoe: zero copy write 1 of 2
aoe: jumbo frame support 1 of 2
aoe: clean up printks via macros
aoe: jumbo frame support 2 of 2
aoe: improve retransmission heuristics
aoe: zero copy write 2 of 2
aoe: module parameter for device timeout
aoe: use bio->bi_idx
aoe: remove sysfs comment
aoe: update driver version
aoe: revert printk macros

Greg Kroah-Hartman:
aoe: fix sysfs_create_file warnings

#1 lore raw

PATCH 1/15 aoe: eliminate isbusy message

From: Ed L. Cashin <[email protected]>

This message doesn't help users because the circumstance isn't problematic.

---
 drivers/block/aoe/aoedev.c |    5 +----
 1 files changed, 1 insertions(+), 4 deletions(-)
drivers/block/aoe/aoedev.c +1 -4
index ed4258a..c2bc3ed 100644
@@ -20,11 +20,8 @@ aoedev_isbusy(struct aoedev *d)
 	f = d->frames;
 	e = f + d->nframes;
 	do {
-		if (f->tag != FREETAG) {
-			printk(KERN_DEBUG "aoe: %ld.%ld isbusy\n",
-				d->aoemajor, d->aoeminor);
+		if (f->tag != FREETAG)
 			return 1;
-		}
 	} while (++f < e);
 
 	return 0;
Signature · 1 line
1.4.2.4
#2 lore raw

PATCH 2/15 aoe: update copyright date

From: Ed L. Cashin <[email protected]>

Update the copyright year to 2006.

---
 drivers/block/aoe/aoe.h     |    2 +-
 drivers/block/aoe/aoeblk.c  |    2 +-
 drivers/block/aoe/aoechr.c  |    2 +-
 drivers/block/aoe/aoecmd.c  |    2 +-
 drivers/block/aoe/aoedev.c  |    2 +-
 drivers/block/aoe/aoemain.c |    2 +-
 drivers/block/aoe/aoenet.c  |    2 +-
 7 files changed, 7 insertions(+), 7 deletions(-)
drivers/block/aoe/aoe.h +1 -1
index 6eebcb7..507c377 100644
@@ -1,4 +1,4 @@
-/* Copyright (c) 2004 Coraid, Inc.  See COPYING for GPL terms. */
+/* Copyright (c) 2006 Coraid, Inc.  See COPYING for GPL terms. */
 #define VERSION "22"
 #define AOE_MAJOR 152
 #define DEVICE_NAME "aoe"
drivers/block/aoe/aoeblk.c +1 -1
index 393b86a..fa0e8ca 100644
@@ -1,4 +1,4 @@
-/* Copyright (c) 2004 Coraid, Inc.  See COPYING for GPL terms. */
+/* Copyright (c) 2006 Coraid, Inc.  See COPYING for GPL terms. */
 /*
  * aoeblk.c
  * block device routines
drivers/block/aoe/aoechr.c +1 -1
index 1bc1cf9..8a7a081 100644
@@ -1,4 +1,4 @@
-/* Copyright (c) 2004 Coraid, Inc.  See COPYING for GPL terms. */
+/* Copyright (c) 2006 Coraid, Inc.  See COPYING for GPL terms. */
 /*
  * aoechr.c
  * AoE character device driver
drivers/block/aoe/aoecmd.c +1 -1
index 39da28d..d1d8759 100644
@@ -1,4 +1,4 @@
-/* Copyright (c) 2004 Coraid, Inc.  See COPYING for GPL terms. */
+/* Copyright (c) 2006 Coraid, Inc.  See COPYING for GPL terms. */
 /*
  * aoecmd.c
  * Filesystem request handling methods
drivers/block/aoe/aoedev.c +1 -1
index c2bc3ed..c7e05ed 100644
@@ -1,4 +1,4 @@
-/* Copyright (c) 2004 Coraid, Inc.  See COPYING for GPL terms. */
+/* Copyright (c) 2006 Coraid, Inc.  See COPYING for GPL terms. */
 /*
  * aoedev.c
  * AoE device utility functions; maintains device list.
drivers/block/aoe/aoemain.c +1 -1
index de08491..727c34d 100644
@@ -1,4 +1,4 @@
-/* Copyright (c) 2004 Coraid, Inc.  See COPYING for GPL terms. */
+/* Copyright (c) 2006 Coraid, Inc.  See COPYING for GPL terms. */
 /*
  * aoemain.c
  * Module initialization routines, discover timer
drivers/block/aoe/aoenet.c +1 -1
index c1434ed..1bba140 100644
@@ -1,4 +1,4 @@
-/* Copyright (c) 2004 Coraid, Inc.  See COPYING for GPL terms. */
+/* Copyright (c) 2006 Coraid, Inc.  See COPYING for GPL terms. */
 /*
  * aoenet.c
  * Ethernet portion of AoE driver
Signature · 1 line
1.4.2.4
#3 lore raw

PATCH 3/15 aoe: remove unused NARGS enum

From: Ed L. Cashin <[email protected]>

The NARGS enum is left over from older code versions.

---
 drivers/block/aoe/aoechr.c |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)
drivers/block/aoe/aoechr.c +0 -1
index 8a7a081..0c543d3 100644
@@ -15,7 +15,6 @@ enum {
 	MINOR_INTERFACES,
 	MINOR_REVALIDATE,
 	MSGSZ = 2048,
-	NARGS = 10,
 	NMSG = 100,		/* message backlog to retain */
 };
 
Signature · 1 line
1.4.2.4
#4 lore raw

PATCH 4/15 aoe: zero copy write 1 of 2

From: Ed L. Cashin <[email protected]>

Avoid memory copy on writes.
(This patch depends on fixes in patch 9 to follow.)

Although skb->len should not be set when working with linear skbuffs, the skb->tail pointer maintained by skb_put/skb_trim is not relevant to what happens when the skb_fill_page_desc function is called. This issue was raised without comment in linux-kernel and netdev earlier this month:

http://thread.gmane.org/gmane.linux.kernel/446474/
http://thread.gmane.org/gmane.linux.network/45444/

So until there is something analogous to skb_put that works for zero-copy write skbuffs, we will do what the other callers of skb_fill_page_desc are doing.

---
 drivers/block/aoe/aoe.h    |    7 +--
 drivers/block/aoe/aoecmd.c |   94 +++++++++++++++++---------------------------
 drivers/block/aoe/aoedev.c |   42 ++++++++++++++------
 3 files changed, 69 insertions(+), 74 deletions(-)
drivers/block/aoe/aoe.h +2 -5
index 507c377..fa2d804 100644
@@ -107,11 +107,7 @@ struct frame {
 	ulong waited;
 	struct buf *buf;
 	char *bufaddr;
-	int writedatalen;
-	int ndata;
-
-	/* largest possible */
-	unsigned char data[sizeof(struct aoe_hdr) + sizeof(struct aoe_atahdr)];
+	struct sk_buff *skb;
 };
 
 struct aoedev {
@@ -157,6 +153,7 @@ void aoecmd_cfg(ushort aoemajor, unsigne
 void aoecmd_ata_rsp(struct sk_buff *);
 void aoecmd_cfg_rsp(struct sk_buff *);
 void aoecmd_sleepwork(void *vp);
+struct sk_buff *new_skb(ulong);
 
 int aoedev_init(void);
 void aoedev_exit(void);
drivers/block/aoe/aoecmd.c +37 -57

176 lines not on this page · raw message

drivers/block/aoe/aoedev.c +30 -12

63 lines not on this page · raw message

Signature · 1 line
1.4.2.4
#5 lore raw

PATCH 5/15 aoe: jumbo frame support 1 of 2

From: Ed L. Cashin <[email protected]>

Add support for jumbo ethernet frames. (This patch depends on patch 7 to follow.)

---
 drivers/block/aoe/aoe.h    |   11 +++++-
 drivers/block/aoe/aoechr.c |    1 +
 drivers/block/aoe/aoecmd.c |   77 ++++++++++++++++++++++++++++++++++++--------
 3 files changed, 72 insertions(+), 17 deletions(-)
drivers/block/aoe/aoe.h +8 -3
index fa2d804..1cec199 100644
@@ -65,7 +65,7 @@ struct aoe_atahdr {
 struct aoe_cfghdr {
 	__be16 bufcnt;
 	__be16 fwver;
-	unsigned char res;
+	unsigned char scnt;
 	unsigned char aoeccmd;
 	unsigned char cslen[2];
 };
@@ -78,12 +78,13 @@ enum {
 	DEVFL_GDALLOC = (1<<4),	/* need to alloc gendisk */
 	DEVFL_PAUSE = (1<<5),
 	DEVFL_NEWSIZE = (1<<6),	/* need to update dev size in block layer */
+	DEVFL_MAXBCNT = (1<<7), /* d->maxbcnt is not changeable */
 
 	BUFFL_FAIL = 1,
 };
 
 enum {
-	MAXATADATA = 1024,
+	DEFAULTBCNT = 2 * 512,	/* 2 sectors */
 	NPERSHELF = 16,		/* number of slots per shelf address */
 	FREETAG = -1,
 	MIN_BUFS = 8,
@@ -107,6 +108,8 @@ struct frame {
 	ulong waited;
 	struct buf *buf;
 	char *bufaddr;
+	ulong bcnt;
+	sector_t lba;
 	struct sk_buff *skb;
 };
 
@@ -120,6 +123,7 @@ struct aoedev {
 	ulong nopen;		/* (bd_openers isn't available without sleeping) */
 	ulong rttavg;		/* round trip average of requests/responses */
 	u16 fw_ver;		/* version of blade's firmware */
+	u16 maxbcnt;
 	struct work_struct work;/* disk create work struct */
 	struct gendisk *gd;
 	request_queue_t blkq;
@@ -134,7 +138,8 @@ struct aoedev {
 	struct list_head bufq;	/* queue of bios to work on */
 	struct buf *inprocess;	/* the one we're currently working on */
 	ulong lasttag;		/* last tag sent */
-	ulong nframes;		/* number of frames below */
+	ushort lostjumbo;
+	ushort nframes;		/* number of frames below */
 	struct frame *frames;
 };
 
drivers/block/aoe/aoechr.c +1 -0
index 0c543d3..2b5256c 100644
@@ -89,6 +89,7 @@ revalidate(const char __user *str, size_
 		return -EINVAL;
 
 	spin_lock_irqsave(&d->lock, flags);
+	d->flags &= ~DEVFL_MAXBCNT;
 	d->flags |= DEVFL_PAUSE;
 	spin_unlock_irqrestore(&d->lock, flags);
 	aoecmd_cfg(major, minor);
drivers/block/aoe/aoecmd.c +63 -14

153 lines not on this page · raw message

Signature · 1 line
1.4.2.4
#6 lore raw

PATCH 6/15 aoe: clean up printks via macros

From: Ed L. Cashin <[email protected]>

Use simple macros to clean up the printks. (This patch is reverted by the 14th patch to follow.)

---
 drivers/block/aoe/aoe.h     |    5 ++++
 drivers/block/aoe/aoeblk.c  |   16 +++++-------
 drivers/block/aoe/aoechr.c  |   13 ++++------
 drivers/block/aoe/aoecmd.c  |   57 ++++++++++++++++++++-----------------------
 drivers/block/aoe/aoedev.c  |    2 +-
 drivers/block/aoe/aoemain.c |    8 ++----
 drivers/block/aoe/aoenet.c  |    7 ++---
 7 files changed, 50 insertions(+), 58 deletions(-)
drivers/block/aoe/aoe.h +5 -0
index 1cec199..4d79f1e 100644
@@ -10,6 +10,11 @@ #ifndef AOE_PARTITIONS
 #define AOE_PARTITIONS (16)
 #endif
 
+#define xprintk(L, fmt, arg...) printk(L "aoe: " "%s: " fmt, __func__, ## arg)
+#define iprintk(fmt, arg...) xprintk(KERN_INFO, fmt, ## arg)
+#define eprintk(fmt, arg...) xprintk(KERN_ERR, fmt, ## arg)
+#define dprintk(fmt, arg...) xprintk(KERN_DEBUG, fmt, ## arg)
+
 #define SYSMINOR(aoemajor, aoeminor) ((aoemajor) * NPERSHELF + (aoeminor))
 #define AOEMAJOR(sysminor) ((sysminor) / NPERSHELF)
 #define AOEMINOR(sysminor) ((sysminor) % NPERSHELF)
drivers/block/aoe/aoeblk.c +7 -9
index fa0e8ca..a7dbe6f 100644
@@ -132,8 +132,7 @@ aoeblk_make_request(request_queue_t *q, 
 	d = bio->bi_bdev->bd_disk->private_data;
 	buf = mempool_alloc(d->bufpool, GFP_NOIO);
 	if (buf == NULL) {
-		printk(KERN_INFO "aoe: aoeblk_make_request: buf allocation "
-			"failure\n");
+		iprintk("buf allocation failure\n");
 		bio_endio(bio, bio->bi_size, -ENOMEM);
 		return 0;
 	}
@@ -150,8 +149,7 @@ aoeblk_make_request(request_queue_t *q, 
 	spin_lock_irqsave(&d->lock, flags);
 
 	if ((d->flags & DEVFL_UP) == 0) {
-		printk(KERN_INFO "aoe: aoeblk_make_request: device %ld.%ld is not up\n",
-			d->aoemajor, d->aoeminor);
+		iprintk("device %ld.%ld is not up\n", d->aoemajor, d->aoeminor);
 		spin_unlock_irqrestore(&d->lock, flags);
 		mempool_free(buf, d->bufpool);
 		bio_endio(bio, bio->bi_size, -ENXIO);
@@ -176,7 +174,7 @@ aoeblk_getgeo(struct block_device *bdev,
 	struct aoedev *d = bdev->bd_disk->private_data;
 
 	if ((d->flags & DEVFL_UP) == 0) {
-		printk(KERN_ERR "aoe: aoeblk_ioctl: disk not up\n");
+		eprintk("disk not up\n");
 		return -ENODEV;
 	}
 
@@ -203,8 +201,8 @@ aoeblk_gdalloc(void *vp)
 
 	gd = alloc_disk(AOE_PARTITIONS);
 	if (gd == NULL) {
-		printk(KERN_ERR "aoe: aoeblk_gdalloc: cannot allocate disk "
-			"structure for %ld.%ld\n", d->aoemajor, d->aoeminor);
+		eprintk("cannot allocate disk structure for %ld.%ld\n",
+			d->aoemajor, d->aoeminor);
 		spin_lock_irqsave(&d->lock, flags);
 		d->flags &= ~DEVFL_GDALLOC;
 		spin_unlock_irqrestore(&d->lock, flags);
@@ -213,8 +211,8 @@ aoeblk_gdalloc(void *vp)
 
 	d->bufpool = mempool_create_slab_pool(MIN_BUFS, buf_pool_cache);
 	if (d->bufpool == NULL) {
-		printk(KERN_ERR "aoe: aoeblk_gdalloc: cannot allocate bufpool "
-			"for %ld.%ld\n", d->aoemajor, d->aoeminor);
+		eprintk("cannot allocate bufpool for %ld.%ld\n",
+			d->aoemajor, d->aoeminor);
 		put_disk(gd);
 		spin_lock_irqsave(&d->lock, flags);
 		d->flags &= ~DEVFL_GDALLOC;
drivers/block/aoe/aoechr.c +5 -8
index 2b5256c..f5cab69 100644
@@ -55,9 +55,7 @@ static int
 interfaces(const char __user *str, size_t size)
 {
 	if (set_aoe_iflist(str, size)) {
-		printk(KERN_CRIT
-		       "%s: could not set interface list: %s\n",
-		       __FUNCTION__, "too many interfaces");
+		eprintk("could not set interface list: too many interfaces\n");
 		return -EINVAL;
 	}
 	return 0;
@@ -80,8 +78,7 @@ revalidate(const char __user *str, size_
 	/* should be e%d.%d format */
 	n = sscanf(buf, "e%d.%d", &major, &minor);
 	if (n != 2) {
-		printk(KERN_ERR "aoe: %s: invalid device specification\n",
-			__FUNCTION__);
+		eprintk("invalid device specification\n");
 		return -EINVAL;
 	}
 	d = aoedev_by_aoeaddr(major, minor);
@@ -116,7 +113,7 @@ bail:		spin_unlock_irqrestore(&emsgs_loc
 
 	mp = kmalloc(n, GFP_ATOMIC);
 	if (mp == NULL) {
-		printk(KERN_CRIT "aoe: aoechr_error: allocation failure, len=%ld\n", n);
+		eprintk("allocation failure, len=%ld\n", n);
 		goto bail;
 	}
 
@@ -141,7 +138,7 @@ aoechr_write(struct file *filp, const ch
 
 	switch ((unsigned long) filp->private_data) {
 	default:
-		printk(KERN_INFO "aoe: aoechr_write: can't write to that file.\n");
+		iprintk("can't write to that file.\n");
 		break;
 	case MINOR_DISCOVER:
 		ret = discover();
@@ -250,7 +247,7 @@ aoechr_init(void)
 
 	n = register_chrdev(AOE_MAJOR, "aoechr", &aoe_fops);
 	if (n < 0) { 
-		printk(KERN_ERR "aoe: aoechr_init: can't register char device\n");
+		eprintk("can't register char device\n");
 		return n;
 	}
 	sema_init(&emsgs_sema, 0);
drivers/block/aoe/aoecmd.c +26 -31

149 lines not on this page · raw message

drivers/block/aoe/aoedev.c +1 -1
index abf1d3c..f51d87b 100644
@@ -155,7 +155,7 @@ aoedev_by_sysminor_m(ulong sysminor, ulo
 		d = aoedev_newdev(bufcnt);
 	 	if (d == NULL) {
 			spin_unlock_irqrestore(&devlist_lock, flags);
-			printk(KERN_INFO "aoe: aoedev_set: aoedev_newdev failure.\n");
+			iprintk("aoedev_newdev failure.\n");
 			return NULL;
 		}
 		d->sysminor = sysminor;
drivers/block/aoe/aoemain.c +3 -5
index 727c34d..13e634d 100644
@@ -84,13 +84,11 @@ aoe_init(void)
 		goto net_fail;
 	ret = register_blkdev(AOE_MAJOR, DEVICE_NAME);
 	if (ret < 0) {
-		printk(KERN_ERR "aoe: aoeblk_init: can't register major\n");
+		eprintk("can't register major\n");
 		goto blkreg_fail;
 	}
 
-	printk(KERN_INFO
-	       "aoe: aoe_init: AoE v%s initialised.\n",
-	       VERSION);
+	iprintk("AoE v%s initialised.\n", VERSION);
 	discover_timer(TINIT);
 	return 0;
 
@@ -103,7 +101,7 @@ aoe_init(void)
  chr_fail:
 	aoedev_exit();
 	
-	printk(KERN_INFO "aoe: aoe_init: initialisation failure.\n");
+	iprintk("initialisation failure.\n");
 	return ret;
 }
 
drivers/block/aoe/aoenet.c +3 -4
index 1bba140..f1cf266 100644
@@ -74,7 +74,7 @@ set_aoe_iflist(const char __user *user_s
 		return -EINVAL;
 
 	if (copy_from_user(aoe_iflist, user_str, size)) {
-		printk(KERN_INFO "aoe: %s: copy from user failed\n", __FUNCTION__);
+		iprintk("copy from user failed\n");
 		return -EFAULT;
 	}
 	aoe_iflist[size] = 0x00;
@@ -132,8 +132,7 @@ aoenet_rcv(struct sk_buff *skb, struct n
 		if (n > NECODES)
 			n = 0;
 		if (net_ratelimit())
-			printk(KERN_ERR "aoe: aoenet_rcv: error packet from %d.%d; "
-			       "ecode=%d '%s'\n",
+			eprintk("error packet from %d.%d; ecode=%d '%s'\n",
 			       be16_to_cpu(h->major), h->minor, 
 			       h->err, aoe_errlist[n]);
 		goto exit;
@@ -147,7 +146,7 @@ aoenet_rcv(struct sk_buff *skb, struct n
 		aoecmd_cfg_rsp(skb);
 		break;
 	default:
-		printk(KERN_INFO "aoe: aoenet_rcv: unknown cmd %d\n", h->cmd);
+		iprintk("unknown cmd %d\n", h->cmd);
 	}
 exit:
 	dev_kfree_skb(skb);
Signature · 1 line
1.4.2.4
#7 lore raw

PATCH 7/15 aoe: jumbo frame support 2 of 2

From: Ed L. Cashin <[email protected]>

Add support for jumbo ethernet frames. (This patch follows patch 5.)

---
 drivers/block/aoe/aoecmd.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)
drivers/block/aoe/aoecmd.c +6 -2
index 63c4560..621fdbb 100644
@@ -475,7 +475,7 @@ void
 aoecmd_ata_rsp(struct sk_buff *skb)
 {
 	struct aoedev *d;
-	struct aoe_hdr *hin;
+	struct aoe_hdr *hin, *hout;
 	struct aoe_atahdr *ahin, *ahout;
 	struct frame *f;
 	struct buf *buf;
@@ -515,7 +515,8 @@ aoecmd_ata_rsp(struct sk_buff *skb)
 	calc_rttavg(d, tsince(f->tag));
 
 	ahin = (struct aoe_atahdr *) (hin+1);
-	ahout = (struct aoe_atahdr *) (f->skb->mac.raw + sizeof(struct aoe_hdr));
+	hout = (struct aoe_hdr *) f->skb->mac.raw;
+	ahout = (struct aoe_atahdr *) (hout+1);
 	buf = f->buf;
 
 	if (ahout->cmdstat == WIN_IDENTIFY)
@@ -552,6 +553,9 @@ aoecmd_ata_rsp(struct sk_buff *skb)
 					skb_fill_page_desc(f->skb, 0,
 						virt_to_page(f->bufaddr),
 						offset_in_page(f->bufaddr), n);
+				f->tag = newtag(d);
+				hout->tag = cpu_to_be32(f->tag);
+				skb->dev = d->ifp;
 				skb_get(f->skb);
 				f->skb->next = NULL;
 				spin_unlock_irqrestore(&d->lock, flags);
Signature · 1 line
1.4.2.4
#8 lore raw

PATCH 8/15 aoe: improve retransmission heuristics

From: Ed L. Cashin <[email protected]>

Add a dynamic minimum timer for better retransmission behavior.

---
 drivers/block/aoe/aoe.h    |    7 ++++---
 drivers/block/aoe/aoecmd.c |   16 +++++++++++++---
 2 files changed, 17 insertions(+), 6 deletions(-)
drivers/block/aoe/aoe.h +4 -3
index 4d79f1e..7b11217 100644
@@ -125,8 +125,10 @@ struct aoedev {
 	ulong sysminor;
 	ulong aoemajor;
 	ulong aoeminor;
-	ulong nopen;		/* (bd_openers isn't available without sleeping) */
-	ulong rttavg;		/* round trip average of requests/responses */
+	u16 nopen;		/* (bd_openers isn't available without sleeping) */
+	u16 lasttag;		/* last tag sent */
+	u16 rttavg;		/* round trip average of requests/responses */
+	u16 mintimer;
 	u16 fw_ver;		/* version of blade's firmware */
 	u16 maxbcnt;
 	struct work_struct work;/* disk create work struct */
@@ -142,7 +144,6 @@ struct aoedev {
 	mempool_t *bufpool;	/* for deadlock-free Buf allocation */
 	struct list_head bufq;	/* queue of bios to work on */
 	struct buf *inprocess;	/* the one we're currently working on */
-	ulong lasttag;		/* last tag sent */
 	ushort lostjumbo;
 	ushort nframes;		/* number of frames below */
 	struct frame *frames;
drivers/block/aoe/aoecmd.c +13 -3
index 621fdbb..c0bdc1f 100644
@@ -461,8 +461,15 @@ calc_rttavg(struct aoedev *d, int rtt)
 	register long n;
 
 	n = rtt;
-	if (n < MINTIMER)
-		n = MINTIMER;
+	if (n < 0) {
+		n = -rtt;
+		if (n < MINTIMER)
+			n = MINTIMER;
+		else if (n > MAXTIMER)
+			n = MAXTIMER;
+		d->mintimer += (n - d->mintimer) >> 1;
+	} else if (n < d->mintimer)
+		n = d->mintimer;
 	else if (n > MAXTIMER)
 		n = MAXTIMER;
 
@@ -498,8 +505,10 @@ aoecmd_ata_rsp(struct sk_buff *skb)
 
 	spin_lock_irqsave(&d->lock, flags);
 
-	f = getframe(d, be32_to_cpu(hin->tag));
+	n = be32_to_cpu(hin->tag);
+	f = getframe(d, n);
 	if (f == NULL) {
+		calc_rttavg(d, -tsince(n));
 		spin_unlock_irqrestore(&d->lock, flags);
 		snprintf(ebuf, sizeof ebuf,
 			"%15s e%d.%d    tag=%08x@%08lx\n",
@@ -724,6 +733,7 @@ aoecmd_cfg_rsp(struct sk_buff *skb)
 		return;
 	}
 	d->flags |= DEVFL_PAUSE;	/* force pause */
+	d->mintimer = MINTIMER;
 	d->fw_ver = be16_to_cpu(ch->fwver);
 
 	/* check for already outstanding ataid */
Signature · 1 line
1.4.2.4
#9 lore raw

PATCH 9/15 aoe: zero copy write 2 of 2

From: Ed L. Cashin <[email protected]>

Avoid memory copy on writes.
(This patch follows patch 4.)

---
 drivers/block/aoe/aoe.h    |    1 +
 drivers/block/aoe/aoecmd.c |   82 +++++++++++++++++++++++++++++++++-----------
 drivers/block/aoe/aoedev.c |    1 +
 3 files changed, 64 insertions(+), 20 deletions(-)
drivers/block/aoe/aoe.h +1 -0
index 7b11217..b41fdfe 100644
@@ -84,6 +84,7 @@ enum {
 	DEVFL_PAUSE = (1<<5),
 	DEVFL_NEWSIZE = (1<<6),	/* need to update dev size in block layer */
 	DEVFL_MAXBCNT = (1<<7), /* d->maxbcnt is not changeable */
+	DEVFL_KICKME = (1<<8),
 
 	BUFFL_FAIL = 1,
 };
drivers/block/aoe/aoecmd.c +62 -20

181 lines not on this page · raw message

drivers/block/aoe/aoedev.c +1 -0
index f51d87b..7fd63d4 100644
@@ -121,6 +121,7 @@ aoedev_downdev(struct aoedev *d)
 			mempool_free(buf, d->bufpool);
 			bio_endio(bio, bio->bi_size, -EIO);
 		}
+		skb_shinfo(f->skb)->nr_frags = f->skb->data_len = 0;
 	}
 	d->inprocess = NULL;
 
Signature · 1 line
1.4.2.4
#10 lore raw

PATCH 10/15 aoe: module parameter for device timeout

From: Ed L. Cashin <[email protected]>

The aoe_deadsecs module parameter sets the number of seconds that elapse before a nonresponsive AoE device is marked as dead.

This is runtime settable in sysfs or settable with a module load or kernel boot parameter.

---
 drivers/block/aoe/aoecmd.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)
drivers/block/aoe/aoecmd.c +5 -2
index 9ebc98a..f2b8f55 100644
@@ -15,7 +15,10 @@ #include "aoe.h"
 #define TIMERTICK (HZ / 10)
 #define MINTIMER (2 * TIMERTICK)
 #define MAXTIMER (HZ << 1)
-#define MAXWAIT (60 * 3)	/* After MAXWAIT seconds, give up and fail dev */
+
+static int aoe_deadsecs = 60 * 3;
+module_param(aoe_deadsecs, int, 0644);
+MODULE_PARM_DESC(aoe_deadsecs, "After aoe_deadsecs seconds, give up and fail dev.");
 
 struct sk_buff *
 new_skb(ulong len)
@@ -373,7 +376,7 @@ rexmit_timer(ulong vp)
 		if (f->tag != FREETAG && tsince(f->tag) >= timeout) {
 			n = f->waited += timeout;
 			n /= HZ;
-			if (n > MAXWAIT) { /* waited too long.  device failure. */
+			if (n > aoe_deadsecs) { /* waited too long for response */
 				aoedev_downdev(d);
 				break;
 			}
Signature · 1 line
1.4.2.4
#11 lore raw

PATCH 11/15 aoe: use bio->bi_idx

From: Ed L. Cashin <[email protected]>

Instead of starting with bio->bi_io_vec, use the offset in bio->bi_idx.

---
 drivers/block/aoe/aoeblk.c |    3 ++-
 drivers/block/aoe/aoecmd.c |    1 +
 2 files changed, 3 insertions(+), 1 deletions(-)
drivers/block/aoe/aoeblk.c +2 -1
index a7dbe6f..196ae7a 100644
@@ -142,7 +142,8 @@ aoeblk_make_request(request_queue_t *q, 
 	buf->bio = bio;
 	buf->resid = bio->bi_size;
 	buf->sector = bio->bi_sector;
-	buf->bv = buf->bio->bi_io_vec;
+	buf->bv = &bio->bi_io_vec[bio->bi_idx];
+	WARN_ON(buf->bv->bv_len == 0);
 	buf->bv_resid = buf->bv->bv_len;
 	buf->bufaddr = page_address(buf->bv->bv_page) + buf->bv->bv_offset;
 
drivers/block/aoe/aoecmd.c +1 -0
index f2b8f55..2d0bcdd 100644
@@ -166,6 +166,7 @@ aoecmd_ata_rw(struct aoedev *d, struct f
 		d->inprocess = NULL;
 	} else if (buf->bv_resid == 0) {
 		buf->bv++;
+		WARN_ON(buf->bv->bv_len == 0);
 		buf->bv_resid = buf->bv->bv_len;
 		buf->bufaddr = page_address(buf->bv->bv_page) + buf->bv->bv_offset;
 	}
Signature · 1 line
1.4.2.4
#12 lore raw

PATCH 12/15 aoe: remove sysfs comment

From: Ed L. Cashin <[email protected]>

Remove unecessary comment.

---
 drivers/block/aoe/aoeblk.c |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)
drivers/block/aoe/aoeblk.c +0 -1
index 196ae7a..088acf4 100644
@@ -14,7 +14,6 @@ #include "aoe.h"
 
 static kmem_cache_t *buf_pool_cache;
 
-/* add attributes for our block devices in sysfs */
 static ssize_t aoedisk_show_state(struct gendisk * disk, char *page)
 {
 	struct aoedev *d = disk->private_data;
Signature · 1 line
1.4.2.4
#13 lore raw

PATCH 13/15 aoe: update driver version

From: Ed L. Cashin <[email protected]>

Update aoe driver version number to 32.

---
 drivers/block/aoe/aoe.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/block/aoe/aoe.h +1 -1
index b41fdfe..188bf09 100644
@@ -1,5 +1,5 @@
 /* Copyright (c) 2006 Coraid, Inc.  See COPYING for GPL terms. */
-#define VERSION "22"
+#define VERSION "32"
 #define AOE_MAJOR 152
 #define DEVICE_NAME "aoe"
 
Signature · 1 line
1.4.2.4
#14 lore raw

PATCH 14/15 aoe: revert printk macros

From: Ed L. Cashin <[email protected]>

This patch addresses the concern that the aoe driver should not introduce unecessary conventions that must be learned by the reader. It reverts patch 6.

---
 drivers/block/aoe/aoe.h     |    5 -----
 drivers/block/aoe/aoeblk.c  |   11 ++++++-----
 drivers/block/aoe/aoechr.c  |   11 ++++++-----
 drivers/block/aoe/aoecmd.c  |   35 ++++++++++++++++++++---------------
 drivers/block/aoe/aoedev.c  |    2 +-
 drivers/block/aoe/aoemain.c |    6 +++---
 drivers/block/aoe/aoenet.c  |    6 +++---
 7 files changed, 39 insertions(+), 37 deletions(-)
drivers/block/aoe/aoe.h +0 -5
index 188bf09..6d11122 100644
@@ -10,11 +10,6 @@ #ifndef AOE_PARTITIONS
 #define AOE_PARTITIONS (16)
 #endif
 
-#define xprintk(L, fmt, arg...) printk(L "aoe: " "%s: " fmt, __func__, ## arg)
-#define iprintk(fmt, arg...) xprintk(KERN_INFO, fmt, ## arg)
-#define eprintk(fmt, arg...) xprintk(KERN_ERR, fmt, ## arg)
-#define dprintk(fmt, arg...) xprintk(KERN_DEBUG, fmt, ## arg)
-
 #define SYSMINOR(aoemajor, aoeminor) ((aoemajor) * NPERSHELF + (aoeminor))
 #define AOEMAJOR(sysminor) ((sysminor) / NPERSHELF)
 #define AOEMINOR(sysminor) ((sysminor) % NPERSHELF)
drivers/block/aoe/aoeblk.c +6 -5
index 088acf4..4259b52 100644
@@ -131,7 +131,7 @@ aoeblk_make_request(request_queue_t *q, 
 	d = bio->bi_bdev->bd_disk->private_data;
 	buf = mempool_alloc(d->bufpool, GFP_NOIO);
 	if (buf == NULL) {
-		iprintk("buf allocation failure\n");
+		printk(KERN_INFO "aoe: buf allocation failure\n");
 		bio_endio(bio, bio->bi_size, -ENOMEM);
 		return 0;
 	}
@@ -149,7 +149,8 @@ aoeblk_make_request(request_queue_t *q, 
 	spin_lock_irqsave(&d->lock, flags);
 
 	if ((d->flags & DEVFL_UP) == 0) {
-		iprintk("device %ld.%ld is not up\n", d->aoemajor, d->aoeminor);
+		printk(KERN_INFO "aoe: device %ld.%ld is not up\n",
+			d->aoemajor, d->aoeminor);
 		spin_unlock_irqrestore(&d->lock, flags);
 		mempool_free(buf, d->bufpool);
 		bio_endio(bio, bio->bi_size, -ENXIO);
@@ -174,7 +175,7 @@ aoeblk_getgeo(struct block_device *bdev,
 	struct aoedev *d = bdev->bd_disk->private_data;
 
 	if ((d->flags & DEVFL_UP) == 0) {
-		eprintk("disk not up\n");
+		printk(KERN_ERR "aoe: disk not up\n");
 		return -ENODEV;
 	}
 
@@ -201,7 +202,7 @@ aoeblk_gdalloc(void *vp)
 
 	gd = alloc_disk(AOE_PARTITIONS);
 	if (gd == NULL) {
-		eprintk("cannot allocate disk structure for %ld.%ld\n",
+		printk(KERN_ERR "aoe: cannot allocate disk structure for %ld.%ld\n",
 			d->aoemajor, d->aoeminor);
 		spin_lock_irqsave(&d->lock, flags);
 		d->flags &= ~DEVFL_GDALLOC;
@@ -211,7 +212,7 @@ aoeblk_gdalloc(void *vp)
 
 	d->bufpool = mempool_create_slab_pool(MIN_BUFS, buf_pool_cache);
 	if (d->bufpool == NULL) {
-		eprintk("cannot allocate bufpool for %ld.%ld\n",
+		printk(KERN_ERR "aoe: cannot allocate bufpool for %ld.%ld\n",
 			d->aoemajor, d->aoeminor);
 		put_disk(gd);
 		spin_lock_irqsave(&d->lock, flags);
drivers/block/aoe/aoechr.c +6 -5
index f5cab69..e22b4c9 100644
@@ -55,7 +55,8 @@ static int
 interfaces(const char __user *str, size_t size)
 {
 	if (set_aoe_iflist(str, size)) {
-		eprintk("could not set interface list: too many interfaces\n");
+		printk(KERN_ERR
+			"aoe: could not set interface list: too many interfaces\n");
 		return -EINVAL;
 	}
 	return 0;
@@ -78,7 +79,7 @@ revalidate(const char __user *str, size_
 	/* should be e%d.%d format */
 	n = sscanf(buf, "e%d.%d", &major, &minor);
 	if (n != 2) {
-		eprintk("invalid device specification\n");
+		printk(KERN_ERR "aoe: invalid device specification\n");
 		return -EINVAL;
 	}
 	d = aoedev_by_aoeaddr(major, minor);
@@ -113,7 +114,7 @@ bail:		spin_unlock_irqrestore(&emsgs_loc
 
 	mp = kmalloc(n, GFP_ATOMIC);
 	if (mp == NULL) {
-		eprintk("allocation failure, len=%ld\n", n);
+		printk(KERN_ERR "aoe: allocation failure, len=%ld\n", n);
 		goto bail;
 	}
 
@@ -138,7 +139,7 @@ aoechr_write(struct file *filp, const ch
 
 	switch ((unsigned long) filp->private_data) {
 	default:
-		iprintk("can't write to that file.\n");
+		printk(KERN_INFO "aoe: can't write to that file.\n");
 		break;
 	case MINOR_DISCOVER:
 		ret = discover();
@@ -247,7 +248,7 @@ aoechr_init(void)
 
 	n = register_chrdev(AOE_MAJOR, "aoechr", &aoe_fops);
 	if (n < 0) { 
-		eprintk("can't register char device\n");
+		printk(KERN_ERR "aoe: can't register char device\n");
 		return n;
 	}
 	sema_init(&emsgs_sema, 0);
drivers/block/aoe/aoecmd.c +20 -15
index 2d0bcdd..8a13b1a 100644
@@ -159,7 +159,7 @@ aoecmd_ata_rw(struct aoedev *d, struct f
 	buf->nframesout += 1;
 	buf->bufaddr += bcnt;
 	buf->bv_resid -= bcnt;
-/* dprintk("bv_resid=%ld\n", buf->bv_resid); */
+/* printk(KERN_DEBUG "aoe: bv_resid=%ld\n", buf->bv_resid); */
 	buf->resid -= bcnt;
 	buf->sector += bcnt >> 9;
 	if (buf->resid == 0) {
@@ -203,7 +203,7 @@ aoecmd_cfg_pkts(ushort aoemajor, unsigne
 
 		skb = new_skb(sizeof *h + sizeof *ch);
 		if (skb == NULL) {
-			iprintk("skb alloc failure\n");
+			printk(KERN_INFO "aoe: skb alloc failure\n");
 			continue;
 		}
 		skb->dev = ifp;
@@ -276,7 +276,7 @@ loop:
 			return;
 		buf = container_of(d->bufq.next, struct buf, bufs);
 		list_del(d->bufq.next);
-/*dprintk("bi_size=%ld\n", buf->bio->bi_size); */
+/*printk(KERN_DEBUG "aoe: bi_size=%ld\n", buf->bio->bi_size); */
 		d->inprocess = buf;
 	}
 	aoecmd_ata_rw(d, f);
@@ -319,7 +319,7 @@ rexmit(struct aoedev *d, struct frame *f
 		}
 		if (++d->lostjumbo > (d->nframes << 1))
 		if (d->maxbcnt != DEFAULTBCNT) {
-			iprintk("e%ld.%ld: too many lost jumbo on %s - using 1KB frames.\n",
+			printk(KERN_INFO "aoe: e%ld.%ld: too many lost jumbo on %s - using 1KB frames.\n",
 				d->aoemajor, d->aoeminor, d->ifp->name);
 			d->maxbcnt = DEFAULTBCNT;
 			d->flags |= DEVFL_MAXBCNT;
@@ -472,7 +472,7 @@ ataid_complete(struct aoedev *d, unsigne
 	}
 
 	if (d->ssize != ssize)
-		iprintk("%012llx e%lu.%lu v%04x has %llu sectors\n",
+		printk(KERN_INFO "aoe: %012llx e%lu.%lu v%04x has %llu sectors\n",
 			(unsigned long long)mac_addr(d->addr),
 			d->aoemajor, d->aoeminor,
 			d->fw_ver, (long long)ssize);
@@ -483,7 +483,7 @@ ataid_complete(struct aoedev *d, unsigne
 		d->flags |= DEVFL_NEWSIZE;
 	} else {
 		if (d->flags & DEVFL_GDALLOC) {
-			eprintk("can't schedule work for e%lu.%lu, %s\n",
+			printk(KERN_ERR "aoe: can't schedule work for e%lu.%lu, %s\n",
 			       d->aoemajor, d->aoeminor,
 			       "it's already on!  This shouldn't happen.\n");
 			return;
@@ -569,7 +569,8 @@ aoecmd_ata_rsp(struct sk_buff *skb)
 	if (ahout->cmdstat == WIN_IDENTIFY)
 		d->flags &= ~DEVFL_PAUSE;
 	if (ahin->cmdstat & 0xa9) {	/* these bits cleared on success */
-		eprintk("ata error cmd=%2.2Xh stat=%2.2Xh from e%ld.%ld\n",
+		printk(KERN_ERR
+			"aoe: ata error cmd=%2.2Xh stat=%2.2Xh from e%ld.%ld\n",
 			ahout->cmdstat, ahin->cmdstat,
 			d->aoemajor, d->aoeminor);
 		if (buf)
@@ -580,7 +581,8 @@ aoecmd_ata_rsp(struct sk_buff *skb)
 		case WIN_READ:
 		case WIN_READ_EXT:
 			if (skb->len - sizeof *hin - sizeof *ahin < n) {
-				eprintk("runt data size in read.  skb->len=%d\n",
+				printk(KERN_ERR
+					"aoe: runt data size in read.  skb->len=%d\n",
 					skb->len);
 				/* fail frame f?  just returning will rexmit. */
 				spin_unlock_irqrestore(&d->lock, flags);
@@ -618,7 +620,8 @@ aoecmd_ata_rsp(struct sk_buff *skb)
 			break;
 		case WIN_IDENTIFY:
 			if (skb->len - sizeof *hin - sizeof *ahin < 512) {
-				iprintk("runt data size in ataid.  skb->len=%d\n",
+				printk(KERN_INFO
+					"aoe: runt data size in ataid.  skb->len=%d\n",
 					skb->len);
 				spin_unlock_irqrestore(&d->lock, flags);
 				return;
@@ -626,7 +629,8 @@ aoecmd_ata_rsp(struct sk_buff *skb)
 			ataid_complete(d, (char *) (ahin+1));
 			break;
 		default:
-			iprintk("unrecognized ata command %2.2Xh for %d.%d\n",
+			printk(KERN_INFO
+				"aoe: unrecognized ata command %2.2Xh for %d.%d\n",
 				ahout->cmdstat,
 				be16_to_cpu(hin->major),
 				hin->minor);
@@ -686,7 +690,7 @@ aoecmd_ata_id(struct aoedev *d)
 
 	f = freeframe(d);
 	if (f == NULL) {
-		eprintk("can't get a frame. This shouldn't happen.\n");
+		printk(KERN_ERR "aoe: can't get a frame. This shouldn't happen.\n");
 		return NULL;
 	}
 
@@ -732,14 +736,14 @@ aoecmd_cfg_rsp(struct sk_buff *skb)
 	 */
 	aoemajor = be16_to_cpu(h->major);
 	if (aoemajor == 0xfff) {
-		eprintk("Warning: shelf address is all ones.  "
+		printk(KERN_ERR "aoe: Warning: shelf address is all ones.  "
 			"Check shelf dip switches.\n");
 		return;
 	}
 
 	sysminor = SYSMINOR(aoemajor, h->minor);
 	if (sysminor * AOE_PARTITIONS + AOE_PARTITIONS > MINORMASK) {
-		iprintk("e%ld.%d: minor number too large\n",
+		printk(KERN_INFO "aoe: e%ld.%d: minor number too large\n",
 			aoemajor, (int) h->minor);
 		return;
 	}
@@ -750,7 +754,7 @@ aoecmd_cfg_rsp(struct sk_buff *skb)
 
 	d = aoedev_by_sysminor_m(sysminor, n);
 	if (d == NULL) {
-		iprintk("device sysminor_m failure\n");
+		printk(KERN_INFO "aoe: device sysminor_m failure\n");
 		return;
 	}
 
@@ -767,7 +771,8 @@ aoecmd_cfg_rsp(struct sk_buff *skb)
 			n = ch->scnt;
 		n = n ? n * 512 : DEFAULTBCNT;
 		if (n != d->maxbcnt) {
-			iprintk("e%ld.%ld: setting %d byte data frames on %s\n",
+			printk(KERN_INFO
+				"aoe: e%ld.%ld: setting %d byte data frames on %s\n",
 				d->aoemajor, d->aoeminor, n, d->ifp->name);
 			d->maxbcnt = n;
 		}
drivers/block/aoe/aoedev.c +1 -1
index 7fd63d4..6125921 100644
@@ -156,7 +156,7 @@ aoedev_by_sysminor_m(ulong sysminor, ulo
 		d = aoedev_newdev(bufcnt);
 	 	if (d == NULL) {
 			spin_unlock_irqrestore(&devlist_lock, flags);
-			iprintk("aoedev_newdev failure.\n");
+			printk(KERN_INFO "aoe: aoedev_newdev failure.\n");
 			return NULL;
 		}
 		d->sysminor = sysminor;
drivers/block/aoe/aoemain.c +3 -3
index 13e634d..a04b7d6 100644
@@ -84,11 +84,11 @@ aoe_init(void)
 		goto net_fail;
 	ret = register_blkdev(AOE_MAJOR, DEVICE_NAME);
 	if (ret < 0) {
-		eprintk("can't register major\n");
+		printk(KERN_ERR "aoe: can't register major\n");
 		goto blkreg_fail;
 	}
 
-	iprintk("AoE v%s initialised.\n", VERSION);
+	printk(KERN_INFO "aoe: AoE v%s initialised.\n", VERSION);
 	discover_timer(TINIT);
 	return 0;
 
@@ -101,7 +101,7 @@ aoe_init(void)
  chr_fail:
 	aoedev_exit();
 	
-	iprintk("initialisation failure.\n");
+	printk(KERN_INFO "aoe: initialisation failure.\n");
 	return ret;
 }
 
drivers/block/aoe/aoenet.c +3 -3
index f1cf266..9626e0f 100644
@@ -74,7 +74,7 @@ set_aoe_iflist(const char __user *user_s
 		return -EINVAL;
 
 	if (copy_from_user(aoe_iflist, user_str, size)) {
-		iprintk("copy from user failed\n");
+		printk(KERN_INFO "aoe: copy from user failed\n");
 		return -EFAULT;
 	}
 	aoe_iflist[size] = 0x00;
@@ -132,7 +132,7 @@ aoenet_rcv(struct sk_buff *skb, struct n
 		if (n > NECODES)
 			n = 0;
 		if (net_ratelimit())
-			eprintk("error packet from %d.%d; ecode=%d '%s'\n",
+			printk(KERN_ERR "aoe: error packet from %d.%d; ecode=%d '%s'\n",
 			       be16_to_cpu(h->major), h->minor, 
 			       h->err, aoe_errlist[n]);
 		goto exit;
@@ -146,7 +146,7 @@ aoenet_rcv(struct sk_buff *skb, struct n
 		aoecmd_cfg_rsp(skb);
 		break;
 	default:
-		iprintk("unknown cmd %d\n", h->cmd);
+		printk(KERN_INFO "aoe: unknown cmd %d\n", h->cmd);
 	}
 exit:
 	dev_kfree_skb(skb);
Signature · 1 line
1.4.2.4
#15 lore raw

PATCH 15/15 aoe: fix sysfs_create_file warnings

From: Greg Kroah-Hartman <[email protected]>

Moved the attributes into a group, making the compiler be quiet about ignoring the return value of the file create calls. This also also fixed a bug when removing the files, which were not symlinks.

---
 drivers/block/aoe/aoeblk.c |   23 ++++++++++++++---------
 1 files changed, 14 insertions(+), 9 deletions(-)
drivers/block/aoe/aoeblk.c +14 -9
index 4259b52..d433f27 100644
@@ -63,21 +63,26 @@ static struct disk_attribute disk_attr_f
 	.show = aoedisk_show_fwver
 };
 
-static void
+static struct attribute *aoe_attrs[] = {
+	&disk_attr_state.attr,
+	&disk_attr_mac.attr,
+	&disk_attr_netif.attr,
+	&disk_attr_fwver.attr,
+};
+
+static const struct attribute_group attr_group = {
+	.attrs = aoe_attrs,
+};
+
+static int
 aoedisk_add_sysfs(struct aoedev *d)
 {
-	sysfs_create_file(&d->gd->kobj, &disk_attr_state.attr);
-	sysfs_create_file(&d->gd->kobj, &disk_attr_mac.attr);
-	sysfs_create_file(&d->gd->kobj, &disk_attr_netif.attr);
-	sysfs_create_file(&d->gd->kobj, &disk_attr_fwver.attr);
+	return sysfs_create_group(&d->gd->kobj, &attr_group);
 }
 void
 aoedisk_rm_sysfs(struct aoedev *d)
 {
-	sysfs_remove_link(&d->gd->kobj, "state");
-	sysfs_remove_link(&d->gd->kobj, "mac");
-	sysfs_remove_link(&d->gd->kobj, "netif");
-	sysfs_remove_link(&d->gd->kobj, "firmware-version");
+	sysfs_remove_group(&d->gd->kobj, &attr_group);
 }
 
 static int
Signature · 1 line
1.4.2.4