aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/block')
-rw-r--r--drivers/block/Kconfig15
-rw-r--r--drivers/block/aoe/aoecmd.c2
-rw-r--r--drivers/block/cciss.c1
-rw-r--r--drivers/block/floppy.c93
-rw-r--r--drivers/block/loop.c17
-rw-r--r--drivers/block/mtip32xx/mtip32xx.c33
-rw-r--r--drivers/block/mtip32xx/mtip32xx.h7
-rw-r--r--drivers/block/xen-blkback/common.h4
-rw-r--r--drivers/block/xen-blkback/xenbus.c9
9 files changed, 110 insertions, 71 deletions
diff --git a/drivers/block/Kconfig b/drivers/block/Kconfig
index f529407db93f..824e09c4d0d7 100644
--- a/drivers/block/Kconfig
+++ b/drivers/block/Kconfig
@@ -131,6 +131,7 @@ config BLK_CPQ_DA
131config BLK_CPQ_CISS_DA 131config BLK_CPQ_CISS_DA
132 tristate "Compaq Smart Array 5xxx support" 132 tristate "Compaq Smart Array 5xxx support"
133 depends on PCI 133 depends on PCI
134 select CHECK_SIGNATURE
134 help 135 help
135 This is the driver for Compaq Smart Array 5xxx controllers. 136 This is the driver for Compaq Smart Array 5xxx controllers.
136 Everyone using these boards should say Y here. 137 Everyone using these boards should say Y here.
@@ -166,8 +167,8 @@ config BLK_DEV_DAC960
166 module will be called DAC960. 167 module will be called DAC960.
167 168
168config BLK_DEV_UMEM 169config BLK_DEV_UMEM
169 tristate "Micro Memory MM5415 Battery Backed RAM support (EXPERIMENTAL)" 170 tristate "Micro Memory MM5415 Battery Backed RAM support"
170 depends on PCI && EXPERIMENTAL 171 depends on PCI
171 ---help--- 172 ---help---
172 Saying Y here will include support for the MM5415 family of 173 Saying Y here will include support for the MM5415 family of
173 battery backed (Non-volatile) RAM cards. 174 battery backed (Non-volatile) RAM cards.
@@ -430,8 +431,8 @@ config CDROM_PKTCDVD_BUFFERS
430 a disc is opened for writing. 431 a disc is opened for writing.
431 432
432config CDROM_PKTCDVD_WCACHE 433config CDROM_PKTCDVD_WCACHE
433 bool "Enable write caching (EXPERIMENTAL)" 434 bool "Enable write caching"
434 depends on CDROM_PKTCDVD && EXPERIMENTAL 435 depends on CDROM_PKTCDVD
435 help 436 help
436 If enabled, write caching will be set for the CD-R/W device. For now 437 If enabled, write caching will be set for the CD-R/W device. For now
437 this option is dangerous unless the CD-RW media is known good, as we 438 this option is dangerous unless the CD-RW media is known good, as we
@@ -508,8 +509,8 @@ config XEN_BLKDEV_BACKEND
508 509
509 510
510config VIRTIO_BLK 511config VIRTIO_BLK
511 tristate "Virtio block driver (EXPERIMENTAL)" 512 tristate "Virtio block driver"
512 depends on EXPERIMENTAL && VIRTIO 513 depends on VIRTIO
513 ---help--- 514 ---help---
514 This is the virtual block driver for virtio. It can be used with 515 This is the virtual block driver for virtio. It can be used with
515 lguest or QEMU based VMMs (like KVM or Xen). Say Y or M. 516 lguest or QEMU based VMMs (like KVM or Xen). Say Y or M.
@@ -528,7 +529,7 @@ config BLK_DEV_HD
528 529
529config BLK_DEV_RBD 530config BLK_DEV_RBD
530 tristate "Rados block device (RBD)" 531 tristate "Rados block device (RBD)"
531 depends on INET && EXPERIMENTAL && BLOCK 532 depends on INET && BLOCK
532 select CEPH_LIB 533 select CEPH_LIB
533 select LIBCRC32C 534 select LIBCRC32C
534 select CRYPTO_AES 535 select CRYPTO_AES
diff --git a/drivers/block/aoe/aoecmd.c b/drivers/block/aoe/aoecmd.c
index 3804a0af3ef1..9fe4f1865558 100644
--- a/drivers/block/aoe/aoecmd.c
+++ b/drivers/block/aoe/aoecmd.c
@@ -935,7 +935,7 @@ aoe_end_request(struct aoedev *d, struct request *rq, int fastfail)
935 935
936 /* cf. http://lkml.org/lkml/2006/10/31/28 */ 936 /* cf. http://lkml.org/lkml/2006/10/31/28 */
937 if (!fastfail) 937 if (!fastfail)
938 q->request_fn(q); 938 __blk_run_queue(q);
939} 939}
940 940
941static void 941static void
diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c
index b0f553b26d0f..ca83f96756ad 100644
--- a/drivers/block/cciss.c
+++ b/drivers/block/cciss.c
@@ -5205,7 +5205,6 @@ static void cciss_shutdown(struct pci_dev *pdev)
5205 return; 5205 return;
5206 } 5206 }
5207 /* write all data in the battery backed cache to disk */ 5207 /* write all data in the battery backed cache to disk */
5208 memset(flush_buf, 0, 4);
5209 return_code = sendcmd_withirq(h, CCISS_CACHE_FLUSH, flush_buf, 5208 return_code = sendcmd_withirq(h, CCISS_CACHE_FLUSH, flush_buf,
5210 4, 0, CTLR_LUNID, TYPE_CMD); 5209 4, 0, CTLR_LUNID, TYPE_CMD);
5211 kfree(flush_buf); 5210 kfree(flush_buf);
diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c
index 17c675c52295..2ddd64a9ffde 100644
--- a/drivers/block/floppy.c
+++ b/drivers/block/floppy.c
@@ -4109,12 +4109,19 @@ static struct platform_driver floppy_driver = {
4109 4109
4110static struct platform_device floppy_device[N_DRIVE]; 4110static struct platform_device floppy_device[N_DRIVE];
4111 4111
4112static bool floppy_available(int drive)
4113{
4114 if (!(allowed_drive_mask & (1 << drive)))
4115 return false;
4116 if (fdc_state[FDC(drive)].version == FDC_NONE)
4117 return false;
4118 return true;
4119}
4120
4112static struct kobject *floppy_find(dev_t dev, int *part, void *data) 4121static struct kobject *floppy_find(dev_t dev, int *part, void *data)
4113{ 4122{
4114 int drive = (*part & 3) | ((*part & 0x80) >> 5); 4123 int drive = (*part & 3) | ((*part & 0x80) >> 5);
4115 if (drive >= N_DRIVE || 4124 if (drive >= N_DRIVE || !floppy_available(drive))
4116 !(allowed_drive_mask & (1 << drive)) ||
4117 fdc_state[FDC(drive)].version == FDC_NONE)
4118 return NULL; 4125 return NULL;
4119 if (((*part >> 2) & 0x1f) >= ARRAY_SIZE(floppy_type)) 4126 if (((*part >> 2) & 0x1f) >= ARRAY_SIZE(floppy_type))
4120 return NULL; 4127 return NULL;
@@ -4124,8 +4131,7 @@ static struct kobject *floppy_find(dev_t dev, int *part, void *data)
4124 4131
4125static int __init do_floppy_init(void) 4132static int __init do_floppy_init(void)
4126{ 4133{
4127 int i, unit, drive; 4134 int i, unit, drive, err;
4128 int err, dr;
4129 4135
4130 set_debugt(); 4136 set_debugt();
4131 interruptjiffies = resultjiffies = jiffies; 4137 interruptjiffies = resultjiffies = jiffies;
@@ -4137,34 +4143,32 @@ static int __init do_floppy_init(void)
4137 4143
4138 raw_cmd = NULL; 4144 raw_cmd = NULL;
4139 4145
4140 for (dr = 0; dr < N_DRIVE; dr++) { 4146 floppy_wq = alloc_ordered_workqueue("floppy", 0);
4141 disks[dr] = alloc_disk(1); 4147 if (!floppy_wq)
4142 if (!disks[dr]) { 4148 return -ENOMEM;
4143 err = -ENOMEM;
4144 goto out_put_disk;
4145 }
4146 4149
4147 floppy_wq = alloc_ordered_workqueue("floppy", 0); 4150 for (drive = 0; drive < N_DRIVE; drive++) {
4148 if (!floppy_wq) { 4151 disks[drive] = alloc_disk(1);
4152 if (!disks[drive]) {
4149 err = -ENOMEM; 4153 err = -ENOMEM;
4150 goto out_put_disk; 4154 goto out_put_disk;
4151 } 4155 }
4152 4156
4153 disks[dr]->queue = blk_init_queue(do_fd_request, &floppy_lock); 4157 disks[drive]->queue = blk_init_queue(do_fd_request, &floppy_lock);
4154 if (!disks[dr]->queue) { 4158 if (!disks[drive]->queue) {
4155 err = -ENOMEM; 4159 err = -ENOMEM;
4156 goto out_destroy_workq; 4160 goto out_put_disk;
4157 } 4161 }
4158 4162
4159 blk_queue_max_hw_sectors(disks[dr]->queue, 64); 4163 blk_queue_max_hw_sectors(disks[drive]->queue, 64);
4160 disks[dr]->major = FLOPPY_MAJOR; 4164 disks[drive]->major = FLOPPY_MAJOR;
4161 disks[dr]->first_minor = TOMINOR(dr); 4165 disks[drive]->first_minor = TOMINOR(drive);
4162 disks[dr]->fops = &floppy_fops; 4166 disks[drive]->fops = &floppy_fops;
4163 sprintf(disks[dr]->disk_name, "fd%d", dr); 4167 sprintf(disks[drive]->disk_name, "fd%d", drive);
4164 4168
4165 init_timer(&motor_off_timer[dr]); 4169 init_timer(&motor_off_timer[drive]);
4166 motor_off_timer[dr].data = dr; 4170 motor_off_timer[drive].data = drive;
4167 motor_off_timer[dr].function = motor_off_callback; 4171 motor_off_timer[drive].function = motor_off_callback;
4168 } 4172 }
4169 4173
4170 err = register_blkdev(FLOPPY_MAJOR, "fd"); 4174 err = register_blkdev(FLOPPY_MAJOR, "fd");
@@ -4282,9 +4286,7 @@ static int __init do_floppy_init(void)
4282 } 4286 }
4283 4287
4284 for (drive = 0; drive < N_DRIVE; drive++) { 4288 for (drive = 0; drive < N_DRIVE; drive++) {
4285 if (!(allowed_drive_mask & (1 << drive))) 4289 if (!floppy_available(drive))
4286 continue;
4287 if (fdc_state[FDC(drive)].version == FDC_NONE)
4288 continue; 4290 continue;
4289 4291
4290 floppy_device[drive].name = floppy_device_name; 4292 floppy_device[drive].name = floppy_device_name;
@@ -4293,7 +4295,7 @@ static int __init do_floppy_init(void)
4293 4295
4294 err = platform_device_register(&floppy_device[drive]); 4296 err = platform_device_register(&floppy_device[drive]);
4295 if (err) 4297 if (err)
4296 goto out_release_dma; 4298 goto out_remove_drives;
4297 4299
4298 err = device_create_file(&floppy_device[drive].dev, 4300 err = device_create_file(&floppy_device[drive].dev,
4299 &dev_attr_cmos); 4301 &dev_attr_cmos);
@@ -4311,28 +4313,33 @@ static int __init do_floppy_init(void)
4311 4313
4312out_unreg_platform_dev: 4314out_unreg_platform_dev:
4313 platform_device_unregister(&floppy_device[drive]); 4315 platform_device_unregister(&floppy_device[drive]);
4316out_remove_drives:
4317 while (drive--) {
4318 if (floppy_available(drive)) {
4319 del_gendisk(disks[drive]);
4320 device_remove_file(&floppy_device[drive].dev, &dev_attr_cmos);
4321 platform_device_unregister(&floppy_device[drive]);
4322 }
4323 }
4314out_release_dma: 4324out_release_dma:
4315 if (atomic_read(&usage_count)) 4325 if (atomic_read(&usage_count))
4316 floppy_release_irq_and_dma(); 4326 floppy_release_irq_and_dma();
4317out_unreg_region: 4327out_unreg_region:
4318 blk_unregister_region(MKDEV(FLOPPY_MAJOR, 0), 256); 4328 blk_unregister_region(MKDEV(FLOPPY_MAJOR, 0), 256);
4319 platform_driver_unregister(&floppy_driver); 4329 platform_driver_unregister(&floppy_driver);
4320out_destroy_workq:
4321 destroy_workqueue(floppy_wq);
4322out_unreg_blkdev: 4330out_unreg_blkdev:
4323 unregister_blkdev(FLOPPY_MAJOR, "fd"); 4331 unregister_blkdev(FLOPPY_MAJOR, "fd");
4324out_put_disk: 4332out_put_disk:
4325 while (dr--) { 4333 destroy_workqueue(floppy_wq);
4326 del_timer_sync(&motor_off_timer[dr]); 4334 for (drive = 0; drive < N_DRIVE; drive++) {
4327 if (disks[dr]->queue) { 4335 if (!disks[drive])
4328 blk_cleanup_queue(disks[dr]->queue); 4336 break;
4329 /* 4337 if (disks[drive]->queue) {
4330 * put_disk() is not paired with add_disk() and 4338 del_timer_sync(&motor_off_timer[drive]);
4331 * will put queue reference one extra time. fix it. 4339 blk_cleanup_queue(disks[drive]->queue);
4332 */ 4340 disks[drive]->queue = NULL;
4333 disks[dr]->queue = NULL;
4334 } 4341 }
4335 put_disk(disks[dr]); 4342 put_disk(disks[drive]);
4336 } 4343 }
4337 return err; 4344 return err;
4338} 4345}
@@ -4548,11 +4555,12 @@ static void __exit floppy_module_exit(void)
4548 unregister_blkdev(FLOPPY_MAJOR, "fd"); 4555 unregister_blkdev(FLOPPY_MAJOR, "fd");
4549 platform_driver_unregister(&floppy_driver); 4556 platform_driver_unregister(&floppy_driver);
4550 4557
4558 destroy_workqueue(floppy_wq);
4559
4551 for (drive = 0; drive < N_DRIVE; drive++) { 4560 for (drive = 0; drive < N_DRIVE; drive++) {
4552 del_timer_sync(&motor_off_timer[drive]); 4561 del_timer_sync(&motor_off_timer[drive]);
4553 4562
4554 if ((allowed_drive_mask & (1 << drive)) && 4563 if (floppy_available(drive)) {
4555 fdc_state[FDC(drive)].version != FDC_NONE) {
4556 del_gendisk(disks[drive]); 4564 del_gendisk(disks[drive]);
4557 device_remove_file(&floppy_device[drive].dev, &dev_attr_cmos); 4565 device_remove_file(&floppy_device[drive].dev, &dev_attr_cmos);
4558 platform_device_unregister(&floppy_device[drive]); 4566 platform_device_unregister(&floppy_device[drive]);
@@ -4572,7 +4580,6 @@ static void __exit floppy_module_exit(void)
4572 4580
4573 cancel_delayed_work_sync(&fd_timeout); 4581 cancel_delayed_work_sync(&fd_timeout);
4574 cancel_delayed_work_sync(&fd_timer); 4582 cancel_delayed_work_sync(&fd_timer);
4575 destroy_workqueue(floppy_wq);
4576 4583
4577 if (atomic_read(&usage_count)) 4584 if (atomic_read(&usage_count))
4578 floppy_release_irq_and_dma(); 4585 floppy_release_irq_and_dma();
diff --git a/drivers/block/loop.c b/drivers/block/loop.c
index e9d594fd12cb..54046e51160a 100644
--- a/drivers/block/loop.c
+++ b/drivers/block/loop.c
@@ -976,8 +976,21 @@ static int loop_clr_fd(struct loop_device *lo)
976 if (lo->lo_state != Lo_bound) 976 if (lo->lo_state != Lo_bound)
977 return -ENXIO; 977 return -ENXIO;
978 978
979 if (lo->lo_refcnt > 1) /* we needed one fd for the ioctl */ 979 /*
980 return -EBUSY; 980 * If we've explicitly asked to tear down the loop device,
981 * and it has an elevated reference count, set it for auto-teardown when
982 * the last reference goes away. This stops $!~#$@ udev from
983 * preventing teardown because it decided that it needs to run blkid on
984 * the loopback device whenever they appear. xfstests is notorious for
985 * failing tests because blkid via udev races with a losetup
986 * <dev>/do something like mkfs/losetup -d <dev> causing the losetup -d
987 * command to fail with EBUSY.
988 */
989 if (lo->lo_refcnt > 1) {
990 lo->lo_flags |= LO_FLAGS_AUTOCLEAR;
991 mutex_unlock(&lo->lo_ctl_mutex);
992 return 0;
993 }
981 994
982 if (filp == NULL) 995 if (filp == NULL)
983 return -EINVAL; 996 return -EINVAL;
diff --git a/drivers/block/mtip32xx/mtip32xx.c b/drivers/block/mtip32xx/mtip32xx.c
index f946d31d6917..9694dd99bbbc 100644
--- a/drivers/block/mtip32xx/mtip32xx.c
+++ b/drivers/block/mtip32xx/mtip32xx.c
@@ -559,7 +559,7 @@ static void mtip_timeout_function(unsigned long int data)
559 struct mtip_cmd *command; 559 struct mtip_cmd *command;
560 int tag, cmdto_cnt = 0; 560 int tag, cmdto_cnt = 0;
561 unsigned int bit, group; 561 unsigned int bit, group;
562 unsigned int num_command_slots = port->dd->slot_groups * 32; 562 unsigned int num_command_slots;
563 unsigned long to, tagaccum[SLOTBITS_IN_LONGS]; 563 unsigned long to, tagaccum[SLOTBITS_IN_LONGS];
564 564
565 if (unlikely(!port)) 565 if (unlikely(!port))
@@ -572,6 +572,7 @@ static void mtip_timeout_function(unsigned long int data)
572 } 572 }
573 /* clear the tag accumulator */ 573 /* clear the tag accumulator */
574 memset(tagaccum, 0, SLOTBITS_IN_LONGS * sizeof(long)); 574 memset(tagaccum, 0, SLOTBITS_IN_LONGS * sizeof(long));
575 num_command_slots = port->dd->slot_groups * 32;
575 576
576 for (tag = 0; tag < num_command_slots; tag++) { 577 for (tag = 0; tag < num_command_slots; tag++) {
577 /* 578 /*
@@ -2035,8 +2036,9 @@ static unsigned int implicit_sector(unsigned char command,
2035 } 2036 }
2036 return rv; 2037 return rv;
2037} 2038}
2038 2039static void mtip_set_timeout(struct driver_data *dd,
2039static void mtip_set_timeout(struct host_to_dev_fis *fis, unsigned int *timeout) 2040 struct host_to_dev_fis *fis,
2041 unsigned int *timeout, u8 erasemode)
2040{ 2042{
2041 switch (fis->command) { 2043 switch (fis->command) {
2042 case ATA_CMD_DOWNLOAD_MICRO: 2044 case ATA_CMD_DOWNLOAD_MICRO:
@@ -2044,7 +2046,10 @@ static void mtip_set_timeout(struct host_to_dev_fis *fis, unsigned int *timeout)
2044 break; 2046 break;
2045 case ATA_CMD_SEC_ERASE_UNIT: 2047 case ATA_CMD_SEC_ERASE_UNIT:
2046 case 0xFC: 2048 case 0xFC:
2047 *timeout = 240000; /* 4 minutes */ 2049 if (erasemode)
2050 *timeout = ((*(dd->port->identify + 90) * 2) * 60000);
2051 else
2052 *timeout = ((*(dd->port->identify + 89) * 2) * 60000);
2048 break; 2053 break;
2049 case ATA_CMD_STANDBYNOW1: 2054 case ATA_CMD_STANDBYNOW1:
2050 *timeout = 120000; /* 2 minutes */ 2055 *timeout = 120000; /* 2 minutes */
@@ -2087,6 +2092,7 @@ static int exec_drive_taskfile(struct driver_data *dd,
2087 unsigned int transfer_size; 2092 unsigned int transfer_size;
2088 unsigned long task_file_data; 2093 unsigned long task_file_data;
2089 int intotal = outtotal + req_task->out_size; 2094 int intotal = outtotal + req_task->out_size;
2095 int erasemode = 0;
2090 2096
2091 taskout = req_task->out_size; 2097 taskout = req_task->out_size;
2092 taskin = req_task->in_size; 2098 taskin = req_task->in_size;
@@ -2212,7 +2218,13 @@ static int exec_drive_taskfile(struct driver_data *dd,
2212 fis.lba_hi, 2218 fis.lba_hi,
2213 fis.device); 2219 fis.device);
2214 2220
2215 mtip_set_timeout(&fis, &timeout); 2221 /* check for erase mode support during secure erase.*/
2222 if ((fis.command == ATA_CMD_SEC_ERASE_UNIT) && outbuf &&
2223 (outbuf[0] & MTIP_SEC_ERASE_MODE)) {
2224 erasemode = 1;
2225 }
2226
2227 mtip_set_timeout(dd, &fis, &timeout, erasemode);
2216 2228
2217 /* Determine the correct transfer size.*/ 2229 /* Determine the correct transfer size.*/
2218 if (force_single_sector) 2230 if (force_single_sector)
@@ -2428,7 +2440,7 @@ static int mtip_hw_ioctl(struct driver_data *dd, unsigned int cmd,
2428 * return value 2440 * return value
2429 * None 2441 * None
2430 */ 2442 */
2431static void mtip_hw_submit_io(struct driver_data *dd, sector_t start, 2443static void mtip_hw_submit_io(struct driver_data *dd, sector_t sector,
2432 int nsect, int nents, int tag, void *callback, 2444 int nsect, int nents, int tag, void *callback,
2433 void *data, int dir) 2445 void *data, int dir)
2434{ 2446{
@@ -2436,6 +2448,7 @@ static void mtip_hw_submit_io(struct driver_data *dd, sector_t start,
2436 struct mtip_port *port = dd->port; 2448 struct mtip_port *port = dd->port;
2437 struct mtip_cmd *command = &port->commands[tag]; 2449 struct mtip_cmd *command = &port->commands[tag];
2438 int dma_dir = (dir == READ) ? DMA_FROM_DEVICE : DMA_TO_DEVICE; 2450 int dma_dir = (dir == READ) ? DMA_FROM_DEVICE : DMA_TO_DEVICE;
2451 u64 start = sector;
2439 2452
2440 /* Map the scatter list for DMA access */ 2453 /* Map the scatter list for DMA access */
2441 nents = dma_map_sg(&dd->pdev->dev, command->sg, nents, dma_dir); 2454 nents = dma_map_sg(&dd->pdev->dev, command->sg, nents, dma_dir);
@@ -2454,8 +2467,12 @@ static void mtip_hw_submit_io(struct driver_data *dd, sector_t start,
2454 fis->opts = 1 << 7; 2467 fis->opts = 1 << 7;
2455 fis->command = 2468 fis->command =
2456 (dir == READ ? ATA_CMD_FPDMA_READ : ATA_CMD_FPDMA_WRITE); 2469 (dir == READ ? ATA_CMD_FPDMA_READ : ATA_CMD_FPDMA_WRITE);
2457 *((unsigned int *) &fis->lba_low) = (start & 0xFFFFFF); 2470 fis->lba_low = start & 0xFF;
2458 *((unsigned int *) &fis->lba_low_ex) = ((start >> 24) & 0xFFFFFF); 2471 fis->lba_mid = (start >> 8) & 0xFF;
2472 fis->lba_hi = (start >> 16) & 0xFF;
2473 fis->lba_low_ex = (start >> 24) & 0xFF;
2474 fis->lba_mid_ex = (start >> 32) & 0xFF;
2475 fis->lba_hi_ex = (start >> 40) & 0xFF;
2459 fis->device = 1 << 6; 2476 fis->device = 1 << 6;
2460 fis->features = nsect & 0xFF; 2477 fis->features = nsect & 0xFF;
2461 fis->features_ex = (nsect >> 8) & 0xFF; 2478 fis->features_ex = (nsect >> 8) & 0xFF;
diff --git a/drivers/block/mtip32xx/mtip32xx.h b/drivers/block/mtip32xx/mtip32xx.h
index 18627a1d04c5..b1742640556a 100644
--- a/drivers/block/mtip32xx/mtip32xx.h
+++ b/drivers/block/mtip32xx/mtip32xx.h
@@ -33,6 +33,9 @@
33/* offset of Device Control register in PCIe extended capabilites space */ 33/* offset of Device Control register in PCIe extended capabilites space */
34#define PCIE_CONFIG_EXT_DEVICE_CONTROL_OFFSET 0x48 34#define PCIE_CONFIG_EXT_DEVICE_CONTROL_OFFSET 0x48
35 35
36/* check for erase mode support during secure erase */
37#define MTIP_SEC_ERASE_MODE 0x2
38
36/* # of times to retry timed out/failed IOs */ 39/* # of times to retry timed out/failed IOs */
37#define MTIP_MAX_RETRIES 2 40#define MTIP_MAX_RETRIES 2
38 41
@@ -152,14 +155,14 @@ enum {
152 MTIP_DDF_REBUILD_FAILED_BIT = 8, 155 MTIP_DDF_REBUILD_FAILED_BIT = 8,
153}; 156};
154 157
155__packed struct smart_attr{ 158struct smart_attr {
156 u8 attr_id; 159 u8 attr_id;
157 u16 flags; 160 u16 flags;
158 u8 cur; 161 u8 cur;
159 u8 worst; 162 u8 worst;
160 u32 data; 163 u32 data;
161 u8 res[3]; 164 u8 res[3];
162}; 165} __packed;
163 166
164/* Register Frame Information Structure (FIS), host to device. */ 167/* Register Frame Information Structure (FIS), host to device. */
165struct host_to_dev_fis { 168struct host_to_dev_fis {
diff --git a/drivers/block/xen-blkback/common.h b/drivers/block/xen-blkback/common.h
index 9ad3b5ec1dc1..9a54623e52d7 100644
--- a/drivers/block/xen-blkback/common.h
+++ b/drivers/block/xen-blkback/common.h
@@ -158,8 +158,8 @@ struct xen_vbd {
158 struct block_device *bdev; 158 struct block_device *bdev;
159 /* Cached size parameter. */ 159 /* Cached size parameter. */
160 sector_t size; 160 sector_t size;
161 bool flush_support; 161 unsigned int flush_support:1;
162 bool discard_secure; 162 unsigned int discard_secure:1;
163}; 163};
164 164
165struct backend_info; 165struct backend_info;
diff --git a/drivers/block/xen-blkback/xenbus.c b/drivers/block/xen-blkback/xenbus.c
index 4f66171c6683..f58434c2617c 100644
--- a/drivers/block/xen-blkback/xenbus.c
+++ b/drivers/block/xen-blkback/xenbus.c
@@ -105,11 +105,10 @@ static struct xen_blkif *xen_blkif_alloc(domid_t domid)
105{ 105{
106 struct xen_blkif *blkif; 106 struct xen_blkif *blkif;
107 107
108 blkif = kmem_cache_alloc(xen_blkif_cachep, GFP_KERNEL); 108 blkif = kmem_cache_zalloc(xen_blkif_cachep, GFP_KERNEL);
109 if (!blkif) 109 if (!blkif)
110 return ERR_PTR(-ENOMEM); 110 return ERR_PTR(-ENOMEM);
111 111
112 memset(blkif, 0, sizeof(*blkif));
113 blkif->domid = domid; 112 blkif->domid = domid;
114 spin_lock_init(&blkif->blk_ring_lock); 113 spin_lock_init(&blkif->blk_ring_lock);
115 atomic_set(&blkif->refcnt, 1); 114 atomic_set(&blkif->refcnt, 1);
@@ -196,7 +195,7 @@ static void xen_blkif_disconnect(struct xen_blkif *blkif)
196 } 195 }
197} 196}
198 197
199void xen_blkif_free(struct xen_blkif *blkif) 198static void xen_blkif_free(struct xen_blkif *blkif)
200{ 199{
201 if (!atomic_dec_and_test(&blkif->refcnt)) 200 if (!atomic_dec_and_test(&blkif->refcnt))
202 BUG(); 201 BUG();
@@ -257,7 +256,7 @@ static struct attribute_group xen_vbdstat_group = {
257VBD_SHOW(physical_device, "%x:%x\n", be->major, be->minor); 256VBD_SHOW(physical_device, "%x:%x\n", be->major, be->minor);
258VBD_SHOW(mode, "%s\n", be->mode); 257VBD_SHOW(mode, "%s\n", be->mode);
259 258
260int xenvbd_sysfs_addif(struct xenbus_device *dev) 259static int xenvbd_sysfs_addif(struct xenbus_device *dev)
261{ 260{
262 int error; 261 int error;
263 262
@@ -281,7 +280,7 @@ fail1: device_remove_file(&dev->dev, &dev_attr_physical_device);
281 return error; 280 return error;
282} 281}
283 282
284void xenvbd_sysfs_delif(struct xenbus_device *dev) 283static void xenvbd_sysfs_delif(struct xenbus_device *dev)
285{ 284{
286 sysfs_remove_group(&dev->dev.kobj, &xen_vbdstat_group); 285 sysfs_remove_group(&dev->dev.kobj, &xen_vbdstat_group);
287 device_remove_file(&dev->dev, &dev_attr_mode); 286 device_remove_file(&dev->dev, &dev_attr_mode);