pandora-kernel.git
16 years agoide: switch ide_cmd_ioctl() to use REQ_TYPE_ATA_TASKFILE requests
Bartlomiej Zolnierkiewicz [Sat, 26 Jan 2008 19:13:13 +0000 (20:13 +0100)]
ide: switch ide_cmd_ioctl() to use REQ_TYPE_ATA_TASKFILE requests

Based on the earlier work by Tejun Heo.

There should be no functionality changes caused by this patch.

Cc: Tejun Heo <htejun@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide: switch set_xfer_rate() to use REQ_TYPE_ATA_TASKFILE requests
Bartlomiej Zolnierkiewicz [Sat, 26 Jan 2008 19:13:12 +0000 (20:13 +0100)]
ide: switch set_xfer_rate() to use REQ_TYPE_ATA_TASKFILE requests

Based on the earlier work by Tejun Heo.

Switch set_xfer_rate() to use REQ_TYPE_ATA_TASKFILE requests
and make ide_wait_cmd() static.

There should be no functionality changes caused by this patch.

Cc: Tejun Heo <htejun@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide: fix final status check in drive_cmd_intr()
Bartlomiej Zolnierkiewicz [Sat, 26 Jan 2008 19:13:12 +0000 (20:13 +0100)]
ide: fix final status check in drive_cmd_intr()

Don't check for READY_STAT bit being set for PIO-in protocol (makes the
final status check in drive_cmd_intr() match the one in task_in_intr()).

Also fix function name reported by ide_error() call while at it.

Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide: check BUSY and ERROR status bits before reading data in drive_cmd_intr()
Bartlomiej Zolnierkiewicz [Sat, 26 Jan 2008 19:13:12 +0000 (20:13 +0100)]
ide: check BUSY and ERROR status bits before reading data in drive_cmd_intr()

Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide: don't enable local IRQs for PIO-in in driver_cmd_intr() (take 2)
Bartlomiej Zolnierkiewicz [Sat, 26 Jan 2008 19:13:12 +0000 (20:13 +0100)]
ide: don't enable local IRQs for PIO-in in driver_cmd_intr() (take 2)

Don't enable local IRQs for PIO-in protocol in driver_cmd_intr().

While at it:

* Remove redundant rq->cmd_type check.

* Read status register after enabling local IRQs for no-data protocol.

v2:
* Re-add DRQ=1 check lost in v1 (noticed by Sergei).

Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide: convert "empty" REQ_TYPE_ATA_CMD requests to use REQ_TYPE_ATA_TASKFILE
Bartlomiej Zolnierkiewicz [Sat, 26 Jan 2008 19:13:12 +0000 (20:13 +0100)]
ide: convert "empty" REQ_TYPE_ATA_CMD requests to use REQ_TYPE_ATA_TASKFILE

Based on the previous work by Tejun Heo.

There should be no functionality changes caused by this patch.

Cc: Tejun Heo <htejun@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide: initialize rq->cmd_type in ide_init_drive_cmd() callers
Bartlomiej Zolnierkiewicz [Sat, 26 Jan 2008 19:13:11 +0000 (20:13 +0100)]
ide: initialize rq->cmd_type in ide_init_drive_cmd() callers

* Initialize rq->cmd_type in ide_wait_cmd(), ide_cmd_ioctl() and
  set_pio_mode() (other callers were aleady over-riding rq->cmd_type).

* Remove no longer needed rq->cmd_type setup from ide_init_drive_cmd().

Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide: use wait_drive_not_busy() in drive_cmd_intr() (take 2)
Bartlomiej Zolnierkiewicz [Sat, 26 Jan 2008 19:13:11 +0000 (20:13 +0100)]
ide: use wait_drive_not_busy() in drive_cmd_intr() (take 2)

Use wait_drive_not_busy() in drive_cmd_intr().

v2:
* Fix wait_drive_not_busy() comment (noticed by Sergei).

Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide: kill DATA_READY define
Bartlomiej Zolnierkiewicz [Sat, 26 Jan 2008 19:13:11 +0000 (20:13 +0100)]
ide: kill DATA_READY define

Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide: task_end_request() fix
Tejun Heo [Sat, 26 Jan 2008 19:13:11 +0000 (20:13 +0100)]
ide: task_end_request() fix

task_end_request() modified to always call ide_end_drive_cmd()
for taskfile requests.  Previously, ide_end_drive_cmd() was
called only when IDE_TFLAG_FLAGGED was set.  Also,
ide_dma_intr() is modified to use task_end_request().

Enables TASKFILE ioctls to get valid register outputs on
successful completion.

Bart:
- ported it over recent IDE changes

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide: use rq->nr_sectors in task_end_request()
Bartlomiej Zolnierkiewicz [Sat, 26 Jan 2008 19:13:11 +0000 (20:13 +0100)]
ide: use rq->nr_sectors in task_end_request()

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide: remove needless ->cursg clearing from task_end_request()
Bartlomiej Zolnierkiewicz [Sat, 26 Jan 2008 19:13:11 +0000 (20:13 +0100)]
ide: remove needless ->cursg clearing from task_end_request()

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide: set IDE_TFLAG_IN_* flags before queuing/executing command
Bartlomiej Zolnierkiewicz [Sat, 26 Jan 2008 19:13:10 +0000 (20:13 +0100)]
ide: set IDE_TFLAG_IN_* flags before queuing/executing command

* Add IDE_TFLAG_{HOB,TF,DEVICE} defines.

* Set IDE_TFLAG_IN_* flags in {do_rw,ide_no_data,ide_raw}_taskfile() users.

* Remove no longer needed ->tf_flags setup from ide_end_drive_cmd().

There should be no functionality changes caused by this patch.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide-tape: fix handling of non-special requests in ->end_request method
Bartlomiej Zolnierkiewicz [Sat, 26 Jan 2008 19:13:10 +0000 (20:13 +0100)]
ide-tape: fix handling of non-special requests in ->end_request method

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide: fix final status check in task_in_intr()
Bartlomiej Zolnierkiewicz [Sat, 26 Jan 2008 19:13:10 +0000 (20:13 +0100)]
ide: fix final status check in task_in_intr()

Check for DRQ bit being cleared on the final status check.

Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide: clear HOB bit for REQ_TYPE_ATA_CMD requests in ide_end_drive_cmd()
Bartlomiej Zolnierkiewicz [Sat, 26 Jan 2008 19:13:10 +0000 (20:13 +0100)]
ide: clear HOB bit for REQ_TYPE_ATA_CMD requests in ide_end_drive_cmd()

ide_dump_status() may set HOB bit before ide_end_drive_cmd() is called.

Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide: fix ->io_32bit race in ide_taskfile_ioctl()
Tejun Heo [Sat, 26 Jan 2008 19:13:10 +0000 (20:13 +0100)]
ide: fix ->io_32bit race in ide_taskfile_ioctl()

In ide_taskfile_ioctl(), there was a race condition involving
drive->io_32bit.  It was cleared and restored during ioctl
requests but there was no synchronization with other requests.
So, other requests could execute with the altered ->io_32bit
setting or updated drive->io_32bit could be overwritten by
ide_taskfile_ioctl().

This patch adds IDE_TFLAG_IO_16BIT flag to indicate to
ide_pio_datablock() that 16-bit I/O is needed regardless of
drive->io_32bit settting.

Bart:
- ported it over recent IDE changes

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agocmd64x: remove /proc/ide/cmd64x
Bartlomiej Zolnierkiewicz [Sat, 26 Jan 2008 19:13:09 +0000 (20:13 +0100)]
cmd64x: remove /proc/ide/cmd64x

This belongs to user-space (and only if really needed).

   text    data     bss     dec     hex filename
   3874     180      28    4082     ff2 drivers/ide/pci/cmd64x.o.before
   2231     180       0    2411     96b drivers/ide/pci/cmd64x.o.after

Additionaly to being bloat the code reported incorrect UDMA modes for
the reserved values of UDIDETCR0/1 registers.

Also while at it remove unused CNTRL_DIS_RA0/1 defines.

Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide: remove broken disk byte-swapping support
Bartlomiej Zolnierkiewicz [Sat, 26 Jan 2008 19:13:09 +0000 (20:13 +0100)]
ide: remove broken disk byte-swapping support

Remove broken disk byte-swapping support:
- it can cause a data corruption on SMP (or if using PREEMPT on UP)
- all data coming from disk are byte-swapped by taskfile_*_data() which
  results in incorrect identify data being reported by /proc/ide/ and IOCTLs
- "hdx=bswap/byteswap" kernel parameter has been broken on m68k host drivers
  (including Atari/Q40 ones) since 2.5.x days (because of 'hwif' zero-ing)
- byte-swapping is limited to PIO transfers (for working with TiVo disks on
  x86 machines using user-space solutions or dm-byteswap should result in
  much better performance because DMA can be used)

For previous discussions please see:

http://www.ussg.iu.edu/hypermail/linux/kernel/0201.0/0768.html
http://lkml.org/lkml/2004/2/28/111

[ I have dm-byteswap device mapper target if somebody is interested
  (patch is for 2.6.4 though but I'll dust it off if needed). ]

Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide: add ide_busy_sleep() helper
Bartlomiej Zolnierkiewicz [Sat, 26 Jan 2008 19:13:09 +0000 (20:13 +0100)]
ide: add ide_busy_sleep() helper

Add ide_busy_sleep() helper and use it in do_probe(),
enable_nest() and probe_hwif().

As a nice side-effect this fixes a minor bug in do_probe()
(the code was reading status register without any delay).

Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide: make CONFIG_IDEPCI_PCIBUS_ORDER visible and deprecate it
Bartlomiej Zolnierkiewicz [Sat, 26 Jan 2008 19:13:09 +0000 (20:13 +0100)]
ide: make CONFIG_IDEPCI_PCIBUS_ORDER visible and deprecate it

Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide: move CONFIG_IDEPCI_PCIBUS_ORDER code to ide-scan-pci.c
Bartlomiej Zolnierkiewicz [Sat, 26 Jan 2008 19:13:09 +0000 (20:13 +0100)]
ide: move CONFIG_IDEPCI_PCIBUS_ORDER code to ide-scan-pci.c

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide: print banner message once per controller in m68k host drivers
Bartlomiej Zolnierkiewicz [Sat, 26 Jan 2008 19:13:09 +0000 (20:13 +0100)]
ide: print banner message once per controller in m68k host drivers

* Print banner message once per controller in m68k host drivers.

* Change printk() level to KERN_INFO in buddha, falconide and gayle.

* Add banner message to q40ide.

This is basically a preparation for the future IDE layer changes.

Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Roman Zippel <zippel@linux-m68k.org>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide: add ide_set_irq() inline helper
Bartlomiej Zolnierkiewicz [Sat, 26 Jan 2008 19:13:08 +0000 (20:13 +0100)]
ide: add ide_set_irq() inline helper

There should be no functionality changes caused by this patch.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide-pmac: use custom hwif->sg_max_nents only if DMA support is enabled
Bartlomiej Zolnierkiewicz [Sat, 26 Jan 2008 19:13:08 +0000 (20:13 +0100)]
ide-pmac: use custom hwif->sg_max_nents only if DMA support is enabled

Move setting hwif->sg_max_nents from pmac_ide_setup_device()
to pmac_ide_setup_dma().

Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agorapide: remove write-only hwif->hwif_data
Bartlomiej Zolnierkiewicz [Sat, 26 Jan 2008 19:13:08 +0000 (20:13 +0100)]
rapide: remove write-only hwif->hwif_data

Cc: Russell King <rmk@arm.linux.org.uk>
Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide: use ide_init_port_hw() in setup-pci.c
Bartlomiej Zolnierkiewicz [Sat, 26 Jan 2008 19:13:08 +0000 (20:13 +0100)]
ide: use ide_init_port_hw() in setup-pci.c

* Move setting hwif->gendev.parent from ide_pci_setup_ports()
  to ide_hwif_configure().

* Always set hwif->io_ports in ide_hwif_configure().

* Use ide_init_port_hw() in ide_hwif_configure().

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide: always use ide_std_init_ports() in setup-pci.c
Bartlomiej Zolnierkiewicz [Sat, 26 Jan 2008 19:13:08 +0000 (20:13 +0100)]
ide: always use ide_std_init_ports() in setup-pci.c

* ide_init_hwif_ports() call in setup-pci.c::ide_hwif_configure()
  doesn't depend on the default cotrol register offset, default IRQ
  or ppc_ide_md.ide_init_hwif implementations so ide_std_init_ports()
  can always be used.

* Since 'base' is always non-zero and thus hwif->io_ports[IDE_DATA_OFFSET]
  is also non-zero always clear hwif->noprobe.

Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoau1xxx-ide: use ide_init_port_hw()
Bartlomiej Zolnierkiewicz [Sat, 26 Jan 2008 19:13:08 +0000 (20:13 +0100)]
au1xxx-ide: use ide_init_port_hw()

Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoau1xxx-ide: au_ide_probe() fixes
Bartlomiej Zolnierkiewicz [Sat, 26 Jan 2008 19:13:07 +0000 (20:13 +0100)]
au1xxx-ide: au_ide_probe() fixes

* hwif->hold is always set in au_ide_probe() (few lines earlier),
  no need to set it again

* hwif->{channel,select_data,config_data} should be always zero

* autotune PIO also if CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA is defined

Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide: make remaining built-in only IDE host drivers modular (take 2)
Bartlomiej Zolnierkiewicz [Sat, 26 Jan 2008 19:13:07 +0000 (20:13 +0100)]
ide: make remaining built-in only IDE host drivers modular (take 2)

* Make remaining built-in only IDE host drivers modular, add ide-scan-pci.c
  file for probing PCI host drivers registered with IDE core (special case
  for built-in IDE and CONFIG_IDEPCI_PCIBUS_ORDER=y) and then take care of
  the ordering in which all IDE host drivers are probed when IDE is built-in
  during link time.

* Move probing of gayle, falconide, macide, q40ide and buddha (m68k arch
  specific) host drivers, before PCI ones (no PCI on m68k), ide-cris (cris
  arch specific), cmd640 (x86 arch specific) and pmac (ppc arch specific).

* Move probing of ide-cris (cris arch specific) host driver before cmd640
  (x86 arch specific).

* Move probing of mpc8xx (ppc specific) host driver before ide-pnp (depends
  on ISA and none of ppc platform that use mpc8xx supports ISA) and ide-h8300
  (h8300 arch specific).

* Add "probe_vlb" kernel parameter to cmd640 host driver and update
  Documentation/ide.txt accordingly.

* Make IDE_ARM config option visible so it can also be disabled if needed.

* Remove bogus comment from ide.c while at it.

v2:
* Fix two issues spotted by Sergei:
  - replace ENOMEM error value by ENOENT in ide-h8300 host driver
  - fix MODULE_PARM_DESC() in cmd640 host driver

Cc: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Cc: Mikael Starvik <starvik@axis.com>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Roman Zippel <zippel@linux-m68k.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide: fix host drivers depending on ide_generic to probe for interfaces (take 2)
Bartlomiej Zolnierkiewicz [Sat, 26 Jan 2008 19:13:06 +0000 (20:13 +0100)]
ide: fix host drivers depending on ide_generic to probe for interfaces (take 2)

* Add mpc8xx_ide_probe() to mpc8xx.c and call it from probe_for_hwifs().

* Convert ide_arm, ide-cris, ide-h8300, ide-pnp, buddha, falconide, gayle,
  macide, q40ide, cmd640 and mpc8xx host drivers to use ide_device_add().

  This removes dependency on ide_generic for these drivers so update
  ide/Kconfig accordingly.

v2:
* ide_arm build fix (s/ide_device_idx/ide_device_add/)
  (Thanks to Christoph Lameter <clameter@sgi.com> for reporting the problem).

Cc: Mikael Starvik <starvik@axis.com>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Roman Zippel <zippel@linux-m68k.org>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agocmd640: fix dependency on IDE_GENERIC
Bartlomiej Zolnierkiewicz [Sat, 26 Jan 2008 19:13:06 +0000 (20:13 +0100)]
cmd640: fix dependency on IDE_GENERIC

Make BLK_DEV_CMD640 select IDE_GENERIC.

Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide: move ide_arm_init() call from init_ide_data() to ide_init()
Bartlomiej Zolnierkiewicz [Sat, 26 Jan 2008 19:13:06 +0000 (20:13 +0100)]
ide: move ide_arm_init() call from init_ide_data() to ide_init()

* Remove ide_init_port_data() call from ide_arm_init() and move
  ide_arm_init() call from init_ide_data() to ide_init().

This patch is a preparation for the future changes (and as a side-effect
makes obsolete "idex=io[,ctl[,irq]]" kernel parameters work for ide_arm).

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide: drop 'initializing' argument from ide_register_hw()
Bartlomiej Zolnierkiewicz [Sat, 26 Jan 2008 19:13:06 +0000 (20:13 +0100)]
ide: drop 'initializing' argument from ide_register_hw()

* Rename init_hwif_data() to ide_init_port_data() and export it.

* For all users of ide_register_hw() with 'initializing' argument set
  hwif->present and hwif->hold are always zero so convert these host
  drivers to use ide_find_port()+ide_init_port_data()+ide_init_port_hw()
  instead (also no need for init_hwif_default() call since the setup
  done by it gets over-ridden by ide_init_port_hw() call).

* Drop 'initializing' argument from ide_register_hw().

Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Roman Zippel <zippel@linux-m68k.org>
Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide: add ide_init_port_hw() helper
Bartlomiej Zolnierkiewicz [Sat, 26 Jan 2008 19:13:05 +0000 (20:13 +0100)]
ide: add ide_init_port_hw() helper

* Add ide_init_port_hw() helper.

* rapide.c: convert rapide_locate_hwif() to rapide_setup_ports()
  and use ide_init_port_hw().

* ide_platform.c: convert plat_ide_locate_hwif() to plat_ide_setup_ports()
  and use ide_init_port_hw().

* sgiioc4.c: use ide_init_port_hw().

* pmac.c: add 'hw_regs_t *hw' argument to pmac_ide_setup_device(),
  setup 'hw' in pmac_ide_{macio,pci}_attach() and use ide_init_port_hw()
  in pmac_ide_setup_device().

This patch is a preparation for the future changes in the IDE probing code.

There should be no functionality changes caused by this patch.

Cc: Russell King <rmk@arm.linux.org.uk>
Cc: Anton Vorontsov <avorontsov@ru.mvista.com>
Cc: Jeremy Higdon <jeremy@sgi.com>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agosgiioc4: always init hwif->io_ports
Bartlomiej Zolnierkiewicz [Sat, 26 Jan 2008 19:13:05 +0000 (20:13 +0100)]
sgiioc4: always init hwif->io_ports

'if (hwif->io_ports[IDE_DATA_OFFSET] != cmd_base)' is always true.

Cc: Jeremy Higdon <jeremy@sgi.com>
Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide: Fix build break caused by "ide: remove ideprobe_init()"
Olof Johansson [Sat, 26 Jan 2008 19:13:05 +0000 (20:13 +0100)]
ide: Fix build break caused by "ide: remove ideprobe_init()"

Fix build break of powerpc holly_defconfig:

In file included from arch/powerpc/platforms/embedded6xx/holly.c:24:
include/linux/ide.h:1206: error: 'CONFIG_IDE_MAX_HWIFS' undeclared here (not in a function)

There's no need to have a sized array in the prototype, might as well
turn it into a pointer.

It could probably be argued that large parts of the include file can be
covered under #ifdef CONFIG_IDE, but that's a larger undertaking.

Signed-off-by: Olof Johansson <olof@lixom.net>
Cc: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide: remove ideprobe_init()
Bartlomiej Zolnierkiewicz [Sat, 26 Jan 2008 19:13:05 +0000 (20:13 +0100)]
ide: remove ideprobe_init()

* Rename ide_device_add() to ide_device_add_all() and make it accept
  'u8 idx[MAX_HWIFS]' instead of 'u8 idx[4]' as an argument.

* Add ide_device_add() wrapper for ide_device_add_all().

* Convert ide_generic_init() to use ide_device_add_all().

* Remove no longer needed ideprobe_init().

There should be no functionality changes caused by this patch.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide: add hwif->chipset fixup to ide_device_add()
Bartlomiej Zolnierkiewicz [Sat, 26 Jan 2008 19:13:04 +0000 (20:13 +0100)]
ide: add hwif->chipset fixup to ide_device_add()

Add hwif->chipset fixup identical to the one in ideprobe_init()
to ide_device_add().

Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoswarm: set hwif->chipset
Bartlomiej Zolnierkiewicz [Sat, 26 Jan 2008 19:13:04 +0000 (20:13 +0100)]
swarm: set hwif->chipset

hwif->chipset should be set if the hwif is claimed by host driver.

Cc: Maciej W. Rozycki <macro@linux-mips.org>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agorapide: set hwif->chipset
Bartlomiej Zolnierkiewicz [Sat, 26 Jan 2008 19:13:04 +0000 (20:13 +0100)]
rapide: set hwif->chipset

hwif->chipset should be set if the hwif is claimed by host driver.

Cc: Russell King <rmk@arm.linux.org.uk>
Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide: fix probing for hosts with serialized or IRQ sharing interfaces
Bartlomiej Zolnierkiewicz [Sat, 26 Jan 2008 19:13:04 +0000 (20:13 +0100)]
ide: fix probing for hosts with serialized or IRQ sharing interfaces

After hwif_register_devices() IDE devices are ready to be used so
the way in which ide_device_add() works currently is racy for hosts
with serialized / IRQ sharing interfaces.

Fix ide_device_add() by looping over interfaces for probe_hwif(),
hwif_init() and hwif_register_devices() operations.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide: kill probe_hwif_init()
Bartlomiej Zolnierkiewicz [Sat, 26 Jan 2008 19:13:04 +0000 (20:13 +0100)]
ide: kill probe_hwif_init()

There should be no functionality changes caused by this patch.

Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide: don't try to unregister interfaces if 'initializing' in ide_register_hw()
Bartlomiej Zolnierkiewicz [Sat, 26 Jan 2008 19:13:03 +0000 (20:13 +0100)]
ide: don't try to unregister interfaces if 'initializing' in ide_register_hw()

Host drivers using ide_register_hw() and 'initializing == 1':

* ide-pnp
  - depends on ISA

* ide_arm
  - ARM arch specific
  - initialized before all other host drivers

* ide-cris
  - CRIS arch specific => IDE_ARCH_OBSOLETE_INIT is not defined
  - broken

* ide-h8300
  - H8300 arch specific => IDE_ARCH_OBSOLETE_INIT is not defined, no PCI

* buddha/q40/gayle/macide/falconide
  - M68K arch specific => IDE_ARCH_OBSOLETE_INIT is not defined, no PCI

Since the only host drivers which probe interfaces before the above ones are:

* ali14xx/dtc2278/ht6560b/qd65xx/umc8672
  - depend on ISA
  - require IDE_ARCH_OBSOLETE_INIT=y to work

* PCI ones
  - depend on PCI

don't try to unregister interfaces if 'initializing == 1' in ide_register_hw()
(it is possible that built-in host drivers will claim all IDE interfaces but
later ide-pnp host driver will try to unregister them - this change fixes it).

Also skip hwif->hold check if 'initializing == 1' since it is set only by:

* pmac
  - PPC && PMAC specific => no ISA

* au1xxx-ide
  - MIPS && SOC_AU1200 specific => no ISA

and use ide_find_port() helper to find free ide_hwifs[] slot.

Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide: merge ->fixup and ->quirkproc methods
Bartlomiej Zolnierkiewicz [Sat, 26 Jan 2008 19:13:03 +0000 (20:13 +0100)]
ide: merge ->fixup and ->quirkproc methods

* Assign drive->quirk_list in ->quirkproc implementations:
  - hpt366.c::hpt3xx_quirkproc()
  - pdc202xx_new.c::pdcnew_quirkproc()
  - pdc202xx_old.c::pdc202xx_quirkproc()

* Make ->quirkproc void.

* Move calling ->quirkproc from do_identify() to probe_hwif().

* Convert it821x_fixups() to it821x_quirkproc() in it821x.c.

* Convert siimage_fixup() to sil_quirkproc() in siimage.c, also remove
  no longer needed drive->present check from is_dev_seagate_sata().

* Convert ide_undecoded_slave() to accept 'drive' instead of 'hwif'
  as an argument.  Then convert ide_register_hw() to accept 'quirkproc'
  argument instead of 'fixup' one.

* Remove no longer needed ->fixup method.

Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide: dump taskfile HOB registers in ide_tf_load() (if DEBUG is defined)
Bartlomiej Zolnierkiewicz [Sat, 26 Jan 2008 19:13:03 +0000 (20:13 +0100)]
ide: dump taskfile HOB registers in ide_tf_load() (if DEBUG is defined)

* Dump taskfile HOB registers in ide_tf_load() (if DEBUG is defined).

* Remove no longer needed DEBUG code from __ide_do_rw_disk().

Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide: merge ->dma_host_{on,off} methods into ->dma_host_set method
Bartlomiej Zolnierkiewicz [Sat, 26 Jan 2008 19:13:03 +0000 (20:13 +0100)]
ide: merge ->dma_host_{on,off} methods into ->dma_host_set method

Merge ->dma_host_{on,off} methods into ->dma_host_set method
which takes 'int on' argument.

There should be no functionality changes caused by this patch.

Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide: move drive->using_dma check to callers of ->dma_host_on method
Bartlomiej Zolnierkiewicz [Sat, 26 Jan 2008 19:13:02 +0000 (20:13 +0100)]
ide: move drive->using_dma check to callers of ->dma_host_on method

Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoatiixp: remove ->dma_host_on and ->dma_host_off methods
Bartlomiej Zolnierkiewicz [Sat, 26 Jan 2008 19:13:02 +0000 (20:13 +0100)]
atiixp: remove ->dma_host_on and ->dma_host_off methods

* Enable/disable UDMA in atiixp_set_dma_mode().

* Remove no longer needed atiixp_dma_host_{on,off}() and save_mdma_mode[].

* Bump driver version.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide-cris: fix DMA methods
Bartlomiej Zolnierkiewicz [Sat, 26 Jan 2008 19:13:01 +0000 (20:13 +0100)]
ide-cris: fix DMA methods

* Rename cris_dma_{on,off}() to cris_dma_host_{on,off}().

* Remove no longer needed ->dma_off_quietly
  (IDE core has the needed code now).

* Make cris_dma_host_on() void.

I left fixing ide-cris after "kill dma_on/dma_off_quietly() methods"
patch because:

* Currently this driver is broken: cris_dma_on() (returns 'int')
  is assigned to hwif->dma_host_on (returns 'void') so the driver
  won't build.

* ->ide_dma_on method was missing so the driver OOPS-es on attempt
  to enable DMA.

* drive->using_dma was never set/cleared so DMA wouldn't be used anyway.

Unfortunately it seems that ide-cris stays broken even after this patch:

* V10: <asm/arch-v10/ide.h> needs fixing
  - ide_init_default_hwifs() should be removed
    (IDE core no longer uses it)
  - same for ide_init_hwif_ports() and ide_default_{irq,io_base}()
    (they shouldn't be needed for ide-cris host driver)

* V32: I'm unable to find a place which defines ETRAX_ARCH_V32

but I'm leaving fixing this to CRIS gurus. :)

Cc: Mikael Starvik <starvik@axis.com>
Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide: remove ->ide_dma_on and ->dma_off_quietly methods from ide_hwif_t
Bartlomiej Zolnierkiewicz [Sat, 26 Jan 2008 19:13:01 +0000 (20:13 +0100)]
ide: remove ->ide_dma_on and ->dma_off_quietly methods from ide_hwif_t

* Make ide_dma_off_quietly() and __ide_dma_on() always available.

* Drop "__" prefix from __ide_dma_on().

* Check for presence of ->dma_host_on instead of ->ide_dma_on.

* Convert all users of ->ide_dma_on and ->dma_off_quietly methods
  to use ide_dma_on() and ide_dma_off_quietly() instead.

* Remove no longer needed ->ide_dma_on and ->dma_off_quietly methods
  from ide_hwif_t.

* Make ide_dma_on() void.

There should be no functionality changes caused by this patch.

Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoau1xxx-ide: add ide_toggle_bounce() calls
Bartlomiej Zolnierkiewicz [Sat, 26 Jan 2008 19:13:01 +0000 (20:13 +0100)]
au1xxx-ide: add ide_toggle_bounce() calls

Add ide_toggle_bounce() call to ->ide_dma_on/->dma_off_quietly
methods so they match generic __ide_dma_on()/ide_dma_off_quietly().

Since there is no PCI device there should be no functionality
changes caused by this patch.

Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoicside: add ide_toggle_bounce() calls
Bartlomiej Zolnierkiewicz [Sat, 26 Jan 2008 19:13:00 +0000 (20:13 +0100)]
icside: add ide_toggle_bounce() calls

Add ide_toggle_bounce() call to ->ide_dma_on/->dma_off_quietly
methods so they match generic __ide_dma_on()/ide_dma_off_quietly().

Since there is no PCI device there should be no functionality
changes caused by this patch.

Cc: Russell King <rmk@arm.linux.org.uk>
Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agosgiioc4: add ide_toggle_bounce() calls
Bartlomiej Zolnierkiewicz [Sat, 26 Jan 2008 19:13:00 +0000 (20:13 +0100)]
sgiioc4: add ide_toggle_bounce() calls

Add ide_toggle_bounce() call to ->ide_dma_on/->dma_off_quietly
methods so they match generic __ide_dma_on()/ide_dma_off_quietly().

Tested on Altix by Jeremy.

Acked-by: Jeremy Higdon <jeremy@sgi.com>
Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agocy82c693: add ->set_dma_mode method
Bartlomiej Zolnierkiewicz [Sat, 26 Jan 2008 19:13:00 +0000 (20:13 +0100)]
cy82c693: add ->set_dma_mode method

* Fix SWDMA/MWDMA masks in cy82c693_chipset.

* Add IDE_HFLAG_CY82C693 host flag and use it in ide_tune_dma() to
  check whether the DMA should be enabled even if ide_max_dma_mode()
  fails.

* Convert cy82c693_dma_enable() to become cy82c693_set_dma_mode()
  and remove no longer needed cy82c693_ide_dma_on().  Then set
  IDE_HFLAG_CY82C693 instead of IDE_HFLAG_TRUST_BIOS_FOR_DMA in
  cy82c693_chipset.

* Bump driver version.

As a result of this patch cy82c693 driver will configure and use DMA on
all SWDMA0-2 and MWDMA0-2 capable ATA devices instead of relying on BIOS.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agocy82c693: correct DMA modes clipping
Bartlomiej Zolnierkiewicz [Sat, 26 Jan 2008 19:13:00 +0000 (20:13 +0100)]
cy82c693: correct DMA modes clipping

* Mask device DMA masks by ATA_{S,M}WDMA2 in cy82c693_ide_dma_on().

* Remove clipping of DMA modes by id->tDMA in cy82c693_dma_enable():
  - id->tDMA may not be defined on newer devices
  - id->vendor6/id->tDMA word is in LE endianness
    (cy82c693 seems to be Alpha specific though)

* Bump driver version.

Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide: (hopefully) fix VDMA for CS5520
Bartlomiej Zolnierkiewicz [Sat, 26 Jan 2008 19:12:59 +0000 (20:12 +0100)]
ide: (hopefully) fix VDMA for CS5520

* Set the correct hwif->dma_base for the second channel in
  ide_get_or_set_dma_base().

* Remove DMA enable code from cs5520_set_pio_mode(), this can
  be handled by the generic ->dma_host_on method now.

* Add VDMA check to ide_config_drive_speed().

* drive->using_dma was never enabled since cs5520 host driver's
  ->ide_dma_on method overrided the generic ->ide_dma_on (so
  __ide_dma_on() was never called, drive->using_dma was never set
  and VDMA was never used since it depends on drive->using_dma).

  Fix it by using ->dma_host_on method instead of ->ide_dma_on
  (also add matching ->dma_host_off method).

Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide-disk: add idedisk_set_doorlock() helper
Bartlomiej Zolnierkiewicz [Sat, 26 Jan 2008 19:12:59 +0000 (20:12 +0100)]
ide-disk: add idedisk_set_doorlock() helper

There should be no functionality changes caused by this patch.

Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoserverworks: cleanup ->set_dma_mode method
Bartlomiej Zolnierkiewicz [Sat, 26 Jan 2008 19:12:59 +0000 (20:12 +0100)]
serverworks: cleanup ->set_dma_mode method

IDE core guarantees that ->set_dma_mode will be called only
for DMA modes set in SWDMA/MWDMA/UDMA masks.

There should be no functionality changes caused by this patch.

Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agosl82c105: remove no longer needed ->selectproc method
Bartlomiej Zolnierkiewicz [Sat, 26 Jan 2008 19:12:59 +0000 (20:12 +0100)]
sl82c105: remove no longer needed ->selectproc method

* Program register 0x40 in sl82c105_resetproc().

* Remove no longer needed sl82c105_selectproc() and pci_set_drvdata() calls.

Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agosl82c105: program DMA/PIO timings in ->dma_start/->ide_dma_end
Bartlomiej Zolnierkiewicz [Sat, 26 Jan 2008 19:12:58 +0000 (20:12 +0100)]
sl82c105: program DMA/PIO timings in ->dma_start/->ide_dma_end

* Program DMA timings in sl82c105_dma_start() (->dma_start method)
  before starting DMA transfer.

* Add sl82c105_dma_end() (->ide_dma_end method) to switch back to
  PIO timings when DMA transfer is complete.

* In sl82c105_set_pio_mode() program timings regardless of ->using_dma
  setting and in sl82c105_set_dma_mode() only cache the new timings.

* Remove no longer needed sl82c105_{ide_dma_on,off_quietly}().

Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoMerge git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6
Linus Torvalds [Sat, 26 Jan 2008 01:19:08 +0000 (17:19 -0800)]
Merge git://git./linux/kernel/git/jejb/scsi-misc-2.6

* git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6: (200 commits)
  [SCSI] usbstorage: use last_sector_bug flag universally
  [SCSI] libsas: abstract STP task status into a function
  [SCSI] ultrastor: clean up inline asm warnings
  [SCSI] aic7xxx: fix firmware build
  [SCSI] aacraid: fib context lock for management ioctls
  [SCSI] ch: remove forward declarations
  [SCSI] ch: fix device minor number management bug
  [SCSI] ch: handle class_device_create failure properly
  [SCSI] NCR5380: fix section mismatch
  [SCSI] sg: fix /proc/scsi/sg/devices when no SCSI devices
  [SCSI] IB/iSER: add logical unit reset support
  [SCSI] don't use __GFP_DMA for sense buffers if not required
  [SCSI] use dynamically allocated sense buffer
  [SCSI] scsi.h: add macro for enclosure bit of inquiry data
  [SCSI] sd: add fix for devices with last sector access problems
  [SCSI] fix pcmcia compile problem
  [SCSI] aacraid: add Voodoo Lite class of cards.
  [SCSI] aacraid: add new driver features flags
  [SCSI] qla2xxx: Update version number to 8.02.00-k7.
  [SCSI] qla2xxx: Issue correct MBC_INITIALIZE_FIRMWARE command.
  ...

16 years agoMerge git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6
Linus Torvalds [Sat, 26 Jan 2008 01:15:23 +0000 (17:15 -0800)]
Merge git://git./linux/kernel/git/herbert/crypto-2.6

* git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6:
  [CRYPTO] hifn795x: Disallow built-in hifn795x when HW_RANDOM is m

16 years agoMerge branch 'upstream-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mfashe...
Linus Torvalds [Sat, 26 Jan 2008 01:11:13 +0000 (17:11 -0800)]
Merge branch 'upstream-linus' of git://git./linux/kernel/git/mfasheh/ocfs2

* 'upstream-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mfasheh/ocfs2: (31 commits)
  ocfs2: clean up bh null checks
  ocfs2: document access rules for blocked_lock_list
  configfs: file.c fix possible recursive locking
  configfs: dir.c fix possible recursive locking
  configfs: Remove EXPERIMENTAL
  ocfs2: bump version number
  ocfs2/dlm: Clear joining_node on hearbeat node down
  ocfs2: convert byte order of constant instead of variable
  ocfs2: Update default cluster timeouts
  ocfs2: printf fixes
  ocfs2: Use generic_file_llseek
  ocfs2: Safer read_inline_data()
  ocfs2: Silence false lockdep warnings
  [PATCH 2/2] ocfs2: cluster aware flock()
  [PATCH 1/2] ocfs2: add flock lock type
  ocfs2: Local alloc window size changeable via mount option
  ocfs2: Support commit= mount option
  ocfs2: Add missing permission checks
  [PATCH 2/2] ocfs2: Implement group add for online resize
  [PATCH 1/2] ocfs2: Add group extend for online resize
  ...

16 years agoMerge branch 'upstream-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jgarzi...
Linus Torvalds [Sat, 26 Jan 2008 01:08:28 +0000 (17:08 -0800)]
Merge branch 'upstream-linus' of git://git./linux/kernel/git/jgarzik/libata-dev

* 'upstream-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jgarzik/libata-dev: (67 commits)
  fix drivers/ata/sata_fsl.c double-decl
  [libata] Prefer SCSI_SENSE_BUFFERSIZE to sizeof()
  pata_legacy: Merge winbond support
  ata_generic: Cenatek support
  pata_winbond: error return
  pata_serverworks: Fix cable types and cosmetics
  pata_mpc52xx: remove un-needed assignment
  libata: fix off-by-one in error categorization
  ahci: factor out AHCI enabling and enable AHCI before reading CAP
  ata_piix: implement SIDPR SCR access
  ata_piix: convert to prepare - activate initialization
  libata: factor out ata_pci_activate_sff_host() from ata_pci_one()
  [libata] Prefer SCSI_SENSE_BUFFERSIZE to sizeof()
  pata_legacy: resychronize with upstream changes and resubmit
  [libata] pata_legacy: typo fix
  [libata] pata_winbond: update for new ->data_xfer hook
  pata_pcmcia: convert to new data_xfer prototype
  libata annotations and fixes
  libata: use dev_driver_string() instead of "libata" in libata-sff.c
  ata_piix: kill unused constants and flags
  ...

16 years agoocfs2: clean up bh null checks
Mark Fasheh [Thu, 24 Jan 2008 02:35:31 +0000 (18:35 -0800)]
ocfs2: clean up bh null checks

If we know a buffer_head is non-null, then brelse() is unnecessary and
put_bh() can be used instead. Also, an explicit check for NULL is
unnecessary when using brelse(). This patch only covers buffer_head_io.c and
resize.c, which have recently added code which exhibits this problem.

Signed-off-by: Mark Fasheh <mark.fasheh@oracle.com>
16 years agoocfs2: document access rules for blocked_lock_list
Mark Fasheh [Thu, 24 Jan 2008 00:54:48 +0000 (16:54 -0800)]
ocfs2: document access rules for blocked_lock_list

ocfs2_super->blocked_lock_list and ocfs2_super->blocked_lock_count have some
usage restrictions which aren't immediately obvious to anyone reading the
code. It's a good idea to document this so that we avoid making costly
mistakes in the future.

Signed-off-by: Mark Fasheh <mark.fasheh@oracle.com>
16 years agoconfigfs: file.c fix possible recursive locking
Joonwoo Park [Wed, 26 Dec 2007 03:09:57 +0000 (12:09 +0900)]
configfs: file.c fix possible recursive locking

configfs_register_subsystem() with default_groups triggers recursive locking.
it seems that mutex_lock_nested is needed.

=============================================
[ INFO: possible recursive locking detected ]
2.6.24-rc6 #145
---------------------------------------------
swapper/1 is trying to acquire lock:
 (&sb->s_type->i_mutex_key#3){--..}, at: [<c40c9a9e>] configfs_add_file+0x2e/0x70

but task is already holding lock:
 (&sb->s_type->i_mutex_key#3){--..}, at: [<c40ca985>] configfs_register_subsystem+0x55/0x130

other info that might help us debug this:
1 lock held by swapper/1:
 #0:  (&sb->s_type->i_mutex_key#3){--..}, at: [<c40ca985>] configfs_register_subsystem+0x55/0x130

stack backtrace:
Pid: 1, comm: swapper Not tainted 2.6.24-rc6 #145
 [<c40053ba>] show_trace_log_lvl+0x1a/0x30
 [<c4005e82>] show_trace+0x12/0x20
 [<c400687e>] dump_stack+0x6e/0x80
 [<c404ec72>] __lock_acquire+0xe62/0x1120
 [<c404efb2>] lock_acquire+0x82/0xa0
 [<c43fda88>] mutex_lock_nested+0x98/0x2e0
 [<c40c9a9e>] configfs_add_file+0x2e/0x70
 [<c40c9b0c>] configfs_create_file+0x2c/0x40
 [<c40ca639>] configfs_attach_item+0x139/0x220
 [<c40ca734>] configfs_attach_group+0x14/0x140
 [<c40ca7e9>] configfs_attach_group+0xc9/0x140
 [<c40ca9f6>] configfs_register_subsystem+0xc6/0x130
 [<c45c8186>] init_netconsole+0x2b6/0x300
 [<c45a75f2>] kernel_init+0x142/0x320
 [<c4004fb3>] kernel_thread_helper+0x7/0x14
 =======================

Signed-off-by: Joonwoo Park <joonwpark81@gmail.com>
Signed-off-by: Joel Becker <joel.becker@oracle.com>
Signed-off-by: Mark Fasheh <mark.fasheh@oracle.com>
16 years agoconfigfs: dir.c fix possible recursive locking
Joonwoo Park [Wed, 26 Dec 2007 03:09:57 +0000 (12:09 +0900)]
configfs: dir.c fix possible recursive locking

configfs_register_subsystem() with default_groups triggers recursive locking.
it seems that mutex_lock_nested is needed.

=============================================
[ INFO: possible recursive locking detected ]
2.6.24-rc6 #141
---------------------------------------------
swapper/1 is trying to acquire lock:
 (&sb->s_type->i_mutex_key#3){--..}, at: [<c40ca76f>] configfs_attach_group+0x4f/0x190

but task is already holding lock:
 (&sb->s_type->i_mutex_key#3){--..}, at: [<c40ca9d5>] configfs_register_subsystem+0x55/0x130

other info that might help us debug this:
1 lock held by swapper/1:
 #0:  (&sb->s_type->i_mutex_key#3){--..}, at: [<c40ca9d5>] configfs_register_subsystem+0x55/0x130

stack backtrace:
Pid: 1, comm: swapper Not tainted 2.6.24-rc6 #141
 [<c40053ba>] show_trace_log_lvl+0x1a/0x30
 [<c4005e82>] show_trace+0x12/0x20
 [<c400687e>] dump_stack+0x6e/0x80
 [<c404ec72>] __lock_acquire+0xe62/0x1120
 [<c404efb2>] lock_acquire+0x82/0xa0
 [<c43fdad8>] mutex_lock_nested+0x98/0x2e0
 [<c40ca76f>] configfs_attach_group+0x4f/0x190
 [<c40caa46>] configfs_register_subsystem+0xc6/0x130
 [<c45c8186>] init_netconsole+0x2b6/0x300
 [<c45a75f2>] kernel_init+0x142/0x320
 [<c4004fb3>] kernel_thread_helper+0x7/0x14
 =======================

Signed-off-by: Joonwoo Park <joonwpark81@gmail.com>
Signed-off-by: Joel Becker <joel.becker@oracle.com>
Signed-off-by: Mark Fasheh <mark.fasheh@oracle.com>
16 years agoconfigfs: Remove EXPERIMENTAL
Joel Becker [Mon, 31 Dec 2007 21:56:47 +0000 (13:56 -0800)]
configfs: Remove EXPERIMENTAL

configfs has been alive and kicking for a while now.  It underpins some
non-EXPERIMENTAL subsystems, such as OCFS2's cluster stack.

Signed-off-by: Joel Becker <joel.becker@oracle.com>
Signed-off-by: Mark Fasheh <mark.fasheh@oracle.com>
16 years agoocfs2: bump version number
Mark Fasheh [Tue, 6 Nov 2007 23:52:58 +0000 (15:52 -0800)]
ocfs2: bump version number

Bump the printed version to 1.5.0. This helps us quickly identify which
version of Ocfs2 a bug filer is running.

Signed-off-by: Mark Fasheh <mark.fasheh@oracle.com>
16 years agoocfs2/dlm: Clear joining_node on hearbeat node down
Tao Ma [Thu, 10 Jan 2008 07:20:55 +0000 (15:20 +0800)]
ocfs2/dlm: Clear joining_node on hearbeat node down

Currently the process of dlm join contains 2 steps: query join and assert join.
After query join, the joined node will set its joining_node. So if the joining
node happens to panic before the 2nd step, the joined node will fail to clear
its joining_node flag because that node isn't in the domain map. It at least
cause 2 problems.
1. All the new join request will fail. So no new node can mount the volume.
2. The joined node can't umount the volume since during the umount process it
   has to wait for the joining_node to be unknown. So the umount will be hanged.

The solution is to clear the joining_node before we check the domain map.

Signed-off-by: Tao Ma <tao.ma@oracle.com>
Signed-off-by: Mark Fasheh <mark.fasheh@oracle.com>
16 years agoocfs2: convert byte order of constant instead of variable
Marcin Slusarz [Tue, 25 Dec 2007 14:52:59 +0000 (15:52 +0100)]
ocfs2: convert byte order of constant instead of variable

Convert byte order of constant instead of variable it will be done at
compile time vs run time. Remove unused le32_and_cpu.

Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>
Signed-off-by: Mark Fasheh <mark.fasheh@oracle.com>
16 years agoocfs2: Update default cluster timeouts
Sunil Mushran [Wed, 7 Nov 2007 00:10:23 +0000 (16:10 -0800)]
ocfs2: Update default cluster timeouts

Lots of people are having trouble with the default timeouts, which are too
low. These new values are derived from an informal survey taken on
ocfs2-users, as well as data from bug reports. This should reduce the amount
of cluster disconnects and subsequent fencing seen during normal workloads.

Signed-off-by: Sunil Mushran <sunil.mushran@oracle.com>
Signed-off-by: Mark Fasheh <mark.fasheh@oracle.com>
16 years agoocfs2: printf fixes
Jan Kara [Wed, 19 Dec 2007 14:25:42 +0000 (15:25 +0100)]
ocfs2: printf fixes

Explicitely convert loff_t to long long in printf. Just for sure...

Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Mark Fasheh <mark.fasheh@oracle.com>
16 years agoocfs2: Use generic_file_llseek
Jan Kara [Wed, 19 Dec 2007 14:24:52 +0000 (15:24 +0100)]
ocfs2: Use generic_file_llseek

We should use generic_file_llseek() and not default_llseek() so that
s_maxbytes gets properly checked when seeking.

Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Mark Fasheh <mark.fasheh@oracle.com>
16 years agoocfs2: Safer read_inline_data()
Jan Kara [Wed, 19 Dec 2007 14:24:09 +0000 (15:24 +0100)]
ocfs2: Safer read_inline_data()

In ocfs2_read_inline_data() we should store file size in loff_t. Although
the file size should fit in 32 bits we cannot be sure in case filesystem is
corrupted.

Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Mark Fasheh <mark.fasheh@oracle.com>
16 years agoocfs2: Silence false lockdep warnings
Jan Kara [Thu, 10 Jan 2008 23:11:45 +0000 (00:11 +0100)]
ocfs2: Silence false lockdep warnings

Create separate lockdep lock classes for system file's i_mutexes. They are
used to guard allocations and similar things and thus rank differently
than i_mutex of a regular file or directory.

Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Mark Fasheh <mark.fasheh@oracle.com>
16 years ago[PATCH 2/2] ocfs2: cluster aware flock()
Mark Fasheh [Fri, 21 Dec 2007 00:49:04 +0000 (16:49 -0800)]
[PATCH 2/2] ocfs2: cluster aware flock()

Hook up ocfs2_flock(), using the new flock lock type in dlmglue.c. A new
mount option, "localflocks" is added so that users can revert to old
functionality as need be.

Signed-off-by: Mark Fasheh <mark.fasheh@oracle.com>
16 years ago[PATCH 1/2] ocfs2: add flock lock type
Mark Fasheh [Fri, 21 Dec 2007 00:43:10 +0000 (16:43 -0800)]
[PATCH 1/2] ocfs2: add flock lock type

This adds a new dlmglue lock type which is intended to back flock()
requests.

Since these locks are driven from userspace, usage rules are much more
liberal than the typical Ocfs2 internal cluster lock. As a result, we can't
make use of most dlmglue features - lock caching and lock level
optimizations in particular. Additionally, userspace is free to deadlock
itself, so we have to deal with that in the same way as the rest of the
kernel - by allowing a signal to abort a lock request.

In order to keep ocfs2_cluster_lock() complexity down, ocfs2_file_lock()
does it's own dlm coordination. We still use the same helper functions
though, so duplicated code is kept to a minimum.

Signed-off-by: Mark Fasheh <mark.fasheh@oracle.com>
16 years agoocfs2: Local alloc window size changeable via mount option
Sunil Mushran [Thu, 20 Dec 2007 22:58:11 +0000 (14:58 -0800)]
ocfs2: Local alloc window size changeable via mount option

Local alloc is a performance optimization in ocfs2 in which a node
takes a window of bits from the global bitmap and then uses that for
all small local allocations. This window size is fixed to 8MB currently.
This patch allows users to specify the window size in MB including
disabling it by passing in 0. If the number specified is too large,
the fs will use the default value of 8MB.

mount -o localalloc=X /dev/sdX /mntpoint

Signed-off-by: Sunil Mushran <sunil.mushran@oracle.com>
Signed-off-by: Mark Fasheh <mark.fasheh@oracle.com>
16 years agoocfs2: Support commit= mount option
Mark Fasheh [Wed, 7 Nov 2007 22:40:36 +0000 (14:40 -0800)]
ocfs2: Support commit= mount option

Mostly taken from ext3. This allows the user to set the jbd commit interval,
in seconds. The default of 5 seconds stays the same, but now users can
easily increase the commit interval. Typically, this would be increased in
order to benefit performance at the expense of data-safety.

Signed-off-by: Mark Fasheh <mark.fasheh@oracle.com>
16 years agoocfs2: Add missing permission checks
Mark Fasheh [Wed, 19 Dec 2007 02:58:18 +0000 (18:58 -0800)]
ocfs2: Add missing permission checks

Check that an online resize is being driven by a user with permission to
change system resource limits.

Signed-off-by: Mark Fasheh <mark.fasheh@oracle.com>
16 years ago[PATCH 2/2] ocfs2: Implement group add for online resize
Tao Ma [Tue, 18 Dec 2007 07:47:25 +0000 (15:47 +0800)]
[PATCH 2/2] ocfs2: Implement group add for online resize

This patch adds the ability for a userspace program to request that a
properly formatted cluster group be added to the main allocation bitmap for
an Ocfs2 file system. The request is made via an ioctl, OCFS2_IOC_GROUP_ADD.
On a high level, this is similar to ext3, but we use a different ioctl as
the structure which has to be passed through is different.

During an online resize, tunefs.ocfs2 will format any new cluster groups
which must be added to complete the resize, and call OCFS2_IOC_GROUP_ADD on
each one. Kernel verifies that the core cluster group information is valid
and then does the work of linking it into the global allocation bitmap.

Signed-off-by: Tao Ma <tao.ma@oracle.com>
Signed-off-by: Mark Fasheh <mark.fasheh@oracle.com>
16 years ago[PATCH 1/2] ocfs2: Add group extend for online resize
Tao Ma [Tue, 18 Dec 2007 07:47:03 +0000 (15:47 +0800)]
[PATCH 1/2] ocfs2: Add group extend for online resize

This patch adds the ability for a userspace program to request an extend of
last cluster group on an Ocfs2 file system. The request is made via ioctl,
OCFS2_IOC_GROUP_EXTEND. This is derived from EXT3_IOC_GROUP_EXTEND, but is
obviously Ocfs2 specific.

tunefs.ocfs2 would call this for an online-resize operation if the last
cluster group isn't full.

Signed-off-by: Tao Ma <tao.ma@oracle.com>
Signed-off-by: Mark Fasheh <mark.fasheh@oracle.com>
16 years ago[SCSI] usbstorage: use last_sector_bug flag universally
Hans de Goede [Sun, 20 Jan 2008 10:27:29 +0000 (11:27 +0100)]
[SCSI] usbstorage: use last_sector_bug flag universally

This patch sets the last_sector_bug flag to 1 for all USB disks. This is
needed to makes the cardreader on various HP multifunction printers work.

Since the performance impact is negible we set this flag for all USB disks to
avoid an unusual_devs.h nightmare.

Signed-off-by: Hans de Goede <j.w.r.degoede@hhs.nl>
Acked-by: Matthew Dharm <mdharm-usb@one-eyed-alien.net>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
16 years agoocfs2: Reserve ioctl range
Tao Ma [Tue, 18 Dec 2007 07:46:37 +0000 (15:46 +0800)]
ocfs2: Reserve ioctl range

We need to reserve at least two ioctls for online-resize. Reserve a small
range of ioctls for Ocfs2 use in Documentation/ioctl-number.txt. This should
give us enough room for future growth.

Signed-off-by: Tao Ma <tao.ma@oracle.com>
Signed-off-by: Mark Fasheh <mark.fasheh@oracle.com>
16 years agoocfs2: Initalize bitmap_cpg of ocfs2_super to be the maximum.
Tao Ma [Tue, 18 Dec 2007 07:46:10 +0000 (15:46 +0800)]
ocfs2: Initalize bitmap_cpg of ocfs2_super to be the maximum.

This value is initialized from global_bitmap->id2.i_chain.cl_cpg. If there
is only 1 group, it will be equal to the total clusters in the volume. So
as for online resize, it should change for all the nodes in the cluster.
It isn't easy and there is no corresponding lock for it.

bitmap_cpg is only used in 2 areas:
1. Check whether the suballoc is too large for us to allocate from the global
   bitmap, so it is little used. And now the suballoc size is 2048, it rarely
   meet this situation and the check is almost useless.
2. Calculate which group a cluster belongs to. We use it during truncate to
   figure out which cluster group an extent belongs too. But we should be OK
   if we increase it though as the cluster group calculated shouldn't change
   and we only ever have a small bitmap_cpg on file systems with a single
   cluster group.

Signed-off-by: Tao Ma <tao.ma@oracle.com>
Signed-off-by: Mark Fasheh <mark.fasheh@oracle.com>
16 years ago[CRYPTO] hifn795x: Disallow built-in hifn795x when HW_RANDOM is m
Herbert Xu [Fri, 25 Jan 2008 22:48:44 +0000 (09:48 +1100)]
[CRYPTO] hifn795x: Disallow built-in hifn795x when HW_RANDOM is m

Currently it is possible to select HW_RANDOM as a module and have
hifn795x built-in.  This causes a build problem because hifn795x
will then call hwrng_register which isn't built-in.

This patch introduces a new config option to control the hifn795x
RNG which lets us avoid this problem.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
16 years agoocfs2: Documentation update
Mark Fasheh [Tue, 30 Oct 2007 19:09:03 +0000 (12:09 -0700)]
ocfs2: Documentation update

Remove 'readpages' from the list in ocfs2.txt. Instead of having two
identical lists, I just removed the list in the OCFS2 section of fs/Kconfig
and added a pointer to Documentation/filesystems/ocfs2.txt.

Signed-off-by: Mark Fasheh <mark.fasheh@oracle.com>
16 years agoocfs2: Readpages support
Mark Fasheh [Tue, 30 Oct 2007 19:08:32 +0000 (12:08 -0700)]
ocfs2: Readpages support

Add ->readpages support to Ocfs2. This is rather trivial - all it required
is a small update to ocfs2_get_block (for mapping full extents via b_size)
and an ocfs2_readpages() function which partially mirrors ocfs2_readpage().

Signed-off-by: Mark Fasheh <mark.fasheh@oracle.com>
16 years agodlm: Split lock mode and flag constants into a sharable header.
Joel Becker [Fri, 5 Oct 2007 21:31:44 +0000 (14:31 -0700)]
dlm: Split lock mode and flag constants into a sharable header.

This allows others to use the DLM constants without being tied to the
function API of fs/dlm.

Signed-off-by: Joel Becker <joel.becker@oracle.com>
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
Signed-off-by: David Teigland <teigland@redhat.com>
Signed-off-by: Mark Fasheh <mark.fasheh@oracle.com>
16 years agoocfs2: Rename ocfs2_meta_[un]lock
Mark Fasheh [Thu, 18 Oct 2007 22:30:42 +0000 (15:30 -0700)]
ocfs2: Rename ocfs2_meta_[un]lock

Call this the "inode_lock" now, since it covers both data and meta data.
This patch makes no functional changes.

Signed-off-by: Mark Fasheh <mark.fasheh@oracle.com>
16 years agoocfs2: Remove data locks
Mark Fasheh [Thu, 18 Oct 2007 22:23:46 +0000 (15:23 -0700)]
ocfs2: Remove data locks

The meta lock now covers both meta data and data, so this just removes the
now-redundant data lock.

Combining locks saves us a round of lock mastery per inode and one less lock
to ping between nodes during read/write.

We don't lose much - since meta locks were always held before a data lock
(and at the same level) ordered writeout mode (the default) ensured that
flushing for the meta data lock also pushed out data anyways.

Signed-off-by: Mark Fasheh <mark.fasheh@oracle.com>
16 years agoocfs2: Add data downconvert worker to inode lock
Mark Fasheh [Thu, 18 Oct 2007 22:13:59 +0000 (15:13 -0700)]
ocfs2: Add data downconvert worker to inode lock

In order to extend inode lock coverage to inode data, we use the same data
downconvert worker with only a small modification to only do work for
regular files.

Signed-off-by: Mark Fasheh <mark.fasheh@oracle.com>
16 years agoocfs2: Remove mount/unmount votes
Mark Fasheh [Mon, 24 Sep 2007 22:56:19 +0000 (15:56 -0700)]
ocfs2: Remove mount/unmount votes

The node maps that are set/unset by these votes are no longer relevant, thus
we can remove the mount and umount votes. Since those are the last two
remaining votes, we can also remove the entire vote infrastructure.

The vote thread has been renamed to the downconvert thread, and the small
amount of functionality related to managing it has been moved into
fs/ocfs2/dlmglue.c. All references to votes have been removed or updated.

Signed-off-by: Mark Fasheh <mark.fasheh@oracle.com>
16 years agoMerge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/roland...
Linus Torvalds [Fri, 25 Jan 2008 22:41:24 +0000 (14:41 -0800)]
Merge branch 'for-linus' of git://git./linux/kernel/git/roland/infiniband

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/roland/infiniband: (81 commits)
  RDMA/cxgb3: Fix the T3A workaround checks
  IB/ipath: Remove unnecessary cast
  IPoIB: Constify seq_operations function pointer tables
  RDMA/cxgb3: Mark QP as privileged based on user capabilities
  RDMA/cxgb3: Fix page shift calculation in build_phys_page_list()
  RDMA/cxgb3: Flush the receive queue when closing
  IB/ipath: Trivial simplification of ipath_make_ud_req()
  IB/mthca: Update latest "native Arbel" firmware revision
  IPoIB: Remove redundant check of netif_queue_stopped() in xmit handler
  IB/ipath: Add mappings from HW register to PortInfo port physical state
  IB/ipath: Changes to support PIO bandwidth check on IBA7220
  IB/ipath: Minor cleanup of unused fields and chip-specific errors
  IB/ipath: New sysfs entries to control 7220 features
  IB/ipath: Add new chip-specific functions to older chips, consistent init
  IB/ipath: Remove unused MDIO interface code
  IB/ehca: Prevent RDMA-related connection failures on some eHCA2 hardware
  IB/ehca: Add "port connection autodetect mode"
  IB/ehca: Define array to store SMI/GSI QPs
  IB/ehca: Remove CQ-QP-link before destroying QP in error path of create_qp()
  IB/iser: Add change_queue_depth method
  ...

16 years agoocfs2: Remove fs dependency on ocfs2_heartbeat module
Mark Fasheh [Mon, 24 Sep 2007 22:09:41 +0000 (15:09 -0700)]
ocfs2: Remove fs dependency on ocfs2_heartbeat module

Now that the dlm exposes domain information to us, we don't need generic
node up / node down callbacks. And since the DLM is only telling us when a
node goes down unexpectedly, we no longer need to optimize away node down
callbacks via the umount map.

Signed-off-by: Mark Fasheh <mark.fasheh@oracle.com>
16 years agoocfs2_dlm: Call node eviction callbacks from heartbeat handler
Mark Fasheh [Fri, 7 Sep 2007 18:11:10 +0000 (11:11 -0700)]
ocfs2_dlm: Call node eviction callbacks from heartbeat handler

With this, a dlm client can take advantage of the group protocol in the dlm
to get full notification whenever a node within the dlm domain leaves
unexpectedly.

Signed-off-by: Mark Fasheh <mark.fasheh@oracle.com>