linux-2.6
15 years agoide-atapi: assign expiry and timeout based on device type
Borislav Petkov [Fri, 2 Jan 2009 15:12:55 +0000 (16:12 +0100)] 
ide-atapi: assign expiry and timeout based on device type

There should be no functionality change resulting from this patch.

Signed-off-by: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide-atapi: compute cmd_len based on device type in ide_transfer_pc
Borislav Petkov [Fri, 2 Jan 2009 15:12:54 +0000 (16:12 +0100)] 
ide-atapi: compute cmd_len based on device type in ide_transfer_pc

There should be no functionality change resulting from this patch.

Signed-off-by: Borislav Petkov <petkovbb@gmail.com>
[bart: move cmd_len check closer to ->output_data() call]
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide: remove the last ide-scsi remnants
Borislav Petkov [Fri, 2 Jan 2009 15:12:54 +0000 (16:12 +0100)] 
ide: remove the last ide-scsi remnants

Signed-off-by: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide-atapi: remove ide-scsi remnants from ide_pc_intr()
Borislav Petkov [Fri, 2 Jan 2009 15:12:54 +0000 (16:12 +0100)] 
ide-atapi: remove ide-scsi remnants from ide_pc_intr()

As a result, remove now unused ide_scsi_get_timeout and ide_scsi_expiry.

Signed-off-by: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide-atapi: remove ide-scsi remnants from ide_transfer_pc()
Borislav Petkov [Fri, 2 Jan 2009 15:12:53 +0000 (16:12 +0100)] 
ide-atapi: remove ide-scsi remnants from ide_transfer_pc()

Signed-off-by: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide-atapi: remove ide-scsi remnants from ide_issue_pc
Borislav Petkov [Fri, 2 Jan 2009 15:12:53 +0000 (16:12 +0100)] 
ide-atapi: remove ide-scsi remnants from ide_issue_pc

Signed-off-by: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide-cd: move cdrom_timer_expiry to ide-atapi.c
Borislav Petkov [Fri, 2 Jan 2009 15:12:53 +0000 (16:12 +0100)] 
ide-cd: move cdrom_timer_expiry to ide-atapi.c

- cdrom_timer_expiry -> ide_cd_expiry
- remove expiry-arg to ide_issue_pc as it is redundant now
- ide_debug_log -> debug_log

Signed-off-by: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide-atapi: teach ide atapi about drive->waiting_for_dma
Borislav Petkov [Fri, 2 Jan 2009 15:12:53 +0000 (16:12 +0100)] 
ide-atapi: teach ide atapi about drive->waiting_for_dma

In addition, we wait for DRQ to be asserted by repeatedly polling
device status no matter what DRQ type each device implements.

Signed-off-by: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide-atapi: accomodate transfer length calculation for ide-cd
Borislav Petkov [Fri, 2 Jan 2009 15:12:52 +0000 (16:12 +0100)] 
ide-atapi: accomodate transfer length calculation for ide-cd

... by factoring it out of ide_cd_do_request() into a helper, as suggested by
Bart.

There should be no functionality change resulting from this patch.

Signed-off-by: Borislav Petkov <petkovbb@gmail.com>
[bart: BLK_DEV_IDECD needs to select IDE_ATAPI now]
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide-atapi: setup dma for ide-cd
Borislav Petkov [Fri, 2 Jan 2009 15:12:52 +0000 (16:12 +0100)] 
ide-atapi: setup dma for ide-cd

There should be no functional change resulting from this patch.

Signed-off-by: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide-atapi: combine drive-specific assignments
Borislav Petkov [Fri, 2 Jan 2009 15:12:52 +0000 (16:12 +0100)] 
ide-atapi: combine drive-specific assignments

There should be no functionality change resulting from this patch.

Signed-off-by: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide-atapi: add a dev_is_idecd-inline
Borislav Petkov [Fri, 2 Jan 2009 15:12:52 +0000 (16:12 +0100)] 
ide-atapi: add a dev_is_idecd-inline

There should be no functionality change resulting from this patch.

Signed-off-by: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoremove ide-scsi
FUJITA Tomonori [Fri, 2 Jan 2009 15:12:51 +0000 (16:12 +0100)] 
remove ide-scsi

As planed, this removes ide-scsi.

The 2.6 kernel supports direct writing to ide CD drives, which
eliminates the need for ide-scsi. ide-scsi has been unmaintained and
marked as deprecated.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Cc: James.Bottomley@HansenPartnership.com
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide-floppy: allocate only toplevel packet commands
Linus Torvalds [Fri, 2 Jan 2009 15:12:51 +0000 (16:12 +0100)] 
ide-floppy: allocate only toplevel packet commands

This makes the top-level function just allocate a single pc entry, and then
pass it down as a pointer to all the helper functions that also need one
of those "struct ide_atapi_pc" things. As far as I can tell, the use of
these things never overlaps each other, BUT I DID NOT CHECK VERY CLOSELY!

So I'm not guaranteeing this is correct, and I don't have the hardware. It
would be good for somebody who knows the code more, and has the hardware,
could please test this?

With this, ide-floppy still has fairly big stack usage, but instead of

idefloppy_ioctl [vmlinux]:              1208
ide_floppy_get_capacity [vmlinux]:      872
idefloppy_release [vmlinux]:            408
idefloppy_open [vmlinux]:               408

where those two first ones are at the very top of the list of stack users
for me, it's now

ide_floppy_get_capacity [vmlinux]:           404
ide_floppy_ioctl [vmlinux]:                  364

ie they are still high, but they are no longer at the top.

Borislav: Since ide_floppy_get_capacity is passed as a function pointer to other
parts of the kernel (e.g., block layer) we need that ide_atapi_pc to be created
on stack. Also, redid stack users numbers above. The two functions missing from
Linus' original 'make stackusage' output are due to ide being
rewritten/reorganized atm.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide: make IDE_AFLAG_.. numbering continuous again
Borislav Petkov [Fri, 2 Jan 2009 15:12:50 +0000 (16:12 +0100)] 
ide: make IDE_AFLAG_.. numbering continuous again

Signed-off-by: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide-cd: move debug defines into header
Borislav Petkov [Fri, 2 Jan 2009 15:12:50 +0000 (16:12 +0100)] 
ide-cd: move debug defines into header

While at it:
- disable compiling-in debug support by default

Signed-off-by: Borislav Petkov <petkovbb@gmail.com>
[bart: fixup patch description]
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide: use per-device request queue locks (v2)
Bartlomiej Zolnierkiewicz [Fri, 2 Jan 2009 15:12:50 +0000 (16:12 +0100)] 
ide: use per-device request queue locks (v2)

* Move hack for flush requests from choose_drive() to do_ide_request().

* Add ide_plug_device() helper and convert core IDE code from using
  per-hwgroup lock as a request lock to use the ->queue_lock instead.

* Remove no longer needed:
  - choose_drive() function
  - WAKEUP() macro
  - 'sleeping' flag from ide_hwif_t
  - 'service_{start,time}' fields from ide_drive_t

This patch results in much simpler and more maintainable code
(besides being a scalability improvement).

v2:
* Fixes/improvements based on review from Elias:
  - take as many requests off the queue as possible
  - remove now redundant BUG_ON()

Cc: Elias Oltmanns <eo@nebensachen.de>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide: add ide_[un]lock_hwgroup() helpers
Bartlomiej Zolnierkiewicz [Fri, 2 Jan 2009 15:12:50 +0000 (16:12 +0100)] 
ide: add ide_[un]lock_hwgroup() helpers

Add ide_[un]lock_hwgroup() inline helpers for obtaining exclusive
access to the given hwgroup and update the core code accordingly.

[ This change besides making code saner results in more efficient
  use of ide_{get,release}_lock(). ]

Cc: Michael Schmitz <schmitz@biophys.uni-duesseldorf.de>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Elias Oltmanns <eo@nebensachen.de>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide: remove "paranoia" checks for hwgroup->busy
Bartlomiej Zolnierkiewicz [Fri, 2 Jan 2009 15:12:49 +0000 (16:12 +0100)] 
ide: remove "paranoia" checks for hwgroup->busy

Remove "paranoia" checks for hwgroup->busy from ide_timer_expiry()
and ide_intr().  This is a preparation for future changes.

Cc: Michael Schmitz <schmitz@biophys.uni-duesseldorf.de>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Elias Oltmanns <eo@nebensachen.de>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide: remove IDE PM hack from do_ide_request()
Bartlomiej Zolnierkiewicz [Fri, 2 Jan 2009 15:12:49 +0000 (16:12 +0100)] 
ide: remove IDE PM hack from do_ide_request()

We now tell block layer that there is still work to do using
blk_plug_device() so hack for IDE Power Management can be removed
(it was buggy for hwgroups having more than 4 devices anyway).

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide: don't execute the next queued command from the hard-IRQ context (v2)
Bartlomiej Zolnierkiewicz [Fri, 2 Jan 2009 15:12:48 +0000 (16:12 +0100)] 
ide: don't execute the next queued command from the hard-IRQ context (v2)

* Tell the block layer that we are not done handling requests by using
  blk_plug_device() in ide_do_request() (request handling function)
  and ide_timer_expiry() (timeout handler) if the queue is not empty.

* Remove optimization which directly calls ide_do_request() for the next
  queued command from the ide_intr() (IRQ handler) and ide_timer_expiry().

* Remove no longer needed IRQ masking from ide_do_request() - in case of
  IDE ports needing serialization disable_irq_nosync()/enable_irq() was
  used for the (possibly shared) IRQ of the other IDE port.

* Put the misplaced comment in the right place in ide_do_request().

* Drop no longer needed 'int masked_irq' argument from ide_do_request().

* Merge ide_do_request() into do_ide_request().

* Remove no longer needed IDE_NO_IRQ define.

While at it:

* Don't use HWGROUP() macro in do_ide_request().

* Use __func__ in ide_intr().

This patch reduces IRQ hadling latency for IDE and improves the system-wide
handling of shared IRQs (which should result in more timeout resistant and
stable IDE systems).  It also makes it possible to do some further changes
later (i.e. replace some busy-waiting delays with sleeping equivalents).

v2:
Changes per review from Elias Oltmanns:
- fix wrong goto statement in 'if (startstop == ide_stopped)' block
- use spin_unlock_irq()
- don't use obsolete HWIF() macro

Cc: Elias Oltmanns <eo@nebensachen.de>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide: move sysfs support to ide-sysfs.c
Bartlomiej Zolnierkiewicz [Fri, 2 Jan 2009 15:12:48 +0000 (16:12 +0100)] 
ide: move sysfs support to ide-sysfs.c

While at it:
- media_string() -> ide_media_string()

There should be no functional changes caused by this patch.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide: factor out device type classifying from do_identify()
Bartlomiej Zolnierkiewicz [Fri, 2 Jan 2009 15:12:47 +0000 (16:12 +0100)] 
ide: factor out device type classifying from do_identify()

Factor out device type classifying from do_identify()
to ide_classify_ata_dev() and ide_classify_atapi_dev().

There should be no functional changes caused by this patch.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide: small ide_register_port() cleanup
Bartlomiej Zolnierkiewicz [Fri, 2 Jan 2009 15:12:47 +0000 (16:12 +0100)] 
ide: small ide_register_port() cleanup

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide: remove chipset type fixup from ide_host_register()
Bartlomiej Zolnierkiewicz [Fri, 2 Jan 2009 15:12:47 +0000 (16:12 +0100)] 
ide: remove chipset type fixup from ide_host_register()

* Set chipset type explicitly in tx4938ide and tx4939ide host drivers
  (all other host drivers were updated already).

* Remove no longer used chipset type fixup from ide_host_register().

Acked-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
Cc: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agotx493x: fix indentation
Bartlomiej Zolnierkiewicz [Fri, 2 Jan 2009 15:12:46 +0000 (16:12 +0100)] 
tx493x: fix indentation

Trivial CodingStyle fixup for tx4938ide and tx4939ide drivers.

Acked-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
Acked-by: Sergei Shtyltov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agox86: convert permanent_kmaps_init() from macro to inline
Ingo Brueckl [Fri, 2 Jan 2009 13:42:00 +0000 (14:42 +0100)] 
x86: convert permanent_kmaps_init() from macro to inline

Impact: cleanup

This compiler warning:

  arch/x86/mm/init_32.c:515: warning: unused variable 'pgd_base'

triggers because permanent_kmaps_init() is a CPP macro in the
!CONFIG_HIGHMEM case, that does not tell the compiler that the
'pgd_base' parameter is used.

Convert permanent_kmaps_init() (and set_highmem_pages_init()) to
C inline functions - which gives the parameter a proper type and
which gets rid of the compiler warning as well.

Signed-off-by: Ingo Brueckl <ib@wupperonline.de>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
15 years agoMerge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux...
David Vrabel [Fri, 2 Jan 2009 13:17:13 +0000 (13:17 +0000)] 
Merge branch 'master' of git://git./linux/kernel/git/torvalds/linux-2.6 into for-upstream

Conflicts:

drivers/uwb/wlp/eda.c

15 years agox86: early_printk - use sizeof instead of hardcoded number
Cyrill Gorcunov [Fri, 2 Jan 2009 08:27:18 +0000 (11:27 +0300)] 
x86: early_printk - use sizeof instead of hardcoded number

Impact: cleanup

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
15 years agoMerge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs-2.6
Linus Torvalds [Wed, 31 Dec 2008 23:57:56 +0000 (15:57 -0800)] 
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: (34 commits)
  nfsd race fixes: jfs
  nfsd race fixes: reiserfs
  nfsd race fixes: ext4
  nfsd race fixes: ext3
  nfsd race fixes: ext2
  nfsd/create race fixes, infrastructure
  filesystem notification: create fs/notify to contain all fs notification
  fs/block_dev.c: __read_mostly improvement and sb_is_blkdev_sb utilization
  kill ->dir_notify()
  filp_cachep can be static in fs/file_table.c
  fix f_count description in Documentation/filesystems/files.txt
  make INIT_FS use the __RW_LOCK_UNLOCKED initialization
  take init_fs to saner place
  kill vfs_permission
  pass a struct path * to may_open
  kill walk_init_root
  remove incorrect comment in inode_permission
  expand some comments (d_path / seq_path)
  correct wrong function name of d_put in kernel document and source comment
  fix switch_names() breakage in short-to-short case
  ...

15 years agocpumask: CONFIG_DISABLE_OBSOLETE_CPUMASK_FUNCTIONS
Rusty Russell [Wed, 31 Dec 2008 23:42:30 +0000 (10:12 +1030)] 
cpumask: CONFIG_DISABLE_OBSOLETE_CPUMASK_FUNCTIONS

Impact: new debug CONFIG options

This helps find unconverted code.  It currently breaks compile horribly,
but we never wanted a flag day so that's expected.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
15 years agocpumask: zero extra bits in alloc_cpumask_var_node
Rusty Russell [Wed, 31 Dec 2008 23:42:30 +0000 (10:12 +1030)] 
cpumask: zero extra bits in alloc_cpumask_var_node

Impact: extra safety checks during transition

When CONFIG_CPUMASKS_OFFSTACK is set, the new cpumask_ operators only
use bits up to nr_cpu_ids, not NR_CPUS.  Using the old cpus_ operators
on these masks can mean accessing undefined bits.

After some discussion, Mike and I decided to err on the side of caution;
we zero the "undefined" bits in alloc_cpumask_var_node() until all the
old cpumask functions are removed.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
15 years agocpumask: replace for_each_cpu_mask_nr with for_each_cpu in kernel/time/
Rusty Russell [Wed, 31 Dec 2008 23:42:29 +0000 (10:12 +1030)] 
cpumask: replace for_each_cpu_mask_nr with for_each_cpu in kernel/time/

Impact: cleanup

Simple replacement, now the _nr is redundant.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Mike Travis <travis@sgi.com>
Cc: Ingo Molnar <mingo@redhat.com>
15 years agocpumask: convert mm/
Rusty Russell [Wed, 31 Dec 2008 23:42:29 +0000 (10:12 +1030)] 
cpumask: convert mm/

Impact: Use new API

Convert kernel mm functions to use struct cpumask.

We skip include/linux/percpu.h and mm/allocpercpu.c, which are in flux.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Mike Travis <travis@sgi.com>
Reviewed-by: Christoph Lameter <cl@linux-foundation.org>
15 years agocpumask: convert rest of files in kernel/
Rusty Russell [Wed, 31 Dec 2008 23:42:28 +0000 (10:12 +1030)] 
cpumask: convert rest of files in kernel/

Impact: Reduce stack usage, use new cpumask API.

Mainly changing cpumask_t to 'struct cpumask' and similar simple API
conversion.  Two conversions worth mentioning:

1) we use cpumask_any_but to avoid a temporary in kernel/softlockup.c,
2) Use cpumask_var_t in taskstats_user_cmd().

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Mike Travis <travis@sgi.com>
Cc: Balbir Singh <balbir@linux.vnet.ibm.com>
Cc: Ingo Molnar <mingo@redhat.com>
15 years agocpumask: convert kernel/cpu.c
Rusty Russell [Wed, 31 Dec 2008 23:42:28 +0000 (10:12 +1030)] 
cpumask: convert kernel/cpu.c

Impact: Reduce kernel stack and memory usage, use new cpumask API.

Use cpumask_var_t for take_cpu_down() stack var, and frozen_cpus.

Note that notify_cpu_starting() can be called before core_initcall
allocates frozen_cpus, but the NULL check is optimized out by gcc for
the CONFIG_CPUMASK_OFFSTACK=n case.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
15 years agocpumask: convert kernel/profile.c
Rusty Russell [Wed, 31 Dec 2008 23:42:27 +0000 (10:12 +1030)] 
cpumask: convert kernel/profile.c

Impact: Reduce kernel memory usage, use new cpumask API.

Avoid a static cpumask_t for prof_cpu_mask, and an on-stack cpumask_t
in prof_cpu_mask_write_proc.  Both become cpumask_var_t.

prof_cpu_mask is only allocated when profiling is on, but the NULL
checks are optimized out by gcc for the !CPUMASK_OFFSTACK case.

Also removed some strange and unnecessary casts.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
15 years agocpumask: convert RCU implementations
Rusty Russell [Wed, 31 Dec 2008 23:42:26 +0000 (10:12 +1030)] 
cpumask: convert RCU implementations

Impact: use new cpumask API.

rcu_ctrlblk contains a cpumask, and it's highly optimized so I don't want
a cpumask_var_t (ie. a pointer) for the CONFIG_CPUMASK_OFFSTACK case.  It
could use a dangling bitmap, and be allocated in __rcu_init to save memory,
but for the moment we use a bitmap.

(Eventually 'struct cpumask' will be undefined for CONFIG_CPUMASK_OFFSTACK,
so we use a bitmap here to show we really mean it).

We remove on-stack cpumasks, using cpumask_var_t for
rcu_torture_shuffle_tasks() and for_each_cpu_and in force_quiescent_state().

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
15 years agocpumask: convert kernel/irq
Rusty Russell [Wed, 31 Dec 2008 23:42:26 +0000 (10:12 +1030)] 
cpumask: convert kernel/irq

Impact: Reduce stack usage, use new cpumask API.  ALPHA mod!

Main change is that irq_default_affinity becomes a cpumask_var_t, so
treat it as a pointer (this effects alpha).

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
15 years agocpumask: convert kernel time functions
Rusty Russell [Wed, 31 Dec 2008 23:42:25 +0000 (10:12 +1030)] 
cpumask: convert kernel time functions

Impact: Use new APIs

Convert kernel/time functions to use struct cpumask *.

Note the ugly bitmap declarations in tick-broadcast.c.  These should
be cpumask_var_t, but there was no obvious initialization function to
put the alloc_cpumask_var() calls in.  This was safe.

(Eventually 'struct cpumask' will be undefined for CONFIG_CPUMASK_OFFSTACK,
so we use a bitmap here to show we really mean it).

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Mike Travis <travis@sgi.com>
15 years agocpumask: convert kernel/workqueue.c
Rusty Russell [Wed, 31 Dec 2008 23:42:25 +0000 (10:12 +1030)] 
cpumask: convert kernel/workqueue.c

Impact: Reduce memory usage, use new cpumask API.

cpu_populated_map becomes a cpumask_var_t, and cpu_singlethread_map is
simply a cpumask pointer: it's simply the cpumask containing the first
possible CPU anyway.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
15 years agocpumask: convert kernel/compat.c
Rusty Russell [Wed, 31 Dec 2008 23:42:24 +0000 (10:12 +1030)] 
cpumask: convert kernel/compat.c

Impact: Reduce stack usage, use new cpumask API.

Straightforward conversion; cpumasks' size is given by cpumask_size() (now
a variable rather than fixed) and on-stack cpu masks use cpumask_var_t.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
15 years agocpumask: remove any_online_cpu() users: mm/
Rusty Russell [Wed, 31 Dec 2008 23:42:24 +0000 (10:12 +1030)] 
cpumask: remove any_online_cpu() users: mm/

Impact: Remove obsolete API usage

any_online_cpu() is a good name, but it takes a cpumask_t, not a
pointer.

There are several places where any_online_cpu() doesn't really want a
mask arg at all.  Replace all callers with cpumask_any() and
cpumask_any_and().

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Mike Travis <travis@sgi.com>
15 years agocpumask: remove any_online_cpu() users: kernel/
Rusty Russell [Wed, 31 Dec 2008 23:42:23 +0000 (10:12 +1030)] 
cpumask: remove any_online_cpu() users: kernel/

Impact: Remove obsolete API usage

any_online_cpu() is a good name, but it takes a cpumask_t, not a
pointer.

There are several places where any_online_cpu() doesn't really want a
mask arg at all.  Replace all callers with cpumask_any() and
cpumask_any_and().

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Mike Travis <travis@sgi.com>
15 years agocpumask: convert kernel trace functions further
Rusty Russell [Wed, 31 Dec 2008 23:42:23 +0000 (10:12 +1030)] 
cpumask: convert kernel trace functions further

Impact: Reduce future memory usage, use new cpumask API.

Since the last patch was created and acked, more old cpumask users
slipped into kernel/trace.

Mostly trivial conversions, except struct trace_iterator's "started"
member becomes a cpumask_var_t.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
15 years agocpumask: convert kernel trace functions
Rusty Russell [Wed, 31 Dec 2008 23:42:22 +0000 (10:12 +1030)] 
cpumask: convert kernel trace functions

Impact: Reduce future memory usage, use new cpumask API.

(Eventually, cpumask_var_t will be allocated based on nr_cpu_ids, not NR_CPUS).

Convert kernel trace functions to use struct cpumask API:
1) Use cpumask_copy/cpumask_test_cpu/for_each_cpu.
2) Use cpumask_var_t and alloc_cpumask_var/free_cpumask_var everywhere.
3) Use on_each_cpu instead of playing with current->cpus_allowed.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Mike Travis <travis@sgi.com>
Acked-by: Steven Rostedt <rostedt@goodmis.org>
15 years agocpumask: Introduce topology_core_cpumask()/topology_thread_cpumask(): ia64
Rusty Russell [Wed, 31 Dec 2008 23:42:21 +0000 (10:12 +1030)] 
cpumask: Introduce topology_core_cpumask()/topology_thread_cpumask(): ia64

Impact: New API

The old topology_core_siblings() and topology_thread_siblings() return
a cpumask_t; these new ones return a (const) struct cpumask *.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Mike Travis <travis@sgi.com>
15 years agocpumask: Introduce topology_core_cpumask()/topology_thread_cpumask(): powerpc
Rusty Russell [Wed, 31 Dec 2008 23:42:21 +0000 (10:12 +1030)] 
cpumask: Introduce topology_core_cpumask()/topology_thread_cpumask(): powerpc

Impact: New API

The old topology_core_siblings() and topology_thread_siblings() return
a cpumask_t; these new ones return a (const) struct cpumask *.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Mike Travis <travis@sgi.com>
15 years agocpumask: Introduce topology_core_cpumask()/topology_thread_cpumask(): s390
Rusty Russell [Wed, 31 Dec 2008 23:42:20 +0000 (10:12 +1030)] 
cpumask: Introduce topology_core_cpumask()/topology_thread_cpumask(): s390

Impact: New API

The old topology_core_siblings() and topology_thread_siblings() return
a cpumask_t; these new ones return a (const) struct cpumask *.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Mike Travis <travis@sgi.com>
15 years agocpumask: Introduce topology_core_cpumask()/topology_thread_cpumask(): sparc
Rusty Russell [Wed, 31 Dec 2008 23:42:20 +0000 (10:12 +1030)] 
cpumask: Introduce topology_core_cpumask()/topology_thread_cpumask(): sparc

Impact: New API

The old topology_core_siblings() and topology_thread_siblings() return
a cpumask_t; these new ones return a (const) struct cpumask *.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Mike Travis <travis@sgi.com>
15 years agocpumask: Use find_last_bit()
Rusty Russell [Wed, 31 Dec 2008 23:42:19 +0000 (10:12 +1030)] 
cpumask: Use find_last_bit()

Impact: cleanup

There's one obvious place to use it: to find the highest possible cpu.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
15 years agobitmap: find_last_bit()
Rusty Russell [Wed, 31 Dec 2008 23:42:19 +0000 (10:12 +1030)] 
bitmap: find_last_bit()

Impact: New API

As the name suggests.  For the moment everyone uses the generic one.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
15 years agom68knommu: define __fls
Rusty Russell [Wed, 31 Dec 2008 23:42:18 +0000 (10:12 +1030)] 
m68knommu: define __fls

Like fls, but can't be handed 0 and returns the bit number.

(I broke this arch in linux-next by using __fls in generic code).

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
15 years agom68k: define __fls
Rusty Russell [Wed, 31 Dec 2008 23:42:18 +0000 (10:12 +1030)] 
m68k: define __fls

Like fls, but can't be handed 0 and returns the bit number.

(I broke this arch in linux-next by using __fls in generic code).

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
15 years agoblackfin: define __fls
Rusty Russell [Wed, 31 Dec 2008 23:42:17 +0000 (10:12 +1030)] 
blackfin: define __fls

Like fls, but can't be handed 0 and returns the bit number.

(I broke this arch in linux-next by using __fls in generic code).

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Acked-by: Mike Frysinger <vapier@gentoo.org>
15 years agoavr32: define __fls
Rusty Russell [Wed, 31 Dec 2008 23:42:16 +0000 (10:12 +1030)] 
avr32: define __fls

Like fls, but can't be handed 0 and returns the bit number.

(I broke this arch in linux-next by using __fls in generic code).

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
15 years agoparisc: remove gratuitous cpu_online_map declaration.
Rusty Russell [Wed, 31 Dec 2008 23:42:16 +0000 (10:12 +1030)] 
parisc: remove gratuitous cpu_online_map declaration.

This is defined in linux/cpumask.h (included in this file already),
and this is now defined differently.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Cc: linux-parisc@vger.kernel.org
15 years agocpumask: Use accessors code in core
Rusty Russell [Wed, 31 Dec 2008 23:42:15 +0000 (10:12 +1030)] 
cpumask: Use accessors code in core

Impact: use new API

cpu_*_map are going away in favour of cpu_*_mask, but const pointers.
So we have accessors where we really do want to frob them.  Archs
will also need the (trivial) conversion before we can finally remove
cpu_*_map.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Mike Travis <travis@sgi.com>
15 years agocpumask: prepare for iterators to only go to nr_cpu_ids/nr_cpumask_bits.: core
Rusty Russell [Wed, 31 Dec 2008 23:42:15 +0000 (10:12 +1030)] 
cpumask: prepare for iterators to only go to nr_cpu_ids/nr_cpumask_bits.: core

Impact: cleanup

In future, all cpumask ops will only be valid (in general) for bit
numbers < nr_cpu_ids.  So use that instead of NR_CPUS in iterators
and other comparisons.

This is always safe: no cpu number can be >= nr_cpu_ids, and
nr_cpu_ids is initialized to NR_CPUS at boot.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Mike Travis <travis@sgi.com>
Acked-by: Ingo Molnar <mingo@elte.hu>
Acked-by: James Morris <jmorris@namei.org>
Cc: Eric Biederman <ebiederm@xmission.com>
15 years agopercpu: fix percpu accessors to potentially !cpu_possible() cpus: m32r
Rusty Russell [Wed, 31 Dec 2008 23:42:14 +0000 (10:12 +1030)] 
percpu: fix percpu accessors to potentially !cpu_possible() cpus: m32r

Impact: CPU iterator bugfixes

Percpu areas are only allocated for possible cpus.  In general, you
shouldn't access random cpu's percpu areas.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Mike Travis <travis@sgi.com>
Acked-by: Ingo Molnar <mingo@elte.hu>
Acked-by: Hirokazu Takata <takata@linux-m32r.org>
15 years agopercpu: fix percpu accessors to potentially !cpu_possible() cpus: pnpbios
Rusty Russell [Wed, 31 Dec 2008 23:42:14 +0000 (10:12 +1030)] 
percpu: fix percpu accessors to potentially !cpu_possible() cpus: pnpbios

Impact: CPU iterator bugfixes

Percpu areas are only allocated for possible cpus.  In general, you
shouldn't access random cpu's percpu areas.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Mike Travis <travis@sgi.com>
Acked-by: Ingo Molnar <mingo@elte.hu>
Cc: Adam Belay <ambx1@neo.rr.com>
15 years agocpumask: fix bogus kernel-doc
Li Zefan [Wed, 31 Dec 2008 08:45:50 +0000 (16:45 +0800)] 
cpumask: fix bogus kernel-doc

Impact: fix kernel-doc

alloc_bootmem_cpumask_var() returns avoid.

Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
15 years agocpumask: Remove IA64 definition of total_cpus now it's in core code
Rusty Russell [Wed, 31 Dec 2008 23:42:13 +0000 (10:12 +1030)] 
cpumask: Remove IA64 definition of total_cpus now it's in core code

Impact: fix IA64 compile

Fortunately, they have exactly the same semantics.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
15 years agonfsd race fixes: jfs
Dave Kleikamp [Wed, 31 Dec 2008 04:08:37 +0000 (22:08 -0600)] 
nfsd race fixes: jfs

jfs version of Al Viro's nfsd race patches

Signed-off-by: Dave Kleikamp <shaggy@linux.vnet.ibm.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
15 years agonfsd race fixes: reiserfs
Al Viro [Tue, 30 Dec 2008 07:03:58 +0000 (02:03 -0500)] 
nfsd race fixes: reiserfs

... and the same for reiserfs.  The difference here is that we need
insert_inode_locked4() to match iget5_locked().

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
15 years agonfsd race fixes: ext4
Al Viro [Tue, 30 Dec 2008 07:03:31 +0000 (02:03 -0500)] 
nfsd race fixes: ext4

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
15 years agonfsd race fixes: ext3
Al Viro [Tue, 30 Dec 2008 07:02:50 +0000 (02:02 -0500)] 
nfsd race fixes: ext3

ext3 analog of the previous patch

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
15 years agonfsd race fixes: ext2
Al Viro [Tue, 30 Dec 2008 06:52:35 +0000 (01:52 -0500)] 
nfsd race fixes: ext2

* make ext2_new_inode() put the inode into icache in locked state
* do not unlock until the inode is fully set up; otherwise nfsd
might pick it in half-baked state.
* make sure that ext2_new_inode() does *not* lead to two inodes with the
same inumber hashed at the same time; otherwise a bogus fhandle coming
from nfsd might race with inode creation:

nfsd: iget_locked() creates inode
nfsd: try to read from disk, block on that.
ext2_new_inode(): allocate inode with that inumber
ext2_new_inode(): insert it into icache, set it up and dirty
ext2_write_inode(): get the relevant part of inode table in cache,
set the entry for our inode (and start writing to disk)
nfsd: get CPU again, look into inode table, see nice and sane on-disk
inode, set the in-core inode from it

oops - we have two in-core inodes with the same inumber live in icache,
both used for IO.  Welcome to fs corruption...

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
15 years agonfsd/create race fixes, infrastructure
Al Viro [Tue, 30 Dec 2008 06:48:21 +0000 (01:48 -0500)] 
nfsd/create race fixes, infrastructure

new helpers - insert_inode_locked() and insert_inode_locked4().
Hash new inode, making sure that there's no such inode in icache
already.  If there is and it does not end up unhashed (as would
happen if we have nfsd trying to resolve a bogus fhandle), fail.
Otherwise insert our inode into hash and succeed.

In either case have i_state set to new+locked; cleanup ends up
being simpler with such calling conventions.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
15 years agofilesystem notification: create fs/notify to contain all fs notification
Eric Paris [Wed, 17 Dec 2008 18:59:41 +0000 (13:59 -0500)] 
filesystem notification: create fs/notify to contain all fs notification

Creating a generic filesystem notification interface, fsnotify, which will be
used by inotify, dnotify, and eventually fanotify is really starting to
clutter the fs directory.  This patch simply moves inotify and dnotify into
fs/notify/inotify and fs/notify/dnotify respectively to make both current fs/
and future notification tidier.

Signed-off-by: Eric Paris <eparis@redhat.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
15 years agofs/block_dev.c: __read_mostly improvement and sb_is_blkdev_sb utilization
Denis ChengRq [Mon, 1 Dec 2008 22:34:56 +0000 (14:34 -0800)] 
fs/block_dev.c: __read_mostly improvement and sb_is_blkdev_sb utilization

- iget5_locked in bdget really needs blockdev_superblock, instead of
  bd_mnt, so bd_mnt could be just a local variable;

- blockdev_superblock really needs __read_mostly, while local var bd_mnt
  not;

- make use of sb_is_blkdev_sb in bd_forget, instead of direct reference
  to blockdev_superblock.

Signed-off-by: Denis ChengRq <crquan@gmail.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
15 years agokill ->dir_notify()
Al Viro [Fri, 26 Dec 2008 05:57:40 +0000 (00:57 -0500)] 
kill ->dir_notify()

Remove the hopelessly misguided ->dir_notify().  The only instance (cifs)
has been broken by design from the very beginning; the objects it creates
are never destroyed, keep references to struct file they can outlive, nothing
that could possibly evict them exists on close(2) path *and* no locking
whatsoever is done to prevent races with close(), should the previous, er,
deficiencies someday be dealt with.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
15 years agofilp_cachep can be static in fs/file_table.c
Eric Dumazet [Wed, 10 Dec 2008 17:35:45 +0000 (09:35 -0800)] 
filp_cachep can be static in fs/file_table.c

Instead of creating the "filp" kmem_cache in vfs_caches_init(),
we can do it a litle be later in files_init(), so that filp_cachep
is static to fs/file_table.c

Acked-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Signed-off-by: Eric Dumazet <dada1@cosmosbay.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
15 years agofix f_count description in Documentation/filesystems/files.txt
Eric Dumazet [Wed, 10 Dec 2008 17:35:45 +0000 (09:35 -0800)] 
fix f_count description in Documentation/filesystems/files.txt

Documentation/filesystems/files.txt was not updated when
f_count became an atomic_long_t.
atomic_long_inc_not_zero() is now used instead of atomic_inc_not_zero()

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
15 years agomake INIT_FS use the __RW_LOCK_UNLOCKED initialization
Steven Rostedt [Wed, 10 Dec 2008 23:37:28 +0000 (18:37 -0500)] 
make INIT_FS use the __RW_LOCK_UNLOCKED initialization

[AV: rediffed on top of unification of init_fs]
Initialization of init_fs still uses the deprecated RW_LOCK_UNLOCKED macro.
This patch updates it to use the __RW_LOCK_UNLOCKED(lock) macro.

Signed-off-by: Steven Rostedt <srostedt@redhat.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
15 years agotake init_fs to saner place
Al Viro [Fri, 26 Dec 2008 05:35:37 +0000 (00:35 -0500)] 
take init_fs to saner place

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
15 years agokill vfs_permission
Christoph Hellwig [Fri, 24 Oct 2008 07:59:29 +0000 (09:59 +0200)] 
kill vfs_permission

With all the nameidata removal there's no point anymore for this helper.
Of the three callers left two will go away with the next lookup series
anyway.

Also add proper kerneldoc to inode_permission as this is the main
permission check routine now.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
15 years agopass a struct path * to may_open
Christoph Hellwig [Fri, 24 Oct 2008 07:58:10 +0000 (09:58 +0200)] 
pass a struct path * to may_open

No need for the nameidata in may_open - a struct path is enough.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
15 years agokill walk_init_root
Christoph Hellwig [Wed, 5 Nov 2008 14:07:21 +0000 (15:07 +0100)] 
kill walk_init_root

walk_init_root is a tiny helper that is marked __always_inline, has just
one caller and an unused argument.  Just merge it into the caller.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
15 years agoremove incorrect comment in inode_permission
Christoph Hellwig [Wed, 5 Nov 2008 14:04:29 +0000 (15:04 +0100)] 
remove incorrect comment in inode_permission

We now pass on all MAY_ flags to the filesystems permission routines,
so remove the comment stating the contrary.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
15 years agoexpand some comments (d_path / seq_path)
Arjan van de Ven [Mon, 1 Dec 2008 22:35:00 +0000 (14:35 -0800)] 
expand some comments (d_path / seq_path)

Explain that you really need to use the return value of d_path rather than
the buffer you passed into it.

Also fix the comment for seq_path(), the function arguments changed
recently but the comment hadn't been updated in sync.

Signed-off-by: Arjan van de Ven <arjan@linux.intel.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Christoph Hellwig <hch@lst.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
15 years agocorrect wrong function name of d_put in kernel document and source comment
Zhaolei [Mon, 1 Dec 2008 22:34:58 +0000 (14:34 -0800)] 
correct wrong function name of d_put in kernel document and source comment

no function named d_put(), it should be dput().

Impact: fix document and comment, no functionality changed

Signed-off-by: Zhao Lei <zhaolei@cn.fuijtsu.com>
Signed-off-by: Randy Dunlap <rdunlap@xenotime.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
15 years agofix switch_names() breakage in short-to-short case
Al Viro [Mon, 3 Nov 2008 20:03:50 +0000 (15:03 -0500)] 
fix switch_names() breakage in short-to-short case

We want ->name.len to match the resulting name on *both*
source and target

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
15 years agobefs: ensure fast symlinks are NUL-terminated
Duane Griffin [Fri, 19 Dec 2008 20:47:18 +0000 (20:47 +0000)] 
befs: ensure fast symlinks are NUL-terminated

Ensure fast symlink targets are NUL-terminated, even if corrupted
on-disk.

Cc: Sergey S. Kostyliov <rathamahata@php4.ru>
Signed-off-by: Duane Griffin <duaneg@dghda.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
15 years agofreevxfs: ensure fast symlinks are NUL-terminated
Duane Griffin [Fri, 19 Dec 2008 20:47:17 +0000 (20:47 +0000)] 
freevxfs: ensure fast symlinks are NUL-terminated

Ensure fast symlink targets are NUL-terminated, even if corrupted
on-disk.

Cc: Christoph Hellwig <hch@infradead.org>
Signed-off-by: Duane Griffin <duaneg@dghda.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
15 years agosysv: ensure fast symlinks are NUL-terminated
Duane Griffin [Fri, 19 Dec 2008 20:47:16 +0000 (20:47 +0000)] 
sysv: ensure fast symlinks are NUL-terminated

Ensure fast symlink targets are NUL-terminated, even if corrupted
on-disk.

Cc: Christoph Hellwig <hch@infradead.org>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Duane Griffin <duaneg@dghda.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
15 years agoext4: ensure fast symlinks are NUL-terminated
Duane Griffin [Fri, 19 Dec 2008 20:47:15 +0000 (20:47 +0000)] 
ext4: ensure fast symlinks are NUL-terminated

Ensure fast symlink targets are NUL-terminated, even if corrupted
on-disk.

Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Theodore Ts'o <tytso@mit.edu>
Cc: adilger@sun.com
Cc: linux-ext4@vger.kernel.org
Signed-off-by: Duane Griffin <duaneg@dghda.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
15 years agoext3: ensure fast symlinks are NUL-terminated
Duane Griffin [Fri, 19 Dec 2008 20:47:14 +0000 (20:47 +0000)] 
ext3: ensure fast symlinks are NUL-terminated

Ensure fast symlink targets are NUL-terminated, even if corrupted
on-disk.

Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Stephen Tweedie <sct@redhat.com>
Cc: linux-ext4@vger.kernel.org
Signed-off-by: Duane Griffin <duaneg@dghda.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
15 years agoext2: ensure fast symlinks are NUL-terminated
Duane Griffin [Fri, 19 Dec 2008 20:47:13 +0000 (20:47 +0000)] 
ext2: ensure fast symlinks are NUL-terminated

Ensure fast symlink targets are NUL-terminated, even if corrupted
on-disk.

Cc: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Duane Griffin <duaneg@dghda.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
15 years agovfs: ensure page symlinks are NUL-terminated
Duane Griffin [Fri, 19 Dec 2008 20:47:12 +0000 (20:47 +0000)] 
vfs: ensure page symlinks are NUL-terminated

On-disk data corruption could cause a page link to have its i_size set
to PAGE_SIZE (or a multiple thereof) and its contents all non-NUL.
NUL-terminate the link name to ensure this doesn't cause further
problems for the kernel.

Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Duane Griffin <duaneg@dghda.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
15 years agovfs: introduce helper function to safely NUL-terminate symlinks
Duane Griffin [Fri, 19 Dec 2008 20:47:11 +0000 (20:47 +0000)] 
vfs: introduce helper function to safely NUL-terminate symlinks

A number of filesystems were potentially triggering kernel bugs due to
corrupted symlink names on disk. This function helps safely terminate
the names.

Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Duane Griffin <duaneg@dghda.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
15 years agoeCryptfs: check readlink result was not an error before using it
Duane Griffin [Fri, 19 Dec 2008 20:47:10 +0000 (20:47 +0000)] 
eCryptfs: check readlink result was not an error before using it

The result from readlink is being used to index into the link name
buffer without checking whether it is a valid length. If readlink
returns an error this will fault or cause memory corruption.

Cc: Tyler Hicks <tyhicks@linux.vnet.ibm.com>
Cc: Dustin Kirkland <kirkland@canonical.com>
Cc: ecryptfs-devel@lists.launchpad.net
Signed-off-by: Duane Griffin <duaneg@dghda.com>
Acked-by: Michael Halcrow <mhalcrow@us.ibm.com>
Acked-by: Tyler Hicks <tyhicks@linux.vnet.ibm.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
15 years agofs/namespace.c: drop code after return
Julia Lawall [Mon, 1 Dec 2008 22:34:51 +0000 (14:34 -0800)] 
fs/namespace.c: drop code after return

The extra semicolon serves no purpose.

Signed-off-by: Julia Lawall <julia@diku.dk>
Reviewed-by: Richard Genoud <richard.genoud@gmail.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Christoph Hellwig <hch@lst.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
15 years agoinclude: linux/fs.h: put declarations in __KERNEL__
Jan Engelhardt [Mon, 1 Dec 2008 22:34:50 +0000 (14:34 -0800)] 
include: linux/fs.h: put declarations in __KERNEL__

include/linux/fs.h contains externs for a bunch of variables.  That obviously
belongs under ifdef __KERNEL__.

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
15 years agoshrink struct dentry
Nick Piggin [Mon, 1 Dec 2008 08:33:43 +0000 (09:33 +0100)] 
shrink struct dentry

struct dentry is one of the most critical structures in the kernel. So it's
sad to see it going neglected.

With CONFIG_PROFILING turned on (which is probably the common case at least
for distros and kernel developers), sizeof(struct dcache) == 208 here
(64-bit). This gives 19 objects per slab.

I packed d_mounted into a hole, and took another 4 bytes off the inline
name length to take the padding out from the end of the structure. This
shinks it to 200 bytes. I could have gone the other way and increased the
length to 40, but I'm aiming for a magic number, read on...

I then got rid of the d_cookie pointer. This shrinks it to 192 bytes. Rant:
why was this ever a good idea? The cookie system should increase its hash
size or use a tree or something if lookups are a problem. Also the "fast
dcookie lookups" in oprofile should be moved into the dcookie code -- how
can oprofile possibly care about the dcookie_mutex? It gets dropped after
get_dcookie() returns so it can't be providing any sort of protection.

At 192 bytes, 21 objects fit into a 4K page, saving about 3MB on my system
with ~140 000 entries allocated. 192 is also a multiple of 64, so we get
nice cacheline alignment on 64 and 32 byte line systems -- any given dentry
will now require 3 cachelines to touch all fields wheras previously it
would require 4.

I know the inline name size was chosen quite carefully, however with the
reduction in cacheline footprint, it should actually be just about as fast
to do a name lookup for a 36 character name as it was before the patch (and
faster for other sizes). The memory footprint savings for names which are
<= 32 or > 36 bytes long should more than make up for the memory cost for
33-36 byte names.

Performance is a feature...

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
15 years agofs: reorder struct inotify_device on 64bits to remove padding
Richard Kennedy [Thu, 4 Dec 2008 11:17:47 +0000 (11:17 +0000)] 
fs: reorder struct inotify_device on 64bits to remove padding

Reorder struct inotify_device to remove 8 bytes of padding on 64bit
builds, reducing size to 128 bytes . Therefore allocating from a smaller
slab & using one fewer cachelines.

Signed-off-by: Richard Kennedy <richard@rsk.demon.co.uk>
----
Hi,
patch against 2.6.28-rc7.
built & tested on AMDX2 desktop.

I've not been able to send this to the listed inotify maintainers, I
just get mail failures. So I guessed filesystem was the best home for
it, hope that's ok.

regards
Richard
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
15 years agointroduce new LSM hooks where vfsmount is available.
Kentaro Takeda [Wed, 17 Dec 2008 04:24:15 +0000 (13:24 +0900)] 
introduce new LSM hooks where vfsmount is available.

Add new LSM hooks for path-based checks.  Call them on directory-modifying
operations at the points where we still know the vfsmount involved.

Signed-off-by: Kentaro Takeda <takedakn@nttdata.co.jp>
Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Signed-off-by: Toshiharu Harada <haradats@nttdata.co.jp>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
15 years agoMerge branch 'master' of ../mmc
Pierre Ossman [Wed, 31 Dec 2008 18:56:05 +0000 (19:56 +0100)] 
Merge branch 'master' of ../mmc

15 years agommc: warn about voltage mismatches
David Brownell [Wed, 31 Dec 2008 17:50:30 +0000 (09:50 -0800)] 
mmc: warn about voltage mismatches

Get rid of a silent failure mode when the MMC/SD host doesn't
support the voltages needed to operate a given card, by
adding a warning.  A 3.3V host and a 3.0V card, for example,
no longer need to mysteriously just not work at all.

This isn't the best diagnostic; ideally it would also tell
what voltage the card and host support (and not just by
dumping the bitmasks).

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
15 years agommc_spi: Add support for OpenFirmware bindings
Anton Vorontsov [Tue, 30 Dec 2008 15:15:28 +0000 (18:15 +0300)] 
mmc_spi: Add support for OpenFirmware bindings

The support is implemented via platform data accessors, new module
(of_mmc_spi) will be created automatically when the driver compiles
on OpenFirmware platforms. Link-time dependency will load the module
automatically.

Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>