aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/block')
-rw-r--r--drivers/block/DAC960.c38
-rw-r--r--drivers/block/DAC960.h18
-rw-r--r--drivers/block/acsi.c4
-rw-r--r--drivers/block/acsi_slm.c4
-rw-r--r--drivers/block/amiflop.c17
-rw-r--r--drivers/block/aoe/aoe.h30
-rw-r--r--drivers/block/aoe/aoeblk.c45
-rw-r--r--drivers/block/aoe/aoechr.c18
-rw-r--r--drivers/block/aoe/aoecmd.c303
-rw-r--r--drivers/block/aoe/aoedev.c52
-rw-r--r--drivers/block/aoe/aoemain.c10
-rw-r--r--drivers/block/aoe/aoenet.c9
-rw-r--r--drivers/block/ataflop.c4
-rw-r--r--drivers/block/cciss.c42
-rw-r--r--drivers/block/cpqarray.c19
-rw-r--r--drivers/block/floppy.c4
-rw-r--r--drivers/block/loop.c8
-rw-r--r--drivers/block/ps2esdi.c6
-rw-r--r--drivers/block/rd.c12
-rw-r--r--drivers/block/swim3.c8
-rw-r--r--drivers/block/swim_iop.c4
-rw-r--r--drivers/block/sx8.c2
-rw-r--r--drivers/block/ub.c6
-rw-r--r--drivers/block/umem.c2
-rw-r--r--drivers/block/xd.c5
-rw-r--r--drivers/block/xd.h3
-rw-r--r--drivers/block/z2ram.c28
27 files changed, 394 insertions, 307 deletions
diff --git a/drivers/block/DAC960.c b/drivers/block/DAC960.c
index b3f639fbf220..742d07403101 100644
--- a/drivers/block/DAC960.c
+++ b/drivers/block/DAC960.c
@@ -2698,8 +2698,7 @@ DAC960_DetectController(struct pci_dev *PCI_Device,
2698{ 2698{
2699 struct DAC960_privdata *privdata = 2699 struct DAC960_privdata *privdata =
2700 (struct DAC960_privdata *)entry->driver_data; 2700 (struct DAC960_privdata *)entry->driver_data;
2701 irqreturn_t (*InterruptHandler)(int, void *, struct pt_regs *) = 2701 irq_handler_t InterruptHandler = privdata->InterruptHandler;
2702 privdata->InterruptHandler;
2703 unsigned int MemoryWindowSize = privdata->MemoryWindowSize; 2702 unsigned int MemoryWindowSize = privdata->MemoryWindowSize;
2704 DAC960_Controller_T *Controller = NULL; 2703 DAC960_Controller_T *Controller = NULL;
2705 unsigned char DeviceFunction = PCI_Device->devfn; 2704 unsigned char DeviceFunction = PCI_Device->devfn;
@@ -5253,10 +5252,9 @@ static void DAC960_V2_ProcessCompletedCommand(DAC960_Command_T *Command)
5253*/ 5252*/
5254 5253
5255static irqreturn_t DAC960_GEM_InterruptHandler(int IRQ_Channel, 5254static irqreturn_t DAC960_GEM_InterruptHandler(int IRQ_Channel,
5256 void *DeviceIdentifier, 5255 void *DeviceIdentifier)
5257 struct pt_regs *InterruptRegisters)
5258{ 5256{
5259 DAC960_Controller_T *Controller = (DAC960_Controller_T *) DeviceIdentifier; 5257 DAC960_Controller_T *Controller = DeviceIdentifier;
5260 void __iomem *ControllerBaseAddress = Controller->BaseAddress; 5258 void __iomem *ControllerBaseAddress = Controller->BaseAddress;
5261 DAC960_V2_StatusMailbox_T *NextStatusMailbox; 5259 DAC960_V2_StatusMailbox_T *NextStatusMailbox;
5262 unsigned long flags; 5260 unsigned long flags;
@@ -5295,10 +5293,9 @@ static irqreturn_t DAC960_GEM_InterruptHandler(int IRQ_Channel,
5295*/ 5293*/
5296 5294
5297static irqreturn_t DAC960_BA_InterruptHandler(int IRQ_Channel, 5295static irqreturn_t DAC960_BA_InterruptHandler(int IRQ_Channel,
5298 void *DeviceIdentifier, 5296 void *DeviceIdentifier)
5299 struct pt_regs *InterruptRegisters)
5300{ 5297{
5301 DAC960_Controller_T *Controller = (DAC960_Controller_T *) DeviceIdentifier; 5298 DAC960_Controller_T *Controller = DeviceIdentifier;
5302 void __iomem *ControllerBaseAddress = Controller->BaseAddress; 5299 void __iomem *ControllerBaseAddress = Controller->BaseAddress;
5303 DAC960_V2_StatusMailbox_T *NextStatusMailbox; 5300 DAC960_V2_StatusMailbox_T *NextStatusMailbox;
5304 unsigned long flags; 5301 unsigned long flags;
@@ -5338,10 +5335,9 @@ static irqreturn_t DAC960_BA_InterruptHandler(int IRQ_Channel,
5338*/ 5335*/
5339 5336
5340static irqreturn_t DAC960_LP_InterruptHandler(int IRQ_Channel, 5337static irqreturn_t DAC960_LP_InterruptHandler(int IRQ_Channel,
5341 void *DeviceIdentifier, 5338 void *DeviceIdentifier)
5342 struct pt_regs *InterruptRegisters)
5343{ 5339{
5344 DAC960_Controller_T *Controller = (DAC960_Controller_T *) DeviceIdentifier; 5340 DAC960_Controller_T *Controller = DeviceIdentifier;
5345 void __iomem *ControllerBaseAddress = Controller->BaseAddress; 5341 void __iomem *ControllerBaseAddress = Controller->BaseAddress;
5346 DAC960_V2_StatusMailbox_T *NextStatusMailbox; 5342 DAC960_V2_StatusMailbox_T *NextStatusMailbox;
5347 unsigned long flags; 5343 unsigned long flags;
@@ -5381,10 +5377,9 @@ static irqreturn_t DAC960_LP_InterruptHandler(int IRQ_Channel,
5381*/ 5377*/
5382 5378
5383static irqreturn_t DAC960_LA_InterruptHandler(int IRQ_Channel, 5379static irqreturn_t DAC960_LA_InterruptHandler(int IRQ_Channel,
5384 void *DeviceIdentifier, 5380 void *DeviceIdentifier)
5385 struct pt_regs *InterruptRegisters)
5386{ 5381{
5387 DAC960_Controller_T *Controller = (DAC960_Controller_T *) DeviceIdentifier; 5382 DAC960_Controller_T *Controller = DeviceIdentifier;
5388 void __iomem *ControllerBaseAddress = Controller->BaseAddress; 5383 void __iomem *ControllerBaseAddress = Controller->BaseAddress;
5389 DAC960_V1_StatusMailbox_T *NextStatusMailbox; 5384 DAC960_V1_StatusMailbox_T *NextStatusMailbox;
5390 unsigned long flags; 5385 unsigned long flags;
@@ -5420,10 +5415,9 @@ static irqreturn_t DAC960_LA_InterruptHandler(int IRQ_Channel,
5420*/ 5415*/
5421 5416
5422static irqreturn_t DAC960_PG_InterruptHandler(int IRQ_Channel, 5417static irqreturn_t DAC960_PG_InterruptHandler(int IRQ_Channel,
5423 void *DeviceIdentifier, 5418 void *DeviceIdentifier)
5424 struct pt_regs *InterruptRegisters)
5425{ 5419{
5426 DAC960_Controller_T *Controller = (DAC960_Controller_T *) DeviceIdentifier; 5420 DAC960_Controller_T *Controller = DeviceIdentifier;
5427 void __iomem *ControllerBaseAddress = Controller->BaseAddress; 5421 void __iomem *ControllerBaseAddress = Controller->BaseAddress;
5428 DAC960_V1_StatusMailbox_T *NextStatusMailbox; 5422 DAC960_V1_StatusMailbox_T *NextStatusMailbox;
5429 unsigned long flags; 5423 unsigned long flags;
@@ -5459,10 +5453,9 @@ static irqreturn_t DAC960_PG_InterruptHandler(int IRQ_Channel,
5459*/ 5453*/
5460 5454
5461static irqreturn_t DAC960_PD_InterruptHandler(int IRQ_Channel, 5455static irqreturn_t DAC960_PD_InterruptHandler(int IRQ_Channel,
5462 void *DeviceIdentifier, 5456 void *DeviceIdentifier)
5463 struct pt_regs *InterruptRegisters)
5464{ 5457{
5465 DAC960_Controller_T *Controller = (DAC960_Controller_T *) DeviceIdentifier; 5458 DAC960_Controller_T *Controller = DeviceIdentifier;
5466 void __iomem *ControllerBaseAddress = Controller->BaseAddress; 5459 void __iomem *ControllerBaseAddress = Controller->BaseAddress;
5467 unsigned long flags; 5460 unsigned long flags;
5468 5461
@@ -5498,10 +5491,9 @@ static irqreturn_t DAC960_PD_InterruptHandler(int IRQ_Channel,
5498*/ 5491*/
5499 5492
5500static irqreturn_t DAC960_P_InterruptHandler(int IRQ_Channel, 5493static irqreturn_t DAC960_P_InterruptHandler(int IRQ_Channel,
5501 void *DeviceIdentifier, 5494 void *DeviceIdentifier)
5502 struct pt_regs *InterruptRegisters)
5503{ 5495{
5504 DAC960_Controller_T *Controller = (DAC960_Controller_T *) DeviceIdentifier; 5496 DAC960_Controller_T *Controller = DeviceIdentifier;
5505 void __iomem *ControllerBaseAddress = Controller->BaseAddress; 5497 void __iomem *ControllerBaseAddress = Controller->BaseAddress;
5506 unsigned long flags; 5498 unsigned long flags;
5507 5499
diff --git a/drivers/block/DAC960.h b/drivers/block/DAC960.h
index f9217c34bc2b..6148073532b2 100644
--- a/drivers/block/DAC960.h
+++ b/drivers/block/DAC960.h
@@ -2175,7 +2175,7 @@ static char
2175struct DAC960_privdata { 2175struct DAC960_privdata {
2176 DAC960_HardwareType_T HardwareType; 2176 DAC960_HardwareType_T HardwareType;
2177 DAC960_FirmwareType_T FirmwareType; 2177 DAC960_FirmwareType_T FirmwareType;
2178 irqreturn_t (*InterruptHandler)(int, void *, struct pt_regs *); 2178 irq_handler_t InterruptHandler;
2179 unsigned int MemoryWindowSize; 2179 unsigned int MemoryWindowSize;
2180}; 2180};
2181 2181
@@ -4379,8 +4379,8 @@ static inline void DAC960_P_To_PD_TranslateEnquiry(void *Enquiry)
4379static inline void DAC960_P_To_PD_TranslateDeviceState(void *DeviceState) 4379static inline void DAC960_P_To_PD_TranslateDeviceState(void *DeviceState)
4380{ 4380{
4381 memcpy(DeviceState + 2, DeviceState + 3, 1); 4381 memcpy(DeviceState + 2, DeviceState + 3, 1);
4382 memcpy(DeviceState + 4, DeviceState + 5, 2); 4382 memmove(DeviceState + 4, DeviceState + 5, 2);
4383 memcpy(DeviceState + 6, DeviceState + 8, 4); 4383 memmove(DeviceState + 6, DeviceState + 8, 4);
4384} 4384}
4385 4385
4386static inline 4386static inline
@@ -4412,12 +4412,12 @@ static void DAC960_FinalizeController(DAC960_Controller_T *);
4412static void DAC960_V1_QueueReadWriteCommand(DAC960_Command_T *); 4412static void DAC960_V1_QueueReadWriteCommand(DAC960_Command_T *);
4413static void DAC960_V2_QueueReadWriteCommand(DAC960_Command_T *); 4413static void DAC960_V2_QueueReadWriteCommand(DAC960_Command_T *);
4414static void DAC960_RequestFunction(struct request_queue *); 4414static void DAC960_RequestFunction(struct request_queue *);
4415static irqreturn_t DAC960_BA_InterruptHandler(int, void *, struct pt_regs *); 4415static irqreturn_t DAC960_BA_InterruptHandler(int, void *);
4416static irqreturn_t DAC960_LP_InterruptHandler(int, void *, struct pt_regs *); 4416static irqreturn_t DAC960_LP_InterruptHandler(int, void *);
4417static irqreturn_t DAC960_LA_InterruptHandler(int, void *, struct pt_regs *); 4417static irqreturn_t DAC960_LA_InterruptHandler(int, void *);
4418static irqreturn_t DAC960_PG_InterruptHandler(int, void *, struct pt_regs *); 4418static irqreturn_t DAC960_PG_InterruptHandler(int, void *);
4419static irqreturn_t DAC960_PD_InterruptHandler(int, void *, struct pt_regs *); 4419static irqreturn_t DAC960_PD_InterruptHandler(int, void *);
4420static irqreturn_t DAC960_P_InterruptHandler(int, void *, struct pt_regs *); 4420static irqreturn_t DAC960_P_InterruptHandler(int, void *);
4421static void DAC960_V1_QueueMonitoringCommand(DAC960_Command_T *); 4421static void DAC960_V1_QueueMonitoringCommand(DAC960_Command_T *);
4422static void DAC960_V2_QueueMonitoringCommand(DAC960_Command_T *); 4422static void DAC960_V2_QueueMonitoringCommand(DAC960_Command_T *);
4423static void DAC960_MonitoringTimerFunction(unsigned long); 4423static void DAC960_MonitoringTimerFunction(unsigned long);
diff --git a/drivers/block/acsi.c b/drivers/block/acsi.c
index 0b80fbb8dbfd..706cdc6a69ec 100644
--- a/drivers/block/acsi.c
+++ b/drivers/block/acsi.c
@@ -346,7 +346,7 @@ static int acsicmd_dma( const char *cmd, char *buffer, int blocks, int
346 rwflag, int enable); 346 rwflag, int enable);
347static int acsi_reqsense( char *buffer, int targ, int lun); 347static int acsi_reqsense( char *buffer, int targ, int lun);
348static void acsi_print_error(const unsigned char *errblk, struct acsi_info_struct *aip); 348static void acsi_print_error(const unsigned char *errblk, struct acsi_info_struct *aip);
349static irqreturn_t acsi_interrupt (int irq, void *data, struct pt_regs *fp); 349static irqreturn_t acsi_interrupt (int irq, void *data);
350static void unexpected_acsi_interrupt( void ); 350static void unexpected_acsi_interrupt( void );
351static void bad_rw_intr( void ); 351static void bad_rw_intr( void );
352static void read_intr( void ); 352static void read_intr( void );
@@ -726,7 +726,7 @@ static void acsi_print_error(const unsigned char *errblk, struct acsi_info_struc
726 * 726 *
727 *******************************************************************/ 727 *******************************************************************/
728 728
729static irqreturn_t acsi_interrupt(int irq, void *data, struct pt_regs *fp ) 729static irqreturn_t acsi_interrupt(int irq, void *data )
730 730
731{ void (*acsi_irq_handler)(void) = do_acsi; 731{ void (*acsi_irq_handler)(void) = do_acsi;
732 732
diff --git a/drivers/block/acsi_slm.c b/drivers/block/acsi_slm.c
index 4030a8fd1187..8e41c87b026e 100644
--- a/drivers/block/acsi_slm.c
+++ b/drivers/block/acsi_slm.c
@@ -246,7 +246,7 @@ static int slm_getstats( char *buffer, int device );
246static ssize_t slm_read( struct file* file, char *buf, size_t count, loff_t 246static ssize_t slm_read( struct file* file, char *buf, size_t count, loff_t
247 *ppos ); 247 *ppos );
248static void start_print( int device ); 248static void start_print( int device );
249static irqreturn_t slm_interrupt(int irc, void *data, struct pt_regs *fp); 249static irqreturn_t slm_interrupt(int irc, void *data);
250static void slm_test_ready( unsigned long dummy ); 250static void slm_test_ready( unsigned long dummy );
251static void set_dma_addr( unsigned long paddr ); 251static void set_dma_addr( unsigned long paddr );
252static unsigned long get_dma_addr( void ); 252static unsigned long get_dma_addr( void );
@@ -452,7 +452,7 @@ static void start_print( int device )
452 452
453/* Only called when an error happened or at the end of a page */ 453/* Only called when an error happened or at the end of a page */
454 454
455static irqreturn_t slm_interrupt(int irc, void *data, struct pt_regs *fp) 455static irqreturn_t slm_interrupt(int irc, void *data)
456 456
457{ unsigned long addr; 457{ unsigned long addr;
458 int stat; 458 int stat;
diff --git a/drivers/block/amiflop.c b/drivers/block/amiflop.c
index 2641597c6549..5d6562171533 100644
--- a/drivers/block/amiflop.c
+++ b/drivers/block/amiflop.c
@@ -209,7 +209,7 @@ static int fd_device[4] = { 0, 0, 0, 0 };
209 209
210/* Milliseconds timer */ 210/* Milliseconds timer */
211 211
212static irqreturn_t ms_isr(int irq, void *dummy, struct pt_regs *fp) 212static irqreturn_t ms_isr(int irq, void *dummy)
213{ 213{
214 ms_busy = -1; 214 ms_busy = -1;
215 wake_up(&ms_wait); 215 wake_up(&ms_wait);
@@ -560,7 +560,7 @@ static unsigned long fd_get_drive_id(int drive)
560 return (id); 560 return (id);
561} 561}
562 562
563static irqreturn_t fd_block_done(int irq, void *dummy, struct pt_regs *fp) 563static irqreturn_t fd_block_done(int irq, void *dummy)
564{ 564{
565 if (block_flag) 565 if (block_flag)
566 custom.dsklen = 0x4000; 566 custom.dsklen = 0x4000;
@@ -1709,10 +1709,13 @@ static struct kobject *floppy_find(dev_t dev, int *part, void *data)
1709 return get_disk(unit[drive].gendisk); 1709 return get_disk(unit[drive].gendisk);
1710} 1710}
1711 1711
1712int __init amiga_floppy_init(void) 1712static int __init amiga_floppy_init(void)
1713{ 1713{
1714 int i, ret; 1714 int i, ret;
1715 1715
1716 if (!MACH_IS_AMIGA)
1717 return -ENXIO;
1718
1716 if (!AMIGAHW_PRESENT(AMI_FLOPPY)) 1719 if (!AMIGAHW_PRESENT(AMI_FLOPPY))
1717 return -ENXIO; 1720 return -ENXIO;
1718 1721
@@ -1809,15 +1812,9 @@ out_blkdev:
1809 return ret; 1812 return ret;
1810} 1813}
1811 1814
1815module_init(amiga_floppy_init);
1812#ifdef MODULE 1816#ifdef MODULE
1813 1817
1814int init_module(void)
1815{
1816 if (!MACH_IS_AMIGA)
1817 return -ENXIO;
1818 return amiga_floppy_init();
1819}
1820
1821#if 0 /* not safe to unload */ 1818#if 0 /* not safe to unload */
1822void cleanup_module(void) 1819void cleanup_module(void)
1823{ 1820{
diff --git a/drivers/block/aoe/aoe.h b/drivers/block/aoe/aoe.h
index 6eebcb7be97e..6d111228cfac 100644
--- a/drivers/block/aoe/aoe.h
+++ b/drivers/block/aoe/aoe.h
@@ -1,5 +1,5 @@
1/* Copyright (c) 2004 Coraid, Inc. See COPYING for GPL terms. */ 1/* Copyright (c) 2006 Coraid, Inc. See COPYING for GPL terms. */
2#define VERSION "22" 2#define VERSION "32"
3#define AOE_MAJOR 152 3#define AOE_MAJOR 152
4#define DEVICE_NAME "aoe" 4#define DEVICE_NAME "aoe"
5 5
@@ -65,7 +65,7 @@ struct aoe_atahdr {
65struct aoe_cfghdr { 65struct aoe_cfghdr {
66 __be16 bufcnt; 66 __be16 bufcnt;
67 __be16 fwver; 67 __be16 fwver;
68 unsigned char res; 68 unsigned char scnt;
69 unsigned char aoeccmd; 69 unsigned char aoeccmd;
70 unsigned char cslen[2]; 70 unsigned char cslen[2];
71}; 71};
@@ -78,12 +78,14 @@ enum {
78 DEVFL_GDALLOC = (1<<4), /* need to alloc gendisk */ 78 DEVFL_GDALLOC = (1<<4), /* need to alloc gendisk */
79 DEVFL_PAUSE = (1<<5), 79 DEVFL_PAUSE = (1<<5),
80 DEVFL_NEWSIZE = (1<<6), /* need to update dev size in block layer */ 80 DEVFL_NEWSIZE = (1<<6), /* need to update dev size in block layer */
81 DEVFL_MAXBCNT = (1<<7), /* d->maxbcnt is not changeable */
82 DEVFL_KICKME = (1<<8),
81 83
82 BUFFL_FAIL = 1, 84 BUFFL_FAIL = 1,
83}; 85};
84 86
85enum { 87enum {
86 MAXATADATA = 1024, 88 DEFAULTBCNT = 2 * 512, /* 2 sectors */
87 NPERSHELF = 16, /* number of slots per shelf address */ 89 NPERSHELF = 16, /* number of slots per shelf address */
88 FREETAG = -1, 90 FREETAG = -1,
89 MIN_BUFS = 8, 91 MIN_BUFS = 8,
@@ -107,11 +109,9 @@ struct frame {
107 ulong waited; 109 ulong waited;
108 struct buf *buf; 110 struct buf *buf;
109 char *bufaddr; 111 char *bufaddr;
110 int writedatalen; 112 ulong bcnt;
111 int ndata; 113 sector_t lba;
112 114 struct sk_buff *skb;
113 /* largest possible */
114 unsigned char data[sizeof(struct aoe_hdr) + sizeof(struct aoe_atahdr)];
115}; 115};
116 116
117struct aoedev { 117struct aoedev {
@@ -121,9 +121,12 @@ struct aoedev {
121 ulong sysminor; 121 ulong sysminor;
122 ulong aoemajor; 122 ulong aoemajor;
123 ulong aoeminor; 123 ulong aoeminor;
124 ulong nopen; /* (bd_openers isn't available without sleeping) */ 124 u16 nopen; /* (bd_openers isn't available without sleeping) */
125 ulong rttavg; /* round trip average of requests/responses */ 125 u16 lasttag; /* last tag sent */
126 u16 rttavg; /* round trip average of requests/responses */
127 u16 mintimer;
126 u16 fw_ver; /* version of blade's firmware */ 128 u16 fw_ver; /* version of blade's firmware */
129 u16 maxbcnt;
127 struct work_struct work;/* disk create work struct */ 130 struct work_struct work;/* disk create work struct */
128 struct gendisk *gd; 131 struct gendisk *gd;
129 request_queue_t blkq; 132 request_queue_t blkq;
@@ -137,8 +140,8 @@ struct aoedev {
137 mempool_t *bufpool; /* for deadlock-free Buf allocation */ 140 mempool_t *bufpool; /* for deadlock-free Buf allocation */
138 struct list_head bufq; /* queue of bios to work on */ 141 struct list_head bufq; /* queue of bios to work on */
139 struct buf *inprocess; /* the one we're currently working on */ 142 struct buf *inprocess; /* the one we're currently working on */
140 ulong lasttag; /* last tag sent */ 143 ushort lostjumbo;
141 ulong nframes; /* number of frames below */ 144 ushort nframes; /* number of frames below */
142 struct frame *frames; 145 struct frame *frames;
143}; 146};
144 147
@@ -157,6 +160,7 @@ void aoecmd_cfg(ushort aoemajor, unsigned char aoeminor);
157void aoecmd_ata_rsp(struct sk_buff *); 160void aoecmd_ata_rsp(struct sk_buff *);
158void aoecmd_cfg_rsp(struct sk_buff *); 161void aoecmd_cfg_rsp(struct sk_buff *);
159void aoecmd_sleepwork(void *vp); 162void aoecmd_sleepwork(void *vp);
163struct sk_buff *new_skb(ulong);
160 164
161int aoedev_init(void); 165int aoedev_init(void);
162void aoedev_exit(void); 166void aoedev_exit(void);
diff --git a/drivers/block/aoe/aoeblk.c b/drivers/block/aoe/aoeblk.c
index 393b86a3dbf8..aa25f8b09fe3 100644
--- a/drivers/block/aoe/aoeblk.c
+++ b/drivers/block/aoe/aoeblk.c
@@ -1,4 +1,4 @@
1/* Copyright (c) 2004 Coraid, Inc. See COPYING for GPL terms. */ 1/* Copyright (c) 2006 Coraid, Inc. See COPYING for GPL terms. */
2/* 2/*
3 * aoeblk.c 3 * aoeblk.c
4 * block device routines 4 * block device routines
@@ -14,7 +14,6 @@
14 14
15static kmem_cache_t *buf_pool_cache; 15static kmem_cache_t *buf_pool_cache;
16 16
17/* add attributes for our block devices in sysfs */
18static ssize_t aoedisk_show_state(struct gendisk * disk, char *page) 17static ssize_t aoedisk_show_state(struct gendisk * disk, char *page)
19{ 18{
20 struct aoedev *d = disk->private_data; 19 struct aoedev *d = disk->private_data;
@@ -64,21 +63,27 @@ static struct disk_attribute disk_attr_fwver = {
64 .show = aoedisk_show_fwver 63 .show = aoedisk_show_fwver
65}; 64};
66 65
67static void 66static struct attribute *aoe_attrs[] = {
67 &disk_attr_state.attr,
68 &disk_attr_mac.attr,
69 &disk_attr_netif.attr,
70 &disk_attr_fwver.attr,
71 NULL
72};
73
74static const struct attribute_group attr_group = {
75 .attrs = aoe_attrs,
76};
77
78static int
68aoedisk_add_sysfs(struct aoedev *d) 79aoedisk_add_sysfs(struct aoedev *d)
69{ 80{
70 sysfs_create_file(&d->gd->kobj, &disk_attr_state.attr); 81 return sysfs_create_group(&d->gd->kobj, &attr_group);
71 sysfs_create_file(&d->gd->kobj, &disk_attr_mac.attr);
72 sysfs_create_file(&d->gd->kobj, &disk_attr_netif.attr);
73 sysfs_create_file(&d->gd->kobj, &disk_attr_fwver.attr);
74} 82}
75void 83void
76aoedisk_rm_sysfs(struct aoedev *d) 84aoedisk_rm_sysfs(struct aoedev *d)
77{ 85{
78 sysfs_remove_link(&d->gd->kobj, "state"); 86 sysfs_remove_group(&d->gd->kobj, &attr_group);
79 sysfs_remove_link(&d->gd->kobj, "mac");
80 sysfs_remove_link(&d->gd->kobj, "netif");
81 sysfs_remove_link(&d->gd->kobj, "firmware-version");
82} 87}
83 88
84static int 89static int
@@ -132,8 +137,7 @@ aoeblk_make_request(request_queue_t *q, struct bio *bio)
132 d = bio->bi_bdev->bd_disk->private_data; 137 d = bio->bi_bdev->bd_disk->private_data;
133 buf = mempool_alloc(d->bufpool, GFP_NOIO); 138 buf = mempool_alloc(d->bufpool, GFP_NOIO);
134 if (buf == NULL) { 139 if (buf == NULL) {
135 printk(KERN_INFO "aoe: aoeblk_make_request: buf allocation " 140 printk(KERN_INFO "aoe: buf allocation failure\n");
136 "failure\n");
137 bio_endio(bio, bio->bi_size, -ENOMEM); 141 bio_endio(bio, bio->bi_size, -ENOMEM);
138 return 0; 142 return 0;
139 } 143 }
@@ -143,14 +147,15 @@ aoeblk_make_request(request_queue_t *q, struct bio *bio)
143 buf->bio = bio; 147 buf->bio = bio;
144 buf->resid = bio->bi_size; 148 buf->resid = bio->bi_size;
145 buf->sector = bio->bi_sector; 149 buf->sector = bio->bi_sector;
146 buf->bv = buf->bio->bi_io_vec; 150 buf->bv = &bio->bi_io_vec[bio->bi_idx];
151 WARN_ON(buf->bv->bv_len == 0);
147 buf->bv_resid = buf->bv->bv_len; 152 buf->bv_resid = buf->bv->bv_len;
148 buf->bufaddr = page_address(buf->bv->bv_page) + buf->bv->bv_offset; 153 buf->bufaddr = page_address(buf->bv->bv_page) + buf->bv->bv_offset;
149 154
150 spin_lock_irqsave(&d->lock, flags); 155 spin_lock_irqsave(&d->lock, flags);
151 156
152 if ((d->flags & DEVFL_UP) == 0) { 157 if ((d->flags & DEVFL_UP) == 0) {
153 printk(KERN_INFO "aoe: aoeblk_make_request: device %ld.%ld is not up\n", 158 printk(KERN_INFO "aoe: device %ld.%ld is not up\n",
154 d->aoemajor, d->aoeminor); 159 d->aoemajor, d->aoeminor);
155 spin_unlock_irqrestore(&d->lock, flags); 160 spin_unlock_irqrestore(&d->lock, flags);
156 mempool_free(buf, d->bufpool); 161 mempool_free(buf, d->bufpool);
@@ -176,7 +181,7 @@ aoeblk_getgeo(struct block_device *bdev, struct hd_geometry *geo)
176 struct aoedev *d = bdev->bd_disk->private_data; 181 struct aoedev *d = bdev->bd_disk->private_data;
177 182
178 if ((d->flags & DEVFL_UP) == 0) { 183 if ((d->flags & DEVFL_UP) == 0) {
179 printk(KERN_ERR "aoe: aoeblk_ioctl: disk not up\n"); 184 printk(KERN_ERR "aoe: disk not up\n");
180 return -ENODEV; 185 return -ENODEV;
181 } 186 }
182 187
@@ -203,8 +208,8 @@ aoeblk_gdalloc(void *vp)
203 208
204 gd = alloc_disk(AOE_PARTITIONS); 209 gd = alloc_disk(AOE_PARTITIONS);
205 if (gd == NULL) { 210 if (gd == NULL) {
206 printk(KERN_ERR "aoe: aoeblk_gdalloc: cannot allocate disk " 211 printk(KERN_ERR "aoe: cannot allocate disk structure for %ld.%ld\n",
207 "structure for %ld.%ld\n", d->aoemajor, d->aoeminor); 212 d->aoemajor, d->aoeminor);
208 spin_lock_irqsave(&d->lock, flags); 213 spin_lock_irqsave(&d->lock, flags);
209 d->flags &= ~DEVFL_GDALLOC; 214 d->flags &= ~DEVFL_GDALLOC;
210 spin_unlock_irqrestore(&d->lock, flags); 215 spin_unlock_irqrestore(&d->lock, flags);
@@ -213,8 +218,8 @@ aoeblk_gdalloc(void *vp)
213 218
214 d->bufpool = mempool_create_slab_pool(MIN_BUFS, buf_pool_cache); 219 d->bufpool = mempool_create_slab_pool(MIN_BUFS, buf_pool_cache);
215 if (d->bufpool == NULL) { 220 if (d->bufpool == NULL) {
216 printk(KERN_ERR "aoe: aoeblk_gdalloc: cannot allocate bufpool " 221 printk(KERN_ERR "aoe: cannot allocate bufpool for %ld.%ld\n",
217 "for %ld.%ld\n", d->aoemajor, d->aoeminor); 222 d->aoemajor, d->aoeminor);
218 put_disk(gd); 223 put_disk(gd);
219 spin_lock_irqsave(&d->lock, flags); 224 spin_lock_irqsave(&d->lock, flags);
220 d->flags &= ~DEVFL_GDALLOC; 225 d->flags &= ~DEVFL_GDALLOC;
diff --git a/drivers/block/aoe/aoechr.c b/drivers/block/aoe/aoechr.c
index 1bc1cf9603f1..e22b4c9520a9 100644
--- a/drivers/block/aoe/aoechr.c
+++ b/drivers/block/aoe/aoechr.c
@@ -1,4 +1,4 @@
1/* Copyright (c) 2004 Coraid, Inc. See COPYING for GPL terms. */ 1/* Copyright (c) 2006 Coraid, Inc. See COPYING for GPL terms. */
2/* 2/*
3 * aoechr.c 3 * aoechr.c
4 * AoE character device driver 4 * AoE character device driver
@@ -15,7 +15,6 @@ enum {
15 MINOR_INTERFACES, 15 MINOR_INTERFACES,
16 MINOR_REVALIDATE, 16 MINOR_REVALIDATE,
17 MSGSZ = 2048, 17 MSGSZ = 2048,
18 NARGS = 10,
19 NMSG = 100, /* message backlog to retain */ 18 NMSG = 100, /* message backlog to retain */
20}; 19};
21 20
@@ -56,9 +55,8 @@ static int
56interfaces(const char __user *str, size_t size) 55interfaces(const char __user *str, size_t size)
57{ 56{
58 if (set_aoe_iflist(str, size)) { 57 if (set_aoe_iflist(str, size)) {
59 printk(KERN_CRIT 58 printk(KERN_ERR
60 "%s: could not set interface list: %s\n", 59 "aoe: could not set interface list: too many interfaces\n");
61 __FUNCTION__, "too many interfaces");
62 return -EINVAL; 60 return -EINVAL;
63 } 61 }
64 return 0; 62 return 0;
@@ -81,8 +79,7 @@ revalidate(const char __user *str, size_t size)
81 /* should be e%d.%d format */ 79 /* should be e%d.%d format */
82 n = sscanf(buf, "e%d.%d", &major, &minor); 80 n = sscanf(buf, "e%d.%d", &major, &minor);
83 if (n != 2) { 81 if (n != 2) {
84 printk(KERN_ERR "aoe: %s: invalid device specification\n", 82 printk(KERN_ERR "aoe: invalid device specification\n");
85 __FUNCTION__);
86 return -EINVAL; 83 return -EINVAL;
87 } 84 }
88 d = aoedev_by_aoeaddr(major, minor); 85 d = aoedev_by_aoeaddr(major, minor);
@@ -90,6 +87,7 @@ revalidate(const char __user *str, size_t size)
90 return -EINVAL; 87 return -EINVAL;
91 88
92 spin_lock_irqsave(&d->lock, flags); 89 spin_lock_irqsave(&d->lock, flags);
90 d->flags &= ~DEVFL_MAXBCNT;
93 d->flags |= DEVFL_PAUSE; 91 d->flags |= DEVFL_PAUSE;
94 spin_unlock_irqrestore(&d->lock, flags); 92 spin_unlock_irqrestore(&d->lock, flags);
95 aoecmd_cfg(major, minor); 93 aoecmd_cfg(major, minor);
@@ -116,7 +114,7 @@ bail: spin_unlock_irqrestore(&emsgs_lock, flags);
116 114
117 mp = kmalloc(n, GFP_ATOMIC); 115 mp = kmalloc(n, GFP_ATOMIC);
118 if (mp == NULL) { 116 if (mp == NULL) {
119 printk(KERN_CRIT "aoe: aoechr_error: allocation failure, len=%ld\n", n); 117 printk(KERN_ERR "aoe: allocation failure, len=%ld\n", n);
120 goto bail; 118 goto bail;
121 } 119 }
122 120
@@ -141,7 +139,7 @@ aoechr_write(struct file *filp, const char __user *buf, size_t cnt, loff_t *offp
141 139
142 switch ((unsigned long) filp->private_data) { 140 switch ((unsigned long) filp->private_data) {
143 default: 141 default:
144 printk(KERN_INFO "aoe: aoechr_write: can't write to that file.\n"); 142 printk(KERN_INFO "aoe: can't write to that file.\n");
145 break; 143 break;
146 case MINOR_DISCOVER: 144 case MINOR_DISCOVER:
147 ret = discover(); 145 ret = discover();
@@ -250,7 +248,7 @@ aoechr_init(void)
250 248
251 n = register_chrdev(AOE_MAJOR, "aoechr", &aoe_fops); 249 n = register_chrdev(AOE_MAJOR, "aoechr", &aoe_fops);
252 if (n < 0) { 250 if (n < 0) {
253 printk(KERN_ERR "aoe: aoechr_init: can't register char device\n"); 251 printk(KERN_ERR "aoe: can't register char device\n");
254 return n; 252 return n;
255 } 253 }
256 sema_init(&emsgs_sema, 0); 254 sema_init(&emsgs_sema, 0);
diff --git a/drivers/block/aoe/aoecmd.c b/drivers/block/aoe/aoecmd.c
index 39da28d344fe..8a13b1af8bab 100644
--- a/drivers/block/aoe/aoecmd.c
+++ b/drivers/block/aoe/aoecmd.c
@@ -1,4 +1,4 @@
1/* Copyright (c) 2004 Coraid, Inc. See COPYING for GPL terms. */ 1/* Copyright (c) 2006 Coraid, Inc. See COPYING for GPL terms. */
2/* 2/*
3 * aoecmd.c 3 * aoecmd.c
4 * Filesystem request handling methods 4 * Filesystem request handling methods
@@ -15,17 +15,19 @@
15#define TIMERTICK (HZ / 10) 15#define TIMERTICK (HZ / 10)
16#define MINTIMER (2 * TIMERTICK) 16#define MINTIMER (2 * TIMERTICK)
17#define MAXTIMER (HZ << 1) 17#define MAXTIMER (HZ << 1)
18#define MAXWAIT (60 * 3) /* After MAXWAIT seconds, give up and fail dev */
19 18
20static struct sk_buff * 19static int aoe_deadsecs = 60 * 3;
21new_skb(struct net_device *if_dev, ulong len) 20module_param(aoe_deadsecs, int, 0644);
21MODULE_PARM_DESC(aoe_deadsecs, "After aoe_deadsecs seconds, give up and fail dev.");
22
23struct sk_buff *
24new_skb(ulong len)
22{ 25{
23 struct sk_buff *skb; 26 struct sk_buff *skb;
24 27
25 skb = alloc_skb(len, GFP_ATOMIC); 28 skb = alloc_skb(len, GFP_ATOMIC);
26 if (skb) { 29 if (skb) {
27 skb->nh.raw = skb->mac.raw = skb->data; 30 skb->nh.raw = skb->mac.raw = skb->data;
28 skb->dev = if_dev;
29 skb->protocol = __constant_htons(ETH_P_AOE); 31 skb->protocol = __constant_htons(ETH_P_AOE);
30 skb->priority = 0; 32 skb->priority = 0;
31 skb_put(skb, len); 33 skb_put(skb, len);
@@ -40,29 +42,6 @@ new_skb(struct net_device *if_dev, ulong len)
40 return skb; 42 return skb;
41} 43}
42 44
43static struct sk_buff *
44skb_prepare(struct aoedev *d, struct frame *f)
45{
46 struct sk_buff *skb;
47 char *p;
48
49 skb = new_skb(d->ifp, f->ndata + f->writedatalen);
50 if (!skb) {
51 printk(KERN_INFO "aoe: skb_prepare: failure to allocate skb\n");
52 return NULL;
53 }
54
55 p = skb->mac.raw;
56 memcpy(p, f->data, f->ndata);
57
58 if (f->writedatalen) {
59 p += sizeof(struct aoe_hdr) + sizeof(struct aoe_atahdr);
60 memcpy(p, f->bufaddr, f->writedatalen);
61 }
62
63 return skb;
64}
65
66static struct frame * 45static struct frame *
67getframe(struct aoedev *d, int tag) 46getframe(struct aoedev *d, int tag)
68{ 47{
@@ -107,6 +86,17 @@ aoehdr_atainit(struct aoedev *d, struct aoe_hdr *h)
107 return host_tag; 86 return host_tag;
108} 87}
109 88
89static inline void
90put_lba(struct aoe_atahdr *ah, sector_t lba)
91{
92 ah->lba0 = lba;
93 ah->lba1 = lba >>= 8;
94 ah->lba2 = lba >>= 8;
95 ah->lba3 = lba >>= 8;
96 ah->lba4 = lba >>= 8;
97 ah->lba5 = lba >>= 8;
98}
99
110static void 100static void
111aoecmd_ata_rw(struct aoedev *d, struct frame *f) 101aoecmd_ata_rw(struct aoedev *d, struct frame *f)
112{ 102{
@@ -125,29 +115,27 @@ aoecmd_ata_rw(struct aoedev *d, struct frame *f)
125 115
126 sector = buf->sector; 116 sector = buf->sector;
127 bcnt = buf->bv_resid; 117 bcnt = buf->bv_resid;
128 if (bcnt > MAXATADATA) 118 if (bcnt > d->maxbcnt)
129 bcnt = MAXATADATA; 119 bcnt = d->maxbcnt;
130 120
131 /* initialize the headers & frame */ 121 /* initialize the headers & frame */
132 h = (struct aoe_hdr *) f->data; 122 skb = f->skb;
123 h = (struct aoe_hdr *) skb->mac.raw;
133 ah = (struct aoe_atahdr *) (h+1); 124 ah = (struct aoe_atahdr *) (h+1);
134 f->ndata = sizeof *h + sizeof *ah; 125 skb->len = sizeof *h + sizeof *ah;
135 memset(h, 0, f->ndata); 126 memset(h, 0, ETH_ZLEN);
136 f->tag = aoehdr_atainit(d, h); 127 f->tag = aoehdr_atainit(d, h);
137 f->waited = 0; 128 f->waited = 0;
138 f->buf = buf; 129 f->buf = buf;
139 f->bufaddr = buf->bufaddr; 130 f->bufaddr = buf->bufaddr;
131 f->bcnt = bcnt;
132 f->lba = sector;
140 133
141 /* set up ata header */ 134 /* set up ata header */
142 ah->scnt = bcnt >> 9; 135 ah->scnt = bcnt >> 9;
143 ah->lba0 = sector; 136 put_lba(ah, sector);
144 ah->lba1 = sector >>= 8;
145 ah->lba2 = sector >>= 8;
146 ah->lba3 = sector >>= 8;
147 if (d->flags & DEVFL_EXT) { 137 if (d->flags & DEVFL_EXT) {
148 ah->aflags |= AOEAFL_EXT; 138 ah->aflags |= AOEAFL_EXT;
149 ah->lba4 = sector >>= 8;
150 ah->lba5 = sector >>= 8;
151 } else { 139 } else {
152 extbit = 0; 140 extbit = 0;
153 ah->lba3 &= 0x0f; 141 ah->lba3 &= 0x0f;
@@ -155,11 +143,14 @@ aoecmd_ata_rw(struct aoedev *d, struct frame *f)
155 } 143 }
156 144
157 if (bio_data_dir(buf->bio) == WRITE) { 145 if (bio_data_dir(buf->bio) == WRITE) {
146 skb_fill_page_desc(skb, 0, virt_to_page(f->bufaddr),
147 offset_in_page(f->bufaddr), bcnt);
158 ah->aflags |= AOEAFL_WRITE; 148 ah->aflags |= AOEAFL_WRITE;
159 f->writedatalen = bcnt; 149 skb->len += bcnt;
150 skb->data_len = bcnt;
160 } else { 151 } else {
152 skb->len = ETH_ZLEN;
161 writebit = 0; 153 writebit = 0;
162 f->writedatalen = 0;
163 } 154 }
164 155
165 ah->cmdstat = WIN_READ | writebit | extbit; 156 ah->cmdstat = WIN_READ | writebit | extbit;
@@ -168,26 +159,27 @@ aoecmd_ata_rw(struct aoedev *d, struct frame *f)
168 buf->nframesout += 1; 159 buf->nframesout += 1;
169 buf->bufaddr += bcnt; 160 buf->bufaddr += bcnt;
170 buf->bv_resid -= bcnt; 161 buf->bv_resid -= bcnt;
171/* printk(KERN_INFO "aoe: bv_resid=%ld\n", buf->bv_resid); */ 162/* printk(KERN_DEBUG "aoe: bv_resid=%ld\n", buf->bv_resid); */
172 buf->resid -= bcnt; 163 buf->resid -= bcnt;
173 buf->sector += bcnt >> 9; 164 buf->sector += bcnt >> 9;
174 if (buf->resid == 0) { 165 if (buf->resid == 0) {
175 d->inprocess = NULL; 166 d->inprocess = NULL;
176 } else if (buf->bv_resid == 0) { 167 } else if (buf->bv_resid == 0) {
177 buf->bv++; 168 buf->bv++;
169 WARN_ON(buf->bv->bv_len == 0);
178 buf->bv_resid = buf->bv->bv_len; 170 buf->bv_resid = buf->bv->bv_len;
179 buf->bufaddr = page_address(buf->bv->bv_page) + buf->bv->bv_offset; 171 buf->bufaddr = page_address(buf->bv->bv_page) + buf->bv->bv_offset;
180 } 172 }
181 173
182 skb = skb_prepare(d, f); 174 skb->dev = d->ifp;
183 if (skb) { 175 skb = skb_clone(skb, GFP_ATOMIC);
184 skb->next = NULL; 176 if (skb == NULL)
185 if (d->sendq_hd) 177 return;
186 d->sendq_tl->next = skb; 178 if (d->sendq_hd)
187 else 179 d->sendq_tl->next = skb;
188 d->sendq_hd = skb; 180 else
189 d->sendq_tl = skb; 181 d->sendq_hd = skb;
190 } 182 d->sendq_tl = skb;
191} 183}
192 184
193/* some callers cannot sleep, and they can call this function, 185/* some callers cannot sleep, and they can call this function,
@@ -209,11 +201,12 @@ aoecmd_cfg_pkts(ushort aoemajor, unsigned char aoeminor, struct sk_buff **tail)
209 if (!is_aoe_netif(ifp)) 201 if (!is_aoe_netif(ifp))
210 continue; 202 continue;
211 203
212 skb = new_skb(ifp, sizeof *h + sizeof *ch); 204 skb = new_skb(sizeof *h + sizeof *ch);
213 if (skb == NULL) { 205 if (skb == NULL) {
214 printk(KERN_INFO "aoe: aoecmd_cfg: skb alloc failure\n"); 206 printk(KERN_INFO "aoe: skb alloc failure\n");
215 continue; 207 continue;
216 } 208 }
209 skb->dev = ifp;
217 if (sl_tail == NULL) 210 if (sl_tail == NULL)
218 sl_tail = skb; 211 sl_tail = skb;
219 h = (struct aoe_hdr *) skb->mac.raw; 212 h = (struct aoe_hdr *) skb->mac.raw;
@@ -237,6 +230,29 @@ aoecmd_cfg_pkts(ushort aoemajor, unsigned char aoeminor, struct sk_buff **tail)
237 return sl; 230 return sl;
238} 231}
239 232
233static struct frame *
234freeframe(struct aoedev *d)
235{
236 struct frame *f, *e;
237 int n = 0;
238
239 f = d->frames;
240 e = f + d->nframes;
241 for (; f<e; f++) {
242 if (f->tag != FREETAG)
243 continue;
244 if (atomic_read(&skb_shinfo(f->skb)->dataref) == 1) {
245 skb_shinfo(f->skb)->nr_frags = f->skb->data_len = 0;
246 return f;
247 }
248 n++;
249 }
250 if (n == d->nframes) /* wait for network layer */
251 d->flags |= DEVFL_KICKME;
252
253 return NULL;
254}
255
240/* enters with d->lock held */ 256/* enters with d->lock held */
241void 257void
242aoecmd_work(struct aoedev *d) 258aoecmd_work(struct aoedev *d)
@@ -252,7 +268,7 @@ aoecmd_work(struct aoedev *d)
252 } 268 }
253 269
254loop: 270loop:
255 f = getframe(d, FREETAG); 271 f = freeframe(d);
256 if (f == NULL) 272 if (f == NULL)
257 return; 273 return;
258 if (d->inprocess == NULL) { 274 if (d->inprocess == NULL) {
@@ -260,7 +276,7 @@ loop:
260 return; 276 return;
261 buf = container_of(d->bufq.next, struct buf, bufs); 277 buf = container_of(d->bufq.next, struct buf, bufs);
262 list_del(d->bufq.next); 278 list_del(d->bufq.next);
263/*printk(KERN_INFO "aoecmd_work: bi_size=%ld\n", buf->bio->bi_size); */ 279/*printk(KERN_DEBUG "aoe: bi_size=%ld\n", buf->bio->bi_size); */
264 d->inprocess = buf; 280 d->inprocess = buf;
265 } 281 }
266 aoecmd_ata_rw(d, f); 282 aoecmd_ata_rw(d, f);
@@ -272,6 +288,7 @@ rexmit(struct aoedev *d, struct frame *f)
272{ 288{
273 struct sk_buff *skb; 289 struct sk_buff *skb;
274 struct aoe_hdr *h; 290 struct aoe_hdr *h;
291 struct aoe_atahdr *ah;
275 char buf[128]; 292 char buf[128];
276 u32 n; 293 u32 n;
277 294
@@ -283,21 +300,41 @@ rexmit(struct aoedev *d, struct frame *f)
283 d->aoemajor, d->aoeminor, f->tag, jiffies, n); 300 d->aoemajor, d->aoeminor, f->tag, jiffies, n);
284 aoechr_error(buf); 301 aoechr_error(buf);
285 302
286 h = (struct aoe_hdr *) f->data; 303 skb = f->skb;
304 h = (struct aoe_hdr *) skb->mac.raw;
305 ah = (struct aoe_atahdr *) (h+1);
287 f->tag = n; 306 f->tag = n;
288 h->tag = cpu_to_be32(n); 307 h->tag = cpu_to_be32(n);
289 memcpy(h->dst, d->addr, sizeof h->dst); 308 memcpy(h->dst, d->addr, sizeof h->dst);
290 memcpy(h->src, d->ifp->dev_addr, sizeof h->src); 309 memcpy(h->src, d->ifp->dev_addr, sizeof h->src);
291 310
292 skb = skb_prepare(d, f); 311 n = DEFAULTBCNT / 512;
293 if (skb) { 312 if (ah->scnt > n) {
294 skb->next = NULL; 313 ah->scnt = n;
295 if (d->sendq_hd) 314 if (ah->aflags & AOEAFL_WRITE) {
296 d->sendq_tl->next = skb; 315 skb_fill_page_desc(skb, 0, virt_to_page(f->bufaddr),
297 else 316 offset_in_page(f->bufaddr), DEFAULTBCNT);
298 d->sendq_hd = skb; 317 skb->len = sizeof *h + sizeof *ah + DEFAULTBCNT;
299 d->sendq_tl = skb; 318 skb->data_len = DEFAULTBCNT;
319 }
320 if (++d->lostjumbo > (d->nframes << 1))
321 if (d->maxbcnt != DEFAULTBCNT) {
322 printk(KERN_INFO "aoe: e%ld.%ld: too many lost jumbo on %s - using 1KB frames.\n",
323 d->aoemajor, d->aoeminor, d->ifp->name);
324 d->maxbcnt = DEFAULTBCNT;
325 d->flags |= DEVFL_MAXBCNT;
326 }
300 } 327 }
328
329 skb->dev = d->ifp;
330 skb = skb_clone(skb, GFP_ATOMIC);
331 if (skb == NULL)
332 return;
333 if (d->sendq_hd)
334 d->sendq_tl->next = skb;
335 else
336 d->sendq_hd = skb;
337 d->sendq_tl = skb;
301} 338}
302 339
303static int 340static int
@@ -340,13 +377,17 @@ rexmit_timer(ulong vp)
340 if (f->tag != FREETAG && tsince(f->tag) >= timeout) { 377 if (f->tag != FREETAG && tsince(f->tag) >= timeout) {
341 n = f->waited += timeout; 378 n = f->waited += timeout;
342 n /= HZ; 379 n /= HZ;
343 if (n > MAXWAIT) { /* waited too long. device failure. */ 380 if (n > aoe_deadsecs) { /* waited too long for response */
344 aoedev_downdev(d); 381 aoedev_downdev(d);
345 break; 382 break;
346 } 383 }
347 rexmit(d, f); 384 rexmit(d, f);
348 } 385 }
349 } 386 }
387 if (d->flags & DEVFL_KICKME) {
388 d->flags &= ~DEVFL_KICKME;
389 aoecmd_work(d);
390 }
350 391
351 sl = d->sendq_hd; 392 sl = d->sendq_hd;
352 d->sendq_hd = d->sendq_tl = NULL; 393 d->sendq_hd = d->sendq_tl = NULL;
@@ -431,8 +472,8 @@ ataid_complete(struct aoedev *d, unsigned char *id)
431 } 472 }
432 473
433 if (d->ssize != ssize) 474 if (d->ssize != ssize)
434 printk(KERN_INFO "aoe: %012llx e%lu.%lu v%04x has %llu " 475 printk(KERN_INFO "aoe: %012llx e%lu.%lu v%04x has %llu sectors\n",
435 "sectors\n", (unsigned long long)mac_addr(d->addr), 476 (unsigned long long)mac_addr(d->addr),
436 d->aoemajor, d->aoeminor, 477 d->aoemajor, d->aoeminor,
437 d->fw_ver, (long long)ssize); 478 d->fw_ver, (long long)ssize);
438 d->ssize = ssize; 479 d->ssize = ssize;
@@ -442,11 +483,9 @@ ataid_complete(struct aoedev *d, unsigned char *id)
442 d->flags |= DEVFL_NEWSIZE; 483 d->flags |= DEVFL_NEWSIZE;
443 } else { 484 } else {
444 if (d->flags & DEVFL_GDALLOC) { 485 if (d->flags & DEVFL_GDALLOC) {
445 printk(KERN_INFO "aoe: %s: %s e%lu.%lu, %s\n", 486 printk(KERN_ERR "aoe: can't schedule work for e%lu.%lu, %s\n",
446 __FUNCTION__,
447 "can't schedule work for",
448 d->aoemajor, d->aoeminor, 487 d->aoemajor, d->aoeminor,
449 "it's already on! (This really shouldn't happen).\n"); 488 "it's already on! This shouldn't happen.\n");
450 return; 489 return;
451 } 490 }
452 d->flags |= DEVFL_GDALLOC; 491 d->flags |= DEVFL_GDALLOC;
@@ -460,8 +499,15 @@ calc_rttavg(struct aoedev *d, int rtt)
460 register long n; 499 register long n;
461 500
462 n = rtt; 501 n = rtt;
463 if (n < MINTIMER) 502 if (n < 0) {
464 n = MINTIMER; 503 n = -rtt;
504 if (n < MINTIMER)
505 n = MINTIMER;
506 else if (n > MAXTIMER)
507 n = MAXTIMER;
508 d->mintimer += (n - d->mintimer) >> 1;
509 } else if (n < d->mintimer)
510 n = d->mintimer;
465 else if (n > MAXTIMER) 511 else if (n > MAXTIMER)
466 n = MAXTIMER; 512 n = MAXTIMER;
467 513
@@ -474,7 +520,7 @@ void
474aoecmd_ata_rsp(struct sk_buff *skb) 520aoecmd_ata_rsp(struct sk_buff *skb)
475{ 521{
476 struct aoedev *d; 522 struct aoedev *d;
477 struct aoe_hdr *hin; 523 struct aoe_hdr *hin, *hout;
478 struct aoe_atahdr *ahin, *ahout; 524 struct aoe_atahdr *ahin, *ahout;
479 struct frame *f; 525 struct frame *f;
480 struct buf *buf; 526 struct buf *buf;
@@ -497,8 +543,10 @@ aoecmd_ata_rsp(struct sk_buff *skb)
497 543
498 spin_lock_irqsave(&d->lock, flags); 544 spin_lock_irqsave(&d->lock, flags);
499 545
500 f = getframe(d, be32_to_cpu(hin->tag)); 546 n = be32_to_cpu(hin->tag);
547 f = getframe(d, n);
501 if (f == NULL) { 548 if (f == NULL) {
549 calc_rttavg(d, -tsince(n));
502 spin_unlock_irqrestore(&d->lock, flags); 550 spin_unlock_irqrestore(&d->lock, flags);
503 snprintf(ebuf, sizeof ebuf, 551 snprintf(ebuf, sizeof ebuf,
504 "%15s e%d.%d tag=%08x@%08lx\n", 552 "%15s e%d.%d tag=%08x@%08lx\n",
@@ -514,26 +562,27 @@ aoecmd_ata_rsp(struct sk_buff *skb)
514 calc_rttavg(d, tsince(f->tag)); 562 calc_rttavg(d, tsince(f->tag));
515 563
516 ahin = (struct aoe_atahdr *) (hin+1); 564 ahin = (struct aoe_atahdr *) (hin+1);
517 ahout = (struct aoe_atahdr *) (f->data + sizeof(struct aoe_hdr)); 565 hout = (struct aoe_hdr *) f->skb->mac.raw;
566 ahout = (struct aoe_atahdr *) (hout+1);
518 buf = f->buf; 567 buf = f->buf;
519 568
520 if (ahout->cmdstat == WIN_IDENTIFY) 569 if (ahout->cmdstat == WIN_IDENTIFY)
521 d->flags &= ~DEVFL_PAUSE; 570 d->flags &= ~DEVFL_PAUSE;
522 if (ahin->cmdstat & 0xa9) { /* these bits cleared on success */ 571 if (ahin->cmdstat & 0xa9) { /* these bits cleared on success */
523 printk(KERN_CRIT "aoe: aoecmd_ata_rsp: ata error cmd=%2.2Xh " 572 printk(KERN_ERR
524 "stat=%2.2Xh from e%ld.%ld\n", 573 "aoe: ata error cmd=%2.2Xh stat=%2.2Xh from e%ld.%ld\n",
525 ahout->cmdstat, ahin->cmdstat, 574 ahout->cmdstat, ahin->cmdstat,
526 d->aoemajor, d->aoeminor); 575 d->aoemajor, d->aoeminor);
527 if (buf) 576 if (buf)
528 buf->flags |= BUFFL_FAIL; 577 buf->flags |= BUFFL_FAIL;
529 } else { 578 } else {
579 n = ahout->scnt << 9;
530 switch (ahout->cmdstat) { 580 switch (ahout->cmdstat) {
531 case WIN_READ: 581 case WIN_READ:
532 case WIN_READ_EXT: 582 case WIN_READ_EXT:
533 n = ahout->scnt << 9;
534 if (skb->len - sizeof *hin - sizeof *ahin < n) { 583 if (skb->len - sizeof *hin - sizeof *ahin < n) {
535 printk(KERN_CRIT "aoe: aoecmd_ata_rsp: runt " 584 printk(KERN_ERR
536 "ata data size in read. skb->len=%d\n", 585 "aoe: runt data size in read. skb->len=%d\n",
537 skb->len); 586 skb->len);
538 /* fail frame f? just returning will rexmit. */ 587 /* fail frame f? just returning will rexmit. */
539 spin_unlock_irqrestore(&d->lock, flags); 588 spin_unlock_irqrestore(&d->lock, flags);
@@ -542,22 +591,49 @@ aoecmd_ata_rsp(struct sk_buff *skb)
542 memcpy(f->bufaddr, ahin+1, n); 591 memcpy(f->bufaddr, ahin+1, n);
543 case WIN_WRITE: 592 case WIN_WRITE:
544 case WIN_WRITE_EXT: 593 case WIN_WRITE_EXT:
594 if (f->bcnt -= n) {
595 skb = f->skb;
596 f->bufaddr += n;
597 put_lba(ahout, f->lba += ahout->scnt);
598 n = f->bcnt;
599 if (n > DEFAULTBCNT)
600 n = DEFAULTBCNT;
601 ahout->scnt = n >> 9;
602 if (ahout->aflags & AOEAFL_WRITE) {
603 skb_fill_page_desc(skb, 0,
604 virt_to_page(f->bufaddr),
605 offset_in_page(f->bufaddr), n);
606 skb->len = sizeof *hout + sizeof *ahout + n;
607 skb->data_len = n;
608 }
609 f->tag = newtag(d);
610 hout->tag = cpu_to_be32(f->tag);
611 skb->dev = d->ifp;
612 skb = skb_clone(skb, GFP_ATOMIC);
613 spin_unlock_irqrestore(&d->lock, flags);
614 if (skb)
615 aoenet_xmit(skb);
616 return;
617 }
618 if (n > DEFAULTBCNT)
619 d->lostjumbo = 0;
545 break; 620 break;
546 case WIN_IDENTIFY: 621 case WIN_IDENTIFY:
547 if (skb->len - sizeof *hin - sizeof *ahin < 512) { 622 if (skb->len - sizeof *hin - sizeof *ahin < 512) {
548 printk(KERN_INFO "aoe: aoecmd_ata_rsp: runt data size " 623 printk(KERN_INFO
549 "in ataid. skb->len=%d\n", skb->len); 624 "aoe: runt data size in ataid. skb->len=%d\n",
625 skb->len);
550 spin_unlock_irqrestore(&d->lock, flags); 626 spin_unlock_irqrestore(&d->lock, flags);
551 return; 627 return;
552 } 628 }
553 ataid_complete(d, (char *) (ahin+1)); 629 ataid_complete(d, (char *) (ahin+1));
554 break; 630 break;
555 default: 631 default:
556 printk(KERN_INFO "aoe: aoecmd_ata_rsp: unrecognized " 632 printk(KERN_INFO
557 "outbound ata command %2.2Xh for %d.%d\n", 633 "aoe: unrecognized ata command %2.2Xh for %d.%d\n",
558 ahout->cmdstat, 634 ahout->cmdstat,
559 be16_to_cpu(hin->major), 635 be16_to_cpu(hin->major),
560 hin->minor); 636 hin->minor);
561 } 637 }
562 } 638 }
563 639
@@ -612,33 +688,32 @@ aoecmd_ata_id(struct aoedev *d)
612 struct frame *f; 688 struct frame *f;
613 struct sk_buff *skb; 689 struct sk_buff *skb;
614 690
615 f = getframe(d, FREETAG); 691 f = freeframe(d);
616 if (f == NULL) { 692 if (f == NULL) {
617 printk(KERN_CRIT "aoe: aoecmd_ata_id: can't get a frame. " 693 printk(KERN_ERR "aoe: can't get a frame. This shouldn't happen.\n");
618 "This shouldn't happen.\n");
619 return NULL; 694 return NULL;
620 } 695 }
621 696
622 /* initialize the headers & frame */ 697 /* initialize the headers & frame */
623 h = (struct aoe_hdr *) f->data; 698 skb = f->skb;
699 h = (struct aoe_hdr *) skb->mac.raw;
624 ah = (struct aoe_atahdr *) (h+1); 700 ah = (struct aoe_atahdr *) (h+1);
625 f->ndata = sizeof *h + sizeof *ah; 701 skb->len = ETH_ZLEN;
626 memset(h, 0, f->ndata); 702 memset(h, 0, ETH_ZLEN);
627 f->tag = aoehdr_atainit(d, h); 703 f->tag = aoehdr_atainit(d, h);
628 f->waited = 0; 704 f->waited = 0;
629 f->writedatalen = 0;
630 705
631 /* set up ata header */ 706 /* set up ata header */
632 ah->scnt = 1; 707 ah->scnt = 1;
633 ah->cmdstat = WIN_IDENTIFY; 708 ah->cmdstat = WIN_IDENTIFY;
634 ah->lba3 = 0xa0; 709 ah->lba3 = 0xa0;
635 710
636 skb = skb_prepare(d, f); 711 skb->dev = d->ifp;
637 712
638 d->rttavg = MAXTIMER; 713 d->rttavg = MAXTIMER;
639 d->timer.function = rexmit_timer; 714 d->timer.function = rexmit_timer;
640 715
641 return skb; 716 return skb_clone(skb, GFP_ATOMIC);
642} 717}
643 718
644void 719void
@@ -648,9 +723,9 @@ aoecmd_cfg_rsp(struct sk_buff *skb)
648 struct aoe_hdr *h; 723 struct aoe_hdr *h;
649 struct aoe_cfghdr *ch; 724 struct aoe_cfghdr *ch;
650 ulong flags, sysminor, aoemajor; 725 ulong flags, sysminor, aoemajor;
651 u16 bufcnt;
652 struct sk_buff *sl; 726 struct sk_buff *sl;
653 enum { MAXFRAMES = 16 }; 727 enum { MAXFRAMES = 16 };
728 u16 n;
654 729
655 h = (struct aoe_hdr *) skb->mac.raw; 730 h = (struct aoe_hdr *) skb->mac.raw;
656 ch = (struct aoe_cfghdr *) (h+1); 731 ch = (struct aoe_cfghdr *) (h+1);
@@ -661,26 +736,25 @@ aoecmd_cfg_rsp(struct sk_buff *skb)
661 */ 736 */
662 aoemajor = be16_to_cpu(h->major); 737 aoemajor = be16_to_cpu(h->major);
663 if (aoemajor == 0xfff) { 738 if (aoemajor == 0xfff) {
664 printk(KERN_CRIT "aoe: aoecmd_cfg_rsp: Warning: shelf " 739 printk(KERN_ERR "aoe: Warning: shelf address is all ones. "
665 "address is all ones. Check shelf dip switches\n"); 740 "Check shelf dip switches.\n");
666 return; 741 return;
667 } 742 }
668 743
669 sysminor = SYSMINOR(aoemajor, h->minor); 744 sysminor = SYSMINOR(aoemajor, h->minor);
670 if (sysminor * AOE_PARTITIONS + AOE_PARTITIONS > MINORMASK) { 745 if (sysminor * AOE_PARTITIONS + AOE_PARTITIONS > MINORMASK) {
671 printk(KERN_INFO 746 printk(KERN_INFO "aoe: e%ld.%d: minor number too large\n",
672 "aoe: e%ld.%d: minor number too large\n",
673 aoemajor, (int) h->minor); 747 aoemajor, (int) h->minor);
674 return; 748 return;
675 } 749 }
676 750
677 bufcnt = be16_to_cpu(ch->bufcnt); 751 n = be16_to_cpu(ch->bufcnt);
678 if (bufcnt > MAXFRAMES) /* keep it reasonable */ 752 if (n > MAXFRAMES) /* keep it reasonable */
679 bufcnt = MAXFRAMES; 753 n = MAXFRAMES;
680 754
681 d = aoedev_by_sysminor_m(sysminor, bufcnt); 755 d = aoedev_by_sysminor_m(sysminor, n);
682 if (d == NULL) { 756 if (d == NULL) {
683 printk(KERN_INFO "aoe: aoecmd_cfg_rsp: device sysminor_m failure\n"); 757 printk(KERN_INFO "aoe: device sysminor_m failure\n");
684 return; 758 return;
685 } 759 }
686 760
@@ -689,6 +763,20 @@ aoecmd_cfg_rsp(struct sk_buff *skb)
689 /* permit device to migrate mac and network interface */ 763 /* permit device to migrate mac and network interface */
690 d->ifp = skb->dev; 764 d->ifp = skb->dev;
691 memcpy(d->addr, h->src, sizeof d->addr); 765 memcpy(d->addr, h->src, sizeof d->addr);
766 if (!(d->flags & DEVFL_MAXBCNT)) {
767 n = d->ifp->mtu;
768 n -= sizeof (struct aoe_hdr) + sizeof (struct aoe_atahdr);
769 n /= 512;
770 if (n > ch->scnt)
771 n = ch->scnt;
772 n = n ? n * 512 : DEFAULTBCNT;
773 if (n != d->maxbcnt) {
774 printk(KERN_INFO
775 "aoe: e%ld.%ld: setting %d byte data frames on %s\n",
776 d->aoemajor, d->aoeminor, n, d->ifp->name);
777 d->maxbcnt = n;
778 }
779 }
692 780
693 /* don't change users' perspective */ 781 /* don't change users' perspective */
694 if (d->nopen && !(d->flags & DEVFL_PAUSE)) { 782 if (d->nopen && !(d->flags & DEVFL_PAUSE)) {
@@ -696,6 +784,7 @@ aoecmd_cfg_rsp(struct sk_buff *skb)
696 return; 784 return;
697 } 785 }
698 d->flags |= DEVFL_PAUSE; /* force pause */ 786 d->flags |= DEVFL_PAUSE; /* force pause */
787 d->mintimer = MINTIMER;
699 d->fw_ver = be16_to_cpu(ch->fwver); 788 d->fw_ver = be16_to_cpu(ch->fwver);
700 789
701 /* check for already outstanding ataid */ 790 /* check for already outstanding ataid */
diff --git a/drivers/block/aoe/aoedev.c b/drivers/block/aoe/aoedev.c
index ed4258a62df5..6125921bbec4 100644
--- a/drivers/block/aoe/aoedev.c
+++ b/drivers/block/aoe/aoedev.c
@@ -1,4 +1,4 @@
1/* Copyright (c) 2004 Coraid, Inc. See COPYING for GPL terms. */ 1/* Copyright (c) 2006 Coraid, Inc. See COPYING for GPL terms. */
2/* 2/*
3 * aoedev.c 3 * aoedev.c
4 * AoE device utility functions; maintains device list. 4 * AoE device utility functions; maintains device list.
@@ -20,11 +20,8 @@ aoedev_isbusy(struct aoedev *d)
20 f = d->frames; 20 f = d->frames;
21 e = f + d->nframes; 21 e = f + d->nframes;
22 do { 22 do {
23 if (f->tag != FREETAG) { 23 if (f->tag != FREETAG)
24 printk(KERN_DEBUG "aoe: %ld.%ld isbusy\n",
25 d->aoemajor, d->aoeminor);
26 return 1; 24 return 1;
27 }
28 } while (++f < e); 25 } while (++f < e);
29 26
30 return 0; 27 return 0;
@@ -66,22 +63,32 @@ aoedev_newdev(ulong nframes)
66 struct frame *f, *e; 63 struct frame *f, *e;
67 64
68 d = kzalloc(sizeof *d, GFP_ATOMIC); 65 d = kzalloc(sizeof *d, GFP_ATOMIC);
69 if (d == NULL)
70 return NULL;
71 f = kcalloc(nframes, sizeof *f, GFP_ATOMIC); 66 f = kcalloc(nframes, sizeof *f, GFP_ATOMIC);
72 if (f == NULL) { 67 switch (!d || !f) {
73 kfree(d); 68 case 0:
69 d->nframes = nframes;
70 d->frames = f;
71 e = f + nframes;
72 for (; f<e; f++) {
73 f->tag = FREETAG;
74 f->skb = new_skb(ETH_ZLEN);
75 if (!f->skb)
76 break;
77 }
78 if (f == e)
79 break;
80 while (f > d->frames) {
81 f--;
82 dev_kfree_skb(f->skb);
83 }
84 default:
85 if (f)
86 kfree(f);
87 if (d)
88 kfree(d);
74 return NULL; 89 return NULL;
75 } 90 }
76
77 INIT_WORK(&d->work, aoecmd_sleepwork, d); 91 INIT_WORK(&d->work, aoecmd_sleepwork, d);
78
79 d->nframes = nframes;
80 d->frames = f;
81 e = f + nframes;
82 for (; f<e; f++)
83 f->tag = FREETAG;
84
85 spin_lock_init(&d->lock); 92 spin_lock_init(&d->lock);
86 init_timer(&d->timer); 93 init_timer(&d->timer);
87 d->timer.data = (ulong) d; 94 d->timer.data = (ulong) d;
@@ -114,6 +121,7 @@ aoedev_downdev(struct aoedev *d)
114 mempool_free(buf, d->bufpool); 121 mempool_free(buf, d->bufpool);
115 bio_endio(bio, bio->bi_size, -EIO); 122 bio_endio(bio, bio->bi_size, -EIO);
116 } 123 }
124 skb_shinfo(f->skb)->nr_frags = f->skb->data_len = 0;
117 } 125 }
118 d->inprocess = NULL; 126 d->inprocess = NULL;
119 127
@@ -148,7 +156,7 @@ aoedev_by_sysminor_m(ulong sysminor, ulong bufcnt)
148 d = aoedev_newdev(bufcnt); 156 d = aoedev_newdev(bufcnt);
149 if (d == NULL) { 157 if (d == NULL) {
150 spin_unlock_irqrestore(&devlist_lock, flags); 158 spin_unlock_irqrestore(&devlist_lock, flags);
151 printk(KERN_INFO "aoe: aoedev_set: aoedev_newdev failure.\n"); 159 printk(KERN_INFO "aoe: aoedev_newdev failure.\n");
152 return NULL; 160 return NULL;
153 } 161 }
154 d->sysminor = sysminor; 162 d->sysminor = sysminor;
@@ -163,11 +171,19 @@ aoedev_by_sysminor_m(ulong sysminor, ulong bufcnt)
163static void 171static void
164aoedev_freedev(struct aoedev *d) 172aoedev_freedev(struct aoedev *d)
165{ 173{
174 struct frame *f, *e;
175
166 if (d->gd) { 176 if (d->gd) {
167 aoedisk_rm_sysfs(d); 177 aoedisk_rm_sysfs(d);
168 del_gendisk(d->gd); 178 del_gendisk(d->gd);
169 put_disk(d->gd); 179 put_disk(d->gd);
170 } 180 }
181 f = d->frames;
182 e = f + d->nframes;
183 for (; f<e; f++) {
184 skb_shinfo(f->skb)->nr_frags = 0;
185 dev_kfree_skb(f->skb);
186 }
171 kfree(d->frames); 187 kfree(d->frames);
172 if (d->bufpool) 188 if (d->bufpool)
173 mempool_destroy(d->bufpool); 189 mempool_destroy(d->bufpool);
diff --git a/drivers/block/aoe/aoemain.c b/drivers/block/aoe/aoemain.c
index de08491ebe66..a04b7d613299 100644
--- a/drivers/block/aoe/aoemain.c
+++ b/drivers/block/aoe/aoemain.c
@@ -1,4 +1,4 @@
1/* Copyright (c) 2004 Coraid, Inc. See COPYING for GPL terms. */ 1/* Copyright (c) 2006 Coraid, Inc. See COPYING for GPL terms. */
2/* 2/*
3 * aoemain.c 3 * aoemain.c
4 * Module initialization routines, discover timer 4 * Module initialization routines, discover timer
@@ -84,13 +84,11 @@ aoe_init(void)
84 goto net_fail; 84 goto net_fail;
85 ret = register_blkdev(AOE_MAJOR, DEVICE_NAME); 85 ret = register_blkdev(AOE_MAJOR, DEVICE_NAME);
86 if (ret < 0) { 86 if (ret < 0) {
87 printk(KERN_ERR "aoe: aoeblk_init: can't register major\n"); 87 printk(KERN_ERR "aoe: can't register major\n");
88 goto blkreg_fail; 88 goto blkreg_fail;
89 } 89 }
90 90
91 printk(KERN_INFO 91 printk(KERN_INFO "aoe: AoE v%s initialised.\n", VERSION);
92 "aoe: aoe_init: AoE v%s initialised.\n",
93 VERSION);
94 discover_timer(TINIT); 92 discover_timer(TINIT);
95 return 0; 93 return 0;
96 94
@@ -103,7 +101,7 @@ aoe_init(void)
103 chr_fail: 101 chr_fail:
104 aoedev_exit(); 102 aoedev_exit();
105 103
106 printk(KERN_INFO "aoe: aoe_init: initialisation failure.\n"); 104 printk(KERN_INFO "aoe: initialisation failure.\n");
107 return ret; 105 return ret;
108} 106}
109 107
diff --git a/drivers/block/aoe/aoenet.c b/drivers/block/aoe/aoenet.c
index c1434ed11880..9626e0f5da9d 100644
--- a/drivers/block/aoe/aoenet.c
+++ b/drivers/block/aoe/aoenet.c
@@ -1,4 +1,4 @@
1/* Copyright (c) 2004 Coraid, Inc. See COPYING for GPL terms. */ 1/* Copyright (c) 2006 Coraid, Inc. See COPYING for GPL terms. */
2/* 2/*
3 * aoenet.c 3 * aoenet.c
4 * Ethernet portion of AoE driver 4 * Ethernet portion of AoE driver
@@ -74,7 +74,7 @@ set_aoe_iflist(const char __user *user_str, size_t size)
74 return -EINVAL; 74 return -EINVAL;
75 75
76 if (copy_from_user(aoe_iflist, user_str, size)) { 76 if (copy_from_user(aoe_iflist, user_str, size)) {
77 printk(KERN_INFO "aoe: %s: copy from user failed\n", __FUNCTION__); 77 printk(KERN_INFO "aoe: copy from user failed\n");
78 return -EFAULT; 78 return -EFAULT;
79 } 79 }
80 aoe_iflist[size] = 0x00; 80 aoe_iflist[size] = 0x00;
@@ -132,8 +132,7 @@ aoenet_rcv(struct sk_buff *skb, struct net_device *ifp, struct packet_type *pt,
132 if (n > NECODES) 132 if (n > NECODES)
133 n = 0; 133 n = 0;
134 if (net_ratelimit()) 134 if (net_ratelimit())
135 printk(KERN_ERR "aoe: aoenet_rcv: error packet from %d.%d; " 135 printk(KERN_ERR "aoe: error packet from %d.%d; ecode=%d '%s'\n",
136 "ecode=%d '%s'\n",
137 be16_to_cpu(h->major), h->minor, 136 be16_to_cpu(h->major), h->minor,
138 h->err, aoe_errlist[n]); 137 h->err, aoe_errlist[n]);
139 goto exit; 138 goto exit;
@@ -147,7 +146,7 @@ aoenet_rcv(struct sk_buff *skb, struct net_device *ifp, struct packet_type *pt,
147 aoecmd_cfg_rsp(skb); 146 aoecmd_cfg_rsp(skb);
148 break; 147 break;
149 default: 148 default:
150 printk(KERN_INFO "aoe: aoenet_rcv: unknown cmd %d\n", h->cmd); 149 printk(KERN_INFO "aoe: unknown cmd %d\n", h->cmd);
151 } 150 }
152exit: 151exit:
153 dev_kfree_skb(skb); 152 dev_kfree_skb(skb);
diff --git a/drivers/block/ataflop.c b/drivers/block/ataflop.c
index c39650920bdf..14d6b9492750 100644
--- a/drivers/block/ataflop.c
+++ b/drivers/block/ataflop.c
@@ -342,7 +342,7 @@ static void fd_select_drive( int drive );
342static void fd_deselect( void ); 342static void fd_deselect( void );
343static void fd_motor_off_timer( unsigned long dummy ); 343static void fd_motor_off_timer( unsigned long dummy );
344static void check_change( unsigned long dummy ); 344static void check_change( unsigned long dummy );
345static irqreturn_t floppy_irq (int irq, void *dummy, struct pt_regs *fp); 345static irqreturn_t floppy_irq (int irq, void *dummy);
346static void fd_error( void ); 346static void fd_error( void );
347static int do_format(int drive, int type, struct atari_format_descr *desc); 347static int do_format(int drive, int type, struct atari_format_descr *desc);
348static void do_fd_action( int drive ); 348static void do_fd_action( int drive );
@@ -573,7 +573,7 @@ static inline void copy_buffer(void *from, void *to)
573 573
574static void (*FloppyIRQHandler)( int status ) = NULL; 574static void (*FloppyIRQHandler)( int status ) = NULL;
575 575
576static irqreturn_t floppy_irq (int irq, void *dummy, struct pt_regs *fp) 576static irqreturn_t floppy_irq (int irq, void *dummy)
577{ 577{
578 unsigned char status; 578 unsigned char status;
579 void (*handler)( int ); 579 void (*handler)( int );
diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c
index 36b88f6c5f82..4105c3bf3476 100644
--- a/drivers/block/cciss.c
+++ b/drivers/block/cciss.c
@@ -130,7 +130,7 @@ static struct board_type products[] = {
130static ctlr_info_t *hba[MAX_CTLR]; 130static ctlr_info_t *hba[MAX_CTLR];
131 131
132static void do_cciss_request(request_queue_t *q); 132static void do_cciss_request(request_queue_t *q);
133static irqreturn_t do_cciss_intr(int irq, void *dev_id, struct pt_regs *regs); 133static irqreturn_t do_cciss_intr(int irq, void *dev_id);
134static int cciss_open(struct inode *inode, struct file *filep); 134static int cciss_open(struct inode *inode, struct file *filep);
135static int cciss_release(struct inode *inode, struct file *filep); 135static int cciss_release(struct inode *inode, struct file *filep);
136static int cciss_ioctl(struct inode *inode, struct file *filep, 136static int cciss_ioctl(struct inode *inode, struct file *filep,
@@ -1300,6 +1300,12 @@ static void cciss_softirq_done(struct request *rq)
1300 1300
1301 complete_buffers(rq->bio, rq->errors); 1301 complete_buffers(rq->bio, rq->errors);
1302 1302
1303 if (blk_fs_request(rq)) {
1304 const int rw = rq_data_dir(rq);
1305
1306 disk_stat_add(rq->rq_disk, sectors[rw], rq->nr_sectors);
1307 }
1308
1303#ifdef CCISS_DEBUG 1309#ifdef CCISS_DEBUG
1304 printk("Done with %p\n", rq); 1310 printk("Done with %p\n", rq);
1305#endif /* CCISS_DEBUG */ 1311#endif /* CCISS_DEBUG */
@@ -1923,7 +1929,6 @@ static void cciss_geometry_inquiry(int ctlr, int logvol,
1923{ 1929{
1924 int return_code; 1930 int return_code;
1925 unsigned long t; 1931 unsigned long t;
1926 unsigned long rem;
1927 1932
1928 memset(inq_buff, 0, sizeof(InquiryData_struct)); 1933 memset(inq_buff, 0, sizeof(InquiryData_struct));
1929 if (withirq) 1934 if (withirq)
@@ -1939,26 +1944,23 @@ static void cciss_geometry_inquiry(int ctlr, int logvol,
1939 printk(KERN_WARNING 1944 printk(KERN_WARNING
1940 "cciss: reading geometry failed, volume " 1945 "cciss: reading geometry failed, volume "
1941 "does not support reading geometry\n"); 1946 "does not support reading geometry\n");
1942 drv->block_size = block_size;
1943 drv->nr_blocks = total_size;
1944 drv->heads = 255; 1947 drv->heads = 255;
1945 drv->sectors = 32; // Sectors per track 1948 drv->sectors = 32; // Sectors per track
1946 t = drv->heads * drv->sectors;
1947 drv->cylinders = total_size;
1948 rem = do_div(drv->cylinders, t);
1949 } else { 1949 } else {
1950 drv->block_size = block_size;
1951 drv->nr_blocks = total_size;
1952 drv->heads = inq_buff->data_byte[6]; 1950 drv->heads = inq_buff->data_byte[6];
1953 drv->sectors = inq_buff->data_byte[7]; 1951 drv->sectors = inq_buff->data_byte[7];
1954 drv->cylinders = (inq_buff->data_byte[4] & 0xff) << 8; 1952 drv->cylinders = (inq_buff->data_byte[4] & 0xff) << 8;
1955 drv->cylinders += inq_buff->data_byte[5]; 1953 drv->cylinders += inq_buff->data_byte[5];
1956 drv->raid_level = inq_buff->data_byte[8]; 1954 drv->raid_level = inq_buff->data_byte[8];
1957 t = drv->heads * drv->sectors; 1955 }
1958 if (t > 1) { 1956 drv->block_size = block_size;
1959 drv->cylinders = total_size; 1957 drv->nr_blocks = total_size;
1960 rem = do_div(drv->cylinders, t); 1958 t = drv->heads * drv->sectors;
1961 } 1959 if (t > 1) {
1960 unsigned rem = sector_div(total_size, t);
1961 if (rem)
1962 total_size++;
1963 drv->cylinders = total_size;
1962 } 1964 }
1963 } else { /* Get geometry failed */ 1965 } else { /* Get geometry failed */
1964 printk(KERN_WARNING "cciss: reading geometry failed\n"); 1966 printk(KERN_WARNING "cciss: reading geometry failed\n");
@@ -1996,8 +1998,8 @@ cciss_read_capacity(int ctlr, int logvol, int withirq, sector_t *total_size,
1996 *block_size = BLOCK_SIZE; 1998 *block_size = BLOCK_SIZE;
1997 } 1999 }
1998 if (*total_size != (__u32) 0) 2000 if (*total_size != (__u32) 0)
1999 printk(KERN_INFO " blocks= %lld block_size= %d\n", 2001 printk(KERN_INFO " blocks= %llu block_size= %d\n",
2000 *total_size, *block_size); 2002 (unsigned long long)*total_size, *block_size);
2001 kfree(buf); 2003 kfree(buf);
2002 return; 2004 return;
2003} 2005}
@@ -2031,8 +2033,8 @@ cciss_read_capacity_16(int ctlr, int logvol, int withirq, sector_t *total_size,
2031 *total_size = 0; 2033 *total_size = 0;
2032 *block_size = BLOCK_SIZE; 2034 *block_size = BLOCK_SIZE;
2033 } 2035 }
2034 printk(KERN_INFO " blocks= %lld block_size= %d\n", 2036 printk(KERN_INFO " blocks= %llu block_size= %d\n",
2035 *total_size, *block_size); 2037 (unsigned long long)*total_size, *block_size);
2036 kfree(buf); 2038 kfree(buf);
2037 return; 2039 return;
2038} 2040}
@@ -2300,7 +2302,7 @@ static int sendcmd(__u8 cmd, int ctlr, void *buff, size_t size, unsigned int use
2300#ifdef CONFIG_CISS_SCSI_TAPE 2302#ifdef CONFIG_CISS_SCSI_TAPE
2301 /* if we saved some commands for later, process them now. */ 2303 /* if we saved some commands for later, process them now. */
2302 if (info_p->scsi_rejects.ncompletions > 0) 2304 if (info_p->scsi_rejects.ncompletions > 0)
2303 do_cciss_intr(0, info_p, NULL); 2305 do_cciss_intr(0, info_p);
2304#endif 2306#endif
2305 cmd_free(info_p, c, 1); 2307 cmd_free(info_p, c, 1);
2306 return status; 2308 return status;
@@ -2652,7 +2654,7 @@ static inline long interrupt_not_for_us(ctlr_info_t *h)
2652#endif 2654#endif
2653} 2655}
2654 2656
2655static irqreturn_t do_cciss_intr(int irq, void *dev_id, struct pt_regs *regs) 2657static irqreturn_t do_cciss_intr(int irq, void *dev_id)
2656{ 2658{
2657 ctlr_info_t *h = dev_id; 2659 ctlr_info_t *h = dev_id;
2658 CommandList_struct *c; 2660 CommandList_struct *c;
diff --git a/drivers/block/cpqarray.c b/drivers/block/cpqarray.c
index ada68e65b5ff..d5f519ebbc08 100644
--- a/drivers/block/cpqarray.c
+++ b/drivers/block/cpqarray.c
@@ -169,7 +169,7 @@ static inline cmdlist_t *removeQ(cmdlist_t **Qptr, cmdlist_t *c);
169static inline void complete_buffers(struct bio *bio, int ok); 169static inline void complete_buffers(struct bio *bio, int ok);
170static inline void complete_command(cmdlist_t *cmd, int timeout); 170static inline void complete_command(cmdlist_t *cmd, int timeout);
171 171
172static irqreturn_t do_ida_intr(int irq, void *dev_id, struct pt_regs * regs); 172static irqreturn_t do_ida_intr(int irq, void *dev_id);
173static void ida_timer(unsigned long tdata); 173static void ida_timer(unsigned long tdata);
174static int ida_revalidate(struct gendisk *disk); 174static int ida_revalidate(struct gendisk *disk);
175static int revalidate_allvol(ctlr_info_t *host); 175static int revalidate_allvol(ctlr_info_t *host);
@@ -998,6 +998,7 @@ static inline void complete_buffers(struct bio *bio, int ok)
998 */ 998 */
999static inline void complete_command(cmdlist_t *cmd, int timeout) 999static inline void complete_command(cmdlist_t *cmd, int timeout)
1000{ 1000{
1001 struct request *rq = cmd->rq;
1001 int ok=1; 1002 int ok=1;
1002 int i, ddir; 1003 int i, ddir;
1003 1004
@@ -1029,12 +1030,18 @@ static inline void complete_command(cmdlist_t *cmd, int timeout)
1029 pci_unmap_page(hba[cmd->ctlr]->pci_dev, cmd->req.sg[i].addr, 1030 pci_unmap_page(hba[cmd->ctlr]->pci_dev, cmd->req.sg[i].addr,
1030 cmd->req.sg[i].size, ddir); 1031 cmd->req.sg[i].size, ddir);
1031 1032
1032 complete_buffers(cmd->rq->bio, ok); 1033 complete_buffers(rq->bio, ok);
1033 1034
1034 add_disk_randomness(cmd->rq->rq_disk); 1035 if (blk_fs_request(rq)) {
1036 const int rw = rq_data_dir(rq);
1035 1037
1036 DBGPX(printk("Done with %p\n", cmd->rq);); 1038 disk_stat_add(rq->rq_disk, sectors[rw], rq->nr_sectors);
1037 end_that_request_last(cmd->rq, ok ? 1 : -EIO); 1039 }
1040
1041 add_disk_randomness(rq->rq_disk);
1042
1043 DBGPX(printk("Done with %p\n", rq););
1044 end_that_request_last(rq, ok ? 1 : -EIO);
1038} 1045}
1039 1046
1040/* 1047/*
@@ -1042,7 +1049,7 @@ static inline void complete_command(cmdlist_t *cmd, int timeout)
1042 * Find the command on the completion queue, remove it, tell the OS and 1049 * Find the command on the completion queue, remove it, tell the OS and
1043 * try to queue up more IO 1050 * try to queue up more IO
1044 */ 1051 */
1045static irqreturn_t do_ida_intr(int irq, void *dev_id, struct pt_regs *regs) 1052static irqreturn_t do_ida_intr(int irq, void *dev_id)
1046{ 1053{
1047 ctlr_info_t *h = dev_id; 1054 ctlr_info_t *h = dev_id;
1048 cmdlist_t *c; 1055 cmdlist_t *c;
diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c
index 629c5769d994..9e6d3a87cbe3 100644
--- a/drivers/block/floppy.c
+++ b/drivers/block/floppy.c
@@ -221,7 +221,7 @@ static DEFINE_SPINLOCK(floppy_lock);
221static struct completion device_release; 221static struct completion device_release;
222 222
223static unsigned short virtual_dma_port = 0x3f0; 223static unsigned short virtual_dma_port = 0x3f0;
224irqreturn_t floppy_interrupt(int irq, void *dev_id, struct pt_regs *regs); 224irqreturn_t floppy_interrupt(int irq, void *dev_id);
225static int set_dor(int fdc, char mask, char data); 225static int set_dor(int fdc, char mask, char data);
226 226
227#define K_64 0x10000 /* 64KB */ 227#define K_64 0x10000 /* 64KB */
@@ -1726,7 +1726,7 @@ static void print_result(char *message, int inr)
1726} 1726}
1727 1727
1728/* interrupt handler. Note that this can be called externally on the Sparc */ 1728/* interrupt handler. Note that this can be called externally on the Sparc */
1729irqreturn_t floppy_interrupt(int irq, void *dev_id, struct pt_regs *regs) 1729irqreturn_t floppy_interrupt(int irq, void *dev_id)
1730{ 1730{
1731 void (*handler) (void) = do_floppy; 1731 void (*handler) (void) = do_floppy;
1732 int do_print; 1732 int do_print;
diff --git a/drivers/block/loop.c b/drivers/block/loop.c
index d6bb8da955a2..beab6d2643cb 100644
--- a/drivers/block/loop.c
+++ b/drivers/block/loop.c
@@ -295,7 +295,7 @@ fail:
295 * and do_lo_send_write(). 295 * and do_lo_send_write().
296 */ 296 */
297static int __do_lo_send_write(struct file *file, 297static int __do_lo_send_write(struct file *file,
298 u8 __user *buf, const int len, loff_t pos) 298 u8 *buf, const int len, loff_t pos)
299{ 299{
300 ssize_t bw; 300 ssize_t bw;
301 mm_segment_t old_fs = get_fs(); 301 mm_segment_t old_fs = get_fs();
@@ -324,7 +324,7 @@ static int do_lo_send_direct_write(struct loop_device *lo,
324 struct bio_vec *bvec, int bsize, loff_t pos, struct page *page) 324 struct bio_vec *bvec, int bsize, loff_t pos, struct page *page)
325{ 325{
326 ssize_t bw = __do_lo_send_write(lo->lo_backing_file, 326 ssize_t bw = __do_lo_send_write(lo->lo_backing_file,
327 (u8 __user *)kmap(bvec->bv_page) + bvec->bv_offset, 327 kmap(bvec->bv_page) + bvec->bv_offset,
328 bvec->bv_len, pos); 328 bvec->bv_len, pos);
329 kunmap(bvec->bv_page); 329 kunmap(bvec->bv_page);
330 cond_resched(); 330 cond_resched();
@@ -351,7 +351,7 @@ static int do_lo_send_write(struct loop_device *lo, struct bio_vec *bvec,
351 bvec->bv_offset, bvec->bv_len, pos >> 9); 351 bvec->bv_offset, bvec->bv_len, pos >> 9);
352 if (likely(!ret)) 352 if (likely(!ret))
353 return __do_lo_send_write(lo->lo_backing_file, 353 return __do_lo_send_write(lo->lo_backing_file,
354 (u8 __user *)page_address(page), bvec->bv_len, 354 page_address(page), bvec->bv_len,
355 pos); 355 pos);
356 printk(KERN_ERR "loop: Transfer error at byte offset %llu, " 356 printk(KERN_ERR "loop: Transfer error at byte offset %llu, "
357 "length %i.\n", (unsigned long long)pos, bvec->bv_len); 357 "length %i.\n", (unsigned long long)pos, bvec->bv_len);
@@ -1187,7 +1187,7 @@ struct compat_loop_info {
1187 * - noinlined to reduce stack space usage in main part of driver 1187 * - noinlined to reduce stack space usage in main part of driver
1188 */ 1188 */
1189static noinline int 1189static noinline int
1190loop_info64_from_compat(const struct compat_loop_info *arg, 1190loop_info64_from_compat(const struct compat_loop_info __user *arg,
1191 struct loop_info64 *info64) 1191 struct loop_info64 *info64)
1192{ 1192{
1193 struct compat_loop_info info; 1193 struct compat_loop_info info;
diff --git a/drivers/block/ps2esdi.c b/drivers/block/ps2esdi.c
index 5537974fb242..688a4fb0dc99 100644
--- a/drivers/block/ps2esdi.c
+++ b/drivers/block/ps2esdi.c
@@ -75,8 +75,7 @@ static int ps2esdi_out_cmd_blk(u_short * cmd_blk);
75 75
76static void ps2esdi_prep_dma(char *buffer, u_short length, u_char dma_xmode); 76static void ps2esdi_prep_dma(char *buffer, u_short length, u_char dma_xmode);
77 77
78static irqreturn_t ps2esdi_interrupt_handler(int irq, void *dev_id, 78static irqreturn_t ps2esdi_interrupt_handler(int irq, void *dev_id);
79 struct pt_regs *regs);
80static void (*current_int_handler) (u_int) = NULL; 79static void (*current_int_handler) (u_int) = NULL;
81static void ps2esdi_normal_interrupt_handler(u_int); 80static void ps2esdi_normal_interrupt_handler(u_int);
82static void ps2esdi_initial_reset_int_handler(u_int); 81static void ps2esdi_initial_reset_int_handler(u_int);
@@ -687,8 +686,7 @@ static void ps2esdi_prep_dma(char *buffer, u_short length, u_char dma_xmode)
687 686
688 687
689 688
690static irqreturn_t ps2esdi_interrupt_handler(int irq, void *dev_id, 689static irqreturn_t ps2esdi_interrupt_handler(int irq, void *dev_id)
691 struct pt_regs *regs)
692{ 690{
693 u_int int_ret_code; 691 u_int int_ret_code;
694 692
diff --git a/drivers/block/rd.c b/drivers/block/rd.c
index a3f64bfe6b58..485aa87e9bcd 100644
--- a/drivers/block/rd.c
+++ b/drivers/block/rd.c
@@ -432,6 +432,12 @@ static int __init rd_init(void)
432 rd_disks[i] = alloc_disk(1); 432 rd_disks[i] = alloc_disk(1);
433 if (!rd_disks[i]) 433 if (!rd_disks[i])
434 goto out; 434 goto out;
435
436 rd_queue[i] = blk_alloc_queue(GFP_KERNEL);
437 if (!rd_queue[i]) {
438 put_disk(rd_disks[i]);
439 goto out;
440 }
435 } 441 }
436 442
437 if (register_blkdev(RAMDISK_MAJOR, "ramdisk")) { 443 if (register_blkdev(RAMDISK_MAJOR, "ramdisk")) {
@@ -442,10 +448,6 @@ static int __init rd_init(void)
442 for (i = 0; i < CONFIG_BLK_DEV_RAM_COUNT; i++) { 448 for (i = 0; i < CONFIG_BLK_DEV_RAM_COUNT; i++) {
443 struct gendisk *disk = rd_disks[i]; 449 struct gendisk *disk = rd_disks[i];
444 450
445 rd_queue[i] = blk_alloc_queue(GFP_KERNEL);
446 if (!rd_queue[i])
447 goto out_queue;
448
449 blk_queue_make_request(rd_queue[i], &rd_make_request); 451 blk_queue_make_request(rd_queue[i], &rd_make_request);
450 blk_queue_hardsect_size(rd_queue[i], rd_blocksize); 452 blk_queue_hardsect_size(rd_queue[i], rd_blocksize);
451 453
@@ -466,8 +468,6 @@ static int __init rd_init(void)
466 CONFIG_BLK_DEV_RAM_COUNT, rd_size, rd_blocksize); 468 CONFIG_BLK_DEV_RAM_COUNT, rd_size, rd_blocksize);
467 469
468 return 0; 470 return 0;
469out_queue:
470 unregister_blkdev(RAMDISK_MAJOR, "ramdisk");
471out: 471out:
472 while (i--) { 472 while (i--) {
473 put_disk(rd_disks[i]); 473 put_disk(rd_disks[i]);
diff --git a/drivers/block/swim3.c b/drivers/block/swim3.c
index fdc8f892eb86..1a65979f1f0f 100644
--- a/drivers/block/swim3.c
+++ b/drivers/block/swim3.c
@@ -238,8 +238,8 @@ static void scan_timeout(unsigned long data);
238static void seek_timeout(unsigned long data); 238static void seek_timeout(unsigned long data);
239static void settle_timeout(unsigned long data); 239static void settle_timeout(unsigned long data);
240static void xfer_timeout(unsigned long data); 240static void xfer_timeout(unsigned long data);
241static irqreturn_t swim3_interrupt(int irq, void *dev_id, struct pt_regs *regs); 241static irqreturn_t swim3_interrupt(int irq, void *dev_id);
242/*static void fd_dma_interrupt(int irq, void *dev_id, struct pt_regs *regs);*/ 242/*static void fd_dma_interrupt(int irq, void *dev_id);*/
243static int grab_drive(struct floppy_state *fs, enum swim_state state, 243static int grab_drive(struct floppy_state *fs, enum swim_state state,
244 int interruptible); 244 int interruptible);
245static void release_drive(struct floppy_state *fs); 245static void release_drive(struct floppy_state *fs);
@@ -624,7 +624,7 @@ static void xfer_timeout(unsigned long data)
624 start_request(fs); 624 start_request(fs);
625} 625}
626 626
627static irqreturn_t swim3_interrupt(int irq, void *dev_id, struct pt_regs *regs) 627static irqreturn_t swim3_interrupt(int irq, void *dev_id)
628{ 628{
629 struct floppy_state *fs = (struct floppy_state *) dev_id; 629 struct floppy_state *fs = (struct floppy_state *) dev_id;
630 struct swim3 __iomem *sw = fs->swim3; 630 struct swim3 __iomem *sw = fs->swim3;
@@ -777,7 +777,7 @@ static irqreturn_t swim3_interrupt(int irq, void *dev_id, struct pt_regs *regs)
777} 777}
778 778
779/* 779/*
780static void fd_dma_interrupt(int irq, void *dev_id, struct pt_regs *regs) 780static void fd_dma_interrupt(int irq, void *dev_id)
781{ 781{
782} 782}
783*/ 783*/
diff --git a/drivers/block/swim_iop.c b/drivers/block/swim_iop.c
index dfda796eba56..ed7b06cf3e68 100644
--- a/drivers/block/swim_iop.c
+++ b/drivers/block/swim_iop.c
@@ -94,7 +94,7 @@ static char *drive_names[7] = {
94int swimiop_init(void); 94int swimiop_init(void);
95static void swimiop_init_request(struct swim_iop_req *); 95static void swimiop_init_request(struct swim_iop_req *);
96static int swimiop_send_request(struct swim_iop_req *); 96static int swimiop_send_request(struct swim_iop_req *);
97static void swimiop_receive(struct iop_msg *, struct pt_regs *); 97static void swimiop_receive(struct iop_msg *);
98static void swimiop_status_update(int, struct swim_drvstatus *); 98static void swimiop_status_update(int, struct swim_drvstatus *);
99static int swimiop_eject(struct floppy_state *fs); 99static int swimiop_eject(struct floppy_state *fs);
100 100
@@ -257,7 +257,7 @@ static int swimiop_send_request(struct swim_iop_req *req)
257 * 2. An unsolicited message was received from the IOP. 257 * 2. An unsolicited message was received from the IOP.
258 */ 258 */
259 259
260void swimiop_receive(struct iop_msg *msg, struct pt_regs *regs) 260void swimiop_receive(struct iop_msg *msg)
261{ 261{
262 struct swim_iop_req *req; 262 struct swim_iop_req *req;
263 struct swimmsg_status *sm; 263 struct swimmsg_status *sm;
diff --git a/drivers/block/sx8.c b/drivers/block/sx8.c
index c6beee18a07c..47d6975268ff 100644
--- a/drivers/block/sx8.c
+++ b/drivers/block/sx8.c
@@ -1200,7 +1200,7 @@ static inline void carm_handle_responses(struct carm_host *host)
1200 host->resp_idx += work; 1200 host->resp_idx += work;
1201} 1201}
1202 1202
1203static irqreturn_t carm_interrupt(int irq, void *__host, struct pt_regs *regs) 1203static irqreturn_t carm_interrupt(int irq, void *__host)
1204{ 1204{
1205 struct carm_host *host = __host; 1205 struct carm_host *host = __host;
1206 void __iomem *mmio; 1206 void __iomem *mmio;
diff --git a/drivers/block/ub.c b/drivers/block/ub.c
index 45a8f402b07b..0d5c73f07265 100644
--- a/drivers/block/ub.c
+++ b/drivers/block/ub.c
@@ -362,7 +362,7 @@ static void ub_end_rq(struct request *rq, unsigned int status);
362static int ub_rw_cmd_retry(struct ub_dev *sc, struct ub_lun *lun, 362static int ub_rw_cmd_retry(struct ub_dev *sc, struct ub_lun *lun,
363 struct ub_request *urq, struct ub_scsi_cmd *cmd); 363 struct ub_request *urq, struct ub_scsi_cmd *cmd);
364static int ub_submit_scsi(struct ub_dev *sc, struct ub_scsi_cmd *cmd); 364static int ub_submit_scsi(struct ub_dev *sc, struct ub_scsi_cmd *cmd);
365static void ub_urb_complete(struct urb *urb, struct pt_regs *pt); 365static void ub_urb_complete(struct urb *urb);
366static void ub_scsi_action(unsigned long _dev); 366static void ub_scsi_action(unsigned long _dev);
367static void ub_scsi_dispatch(struct ub_dev *sc); 367static void ub_scsi_dispatch(struct ub_dev *sc);
368static void ub_scsi_urb_compl(struct ub_dev *sc, struct ub_scsi_cmd *cmd); 368static void ub_scsi_urb_compl(struct ub_dev *sc, struct ub_scsi_cmd *cmd);
@@ -959,7 +959,7 @@ static void ub_urb_timeout(unsigned long arg)
959 * the sc->lock taken) and from an interrupt (while we do NOT have 959 * the sc->lock taken) and from an interrupt (while we do NOT have
960 * the sc->lock taken). Therefore, bounce this off to a tasklet. 960 * the sc->lock taken). Therefore, bounce this off to a tasklet.
961 */ 961 */
962static void ub_urb_complete(struct urb *urb, struct pt_regs *pt) 962static void ub_urb_complete(struct urb *urb)
963{ 963{
964 struct ub_dev *sc = urb->context; 964 struct ub_dev *sc = urb->context;
965 965
@@ -1923,7 +1923,7 @@ err_alloc:
1923 1923
1924/* 1924/*
1925 */ 1925 */
1926static void ub_probe_urb_complete(struct urb *urb, struct pt_regs *pt) 1926static void ub_probe_urb_complete(struct urb *urb)
1927{ 1927{
1928 struct completion *cop = urb->context; 1928 struct completion *cop = urb->context;
1929 complete(cop); 1929 complete(cop);
diff --git a/drivers/block/umem.c b/drivers/block/umem.c
index cbb9d0f21acc..30f16bd83650 100644
--- a/drivers/block/umem.c
+++ b/drivers/block/umem.c
@@ -571,7 +571,7 @@ static int mm_make_request(request_queue_t *q, struct bio *bio)
571-- mm_interrupt 571-- mm_interrupt
572----------------------------------------------------------------------------------- 572-----------------------------------------------------------------------------------
573*/ 573*/
574static irqreturn_t mm_interrupt(int irq, void *__card, struct pt_regs *regs) 574static irqreturn_t mm_interrupt(int irq, void *__card)
575{ 575{
576 struct cardinfo *card = (struct cardinfo *) __card; 576 struct cardinfo *card = (struct cardinfo *) __card;
577 unsigned int dma_status; 577 unsigned int dma_status;
diff --git a/drivers/block/xd.c b/drivers/block/xd.c
index ebf3025721d1..0d97b7eb818a 100644
--- a/drivers/block/xd.c
+++ b/drivers/block/xd.c
@@ -48,9 +48,9 @@
48#include <linux/blkdev.h> 48#include <linux/blkdev.h>
49#include <linux/blkpg.h> 49#include <linux/blkpg.h>
50#include <linux/delay.h> 50#include <linux/delay.h>
51#include <linux/io.h>
51 52
52#include <asm/system.h> 53#include <asm/system.h>
53#include <asm/io.h>
54#include <asm/uaccess.h> 54#include <asm/uaccess.h>
55#include <asm/dma.h> 55#include <asm/dma.h>
56 56
@@ -462,8 +462,7 @@ static void xd_recalibrate (u_char drive)
462} 462}
463 463
464/* xd_interrupt_handler: interrupt service routine */ 464/* xd_interrupt_handler: interrupt service routine */
465static irqreturn_t xd_interrupt_handler(int irq, void *dev_id, 465static irqreturn_t xd_interrupt_handler(int irq, void *dev_id)
466 struct pt_regs *regs)
467{ 466{
468 if (inb(XD_STATUS) & STAT_INTERRUPT) { /* check if it was our device */ 467 if (inb(XD_STATUS) & STAT_INTERRUPT) { /* check if it was our device */
469#ifdef DEBUG_OTHER 468#ifdef DEBUG_OTHER
diff --git a/drivers/block/xd.h b/drivers/block/xd.h
index 71ac2e3dffc8..82e090fea957 100644
--- a/drivers/block/xd.h
+++ b/drivers/block/xd.h
@@ -109,8 +109,7 @@ static int xd_ioctl (struct inode *inode,struct file *file,unsigned int cmd,unsi
109static int xd_readwrite (u_char operation,XD_INFO *disk,char *buffer,u_int block,u_int count); 109static int xd_readwrite (u_char operation,XD_INFO *disk,char *buffer,u_int block,u_int count);
110static void xd_recalibrate (u_char drive); 110static void xd_recalibrate (u_char drive);
111 111
112static irqreturn_t xd_interrupt_handler(int irq, void *dev_id, 112static irqreturn_t xd_interrupt_handler(int irq, void *dev_id);
113 struct pt_regs *regs);
114static u_char xd_setup_dma (u_char opcode,u_char *buffer,u_int count); 113static u_char xd_setup_dma (u_char opcode,u_char *buffer,u_int count);
115static u_char *xd_build (u_char *cmdblk,u_char command,u_char drive,u_char head,u_short cylinder,u_char sector,u_char count,u_char control); 114static u_char *xd_build (u_char *cmdblk,u_char command,u_char drive,u_char head,u_short cylinder,u_char sector,u_char count,u_char control);
116static void xd_watchdog (unsigned long unused); 115static void xd_watchdog (unsigned long unused);
diff --git a/drivers/block/z2ram.c b/drivers/block/z2ram.c
index 82ddbdd7bd4b..7cc2685ca84a 100644
--- a/drivers/block/z2ram.c
+++ b/drivers/block/z2ram.c
@@ -329,7 +329,7 @@ static struct kobject *z2_find(dev_t dev, int *part, void *data)
329 329
330static struct request_queue *z2_queue; 330static struct request_queue *z2_queue;
331 331
332int __init 332static int __init
333z2_init(void) 333z2_init(void)
334{ 334{
335 int ret; 335 int ret;
@@ -370,26 +370,7 @@ err:
370 return ret; 370 return ret;
371} 371}
372 372
373#if defined(MODULE) 373static void __exit z2_exit(void)
374
375MODULE_LICENSE("GPL");
376
377int
378init_module( void )
379{
380 int error;
381
382 error = z2_init();
383 if ( error == 0 )
384 {
385 printk( KERN_INFO DEVICE_NAME ": loaded as module\n" );
386 }
387
388 return error;
389}
390
391void
392cleanup_module( void )
393{ 374{
394 int i, j; 375 int i, j;
395 blk_unregister_region(MKDEV(Z2RAM_MAJOR, 0), 256); 376 blk_unregister_region(MKDEV(Z2RAM_MAJOR, 0), 256);
@@ -425,4 +406,7 @@ cleanup_module( void )
425 406
426 return; 407 return;
427} 408}
428#endif 409
410module_init(z2_init);
411module_exit(z2_exit);
412MODULE_LICENSE("GPL");