Skip to contentSkip to conversation

IDE updates part 2

GIT PULL Bartlomiej Zolnierkiewicz 1 participant 1 message Jan 2, 2009

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

First IDE updates in 2009, this time:

* Fix IDE to not process commands in IRQ-context and than switch the subsystem to use per-device request queue locks instead of (ab)using hwgroup locks for this purpose. Besides being obvious IRQ-latency and scalability improvement this decreases complexity of core code greatly (~100 LOC of very tricky code gone) and makes maintainance work much easier.

[ Thanks to Elias Oltmanns for his work on reviewing these changes
and catching some issues early. ]

* Scheduled removal of deprecated ide-scsi device driver.

We've been discouraging using ide-scsi since early 2.5.x days as the driver contains unfixable problems with error handling and lifetimes of IDE/SCSI objects. There is now consensus between IDE/SCSI people that both (recently rewritten) native ide-{cd,gd,tape} drivers from IDE side and proper ATA-SCSI emulation (libata) from SCSI side offer a better alternative.

The driver has been officially orphaned for a year and then scheduled for removal for the last 4 months so this shouldn't come as surprise (I didn't got a single user complaint about this and ide-scsi has even been broken by some unrelated kernel changes for few kernel releases in the past without anybody noticing).

(from FUJITA Tomonori and Borislav Petkov)

* Fix multiple nested big stack usage in ide-floppy.c.

(from Linus himself, testing/merging handled by Borislav)

* Preparations to switch ide-cd device driver to use generic ATAPI code which will happen in the next IDE updates pull request.

(from Borislav)

* Misc fixups/cleanups.

All above changes have been in linux-next for some time now...

Linus, please pull from:

master.kernel.org:/pub/scm/linux/kernel/git/bart/ide-2.6.git/

to receive the following updates:

 Documentation/feature-removal-schedule.txt |    9 -
 MAINTAINERS                                |    5 -
 drivers/ide/Kconfig                        |   18 +-
 drivers/ide/Makefile                       |    2 +-
 drivers/ide/ide-atapi.c                    |  248 +++++----
 drivers/ide/ide-cd.c                       |   99 +---
 drivers/ide/ide-cd.h                       |   12 +-
 drivers/ide/ide-floppy.c                   |   28 +-
 drivers/ide/ide-floppy_ioctl.c             |   58 +-
 drivers/ide/ide-io.c                       |  282 +++-------
 drivers/ide/ide-ioctls.c                   |    3 +-
 drivers/ide/ide-park.c                     |   13 +-
 drivers/ide/ide-probe.c                    |  223 +++-----
 drivers/ide/ide-sysfs.c                    |  125 ++++
 drivers/ide/ide-tape.c                     |    2 +-
 drivers/ide/ide.c                          |   72 +---
 drivers/ide/tx4938ide.c                    |   11 +-
 drivers/ide/tx4939ide.c                    |   43 +-
 drivers/scsi/Kconfig                       |    8 +-
 drivers/scsi/Makefile                      |    1 -
 drivers/scsi/ide-scsi.c                    |  840 ----------------------------
 include/linux/ide.h                        |  121 +++--
 22 files changed, 614 insertions(+), 1609 deletions(-)
 create mode 100644 drivers/ide/ide-sysfs.c
 delete mode 100644 drivers/scsi/ide-scsi.c

Bartlomiej Zolnierkiewicz (10):
tx493x: fix indentation
ide: remove chipset type fixup from ide_host_register()
ide: small ide_register_port() cleanup
ide: factor out device type classifying from do_identify()
ide: move sysfs support to ide-sysfs.c
ide: don't execute the next queued command from the hard-IRQ context (v2)
ide: remove IDE PM hack from do_ide_request()
ide: remove "paranoia" checks for hwgroup->busy
ide: add ide_[un]lock_hwgroup() helpers
ide: use per-device request queue locks (v2)

Borislav Petkov (20):
ide-cd: move debug defines into header
ide: make IDE_AFLAG_.. numbering continuous again
ide-atapi: add a dev_is_idecd-inline
ide-atapi: combine drive-specific assignments
ide-atapi: setup dma for ide-cd
ide-atapi: accomodate transfer length calculation for ide-cd
ide-atapi: teach ide atapi about drive->waiting_for_dma
ide-cd: move cdrom_timer_expiry to ide-atapi.c
ide-atapi: remove ide-scsi remnants from ide_issue_pc
ide-atapi: remove ide-scsi remnants from ide_transfer_pc()
ide-atapi: remove ide-scsi remnants from ide_pc_intr()
ide: remove the last ide-scsi remnants
ide-atapi: compute cmd_len based on device type in ide_transfer_pc
ide-atapi: assign expiry and timeout based on device type
ide-atapi: split drive-specific functionality in ide_issue_pc
ide-cd: remove xferlen arg to cdrom_start_packet_command
ide-cd: remove handler wrappers
ide-atapi: remove timeout arg to ide_issue_pc
ide-atapi: put the rest of non-ide-cd code into the else-clause of ide_transfer_pc
ide-atapi: start dma in a drive-specific way

FUJITA Tomonori (1):
remove ide-scsi

Linus Torvalds (1):
ide-floppy: allocate only toplevel packet commands

Documentation/feature-removal-schedule.txt +0 -9
index dc7c681..df18d87 100644
@@ -310,15 +310,6 @@ Who:  Krzysztof Piotr Oledzki <[email protected]>
 
 ---------------------------
 
-What: ide-scsi (BLK_DEV_IDESCSI)
-When: 2.6.29
-Why:  The 2.6 kernel supports direct writing to ide CD drives, which
-      eliminates the need for ide-scsi. The new method is more
-      efficient in every way.
-Who:  FUJITA Tomonori <[email protected]>
-
----------------------------
-
 What:	i2c_attach_client(), i2c_detach_client(), i2c_driver->detach_client()
 When:	2.6.29 (ideally) or 2.6.30 (more likely)
 Why:	Deprecated by the new (standard) device driver binding model. Use
MAINTAINERS +0 -5
index ceb32ee..144766c 100644
@@ -2146,11 +2146,6 @@ M:	Gadi Oxman <[email protected]>
 L:	[email protected]
 S:	Maintained
 
-IDE-SCSI DRIVER
-L:	[email protected]
-L:	[email protected]
-S:	Orphan
-
 IDLE-I7300
 P:	Andy Henroid
 M:	[email protected]
drivers/ide/Kconfig +1 -17
index c9f21e3..4ee85fc 100644
@@ -137,6 +137,7 @@ config BLK_DEV_DELKIN
 
 config BLK_DEV_IDECD
 	tristate "Include IDE/ATAPI CDROM support"
+	select IDE_ATAPI
 	---help---
 	  If you have a CD-ROM drive using the ATAPI protocol, say Y. ATAPI is
 	  a newer protocol used by IDE CD-ROM and TAPE drives, similar to the
@@ -185,23 +186,6 @@ config BLK_DEV_IDETAPE
 	  To compile this driver as a module, choose M here: the
 	  module will be called ide-tape.
 
-config BLK_DEV_IDESCSI
-	tristate "SCSI emulation support (DEPRECATED)"
-	depends on SCSI
-	select IDE_ATAPI
-	---help---
-	  WARNING: ide-scsi is no longer needed for cd writing applications!
-	  The 2.6 kernel supports direct writing to ide-cd, which eliminates
-	  the need for ide-scsi + the entire scsi stack just for writing a
-	  cd. The new method is more efficient in every way.
-
-	  This will provide SCSI host adapter emulation for IDE ATAPI devices,
-	  and will allow you to use a SCSI device driver instead of a native
-	  ATAPI driver.
-
-	  If both this SCSI emulation and native ATAPI support are compiled
-	  into the kernel, the native support will be used.
-
 config BLK_DEV_IDEACPI
 	bool "IDE ACPI support"
 	depends on ACPI
drivers/ide/Makefile +1 -1
index 177e3f8..4107289 100644
@@ -5,7 +5,7 @@
 EXTRA_CFLAGS				+= -Idrivers/ide
 
 ide-core-y += ide.o ide-ioctls.o ide-io.o ide-iops.o ide-lib.o ide-probe.o \
-	      ide-taskfile.o ide-pm.o ide-park.o ide-pio-blacklist.o
+	      ide-taskfile.o ide-pm.o ide-park.o ide-pio-blacklist.o ide-sysfs.o
 
 # core IDE code
 ide-core-$(CONFIG_IDE_TIMINGS)		+= ide-timings.o
drivers/ide/ide-atapi.c +141 -107

383 lines not on this page · raw message

drivers/ide/ide-cd.c +16 -83

191 lines not on this page · raw message

drivers/ide/ide-cd.h +8 -4
index d5ce336..bf676b2 100644
@@ -8,10 +8,14 @@
 #include <linux/cdrom.h>
 #include <asm/byteorder.h>
 
-/*
- * typical timeout for packet command
- */
-#define ATAPI_WAIT_PC		(60 * HZ)
+#define IDECD_DEBUG_LOG		0
+
+#if IDECD_DEBUG_LOG
+#define ide_debug_log(lvl, fmt, args...) __ide_debug_log(lvl, fmt, args)
+#else
+#define ide_debug_log(lvl, fmt, args...) do {} while (0)
+#endif
+
 #define ATAPI_WAIT_WRITE_BUSY	(10 * HZ)
 
 /************************************************************************/
drivers/ide/ide-floppy.c +14 -14
index aeb1ad7..0a48e2d 100644
@@ -197,7 +197,7 @@ static ide_startstop_t idefloppy_issue_pc(ide_drive_t *drive,
 
 	pc->retries++;
 
-	return ide_issue_pc(drive, WAIT_FLOPPY_CMD, NULL);
+	return ide_issue_pc(drive);
 }
 
 void ide_floppy_create_read_capacity_cmd(struct ide_atapi_pc *pc)
@@ -342,38 +342,38 @@ static ide_startstop_t ide_floppy_do_request(ide_drive_t *drive,
  * Look at the flexible disk page parameters. We ignore the CHS capacity
  * parameters and use the LBA parameters instead.
  */
-static int ide_floppy_get_flexible_disk_page(ide_drive_t *drive)
+static int ide_floppy_get_flexible_disk_page(ide_drive_t *drive,
+					     struct ide_atapi_pc *pc)
 {
 	struct ide_disk_obj *floppy = drive->driver_data;
 	struct gendisk *disk = floppy->disk;
-	struct ide_atapi_pc pc;
 	u8 *page;
 	int capacity, lba_capacity;
 	u16 transfer_rate, sector_size, cyls, rpm;
 	u8 heads, sectors;
 
-	ide_floppy_create_mode_sense_cmd(&pc, IDEFLOPPY_FLEXIBLE_DISK_PAGE);
+	ide_floppy_create_mode_sense_cmd(pc, IDEFLOPPY_FLEXIBLE_DISK_PAGE);
 
-	if (ide_queue_pc_tail(drive, disk, &pc)) {
+	if (ide_queue_pc_tail(drive, disk, pc)) {
 		printk(KERN_ERR PFX "Can't get flexible disk page params\n");
 		return 1;
 	}
 
-	if (pc.buf[3] & 0x80)
+	if (pc->buf[3] & 0x80)
 		drive->dev_flags |= IDE_DFLAG_WP;
 	else
 		drive->dev_flags &= ~IDE_DFLAG_WP;
 
 	set_disk_ro(disk, !!(drive->dev_flags & IDE_DFLAG_WP));
 
-	page = &pc.buf[8];
+	page = &pc->buf[8];
 
-	transfer_rate = be16_to_cpup((__be16 *)&pc.buf[8 + 2]);
-	sector_size   = be16_to_cpup((__be16 *)&pc.buf[8 + 6]);
-	cyls          = be16_to_cpup((__be16 *)&pc.buf[8 + 8]);
-	rpm           = be16_to_cpup((__be16 *)&pc.buf[8 + 28]);
-	heads         = pc.buf[8 + 4];
-	sectors       = pc.buf[8 + 5];
+	transfer_rate = be16_to_cpup((__be16 *)&pc->buf[8 + 2]);
+	sector_size   = be16_to_cpup((__be16 *)&pc->buf[8 + 6]);
+	cyls          = be16_to_cpup((__be16 *)&pc->buf[8 + 8]);
+	rpm           = be16_to_cpup((__be16 *)&pc->buf[8 + 28]);
+	heads         = pc->buf[8 + 4];
+	sectors       = pc->buf[8 + 5];
 
 	capacity = cyls * heads * sectors * sector_size;
 
@@ -499,7 +499,7 @@ static int ide_floppy_get_capacity(ide_drive_t *drive)
 
 	/* Clik! disk does not support get_flexible_disk_page */
 	if (!(drive->atapi_flags & IDE_AFLAG_CLIK_DRIVE))
-		(void) ide_floppy_get_flexible_disk_page(drive);
+		(void) ide_floppy_get_flexible_disk_page(drive, &pc);
 
 	return rc;
 }
drivers/ide/ide-floppy_ioctl.c +30 -28

142 lines not on this page · raw message

drivers/ide/ide-io.c +85 -197

418 lines not on this page · raw message

drivers/ide/ide-ioctls.c +1 -2
index 28232c6..1be263e 100644
@@ -95,8 +95,7 @@ static int ide_set_nice_ioctl(ide_drive_t *drive, unsigned long arg)
 		return -EPERM;
 
 	if (((arg >> IDE_NICE_DSC_OVERLAP) & 1) &&
-	    (drive->media != ide_tape ||
-	     (drive->dev_flags & IDE_DFLAG_SCSI)))
+	    (drive->media != ide_tape))
 		return -EPERM;
 
 	if ((arg >> IDE_NICE_DSC_OVERLAP) & 1)
drivers/ide/ide-park.c +8 -5
index 63d01c5..678454a 100644
@@ -16,16 +16,19 @@ static void issue_park_cmd(ide_drive_t *drive, unsigned long timeout)
 	spin_lock_irq(&hwgroup->lock);
 	if (drive->dev_flags & IDE_DFLAG_PARKED) {
 		int reset_timer = time_before(timeout, drive->sleep);
+		int start_queue = 0;
 
 		drive->sleep = timeout;
 		wake_up_all(&ide_park_wq);
-		if (reset_timer && hwgroup->sleeping &&
-		    del_timer(&hwgroup->timer)) {
-			hwgroup->sleeping = 0;
-			hwgroup->busy = 0;
+		if (reset_timer && del_timer(&hwgroup->timer))
+			start_queue = 1;
+		spin_unlock_irq(&hwgroup->lock);
+
+		if (start_queue) {
+			spin_lock_irq(q->queue_lock);
 			blk_start_queueing(q);
+			spin_unlock_irq(q->queue_lock);
 		}
-		spin_unlock_irq(&hwgroup->lock);
 		return;
 	}
 	spin_unlock_irq(&hwgroup->lock);
drivers/ide/ide-probe.c +84 -139

285 lines not on this page · raw message

drivers/ide/ide-sysfs.c new file +125 -0

125 lines not on this page · raw message

drivers/ide/ide-tape.c +1 -1
index a2d470e..5d2aa22 100644
@@ -694,7 +694,7 @@ static ide_startstop_t idetape_issue_pc(ide_drive_t *drive,
 
 	pc->retries++;
 
-	return ide_issue_pc(drive, WAIT_TAPE_CMD, NULL);
+	return ide_issue_pc(drive);
 }
 
 /* A mode sense command is used to "sense" tape parameters. */
drivers/ide/ide.c +2 -70

83 lines not on this page · raw message

drivers/ide/tx4938ide.c +6 -5
index 13b63e7..b4ef218 100644
@@ -216,16 +216,17 @@ static const struct ide_tp_ops tx4938ide_tp_ops = {
 #endif	/* __BIG_ENDIAN */
 
 static const struct ide_port_ops tx4938ide_port_ops = {
-	.set_pio_mode = tx4938ide_set_pio_mode,
+	.set_pio_mode		= tx4938ide_set_pio_mode,
 };
 
 static const struct ide_port_info tx4938ide_port_info __initdata = {
-	.port_ops = &tx4938ide_port_ops,
+	.port_ops		= &tx4938ide_port_ops,
 #ifdef __BIG_ENDIAN
-	.tp_ops = &tx4938ide_tp_ops,
+	.tp_ops			= &tx4938ide_tp_ops,
 #endif
-	.host_flags = IDE_HFLAG_MMIO | IDE_HFLAG_NO_DMA,
-	.pio_mask = ATA_PIO5,
+	.host_flags		= IDE_HFLAG_MMIO | IDE_HFLAG_NO_DMA,
+	.pio_mask		= ATA_PIO5,
+	.chipset		= ide_generic,
 };
 
 static int __init tx4938ide_probe(struct platform_device *pdev)
drivers/ide/tx4939ide.c +22 -21

55 lines not on this page · raw message

drivers/scsi/Kconfig +4 -4
index 152d4aa..b732297 100644
@@ -21,7 +21,7 @@ config SCSI
 	  You also need to say Y here if you have a device which speaks
 	  the SCSI protocol.  Examples of this include the parallel port
 	  version of the IOMEGA ZIP drive, USB storage devices, Fibre
-	  Channel, FireWire storage and the IDE-SCSI emulation driver.
+	  Channel, and FireWire storage.
 
 	  To compile this driver as a module, choose M here and read
 	  <file:Documentation/scsi/scsi.txt>.
@@ -101,9 +101,9 @@ config CHR_DEV_OSST
 	---help---
 	  The OnStream SC-x0 SCSI tape drives cannot be driven by the
 	  standard st driver, but instead need this special osst driver and
-	  use the  /dev/osstX char device nodes (major 206).  Via usb-storage
-	  and ide-scsi, you may be able to drive the USB-x0 and DI-x0 drives
-	  as well.  Note that there is also a second generation of OnStream
+	  use the  /dev/osstX char device nodes (major 206).  Via usb-storage,
+	  you may be able to drive the USB-x0 and DI-x0 drives as well.
+	  Note that there is also a second generation of OnStream
 	  tape drives (ADR-x0) that supports the standard SCSI-2 commands for
 	  tapes (QIC-157) and can be driven by the standard driver st.
 	  For more information, you may have a look at the SCSI-HOWTO
drivers/scsi/Makefile +0 -1
index 1410697..7461eb0 100644
@@ -105,7 +105,6 @@ obj-$(CONFIG_SCSI_GDTH)		+= gdth.o
 obj-$(CONFIG_SCSI_INITIO)	+= initio.o
 obj-$(CONFIG_SCSI_INIA100)	+= a100u2w.o
 obj-$(CONFIG_SCSI_QLOGICPTI)	+= qlogicpti.o
-obj-$(CONFIG_BLK_DEV_IDESCSI)	+= ide-scsi.o
 obj-$(CONFIG_SCSI_MESH)		+= mesh.o
 obj-$(CONFIG_SCSI_MAC53C94)	+= mac53c94.o
 obj-$(CONFIG_BLK_DEV_3W_XXXX_RAID) += 3w-xxxx.o
drivers/scsi/ide-scsi.c deleted +0 -840

840 lines not on this page · raw message

include/linux/ide.h +65 -56

213 lines not on this page · raw message