Re: [PATCHv4 2/2] usb: gadget: storage: optional SCSI WRITE FUA bit

From: Alan Stern
Date: Thu Jul 22 2010 - 10:13:33 EST


On Thu, 22 Jul 2010, Andy Shevchenko wrote:

> MS Windows mounts removable storage in "Removal optimized mode" by
> default. All the writes to the media are synchronous which is achieved
> by setting FUA (Force Unit Access) bit in SCSI WRITE(10,12) commands.
> This prevents I/O requests aggregation in block layer dramatically
> decreasing performance.
>
> This patch brings an option to accept or ignore mentioned bit
> a) via specifying module parameter "nofua", or
> b) through sysfs entry
> /sys/devices/platform/musb_hdrc/gadget/gadget-lun-X/nofua
>
> Patch is based on the work that was done by Denis Karpov for Maemo 5
> platform.
>
> Signed-off-by: Andy Shevchenko <ext-andriy.shevchenko@xxxxxxxxx>
> Cc: Denis Karpov <ext-denis.2.karpov@xxxxxxxxx>
> Cc: Adrian Hunter <adrian.hunter@xxxxxxxxx>
> Cc: Alan Stern <stern@xxxxxxxxxxxxxxxxxxx>
> Cc: David Brownell <dbrownell@xxxxxxxxxxxxxxxxxxxxx>
> Cc: Greg Kroah-Hartman <gregkh@xxxxxxx>
> Cc: linux-usb@xxxxxxxxxxxxxxx
> ---
> .../sysfs-devices-platform-musb_hdrc-gadget | 12 +++++++
> drivers/usb/gadget/file_storage.c | 31 +++++++++++++++----
> drivers/usb/gadget/storage_common.c | 28 ++++++++++++++++++
> 3 files changed, 64 insertions(+), 7 deletions(-)
> create mode 100644 Documentation/ABI/testing/sysfs-devices-platform-musb_hdrc-gadget
>
> diff --git a/Documentation/ABI/testing/sysfs-devices-platform-musb_hdrc-gadget b/Documentation/ABI/testing/sysfs-devices-platform-musb_hdrc-gadget
> new file mode 100644
> index 0000000..192d3f3
> --- /dev/null
> +++ b/Documentation/ABI/testing/sysfs-devices-platform-musb_hdrc-gadget
> @@ -0,0 +1,12 @@
> +What: /sys/devices/platform/musb_hdrc/gadget/gadget-lun-X/nofua

The name of the new file and the path given here shouldn't mention
musb_hdrc. That's what _you_ see because that's the device controller
driver you use, but other people will see something different. As a
simple test, you might try using dummy_hcd instead and see what the
name turns out to be.

Just put "..." instead of "musb_hdrc", or something like that.

> +Date: July 2010
> +Contact: Andy Shevchenko <andy.shevchenko@xxxxxxxxx>
> +Description:
> + Show or set the reaction on the FUA (Force Unit Access) bit in
> + the SCSI WRITE(10,12) commands when a gadget in USB Mass
> + Storage mode.
> +
> + Possible values are:
> + 1 -> ignore FUA flag
> + 0 -> follow on it

Change this to "obey the FUA flag".

The rest is okay. Subject to these changes:

Acked-by: Alan Stern <stern@xxxxxxxxxxxxxxxxxxx>

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/