Skip to contentSkip to conversation

aoe [02/13]: update copyright date

PATCH In review Ed L. Cashin 3 participants 29 messages Aug 18, 2006 – Aug 23, 2006 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

PATCH 1/1 aoe [02/13]: update copyright date

Update the copyright year to 2006.

drivers/block/aoe/aoe.h +1 -1
diff -upr 2.6.18-rc4-orig/drivers/block/aoe/aoe.h 2.6.18-rc4-aoe/drivers/block/aoe/aoe.h
@@ -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
diff -upr 2.6.18-rc4-orig/drivers/block/aoe/aoeblk.c 2.6.18-rc4-aoe/drivers/block/aoe/aoeblk.c
@@ -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
diff -upr 2.6.18-rc4-orig/drivers/block/aoe/aoechr.c 2.6.18-rc4-aoe/drivers/block/aoe/aoechr.c
@@ -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
diff -upr 2.6.18-rc4-orig/drivers/block/aoe/aoecmd.c 2.6.18-rc4-aoe/drivers/block/aoe/aoecmd.c
@@ -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
diff -upr 2.6.18-rc4-orig/drivers/block/aoe/aoedev.c 2.6.18-rc4-aoe/drivers/block/aoe/aoedev.c
@@ -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
diff -upr 2.6.18-rc4-orig/drivers/block/aoe/aoemain.c 2.6.18-rc4-aoe/drivers/block/aoe/aoemain.c
@@ -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
diff -upr 2.6.18-rc4-orig/drivers/block/aoe/aoenet.c 2.6.18-rc4-aoe/drivers/block/aoe/aoenet.c
@@ -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
  "Ed L. Cashin" <[email protected]>
#3 lore raw

PATCH 1/1 aoe [03/13]: remove unused NARGS enum

In reply to a message not in the archive

The NARGS enum is left over from older code versions.

drivers/block/aoe/aoechr.c +0 -1
diff -upr 2.6.18-rc4-orig/drivers/block/aoe/aoechr.c 2.6.18-rc4-aoe/drivers/block/aoe/aoechr.c
@@ -15,7 +15,6 @@ enum {
 	MINOR_INTERFACES,
 	MINOR_REVALIDATE,
 	MSGSZ = 2048,
-	NARGS = 10,
 	NMSG = 100,		/* message backlog to retain */
 };
 
Signature · 1 line
  "Ed L. Cashin" <[email protected]>
#5 lore raw

PATCH 1/1 aoe [04/13]: zero copy write 1 of 2

In reply to a message not in the archive

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

drivers/block/aoe/aoe.h +2 -5
diff -upr 2.6.18-rc4-orig/drivers/block/aoe/aoe.h 2.6.18-rc4-aoe/drivers/block/aoe/aoe.h
@@ -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
  "Ed L. Cashin" <[email protected]>
#6 lore raw

Re: [PATCH 2.6.18-rc4] aoe [04/13]: zero copy write 1 of 2

Ar Gwe, 2006-08-18 am 13:39 -0400, ysgrifennodd Ed L. Cashin:

Review

Quoted 4 lines
(quoted diff) +2 -0
+	skb->len = sizeof *h + sizeof *ah;
+	memset(h, 0, skb->len);

Never play with skb->len directly. Use skb_put/skb_trim

#7 lore raw

Re: [PATCH 2.6.18-rc4] aoe [04/13]: zero copy write 1 of 2

Quoted 7 lines · Alan Cox

Ar Gwe, 2006-08-18 am 13:39 -0400, ysgrifennodd Ed L. Cashin:

Review

Quoted 4 lines
(quoted diff) +2 -0
+	skb->len = sizeof *h + sizeof *ah;
+	memset(h, 0, skb->len);

Never play with skb->len directly. Use skb_put/skb_trim

These are skbs pre-allocated by the aoe driver that will always have enough room to accomodate this much data, and we are really setting the packet header length.

To use skb_put here seems awkward. We'd have to do things like shown below throughout the driver instead of just setting the length. Is that what you'd like to see?

drivers/block/aoe/aoecmd.c +3 -1
diff -upr 2.6.18-rc4-orig/drivers/block/aoe/aoecmd.c 2.6.18-rc4-aoe/drivers/block/aoe/aoecmd.c
@@ -314,7 +315,9 @@ rexmit(struct aoedev *d, struct frame *f
 		if (ah->aflags & AOEAFL_WRITE) {
 			skb_fill_page_desc(skb, 0, virt_to_page(f->bufaddr),
 				offset_in_page(f->bufaddr), DEFAULTBCNT);
-			skb->len = sizeof *h + sizeof *ah + DEFAULTBCNT;
+			skb->data_len = 0;
+			skb_trim(skb, 0);
+			skb_put(skb, sizeof *h + sizeof *ah + DEFAULTBCNT);
 			skb->data_len = DEFAULTBCNT;
 		}
 		if (++d->lostjumbo > (d->nframes << 1))
Signature · 1 line
  Ed L Cashin <[email protected]>
#8 lore raw

Re: [PATCH 2.6.18-rc4] aoe [04/13]: zero copy write 1 of 2

Ar Maw, 2006-08-22 am 17:21 -0400, ysgrifennodd Ed L. Cashin:

Quoted 3 lines

These are skbs pre-allocated by the aoe driver that will always have enough room to accomodate this much data, and we are really setting the packet header length.

The skb structure has other fields and if you fiddle with them by hand you break those and you end up breaking if the skb internals change.

Eg if you set skb->len you must set skb->tail. Functions like skb_addd_data, skb_put, skb_trim, etc do the right thing in all cases.

Quoted 3 lines

To use skb_put here seems awkward. We'd have to do things like shown below throughout the driver instead of just setting the length. Is that what you'd like to see?

Yes. It might take a clock or two longer but it sets skb->tail right and is rather more future proof.

#9 lore raw

PATCH 1/1 aoe [05/13]: jumbo frame support 1 of 2

In reply to a message not in the archive

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

drivers/block/aoe/aoe.h +8 -3
diff -upr 2.6.18-rc4-orig/drivers/block/aoe/aoe.h 2.6.18-rc4-aoe/drivers/block/aoe/aoe.h
@@ -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
diff -upr 2.6.18-rc4-orig/drivers/block/aoe/aoechr.c 2.6.18-rc4-aoe/drivers/block/aoe/aoechr.c
@@ -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
  "Ed L. Cashin" <[email protected]>
Acked-by on v1 1/1
#10 lore raw

Re: [PATCH 2.6.18-rc4] aoe [05/13]: jumbo frame support 1 of 2

Ar Gwe, 2006-08-18 am 13:39 -0400, ysgrifennodd Ed L. Cashin:

Quoted 4 lines

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

(but please keep changes that need each other and are small together so you don't cause pain when binary searching for errors)

#11 lore raw

PATCH 1/1 aoe [13/13]: update driver version

In reply to a message not in the archive

Update aoe driver version number to 32.

drivers/block/aoe/aoe.h +1 -1
diff -upr 2.6.18-rc4-orig/drivers/block/aoe/aoe.h 2.6.18-rc4-aoe/drivers/block/aoe/aoe.h
@@ -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
  "Ed L. Cashin" <[email protected]>
#12 lore raw

PATCH 1/1 aoe [07/13]: jumbo frame support 2 of 2

In reply to a message not in the archive

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

drivers/block/aoe/aoecmd.c +7 -3
diff -upr 2.6.18-rc4-orig/drivers/block/aoe/aoecmd.c 2.6.18-rc4-aoe/drivers/block/aoe/aoecmd.c
@@ -28,7 +28,7 @@ new_skb(ulong len)
 		skb->protocol = __constant_htons(ETH_P_AOE);
 		skb->priority = 0;
 		skb_put(skb, len);
-		memset(skb->head, 0, len);
+		memset(skb->head, 0, ETH_ZLEN);
 		skb->next = skb->prev = NULL;
 
 		/* tell the network layer not to perform IP checksums
@@ -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
  "Ed L. Cashin" <[email protected]>
#13 lore raw

Re: [PATCH 2.6.18-rc4] aoe [07/13]: jumbo frame support 2 of 2

Ar Gwe, 2006-08-18 am 13:39 -0400, ysgrifennodd Ed L. Cashin:

Quoted 9 lines

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

diff -upr 2.6.18-rc4-orig/drivers/block/aoe/aoecmd.c 2.6.18-rc4-aoe/drivers/block/aoe/aoecmd.c

drivers/block/aoe/aoecmd.c new_skb(ulong len) · line 31

Quoted 5 lines
drivers/block/aoe/aoecmd.c +1 -1
@@ -28,7 +28,7 @@ new_skb(ulong len)
 		skb->protocol = __constant_htons(ETH_P_AOE);
 		skb->priority = 0;
 		skb_put(skb, len);
-		memset(skb->head, 0, len);
+		memset(skb->head, 0, ETH_ZLEN);

You realise the tail of a short packet is cleared by the network drivers either in software or hardware ?

#14 lore raw

Re: [PATCH 2.6.18-rc4] aoe [07/13]: jumbo frame support 2 of 2

Quoted 1 line · Alan Cox

Ar Gwe, 2006-08-18 am 13:39 -0400, ysgrifennodd Ed L. Cashin:

...

Quoted 9 lines

drivers/block/aoe/aoecmd.c new_skb(ulong len) · line 31

Quoted 6 lines
drivers/block/aoe/aoecmd.c +1 -1
@@ -28,7 +28,7 @@ new_skb(ulong len)
 		skb->protocol = __constant_htons(ETH_P_AOE);
 		skb->priority = 0;
 		skb_put(skb, len);
-		memset(skb->head, 0, len);
+		memset(skb->head, 0, ETH_ZLEN);

You realise the tail of a short packet is cleared by the network drivers either in software or hardware ?

Yes, I think that the patch author is used to doing ETH_ZLEN because of a bug in the e1000 driver where the short packets weren't getting padded. I don't think I ever heard of a resolution to that issue, but I could change it back to "len" here.

Signature · 1 line
  Ed L Cashin <[email protected]>
#15 lore raw

Re: [PATCH 2.6.18-rc4] aoe [07/13]: jumbo frame support 2 of 2

Ar Gwe, 2006-08-18 am 19:04 -0400, ysgrifennodd Ed L. Cashin:

Quoted 5 lines · Alan Cox

Yes, I think that the patch author is used to doing ETH_ZLEN because of a bug in the e1000 driver where the short packets weren't getting padded. I don't think I ever heard of a resolution to that issue, but I could change it back to "len" here.

It should have been resolved as uncleared packet tails are a security hole. If not it needs fixing not aoe

#16 lore raw

PATCH 1/1 aoe [08/13]: improve retransmission heuristics

In reply to a message not in the archive

Add a dynamic minimum timer for better retransmission behavior.

drivers/block/aoe/aoe.h +4 -3
diff -upr 2.6.18-rc4-orig/drivers/block/aoe/aoe.h 2.6.18-rc4-aoe/drivers/block/aoe/aoe.h
@@ -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
diff -upr 2.6.18-rc4-orig/drivers/block/aoe/aoecmd.c 2.6.18-rc4-aoe/drivers/block/aoe/aoecmd.c
@@ -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
  "Ed L. Cashin" <[email protected]>
Acked-by on v1 1/1
#17 lore raw

Re: [PATCH 2.6.18-rc4] aoe [08/13]: improve retransmission heuristics

Ar Gwe, 2006-08-18 am 13:39 -0400, ysgrifennodd Ed L. Cashin:

Quoted 3 lines

Add a dynamic minimum timer for better retransmission behavior.

"those who fail to learn from TCP are doomed to re-invent it, badly, at the wrong level." - Tim Wright

#18 lore raw

PATCH 1/1 aoe [09/13]: zero copy write 2 of 2

In reply to a message not in the archive

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

drivers/block/aoe/aoe.h +1 -0
diff -upr 2.6.18-rc4-orig/drivers/block/aoe/aoe.h 2.6.18-rc4-aoe/drivers/block/aoe/aoe.h
@@ -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
diff -upr 2.6.18-rc4-orig/drivers/block/aoe/aoedev.c 2.6.18-rc4-aoe/drivers/block/aoe/aoedev.c
@@ -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
  "Ed L. Cashin" <[email protected]>
#19 lore raw

PATCH 1/1 aoe [10/13]: module parameter for device timeout

In reply to a message not in the archive

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

drivers/block/aoe/aoecmd.c +5 -2
diff -upr 2.6.18-rc4-orig/drivers/block/aoe/aoecmd.c 2.6.18-rc4-aoe/drivers/block/aoe/aoecmd.c
@@ -15,7 +15,10 @@
 #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
  "Ed L. Cashin" <[email protected]>
#20 lore raw

Re: [PATCH 2.6.18-rc4] aoe [10/13]: module parameter for device timeout

Ar Gwe, 2006-08-18 am 13:39 -0400, ysgrifennodd Ed L. Cashin:

Quoted 5 lines

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

Isn't this a) per link dependant and b) needing to be runtime tuned (sysfs say ?)

#21 lore raw

Re: [PATCH 2.6.18-rc4] aoe [10/13]: module parameter for device timeout

Quoted 9 lines · Alan Cox

Ar Gwe, 2006-08-18 am 13:39 -0400, ysgrifennodd Ed L. Cashin:

Quoted 5 lines

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

Isn't this a) per link dependant and b) needing to be runtime tuned (sysfs say ?)

No, this is just for users who need very fast failure. The default three minutes is good for things like short network interruptions and even quick AoE device reboots, but users who aren't interested in that kind of flexibility and want a fast failure generally want it always and on every link.

Signature · 1 line
  Ed L Cashin <[email protected]>
#22 lore raw

Re: [PATCH 2.6.18-rc4] aoe [10/13]: module parameter for device timeout

Ar Gwe, 2006-08-18 am 19:10 -0400, ysgrifennodd Ed L. Cashin:

Quoted 5 lines

No, this is just for users who need very fast failure. The default three minutes is good for things like short network interruptions and even quick AoE device reboots, but users who aren't interested in that kind of flexibility and want a fast failure generally want it always and on every link.

Ok, but it should still be runtime settable.

#23 lore raw

Re: [PATCH 2.6.18-rc4] aoe [10/13]: module parameter for device timeout

Quoted 8 lines · Alan Cox

Ar Gwe, 2006-08-18 am 19:10 -0400, ysgrifennodd Ed L. Cashin:

Quoted 5 lines

No, this is just for users who need very fast failure. The default three minutes is good for things like short network interruptions and even quick AoE device reboots, but users who aren't interested in that kind of flexibility and want a fast failure generally want it always and on every link.

Ok, but it should still be runtime settable.

You know, it occurs to me that it is, just by virtue of sysfs, and a little test shows that to be the case.

Signature · 1 line
  Ed L Cashin <[email protected]>
#24 lore raw

PATCH 1/1 aoe [11/13]: use bio->bi_idx

In reply to a message not in the archive

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

drivers/block/aoe/aoeblk.c +2 -1
diff -upr 2.6.18-rc4-orig/drivers/block/aoe/aoeblk.c 2.6.18-rc4-aoe/drivers/block/aoe/aoeblk.c
@@ -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
diff -upr 2.6.18-rc4-orig/drivers/block/aoe/aoecmd.c 2.6.18-rc4-aoe/drivers/block/aoe/aoecmd.c
@@ -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
  "Ed L. Cashin" <[email protected]>
#25 lore raw

PATCH 1/1 aoe [12/13]: remove sysfs comment

In reply to a message not in the archive

Remove unecessary comment.

drivers/block/aoe/aoeblk.c +0 -1
diff -upr 2.6.18-rc4-orig/drivers/block/aoe/aoeblk.c 2.6.18-rc4-aoe/drivers/block/aoe/aoeblk.c
@@ -14,7 +14,6 @@
 
 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
  "Ed L. Cashin" <[email protected]>
#26 lore raw

PATCH 1/1 aoe [06/13]: clean up printks via macros

In reply to a message not in the archive

Use simple macros to clean up the printks.

drivers/block/aoe/aoe.h +5 -0
diff -upr 2.6.18-rc4-orig/drivers/block/aoe/aoe.h 2.6.18-rc4-aoe/drivers/block/aoe/aoe.h
@@ -10,6 +10,11 @@
 #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
diff -upr 2.6.18-rc4-orig/drivers/block/aoe/aoeblk.c 2.6.18-rc4-aoe/drivers/block/aoe/aoeblk.c
@@ -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
diff -upr 2.6.18-rc4-orig/drivers/block/aoe/aoechr.c 2.6.18-rc4-aoe/drivers/block/aoe/aoechr.c
@@ -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
diff -upr 2.6.18-rc4-orig/drivers/block/aoe/aoedev.c 2.6.18-rc4-aoe/drivers/block/aoe/aoedev.c
@@ -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
diff -upr 2.6.18-rc4-orig/drivers/block/aoe/aoemain.c 2.6.18-rc4-aoe/drivers/block/aoe/aoemain.c
@@ -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
diff -upr 2.6.18-rc4-orig/drivers/block/aoe/aoenet.c 2.6.18-rc4-aoe/drivers/block/aoe/aoenet.c
@@ -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
  "Ed L. Cashin" <[email protected]>
#27 lore raw

Re: [PATCH 2.6.18-rc4] aoe [06/13]: clean up printks via macros

drivers/block/aoe/aoe.h line 17

Quoted 6 lines · Ed L. Cashin
drivers/block/aoe/aoe.h +5 -0
+#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)
+

Can't you use the dev_{info,error,dbg}() functions instead?

	Arnd <><
#28 lore raw

Re: [PATCH 2.6.18-rc4] aoe [06/13]: clean up printks via macros

Quoted 9 lines · Arnd Bergmann

drivers/block/aoe/aoe.h line 17

Quoted 6 lines · Ed L. Cashin
drivers/block/aoe/aoe.h +5 -0
+#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)
+

Can't you use the dev_{info,error,dbg}() functions instead?

That's a good thought, but I don't think so. The dev_* macros don't add the function name to the printed message, and we don't have a struct device pointer in all our contexts. Even if we did, it would be kind of forced to do that just to try to get the prefix "aoe: " and the function name into the printks, which the new macros do nicely.

Signature · 1 line
  Ed L Cashin <[email protected]>
#29 lore raw

Re: [PATCH 2.6.18-rc4] aoe [06/13]: clean up printks via macros

In reply to Ed L. Cashin

Ar Gwe, 2006-08-18 am 13:39 -0400, ysgrifennodd Ed L. Cashin:

Quoted 3 lines

Use simple macros to clean up the printks.

This isn't a clean up. Well it is to you but its a confusion to anyone else meeting the code. We eschew unneccessary obfuscation when macros are involved.

The older code is longer winded but its *obvious* what it does and it looks like the rest of the kernel.