10 years agoBlackfin: drop unused reserve_pda() function
Graf Yang [Mon, 25 May 2009 04:27:22 +0000]
Blackfin: drop unused reserve_pda() function

The Per-processor Data Area isn't actually reserved by this function, and
all it ended up doing was issuing a printk(), so punt it.

Signed-off-by: Graf Yang <graf.yang@analog.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>

10 years agoBlackfin: update gptimers API
Michael Hennerich [Mon, 4 May 2009 09:11:37 +0000]
Blackfin: update gptimers API

First we fix the prototypes for functions that return boolean values by
using "int" rather than "uint16_t".  Then we introduce a get_gptimer_run()
function for checking the current run status of a timer, and then we add a
disable_gptimers_sync() function which parallels disable_gptimers() with
corresponding normal "_sync" behavior.

Signed-off-by: Michael Hennerich <michael.hennerich@analog.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>

10 years agoBlackfin: include system/processor info in dump messages
Robin Getz [Wed, 20 May 2009 21:19:21 +0000]
Blackfin: include system/processor info in dump messages

People often copy & paste crash messages without surrounding context, so
include common useful information like system/processor stats in the crash
summary.  This should smooth over the report/test cycle a bit more.

Signed-off-by: Robin Getz <robin.getz@analog.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>

10 years agoBlackfin: add workaround for anomaly 05000461
Robin Getz [Mon, 11 May 2009 18:55:16 +0000]
Blackfin: add workaround for anomaly 05000461

Returning too fast with a bad RETI can trigger false errors.

Signed-off-by: Robin Getz <robin.getz@analog.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>

10 years agoBlackfin: make sure stack is accessible before dumping it
Robin Getz [Mon, 11 May 2009 18:34:41 +0000]
Blackfin: make sure stack is accessible before dumping it

When displaying a crash dump, make sure accessing the stack is safe so
we don't crash at the same time.

Signed-off-by: Robin Getz <robin.getz@analog.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>

10 years agoBlackfin: make deferred hardware errors more exact
Robin Getz [Mon, 18 May 2009 18:33:26 +0000]
Blackfin: make deferred hardware errors more exact

Hardware errors on the Blackfin architecture are queued by nature of the
hardware design.  Things that could generate a hardware level queue up at
the system interface and might not process until much later, at which
point the system would send a notification back to the core.

As such, it is possible for user space code to do something that would
trigger a hardware error, but have it delay long enough for the process
context to switch.  So when the hardware error does signal, we mistakenly
evaluate it as a different process or as kernel context and panic (erp!).
This makes it pretty difficult to find the offending context.  But wait,
there is good news somewhere.

By forcing a SSYNC in the interrupt entry, we force all pending queues at
the system level to be processed and all hardware errors to be signaled.
Then we check the current interrupt state to see if the hardware error is
now signaled.  If so, we re-queue the current interrupt and return thus
allowing the higher priority hardware error interrupt to process properly.
Since we haven't done any other context processing yet, the right context
will be selected and killed.  There is still the possibility that the
exact offending instruction will be unknown, but at least we'll have a
much better idea of where to look.

The downside of course is that this causes system-wide syncs at every
interrupt point which results in significant performance degradation.
Since this situation should not occur in any properly configured system
(as hardware errors are triggered by things like bad pointers), make it a
debug configuration option and disable it by default.

Signed-off-by: Robin Getz <robin.getz@analog.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>

10 years agoBlackfin: add note about anomaly 05000242 being worked around
Mike Frysinger [Fri, 24 Apr 2009 03:17:07 +0000]
Blackfin: add note about anomaly 05000242 being worked around

Document anomaly 05000242 workaround in source code.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>

10 years agoBlackfin: work around anomaly 05000220
Graf Yang [Thu, 7 May 2009 04:09:15 +0000]
Blackfin: work around anomaly 05000220

When possible, work around anomaly 05000220 (external memory is write
back cached, but L2 is not cached).  If not possible, detect the
conditions at build time and reject any qualifying configurations.

Signed-off-by: Graf Yang <graf.yang@analog.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>

10 years agoBlackfin: rename some Blackfin drivers
Mike Frysinger [Wed, 20 May 2009 14:05:36 +0000]
Blackfin: rename some Blackfin drivers

Try to keep the naming conventions consistent, so:
SPI_ADC_BF533 -> BFIN_SPI_ADC
TWI_LCD       -> BFIN_TWI_LCD

Signed-off-by: Mike Frysinger <vapier@gentoo.org>

10 years agoBlackfin: make sure MPU CPLB for first 1k is marked as valid
Robin Getz [Tue, 5 May 2009 17:14:39 +0000]
Blackfin: make sure MPU CPLB for first 1k is marked as valid

This way we properly catch and kill applications that jump to a NULL ptr.

Signed-off-by: Robin Getz <robin.getz@analog.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>

10 years agoBlackfin: add workaround for anomaly 05000287
Graf Yang [Fri, 8 May 2009 07:42:12 +0000]
Blackfin: add workaround for anomaly 05000287

Signed-off-by: Graf Yang <graf.yang@analog.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>

10 years agoBlackfin: add support for gptimer0 as a tick source
Graf Yang [Fri, 15 May 2009 11:01:59 +0000]
Blackfin: add support for gptimer0 as a tick source

For systems where the core cycles are not a usable tick source (like SMP
or cycles gets updated), enable gptimer0 as an alternative.

Signed-off-by: Graf Yang <graf.yang@analog.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>

10 years agoBlackfin: annotate anomaly 05000120
Graf Yang [Wed, 6 May 2009 10:38:07 +0000]
Blackfin: annotate anomaly 05000120

Add some notes for anomaly 05000120 to make sure we work around it.

Signed-off-by: Graf Yang <graf.yang@analog.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>

10 years agoBlackfin: BF518F-EZBRD: handle required portmuxing of async pins
Graf Yang [Wed, 20 May 2009 06:06:15 +0000]
Blackfin: BF518F-EZBRD: handle required portmuxing of async pins

The two high address lines on the BF51x are not dedicated which means we
need to handle them like any other peripheral pin if we want to access the
upper 2MB of parallel flash.

Signed-off-by: Graf Yang <graf.yang@analog.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>

10 years agoBlackfin: detect anomaly 05000274
Sonic Zhang [Thu, 7 May 2009 10:04:19 +0000]
Blackfin: detect anomaly 05000274

Detect and reject operating conditions for anomaly 05000274 since the
problem cannot be worked around in software.

Signed-off-by: Sonic Zhang <sonic.zhang@analog.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>

10 years agoBlackfin: do not append newlines to panic() messages
Mike Frysinger [Wed, 29 Apr 2009 06:26:46 +0000]
Blackfin: do not append newlines to panic() messages

The panic() function already handles newlines for us.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>

10 years agoBlackfin: workaround anomaly 05000227
Mike Frysinger [Fri, 24 Apr 2009 03:55:41 +0000]
Blackfin: workaround anomaly 05000227

Workaround anomaly 05000227 by only using the scratch pad for stack when
absolutely necessary.  The core code which reprograms clocks really only
touches MMRs directly with constants.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>

10 years agoBlackfin: delete unused sys_getpagesize() function
Mike Frysinger [Thu, 23 Apr 2009 17:04:10 +0000]
Blackfin: delete unused sys_getpagesize() function

Signed-off-by: Mike Frysinger <vapier@gentoo.org>

10 years agoBlackfin: work around anomaly 05000287
Graf Yang [Fri, 8 May 2009 07:42:12 +0000]
Blackfin: work around anomaly 05000287

Make sure we work around anomaly 05000287 by configuring different port
preferences for the data cache.

Signed-off-by: Graf Yang <graf.yang@analog.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>

10 years agoBlackfin: punt useless GPIO init call
Mike Frysinger [Fri, 24 Apr 2009 01:42:54 +0000]
Blackfin: punt useless GPIO init call

This init code existed only to dump a printk(), and not even a useful one.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>

10 years agoBlackfin: annotate anomaly 05000119 in core DMA code
Robin Getz [Thu, 23 Apr 2009 20:56:42 +0000]
Blackfin: annotate anomaly 05000119 in core DMA code

Add a reminder note to avoid the DMA_DONE bit in our DMA core code.

Signed-off-by: Robin Getz <robin.getz@analog.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>

10 years agoBlackfin: document anomaly 05000234 workaround
Robin Getz [Thu, 23 Apr 2009 14:15:04 +0000]
Blackfin: document anomaly 05000234 workaround

Note the reason for using CHIPD over DSPID.

Signed-off-by: Robin Getz <robin.getz@analog.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>

10 years agoBlackfin: fix early L1 relocation crash
Robin Getz [Thu, 23 Apr 2009 20:49:43 +0000]
Blackfin: fix early L1 relocation crash

Our early L1 relocate code may implicitly call code which lives in L1
memory.  This is due to the dma_memcpy() rewrite that made the DMA code
lockless and safe to be used by multiple processes.  If we start the
early DMA memcpy to relocate things into L1 instruction but then our
DMA memcpy code calls a function that lives in L1, things fall apart.
As such, create a small dedicated DMA memcpy routine that we can assume
sanity at boot time.

Reported-by: Filip Van Rillaer <filip.vanrillaer@oneaccess-net.com>
Signed-off-by: Robin Getz <robin.getz@analog.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>

10 years agoBlackfin: add MDMA defines to make cross-variant coding easier
Graf Yang [Wed, 6 May 2009 09:59:11 +0000]
Blackfin: add MDMA defines to make cross-variant coding easier

Add some defines to make the BF538/BF561 look like most other Blackfin
parts in that it has a MDMA0 channel available for low level init.

Signed-off-by: Graf Yang <graf.yang@analog.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>

10 years agoBlackfin: fix detection of cached L2 SRAM
Mike Frysinger [Tue, 19 May 2009 12:58:13 +0000]
Blackfin: fix detection of cached L2 SRAM

Make sure our bfin_addr_dcachable() function flags cached L2 SRAM properly
else memory easily goes unflushed when working with DMA.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>

10 years agoBlackfin: simplify BF561 coreb driver greatly
Mike Frysinger [Thu, 14 May 2009 14:55:50 +0000]
Blackfin: simplify BF561 coreb driver greatly

Since 90% of this driver can be handled in user space, move it to the
corebld user space application.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>

10 years agoBlackfin: update defconfigs
Sonic Zhang [Thu, 21 May 2009 06:39:46 +0000]
Blackfin: update defconfigs

Signed-off-by: Sonic Zhang <sonic.zhang@analog.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Bryan Wu <cooloney@kernel.org>

10 years agoBlackfin: simplify the do_flush macro
Mike Frysinger [Fri, 10 Apr 2009 21:20:19 +0000]
Blackfin: simplify the do_flush macro

Simplify the do_flush macro now that we don't need to take into account
a second instruction being used together.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Bryan Wu <cooloney@kernel.org>

10 years agoBlackfin: set bf51x/bf52x to 0.0 rev by default and bf54x to 0.2
Mike Frysinger [Mon, 13 Apr 2009 21:58:34 +0000]
Blackfin: set bf51x/bf52x to 0.0 rev by default and bf54x to 0.2

Update the default revs based on what we actually support (bf54x-0.[01]
is too broken to use).

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Bryan Wu <cooloney@kernel.org>

10 years agoBlackfin: do not error if GPIO IRQ is requested already as GPIO
Michael Hennerich [Thu, 16 Apr 2009 12:38:34 +0000]
Blackfin: do not error if GPIO IRQ is requested already as GPIO

Some drivers expect to be able to request both as GPIO and GPIO IRQ, so
allow that use case.

Signed-off-by: Michael Hennerich <michael.hennerich@analog.com>
Signed-off-by: Bryan Wu <cooloney@kernel.org>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>

10 years agoBlackfin: pull updated anomaly lists from toolchain
Mike Frysinger [Fri, 8 May 2009 07:40:25 +0000]
Blackfin: pull updated anomaly lists from toolchain

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Bryan Wu <cooloney@kernel.org>

10 years agoBlackfin: fix up PATA resource handling in bf537-stamp
Michael Hennerich [Tue, 21 Apr 2009 12:05:50 +0000]
Blackfin: fix up PATA resource handling in bf537-stamp

Make sure the addresses declared match reality, and make the PATA IRQ code
optional.

Signed-off-by: Michael Hennerich <michael.hennerich@analog.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Bryan Wu <cooloney@kernel.org>

10 years agoBlackfin: merge Philippe's recent ipipe patch
Philippe Gerum [Wed, 8 Apr 2009 07:41:55 +0000]
Blackfin: merge Philippe's recent ipipe patch

ipipe-2.6.28.9-blackfin-git95aafe6.patch

Singed-off-by: Philippe Gerum <rpm@xenomai.org>
Signed-off-by: Yi Li <yi.li@analog.com>
Signed-off-by: Bryan Wu <cooloney@kernel.org>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>

10 years agoBlackfin: fix warnings with I/O port macros
Mike Frysinger [Wed, 1 Apr 2009 12:25:58 +0000]
Blackfin: fix warnings with I/O port macros

The I/O port functions take ints, so we need to cast them up before
passing to our read/write funcs to avoid ugly messes of warnings.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Bryan Wu <cooloney@kernel.org>

10 years agoBlackfin: fix parentheses balance and convert some tab/space mixing
Mariusz Kozlowski [Sun, 12 Apr 2009 20:03:30 +0000]
Blackfin: fix parentheses balance and convert some tab/space mixing

Signed-off-by: Mariusz Kozlowski <m.kozlowski@tuxland.pl>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Bryan Wu <cooloney@kernel.org>

10 years agoBlackfin: fix bug found by traps test case 21
Graf Yang [Mon, 20 Apr 2009 09:20:58 +0000]
Blackfin: fix bug found by traps test case 21

The traps test case 21 "exception 0x3f: l1_instruction_access" would make
the kernel panic on BF533's because we end up calling show_stack()
infinitely.

Signed-off-by: Graf Yang <graf.yang@analog.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Bryan Wu <cooloney@kernel.org>

10 years agoBlackfin: fix data cache flushing when doing icache flushing
Mike Frysinger [Fri, 10 Apr 2009 20:52:08 +0000]
Blackfin: fix data cache flushing when doing icache flushing

Make sure we flush all data caches and their write buffers before flushing
icache, otherwise random edge cases could crop up where stale data is read
into icache from external memory.  As fallout, punt the combined icache +
dcache flush function since we cannot safely do them back to back -- the
SSYNC is needed between the dcache flush and the icache flush.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Bryan Wu <cooloney@kernel.org>

10 years agoBlackfin: fix link failure due to CONFIG_EXCEPTION_L1_SCRATCH
Graf Yang [Wed, 8 Apr 2009 08:30:22 +0000]
Blackfin: fix link failure due to CONFIG_EXCEPTION_L1_SCRATCH

Move exception stack mess from entry.S to init.c to fix link failure when
CONFIG_EXCEPTION_L1_SCRATCH is in use.

Signed-off-by: Graf Yang <graf.yang@analog.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Bryan Wu <cooloney@kernel.org>

10 years agoBlackfin: allow scheduler functions to be placed into L1
Robin Getz [Tue, 31 Mar 2009 13:40:52 +0000]
Blackfin: allow scheduler functions to be placed into L1

Signed-off-by: Robin Getz <rgetz@blackfin.uclinux.org>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Bryan Wu <cooloney@kernel.org>

10 years agoBlackfin: Allow bf548 ATAPI to be routed to GPIO
Sonic Zhang [Mon, 30 Mar 2009 09:07:26 +0000]
Blackfin: Allow bf548 ATAPI to be routed to GPIO

By default, it is routed to async memory address. In GPIO case,
GPIO peripheral PINs should be requested in advance.

Signed-off-by: Sonic Zhang <sonic.zhang@analog.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Bryan Wu <cooloney@kernel.org>

10 years agoBlackfin: bf527-ezkit: add support for mmc-spi
Yi Li [Tue, 31 Mar 2009 10:36:51 +0000]
Blackfin: bf527-ezkit: add support for mmc-spi

Signed-off-by: Yi Li <yi.li@analog.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Bryan Wu <cooloney@kernel.org>

10 years agoBlackfin: add some help text to the EBIU_AMBCTL settings
Mike Frysinger [Tue, 31 Mar 2009 00:18:35 +0000]
Blackfin: add some help text to the EBIU_AMBCTL settings

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Bryan Wu <cooloney@kernel.org>

10 years agoBlackfin: add comment for anomaly 05000171 to init code
Michael Hennerich [Wed, 15 Apr 2009 08:48:08 +0000]
Blackfin: add comment for anomaly 05000171 to init code

Signed-off-by: Michael Hennerich <michael.hennerich@analog.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Bryan Wu <cooloney@kernel.org>

10 years agoblock: fix kernel-doc in recent block/ changes
Randy Dunlap [Fri, 12 Jun 2009 03:00:41 +0000]
block: fix kernel-doc in recent block/ changes

Fix kernel-doc warnings in recently changed block/ source code.

Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

10 years agoMerge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs-2.6
Linus Torvalds [Fri, 12 Jun 2009 03:05:37 +0000]
Merge branch 'for-linus' of git://git./linux/kernel/git/viro/vfs-2.6

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs-2.6: (87 commits)
  nilfs2: get rid of bd_mount_sem use from nilfs
  nilfs2: correct exclusion control in nilfs_remount function
  nilfs2: simplify remaining sget() use
  nilfs2: get rid of sget use for checking if current mount is present
  nilfs2: get rid of sget use for acquiring nilfs object
  nilfs2: remove meaningless EBUSY case from nilfs_get_sb function
  remove the call to ->write_super in __sync_filesystem
  nilfs2: call nilfs2_write_super from nilfs2_sync_fs
  jffs2: call jffs2_write_super from jffs2_sync_fs
  ufs: add ->sync_fs
  sysv: add ->sync_fs
  hfsplus: add ->sync_fs
  hfs: add ->sync_fs
  fat: add ->sync_fs
  ext2: add ->sync_fs
  exofs: add ->sync_fs
  bfs: add ->sync_fs
  affs: add ->sync_fs
  sanitize ->fsync() for affs
  repair bfs_write_inode(), switch bfs to simple_fsync()
  ...

10 years agoMerge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/gerg/m68knommu
Linus Torvalds [Fri, 12 Jun 2009 03:05:08 +0000]
Merge branch 'for-linus' of git://git./linux/kernel/git/gerg/m68knommu

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/gerg/m68knommu:
  m68knommu: remove unecessary include of thread_info.h in entry.S
  m68knommu: enumerate INIT_THREAD fields properly
  headers_check fix: m68k, swab.h
  arch/m68knommu: Convert #ifdef DEBUG printk(KERN_DEBUG to pr_debug(
  m68knommu: remove obsolete reset code
  m68knommu: move CPU reset code for the 5272 ColdFire into its platform code
  m68knommu: move CPU reset code for the 528x ColdFire into its platform code
  m68knommu: move CPU reset code for the 527x ColdFire into its platform code
  m68knommu: move CPU reset code for the 523x ColdFire into its platform code
  m68knommu: move CPU reset code for the 520x ColdFire into its platform code
  m68knommu: add CPU reset code for the 532x ColdFire
  m68knommu: add CPU reset code for the 5249 ColdFire
  m68knommu: add CPU reset code for the 5206e ColdFire
  m68knommu: add CPU reset code for the 5206 ColdFire
  m68knommu: add CPU reset code for the 5407 ColdFire
  m68knommu: add CPU reset code for the 5307 ColdFire
  m68knommu: merge system reset for code ColdFire 523x family
  m68knommu: fix system reset for ColdFire 527x family

10 years agokvm: remove the duplicated cpumask_clear
Yinghai Lu [Thu, 11 Jun 2009 22:09:00 +0000]
kvm: remove the duplicated cpumask_clear

zalloc_cpumask_var already cleared it.

Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

10 years agox86: use zalloc_cpumask_var in arch_early_irq_init
Yinghai Lu [Thu, 11 Jun 2009 22:07:48 +0000]
x86: use zalloc_cpumask_var in arch_early_irq_init

So we make sure MAXSMP gets a cleared cpumask

Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

10 years agoperfcounters: remove powerpc definitions of perf_counter_do_pending
Stephen Rothwell [Fri, 12 Jun 2009 00:14:22 +0000]
perfcounters: remove powerpc definitions of perf_counter_do_pending

Commit 925d519ab82b6dd7aca9420d809ee83819c08db2 ("perf_counter:
unify and fix delayed counter wakeup") added global definitions.

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Acked-by: Paul Mackerras <paulus@samba.org>
Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

10 years agonilfs2: get rid of bd_mount_sem use from nilfs
Ryusuke Konishi [Sun, 7 Jun 2009 16:39:33 +0000]
nilfs2: get rid of bd_mount_sem use from nilfs

This will remove every bd_mount_sem use in nilfs.

The intended exclusion control was replaced by the previous patch
("nilfs2: correct exclusion control in nilfs_remount function") for
nilfs_remount(), and this patch will replace remains with a new mutex
that this inserts in nilfs object.

Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
Cc: Christoph Hellwig <hch@infradead.org>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

10 years agonilfs2: correct exclusion control in nilfs_remount function
Ryusuke Konishi [Sun, 7 Jun 2009 16:39:32 +0000]
nilfs2: correct exclusion control in nilfs_remount function

nilfs_remount() changes mount state of a superblock instance.  Even
though nilfs accesses other superblock instances during mount or
remount, the mount state was not properly protected in
nilfs_remount().

Moreover, nilfs_remount() has a lock order reversal problem;
nilfs_get_sb() holds:

  1. bdev->bd_mount_sem
  2. sb->s_umount  (sget acquires)

and nilfs_remount() holds:

  1. sb->s_umount  (locked by the caller in vfs)
  2. bdev->bd_mount_sem

To avoid these problems, this patch divides a semaphore protecting
super block instances from nilfs->ns_sem, and applies it to the mount
state protection in nilfs_remount().

With this change, bd_mount_sem use is removed from nilfs_remount() and
the lock order reversal will be resolved.  And the new rw-semaphore,
nilfs->ns_super_sem will properly protect the mount state except the
modification from nilfs_error function.

Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

10 years agonilfs2: simplify remaining sget() use
Ryusuke Konishi [Sun, 7 Jun 2009 16:39:31 +0000]
nilfs2: simplify remaining sget() use

This simplifies the test function passed on the remaining sget()
callsite in nilfs.

Instead of checking mount type (i.e. ro-mount/rw-mount/snapshot mount)
in the test function passed to sget(), this patch first looks up the
nilfs_sb_info struct which the given mount type matches, and then
acquires the super block instance holding the nilfs_sb_info.

Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

10 years agonilfs2: get rid of sget use for checking if current mount is present
Ryusuke Konishi [Sun, 7 Jun 2009 16:39:30 +0000]
nilfs2: get rid of sget use for checking if current mount is present

This stops using sget() for checking if an r/w-mount or an r/o-mount
exists on the device.  This elimination uses a back pointer to the
current mount added to nilfs object.

Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

10 years agonilfs2: get rid of sget use for acquiring nilfs object
Ryusuke Konishi [Sun, 7 Jun 2009 16:39:29 +0000]
nilfs2: get rid of sget use for acquiring nilfs object

This will change the way to obtain nilfs object in nilfs_get_sb()
function.

Previously, a preliminary sget() call was performed, and the nilfs
object was acquired from a super block instance found by the sget()
call.

This patch, instead, instroduces a new dedicated function
find_or_create_nilfs(); as the name implies, the function finds an
existent nilfs object from a global list or creates a new one if no
object is found on the device.

Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

10 years agonilfs2: remove meaningless EBUSY case from nilfs_get_sb function
Ryusuke Konishi [Sun, 7 Jun 2009 16:39:28 +0000]
nilfs2: remove meaningless EBUSY case from nilfs_get_sb function

The following EBUSY case in nilfs_get_sb() is meaningless.  Indeed,
this error code is never returned to the caller.

    if (!s->s_root) {
          ...
    } else if (!(s->s_flags & MS_RDONLY)) {
        err = -EBUSY;
    }

This simply removes the else case.

Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

10 years agoremove the call to ->write_super in __sync_filesystem
Christoph Hellwig [Mon, 8 Jun 2009 08:08:54 +0000]
remove the call to ->write_super in __sync_filesystem

Now that all filesystems provide ->sync_fs methods we can change
__sync_filesystem to only call ->sync_fs.

This gives us a clear separation between periodic writeouts which
are driven by ->write_super and data integrity syncs that go
through ->sync_fs. (modulo file_fsync which is also going away)

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

10 years agonilfs2: call nilfs2_write_super from nilfs2_sync_fs
Christoph Hellwig [Mon, 8 Jun 2009 08:08:36 +0000]
nilfs2: call nilfs2_write_super from nilfs2_sync_fs

The call to ->write_super from __sync_filesystem will go away, so make
sure nilfs2 performs the same actions from inside ->sync_fs.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

10 years agojffs2: call jffs2_write_super from jffs2_sync_fs
Christoph Hellwig [Mon, 8 Jun 2009 08:08:21 +0000]
jffs2: call jffs2_write_super from jffs2_sync_fs

The call to ->write_super from __sync_filesystem will go away, so make
sure jffs2 performs the same actions from inside ->sync_fs.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

10 years agoufs: add ->sync_fs
Christoph Hellwig [Mon, 8 Jun 2009 08:08:05 +0000]
ufs: add ->sync_fs

Add a ->sync_fs method for data integrity syncs, and reimplement
->write_super ontop of it.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

10 years agosysv: add ->sync_fs
Christoph Hellwig [Mon, 8 Jun 2009 08:07:45 +0000]
sysv: add ->sync_fs

Add a ->sync_fs method for data integrity syncs, and reimplement
->write_super ontop of it.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

10 years agohfsplus: add ->sync_fs
Christoph Hellwig [Mon, 8 Jun 2009 08:05:12 +0000]
hfsplus: add ->sync_fs

Add a ->sync_fs method for data integrity syncs, and reimplement
->write_super ontop of it.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

10 years agohfs: add ->sync_fs
Christoph Hellwig [Mon, 8 Jun 2009 08:04:54 +0000]
hfs: add ->sync_fs

Add a ->sync_fs method for data integrity syncs.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

10 years agofat: add ->sync_fs
Christoph Hellwig [Mon, 8 Jun 2009 08:04:35 +0000]
fat: add ->sync_fs

Add a ->sync_fs method for data integrity syncs.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

10 years agoext2: add ->sync_fs
Christoph Hellwig [Mon, 8 Jun 2009 08:04:17 +0000]
ext2: add ->sync_fs

Add a ->sync_fs method for data integrity syncs, and reimplement
->write_super ontop of it.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

10 years agoexofs: add ->sync_fs
Christoph Hellwig [Mon, 8 Jun 2009 08:03:58 +0000]
exofs: add ->sync_fs

Add a ->sync_fs method for data integrity syncs, and reimplement
->write_super ontop of it.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

10 years agobfs: add ->sync_fs
Christoph Hellwig [Mon, 8 Jun 2009 08:03:38 +0000]
bfs: add ->sync_fs

Add a ->sync_fs method for data integrity syncs, and reimplement
->write_super ontop of it.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

10 years agoaffs: add ->sync_fs
Christoph Hellwig [Mon, 8 Jun 2009 08:03:15 +0000]
affs: add ->sync_fs

Add a ->sync_fs method for data integrity syncs.  Factor out common code
between affs_put_super, affs_write_super and the new affs_sync_fs into
a helper.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

10 years agosanitize ->fsync() for affs
Al Viro [Mon, 8 Jun 2009 05:22:00 +0000]
sanitize ->fsync() for affs

unfortunately, for affs (especially for affs directories) we have
no real way to keep track of metadata ownership.  So we have to
do more or less what file_fsync() does, but we do *not* need to
call write_super() there.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

10 years agorepair bfs_write_inode(), switch bfs to simple_fsync()
Al Viro [Mon, 8 Jun 2009 05:15:58 +0000]
repair bfs_write_inode(), switch bfs to simple_fsync()

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

10 years agoFix adfs GET_FRAG_ID() on big-endian
Al Viro [Mon, 8 Jun 2009 04:46:40 +0000]
Fix adfs GET_FRAG_ID() on big-endian

Missing conversion to host-endian before doing shifts

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

10 years agorepair adfs ->write_inode(), switch to simple_fsync()
Al Viro [Mon, 8 Jun 2009 04:44:42 +0000]
repair adfs ->write_inode(), switch to simple_fsync()

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

10 years agoswitch omfs to simple_fsync()
Al Viro [Sun, 7 Jun 2009 19:44:50 +0000]
switch omfs to simple_fsync()

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

10 years agoswitch udf to simple_fsync()
Al Viro [Sun, 7 Jun 2009 19:40:27 +0000]
switch udf to simple_fsync()

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

10 years agoswitch ufs to simple_fsync()
Al Viro [Sun, 7 Jun 2009 19:35:18 +0000]
switch ufs to simple_fsync()

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

10 years agorepair sysv_write_inode(), switch sysv to simple_fsync()
Al Viro [Sun, 7 Jun 2009 19:29:45 +0000]
repair sysv_write_inode(), switch sysv to simple_fsync()

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

10 years agoswitch minix to simple_fsync()
Al Viro [Sun, 7 Jun 2009 19:21:06 +0000]
switch minix to simple_fsync()

* get minix_write_inode() to honour the second argument
* now we can use simple_fsync() for minixfs

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

10 years agoswitch ext2 to simple_fsync()
Al Viro [Sun, 7 Jun 2009 19:14:02 +0000]
switch ext2 to simple_fsync()

kill ext2_sync_file() (along with ext2/fsync.c), get rid of
ext2_update_inode() - it's an alias of ext2_write_inode().

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

10 years agoSanitize ->fsync() for FAT
Al Viro [Sun, 7 Jun 2009 17:44:36 +0000]
Sanitize ->fsync() for FAT

* mark directory data blocks as assoc. metadata
* add new inode to deal with FAT, mark FAT blocks as assoc. metadata of that
* now ->fsync() is trivial both for files and directories

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

10 years agofs/qnx4: sanitize includes
Al Viro [Sun, 7 Jun 2009 13:47:13 +0000]
fs/qnx4: sanitize includes

fs-internal parts of qnx4_fs.h taken to fs/qnx4/qnx4.h, includes adjusted,
qnx4_fs.h doesn't need unifdef anymore.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

10 years agoSanitize qnx4 fsync handling
Al Viro [Sun, 7 Jun 2009 13:30:08 +0000]
Sanitize qnx4 fsync handling

* have directory operations use mark_buffer_dirty_inode(),
  so that sync_mapping_buffers() would get those.
* make qnx4_write_inode() honour its last argument.
* get rid of insane copies of very ancient "walk the indirect blocks"
  in qnx4/fsync - they never matched the actual fs layout and, fortunately,
  never'd been called.  Again, all this junk is not needed; ->fsync()
  should just do sync_mapping_buffers + sync_inode (and if we implement
  block allocation for qnx4, we'll need to use mark_buffer_dirty_inode()
  for extent blocks)

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

10 years agoNew helper - simple_fsync()
Al Viro [Sun, 7 Jun 2009 18:56:44 +0000]
New helper - simple_fsync()

writes associated buffers, then does sync_inode() to write
the inode itself (and to make it clean).  Depends on
->write_inode() honouring the second argument.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

10 years agoPush BKL down into ->remount_fs()
Alessio Igor Bogani [Tue, 12 May 2009 13:10:54 +0000]
Push BKL down into ->remount_fs()

[xfs, btrfs, capifs, shmem don't need BKL, exempt]

Signed-off-by: Alessio Igor Bogani <abogani@texware.it>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

10 years agofs: block_dump missing dentry locking
Nick Piggin [Thu, 28 May 2009 07:01:15 +0000]
fs: block_dump missing dentry locking

I think the block_dump output in __mark_inode_dirty is missing dentry locking.
Surely the i_dentry list can change any time, so we may not even *get* a
dentry there. If we do get one by chance, then it would appear to be able to
go away or get renamed at any time...

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

10 years agofs: remove incorrect I_NEW warnings
Nick Piggin [Tue, 2 Jun 2009 10:07:47 +0000]
fs: remove incorrect I_NEW warnings

Some filesystems can call in to sync an inode that is still in the
I_NEW state (eg. ext family, when mounted with -osync). This is OK
because the filesystem has sole access to the new inode, so it can
modify i_state without races (because no other thread should be
modifying it, by definition of I_NEW). Ie. a false positive, so
remove the warnings.

The races are described here 7ef0d7377cb287e08f3ae94cebc919448e1f5dff,
which is also where the warnings were introduced.

Reported-by: Stephen Hemminger <shemminger@vyatta.com>
Signed-off-by: Nick Piggin <npiggin@suse.de>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

10 years agolinux/magic.h: move cramfs magic out of cramfs_fs.h
Mike Frysinger [Tue, 26 May 2009 09:45:04 +0000]
linux/magic.h: move cramfs magic out of cramfs_fs.h

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
CC: Alexander Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

10 years agoxfs: remove ->write_super and stop maintaining ->s_dirt
Christoph Hellwig [Fri, 5 Jun 2009 10:26:23 +0000]
xfs: remove ->write_super and stop maintaining ->s_dirt

the write_super method is used for

 (1) writing back the superblock periodically from pdflush
 (2) called just before ->sync_fs for data integerity syncs

We don't need (1) because we have our own peridoc writeout through xfssyncd,
and we don't need (2) because xfs_fs_sync_fs performs a proper synchronous
superblock writeout after all other data and metadata has been written out.

Also remove ->s_dirt tracking as it's only used to decide when too call
->write_super.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Eric Sandeen <sandeen@sandeen.net>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

10 years agontfs: remove old debug check for dirty data in ntfs_put_super()
Jens Axboe [Mon, 25 May 2009 07:30:45 +0000]
ntfs: remove old debug check for dirty data in ntfs_put_super()

This should not trigger anymore, so kill it.

Acked-by: Anton Altaparmakov <aia21@cam.ac.uk>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

10 years agofs: Rearrange inode structure elements to avoid waste due to padding
Theodore Ts'o [Thu, 21 May 2009 20:01:02 +0000]
fs: Rearrange inode structure elements to avoid waste due to padding

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Cc: linux-fsdevel@vger.kernel.org
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

10 years agofs: Remove i_cindex from struct inode
Theodore Ts'o [Thu, 21 May 2009 20:01:00 +0000]
fs: Remove i_cindex from struct inode

The only user of the i_cindex element in the inode structure is used
is by the firewire drivers.  As part of an attempt to slim down the
inode structure to save memory --- since a typical Linux system will
have hundreds of thousands if not millions of inodes cached, a
reduction in the size inode has high leverage.

The firewire driver does not need i_cindex in any fast path, so it's
simple enough to calculate when it is needed, instead of wasting space
in the inode structure.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Cc: krh@redhat.com
Cc: stefanr@s5r6.in-berlin.de
Cc: linux-fsdevel@vger.kernel.org
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

10 years ago->write_super lock_super pushdown
Christoph Hellwig [Mon, 11 May 2009 21:35:03 +0000]
->write_super lock_super pushdown

Push down lock_super into ->write_super instances and remove it from the
caller.

Following filesystem don't need ->s_lock in ->write_super and are skipped:

 * bfs, nilfs2 - no other uses of s_lock and have internal locks in
->write_super
 * ext2 - uses BKL in ext2_write_super and has internal calls without s_lock
 * reiserfs - no other uses of s_lock as has reiserfs_write_lock (BKL) in
  ->write_super
 * xfs - no other uses of s_lock and uses internal lock (buffer lock on
superblock buffer) to serialize ->write_super.  Also xfs_fs_write_super
is superflous and will go away in the next merge window

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

10 years agojffs2: move jffs2_write_super to super.c
Christoph Hellwig [Mon, 11 May 2009 21:34:27 +0000]
jffs2: move jffs2_write_super to super.c

jffs2_write_super is only called from super.c and doesn't use any
functionality from fs.c.  So move it over to super.c and make it
static there.

[should go in through the vfs tree as it is a requirement for the
 next patch]

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

10 years agoPush BKL down into do_remount_sb()
Al Viro [Fri, 8 May 2009 17:36:58 +0000]
Push BKL down into do_remount_sb()

[folded fix from Jiri Slaby]

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

10 years agoPush BKL down beyond VFS-only parts of do_mount()
Al Viro [Fri, 8 May 2009 17:34:06 +0000]
Push BKL down beyond VFS-only parts of do_mount()

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

10 years agoPush BKL into do_mount()
Al Viro [Fri, 8 May 2009 17:31:17 +0000]
Push BKL into do_mount()

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

10 years agoPush lock_super() into the ->remount_fs() of filesystems that care about it
Al Viro [Wed, 6 May 2009 14:43:07 +0000]
Push lock_super() into the ->remount_fs() of filesystems that care about it

Note that since we can't run into contention between remount_fs and write_super
(due to exclusion on s_umount), we have to care only about filesystems that
touch lock_super() on their own.  Out of those ext3, ext4, hpfs, sysv and ufs
do need it; fat doesn't since its ->remount_fs() only accesses assign-once
data (basically, it's "we have no atime on directories and only have atime on
files for vfat; force nodiratime and possibly noatime into *flags").

[folded a build fix from hch]

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

10 years agopush BKL down into ->put_super
Christoph Hellwig [Tue, 5 May 2009 13:40:36 +0000]
push BKL down into ->put_super

Move BKL into ->put_super from the only caller.  A couple of
filesystems had trivial enough ->put_super (only kfree and NULLing of
s_fs_info + stuff in there) to not get any locking: coda, cramfs, efs,
hugetlbfs, omfs, qnx4, shmem, all others got the full treatment.  Most
of them probably don't need it, but I'd rather sort that out individually.
Preferably after all the other BKL pushdowns in that area.

[AV: original used to move lock_super() down as well; these changes are
removed since we don't do lock_super() at all in generic_shutdown_super()
now]
[AV: fuse, btrfs and xfs are known to need no damn BKL, exempt]

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

10 years agoNo need to do lock_super() for exclusion in generic_shutdown_super()
Al Viro [Wed, 6 May 2009 02:10:44 +0000]
No need to do lock_super() for exclusion in generic_shutdown_super()

We can't run into contention on it.  All other callers of lock_super()
either hold s_umount (and we have it exclusive) or hold an active
reference to superblock in question, which prevents the call of
generic_shutdown_super() while the reference is held.  So we can
replace lock_super(s) with get_fs_excl() in generic_shutdown_super()
(and corresponding change for unlock_super(), of course).

Since ext4 expects s_lock held for its put_super, take lock_super()
into it.  The rest of filesystems do not care at all.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

10 years agoTrim a bit of crap from fs.h
Al Viro [Thu, 7 May 2009 07:12:29 +0000]
Trim a bit of crap from fs.h

do_remount_sb() is fs/internal.h fodder, fsync_no_super() is long gone.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

10 years agoMake sure that all callers of remount hold s_umount exclusive
Al Viro [Wed, 6 May 2009 03:48:50 +0000]
Make sure that all callers of remount hold s_umount exclusive

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

10 years agoenforce ->sync_fs is only called for rw superblock
Christoph Hellwig [Tue, 5 May 2009 13:41:25 +0000]
enforce ->sync_fs is only called for rw superblock

Make sure a superblock really is writeable by checking MS_RDONLY
under s_umount.  sync_filesystems needed some re-arragement for
that, but all but one sync_filesystem caller had the correct locking
already so that we could add that check there.  cachefiles grew
s_umount locking.

I've also added a WARN_ON to sync_filesystem to assert this for
future callers.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>