cascardo/linux.git
13 years agoplatform/x86: intel_mid_powerbutton needs INPUT
Randy Dunlap [Wed, 16 Feb 2011 22:31:02 +0000 (14:31 -0800)]
platform/x86: intel_mid_powerbutton needs INPUT

intel_mid_powerbtn.c uses input interfaces, so it should depend
on INPUT to fix build errors when CONFIG_INPUT is not enabled:

intel_mid_powerbtn.c:(.text+0x56ca8f): undefined reference to `input_event'
intel_mid_powerbtn.c:(.devinit.text+0x2e7b4): undefined reference to `input_allocate_device'
intel_mid_powerbtn.c:(.devinit.text+0x2e7ff): undefined reference to `input_set_capability'
intel_mid_powerbtn.c:(.devinit.text+0x2e84a): undefined reference to `input_register_device'
intel_mid_powerbtn.c:(.devinit.text+0x2e88b): undefined reference to `input_free_device'
intel_mid_powerbtn.c:(.devexit.text+0x42f0): undefined reference to `input_unregister_device'

Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
Cc: Hong Liu <hong.liu@intel.com>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
13 years agoEnable Dell All-In-One volume up/down keys
Colin Ian King [Thu, 17 Feb 2011 18:44:09 +0000 (18:44 +0000)]
Enable Dell All-In-One volume up/down keys

Enable volume up and down hotkeys on WMI events
GUID 284A0E6B-380E-472A-921F-E52786257FB4 and
GUID 02314822-307C-4F66-bf0E-48AEAEB26CC8.

Also works around a firmware bug where the _WED method
should return an integer containing the key code and in fact
the method returns the key code in element zero of a buffer.

BugLink: http://bugs.launchpad.net/bugs/701530
BugLink: http://bugs.launchpad.net/bugs/676997
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
13 years agointel_mid_powerbtn: add power button driver for Medfield platform (#3)
Hong Liu [Mon, 7 Feb 2011 19:45:55 +0000 (14:45 -0500)]
intel_mid_powerbtn: add power button driver for Medfield platform (#3)

The power button is connected to MSIC on Medfield, we will get two
interrupts from IOAPIC when pressing or releasing the power button.

Signed-off-by: Hong Liu <hong.liu@intel.com>
[Minor fixes as noted by Dmitry]
Signed-off-by: Alan Cox <alan@linux.intel.com>
Acked-by: Dmitry Torokhov <dtor@mail.ru>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
13 years agoeeepc-wmi: add camera keys
Corentin Chary [Sun, 6 Feb 2011 12:30:47 +0000 (13:30 +0100)]
eeepc-wmi: add camera keys

These keys are supposed to be handled by any software
using the camera (like webKam or cheese...). They can
also be used to actually move the camera when possible.

Signed-off-by: Corentin Chary <corentincj@iksaif.net>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
13 years agoeeepc-wmi: reorder device ids
Corentin Chary [Sun, 6 Feb 2011 12:28:43 +0000 (13:28 +0100)]
eeepc-wmi: reorder device ids

Each device seems to be in a "group" (devid >> 16 & 0xFF).

Signed-off-by: Corentin Chary <corentincj@iksaif.net>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
13 years agoeeepc-wmi: add touchpad sysfs file
Corentin Chary [Sun, 6 Feb 2011 12:28:42 +0000 (13:28 +0100)]
eeepc-wmi: add touchpad sysfs file

Signed-off-by: Corentin Chary <corentincj@iksaif.net>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
13 years agoasus-laptop: remove deprecated interfaces (lcd_switch and display_get)
Corentin Chary [Sun, 6 Feb 2011 12:27:31 +0000 (13:27 +0100)]
asus-laptop: remove deprecated interfaces (lcd_switch and display_get)

I should have done that one year ago, so it's more than
time to do it.

These two features use non-standard interfaces. There are the
only features that really need multiple path to guess what's
the right method name on a specific laptop.

Removing them allow to remove a lot of code an significantly
clean the driver.

This will affect the backlight code which won't be able to know
if the backlight is on or off.

The platform display file will also be write only (like the one
in eeepc-laptop).

Signed-off-by: Corentin Chary <corentin.chary@gmail.com>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
13 years agoasus-laptop: let WLED alone on L1400B
Corentin Chary [Sun, 6 Feb 2011 12:27:30 +0000 (13:27 +0100)]
asus-laptop: let WLED alone on L1400B

Asus took the DSDT from another model (L84F), made some change
to make it work, but forgot to remove WLED method (the laptop
doesn't have a wireless card). They even didn't change the model
name.

ref: https://bugzilla.kernel.org/show_bug.cgi?id=25712

Signed-off-by: Corentin Chary <corentin.chary@gmail.com>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
13 years agoeeepc-wmi: comments keymap to clarify the meaning of some keys
Corentin Chary [Sun, 6 Feb 2011 12:30:48 +0000 (13:30 +0100)]
eeepc-wmi: comments keymap to clarify the meaning of some keys

Found while checking PDF manuals...

Signed-off-by: Corentin Chary <corentincj@iksaif.net>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
13 years agoeeepc-wmi: real touchpad led device id is 0x001000012
Corentin Chary [Sun, 6 Feb 2011 12:28:41 +0000 (13:28 +0100)]
eeepc-wmi: real touchpad led device id is 0x001000012

Signed-off-by: Corentin Chary <corentincj@iksaif.net>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
13 years agoeeepc-wmi: respect wireless_hotplug setting
Corentin Chary [Sun, 6 Feb 2011 12:28:40 +0000 (13:28 +0100)]
eeepc-wmi: respect wireless_hotplug setting

Signed-off-by: Corentin Chary <corentincj@iksaif.net>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
13 years agoeeepc-wmi: support backlight power (bl_power) attribute
Corentin Chary [Sun, 6 Feb 2011 12:28:39 +0000 (13:28 +0100)]
eeepc-wmi: support backlight power (bl_power) attribute

Signed-off-by: Corentin Chary <corentincj@iksaif.net>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
13 years agoeeepc-wmi: set the right key code for 0xe9
Corentin Chary [Sun, 6 Feb 2011 12:28:38 +0000 (13:28 +0100)]
eeepc-wmi: set the right key code for 0xe9

This key should power off the backlight, not the display,
it is also used in acpi/video.c to do the same thing.

Signed-off-by: Corentin Chary <corentincj@iksaif.net>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
13 years agoeeepc-wmi: add wimax support
Corentin Chary [Sun, 6 Feb 2011 12:28:37 +0000 (13:28 +0100)]
eeepc-wmi: add wimax support

Signed-off-by: Corentin Chary <corentincj@iksaif.net>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
13 years agoeeepc-wmi: add camera and card reader support
Corentin Chary [Sun, 6 Feb 2011 12:28:36 +0000 (13:28 +0100)]
eeepc-wmi: add camera and card reader support

Signed-off-by: Corentin Chary <corentincj@iksaif.net>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
13 years agoeeepc-wmi: use the presence bit correctly
Corentin Chary [Sun, 6 Feb 2011 12:28:35 +0000 (13:28 +0100)]
eeepc-wmi: use the presence bit correctly

I checked some more DSDT, and it seems that I wasn't
totally right about the meaning of DSTS return value.
Bit 0 is clearly the status of the device, and I discovered
that bit 16 is set when the device is present.

Signed-off-by: Corentin Chary <corentincj@iksaif.net>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
13 years agoeeepc-wmi: reorder defines
Corentin Chary [Sun, 6 Feb 2011 12:28:34 +0000 (13:28 +0100)]
eeepc-wmi: reorder defines

Signed-off-by: Corentin Chary <corentincj@iksaif.net>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
13 years agoeeepc-wmi: switch to platform_create_bundle()
Corentin Chary [Sun, 6 Feb 2011 12:28:33 +0000 (13:28 +0100)]
eeepc-wmi: switch to platform_create_bundle()

This allow to remove ~30 lines of code.

Signed-off-by: Corentin Chary <corentincj@iksaif.net>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
13 years agoeeepc-wmi: add hibernate/resume callbacks
Corentin Chary [Sun, 6 Feb 2011 12:28:32 +0000 (13:28 +0100)]
eeepc-wmi: add hibernate/resume callbacks

Signed-off-by: Corentin Chary <corentincj@iksaif.net>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
13 years agoeeepc-wmi: add an helper using simple return codes
Corentin Chary [Sun, 6 Feb 2011 12:28:31 +0000 (13:28 +0100)]
eeepc-wmi: add an helper using simple return codes

eeepc_wmi_get_devstate returns an acpi_status, so each
call need extra logic to handle the return code. This
patch add a simple getter, returning a boolean (or a
negative error code).

Signed-off-by: Corentin Chary <corentincj@iksaif.net>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
13 years agoeeepc-wmi: return proper error code in eeepc_rfkill_set()
Corentin Chary [Sun, 6 Feb 2011 12:28:30 +0000 (13:28 +0100)]
eeepc-wmi: return proper error code in eeepc_rfkill_set()

Signed-off-by: Corentin Chary <corentincj@iksaif.net>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
13 years agoeeepc-wmi: serialize access to wmi method
Corentin Chary [Sun, 6 Feb 2011 12:28:29 +0000 (13:28 +0100)]
eeepc-wmi: serialize access to wmi method

\AMW0.WMBC, which is the main method that we use,
is not reentrant. When wireless hotpluging is enabled,
toggling the status of the wireless device using WMBC will
trigger a notification and the notification handler need to
call WMBC again to get the new status of the device, this
will trigger the following error:

ACPI Error (dswload-0802): [_T_0] Namespace lookup failure, AE_ALREADY_EXISTS
ACPI Exception: AE_ALREADY_EXISTS, During name lookup/catalog (20100428/psloop-231)
ACPI Error (psparse-0537): Method parse/execution failed [\AMW0.WMBC] (Node f7023b88), AE_ALREADY_EXISTS
ACPI: Marking method WMBC as Serialized because of AE_ALREADY_EXISTS error

Since there is currently no way to tell the acpi subsystem to mark
a method as serialized, we do it in eeepc-wmi.

Of course, we could let the first call fail, and then it would work,
but it doesn't seems really clean, and it will make the first
WMBC call return a random value.

This patch was tested on EeePc 1000H with a RaLink RT2860
wireless card using the rt2800pci driver. rt2860sta driver
seems to deadlock when we remove the pci device...

Signed-off-by: Corentin Chary <corentincj@iksaif.net>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
13 years agoeeepc-wmi: add hotplug code for Eeepc 1000H
Corentin Chary [Sun, 6 Feb 2011 12:28:28 +0000 (13:28 +0100)]
eeepc-wmi: add hotplug code for Eeepc 1000H

Implement wireless like hotplug handling (code stolen from eeepc-laptop).

Reminder: on some models rfkill is implemented by logically unplugging the
wireless card from the PCI bus. Despite sending ACPI notifications, this does
not appear to be implemented using standard ACPI hotplug - nor does the
firmware provide the _OSC method required to support native PCIe hotplug.
The only sensible choice appears to be to handle the hotplugging directly in
the platform driver.

Signed-off-by: Corentin Chary <corentincj@iksaif.net>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
13 years agoeeepc-wmi: add wlan key found on 1015P
Corentin Chary [Sun, 6 Feb 2011 12:28:27 +0000 (13:28 +0100)]
eeepc-wmi: add wlan key found on 1015P

Signed-off-by: Corentin Chary <corentincj@iksaif.net>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
13 years agoeeepc-wmi: reorder keymap
Corentin Chary [Sun, 6 Feb 2011 12:28:26 +0000 (13:28 +0100)]
eeepc-wmi: reorder keymap

Signed-off-by: Corentin Chary <corentincj@iksaif.net>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
13 years agoOLPC XO-1.5 ebook switch driver
Paul Fox [Thu, 3 Feb 2011 16:27:55 +0000 (16:27 +0000)]
OLPC XO-1.5 ebook switch driver

The OLPC XO-1.5 has an ebook switch, triggered when the laptop
screen is rotated then folding down, converting the device into ebook
form.

This switch is exposed through ACPI. Add a driver that exposes it
to userspace as an input device.

Signed-off-by: Daniel Drake <dsd@laptop.org>
Acked-by: Dmitry Torokhov <dtor@mail.ru>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
13 years agoBtrfs: fix __btrfs_map_block on 32 bit machines
Chris Mason [Mon, 28 Mar 2011 01:23:21 +0000 (21:23 -0400)]
Btrfs: fix __btrfs_map_block on 32 bit machines

Recent changes for discard support didn't compile,
this fixes them not to try and % 64 bit numbers.

Signed-off-by: Chris Mason <chris.mason@oracle.com>
13 years agobtrfs: fix possible deadlock by clearing __GFP_FS flag
Miao Xie [Sun, 27 Mar 2011 08:07:36 +0000 (16:07 +0800)]
btrfs: fix possible deadlock by clearing __GFP_FS flag

Using the GFP_HIGHUSER_MOVABLE flag to allocate the metadata's page may cause
deadlock.
  Task1
  open()
    ...
    btrfs_search_slot()
      ...
      btrfs_cow_block()
...
alloc_page()
  wait for reclaiming
shrink_slab()
  ...
  shrink_icache_memory()
    ...
    btrfs_evict_inode()
      ...
      btrfs_search_slot()

If the path is locked by task1, the deadlock happens.

So the btree's page cache is different with the file's page cache, it can not
allocate pages by GFP_HIGHUSER_MOVABLE flag, we must clear __GFP_FS flag in
GFP_HIGHUSER_MOVABLE flag.

Reported-by: Itaru Kitayama <kitayama@cl.bb4u.ne.jp>
Signed-off-by: Miao Xie <miaox@cn.fujitsu.com>
Signed-off-by: Chris Mason <chris.mason@oracle.com>
13 years agobtrfs: check link counter overflow in link(2)
Al Viro [Fri, 4 Mar 2011 17:15:18 +0000 (17:15 +0000)]
btrfs: check link counter overflow in link(2)

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Chris Mason <chris.mason@oracle.com>
13 years agobtrfs: don't mess with i_nlink of unlocked inode in rename()
Al Viro [Fri, 4 Mar 2011 17:14:37 +0000 (17:14 +0000)]
btrfs: don't mess with i_nlink of unlocked inode in rename()

old_inode is not locked; it's not safe to play with its link
count.  Instead of bumping it and calling btrfs_unlink_inode(),
add a variant of the latter that does not do btrfs_drop_nlink()/
btrfs_update_inode(), call it instead of btrfs_inc_nlink()/
btrfs_unlink_inode() and do btrfs_update_inode() ourselves.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Chris Mason <chris.mason@oracle.com>
13 years agoBtrfs: check return value of btrfs_alloc_path()
Tsutomu Itoh [Tue, 1 Mar 2011 06:48:31 +0000 (06:48 +0000)]
Btrfs: check return value of btrfs_alloc_path()

Adding the check on the return value of btrfs_alloc_path() to several places.
And, some of callers are modified by this change.

Signed-off-by: Tsutomu Itoh <t-itoh@jp.fujitsu.com>
Signed-off-by: Chris Mason <chris.mason@oracle.com>
13 years agoBtrfs: fix OOPS of empty filesystem after balance
liubo [Mon, 7 Mar 2011 02:13:14 +0000 (02:13 +0000)]
Btrfs: fix OOPS of empty filesystem after balance

btrfs will remove unused block groups after balance.
When a empty filesystem is balanced, the block group with tag "DATA" may be
dropped, and after umount and mount again, it will not find "DATA" space_info
and lead to OOPS.
So we initial the necessary space_infos(DATA, SYSTEM, METADATA) to avoid OOPS.

Reported-by: Daniel J Blueman <daniel.blueman@gmail.com>
Signed-off-by: Liu Bo <liubo2009@cn.fujitsu.com>
Signed-off-by: Chris Mason <chris.mason@oracle.com>
13 years agoBtrfs: fix memory leak of empty filesystem after balance
liubo [Mon, 7 Mar 2011 02:13:33 +0000 (02:13 +0000)]
Btrfs: fix memory leak of empty filesystem after balance

After Josef's patch(commit 3c14874acc71180553fb5aba528e3cf57c5b958b),
btrfs will exclude super bytes when reading block groups(by marking a extent
state UPTODATE).  However, these bytes do not get freed while balance remove
unused block groups, and we won't process those removed ones any more, when
we do umount and unload the btrfs module,  btrfs hits a memory leak.

This patch add the missing free operation.

Reproduce steps:
$ mkfs.btrfs disk
$ mount disk /mnt/btrfs -o loop
$ btrfs filesystem balance /mnt/btrfs
$ umount /mnt/btrfs
$ rmmod btrfs

Signed-off-by: Liu Bo <liubo2009@cn.fujitsu.com>
Signed-off-by: Chris Mason <chris.mason@oracle.com>
13 years agoBtrfs: fix return value of setflags ioctl
liubo [Thu, 24 Feb 2011 09:38:16 +0000 (09:38 +0000)]
Btrfs: fix return value of setflags ioctl

setflags ioctl should return error when any checks fail.

Signed-off-by: Liu Bo <liubo2009@cn.fujitsu.com>
Reviewed-by: David Sterba <dsterba@suse.cz>
Signed-off-by: Chris Mason <chris.mason@oracle.com>
13 years agoBtrfs: fix uncheck memory allocations
Yoshinori Sano [Tue, 15 Feb 2011 12:01:42 +0000 (12:01 +0000)]
Btrfs: fix uncheck memory allocations

To make Btrfs code more robust, several return value checks where memory
allocation can fail are introduced. I use BUG_ON where I don't know how
to handle the error properly, which increases the number of using the
notorious BUG_ON, though.

Signed-off-by: Yoshinori Sano <yoshinori.sano@gmail.com>
Signed-off-by: Chris Mason <chris.mason@oracle.com>
13 years agobtrfs: make inode ref log recovery faster
liubo [Sat, 26 Mar 2011 12:01:12 +0000 (08:01 -0400)]
btrfs: make inode ref log recovery faster

When we recover from crash via write-ahead log tree and process
the inode refs, for each btrfs_inode_ref item, we will
1) check if we already have a perfect match in fs/file tree, if
   we have, then we're done.
2) search the corresponding back reference in fs/file tree, and
   check all the names in this back reference to see if they are
   also in the log to avoid conflict corners.
3) recover the logged inode refs to fs/file tree.

In current btrfs, however,
- for 2)'s check, once is enough, since the checked back reference
  will remain unchanged after processing all the inode refs belonged
  to the key.
- it has no need to do another 1) between 2) and 3).

I've made a small test to show how it improves,

$dd if=/dev/zero of=foobar bs=4K count=1
$sync
$make 100 hard links continuously, like ln foobar link_i
$fsync foobar
$echo b > /proc/sysrq-trigger
after reboot
$time mount DEV PATH

without patch:
real    0m0.285s
user    0m0.001s
sys     0m0.009s

with patch:
real    0m0.123s
user    0m0.000s
sys     0m0.010s

Changelog v1->v2:
- fix double free - pointed by David Sterba
Changelog v2->v3:
- adjust free order

Signed-off-by: Liu Bo <liubo2009@cn.fujitsu.com>
Signed-off-by: Chris Mason <chris.mason@oracle.com>
13 years agoBtrfs: add btrfs_trim_fs() to handle FITRIM
Li Dongyang [Thu, 24 Mar 2011 10:24:28 +0000 (10:24 +0000)]
Btrfs: add btrfs_trim_fs() to handle FITRIM

We take an free extent out from allocator, trim it, then put it back,
but before we trim the block group, we should make sure the block group is
cached, so plus a little change to make cache_block_group() run without a
transaction.

Signed-off-by: Li Dongyang <lidongyang@novell.com>
Signed-off-by: Chris Mason <chris.mason@oracle.com>
13 years agoBtrfs: adjust btrfs_discard_extent() return errors and trimmed bytes
Li Dongyang [Thu, 24 Mar 2011 10:24:27 +0000 (10:24 +0000)]
Btrfs: adjust btrfs_discard_extent() return errors and trimmed bytes

Callers of btrfs_discard_extent() should check if we are mounted with -o discard,
as we want to make fitrim to work even the fs is not mounted with -o discard.
Also we should use REQ_DISCARD to map the free extent to get a full mapping,
last we only return errors if
1. the error is not a EOPNOTSUPP
2. no device supports discard

Signed-off-by: Li Dongyang <lidongyang@novell.com>
Signed-off-by: Chris Mason <chris.mason@oracle.com>
13 years agoBtrfs: make btrfs_map_block() return entire free extent for each device of RAID0...
Li Dongyang [Thu, 24 Mar 2011 10:24:26 +0000 (10:24 +0000)]
Btrfs: make btrfs_map_block() return entire free extent for each device of RAID0/1/10/DUP

btrfs_map_block() will only return a single stripe length, but we want the
full extent be mapped to each disk when we are trimming the extent,
so we add length to btrfs_bio_stripe and fill it if we are mapping for REQ_DISCARD.

Signed-off-by: Li Dongyang <lidongyang@novell.com>
Signed-off-by: Chris Mason <chris.mason@oracle.com>
13 years agoBtrfs: make update_reserved_bytes() public
Li Dongyang [Thu, 24 Mar 2011 10:24:25 +0000 (10:24 +0000)]
Btrfs: make update_reserved_bytes() public

Make the function public as we should update the reserved extents calculations
after taking out an extent for trimming.

Signed-off-by: Li Dongyang <lidongyang@novell.com>
Signed-off-by: Chris Mason <chris.mason@oracle.com>
13 years agobtrfs: return EXDEV when linking from different subvolumes
Mark Fasheh [Tue, 22 Mar 2011 17:20:26 +0000 (17:20 +0000)]
btrfs: return EXDEV when linking from different subvolumes

btrfs_link returns EPERM if a cross-subvolume link is attempted.

However, in this case I believe EXDEV to be the more appropriate value.
>From the link(2) man page:

EXDEV  oldpath and newpath are not on the same mounted file system.  (Linux
       permits a file system to be mounted at multiple points, but link()
       does not work across different mount points, even if the same file
       system is mounted on both.)

This matters because an application may have different behaviors based on
return codes.

Signed-off-by: Mark Fasheh <mfasheh@suse.com>
Signed-off-by: Chris Mason <chris.mason@oracle.com>
13 years agoBtrfs: Per file/directory controls for COW and compression
Liu Bo [Tue, 22 Mar 2011 10:12:20 +0000 (10:12 +0000)]
Btrfs: Per file/directory controls for COW and compression

Data compression and data cow are controlled across the entire FS by mount
options right now.  ioctls are needed to set this on a per file or per
directory basis.  This has been proposed previously, but VFS developers
wanted us to use generic ioctls rather than btrfs-specific ones.

According to Chris's comment, there should be just one true compression
method(probably LZO) stored in the super.  However, before this, we would
wait for that one method is stable enough to be adopted into the super.
So I list it as a long term goal, and just store it in ram today.

After applying this patch, we can use the generic "FS_IOC_SETFLAGS" ioctl to
control file and directory's datacow and compression attribute.

NOTE:
 - The compression type is selected by such rules:
   If we mount btrfs with compress options, ie, zlib/lzo, the type is it.
   Otherwise, we'll use the default compress type (zlib today).

v1->v2:
- rebase to the latest btrfs.
v2->v3:
- fix a problem, i.e. when a file is set NOCOW via mount option, then this NOCOW
  will be screwed by inheritance from parent directory.

Signed-off-by: Liu Bo <liubo2009@cn.fujitsu.com>
Signed-off-by: Chris Mason <chris.mason@oracle.com>
13 years agoBtrfs: add datacow flag in inode flag
liubo [Mon, 21 Mar 2011 08:54:27 +0000 (08:54 +0000)]
Btrfs: add datacow flag in inode flag

For datacow control, the corresponding inode flags are needed.
This is for btrfs use.

v1->v2:
Change FS_COW_FL to another bit due to conflict with the upstream e2fsprogs

Signed-off-by: Liu Bo <liubo2009@cn.fujitsu.com>
Signed-off-by: Chris Mason <chris.mason@oracle.com>
13 years agobtrfs: use GFP_NOFS instead of GFP_KERNEL
Miao Xie [Thu, 24 Mar 2011 11:41:21 +0000 (11:41 +0000)]
btrfs: use GFP_NOFS instead of GFP_KERNEL

In the filesystem context, we must allocate memory by GFP_NOFS,
or we may start another filesystem operation and make kswap thread hang up.

Signed-off-by: Miao Xie <miaox@cn.fujitsu.com>
Signed-off-by: Chris Mason <chris.mason@oracle.com>
13 years agoBtrfs: check return value of read_tree_block()
Tsutomu Itoh [Thu, 24 Mar 2011 06:33:21 +0000 (06:33 +0000)]
Btrfs: check return value of read_tree_block()

This patch is checking return value of read_tree_block(),
and if it is NULL, error processing.

Signed-off-by: Tsutomu Itoh <t-itoh@jp.fujitsu.com>
Signed-off-by: Chris Mason <chris.mason@oracle.com>
13 years agobtrfs: properly access unaligned checksum buffer
David Sterba [Fri, 18 Mar 2011 22:56:43 +0000 (22:56 +0000)]
btrfs: properly access unaligned checksum buffer

On Fri, Mar 18, 2011 at 11:56:53AM -0400, Chris Mason wrote:
> Thanks for fielding this one.  Does put_unaligned_le32 optimize away on
> platforms with efficient access?  It would be great if we didn't need
> the #ifdef.

(quicktest: assembly output is same for put_unaligned_le32 and direct
assignment on my x86_64)
I was originally following examples in
Documentation/unaligned-memory-access.txt. From other code it seems to me that
the define CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS is intended for larger
portions of code. Macros/wrappers for {put,get}_unaligned* are chosen via
arch/<arch>/include/asm/unaligned.h accordingly, therefore it's safe to use
put_unaligned_le32 without the ifdef.

dave

Signed-off-by: Chris Mason <chris.mason@oracle.com>
13 years agoBtrfs: cleanup some BUG_ON()
Tsutomu Itoh [Wed, 23 Mar 2011 08:14:16 +0000 (08:14 +0000)]
Btrfs: cleanup some BUG_ON()

This patch changes some BUG_ON() to the error return.
(but, most callers still use BUG_ON())

Signed-off-by: Tsutomu Itoh <t-itoh@jp.fujitsu.com>
Signed-off-by: Chris Mason <chris.mason@oracle.com>
13 years agoBtrfs: add initial tracepoint support for btrfs
liubo [Thu, 24 Mar 2011 11:18:59 +0000 (11:18 +0000)]
Btrfs: add initial tracepoint support for btrfs

Tracepoints can provide insight into why btrfs hits bugs and be greatly
helpful for debugging, e.g
              dd-7822  [000]  2121.641088: btrfs_inode_request: root = 5(FS_TREE), gen = 4, ino = 256, blocks = 8, disk_i_size = 0, last_trans = 8, logged_trans = 0
              dd-7822  [000]  2121.641100: btrfs_inode_new: root = 5(FS_TREE), gen = 8, ino = 257, blocks = 0, disk_i_size = 0, last_trans = 0, logged_trans = 0
 btrfs-transacti-7804  [001]  2146.935420: btrfs_cow_block: root = 2(EXTENT_TREE), refs = 2, orig_buf = 29368320 (orig_level = 0), cow_buf = 29388800 (cow_level = 0)
 btrfs-transacti-7804  [001]  2146.935473: btrfs_cow_block: root = 1(ROOT_TREE), refs = 2, orig_buf = 29364224 (orig_level = 0), cow_buf = 29392896 (cow_level = 0)
 btrfs-transacti-7804  [001]  2146.972221: btrfs_transaction_commit: root = 1(ROOT_TREE), gen = 8
   flush-btrfs-2-7821  [001]  2155.824210: btrfs_chunk_alloc: root = 3(CHUNK_TREE), offset = 1103101952, size = 1073741824, num_stripes = 1, sub_stripes = 0, type = DATA
   flush-btrfs-2-7821  [001]  2155.824241: btrfs_cow_block: root = 2(EXTENT_TREE), refs = 2, orig_buf = 29388800 (orig_level = 0), cow_buf = 29396992 (cow_level = 0)
   flush-btrfs-2-7821  [001]  2155.824255: btrfs_cow_block: root = 4(DEV_TREE), refs = 2, orig_buf = 29372416 (orig_level = 0), cow_buf = 29401088 (cow_level = 0)
   flush-btrfs-2-7821  [000]  2155.824329: btrfs_cow_block: root = 3(CHUNK_TREE), refs = 2, orig_buf = 20971520 (orig_level = 0), cow_buf = 20975616 (cow_level = 0)
 btrfs-endio-wri-7800  [001]  2155.898019: btrfs_cow_block: root = 5(FS_TREE), refs = 2, orig_buf = 29384704 (orig_level = 0), cow_buf = 29405184 (cow_level = 0)
 btrfs-endio-wri-7800  [001]  2155.898043: btrfs_cow_block: root = 7(CSUM_TREE), refs = 2, orig_buf = 29376512 (orig_level = 0), cow_buf = 29409280 (cow_level = 0)

Here is what I have added:

1) ordere_extent:
        btrfs_ordered_extent_add
        btrfs_ordered_extent_remove
        btrfs_ordered_extent_start
        btrfs_ordered_extent_put

These provide critical information to understand how ordered_extents are
updated.

2) extent_map:
        btrfs_get_extent

extent_map is used in both read and write cases, and it is useful for tracking
how btrfs specific IO is running.

3) writepage:
        __extent_writepage
        btrfs_writepage_end_io_hook

Pages are cirtical resourses and produce a lot of corner cases during writeback,
so it is valuable to know how page is written to disk.

4) inode:
        btrfs_inode_new
        btrfs_inode_request
        btrfs_inode_evict

These can show where and when a inode is created, when a inode is evicted.

5) sync:
        btrfs_sync_file
        btrfs_sync_fs

These show sync arguments.

6) transaction:
        btrfs_transaction_commit

In transaction based filesystem, it will be useful to know the generation and
who does commit.

7) back reference and cow:
btrfs_delayed_tree_ref
btrfs_delayed_data_ref
btrfs_delayed_ref_head
btrfs_cow_block

Btrfs natively supports back references, these tracepoints are helpful on
understanding btrfs's COW mechanism.

8) chunk:
btrfs_chunk_alloc
btrfs_chunk_free

Chunk is a link between physical offset and logical offset, and stands for space
infomation in btrfs, and these are helpful on tracing space things.

9) reserved_extent:
btrfs_reserved_extent_alloc
btrfs_reserved_extent_free

These can show how btrfs uses its space.

Signed-off-by: Liu Bo <liubo2009@cn.fujitsu.com>
Signed-off-by: Chris Mason <chris.mason@oracle.com>
13 years agoBtrfs: use RCU instead of a spinlock to protect the root node
Chris Mason [Wed, 23 Mar 2011 18:54:42 +0000 (14:54 -0400)]
Btrfs: use RCU instead of a spinlock to protect the root node

The pointer to the extent buffer for the root of each tree
is protected by a spinlock so that we can safely read the pointer
and take a reference on the extent buffer.

But now that the extent buffers are freed via RCU, we can safely
use rcu_read_lock instead.

Signed-off-by: Chris Mason <chris.mason@oracle.com>
13 years agoARM: Suspend: Fix dependency of ARCH_SUSPEND_POSSIBLE
Kukjin Kim [Fri, 25 Mar 2011 11:09:26 +0000 (20:09 +0900)]
ARM: Suspend: Fix dependency of ARCH_SUSPEND_POSSIBLE

The current mainline codes of ARCH_S5P64X0 and ARCH_S5P6442
can not support suspend to ram. So needs this for preventing
build error on them.

Cc: Russell King <rmk+kernel@arm.linux.org.uk>
Cc: Rafael J. Wysocki <rjw@sisk.pl>
Cc: Len Brown <len.brown@intel.com>
Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
13 years agoARM: SAMSUNG: Fix CPU idmask
Kukjin Kim [Wed, 23 Mar 2011 05:45:29 +0000 (14:45 +0900)]
ARM: SAMSUNG: Fix CPU idmask

This patch fixes CPU idmask of S5P64X0 and EXYNOS4210
and its comparison method because just want to use CPU
id for it.

Cc: Ben Dooks <ben-linux@fluff.org>
Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
13 years agoARM: EXYNOS4: Fix addruart macro
Thomas Abraham [Fri, 25 Mar 2011 07:18:18 +0000 (16:18 +0900)]
ARM: EXYNOS4: Fix addruart macro

Fix incorrect conditional execution of ldr instructions in
addruart macro.

Signed-off-by: Thomas Abraham <thomas.abraham@samsung.com>
Signed-off-by: Abhilash Kesavan <a.kesavan@samsung.com>
Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
13 years agoARM: EXYNOS4: Fix smsc9215 irq polarity on SMDKC210
Jeongtae Park [Fri, 25 Mar 2011 06:48:15 +0000 (15:48 +0900)]
ARM: EXYNOS4: Fix smsc9215 irq polarity on SMDKC210

This patch fixes smsc9215 irq ploarity configuration of SMDKC210.
We can change type of EINT(5) as HIGH, but it's better to change
IRQ output of smsc9215 as an active low because smsc's IRQ line
has been pull-up.

Signed-off-by: Jeongtae Park <jtp.park@samsung.com>
Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
13 years agoARM: EXYNOS4: Fix smsc9215 irq polarity on SMDKV310
Jeongtae Park [Fri, 25 Mar 2011 06:48:15 +0000 (15:48 +0900)]
ARM: EXYNOS4: Fix smsc9215 irq polarity on SMDKV310

This patch fixes smsc9215 irq ploarity configuration of SMDKV310.
We can change type of EINT(5) as HIGH, but it's better to change
IRQ output of smsc9215 as an active low because smsc's IRQ line
has been pull-up.

Signed-off-by: Jeongtae Park <jtp.park@samsung.com>
Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
13 years agoARM: EXYNOS4: Fix build warning on regarding SATA_AHCI_PLATFORM
Kukjin Kim [Fri, 25 Mar 2011 01:46:16 +0000 (10:46 +0900)]
ARM: EXYNOS4: Fix build warning on regarding SATA_AHCI_PLATFORM

This patch fixes following build warnings.

warning: (MACH_ARMLEX4210) selects SATA_AHCI_PLATFORM
          which has unmet direct dependencies (ATA)

And adds EXYNOX4_DEV_AHCI for building machines which are
not suppoort for AHCI feature on board.

Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
13 years agoARM: S5PV210: Remove duplicated inclusion
Huang Weiyi [Wed, 23 Mar 2011 06:29:32 +0000 (15:29 +0900)]
ARM: S5PV210: Remove duplicated inclusion

Remove duplicated #include('s) in
  arch/arm/mach-s5pv210/mach-smdkv210.c

Signed-off-by: Huang Weiyi <weiyi.huang@gmail.com>
Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
13 years agoARM: S5PV210: Fix security engine interrupt names
Vladimir Zapolskiy [Wed, 23 Mar 2011 06:08:17 +0000 (15:08 +0900)]
ARM: S5PV210: Fix security engine interrupt names

This change is intended to correct security subsystem interrupt names
for Samsung S5PV210 and S5PC110 SoCs.

Signed-off-by: Vladimir Zapolskiy <vzapolskiy@gmail.com>
Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
13 years agoARM: S5P64X0: Fix iodesc array size for S5P6450
Banajit Goswami [Fri, 18 Mar 2011 11:45:22 +0000 (17:15 +0530)]
ARM: S5P64X0: Fix iodesc array size for S5P6450

The array size parameter of iotable_init for S5P6450 is incorrect.
Fix this by passing the correct length of s5p6450_iodesc table.

Signed-off-by: Banajit Goswami <banajit.g@samsung.com>
Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
13 years agomach-ux500: configure board for the TPS61052 regulator v2
Linus Walleij [Mon, 7 Mar 2011 10:48:15 +0000 (11:48 +0100)]
mach-ux500: configure board for the TPS61052 regulator v2

This registers the TPS61052 regulator to the ux500 MOP/HREF boards.

Cc: Samuel Ortiz <samuel.ortiz@intel.com>
Cc: Liam Girdwood <lrg@slimlogic.co.uk>
Cc: Mark Brown <broonie@opensource.wolfsonmicro.com>
Cc: Ola Lilja <ola.o.lilja@stericsson.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
13 years agoeCryptfs: write lock requested keys
Roberto Sassu [Mon, 21 Mar 2011 15:00:55 +0000 (16:00 +0100)]
eCryptfs: write lock requested keys

A requested key is write locked in order to prevent modifications on the
authentication token while it is being used.

Signed-off-by: Roberto Sassu <roberto.sassu@polito.it>
Signed-off-by: Tyler Hicks <tyhicks@linux.vnet.ibm.com>
13 years agoeCryptfs: move ecryptfs_find_auth_tok_for_sig() call before mutex_lock
Roberto Sassu [Mon, 21 Mar 2011 15:00:54 +0000 (16:00 +0100)]
eCryptfs: move ecryptfs_find_auth_tok_for_sig() call before mutex_lock

The ecryptfs_find_auth_tok_for_sig() call is moved before the
mutex_lock(s->tfm_mutex) instruction in order to avoid possible deadlocks
that may occur by holding the lock on the two semaphores 'key->sem' and
's->tfm_mutex' in reverse order.

Signed-off-by: Roberto Sassu <roberto.sassu@polito.it>
Signed-off-by: Tyler Hicks <tyhicks@linux.vnet.ibm.com>
13 years agoeCryptfs: verify authentication tokens before their use
Roberto Sassu [Mon, 21 Mar 2011 15:00:53 +0000 (16:00 +0100)]
eCryptfs: verify authentication tokens before their use

Authentication tokens content may change if another requestor calls the
update() method of the corresponding key. The new function
ecryptfs_verify_auth_tok_from_key() retrieves the authentication token from
the provided key and verifies if it is still valid before being used to
encrypt or decrypt an eCryptfs file.

Signed-off-by: Roberto Sassu <roberto.sassu@polito.it>
[tyhicks: Minor formatting changes]
Signed-off-by: Tyler Hicks <tyhicks@linux.vnet.ibm.com>
13 years agoeCryptfs: modified size of keysig in the ecryptfs_key_sig structure
Roberto Sassu [Mon, 21 Mar 2011 15:00:52 +0000 (16:00 +0100)]
eCryptfs: modified size of keysig in the ecryptfs_key_sig structure

The size of the 'keysig' array is incremented of one byte in order to make
room for the NULL character. The 'keysig' variable is used, in the function
ecryptfs_generate_key_packet_set(), to find an authentication token with
the given signature and is printed a debug message if it cannot be
retrieved.

Signed-off-by: Roberto Sassu <roberto.sassu@polito.it>
Signed-off-by: Tyler Hicks <tyhicks@linux.vnet.ibm.com>
13 years agoeCryptfs: removed num_global_auth_toks from ecryptfs_mount_crypt_stat
Roberto Sassu [Mon, 21 Mar 2011 15:00:51 +0000 (16:00 +0100)]
eCryptfs: removed num_global_auth_toks from ecryptfs_mount_crypt_stat

This patch removes the 'num_global_auth_toks' field of the
ecryptfs_mount_crypt_stat structure, used to count the number of items in
the 'global_auth_tok_list' list. This variable is not needed because there
are no checks based upon it.

Signed-off-by: Roberto Sassu <roberto.sassu@polito.it>
Signed-off-by: Tyler Hicks <tyhicks@linux.vnet.ibm.com>
13 years agoeCryptfs: ecryptfs_keyring_auth_tok_for_sig() bug fix
Roberto Sassu [Thu, 17 Mar 2011 11:48:50 +0000 (12:48 +0100)]
eCryptfs: ecryptfs_keyring_auth_tok_for_sig() bug fix

The pointer '(*auth_tok_key)' is set to NULL in case request_key()
fails, in order to prevent its use by functions calling
ecryptfs_keyring_auth_tok_for_sig().

Signed-off-by: Roberto Sassu <roberto.sassu@polito.it>
Cc: <stable@kernel.org>
Signed-off-by: Tyler Hicks <tyhicks@linux.vnet.ibm.com>
13 years agoeCryptfs: Unlock page in write_begin error path
Tyler Hicks [Wed, 9 Mar 2011 17:49:13 +0000 (11:49 -0600)]
eCryptfs: Unlock page in write_begin error path

Unlock the page in error path of ecryptfs_write_begin(). This may
happen, for example, if decryption fails while bring the page
up-to-date.

Cc: <stable@kernel.org>
Signed-off-by: Tyler Hicks <tyhicks@linux.vnet.ibm.com>
13 years agoecryptfs: modify write path to encrypt page in writepage
Thieu Le [Wed, 9 Mar 2011 00:26:03 +0000 (16:26 -0800)]
ecryptfs: modify write path to encrypt page in writepage

Change the write path to encrypt the data only when the page is written to
disk in ecryptfs_writepage. Previously, ecryptfs encrypts the page in
ecryptfs_write_end which means that if there are multiple write requests to
the same page, ecryptfs ends up re-encrypting that page over and over again.
This patch minimizes the number of encryptions needed.

Signed-off-by: Thieu Le <thieule@chromium.org>
[tyhicks: Changed NULL .drop_inode sop pointer to generic_drop_inode]
Signed-off-by: Tyler Hicks <tyhicks@linux.vnet.ibm.com>
13 years agoeCryptfs: Remove ECRYPTFS_NEW_FILE crypt stat flag
Tyler Hicks [Wed, 23 Feb 2011 06:54:20 +0000 (00:54 -0600)]
eCryptfs: Remove ECRYPTFS_NEW_FILE crypt stat flag

Now that grow_file() is not called in the ecryptfs_create() path, the
ECRYPTFS_NEW_FILE flag is no longer needed. It helped
ecryptfs_readpage() know not to decrypt zeroes that were read from the
lower file in the grow_file() path.

Signed-off-by: Tyler Hicks <tyhicks@linux.vnet.ibm.com>
13 years agoeCryptfs: Remove unnecessary grow_file() function
Tyler Hicks [Wed, 23 Feb 2011 06:14:19 +0000 (00:14 -0600)]
eCryptfs: Remove unnecessary grow_file() function

When creating a new eCryptfs file, the crypto metadata is written out
and then the lower file was being "grown" with 4 kB of encrypted zeroes.
I suspect that growing the encrypted file was to prevent an information
leak that the unencrypted file was empty. However, the unencrypted file
size is stored, in plaintext, in the metadata so growing the file is
unnecessary.

Signed-off-by: Tyler Hicks <tyhicks@linux.vnet.ibm.com>
13 years agomach-ux500: provide ab8500 init vector
Bengt Jonsson [Wed, 9 Mar 2011 12:34:17 +0000 (13:34 +0100)]
mach-ux500: provide ab8500 init vector

This adds an ab8500 regulator initialization vector for the
HREF/MOP500 series of boards. This also sets the display
regulator to be on at boot so we don't loose our splash
screen when the board comes up.

Signed-off-by: Bengt Jonsson <bengt.g.jonsson@stericsson.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
13 years agomach-ux500: board support for AB8500 GPIO driver
Bibek Basu [Tue, 15 Feb 2011 07:26:16 +0000 (12:56 +0530)]
mach-ux500: board support for AB8500 GPIO driver

This is the board support patch for ab8500 gpio driver
on mach-ux500.Patch implements 16 virtual
IRQ mapped to 16 interrupt capable AB8500 GPIOs.

Signed-off-by: Bibek Basu <bibek.basu@stericsson.com>
[Modify for header file placement]
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
13 years agogpio: driver for 42 AB8500 GPIO pins
Bibek Basu [Wed, 9 Feb 2011 05:32:35 +0000 (11:02 +0530)]
gpio: driver for 42 AB8500 GPIO pins

To get rid of port expanders, the free GPIOs of ab8500
can be used. There are 42 GPIO pins. Out of which 16
are interrupt capable.This patch implements 16 virtual
IRQ mapped to 16 interrupt capable AB8500 GPIOs.

Signed-off-by: Bibek Basu <bibek.basu@stericsson.com>
Acked-by: Grant Likely <grant.likely@secretlab.ca>
[Renamed header file as per MFD structure]
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
13 years agonet: fix ethtool->set_flags not intended -EINVAL return value
Stanislaw Gruszka [Tue, 22 Mar 2011 23:54:49 +0000 (23:54 +0000)]
net: fix ethtool->set_flags not intended -EINVAL return value

After commit d5dbda23804156ae6f35025ade5307a49d1db6d7 "ethtool: Add
support for vlan accleration.", drivers that have NETIF_F_HW_VLAN_TX,
and/or NETIF_F_HW_VLAN_RX feature, but do not allow enable/disable vlan
acceleration via ethtool set_flags, always return -EINVAL from that
function. Fix by returning -EINVAL only if requested features do not
match current settings and can not be changed by driver.

Change any driver that define ethtool->set_flags to use
ethtool_invalid_flags() to avoid similar problems in the future
(also on drivers that do not have the problem).

Tested with modified (to reproduce this bug) myri10ge driver.

Cc: stable@kernel.org # 2.6.37+
Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agomlx4_en: Fix loss of promiscuity
Herbert Xu [Sun, 27 Mar 2011 01:01:26 +0000 (01:01 +0000)]
mlx4_en: Fix loss of promiscuity

The mlx4_en driver uses the combination stop_port/start_port
in a number of places.  Unfortunately that causes any promiscuous
mode settings on the hardware to be lost.

This patch fixes that problem.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agotg3: Fix inline keyword usage
Javier Martinez Canillas [Sat, 26 Mar 2011 16:42:33 +0000 (16:42 +0000)]
tg3: Fix inline keyword usage

The correct usage is "static inline void" not "static void inline".

Signed-off-by: Javier Martinez Canillas <martinez.javier@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agotg3: use <linux/io.h> and <linux/uaccess.h> instead <asm/io.h> and <asm/uaccess.h>
Javier Martinez Canillas [Sat, 26 Mar 2011 16:42:31 +0000 (16:42 +0000)]
tg3: use <linux/io.h> and <linux/uaccess.h> instead <asm/io.h> and <asm/uaccess.h>

It is proper style to include linux/foo.h instead asm/foo.h if both exist

Signed-off-by: Javier Martinez Canillas <martinez.javier@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agonet: use CHECKSUM_NONE instead of magic number
Cesar Eduardo Barros [Sat, 26 Mar 2011 05:10:30 +0000 (05:10 +0000)]
net: use CHECKSUM_NONE instead of magic number

Two places in the kernel were doing skb->ip_summed = 0.

Change both to skb->ip_summed = CHECKSUM_NONE, which is more readable.

Signed-off-by: Cesar Eduardo Barros <cesarb@cesarb.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agoNet / jme: Do not use legacy PCI power management
Rafael J. Wysocki [Sat, 26 Mar 2011 01:34:06 +0000 (01:34 +0000)]
Net / jme: Do not use legacy PCI power management

The jme driver uses the legacy PCI power management, so it has to do
some PCI-specific things in its ->suspend() and ->resume() callbacks,
which isn't necessary and should better be done by the PCI
sybsystem-level power management code.  It also doesn't use device
wakeup flags correctly.

Convert jme to the new PCI power management framework and make it
let the PCI subsystem take care of all the PCI-specific aspects of
device handling during system power transitions.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agomyri10ge: small rx_done refactoring
Stanislaw Gruszka [Fri, 25 Mar 2011 01:21:51 +0000 (01:21 +0000)]
myri10ge: small rx_done refactoring

Avoid theoretical race condition regarding accessing dev->features
NETIF_F_LRO flag, which is illustrated below.

CPU1 CPU2

myri10ge_clean_rx_done(): myri10ge_set_flags():
or
myri10ge_set_rx_csum():

if (dev->features & NETIF_F_LRO)
        setup lro
dev->features |= NETIF_F_LRO
or
dev->features &= ~NETIF_F_LRO;
if (dev->features & NETIF_F_LRO)
        flush lro

On the way reduce myri10ge_rx_done() number of arguments and calls by
moving mgp->small_bytes check into that function. That reduce code size

from:
   text    data     bss     dec     hex filename
  36644     248     100   36992    9080 drivers/net/myri10ge/myri10ge.o

to:
   text    data     bss     dec     hex filename
  36037     247     100   36384    8e20 drivers/net/myri10ge/myri10ge.o

on my i686 system, what should also make myri10ge_clean_rx_done()
being faster.

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agobridge: notify applications if address of bridge device changes
stephen hemminger [Thu, 24 Mar 2011 13:24:01 +0000 (13:24 +0000)]
bridge: notify applications if address of bridge device changes

The mac address of the bridge device may be changed when a new interface
is added to the bridge. If this happens, then the bridge needs to call
the network notifiers to tickle any other systems that care. Since bridge
can be a module, this also means exporting the notifier function.

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agoipv4: Fix IP timestamp option (IPOPT_TS_PRESPEC) handling in ip_options_echo()
Jan Luebbe [Thu, 24 Mar 2011 07:44:22 +0000 (07:44 +0000)]
ipv4: Fix IP timestamp option (IPOPT_TS_PRESPEC) handling in ip_options_echo()

The current handling of echoed IP timestamp options with prespecified
addresses is rather broken since the 2.2.x kernels. As far as i understand
it, it should behave like when originating packets.

Currently it will only timestamp the next free slot if:
 - there is space for *two* timestamps
 - some random data from the echoed packet taken as an IP is *not* a local IP

This first is caused by an off-by-one error. 'soffset' points to the next
free slot and so we only need to have 'soffset + 7 <= optlen'.

The second bug is using sptr as the start of the option, when it really is
set to 'skb_network_header(skb)'. I just use dptr instead which points to
the timestamp option.

Finally it would only timestamp for non-local IPs, which we shouldn't do.
So instead we exclude all unicast destinations, similar to what we do in
ip_options_compile().

Signed-off-by: Jan Luebbe <jluebbe@debian.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agocan: c_can: Fix tx_bytes accounting
Jan Altenberg [Mon, 28 Mar 2011 01:24:10 +0000 (18:24 -0700)]
can: c_can: Fix tx_bytes accounting

The current SocketCAN implementation for the Bosch c_can cell doesn't
account the TX bytes correctly, because it calls
c_can_inval_msg_object() (which clears the msg ctrl register) before
reading the DLC value:

for (/* nix */; (priv->tx_next - priv->tx_echo) > 0; priv->tx_echo++) {
        msg_obj_no = get_tx_echo_msg_obj(priv);
        c_can_inval_msg_object(dev, 0, msg_obj_no);
        val = c_can_read_reg32(priv, &priv->regs->txrqst1);
        if (!(val & (1 << msg_obj_no))) {
                can_get_echo_skb(dev,
                                msg_obj_no - C_CAN_MSG_OBJ_TX_FIRST);
                stats->tx_bytes += priv->read_reg(priv,
                                &priv->regs->ifregs[0].msg_cntrl)
                                & IF_MCONT_DLC_MASK;
                stats->tx_packets++;
        }
}

So, we will always read 0 for the DLC value and "ifconfig" will report
*0* TX Bytes.

The fix is quite easy: Just move c_can_inval_msg_object() to the end of
the if() statement. So:
      * We only call c_can_inval_msg_object() if the message was
        actually transmitted
      * We read out the DLC value _before_ clearing the msg ctrl
        register

Signed-off-by: Jan Altenberg <jan@linutronix.de>
Acked-by: Kurt Van Dijck <kurt.van.dijck@eia.be>
Acked-by: Wolfgang Grandegger <wg@grandegger.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agocan: c_can_platform: fix irq check in probe
Marc Kleine-Budde [Thu, 24 Mar 2011 02:34:33 +0000 (02:34 +0000)]
can: c_can_platform: fix irq check in probe

This patch fixes the check in the probe function whether a IRQ was supplied
to the driver. The original driver check the irq "struct resource *" against
<= 0. Use "platform_get_irq" instead.

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Cc: Bhupesh Sharma <bhupesh.sharma@st.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agocan: c_can: disable one shot mode until driver is fixed
Marc Kleine-Budde [Thu, 24 Mar 2011 02:34:32 +0000 (02:34 +0000)]
can: c_can: disable one shot mode until driver is fixed

This patch disables the one shot mode, until the driver has been fixed and
tested to support it.

> I'm quite sure I've seen a situation where msg_obj 17 "seemed" to be
> pending, while msg_obj 18 and 19 already have been transmitted. But
> in that case, I enabled ONESHOT for the can interface, which enables
> the DA mode (automatic retransmission is disabled).

Reported-by: Jan Altenberg <jan@linutronix.de>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Kurt Van Dijck <kurt.van.dijck@eia.be>
Cc: Bhupesh Sharma <bhupesh.sharma@st.com>
Acked-by: Wolfgang Grandegger <wg@grandegger.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agocan: make struct proto const
Oliver Hartkopp [Tue, 22 Mar 2011 08:27:25 +0000 (08:27 +0000)]
can: make struct proto const

can_ioctl is the only reason for struct proto to be non-const.
script/check-patch.pl suggests struct proto be const.

Setting the reference to the common can_ioctl() in all CAN protocols directly
removes the need to make the struct proto writable in af_can.c

Signed-off-by: Kurt Van Dijck <kurt.van.dijck@eia.be>
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agonet: remove useless comments in net/core/dev.c
Amerigo Wang [Tue, 22 Mar 2011 01:59:47 +0000 (01:59 +0000)]
net: remove useless comments in net/core/dev.c

The code itself can explain what it is doing, no need these comments.

Signed-off-by: WANG Cong <amwang@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agoscore: Use generic show_interrupts()
Thomas Gleixner [Fri, 25 Mar 2011 14:16:56 +0000 (14:16 +0000)]
score: Use generic show_interrupts()

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Chen Liqin <liqin.chen@sunplusct.com>
13 years agoscore: Convert to new irq function names
Thomas Gleixner [Fri, 25 Mar 2011 14:16:55 +0000 (14:16 +0000)]
score: Convert to new irq function names

Scripted with coccinelle.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Chen Liqin <liqin.chen@sunplusct.com>
13 years agoscore: lost a semicolon in asm/irqflags.h
Chen Liqin [Mon, 28 Mar 2011 04:02:20 +0000 (12:02 +0800)]
score: lost a semicolon in asm/irqflags.h

13 years agoscore: Select GENERIC_HARDIRQS_NO_DEPRECATED
Thomas Gleixner [Sun, 6 Feb 2011 22:23:50 +0000 (22:23 +0000)]
score: Select GENERIC_HARDIRQS_NO_DEPRECATED

All chips converted and proper accessor functions used.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Chen Liqin <liqin.chen@sunplusct.com>
13 years agoscore: Convert irq_chip to new functions
Thomas Gleixner [Sun, 6 Feb 2011 22:23:47 +0000 (22:23 +0000)]
score: Convert irq_chip to new functions

Use the proper accessor functions in show_interrupts() while at it.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Chen Liqin <liqin.chen@sunplusct.com>
13 years agoMerge branch 'irq-cleanup-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
Linus Torvalds [Mon, 28 Mar 2011 03:58:56 +0000 (20:58 -0700)]
Merge branch 'irq-cleanup-for-linus' of git://git./linux/kernel/git/tip/linux-2.6-tip

* 'irq-cleanup-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
  tile: Use generic show_interupts()
  tile: Convert to new irq function names
  dma: Ipu: Convert interupt code

13 years agoMerge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/lrg/voltage-2.6
Linus Torvalds [Mon, 28 Mar 2011 03:37:50 +0000 (20:37 -0700)]
Merge branch 'for-linus' of git://git./linux/kernel/git/lrg/voltage-2.6

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/lrg/voltage-2.6:
  regulator: Add MODULE_DEVICE_TABLE to max8997 and max8998
  regulator: fix tps6524x section mismatch
  regulator: Remove more wm831x-specific IRQ operations
  regulator: add ab8500 enable and raise time delays
  regulator: provide consumer interface for fall/rise time
  regulator: add set_voltage_time_sel infrastructure
  regulator: initialization for ab8500 regulators
  regulator: add support for USB voltage regulator
  regulator: switch the ab3100 to use enable_time()
  Regulator: add suspend-finish API for regulator core.
  regulator: fix typo in Kconfig
  regulator: Convert WM831x regulators to genirq
  regulator: If we fail when setting up a supply say which supply

13 years agoMerge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6
Linus Torvalds [Mon, 28 Mar 2011 03:35:07 +0000 (20:35 -0700)]
Merge branch 'for-linus' of git://git./linux/kernel/git/tiwai/sound-2.6

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6:
  ALSA: Fix yet another race in disconnection
  ALSA: asihpi - Update verbose debug print macros
  ALSA: asihpi - Improve non-busmaster adapter operation
  ALSA: asihpi - Support single-rate no-SRC cards
  ALSA: HDA: New AD1984A model for Dell Precision R5500
  ALSA: vmalloc buffers should use normal mmap
  ALSA: hda - Fix SPDIF out regression on ALC889
  ALSA: usb-audio - Support for Boss JS-8 Jam Station
  ALSA: usb-audio: add Cakewalk UM-1G support
  sound/oss/opl3: validate voice and channel indexes
  sound/oss: remove offset from load_patch callbacks

13 years agoMerge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/sameo/mfd-2.6
Linus Torvalds [Mon, 28 Mar 2011 03:07:01 +0000 (20:07 -0700)]
Merge branch 'for-next' of git://git./linux/kernel/git/sameo/mfd-2.6

* 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/sameo/mfd-2.6:
  mfd: Clean up max8997 IRQ namespace
  mfd: Fold irq_set_chip/irq_set_handler
  mfd: Cleanup irq namespace
  mfd: twl6030: Cleanup interrupt handling
  mfd: twl4030: Cleanup interrupt handling
  mfd: mx8925: Remove irq_desc leftovers
  mfd: htc-i2cpld: Cleanup interrupt handling
  mfd: htc-egpio: Cleanup interrupt handling
  mfd: ezx-pcap: Remvove open coded irq handling
  mfd: 88pm860x: Remove unused irq_desc leftovers
  mfd: asic3: Cleanup irq handling
  mfd: Select MFD_CORE if TPS6105X driver is configured
  mfd: Add MODULE_DEVICE_TABLE to rdc321x-southbridge
  mfd: Add MAX8997/8966 IRQ control
  mfd: Constify i2c_device_id tables
  mfd: OLPC: Clean up names to match what OLPC actually uses
  mfd: Add mfd_clone_cell(), convert cs5535-mfd/olpc-xo1 to it

13 years agoMerge branch 'hwmon-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/groec...
Linus Torvalds [Mon, 28 Mar 2011 03:03:39 +0000 (20:03 -0700)]
Merge branch 'hwmon-for-linus' of git://git./linux/kernel/git/groeck/staging

* 'hwmon-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/staging:
  hwmon: (pmbus) Fix temperature limit register access

13 years agoMerge branch 'omap-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
Linus Torvalds [Mon, 28 Mar 2011 03:03:12 +0000 (20:03 -0700)]
Merge branch 'omap-fixes-for-linus' of git://git./linux/kernel/git/tmlind/linux-omap-2.6

* 'omap-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap-2.6:
  hwspinlock: depend on OMAP4
  ARM: OMAP2+: Fix warnings for GPMC interrupt
  OMAP4: PandaBoard: remove unused power regulators
  arm: mach-omap2: omap_l3_smx: fix irq handler setup
  arm: mach-omap2: devices: fix omap3_l3_init() return value

13 years agoMerge branch 'for-linus' of git://git.kernel.dk/linux-2.6-block
Linus Torvalds [Mon, 28 Mar 2011 03:02:45 +0000 (20:02 -0700)]
Merge branch 'for-linus' of git://git.kernel.dk/linux-2.6-block

* 'for-linus' of git://git.kernel.dk/linux-2.6-block:
  staging: Fix bdops->check_events() misconversion in cyasblkdev_block.c
  ide: ensure that we re-run the queue handler

13 years agoMerge branch 'for-2.6.39/drivers' of git://git.kernel.dk/linux-2.6-block
Linus Torvalds [Mon, 28 Mar 2011 03:02:07 +0000 (20:02 -0700)]
Merge branch 'for-2.6.39/drivers' of git://git.kernel.dk/linux-2.6-block

* 'for-2.6.39/drivers' of git://git.kernel.dk/linux-2.6-block: (122 commits)
  cciss: fix lost command issue
  drbd: need include for bitops functions declarations
  Revert "cciss: Add missing allocation in scsi_cmd_stack_setup and  corresponding deallocation"
  cciss: fix missed command status value CMD_UNABORTABLE
  cciss: remove unnecessary casts
  cciss: Mask off error bits of c->busaddr in cmd_special_free when calling pci_free_consistent
  cciss: Inform controller we are using 32-bit tags.
  cciss: hoist tag masking out of loop
  cciss: Add missing allocation in scsi_cmd_stack_setup and  corresponding deallocation
  cciss: export resettable host attribute
  drbd: drop code present under #ifdef which is relevant to 2.6.28 and below
  drbd: Fixed handling of read errors on a 'VerifyS' node
  drbd: Fixed handling of read errors on a 'VerifyT' node
  drbd: Implemented real timeout checking for request processing time
  drbd: Remove unused function atodb_endio()
  drbd: improve log message if received sector offset exceeds local capacity
  drbd: kill dead code
  drbd: don't BUG_ON, if bio_add_page of a single page to an empty bio fails
  drbd: Removed left over, now wrong comments
  drbd: serialize admin requests for new verify run with pending bitmap io
  ...

13 years agoMerge branch 'docs-next' of git://git.lwn.net/linux-2.6
Linus Torvalds [Mon, 28 Mar 2011 02:46:59 +0000 (19:46 -0700)]
Merge branch 'docs-next' of git://git.lwn.net/linux-2.6

* 'docs-next' of git://git.lwn.net/linux-2.6:
  docs: update the development process document
  docs: fix dev_debug() braino in dynamic-debug-howto.txt