platform/kernel/linux-rpi.git
11 years agoBtrfs: fix wrong reserved space when deleting a snapshot/subvolume
Miao Xie [Thu, 28 Feb 2013 10:05:36 +0000 (10:05 +0000)]
Btrfs: fix wrong reserved space when deleting a snapshot/subvolume

When deleting a snapshot/subvolume, we need remove root ref/backref,
dir entries and update the dir inode, so we must reserve free space
for those operations.

Signed-off-by: Miao Xie <miaox@cn.fujitsu.com>
Signed-off-by: Josef Bacik <jbacik@fusionio.com>
11 years agoBtrfs: fix wrong reserved space in qgroup during snap/subv creation
Miao Xie [Thu, 28 Feb 2013 10:04:33 +0000 (10:04 +0000)]
Btrfs: fix wrong reserved space in qgroup during snap/subv creation

There are two problems in the space reservation of the snapshot/
subvolume creation.
- don't reserve the space for the root item insertion
- the space which is reserved in the qgroup is different with
  the free space reservation. we need reserve free space for
  7 items, but in qgroup reservation, we need reserve space only
  for 3 items.

So we implement new metadata reservation functions for the
snapshot/subvolume creation.

Signed-off-by: Miao Xie <miaox@cn.fujitsu.com>
Signed-off-by: Josef Bacik <jbacik@fusionio.com>
11 years agoBtrfs: remove unnecessary dget_parent/dput when creating the pending snapshot
Miao Xie [Thu, 28 Feb 2013 10:01:15 +0000 (10:01 +0000)]
Btrfs: remove unnecessary dget_parent/dput when creating the pending snapshot

Since we have grabbed the parent inode at the beginning of the
snapshot creation, and both sync and async snapshot creation
release it after the pending snapshots are actually created,
it is safe to access the parent inode directly during the snapshot
creation, we needn't use dget_parent/dput to fix the parent dentry
and get the dir inode.

Signed-off-by: Miao Xie <miaox@cn.fujitsu.com>
Signed-off-by: Josef Bacik <jbacik@fusionio.com>
11 years agobtrfs: remove a printk from scan_one_device
David Sterba [Wed, 27 Feb 2013 23:13:55 +0000 (23:13 +0000)]
btrfs: remove a printk from scan_one_device

Dave pointed out that he saw messages from btrfs although there was no
such filesystem on his computers. The automatic device scan is called on
every new blockdevice if the usual distro udev rule set is used. The
printk introduced in 6f60cbd3ae442c was a remainder from copying
portions of code from btrfs_get_bdev_and_sb which is used under
different conditions and the warning makes sense there.

Reported-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
Signed-off-by: Josef Bacik <jbacik@fusionio.com>
11 years agoBtrfs: fix NULL pointer after aborting a transaction
Liu Bo [Wed, 27 Feb 2013 13:28:25 +0000 (13:28 +0000)]
Btrfs: fix NULL pointer after aborting a transaction

While doing cleanup work on an aborted transaction, we've set
the global running transaction pointer to NULL _before_ waiting all
other transaction handles to finish, so others'd hit NULL pointer
crash when referencing the global running transaction pointer.

This first sets a hint to avoid new transaction handle joining, then
waits other existing handles to abort or finish so that we can safely
set the above global pointer to NULL.

Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
Signed-off-by: Josef Bacik <jbacik@fusionio.com>
11 years agoBtrfs: fix memory leak of log roots
Liu Bo [Wed, 27 Feb 2013 13:28:24 +0000 (13:28 +0000)]
Btrfs: fix memory leak of log roots

When we abort a transaction while fsyncing, we'll skip freeing log roots
part of committing a transaction, which leads to memory leak.

This adds a 'free log roots' in putting super when no more users hold
references on log roots, so it's safe and clean.

Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
Signed-off-by: Josef Bacik <jbacik@fusionio.com>
11 years agoBtrfs: copy everything if we've created an inline extent
Josef Bacik [Thu, 28 Feb 2013 18:23:38 +0000 (13:23 -0500)]
Btrfs: copy everything if we've created an inline extent

I noticed while looking into a tree logging bug that we aren't logging inline
extents properly.  Since this requires copying and it shouldn't happen too often
just force us to copy everything for the inode into the tree log when we have an
inline extent.  With this patch we have valid data after a crash when we write
an inline extent.  Thanks,

Cc: stable@vger.kernel.org
Signed-off-by: Josef Bacik <jbacik@fusionio.com>
11 years agoarm: mvebu: enable the SD card slot on Armada 370 Reference Design board
Florian Fainelli [Fri, 1 Feb 2013 10:38:28 +0000 (11:38 +0100)]
arm: mvebu: enable the SD card slot on Armada 370 Reference Design board

The Armada 370 Reference Design board has one SD card slot, directly
connected to the SDIO IP of the SoC, so we enable this IP. there are no
GPIOs for card-detect and write-protect so we do not specify any.

Signed-off-by: Florian Fainelli <florian@openwrt.org>
Signed-off-by: Jason Cooper <jason@lakedaemon.net>
11 years agoARM: kirkwood: topkick: init mvsdio via DT
Jason Cooper [Sat, 26 Jan 2013 20:50:10 +0000 (20:50 +0000)]
ARM: kirkwood: topkick: init mvsdio via DT

Signed-off-by: Jason Cooper <jason@lakedaemon.net>
Tested-by: Andrew Lunn <andrew@lunn.ch>
11 years agoARM: kirkwood: nsa310: convert to pinctrl
Jason Cooper [Sat, 26 Jan 2013 20:50:14 +0000 (20:50 +0000)]
ARM: kirkwood: nsa310: convert to pinctrl

Signed-off-by: Jason Cooper <jason@lakedaemon.net>
11 years agoARM: Kirkwood: topkick: Enable i2c bus.
Andrew Lunn [Sat, 26 Jan 2013 20:50:12 +0000 (20:50 +0000)]
ARM: Kirkwood: topkick: Enable i2c bus.

Add a DT node for I2C and pinctrl hog for the pins. There appears to
be an i2c bus on topkick with a device on it:

i2cdetect 0
WARNING! This program can confuse your I2C bus, cause data loss and worse!
I will probe file /dev/i2c-0.
I will probe address range 0x03-0x77.
Continue? [Y/n] y
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- 64 -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --

Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Jason Cooper <jason@lakedaemon.net>
11 years agoARM: kirkwood: topkick: convert to pinctrl
Jason Cooper [Sat, 26 Jan 2013 20:50:11 +0000 (20:50 +0000)]
ARM: kirkwood: topkick: convert to pinctrl

Signed-off-by: Jason Cooper <jason@lakedaemon.net>
11 years agoARM: dove: convert serial DT nodes to clocks property
Sebastian Hesselbarth [Tue, 29 Jan 2013 20:59:46 +0000 (21:59 +0100)]
ARM: dove: convert serial DT nodes to clocks property

of_serial now has support for using clocks property and we have
a DT clock provider. This patch replaces the hard coded clock-frequency
property with a clocks phandle to tclk.

Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Signed-off-by: Jason Cooper <jason@lakedaemon.net>
11 years agoarm: mvebu: Add SPI flash on Armada 370 DB board
Gregory CLEMENT [Tue, 5 Feb 2013 20:54:55 +0000 (21:54 +0100)]
arm: mvebu: Add SPI flash on Armada 370 DB board

This patch add support for the SPI flash MX25l25635E which is present
on the Armada 370 DB board. This flash stores the bootloader and its
environment.

Signed-off-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
Signed-off-by: Jason Cooper <jason@lakedaemon.net>
11 years agoarm: mvebu: Add SPI flash on Armada XP-DB board
Gregory CLEMENT [Tue, 5 Feb 2013 20:54:54 +0000 (21:54 +0100)]
arm: mvebu: Add SPI flash on Armada XP-DB board

This patch add support for the SPI flash M25P64 which is present on
the Armada XP DB board. This flash stores the bootloader and its
environment.

Signed-off-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
Signed-off-by: Jason Cooper <jason@lakedaemon.net>
11 years agoarm: mvebu: Add SPI flash on Armada XP-GP board
Ezequiel Garcia [Wed, 6 Feb 2013 13:06:23 +0000 (10:06 -0300)]
arm: mvebu: Add SPI flash on Armada XP-GP board

This patch adds an SPI master device node for Armada XP-GP board.
This master node is an SPI flash controller 'n25q128a13'.

Since there is no 'partitions' node declared, one full sized
partition named as the device will be created.

Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Cc: Lior Amsalem <alior@marvell.com>
Tested-by: Gregory Clement <gregory.clement@free-electrons.com>
Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
Acked-by: Gregory Clement <gregory.clement@free-electrons.com>
Signed-off-by: Jason Cooper <jason@lakedaemon.net>
11 years agoarm: mvebu: Add support for SPI controller in Armada 370/XP
Ezequiel Garcia [Wed, 6 Feb 2013 13:06:21 +0000 (10:06 -0300)]
arm: mvebu: Add support for SPI controller in Armada 370/XP

The Armada 370 and Armada XP SoC has an SPI controller.
This patch adds support for this controller in Armada 370
and Armada XP SoC common device tree files.

Note that the Armada XP SPI register length is 0x50 bytes,
while Armada 370 SPI register length is 0x28 bytes,
so we choose the smaller of the two.

Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Cc: Lior Amsalem <alior@marvell.com>
Acked-by: Gregory Clement <gregory.clement@free-electrons.com>
Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
Signed-off-by: Jason Cooper <jason@lakedaemon.net>
11 years agoclocksource: update and move armada-370-xp-timer documentation to timer directory
Gregory CLEMENT [Fri, 25 Jan 2013 17:32:45 +0000 (18:32 +0100)]
clocksource: update and move armada-370-xp-timer documentation to timer directory

Timer driver for Armada 370 and Armada XP have gained local timers
support. So it needs new resources information regarding the IRQs
and the registers.

Also move the documentation in the new and more accurate directory

Signed-off-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
Signed-off-by: Jason Cooper <jason@lakedaemon.net>
11 years agoarm: mvebu: update DT to support local timers
Gregory CLEMENT [Fri, 25 Jan 2013 17:32:44 +0000 (18:32 +0100)]
arm: mvebu: update DT to support local timers

Now that the time-armada-370-xp support local timers, updated the
device tree to take it into account.

Signed-off-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
Signed-off-by: Jason Cooper <jason@lakedaemon.net>
11 years agoARM: Dove: convert usb host controller to DT
Sebastian Hesselbarth [Mon, 28 Jan 2013 15:54:08 +0000 (16:54 +0100)]
ARM: Dove: convert usb host controller to DT

With DT support for orion-ehci also convert Dove to it and
remove the legacy calls and clock aliases.

This patch is based on "ARM: Dove: split legacy and DT setup"
applied to mvebu/boards recently.

Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Signed-off-by: Jason Cooper <jason@lakedaemon.net>
11 years agoarm: mvebu: Enable USB controllers on Armada 370/XP boards
Ezequiel Garcia [Wed, 23 Jan 2013 15:26:31 +0000 (12:26 -0300)]
arm: mvebu: Enable USB controllers on Armada 370/XP boards

This patch activates every USB port provided by each SoC.
Except for Armada XP Openblocks AX3-4 board,
where we enable only the first two USB ports
until we have more information on the third one usage.

Cc: Lior Amsalem <alior@marvell.com>
Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Cc: Gregory CLEMENT <gregory.clement@free-electrons.com>
Tested-by: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
Tested-by: Florian Fainelli <florian@openwrt.org>
Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
Signed-off-by: Jason Cooper <jason@lakedaemon.net>
11 years agoarm: mvebu: Add support for USB host controllers in Armada 370/XP
Ezequiel Garcia [Wed, 23 Jan 2013 15:26:30 +0000 (12:26 -0300)]
arm: mvebu: Add support for USB host controllers in Armada 370/XP

The Armada 370 and Armada XP SoC has an Orion EHCI USB controller.
This patch adds support for this controller in Armada 370
and Armada XP SoC common device tree files.

Cc: Lior Amsalem <alior@marvell.com>
Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Tested-by: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
Tested-by: Florian Fainelli <florian@openwrt.org>
Signed-off-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
Signed-off-by: Jason Cooper <jason@lakedaemon.net>
11 years agoarm: mvebu: add button for OpenBlocks AX3-4
Thomas Petazzoni [Mon, 7 Jan 2013 16:29:58 +0000 (17:29 +0100)]
arm: mvebu: add button for OpenBlocks AX3-4

The OpenBlocks AX3-4 board has one software-controlled button on the
front side, labeled "INIT", so we add minimal support for this button
in the kernel.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: Jason Cooper <jason@lakedaemon.net>
11 years agoARM: Kirkwood: Convert NS2 to gpio-poweroff.
Andrew Lunn [Fri, 28 Dec 2012 14:14:10 +0000 (15:14 +0100)]
ARM: Kirkwood: Convert NS2 to gpio-poweroff.

Remove C code and add a Device Tree node in its place.

Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Tested-by: Simon Guinot <simon.guinot@sequanux.org>
Signed-off-by: Jason Cooper <jason@lakedaemon.net>
11 years agoARM: Kirkwood: Convert NSA310 I2C to device tree
Andrew Lunn [Fri, 28 Dec 2012 14:08:50 +0000 (15:08 +0100)]
ARM: Kirkwood: Convert NSA310 I2C to device tree

Add a sub-node into the I2C node to represent the adt7476 device.

Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Jason Cooper <jason@lakedaemon.net>
11 years agoARM: Kirkwood: Convert NSA310 to use gpio-poweroff driver
Andrew Lunn [Fri, 28 Dec 2012 14:08:49 +0000 (15:08 +0100)]
ARM: Kirkwood: Convert NSA310 to use gpio-poweroff driver

Remove the C code and add a Device Tree node for gpio-poweroff.

Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Jason Cooper <jason@lakedaemon.net>
11 years agoARM: Kirkwood: Convert NSA310 to DT based regulators.
Andrew Lunn [Fri, 28 Dec 2012 14:08:48 +0000 (15:08 +0100)]
ARM: Kirkwood: Convert NSA310 to DT based regulators.

Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Jason Cooper <jason@lakedaemon.net>
11 years agoARM: Dove: add fixed regulator for CuBox USB power
Sebastian Hesselbarth [Thu, 27 Dec 2012 22:21:59 +0000 (23:21 +0100)]
ARM: Dove: add fixed regulator for CuBox USB power

CuBox needs to enable USB power on a gpio pin. Add a fixed regulator
to always enable usb power on boot.

Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Signed-off-by: Jason Cooper <jason@lakedaemon.net>
11 years agoARM: Dove: move CuBox led pinctrl to gpio-leds node
Sebastian Hesselbarth [Thu, 27 Dec 2012 22:21:10 +0000 (23:21 +0100)]
ARM: Dove: move CuBox led pinctrl to gpio-leds node

gpio-leds has support for pinctrl allocation, make use of it.

Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Signed-off-by: Jason Cooper <jason@lakedaemon.net>
11 years agoARM: Kirkwood: Convert openblocks A6 board to pinctrl
Nobuhiro Iwamatsu [Sun, 23 Dec 2012 02:34:37 +0000 (11:34 +0900)]
ARM: Kirkwood: Convert openblocks A6 board to pinctrl

Signed-off-by: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
Signed-off-by: Jason Cooper <jason@lakedaemon.net>
11 years agoARM: Kirkwood: Add pinctrl of NAND to 88f6282
Nobuhiro Iwamatsu [Sun, 23 Dec 2012 02:34:36 +0000 (11:34 +0900)]
ARM: Kirkwood: Add pinctrl of NAND to 88f6282

Signed-off-by: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
Signed-off-by: Jason Cooper <jason@lakedaemon.net>
11 years agoARM: Kirkwood: Add pinctrl of TWSI1 to 88f6282
Nobuhiro Iwamatsu [Sun, 23 Dec 2012 02:34:34 +0000 (11:34 +0900)]
ARM: Kirkwood: Add pinctrl of TWSI1 to 88f6282

The 88f6282 has one more TWSI(TWSI1). This add the information to enable
pinctl of TWSI1.

Signed-off-by: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
Acked-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Jason Cooper <jason@lakedaemon.net>
11 years agoarm: kirkwood: add pinmux option for the SDIO interface on 88F6282
Thomas Petazzoni [Fri, 21 Dec 2012 14:49:13 +0000 (15:49 +0100)]
arm: kirkwood: add pinmux option for the SDIO interface on 88F6282

This commit adds a pinmux option, pmx_sdio, to enable the muxing of
the SDIO interface on the 88F6282 SoC from Marvell.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: Jason Cooper <jason@lakedaemon.net>
11 years agoarm: kirkwood: mplcec4: use Device Tree to probe SDIO
Thomas Petazzoni [Fri, 21 Dec 2012 14:49:12 +0000 (15:49 +0100)]
arm: kirkwood: mplcec4: use Device Tree to probe SDIO

Now that the mvsdio driver has a Device Tree binding, and the SDIO
controller is declared in kirkwood.dtsi, migrate the mplcec4 board to
use the Device Tree to probe the SDIO controller and to mux the pins
of the SDIO interface correctly.

This patch has not been tested, it remains to be tested by a person
having access to the hardware.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Cc: Stefan Peter <s.peter@mpl.ch>
Signed-off-by: Jason Cooper <jason@lakedaemon.net>
11 years agoarm: kirkwood: dreamplug: use Device Tree to probe SDIO
Thomas Petazzoni [Fri, 21 Dec 2012 14:49:11 +0000 (15:49 +0100)]
arm: kirkwood: dreamplug: use Device Tree to probe SDIO

Now that the mvsdio driver has a Device Tree binding, and the SDIO
controller is declared in kirkwood.dtsi, migrate the dreamplug board
to use the Device Tree to probe the SDIO controller and to mux this
interface properly.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Cc: Jason Cooper <jason@lakedaemon.net>
Signed-off-by: Jason Cooper <jason@lakedaemon.net>
11 years agoarm: kirkwood: add Device Tree informations for the SDIO controller
Thomas Petazzoni [Fri, 21 Dec 2012 14:49:10 +0000 (15:49 +0100)]
arm: kirkwood: add Device Tree informations for the SDIO controller

Now that the SDIO controller has a Device Tree binding, let's use it
in kirkwood.dtsi.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: Jason Cooper <jason@lakedaemon.net>
11 years agoarm: mvebu: enable the SDIO interface on the Globalscale Mirabox
Thomas Petazzoni [Fri, 21 Dec 2012 14:49:09 +0000 (15:49 +0100)]
arm: mvebu: enable the SDIO interface on the Globalscale Mirabox

The Globalscale Mirabox uses the SDIO interface of the Armada 370 to
connect to a Wifi/Bluetooth SD8787 chip, so we enable the SDIO
interface of this board in its Device Tree file.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: Jason Cooper <jason@lakedaemon.net>
11 years agoarm: mvebu: enable the SD card slot on Armada 370 DB board
Thomas Petazzoni [Fri, 21 Dec 2012 14:49:08 +0000 (15:49 +0100)]
arm: mvebu: enable the SD card slot on Armada 370 DB board

The Armada XP DB evaluation board has one SD card slot, directly
connected to the SDIO IP of the SoC, so we add a device tree
description for it.

However, in the default configuration of the board, the SD card slot
is not usable: the connector plugged into CON40 must be changed
against a different one, provided with the board by the
manufacturer. Since such a manual modification of the hardware is
needed, we did not enable the SDIO interface by default, and left it
to the board user to modify the Device Tree if needed. Since this
board is really only an evaluation board for developers and not a
final product, it is not too bad.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: Jason Cooper <jason@lakedaemon.net>
11 years agoarm: mvebu: enable the SD card slot on Armada XP DB board
Thomas Petazzoni [Fri, 21 Dec 2012 14:49:07 +0000 (15:49 +0100)]
arm: mvebu: enable the SD card slot on Armada XP DB board

The Armada XP DB evaluation board has one SD card slot, directly
connected to the SDIO IP of the SoC, so we enable this
IP. Unfortunately, there are no GPIOs for card-detect and
write-protect.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: Jason Cooper <jason@lakedaemon.net>
11 years agoarm: mvebu: add pin muxing options for the SDIO interface on Armada XP
Thomas Petazzoni [Fri, 21 Dec 2012 14:49:06 +0000 (15:49 +0100)]
arm: mvebu: add pin muxing options for the SDIO interface on Armada XP

The SDIO interface is only available on pins MPP30/31/32/33/34/35 on
the various Armada XP variants, so we provide a pin muxing option for
this in the Armada XP .dtsi files.

Even though those muxing options are the same for MV78230, MV78260 and
MV78460, we keep them in each .dtsi file, because the number of pins,
and therefore the declaration of the pinctrl node, is different for
each SoC variant.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: Jason Cooper <jason@lakedaemon.net>
11 years agoarm: mvebu: add pin muxing options for the SDIO interface on Armada 370
Thomas Petazzoni [Fri, 21 Dec 2012 14:49:05 +0000 (15:49 +0100)]
arm: mvebu: add pin muxing options for the SDIO interface on Armada 370

The SDIO interface is available either on pins MPP9/11/12/13/14/15 or
MPP47/48/49/50/51/52 on the Armada 370. Even though all combinations
are potentially possible, those two muxing options are the most
probable ones, so we provide those at the SoC level .dtsi file.

In practice, in turns out the Armada 370 DB board uses the former,
while the Armada 370 Mirabox uses the latter.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: Jason Cooper <jason@lakedaemon.net>
11 years agoarm: mvebu: add DT information for the SDIO interface of Armada 370/XP
Thomas Petazzoni [Fri, 21 Dec 2012 14:49:04 +0000 (15:49 +0100)]
arm: mvebu: add DT information for the SDIO interface of Armada 370/XP

Now that the mvsdio MMC driver has a Device Tree binding, we add the
Device Tree informations to describe the SDIO interface available in
the Armada 370/XP SoCs.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: Jason Cooper <jason@lakedaemon.net>
11 years agoarm: mvebu: Add RTC support for Armada 370 and Armada XP
Gregory CLEMENT [Wed, 12 Dec 2012 09:06:24 +0000 (10:06 +0100)]
arm: mvebu: Add RTC support for Armada 370 and Armada XP

The Armada 370 and Armada XP Socs have the same controller that the
one used in the orion platforms. This patch updates the device tree
for these SoCs.

Signed-off-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
Acked-by: Andrew Lunn <andrew@lunn.ch>
Tested-by: Florian Fainelli <florian@openwrt.org>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Jason Cooper <jason@lakedaemon.net>
11 years agoarm: mvebu: update defconfig with ATAG support when using DT
Gregory CLEMENT [Mon, 4 Feb 2013 17:21:07 +0000 (18:21 +0100)]
arm: mvebu: update defconfig with ATAG support when using DT

Some of the mvebu boards (mainly the development board) come with
plug-in RAM modules. This patch allows to let the bootloaders which
have no support for DTS to give the real amount of memory available on
the board.

Signed-off-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
Signed-off-by: Jason Cooper <jason@lakedaemon.net>
11 years agoARM: mvebu: Update defconfig to select SPI flash and MTD support
Ezequiel Garcia [Wed, 6 Feb 2013 13:06:24 +0000 (10:06 -0300)]
ARM: mvebu: Update defconfig to select SPI flash and MTD support

The Armada XP DB-MV784MP-GP board has an SPI flash device.
These options allow to access that device over MTD.

Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
Signed-off-by: Jason Cooper <jason@lakedaemon.net>
11 years agoARM: mvebu: Update defconfig to select SPI support
Ezequiel Garcia [Wed, 6 Feb 2013 13:06:22 +0000 (10:06 -0300)]
ARM: mvebu: Update defconfig to select SPI support

Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Cc: Lior Amsalem <alior@marvell.com>
Acked-by: Gregory Clement <gregory.clement@free-electrons.com>
Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
Signed-off-by: Jason Cooper <jason@lakedaemon.net>
11 years agoarm: mvebu: support for the new Armada XP development board(DB-MV784MP-GP)
Gregory CLEMENT [Thu, 31 Jan 2013 14:50:12 +0000 (15:50 +0100)]
arm: mvebu: support for the new Armada XP development board(DB-MV784MP-GP)

This is the new Armada XP evaluation board from Marvell. It comes with
a RS232 port over USB, a SATA link, an internal SSD, 4 Ethernet
Gigabit links.

Support for USB (Host and device), SDIO, PCIe will be added as drivers
when they become available for Armada XP in mainline.

Tested-by: Simon Guinot <simon.guinot@sequanux.org>
Tested-by: Florian Fainelli <florian@openwrt.org>
Signed-off-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
Tested-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
Signed-off-by: Jason Cooper <jason@lakedaemon.net>
11 years agoarm: mvebu: update defconfig with local timer support
Gregory CLEMENT [Fri, 25 Jan 2013 17:32:43 +0000 (18:32 +0100)]
arm: mvebu: update defconfig with local timer support

Now that we have support for local timers, enable it by default

Signed-off-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
Signed-off-by: Jason Cooper <jason@lakedaemon.net>
11 years agoclocksource: time-armada-370-xp: add local timer support
Gregory CLEMENT [Fri, 25 Jan 2013 17:32:42 +0000 (18:32 +0100)]
clocksource: time-armada-370-xp: add local timer support

On the SOCs Armada 370 and Armada XP, each CPU comes with two private
timers. This patch use the timer 0 of each CPU as local timer for the
clockevent if CONFIG_LOCAL_TIMER is selected. In the other case, use
only the private Timer 0 of CPU 0.

Signed-off-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
Signed-off-by: Jason Cooper <jason@lakedaemon.net>
11 years agoarm: mvebu: Add support for local interrupt
Gregory CLEMENT [Fri, 25 Jan 2013 17:32:41 +0000 (18:32 +0100)]
arm: mvebu: Add support for local interrupt

MPIC allows the use of private interrupt for each CPUs. The 28th first
interrupts are per-cpu. This patch adds support to use them.

Signed-off-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
Signed-off-by: Jason Cooper <jason@lakedaemon.net>
11 years agoarm: mvebu: Update defconfig to select USB support
Ezequiel Garcia [Wed, 23 Jan 2013 15:26:32 +0000 (12:26 -0300)]
arm: mvebu: Update defconfig to select USB support

Cc: Lior Amsalem <alior@marvell.com>
Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Cc: Gregory CLEMENT <gregory.clement@free-electrons.com>
Tested-by: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
Tested-by: Florian Fainelli <florian@openwrt.org>
Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
Signed-off-by: Jason Cooper <jason@lakedaemon.net>
11 years agoARM: kirkwood: convert Guruplug Server Plus to use the device tree
Willy Tarreau [Sun, 9 Dec 2012 18:40:04 +0000 (19:40 +0100)]
ARM: kirkwood: convert Guruplug Server Plus to use the device tree

Add a device tree entry for the Guruplug Server Plus board. This port
was based both on the work done on the dreamplug and the dockstar.

It builds, boots and works on my Guruplug Server Plus.

Signed-off-by: Willy Tarreau <w@1wt.eu>
Signed-off-by: Jason Cooper <jason@lakedaemon.net>
11 years agoarm: mvebu: add DTS file for Marvell RD-A370-A1 board
Florian Fainelli [Wed, 9 Jan 2013 19:56:07 +0000 (20:56 +0100)]
arm: mvebu: add DTS file for Marvell RD-A370-A1 board

This patch adds the DTS file to support the Marvell RD-A370-A1
(Reference Design board) also known as RD-88F6710 board. It is almost
entirely similar to the DB-A370 board except that the first Ethernet PHY
is SGMII-wired and the second is a switch which is RGMII-wired.

Signed-off-by: Florian Fainelli <florian@openwrt.org>
Signed-off-by: Jason Cooper <jason@lakedaemon.net>
11 years agoarm: mvebu: Improve the SMP support of the interrupt controller
Gregory CLEMENT [Wed, 5 Dec 2012 20:43:23 +0000 (21:43 +0100)]
arm: mvebu: Improve the SMP support of the interrupt controller

This patch makes the interrupt controller driver more SMP aware for
the Armada XP SoCs. It adds the support for the per-CPU irq. It also
adds the implementation for the set_affinity hook.

Patch initialy wrote by Yehuda Yitschak and reworked by Gregory
CLEMENT.

Signed-off-by: Yehuda Yitschak <yehuday@marvell.com>
Signed-off-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
Signed-off-by: Jason Cooper <jason@lakedaemon.net>
11 years agoARM: Dove: split legacy and DT setup
Arnd Bergmann [Thu, 28 Feb 2013 17:19:16 +0000 (18:19 +0100)]
ARM: Dove: split legacy and DT setup

In the beginning of DT for Dove it was reasonable to have it close to
non-DT code. With improved DT support, it became more and more difficult
to not break non-DT while changing DT code.

This patch splits up DT board setup and introduces a DOVE_LEGACY config
to allow to remove legacy code for DT-only kernels.

Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Signed-off-by: Jason Cooper <jason@lakedaemon.net>
11 years agoARM: dove: update dove_defconfig with a few useful options
Olof Johansson [Sun, 13 Jan 2013 17:54:07 +0000 (09:54 -0800)]
ARM: dove: update dove_defconfig with a few useful options

This refreshes the dove_defconfig, and adds:
PRINTK_TIME
DEVTMPFS
EXT4

They're quite useful, and allows booting a cubox ubuntu rootfs on SD card,
since that by default uses ext4.

The rest of the churn is due to options and defaults moving around, no
functional difference.

Signed-off-by: Olof Johansson <olof@lixom.net>
Cc: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Signed-off-by: Jason Cooper <jason@lakedaemon.net>
11 years agoARM: Kirkwood: Remove redundent SDIO clock alias
Andrew Lunn [Thu, 10 Jan 2013 21:01:09 +0000 (22:01 +0100)]
ARM: Kirkwood: Remove redundent SDIO clock alias

Now that SDIO is instantiated via DT, and the SDIO DT node has a clocks
property, we no longer need a C coded clock alias. Remove it.

Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Jason Cooper <jason@lakedaemon.net>
11 years agoARM: Kirkwood: Remove redundent USB clock alias
Andrew Lunn [Thu, 10 Jan 2013 21:01:08 +0000 (22:01 +0100)]
ARM: Kirkwood: Remove redundent USB clock alias

Now that USB is instantiated via DT, and the USB DT node has a clocks
property, we no longer need a C coded clock alias. Remove it.

Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Jason Cooper <jason@lakedaemon.net>
11 years agoarm: mvebu: add LEDs support to defconfig file
Thomas Petazzoni [Mon, 7 Jan 2013 16:27:14 +0000 (17:27 +0100)]
arm: mvebu: add LEDs support to defconfig file

The OpenBlocks AX3-4 platform has several LEDs, so it sounds wise to
enable LED support in mvebu_defconfig. We anticipate that more
platforms using Marvell EBU SoCs will have LEDs in the future.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: Jason Cooper <jason@lakedaemon.net>
11 years agoarm: mvebu: enable btmrvl driver in mvebu_defconfig
Thomas Petazzoni [Fri, 21 Dec 2012 14:49:19 +0000 (15:49 +0100)]
arm: mvebu: enable btmrvl driver in mvebu_defconfig

The Globalscale Mirabox platform, based on the Armada 370 from
Marvell, has a SD8787 Wireless/Bluetooth chip connected on the SDIO
interface. Now that the mvsdio has a Device Tree binding, and the
necessary Device Tree informations have been added at the SoC and
board level, let's enable the btmrvl driver for the Bluetooth part of
the SD8787 chip.

For now, the driver gets probed correctly, detects the device but
apparently fails to push the firmware to the device:

Bluetooth: vendor=0x2df, device=0x911a, class=255, fn=2
Bluetooth: FW failed to be active in time!
Bluetooth: Downloading firmware failed!
Bluetooth: vendor=0x2df, device=0x911b, class=255, fn=3
Bluetooth: FW failed to be active in time!
Bluetooth: Downloading firmware failed!

This will have to be investigated separately.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: Jason Cooper <jason@lakedaemon.net>
11 years agoarm: mvebu: enable mwifiex driver in mvebu_defconfig
Thomas Petazzoni [Fri, 21 Dec 2012 14:49:18 +0000 (15:49 +0100)]
arm: mvebu: enable mwifiex driver in mvebu_defconfig

The Globalscale Mirabox platform, based on the Armada 370 from
Marvell, has a SD8787 Wireless chip connected on the SDIO
interface. Now that the mvsdio has a Device Tree binding, and the
necessary Device Tree informations have been added at the SoC and
board level, let's enable the mwifiex driver for the Wireless part of
the SD8787 chip.

For now, the driver gets probed correctly, detects a device and shows
the network interfaces. However, scanning Wifi networks doesn't work
for now, with a 'CMD_RESP: cmd 0x6 error, result=0x1' message. This
will have to be investigated separately.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: Jason Cooper <jason@lakedaemon.net>
11 years agoarm: mvebu: enable SDIO support in mvebu_defconfig
Thomas Petazzoni [Fri, 21 Dec 2012 14:49:17 +0000 (15:49 +0100)]
arm: mvebu: enable SDIO support in mvebu_defconfig

Now that the mvsdio driver has gained Device Tree support and the
necessary Device Tree informations has been added for Armada 370 and
Armada XP platforms, we enable the MMC subsystem and the mvsdio driver
in mvebu_defconfig.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: Jason Cooper <jason@lakedaemon.net>
11 years agoarm: mvebu: Update defconfig with Marvell RTC support
Gregory CLEMENT [Wed, 12 Dec 2012 09:06:26 +0000 (10:06 +0100)]
arm: mvebu: Update defconfig with Marvell RTC support

The RTC class driver is already part of the mvebu_defconfig but the
Marvell internal RTC not yet. Now that its support is added for mvebu
let's update the config file.

Signed-off-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
Tested-by: Florian Fainelli <florian@openwrt.org>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Jason Cooper <jason@lakedaemon.net>
11 years agoMerge branch 'timer/cleanup' into late/mvebu2
Arnd Bergmann [Thu, 28 Feb 2013 17:54:15 +0000 (18:54 +0100)]
Merge branch 'timer/cleanup' into late/mvebu2

Basing the mvebu patches on top of the timer cleanup
avoids some nasty merges.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
11 years agoMerge 'mmc/upstream' into late/mvebu2
Arnd Bergmann [Thu, 28 Feb 2013 17:53:01 +0000 (18:53 +0100)]
Merge 'mmc/upstream' into late/mvebu2

These patches from the mmc tree were merged into v3.9 already
and the later mvebu patches depend on them.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
11 years agoSUNRPC: make AF_LOCAL connect synchronous
J. Bruce Fields [Wed, 20 Feb 2013 22:52:19 +0000 (17:52 -0500)]
SUNRPC: make AF_LOCAL connect synchronous

It doesn't appear that anyone actually needs to connect asynchronously.

Also, using a workqueue for the connect means we lose the namespace
information from the original process.  This is a problem since there's
no way to explicitly pass in a filesystem namespace for resolution of an
AF_LOCAL address.

Acked-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
11 years agocifs: bugfix for unreclaimed writeback pages in cifs_writev_requeue()
Ouyang Maochun [Mon, 18 Feb 2013 15:54:52 +0000 (09:54 -0600)]
cifs: bugfix for unreclaimed writeback pages in cifs_writev_requeue()

Pages get the PG_writeback flag set before cifs sends its
request to SMB server in cifs_writepages(), if the SMB service
goes down, cifs may try to recommit the writing requests in
cifs_writev_requeue(). However, it does not clean its PG_writeback
flag and relaimed the pages even if it fails again in
cifs_writev_requeue(), which may lead to the hanging of the
processes accessing the cifs directory. This patch just cleans
the PG_writeback flags and reclaims the pages under that circumstances.

    Steps to reproduce the bug(trying serveral times may trigger the issue):
    1.Write from cifs client continuously.(e.g dd if=/dev/zero of=<cifs file>)
    2.Stop SMB service from server.(e.g service smb stop)
    3.Wait for two minutes, and then start SMB service from
server.(e.g service smb start)
    4.The processes which are accessing cifs directory may hang up.

Signed-off-by: Ouyang Maochun <ouyang.maochun@zte.com.cn>
Signed-off-by: Jiang Yong <jian.yong5@zte.com.cn>
Tested-by: Zhang Xianwei <zhang.xianwei8@zte.com.cn>
Reviewed-by: Wang Liang <wang.liang82@zte.com.cn>
Reviewed-by: Cai Qu <cai.qu@zte.com.cn>
Reviewed-by: Jiang Biao <jiang.biao2@zte.com.cn>
Reviewed-by: Jeff Layton <jlayton@redhat.com>
Reviewed-by: Pavel Shilovsky <piastry@etersoft.ru>
Signed-off-by: Steve French <sfrench@us.ibm.com>
11 years agox86/kvm: Fix pvclock vsyscall fixmap
Peter Hurley [Wed, 27 Feb 2013 20:28:28 +0000 (15:28 -0500)]
x86/kvm: Fix pvclock vsyscall fixmap

The physical memory fixmapped for the pvclock clock_gettime vsyscall
was allocated, and thus is not a kernel symbol. __pa() is the proper
method to use in this case.

Fixes the crash below when booting a next-20130204+ smp guest on a
3.8-rc5+ KVM host.

[    0.666410] udevd[97]: starting version 175
[    0.674043] udevd[97]: udevd:[97]: segfault at ffffffffff5fd020
     ip 00007fff069e277f sp 00007fff068c9ef8 error d

Acked-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
Signed-off-by: Gleb Natapov <gleb@redhat.com>
11 years agoMerge branch 'akpm' (final batch from Andrew)
Linus Torvalds [Thu, 28 Feb 2013 04:58:09 +0000 (20:58 -0800)]
Merge branch 'akpm' (final batch from Andrew)

Merge third patch-bumb from Andrew Morton:
 "This wraps me up for -rc1.
   - Lots of misc stuff and things which were deferred/missed from
     patchbombings 1 & 2.
   - ocfs2 things
   - lib/scatterlist
   - hfsplus
   - fatfs
   - documentation
   - signals
   - procfs
   - lockdep
   - coredump
   - seqfile core
   - kexec
   - Tejun's large IDR tree reworkings
   - ipmi
   - partitions
   - nbd
   - random() things
   - kfifo
   - tools/testing/selftests updates
   - Sasha's large and pointless hlist cleanup"

* emailed patches from Andrew Morton <akpm@linux-foundation.org>: (163 commits)
  hlist: drop the node parameter from iterators
  kcmp: make it depend on CHECKPOINT_RESTORE
  selftests: add a simple doc
  tools/testing/selftests/Makefile: rearrange targets
  selftests/efivarfs: add create-read test
  selftests/efivarfs: add empty file creation test
  selftests: add tests for efivarfs
  kfifo: fix kfifo_alloc() and kfifo_init()
  kfifo: move kfifo.c from kernel/ to lib/
  arch Kconfig: centralise CONFIG_ARCH_NO_VIRT_TO_BUS
  w1: add support for DS2413 Dual Channel Addressable Switch
  memstick: move the dereference below the NULL test
  drivers/pps/clients/pps-gpio.c: use devm_kzalloc
  Documentation/DMA-API-HOWTO.txt: fix typo
  include/linux/eventfd.h: fix incorrect filename is a comment
  mtd: mtd_stresstest: use prandom_bytes()
  mtd: mtd_subpagetest: convert to use prandom library
  mtd: mtd_speedtest: use prandom_bytes
  mtd: mtd_pagetest: convert to use prandom library
  mtd: mtd_oobtest: convert to use prandom library
  ...

11 years agotarget/pscsi: Rename sg_num to nr_vecs in pscsi_get_bio()
Asias He [Wed, 27 Feb 2013 05:29:30 +0000 (13:29 +0800)]
target/pscsi: Rename sg_num to nr_vecs in pscsi_get_bio()

It is actually a vector not a sg, so nr_vecs is better than sg_num.

Signed-off-by: Asias He <asias@redhat.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
11 years agotarget/pscsi: Fix page increment
Asias He [Wed, 27 Feb 2013 05:29:29 +0000 (13:29 +0800)]
target/pscsi: Fix page increment

The page++ is wrong. It makes bio_add_pc_page() pointing to a wrong page
address if the 'while (len > 0 && data_len > 0) { ... }' loop is
executed more than one once.

Signed-off-by: Asias He <asias@redhat.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
11 years agotarget/pscsi: Drop unnecessary NULL assignment to bio->bi_next
Asias He [Wed, 27 Feb 2013 05:29:28 +0000 (13:29 +0800)]
target/pscsi: Drop unnecessary NULL assignment to bio->bi_next

Signed-off-by: Asias He <asias@redhat.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
11 years agotarget: Add __exit annotation for module_exit functions
Asias He [Wed, 27 Feb 2013 04:50:56 +0000 (12:50 +0800)]
target: Add __exit annotation for module_exit functions

Inclues sbp_exit, fileio_module_exit, iblock_module_exit and
pscsi_module_exit.

Note: rd_module_exit() can not be annotated by __exit, becasue it is
called by target_core_init_configfs() which is annotated by __init.

Signed-off-by: Asias He <asias@redhat.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
11 years agohlist: drop the node parameter from iterators
Sasha Levin [Thu, 28 Feb 2013 01:06:00 +0000 (17:06 -0800)]
hlist: drop the node parameter from iterators

I'm not sure why, but the hlist for each entry iterators were conceived

        list_for_each_entry(pos, head, member)

The hlist ones were greedy and wanted an extra parameter:

        hlist_for_each_entry(tpos, pos, head, member)

Why did they need an extra pos parameter? I'm not quite sure. Not only
they don't really need it, it also prevents the iterator from looking
exactly like the list iterator, which is unfortunate.

Besides the semantic patch, there was some manual work required:

 - Fix up the actual hlist iterators in linux/list.h
 - Fix up the declaration of other iterators based on the hlist ones.
 - A very small amount of places were using the 'node' parameter, this
 was modified to use 'obj->member' instead.
 - Coccinelle didn't handle the hlist_for_each_entry_safe iterator
 properly, so those had to be fixed up manually.

The semantic patch which is mostly the work of Peter Senna Tschudin is here:

@@
iterator name hlist_for_each_entry, hlist_for_each_entry_continue, hlist_for_each_entry_from, hlist_for_each_entry_rcu, hlist_for_each_entry_rcu_bh, hlist_for_each_entry_continue_rcu_bh, for_each_busy_worker, ax25_uid_for_each, ax25_for_each, inet_bind_bucket_for_each, sctp_for_each_hentry, sk_for_each, sk_for_each_rcu, sk_for_each_from, sk_for_each_safe, sk_for_each_bound, hlist_for_each_entry_safe, hlist_for_each_entry_continue_rcu, nr_neigh_for_each, nr_neigh_for_each_safe, nr_node_for_each, nr_node_for_each_safe, for_each_gfn_indirect_valid_sp, for_each_gfn_sp, for_each_host;

type T;
expression a,c,d,e;
identifier b;
statement S;
@@

-T b;
    <+... when != b
(
hlist_for_each_entry(a,
- b,
c, d) S
|
hlist_for_each_entry_continue(a,
- b,
c) S
|
hlist_for_each_entry_from(a,
- b,
c) S
|
hlist_for_each_entry_rcu(a,
- b,
c, d) S
|
hlist_for_each_entry_rcu_bh(a,
- b,
c, d) S
|
hlist_for_each_entry_continue_rcu_bh(a,
- b,
c) S
|
for_each_busy_worker(a, c,
- b,
d) S
|
ax25_uid_for_each(a,
- b,
c) S
|
ax25_for_each(a,
- b,
c) S
|
inet_bind_bucket_for_each(a,
- b,
c) S
|
sctp_for_each_hentry(a,
- b,
c) S
|
sk_for_each(a,
- b,
c) S
|
sk_for_each_rcu(a,
- b,
c) S
|
sk_for_each_from
-(a, b)
+(a)
S
+ sk_for_each_from(a) S
|
sk_for_each_safe(a,
- b,
c, d) S
|
sk_for_each_bound(a,
- b,
c) S
|
hlist_for_each_entry_safe(a,
- b,
c, d, e) S
|
hlist_for_each_entry_continue_rcu(a,
- b,
c) S
|
nr_neigh_for_each(a,
- b,
c) S
|
nr_neigh_for_each_safe(a,
- b,
c, d) S
|
nr_node_for_each(a,
- b,
c) S
|
nr_node_for_each_safe(a,
- b,
c, d) S
|
- for_each_gfn_sp(a, c, d, b) S
+ for_each_gfn_sp(a, c, d) S
|
- for_each_gfn_indirect_valid_sp(a, c, d, b) S
+ for_each_gfn_indirect_valid_sp(a, c, d) S
|
for_each_host(a,
- b,
c) S
|
for_each_host_safe(a,
- b,
c, d) S
|
for_each_mesh_entry(a,
- b,
c, d) S
)
    ...+>

[akpm@linux-foundation.org: drop bogus change from net/ipv4/raw.c]
[akpm@linux-foundation.org: drop bogus hunk from net/ipv6/raw.c]
[akpm@linux-foundation.org: checkpatch fixes]
[akpm@linux-foundation.org: fix warnings]
[akpm@linux-foudnation.org: redo intrusive kvm changes]
Tested-by: Peter Senna Tschudin <peter.senna@gmail.com>
Acked-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
Cc: Wu Fengguang <fengguang.wu@intel.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Gleb Natapov <gleb@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
11 years agokcmp: make it depend on CHECKPOINT_RESTORE
Cyrill Gorcunov [Thu, 28 Feb 2013 01:05:58 +0000 (17:05 -0800)]
kcmp: make it depend on CHECKPOINT_RESTORE

Since kcmp syscall has been implemented (initially on x86 architecture) a
number of other archs wire it up as well: xtensa, sparc, sh, s390, mips,
microblaze, m68k (not taking into account those who uses
<asm-generic/unistd.h> for syscall numbers definitions).

But the Makefile, which turns kcmp.o generation on still depends on former
config-x86.  Thus get rid of this limitation and make kcmp.o depend on
CHECKPOINT_RESTORE option.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Cc: Pavel Emelyanov <xemul@parallels.com>
Cc: Andrey Vagin <avagin@openvz.org>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
11 years agoselftests: add a simple doc
Jeremy Kerr [Thu, 28 Feb 2013 01:05:57 +0000 (17:05 -0800)]
selftests: add a simple doc

This change adds a little documentation to the tests under
tools/testing/selftests/, based on akpm's explanation.

[akpm@linux-foundation.org: move from Documentation to tools/testing/selftests/README.txt]
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Cc: Dave Young <dyoung@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
11 years agotools/testing/selftests/Makefile: rearrange targets
Andrew Morton [Thu, 28 Feb 2013 01:05:56 +0000 (17:05 -0800)]
tools/testing/selftests/Makefile: rearrange targets

Do it one-per-line to reduce patch conflict pain.

Cc: Dave Young <dyoung@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
11 years agoselftests/efivarfs: add create-read test
Jeremy Kerr [Thu, 28 Feb 2013 01:05:55 +0000 (17:05 -0800)]
selftests/efivarfs: add create-read test

Test that reads from a newly-created efivarfs file (with no data written)
will return EOF.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Cc: Matt Fleming <matt.fleming@intel.com>
Cc: Lingzhu Xiang <lxiang@redhat.com>
Cc: Dave Young <dyoung@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
11 years agoselftests/efivarfs: add empty file creation test
Jeremy Kerr [Thu, 28 Feb 2013 01:05:53 +0000 (17:05 -0800)]
selftests/efivarfs: add empty file creation test

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Cc: Matt Fleming <matt.fleming@intel.com>
Cc: Lingzhu Xiang <lxiang@redhat.com>
Cc: Dave Young <dyoung@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
11 years agoselftests: add tests for efivarfs
Jeremy Kerr [Thu, 28 Feb 2013 01:05:52 +0000 (17:05 -0800)]
selftests: add tests for efivarfs

This change adds a few initial efivarfs tests to the
tools/testing/selftests directory.

The open-unlink test is based on code from Lingzhu Xiang.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Cc: Matt Fleming <matt.fleming@intel.com>
Cc: Lingzhu Xiang <lxiang@redhat.com>
Cc: Dave Young <dyoung@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
11 years agokfifo: fix kfifo_alloc() and kfifo_init()
Stefani Seibold [Thu, 28 Feb 2013 01:05:51 +0000 (17:05 -0800)]
kfifo: fix kfifo_alloc() and kfifo_init()

Fix kfifo_alloc() and kfifo_init() to alloc at least the requested number
of elements.  Since the kfifo operates on power of 2 the request size will
be rounded up to the next power of two.

Signed-off-by: Stefani Seibold <stefani@seibold.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
11 years agokfifo: move kfifo.c from kernel/ to lib/
Stefani Seibold [Thu, 28 Feb 2013 01:05:50 +0000 (17:05 -0800)]
kfifo: move kfifo.c from kernel/ to lib/

Move kfifo.c from kernel/ to lib/

Signed-off-by: Stefani Seibold <stefani@seibold.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
11 years agoarch Kconfig: centralise CONFIG_ARCH_NO_VIRT_TO_BUS
Stephen Rothwell [Thu, 28 Feb 2013 01:05:48 +0000 (17:05 -0800)]
arch Kconfig: centralise CONFIG_ARCH_NO_VIRT_TO_BUS

Change it to CONFIG_HAVE_VIRT_TO_BUS and set it in all architecures
that already provide virt_to_bus().

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Reviewed-by: James Hogan <james.hogan@imgtec.com>
Cc: Bjorn Helgaas <bhelgaas@google.com>
Cc: H Hartley Sweeten <hartleys@visionengravers.com>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Paul Mundt <lethal@linux-sh.org>
Cc: Vineet Gupta <Vineet.Gupta1@synopsys.com>
Cc: James Bottomley <James.Bottomley@HansenPartnership.com>
Cc: <linux-arch@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
11 years agow1: add support for DS2413 Dual Channel Addressable Switch
Mariusz Bialonczyk [Thu, 28 Feb 2013 01:05:47 +0000 (17:05 -0800)]
w1: add support for DS2413 Dual Channel Addressable Switch

Also fixes some whitespace inconsistency in Kconfig and w1_family.h when
DS2408 chip support was added.

Signed-off-by: Mariusz Bialonczyk <manio@skyboo.net>
Acked-by: Evgeniy Polyakov <zbr@ioremap.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
11 years agomemstick: move the dereference below the NULL test
Wei Yongjun [Thu, 28 Feb 2013 01:05:46 +0000 (17:05 -0800)]
memstick: move the dereference below the NULL test

The dereference should be moved below the NULL test.

spatch with a semantic match is used to found this.
(http://coccinelle.lip6.fr/)

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Cc: Maxim Levitsky <maximlevitsky@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
11 years agodrivers/pps/clients/pps-gpio.c: use devm_kzalloc
Julia Lawall [Thu, 28 Feb 2013 01:05:44 +0000 (17:05 -0800)]
drivers/pps/clients/pps-gpio.c: use devm_kzalloc

devm_kzalloc allocates memory that is released when a driver detaches.
This patch uses devm_kzalloc for data that is allocated in the probe
function of a platform device and is only freed in the remove function.

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Cc: Rodolfo Giometti <giometti@enneenne.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
11 years agoDocumentation/DMA-API-HOWTO.txt: fix typo
Andrew Morton [Thu, 28 Feb 2013 01:05:43 +0000 (17:05 -0800)]
Documentation/DMA-API-HOWTO.txt: fix typo

Noted by Jesper

Cc: Jesper Juhl <jj@chaosbits.net>
Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Cc: Shuah Khan <shuah.khan@hp.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
11 years agoinclude/linux/eventfd.h: fix incorrect filename is a comment
Martin Sustrik [Thu, 28 Feb 2013 01:05:42 +0000 (17:05 -0800)]
include/linux/eventfd.h: fix incorrect filename is a comment

Comment in eventfd.h referred to 'include/asm-generic/fcntl.h'
while the correct path is 'include/uapi/asm-generic/fcntl.h'.

Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
11 years agomtd: mtd_stresstest: use prandom_bytes()
Akinobu Mita [Thu, 28 Feb 2013 01:05:40 +0000 (17:05 -0800)]
mtd: mtd_stresstest: use prandom_bytes()

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Cc: Artem Bityutskiy <dedekind1@gmail.com>
Cc: David Woodhouse <dwmw2@infradead.org>
Cc: "Theodore Ts'o" <tytso@mit.edu>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Laight <david.laight@aculab.com>
Cc: Eilon Greenstein <eilong@broadcom.com>
Cc: Michel Lespinasse <walken@google.com>
Cc: Robert Love <robert.w.love@intel.com>
Cc: Valdis Kletnieks <valdis.kletnieks@vt.edu>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
11 years agomtd: mtd_subpagetest: convert to use prandom library
Akinobu Mita [Thu, 28 Feb 2013 01:05:39 +0000 (17:05 -0800)]
mtd: mtd_subpagetest: convert to use prandom library

This removes home-brewed pseudo-random number generator and use
prandom library.

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Cc: Artem Bityutskiy <dedekind1@gmail.com>
Cc: David Woodhouse <dwmw2@infradead.org>
Cc: "Theodore Ts'o" <tytso@mit.edu>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Laight <david.laight@aculab.com>
Cc: Eilon Greenstein <eilong@broadcom.com>
Cc: Michel Lespinasse <walken@google.com>
Cc: Robert Love <robert.w.love@intel.com>
Cc: Valdis Kletnieks <valdis.kletnieks@vt.edu>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
11 years agomtd: mtd_speedtest: use prandom_bytes
Akinobu Mita [Thu, 28 Feb 2013 01:05:37 +0000 (17:05 -0800)]
mtd: mtd_speedtest: use prandom_bytes

Use prandom_bytes instead of equivalent local function.

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Cc: Artem Bityutskiy <dedekind1@gmail.com>
Cc: David Woodhouse <dwmw2@infradead.org>
Cc: "Theodore Ts'o" <tytso@mit.edu>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Laight <david.laight@aculab.com>
Cc: Eilon Greenstein <eilong@broadcom.com>
Cc: Michel Lespinasse <walken@google.com>
Cc: Robert Love <robert.w.love@intel.com>
Cc: Valdis Kletnieks <valdis.kletnieks@vt.edu>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
11 years agomtd: mtd_pagetest: convert to use prandom library
Akinobu Mita [Thu, 28 Feb 2013 01:05:35 +0000 (17:05 -0800)]
mtd: mtd_pagetest: convert to use prandom library

This removes home-brewed pseudo-random number generator and use
prandom library.

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Cc: Artem Bityutskiy <dedekind1@gmail.com>
Cc: David Woodhouse <dwmw2@infradead.org>
Cc: "Theodore Ts'o" <tytso@mit.edu>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Laight <david.laight@aculab.com>
Cc: Eilon Greenstein <eilong@broadcom.com>
Cc: Michel Lespinasse <walken@google.com>
Cc: Robert Love <robert.w.love@intel.com>
Cc: Valdis Kletnieks <valdis.kletnieks@vt.edu>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
11 years agomtd: mtd_oobtest: convert to use prandom library
Akinobu Mita [Thu, 28 Feb 2013 01:05:33 +0000 (17:05 -0800)]
mtd: mtd_oobtest: convert to use prandom library

This removes home-brewed pseudo-random number generator and use
prandom library.

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Cc: Artem Bityutskiy <dedekind1@gmail.com>
Cc: David Woodhouse <dwmw2@infradead.org>
Cc: "Theodore Ts'o" <tytso@mit.edu>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Laight <david.laight@aculab.com>
Cc: Eilon Greenstein <eilong@broadcom.com>
Cc: Michel Lespinasse <walken@google.com>
Cc: Robert Love <robert.w.love@intel.com>
Cc: Valdis Kletnieks <valdis.kletnieks@vt.edu>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
11 years agomtd: mtd_nandecctest: use prandom_bytes instead of get_random_bytes()
Akinobu Mita [Thu, 28 Feb 2013 01:05:31 +0000 (17:05 -0800)]
mtd: mtd_nandecctest: use prandom_bytes instead of get_random_bytes()

Using prandom_bytes() is enough.  Because this data is only used
for testing, not used for cryptographic use.

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Cc: Artem Bityutskiy <dedekind1@gmail.com>
Cc: David Woodhouse <dwmw2@infradead.org>
Cc: "Theodore Ts'o" <tytso@mit.edu>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Laight <david.laight@aculab.com>
Cc: Eilon Greenstein <eilong@broadcom.com>
Cc: Michel Lespinasse <walken@google.com>
Cc: Robert Love <robert.w.love@intel.com>
Cc: Valdis Kletnieks <valdis.kletnieks@vt.edu>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
11 years agokernel/utsname.c: fix wrong comment about clone_uts_ns()
Yuanhan Liu [Thu, 28 Feb 2013 01:05:30 +0000 (17:05 -0800)]
kernel/utsname.c: fix wrong comment about clone_uts_ns()

Fix the wrong comment about the return value of clone_uts_ns()

Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Acked-by: Serge Hallyn <serge.hallyn@canonical.com>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
11 years agonbd: fix sparse warning
Alex Elder [Thu, 28 Feb 2013 01:05:28 +0000 (17:05 -0800)]
nbd: fix sparse warning

I just fixed this in "drivers/block/rbd.c" and I noticed that
"drivers/block/nbd.c" has the same problem.  Fix a warning issued by
sparse by adding some lockdep annotations to indicate the queue lock gets
dropped (because it's held when do_nbd_request() is called) and
re-acquired within the function.

Signed-off-by: Alex Elder <elder@inktank.com>
Cc: Paul Clements <paul.clements@steeleye.com>
Cc: Paul Clements <paul.clements@us.sios.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
11 years agonbd: update documentation and link to mailinglist
Wouter Verhelst [Thu, 28 Feb 2013 01:05:27 +0000 (17:05 -0800)]
nbd: update documentation and link to mailinglist

Documentation/blockdev/nbd.txt contained some documentation which was
horribly outdated and probably still dates from the original patch that
added NBD support to the kernel.

This patch removes the useless and outdated bits.  The tools on nbd.sf.net
are fully documented in manpages, which is where documentation for the
non-kernel bits should live.

Additionally, add a reference to the MAINTAINERS file for the nbd-general
mailinglist that is used for discussion of the userland tools and the
kernel module already.

Signed-off-by: Wouter Verhelst <w@uter.be>
Cc: Paul Clements <Paul.Clements@steeleye.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
11 years agonbd: show read-only state in sysfs
Paolo Bonzini [Thu, 28 Feb 2013 01:05:26 +0000 (17:05 -0800)]
nbd: show read-only state in sysfs

Pass the read-only flag to set_device_ro, so that it will be visible to
the block layer and in sysfs.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Cc: Paul Clements <Paul.Clements@steeleye.com>
Cc: Alex Bligh <alex@alex.org.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
11 years agonbd: fsync and kill block device on shutdown
Paolo Bonzini [Thu, 28 Feb 2013 01:05:25 +0000 (17:05 -0800)]
nbd: fsync and kill block device on shutdown

There are two problems with shutdown in the NBD driver.

1: Receiving the NBD_DISCONNECT ioctl does not sync the filesystem.

   This patch adds the sync operation into __nbd_ioctl()'s
   NBD_DISCONNECT handler.  This is useful because BLKFLSBUF is restricted
   to processes that have CAP_SYS_ADMIN, and the NBD client may not
   possess it (fsync of the block device does not sync the filesystem,
   either).

2: Once we clear the socket we have no guarantee that later reads will
   come from the same backing storage.

   The patch adds calls to kill_bdev() in __nbd_ioctl()'s socket
   clearing code so the page cache is cleaned, lest reads that hit on the
   page cache will return stale data from the previously-accessible disk.

Example:

    # qemu-nbd -r -c/dev/nbd0 /dev/sr0
    # file -s /dev/nbd0
    /dev/stdin: # UDF filesystem data (version 1.5) etc.
    # qemu-nbd -d /dev/nbd0
    # qemu-nbd -r -c/dev/nbd0 /dev/sda
    # file -s /dev/nbd0
    /dev/stdin: # UDF filesystem data (version 1.5) etc.

While /dev/sda has:

    # file -s /dev/sda
    /dev/sda: x86 boot sector; etc.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Acked-by: Paul Clements <Paul.Clements@steeleye.com>
Cc: Alex Bligh <alex@alex.org.uk>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
11 years agonbd: support FLUSH requests
Alex Bligh [Thu, 28 Feb 2013 01:05:23 +0000 (17:05 -0800)]
nbd: support FLUSH requests

Currently, the NBD device does not accept flush requests from the Linux
block layer.  If the NBD server opened the target with neither O_SYNC nor
O_DSYNC, however, the device will be effectively backed by a writeback
cache.  Without issuing flushes properly, operation of the NBD device will
not be safe against power losses.

The NBD protocol has support for both a cache flush command and a FUA
command flag; the server will also pass a flag to note its support for
these features.  This patch adds support for the cache flush command and
flag.  In the kernel, we receive the flags via the NBD_SET_FLAGS ioctl,
and map NBD_FLAG_SEND_FLUSH to the argument of blk_queue_flush.  When the
flag is active the block layer will send REQ_FLUSH requests, which we
translate to NBD_CMD_FLUSH commands.

FUA support is not included in this patch because all free software
servers implement it with a full fdatasync; thus it has no advantage over
supporting flush only.  Because I [Paolo] cannot really benchmark it in a
realistic scenario, I cannot tell if it is a good idea or not.  It is also
not clear if it is valid for an NBD server to support FUA but not flush.
The Linux block layer gives a warning for this combination, the NBD
protocol documentation says nothing about it.

The patch also fixes a small problem in the handling of flags: nbd->flags
must be cleared at the end of NBD_DO_IT, but the driver was not doing
that.  The bug manifests itself as follows.  Suppose you two different
client/server pairs to start the NBD device.  Suppose also that the first
client supports NBD_SET_FLAGS, and the first server sends
NBD_FLAG_SEND_FLUSH; the second pair instead does neither of these two
things.  Before this patch, the second invocation of NBD_DO_IT will use a
stale value of nbd->flags, and the second server will issue an error every
time it receives an NBD_CMD_FLUSH command.

This bug is pre-existing, but it becomes much more important after this
patch; flush failures make the device pretty much unusable, unlike

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Alex Bligh <alex@alex.org.uk>
Acked-by: Paul Clements <Paul.Clements@steeleye.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>