Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge with kernel.org:/pub/scm/linux/kernel/git/gregkh/aoe-2.6.git/

for 11 aoe bugfix patches.

+110 -64
+1
Documentation/aoe/mkdevs.sh
··· 5 5 6 6 if test "$#" != "1"; then 7 7 echo "Usage: sh `basename $0` {dir}" 1>&2 8 + echo " n_partitions=16 sh `basename $0` {dir}" 1>&2 8 9 exit 1 9 10 fi 10 11 dir=$1
+1
Documentation/aoe/mkshelf.sh
··· 2 2 3 3 if test "$#" != "2"; then 4 4 echo "Usage: sh `basename $0` {dir} {shelfaddress}" 1>&2 5 + echo " n_partitions=16 sh `basename $0` {dir} {shelfaddress}" 1>&2 5 6 exit 1 6 7 fi 7 8 n_partitions=${n_partitions:-16}
+14
Documentation/aoe/todo.txt
··· 1 + There is a potential for deadlock when allocating a struct sk_buff for 2 + data that needs to be written out to aoe storage. If the data is 3 + being written from a dirty page in order to free that page, and if 4 + there are no other pages available, then deadlock may occur when a 5 + free page is needed for the sk_buff allocation. This situation has 6 + not been observed, but it would be nice to eliminate any potential for 7 + deadlock under memory pressure. 8 + 9 + Because ATA over Ethernet is not fragmented by the kernel's IP code, 10 + the destructore member of the struct sk_buff is available to the aoe 11 + driver. By using a mempool for allocating all but the first few 12 + sk_buffs, and by registering a destructor, we should be able to 13 + efficiently allocate sk_buffs without introducing any potential for 14 + deadlock.
+5 -1
Documentation/aoe/udev-install.sh
··· 23 23 # /etc/udev/rules.d 24 24 # 25 25 rules_d="`sed -n '/^udev_rules=/{ s!udev_rules=!!; s!\"!!g; p; }' $conf`" 26 - test "$rules_d" && sh -xc "cp `dirname $0`/udev.txt $rules_d/60-aoe.rules" 26 + if test -z "$rules_d" || test ! -d "$rules_d"; then 27 + echo "$me Error: cannot find udev rules directory" 1>&2 28 + exit 1 29 + fi 30 + sh -xc "cp `dirname $0`/udev.txt $rules_d/60-aoe.rules"
+15 -8
drivers/block/aoe/aoe.h
··· 1 1 /* Copyright (c) 2004 Coraid, Inc. See COPYING for GPL terms. */ 2 - #define VERSION "5" 2 + #define VERSION "6" 3 3 #define AOE_MAJOR 152 4 4 #define DEVICE_NAME "aoe" 5 + 6 + /* set AOE_PARTITIONS to 1 to use whole-disks only 7 + * default is 16, which is 15 partitions plus the whole disk 8 + */ 5 9 #ifndef AOE_PARTITIONS 6 10 #define AOE_PARTITIONS 16 7 11 #endif 12 + 8 13 #define SYSMINOR(aoemajor, aoeminor) ((aoemajor) * 10 + (aoeminor)) 9 14 #define AOEMAJOR(sysminor) ((sysminor) / 10) 10 15 #define AOEMINOR(sysminor) ((sysminor) % 10) ··· 39 34 struct aoe_hdr { 40 35 unsigned char dst[6]; 41 36 unsigned char src[6]; 42 - unsigned char type[2]; 37 + __be16 type; 43 38 unsigned char verfl; 44 39 unsigned char err; 45 - unsigned char major[2]; 40 + __be16 major; 46 41 unsigned char minor; 47 42 unsigned char cmd; 48 - unsigned char tag[4]; 43 + __be32 tag; 49 44 }; 50 45 51 46 struct aoe_atahdr { ··· 63 58 }; 64 59 65 60 struct aoe_cfghdr { 66 - unsigned char bufcnt[2]; 67 - unsigned char fwver[2]; 61 + __be16 bufcnt; 62 + __be16 fwver; 68 63 unsigned char res; 69 64 unsigned char aoeccmd; 70 65 unsigned char cslen[2]; ··· 90 85 91 86 struct buf { 92 87 struct list_head bufs; 88 + ulong start_time; /* for disk stats */ 93 89 ulong flags; 94 90 ulong nframesout; 95 91 char *bufaddr; ··· 131 125 struct timer_list timer; 132 126 spinlock_t lock; 133 127 struct net_device *ifp; /* interface ed is attached to */ 134 - struct sk_buff *skblist;/* packets needing to be sent */ 128 + struct sk_buff *sendq_hd; /* packets needing to be sent, list head */ 129 + struct sk_buff *sendq_tl; 135 130 mempool_t *bufpool; /* for deadlock-free Buf allocation */ 136 131 struct list_head bufq; /* queue of bios to work on */ 137 132 struct buf *inprocess; /* the one we're currently working on */ ··· 158 151 159 152 int aoedev_init(void); 160 153 void aoedev_exit(void); 161 - struct aoedev *aoedev_bymac(unsigned char *); 154 + struct aoedev *aoedev_by_aoeaddr(int maj, int min); 162 155 void aoedev_downdev(struct aoedev *d); 163 156 struct aoedev *aoedev_set(ulong, unsigned char *, struct net_device *, ulong); 164 157 int aoedev_busy(void);
+3 -2
drivers/block/aoe/aoeblk.c
··· 125 125 } 126 126 memset(buf, 0, sizeof(*buf)); 127 127 INIT_LIST_HEAD(&buf->bufs); 128 + buf->start_time = jiffies; 128 129 buf->bio = bio; 129 130 buf->resid = bio->bi_size; 130 131 buf->sector = bio->bi_sector; ··· 147 146 list_add_tail(&buf->bufs, &d->bufq); 148 147 aoecmd_work(d); 149 148 150 - sl = d->skblist; 151 - d->skblist = NULL; 149 + sl = d->sendq_hd; 150 + d->sendq_hd = d->sendq_tl = NULL; 152 151 153 152 spin_unlock_irqrestore(&d->lock, flags); 154 153
+63 -45
drivers/block/aoe/aoecmd.c
··· 90 90 static int 91 91 aoehdr_atainit(struct aoedev *d, struct aoe_hdr *h) 92 92 { 93 - u16 type = __constant_cpu_to_be16(ETH_P_AOE); 94 - u16 aoemajor = __cpu_to_be16(d->aoemajor); 95 93 u32 host_tag = newtag(d); 96 - u32 tag = __cpu_to_be32(host_tag); 97 94 98 95 memcpy(h->src, d->ifp->dev_addr, sizeof h->src); 99 96 memcpy(h->dst, d->addr, sizeof h->dst); 100 - memcpy(h->type, &type, sizeof type); 97 + h->type = __constant_cpu_to_be16(ETH_P_AOE); 101 98 h->verfl = AOE_HVER; 102 - memcpy(h->major, &aoemajor, sizeof aoemajor); 99 + h->major = cpu_to_be16(d->aoemajor); 103 100 h->minor = d->aoeminor; 104 101 h->cmd = AOECMD_ATA; 105 - memcpy(h->tag, &tag, sizeof tag); 102 + h->tag = cpu_to_be32(host_tag); 106 103 107 104 return host_tag; 108 105 } ··· 178 181 179 182 skb = skb_prepare(d, f); 180 183 if (skb) { 181 - skb->next = d->skblist; 182 - d->skblist = skb; 184 + skb->next = NULL; 185 + if (d->sendq_hd) 186 + d->sendq_tl->next = skb; 187 + else 188 + d->sendq_hd = skb; 189 + d->sendq_tl = skb; 183 190 } 184 191 } 185 192 ··· 216 215 struct aoe_hdr *h; 217 216 char buf[128]; 218 217 u32 n; 219 - u32 net_tag; 220 218 221 219 n = newtag(d); 222 220 ··· 227 227 228 228 h = (struct aoe_hdr *) f->data; 229 229 f->tag = n; 230 - net_tag = __cpu_to_be32(n); 231 - memcpy(h->tag, &net_tag, sizeof net_tag); 230 + h->tag = cpu_to_be32(n); 232 231 233 232 skb = skb_prepare(d, f); 234 233 if (skb) { 235 - skb->next = d->skblist; 236 - d->skblist = skb; 234 + skb->next = NULL; 235 + if (d->sendq_hd) 236 + d->sendq_tl->next = skb; 237 + else 238 + d->sendq_hd = skb; 239 + d->sendq_tl = skb; 237 240 } 238 241 } 239 242 ··· 288 285 } 289 286 } 290 287 291 - sl = d->skblist; 292 - d->skblist = NULL; 288 + sl = d->sendq_hd; 289 + d->sendq_hd = d->sendq_tl = NULL; 293 290 if (sl) { 294 291 n = d->rttavg <<= 1; 295 292 if (n > MAXTIMER) ··· 311 308 u16 n; 312 309 313 310 /* word 83: command set supported */ 314 - n = __le16_to_cpu(*((u16 *) &id[83<<1])); 311 + n = le16_to_cpup((__le16 *) &id[83<<1]); 315 312 316 313 /* word 86: command set/feature enabled */ 317 - n |= __le16_to_cpu(*((u16 *) &id[86<<1])); 314 + n |= le16_to_cpup((__le16 *) &id[86<<1]); 318 315 319 316 if (n & (1<<10)) { /* bit 10: LBA 48 */ 320 317 d->flags |= DEVFL_EXT; 321 318 322 319 /* word 100: number lba48 sectors */ 323 - ssize = __le64_to_cpu(*((u64 *) &id[100<<1])); 320 + ssize = le64_to_cpup((__le64 *) &id[100<<1]); 324 321 325 322 /* set as in ide-disk.c:init_idedisk_capacity */ 326 323 d->geo.cylinders = ssize; ··· 331 328 d->flags &= ~DEVFL_EXT; 332 329 333 330 /* number lba28 sectors */ 334 - ssize = __le32_to_cpu(*((u32 *) &id[60<<1])); 331 + ssize = le32_to_cpup((__le32 *) &id[60<<1]); 335 332 336 333 /* NOTE: obsolete in ATA 6 */ 337 - d->geo.cylinders = __le16_to_cpu(*((u16 *) &id[54<<1])); 338 - d->geo.heads = __le16_to_cpu(*((u16 *) &id[55<<1])); 339 - d->geo.sectors = __le16_to_cpu(*((u16 *) &id[56<<1])); 334 + d->geo.cylinders = le16_to_cpup((__le16 *) &id[54<<1]); 335 + d->geo.heads = le16_to_cpup((__le16 *) &id[55<<1]); 336 + d->geo.sectors = le16_to_cpup((__le16 *) &id[56<<1]); 340 337 } 341 338 d->ssize = ssize; 342 339 d->geo.start = 0; ··· 383 380 register long n; 384 381 ulong flags; 385 382 char ebuf[128]; 386 - 383 + u16 aoemajor; 384 + 387 385 hin = (struct aoe_hdr *) skb->mac.raw; 388 - d = aoedev_bymac(hin->src); 386 + aoemajor = be16_to_cpu(hin->major); 387 + d = aoedev_by_aoeaddr(aoemajor, hin->minor); 389 388 if (d == NULL) { 390 389 snprintf(ebuf, sizeof ebuf, "aoecmd_ata_rsp: ata response " 391 390 "for unknown device %d.%d\n", 392 - __be16_to_cpu(*((u16 *) hin->major)), 393 - hin->minor); 391 + aoemajor, hin->minor); 394 392 aoechr_error(ebuf); 395 393 return; 396 394 } 397 395 398 396 spin_lock_irqsave(&d->lock, flags); 399 397 400 - f = getframe(d, __be32_to_cpu(*((u32 *) hin->tag))); 398 + f = getframe(d, be32_to_cpu(hin->tag)); 401 399 if (f == NULL) { 402 400 spin_unlock_irqrestore(&d->lock, flags); 403 401 snprintf(ebuf, sizeof ebuf, 404 402 "%15s e%d.%d tag=%08x@%08lx\n", 405 403 "unexpected rsp", 406 - __be16_to_cpu(*((u16 *) hin->major)), 404 + be16_to_cpu(hin->major), 407 405 hin->minor, 408 - __be32_to_cpu(*((u32 *) hin->tag)), 406 + be32_to_cpu(hin->tag), 409 407 jiffies); 410 408 aoechr_error(ebuf); 411 409 return; ··· 456 452 printk(KERN_INFO "aoe: aoecmd_ata_rsp: unrecognized " 457 453 "outbound ata command %2.2Xh for %d.%d\n", 458 454 ahout->cmdstat, 459 - __be16_to_cpu(*((u16 *) hin->major)), 455 + be16_to_cpu(hin->major), 460 456 hin->minor); 461 457 } 462 458 } ··· 464 460 if (buf) { 465 461 buf->nframesout -= 1; 466 462 if (buf->nframesout == 0 && buf->resid == 0) { 463 + unsigned long duration = jiffies - buf->start_time; 464 + unsigned long n_sect = buf->bio->bi_size >> 9; 465 + struct gendisk *disk = d->gd; 466 + 467 + if (bio_data_dir(buf->bio) == WRITE) { 468 + disk_stat_inc(disk, writes); 469 + disk_stat_add(disk, write_ticks, duration); 470 + disk_stat_add(disk, write_sectors, n_sect); 471 + } else { 472 + disk_stat_inc(disk, reads); 473 + disk_stat_add(disk, read_ticks, duration); 474 + disk_stat_add(disk, read_sectors, n_sect); 475 + } 476 + disk_stat_add(disk, io_ticks, duration); 467 477 n = (buf->flags & BUFFL_FAIL) ? -EIO : 0; 468 478 bio_endio(buf->bio, buf->bio->bi_size, n); 469 479 mempool_free(buf, d->bufpool); ··· 489 471 490 472 aoecmd_work(d); 491 473 492 - sl = d->skblist; 493 - d->skblist = NULL; 474 + sl = d->sendq_hd; 475 + d->sendq_hd = d->sendq_tl = NULL; 494 476 495 477 spin_unlock_irqrestore(&d->lock, flags); 496 478 ··· 504 486 struct aoe_cfghdr *ch; 505 487 struct sk_buff *skb, *sl; 506 488 struct net_device *ifp; 507 - u16 aoe_type = __constant_cpu_to_be16(ETH_P_AOE); 508 - u16 net_aoemajor = __cpu_to_be16(aoemajor); 509 489 510 490 sl = NULL; 511 491 ··· 523 507 524 508 memset(h->dst, 0xff, sizeof h->dst); 525 509 memcpy(h->src, ifp->dev_addr, sizeof h->src); 526 - memcpy(h->type, &aoe_type, sizeof aoe_type); 510 + h->type = __constant_cpu_to_be16(ETH_P_AOE); 527 511 h->verfl = AOE_HVER; 528 - memcpy(h->major, &net_aoemajor, sizeof net_aoemajor); 512 + h->major = cpu_to_be16(aoemajor); 529 513 h->minor = aoeminor; 530 514 h->cmd = AOECMD_CFG; 531 515 ··· 539 523 540 524 /* 541 525 * Since we only call this in one place (and it only prepares one frame) 542 - * we just return the skb. Usually we'd chain it up to the d->skblist. 526 + * we just return the skb. Usually we'd chain it up to the aoedev sendq. 543 527 */ 544 528 static struct sk_buff * 545 529 aoecmd_ata_id(struct aoedev *d) ··· 591 575 struct aoedev *d; 592 576 struct aoe_hdr *h; 593 577 struct aoe_cfghdr *ch; 594 - ulong flags, bufcnt, sysminor, aoemajor; 578 + ulong flags, sysminor, aoemajor; 579 + u16 bufcnt; 595 580 struct sk_buff *sl; 596 - enum { MAXFRAMES = 8, MAXSYSMINOR = 255 }; 581 + enum { MAXFRAMES = 8 }; 597 582 598 583 h = (struct aoe_hdr *) skb->mac.raw; 599 584 ch = (struct aoe_cfghdr *) (h+1); ··· 603 586 * Enough people have their dip switches set backwards to 604 587 * warrant a loud message for this special case. 605 588 */ 606 - aoemajor = __be16_to_cpu(*((u16 *) h->major)); 589 + aoemajor = be16_to_cpu(h->major); 607 590 if (aoemajor == 0xfff) { 608 591 printk(KERN_CRIT "aoe: aoecmd_cfg_rsp: Warning: shelf " 609 592 "address is all ones. Check shelf dip switches\n"); ··· 611 594 } 612 595 613 596 sysminor = SYSMINOR(aoemajor, h->minor); 614 - if (sysminor > MAXSYSMINOR) { 615 - printk(KERN_INFO "aoe: aoecmd_cfg_rsp: sysminor %ld too " 616 - "large\n", sysminor); 597 + if (sysminor * AOE_PARTITIONS + AOE_PARTITIONS > MINORMASK) { 598 + printk(KERN_INFO 599 + "aoe: e%ld.%d: minor number too large\n", 600 + aoemajor, (int) h->minor); 617 601 return; 618 602 } 619 603 620 - bufcnt = __be16_to_cpu(*((u16 *) ch->bufcnt)); 604 + bufcnt = be16_to_cpu(ch->bufcnt); 621 605 if (bufcnt > MAXFRAMES) /* keep it reasonable */ 622 606 bufcnt = MAXFRAMES; 623 607 ··· 635 617 return; 636 618 } 637 619 638 - d->fw_ver = __be16_to_cpu(*((u16 *) ch->fwver)); 620 + d->fw_ver = be16_to_cpu(ch->fwver); 639 621 640 622 /* we get here only if the device is new */ 641 623 sl = aoecmd_ata_id(d);
+4 -4
drivers/block/aoe/aoedev.c
··· 13 13 static spinlock_t devlist_lock; 14 14 15 15 struct aoedev * 16 - aoedev_bymac(unsigned char *macaddr) 16 + aoedev_by_aoeaddr(int maj, int min) 17 17 { 18 18 struct aoedev *d; 19 19 ulong flags; ··· 21 21 spin_lock_irqsave(&devlist_lock, flags); 22 22 23 23 for (d=devlist; d; d=d->next) 24 - if (!memcmp(d->addr, macaddr, 6)) 24 + if (d->aoemajor == maj && d->aoeminor == min) 25 25 break; 26 26 27 27 spin_unlock_irqrestore(&devlist_lock, flags); ··· 125 125 d->ifp = ifp; 126 126 127 127 if (d->sysminor != sysminor 128 - || memcmp(d->addr, addr, sizeof d->addr) 129 128 || (d->flags & DEVFL_UP) == 0) { 130 129 aoedev_downdev(d); /* flushes outstanding frames */ 131 130 memcpy(d->addr, addr, sizeof d->addr); ··· 146 147 put_disk(d->gd); 147 148 } 148 149 kfree(d->frames); 149 - mempool_destroy(d->bufpool); 150 + if (d->bufpool) 151 + mempool_destroy(d->bufpool); 150 152 kfree(d); 151 153 } 152 154
+4 -4
drivers/block/aoe/aoenet.c
··· 69 69 u64 70 70 mac_addr(char addr[6]) 71 71 { 72 - u64 n = 0; 72 + __be64 n = 0; 73 73 char *p = (char *) &n; 74 74 75 75 memcpy(p + 2, addr, 6); /* (sizeof addr != 6) */ ··· 108 108 aoenet_rcv(struct sk_buff *skb, struct net_device *ifp, struct packet_type *pt) 109 109 { 110 110 struct aoe_hdr *h; 111 - ulong n; 111 + u32 n; 112 112 113 113 skb = skb_check(skb); 114 114 if (!skb) ··· 121 121 skb_push(skb, ETH_HLEN); /* (1) */ 122 122 123 123 h = (struct aoe_hdr *) skb->mac.raw; 124 - n = __be32_to_cpu(*((u32 *) h->tag)); 124 + n = be32_to_cpu(h->tag); 125 125 if ((h->verfl & AOEFL_RSP) == 0 || (n & 1<<31)) 126 126 goto exit; 127 127 ··· 132 132 if (net_ratelimit()) 133 133 printk(KERN_ERR "aoe: aoenet_rcv: error packet from %d.%d; " 134 134 "ecode=%d '%s'\n", 135 - __be16_to_cpu(*((u16 *) h->major)), h->minor, 135 + be16_to_cpu(h->major), h->minor, 136 136 h->err, aoe_errlist[n]); 137 137 goto exit; 138 138 }