]> Pileus Git - ~andy/linux/log
~andy/linux
12 years agoisci: add support for 2 more oem parmeters
Henryk Dembkowski [Thu, 24 Feb 2011 00:55:11 +0000 (16:55 -0800)]
isci: add support for 2 more oem parmeters

1/ add OEM paramater support for mode_type (MPC vs APC)
2/ add OEM parameter support for max_number_concurrent_device_spin_up
3/ cleanup scic_sds_controller_start_next_phy

todo: hook up the amp control afe parameters into the afe init code

Signed-off-by: Henryk Dembkowski <henryk.dembkowski@intel.com>
Signed-off-by: Jacek Danecki <Jacek.Danecki@intel.com>
[cleaned up scic_sds_controller_start_next_phy]
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
12 years agoisci: Adding EFI variable skeletal support
Dave Jiang [Wed, 23 Feb 2011 08:02:24 +0000 (00:02 -0800)]
isci: Adding EFI variable skeletal support

Adding EFI variable retrieving for OEM parameters. Still need GUID and
variable name.

Also updated the data struct for oem parameters and hex file for firmware

Signed-off-by: Dave Jiang <dave.jiang@intel.com>
[fix CONFIG_EFI=n compile error]
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
12 years agoisci: Add support for probing OROM for OEM params
Dan Williams [Tue, 8 Mar 2011 17:52:49 +0000 (09:52 -0800)]
isci: Add support for probing OROM for OEM params

We need to scan the OROM for signature and grab the OEM parameters. We
also need to do the same for EFI. If all fails then we resort to user
binary blob, and if that fails then we go to the defaults.

Share the format with the create_fw utility so that all possible sources
of the parameters are in-sync.

Signed-off-by: Dave Jiang <dave.jiang@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
12 years agoisci: reset hardware at init
Dan Williams [Thu, 24 Mar 2011 00:31:27 +0000 (17:31 -0700)]
isci: reset hardware at init

Don't assume the hardware is in a known state at init.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
12 years agoisci: task.h compile and checkpatch fixes
Dan Williams [Thu, 17 Mar 2011 15:04:43 +0000 (08:04 -0700)]
isci: task.h compile and checkpatch fixes

A usage of "FALSE" leaked in as well as some checkpatch escapes.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
12 years agoisci: don't hold scic_lock over calls to sas_task_abort()
Jeff Skirvin [Wed, 16 Mar 2011 16:41:59 +0000 (09:41 -0700)]
isci: don't hold scic_lock over calls to sas_task_abort()

In the case where submitted I/Os fail with the status code
SCI_FAILURE_REMOTE_DEVICE_RESET_REQUIRED, the execute function now waits
until scic_lock is cleared before calling the helper function
"isci_request_signal_device_reset" which sets the flag for the pending
reset condition on the I/O.

Signed-off-by: Jeff Skirvin <jeffrey.d.skirvin@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
12 years agoisci: fix incorrect assumptions about task->dev and task->dev->port being NULL
Dan Williams [Fri, 11 Mar 2011 18:13:51 +0000 (10:13 -0800)]
isci: fix incorrect assumptions about task->dev and task->dev->port being NULL

A domain_device has the same lifetime as its related scsi_target.  The
scsi_target is reference counted based on outstanding commands,
therefore it is safe to assume that if we have a valid sas_task that the
->dev pointer is also valid.

The asd_sas_port of a domain_device has the same lifetime as the driver
so it can also never be NULL as long as the sas_task is valid and the
driver is loaded.

This also cleans up isci_task_complete_for_upper_layer(), renames it to
isci_task_refuse() and notices that the isci_completion_selection
parameter was set to isci_perform_normal_io_completion by all callers.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
12 years agoisci: add "isci_id" attribute
Dan Williams [Thu, 10 Mar 2011 08:01:43 +0000 (00:01 -0800)]
isci: add "isci_id" attribute

Allow each controller to be identified via sysfs.

# cat /sys/class/scsi_host/host13/isci_id
1

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
12 years agoisci: All pending requests are terminated before stopping the device.
Jeff Skirvin [Wed, 9 Mar 2011 03:32:16 +0000 (20:32 -0700)]
isci: All pending requests are terminated before stopping the device.

Make sure all pending I/O including any in the libsas error handler
process is cleaned-up.

Signed-off-by: Jeff Skirvin <jeffrey.d.skirvin@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
12 years agoisci: Always set response/status for requests going into the error path.
Jeff Skirvin [Mon, 7 Mar 2011 23:40:47 +0000 (16:40 -0700)]
isci: Always set response/status for requests going into the error path.

In the case of I/O requests being failed because of a required device
reset condition, set the response and status to indicate an I/O failure.

Signed-off-by: Jeff Skirvin <jeffrey.d.skirvin@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
12 years agoisci: Errors in the submit path for SATA devices manage the ap lock.
Dan Williams [Thu, 10 Mar 2011 05:27:46 +0000 (21:27 -0800)]
isci: Errors in the submit path for SATA devices manage the ap lock.

Since libsas takes the domain device sata_dev.ap->lock before submitting
a task, error completions in the submit path for SATA devices must
unlock/relock when completing the sas_task back to libsas.

Signed-off-by: Jeff Skirvin <jeffrey.d.skirvin@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
12 years agoisci: Fixed BUG_ON in isci_abort_task_process_cb callback.
Jeff Skirvin [Fri, 4 Mar 2011 22:06:58 +0000 (14:06 -0800)]
isci: Fixed BUG_ON in isci_abort_task_process_cb callback.

The request may be in the "aborted" or the "completed" state when
performing a task management operation on it.

Signed-off-by: Jeff Skirvin <jeffrey.d.skirvin@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
12 years agoisci: Fix TMF build for SAS/SATA LUN reset cases.
Jeff Skirvin [Fri, 4 Mar 2011 22:06:56 +0000 (14:06 -0800)]
isci: Fix TMF build for SAS/SATA LUN reset cases.

In the case where a SAS or SATA LUN reset TMF is built a NULL pointer
dereference occurred because of the (unused) callback data pointer.

Signed-off-by: Jeff Skirvin <jeffrey.d.skirvin@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: Jacek Danecki <Jacek.Danecki@intel.com>
12 years agoisci: Termination handling cleanup, added termination timeouts.
Jeff Skirvin [Fri, 4 Mar 2011 22:06:52 +0000 (14:06 -0800)]
isci: Termination handling cleanup, added termination timeouts.

Added a request "dead" state for use when a termination wait times-out.

isci_terminate_pending_requests now detaches the device's pending list
and terminates each entry on the detached list.

Signed-off-by: Jeff Skirvin <jeffrey.d.skirvin@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
12 years agoisci: Code review change for completion pointer cleanup.
Jeff Skirvin [Fri, 4 Mar 2011 22:06:50 +0000 (14:06 -0800)]
isci: Code review change for completion pointer cleanup.

Since the request structure contains a pointer to the completion to be
used if the request is being aborted or terminated, there is no reason
to pass the completion as a pointer to isci_terminate_request_core().

Signed-off-by: Jeff Skirvin <jeffrey.d.skirvin@intel.com>
Signed-off-by: Jacek Danecki <Jacek.Danecki@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
12 years agoisci: Cleaning up task execute path.
Jeff Skirvin [Wed, 9 Mar 2011 02:22:07 +0000 (19:22 -0700)]
isci: Cleaning up task execute path.

Made sure the device ready check accounts for all states.
Moved the aborted task check into the loop of pulling task requests
off of the submitted list.

Signed-off-by: Jeff Skirvin <jeffrey.d.skirvin@intel.com>
Signed-off-by: Jacek Danecki <Jacek.Danecki@intel.com>
[remove host and device starting state checks]
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
12 years agoisci: save the i/o tag outside the scic request structure.
Jeff Skirvin [Fri, 4 Mar 2011 22:06:46 +0000 (14:06 -0800)]
isci: save the i/o tag outside the scic request structure.

The pointer to the core representation of a request is marked NULL at
completion, but we need to save the i/o tag for task management.

Signed-off-by: Jeff Skirvin <jeffrey.d.skirvin@intel.com>
Signed-off-by: Jacek Danecki <Jacek.Danecki@intel.com>
[revise changelog]
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
12 years agoisci: Any reset indicated on an I/O completion escalates it to the error path.
Jeff Skirvin [Fri, 4 Mar 2011 22:06:44 +0000 (14:06 -0800)]
isci: Any reset indicated on an I/O completion escalates it to the error path.

If there is a pending device reset, the I/O is used to accomplish the reset by setting the
RESET bit in the task status, and then putting the task into the error handler
path using sas abort task.

Signed-off-by: Jeff Skirvin <jeffrey.d.skirvin@intel.com>
Signed-off-by: Jacek Danecki <Jacek.Danecki@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
12 years agoisci: fix completion / abort path.
Jeff Skirvin [Fri, 4 Mar 2011 22:06:42 +0000 (14:06 -0800)]
isci: fix completion / abort path.

Corrected use of the request state_lock in the completion callback.

In the case where an abort (or reset) thread is trying to terminate an
I/O request, it sets the request state to "aborting" (or "terminating")
if the state is still "starting".  One of the bugs was to never set the
state to "completed".  Another was to not correctly recognize the
situation where the I/O had completed but the sas_task was still pending
callback to task_done - this was typically a problem in the LUN and
device reset cases.

It is now possible that we leave isci_task_abort_task() with
request->io_request_completion pointing to localy allocated
aborted_io_completion struct. It may result in a system crash.

Signed-off-by: Jeff Skirvin <jeffrey.d.skirvin@intel.com>
Signed-off-by: Maciej Trela <Maciej.Trela@intel.com>
Signed-off-by: Jacek Danecki <Jacek.Danecki@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
12 years agoisci: Changes in isci_host_completion_routine
Jeff Skirvin [Fri, 4 Mar 2011 22:06:40 +0000 (14:06 -0800)]
isci: Changes in isci_host_completion_routine

Changes to move management of the reqs_in_process entry for the request here.
Made changes to note when the task is already in the abort path and
cannot be completed through callbacks.

Signed-off-by: Jeff Skirvin <jeffrey.d.skirvin@intel.com>
Signed-off-by: Jacek Danecki <Jacek.Danecki@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
12 years agoisci: isci_request_cleanup_completed_loiterer checks task before task_done
Jeff Skirvin [Fri, 4 Mar 2011 22:06:38 +0000 (14:06 -0800)]
isci: isci_request_cleanup_completed_loiterer checks task before task_done

In the condition where outstanding I/Os are being cleaned from the device
requests in process list, the cleanup function needs to check that the
request is actually a sas-task and not a task management function.

Signed-off-by: Jeff Skirvin <jeffrey.d.skirvin@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
12 years agoisci: cleanup debug leftovers in isci.h
Dan Williams [Wed, 9 Mar 2011 05:30:28 +0000 (21:30 -0800)]
isci: cleanup debug leftovers in isci.h

Reported-by: James Bottomley <James.Bottomley@suse.de>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
12 years agoisci: replace remote_device_lock with scic_lock
Dan Williams [Fri, 4 Mar 2011 02:01:43 +0000 (18:01 -0800)]
isci: replace remote_device_lock  with scic_lock

The remote_device_lock is currently used to protect a controller global
resource (RNCs), but the remote_device_lock is per-port.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
12 years agoisci: preallocate remote devices
Dan Williams [Fri, 4 Mar 2011 01:59:32 +0000 (17:59 -0800)]
isci: preallocate remote devices

Until we synchronize against device removal this limits the damage of
use after free bugs to the driver's own objects.  Unless we implement
reference counting we need to ensure at least a subset of a remote
device is valid at all times.  We follow the lead of other libsas
drivers that also preallocate devices.

This also enforces maximum remote device accounting at the lldd layer,
but the core may still run out of RNC's before we hit this limit.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
12 years agoisci: replace isci_remote_device completion with event queue
Dan Williams [Fri, 4 Mar 2011 20:10:29 +0000 (12:10 -0800)]
isci: replace isci_remote_device completion with event queue

Replace the device completion infrastructure with the controller wide
event queue.  There was a potential for the stop and ready notifications
to corrupt each other, now that cannot happen.

The stop pending flag cannot be used until devices are statically
allocated.  We temporarily need to maintain a completion to handle
waiting for an object that has disappeared, but we can at least stop
scribbling on freed memory.

A future change will also get rid of the "stopping" state as it should
not be exposed to the rest of the driver.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
12 years agoisci: kill "host quiesce" mechanism
Dan Williams [Mon, 7 Mar 2011 22:47:35 +0000 (14:47 -0800)]
isci: kill "host quiesce" mechanism

The midlayer is already throttling i/o in the places where host_quiesce
was trying to prevent further i/o to the device.  It's also problematic
in that it holds a lock over GFP_KERNEL allocations.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
12 years agoisci: remove sci_device_handle
Dan Williams [Fri, 4 Mar 2011 19:51:43 +0000 (11:51 -0800)]
isci: remove sci_device_handle

It belies the fact that isci_remote_device and scic_sds_remote_device
are one in same object with the same lifetime rules.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
12 years agoisci: kill isci_host list in favor of an array
Dan Williams [Tue, 8 Mar 2011 00:02:25 +0000 (16:02 -0800)]
isci: kill isci_host list in favor of an array

isci_host_by_id() should have been a clue that an array would have been
a simpler approach.

Reported-by: James Bottomley <James.Bottomley@suse.de>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
12 years agoisci: enable isci for dmar builds
Dan Williams [Fri, 4 Mar 2011 01:59:25 +0000 (17:59 -0800)]
isci: enable isci for dmar builds

Now that phys_to_virt() and virt_to_phys() have been removed we are no
longer violating the dma mapping (or kmap apis).

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
12 years agoisci: pad stp and smp request sizes
Dan Williams [Thu, 3 Mar 2011 22:58:11 +0000 (14:58 -0800)]
isci: pad stp and smp request sizes

Ross says:
 "The memory allocation for these requests doesn’t take into account the
  additional memory needed when the code in
  scic_sds_s[mst]p_request_assign_buffers() shifts the struct
  scu_task_context so that it is cache line aligned:

  In an example from my machine, total buffer that I’ve given to SCIC goes
  from 0x410024566f84 to 0x410024567308.  From this same example, this
  call shifts my task_context_buffer from 0x410024567208 to
  0x410024567240.

  This means that the task_context_buffer that used to range from
  0x410024567208 to 0x410024567308 instead now goes from 0x410024567240 to
  0x410024567340.

  When the memset() call at the end of scic_task_request_construct()
  clears out this task_context_buffer, it does so from 0x410024567240 to
  0x410024567340, effectively killing whatever buffer follows this
  allocation in memory."

djbw:
Use the kernel's PTR_ALIGN instead of
scic_sds_request_align_task_context_buffer() and SMP_CACHE_BYTES instead of
the local CACHE_LINE_SIZE definition.

TODO: These allocations really want to be better defined in a union rather
than opaque buffers carved up by macros.

Reported-by: Ross Zwisler <ross.zwisler@intel.com>
Signed-off-by: Jacek Danecki <Jacek.Danecki@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
12 years agoisci: fix hang after target reset
Dan Williams [Thu, 3 Mar 2011 00:45:18 +0000 (16:45 -0800)]
isci: fix hang after target reset

When aborting a task context we need to be sure that the hardware has acted on
this request (retrieved the task context) before invalidating the remote node
context.  In the case of the "dummy" task context and remote node we do not
have the full state machine that goes through the complete tc abort and rnc
invalidate states.  Instead we ensure the hardware has seen and acted on

Signed-off-by: Jacek Danecki <Jacek.Danecki@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
12 years agoisci: Cleanup warning messages for phy resets
Dave Jiang [Wed, 2 Mar 2011 21:10:45 +0000 (13:10 -0800)]
isci: Cleanup warning messages for phy resets

Moving some of the chattiness of warning messages to debug so only the Linux
system messages are shown.

Signed-off-by: Dave Jiang <dave.jiang@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
12 years agoisci: Adding support for phy enable and disable
Dave Jiang [Wed, 2 Mar 2011 20:31:24 +0000 (12:31 -0800)]
isci: Adding support for phy enable and disable

Adding support for PHY_FUNC_LINK_RESET and PHY_FUNC_DISABLE. This allow the
sysfs knob enable (both 0 and 1) and link_reset to work properly.

Signed-off-by: Dave Jiang <dave.jiang@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
12 years agoisci: controller stop/start fixes
Pawel Marek [Tue, 1 Mar 2011 20:31:06 +0000 (12:31 -0800)]
isci: controller stop/start fixes

Core reworks to support stopping and re-starting the controller, lays the
groundwork for phy disable / re-enable and fixes other bugs around port/phy
setup/teardown.

Signed-off-by: Pawel Marek <pawel.marek@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
12 years agoisci: handle cases where a d2h fis is used report an ncq error
Piotr Sawicki [Fri, 25 Feb 2011 21:07:38 +0000 (13:07 -0800)]
isci: handle cases where a d2h fis is used report an ncq error

Observed that some devices return a d2h fis, treat like an sdb error fis.

Signed-off-by: Piotr Sawicki <piotr.sawicki@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
12 years agoisci: workaround port task scheduler starvation issue
Tomasz Chudy [Fri, 25 Feb 2011 10:25:09 +0000 (02:25 -0800)]
isci: workaround port task scheduler starvation issue

There is a condition whereby TCs (task contexts) can jump to the head of
the round robin queue causing indefinite starvation of pending tasks.
Posting a TC to a suspended RNC (remote node context) causes the
hardware to select that task first, but since the RNC is suspended the
scheduler proceeds to the next task in the expected round robin fashion,
restoring TC arbitration fairness.

Signed-off-by: Tomasz Chudy <tomasz.chudy@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
12 years agoisci: rework timer api
Dan Williams [Wed, 2 Mar 2011 19:49:26 +0000 (11:49 -0800)]
isci: rework timer api

Prepare the timer api for the arrival of dynamic creation and
destruction events from the core.  It pretended to do this previously
but the core to date only used it in a static init-time only fashion.
This is an interim fix until a cleaner event queue can be developed.

1/ make all locking external to the api (add WARN_ONCE to verify)
2/ add a timer_destroy interface (to be used by the core)
3/ use del_timer_sync() prior to deallocating timer data
4/ delete the "timer_list" indirection, we only have timers allocated
   for the isci_host
5/ fix detection of timer list allocation errors

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
12 years agoisci: fix sas address reporting
Dan Williams [Fri, 25 Feb 2011 18:25:21 +0000 (10:25 -0800)]
isci: fix sas address reporting

Undo the open coded and incorrect translation of the oem parameter sas
address to its libsas expected format.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
12 years agoisci: Removing deprecated functions
Dave Jiang [Wed, 23 Feb 2011 23:57:33 +0000 (15:57 -0800)]
isci: Removing deprecated functions

Removed all callbacks in the deprecated.c. Core will call the appropriate
functions directly.

Signed-off-by: Dave Jiang <dave.jiang@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
12 years agoisci: Change event notify calls from scic_cb_* to isci_event_*
Dave Jiang [Wed, 23 Feb 2011 23:57:30 +0000 (15:57 -0800)]
isci: Change event notify calls from scic_cb_* to isci_event_*

Renaming the callbacks to apparopriate event notify calls for the LLDD.

Signed-off-by: Dave Jiang <dave.jiang@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
12 years agoisci: have the driver use native SG calls and DMA-API
Dave Jiang [Wed, 23 Feb 2011 23:57:27 +0000 (15:57 -0800)]
isci: have the driver use native SG calls and DMA-API

Remove abstraction for SG building and get rid of callbacks for getting
DMA memory mapping.

Signed-off-by: Dave Jiang <dave.jiang@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
12 years agoisci: Make the driver copy data directly from and to sg for PIO
Dave Jiang [Wed, 23 Feb 2011 23:57:24 +0000 (15:57 -0800)]
isci: Make the driver copy data directly from and to sg for PIO

We can copy the data directly to and from sg for SATA PIO read operations.
There is no reason to involve the hardware SGL. In the process we also need
to kmap the sg because we don't know where that can come from.

We also do to not call phys_to_virt(). The driver already has the information.
We can just calculcate the appropriate offets.

Signed-off-by: Dave Jiang <dave.jiang@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
12 years agoisci: Removed special macros that does 64bit address math
Dave Jiang [Tue, 22 Feb 2011 23:39:32 +0000 (16:39 -0700)]
isci: Removed special macros that does 64bit address math

These macros are not necessary. We can do 64bit math directly.

Signed-off-by: Dave Jiang <dave.jiang@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
12 years agoisci: fix for asserts during aborts/resets to SAS/SATA in APC mode
Piotr Sawicki [Wed, 23 Feb 2011 08:09:14 +0000 (00:09 -0800)]
isci: fix for asserts during aborts/resets to SAS/SATA in APC mode

Sending aborts/resets to SAS/SATA targets in APC mode eventually causes
an assert in scic_sds_apc_agent_link_up().  We need to handle the hard reset
case for apc mode ports.

Signed-off-by: Piotr Sawicki <piotr.sawicki@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
12 years agoisci: Add Support for new TC completion codes
Tomasz Chudy [Wed, 23 Feb 2011 08:09:04 +0000 (00:09 -0800)]
isci: Add Support for new TC completion codes

Update the SCI Core to comprehend the changes in the TC completion
codes from A0 to B0.  Specifically, there isnew R_ER code
differences for command and data FISes.

Changes are as follows:

1) 0x16 now additionally indicates an R_ERR received for a COMMAND
FIS being sent to a SATA target.  0x16 for SSP still indicates a
NAK received for a COMMAND frame.  Fix is to retry TC to be compliant
with SATA spec or ensure proper error handling of return value
(not spec compliant I don't believe).
2) 0x1B was previously called DONE_BREAK_RCVD for STP and
DONE_LL_ABORT_ERR for SSP.  Now it is universally called
DONE_LL_ABORT_ERR.  This is purely a superficial change.
3) 0x32 is no longer a reserved code.  Now it indicates
DONE_CMD_SDMA_ERR for STP/SSP.  There was a fatal error on the
SDMA for a command IU (includes Raw frames).  Consider retry,
but at a minimum gracefully fail the request.
4) 0x33 is no longer a reserved code.  Now it indicates
DONE_CMD_LL_ABORT_ERR for SSP.  There was a break receivd
during transmission of a command IU.  Consider retry, but
at a minimum gracefully fail the request.

Signed-off-by: Tomasz Chudy <Tomasz.Chudy@intel.com>
Signed-off-by: Jacek Danecki <Jacek.Danecki@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
12 years agoisci: clean up remaining silicon revision ifdefs in phy init
Dan Williams [Wed, 23 Feb 2011 08:09:01 +0000 (00:09 -0800)]
isci: clean up remaining silicon revision ifdefs in phy init

Use the dynamic revision detection code in
scic_sds_phy_link_layer_initialization() and apply some coding style
fixups (long deref chains).  The compile time max link rate setting is
removed in favor of honoring the user-parameter max.

Reported-by: Krzysztof Wierzbicki <Krzysztof.Wierzbicki@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
12 years agoisci: Add support for user parameters in SCIC layer
Jacek Danecki [Wed, 23 Feb 2011 08:08:58 +0000 (00:08 -0800)]
isci: Add support for user parameters in SCIC layer

Add support for the following parameters in SCIC:

     /**
       * This field specifies the NOTIFY (ENABLE SPIN UP) primitive
       * insertion frequency for this phy index.
       */
      u32  notify_enable_spin_up_insertion_frequency;

      /**
       * This method specifies the number of transmitted DWORDs within which
       * to transmit a single ALIGN primitive.  This value applies regardless
       * of what type of device is attached or connection state.  A value of
       * 0 indicates that no ALIGN primitives will be inserted.
       */
      u16  align_insertion_frequency;

      /**
       * This method specifies the number of transmitted DWORDs within which
       * to transmit 2 ALIGN primitives.  This applies for SAS connections
       * only.  A minimum value of 3 is required for this field.
       */
      u16  in_connection_align_insertion_frequency;

Signed-off-by: Krzysztof Wierzbicki <Krzysztof.Wierzbicki@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
12 years agoisci: Move transport layer registers from port to phy
Henryk Dembkowski [Wed, 23 Feb 2011 08:08:52 +0000 (00:08 -0800)]
isci: Move transport layer registers from port to phy

At init and RNC resume we need to touch every phy in a port to be sure
we have initialized STP properties in the case where port_index !=
phy_index.  Also add some missing __iomem annotations.

Signed-off-by: Henryk Dembkowski <henryk.dembkowski@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
12 years agoisci: fix "no outbound task timeout" default value
Tomasz Chudy [Wed, 23 Feb 2011 08:08:49 +0000 (00:08 -0800)]
isci: fix "no outbound task timeout" default value

The default should be 5us.  The hardware encodes it in 256ns increments,
so the value should be 20 to approximate a 5us timeout.

Signed-off-by: Tomasz Chudy <Tomasz.Chudy@intel.com>
Signed-off-by: Jacek Danecki <Jacek.Danecki@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
12 years agoisci: phy state machine cleanup step1
Dan Williams [Wed, 23 Feb 2011 08:14:06 +0000 (00:14 -0800)]
isci: phy state machine cleanup step1

 c99 the struct initializers:
1/ allows grep to consistently show method name associations.  The
   naming is mostly consistent (except when it isn't) so this guarantees
   coverage of present and future exception cases.
2/ let's the compiler guarantee that the state table array entry
   correlates with an actual state name and detect accidental reordering or
   deletion of states.
/ allows default handler's to be identified easily

Signed-off-by: Jacek Danecki <Jacek.Danecki@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
12 years agoisci: Move firmware loading to per PCI device
Dave Jiang [Tue, 22 Feb 2011 09:27:03 +0000 (01:27 -0800)]
isci: Move firmware loading to per PCI device

Moved the firmware loading from per adapter to per PCI device. This should
prevent firmware from being loaded twice becuase of 2 SCU controller per
PCI device. We do have to do it per PCI device because request_firmware()
requires a struct device passed in.

Signed-off-by: Dave Jiang <dave.jiang@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
12 years agoisci: Initialize proc_name field in scsi_host_template
Havard Skinnemoen [Sat, 19 Feb 2011 02:32:08 +0000 (18:32 -0800)]
isci: Initialize proc_name field in scsi_host_template

The proc_name field in struct scsi_host_template is exported through sysfs and
allows userspace tools to identify the driver behind a particular SCSI host
controller.

Initialize this field so that userspace tools can easily identify isci host
controllers through sysfs.

Signed-off-by: Havard Skinnemoen <hskinnemoen@google.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
12 years agoisci: remove scic_controller_get_handler_methods and ilk
Edmund Nadolski [Fri, 18 Feb 2011 17:25:17 +0000 (09:25 -0800)]
isci: remove scic_controller_get_handler_methods and ilk

This removes scic_controller_get_handler_methods and its
associated unused code.

Signed-off-by: Edmund Nadolski <edmund.nadolski@intel.com>
[djbw: kill off the legacy handler, now that we have basic error isr support]
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
12 years agoisci: debug fixes
Dan Williams [Fri, 18 Feb 2011 17:25:15 +0000 (09:25 -0800)]
isci: debug fixes

Some of the chain walks to get back to our dev are invalid.

isci_remote_device_change_state: delete rather than adding conditional deref
chain walking
isci_request_change_state: fix, it was being called too early
isci_request_ssp_io_request_get_lun: fix compile breakage hidden by ifdef DEBUG

Signed-off-by: Maciej Trela <maciej.trela@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
12 years agoisci: advertise linkrate
Dan Williams [Fri, 18 Feb 2011 17:25:13 +0000 (09:25 -0800)]
isci: advertise linkrate

Inform libsas of the linkrate of direct attached links.

Reported-by: Haavard Skinnemoen <hskinnemoen@gmail.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
12 years agoisci: implement error isr
Dan Williams [Fri, 18 Feb 2011 17:25:11 +0000 (09:25 -0800)]
isci: implement error isr

Add basic support for handling/reporting error interrupts.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
12 years agoisci: enable interrupts during controller start, and flush discovery
Edmund Nadolski [Fri, 18 Feb 2011 17:25:09 +0000 (09:25 -0800)]
isci: enable interrupts during controller start, and flush discovery

Polling the event queue during scan is an unneeded holdover from the
original driver.

Signed-off-by: Edmund Nadolski <edmund.nadolski@intel.com>
[djbw: ensure we flush all port events and domain discovery]
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
12 years agoisci: cleanup "starting" state handling
Dan Williams [Fri, 18 Feb 2011 17:25:07 +0000 (09:25 -0800)]
isci: cleanup "starting" state handling

The lldd actively disallows requests in the "starting" state.  Retrying
or holding off commands in this state is sub-optimal:
1/ it adds another state check to the fast path
2/ retrying can cause libsas to give up

However, isci's ->lldd_dev_found() routine already waits for controller
start to complete before allowing further progress.  Checking the
"starting" state in isci_task_execute_task and the isr is redundant and
misleading.  Clean this up and introduce a controller-wide event queue
to start reeling in "completion" proliferation in the driver.

The "stopping" state cleanups are in a similar vein, rely on the the isr
and other paths being precluded from occurring rather than implementing
state checking logic.

Reported-by: Christoph Hellwig <hch@infradead.org>
Cc: Jeff Garzik <jeff@garzik.org>
Signed-off-by: Edmund Nadolski <edmund.nadolski@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
12 years agoisci: bypass scic_controller_get_handler_methods()
Dan Williams [Fri, 18 Feb 2011 17:25:05 +0000 (09:25 -0800)]
isci: bypass scic_controller_get_handler_methods()

The indirection is unecessary and broken in the current case that assigns the
handlers based on a not up-to-date pdev->msix_enabled value.

Route the handlers directly to the requisite core routines.

Todo: hook up error interrupt handling

Reported-by: Jeff Garzik <jeff@garzik.org>
Cc: Christoph Hellwig <hch@infradead.org>
Signed-off-by: Edmund Nadolski <edmund.nadolski@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
12 years agoisci: remove SCIC_DEBUG_ENABLED, and fixup an odd macro
Dan Williams [Thu, 17 Feb 2011 23:01:46 +0000 (15:01 -0800)]
isci: remove SCIC_DEBUG_ENABLED, and fixup an odd macro

This will be replaced by state machine tracepoints and should have been a part
of the logger removal.

Ran across scic_sds_port_decrement_request_count() which is an ugly macro
which silently hides accounting errors.  Turn it into a WARN_ONCE to see if it
ever triggers.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
12 years agoisci: kill a callback cast
Dan Williams [Sat, 12 Feb 2011 19:50:15 +0000 (11:50 -0800)]
isci: kill a callback cast

Callbacks are already type unsafe, obfuscating things further by casting the
callback routine is less safe because now function argument number changes
will not be caught by the compiler.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
12 years agoisci: coding style changes for remote device
Henryk Dembkowski [Sat, 12 Feb 2011 19:50:13 +0000 (11:50 -0800)]
isci: coding style changes for remote device

Change names from upper to low letters

Signed-off-by: Henryk Dembkowski <henryk.dembkowski@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
12 years agoisci: cleanup core consolidation leftovers
Dan Williams [Sat, 12 Feb 2011 19:50:11 +0000 (11:50 -0800)]
isci: cleanup core consolidation leftovers

Remove duplicated license and header file includes that were leftover
from commit 4c1db2d0 "isci: consolidate core" (in the isci.git historical
branch).

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
12 years agoisci: c99 tables cleanup step1
Henryk Dembkowski [Sat, 12 Feb 2011 19:50:09 +0000 (11:50 -0800)]
isci: c99 tables cleanup step1

scic_sds_stp_remote_device_ready_substate_handler_table[]
scic_sds_smp_remote_device_ready_substate_handler_table[]

c99 the struct initializers:
1/ allows grep to consistently show method name associations.  The
   naming is mostly consistent (except when it isn't) so this guarantees
   coverage of present and future exception cases.
2/ let's the compiler guarantee that the state table array entry
   correlates with an actual state name and detect accidental reordering or
   deletion of states.
3/ allows default handler's to be identified easily

Signed-off-by: Henryk Dembkowski <henryk.dembkowski@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
12 years agoisci: coding style changes for remote device
Henryk Dembkowski [Sat, 12 Feb 2011 19:50:07 +0000 (11:50 -0800)]
isci: coding style changes for remote device

Change names from upper to low letters

Signed-off-by: Henryk Dembkowski <henryk.dembkowski@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
12 years agoisci: remote device and node cleanup step1
Henryk Dembkowski [Sat, 12 Feb 2011 19:50:05 +0000 (11:50 -0800)]
isci: remote device and node cleanup step1

c99 the struct initializers (scic_sds_remote_device_state_handler_table[]):
1/ allows grep to consistently show method name associations.  The
   naming is mostly consistent (except when it isn't) so this guarantees
   coverage of present and future exception cases.
2/ let's the compiler guarantee that the state table array entry
   correlates with an actual state name and detect accidental reordering or
   deletion of states.
3/ allows default handler's to be identified easily

Change names from upper to low letters

Cleanup empty lines

Signed-off-by: Henryk Dembkowski <henryk.dembkowski@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
12 years agoisci: removing unused loglevel module param
Dave Jiang [Sat, 12 Feb 2011 02:04:28 +0000 (18:04 -0800)]
isci: removing unused loglevel module param

We no longer use the loglevel parameter. Remove.

Signed-off-by: Dave Jiang <dave.jiang@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
12 years agoisci: kill sci_types.h
Edmund Nadolski [Tue, 8 Feb 2011 16:31:55 +0000 (09:31 -0700)]
isci: kill sci_types.h

Signed-off-by: Edmund Nadolski <edmund.nadolski@intel.com>
[rebased after killing SCI_IO_REQUEST_DATA_DIRECTION]
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
12 years agoisci: kill SCI_IO_REQUEST_DATA_DIRECTION
Dan Williams [Wed, 9 Feb 2011 01:53:10 +0000 (17:53 -0800)]
isci: kill SCI_IO_REQUEST_DATA_DIRECTION

It's an unnecessary typedef that mirrors the kernel's enum
dma_data_direction.

Also cleanup some long variable names along the way.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
12 years agoisci: remove SCI_INVALID_HANDLE
Edmund Nadolski [Tue, 8 Feb 2011 16:28:42 +0000 (09:28 -0700)]
isci: remove SCI_INVALID_HANDLE

Replace SCI_INVALID_HANDLE with NULL

Signed-off-by: Edmund Nadolski <edmund.nadolski@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
12 years agoisci: remove unused SC_LIBRARY_HANDLE_T typedef
Edmund Nadolski [Tue, 8 Feb 2011 15:09:10 +0000 (08:09 -0700)]
isci: remove unused SC_LIBRARY_HANDLE_T typedef

Signed-off-by: Edmund Nadolski <edmund.nadolski@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
12 years agoisci: Intel(R) C600 Series Chipset Storage Control Unit Driver
Dan Williams [Sun, 3 Jul 2011 05:56:22 +0000 (22:56 -0700)]
isci: Intel(R) C600 Series Chipset Storage Control Unit Driver

Support for the up to 2x4-port 6Gb/s SAS controllers embedded in the
chipset.

This is a snapshot of the first publicly available version of the driver,
commit 4c1db2d0 in the 'historical' branch.

   git://git.kernel.org/pub/scm/linux/kernel/git/djbw/isci.git historical

Signed-off-by: Maciej Trela <maciej.trela@intel.com>
Signed-off-by: Dave Jiang <dave.jiang@intel.com>
Signed-off-by: Edmund Nadolski <edmund.nadolski@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
13 years agoLinux 3.0-rc2 v3.0-rc2
Linus Torvalds [Mon, 6 Jun 2011 09:06:33 +0000 (18:06 +0900)]
Linux 3.0-rc2

13 years agomm: fix ENOSPC returned by handle_mm_fault()
Hugh Dickins [Mon, 6 Jun 2011 05:03:13 +0000 (22:03 -0700)]
mm: fix ENOSPC returned by handle_mm_fault()

Al Viro observes that in the hugetlb case, handle_mm_fault() may return
a value of the kind ENOSPC when its caller is expecting a value of the
kind VM_FAULT_SIGBUS: fix alloc_huge_page()'s failure returns.

Signed-off-by: Hugh Dickins <hughd@google.com>
Acked-by: Al Viro <viro@zeniv.linux.org.uk>
Cc: stable@kernel.org
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agoMerge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6
Linus Torvalds [Mon, 6 Jun 2011 08:51:28 +0000 (17:51 +0900)]
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6:
  ALSA: usb - turn off de-emphasis in s/pdif for cm6206
  ALSA: asihpi: Use angle brackets for system includes
  ALSA: fm801: add error handling if auto-detect fails
  ALSA: hda - Check pin support EAPD in ad198x_power_eapd_write
  ALSA: hda - Fix HP and Front pins of ad1988/ad1989 in ad198x_power_eapd()
  ALSA: 6fire: Don't leak firmware in error path
  ASoC: Fix wm_hubs input PGA ZC bits
  ASoC: Fix dapm_is_shared_kcontrol so everything isn't shared

13 years agoMerge branch 'hwmon-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/groec...
Linus Torvalds [Mon, 6 Jun 2011 08:48:02 +0000 (17:48 +0900)]
Merge branch 'hwmon-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/staging

* 'hwmon-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/staging:
  hwmon: (max6642): Better chip detection schema
  hwmon: (coretemp) Further relax temperature range checks
  hwmon: (coretemp) Fix TjMax detection for older CPUs
  hwmon: (coretemp) Relax target temperature range check
  hwmon: (max6642) Rename temp_fault sysfs attribute to temp2_fault

13 years agoMerge branch 'fix/asoc' into for-linus
Takashi Iwai [Mon, 6 Jun 2011 07:28:49 +0000 (09:28 +0200)]
Merge branch 'fix/asoc' into for-linus

13 years agoMerge branch 'for-linus' of git://android.git.kernel.org/kernel/tegra
Linus Torvalds [Sat, 4 Jun 2011 23:11:11 +0000 (08:11 +0900)]
Merge branch 'for-linus' of git://android.git.kernel.org/kernel/tegra

* 'for-linus' of git://android.git.kernel.org/kernel/tegra:
  ARM: Tegra: Harmony: Fix conflicting GPIO numbering

13 years agoARM: Tegra: Harmony: Fix conflicting GPIO numbering
Stephen Warren [Tue, 31 May 2011 21:14:07 +0000 (15:14 -0600)]
ARM: Tegra: Harmony: Fix conflicting GPIO numbering

Currently, both the WM8903 and TPS6586x chips attempt to register with
gpiolib using the same GPIO numbers. This causes the audio driver to
fail to initialize.

To solve this, add a define to board-harmony.h for the TPS6586x, and make
board-harmony-power.c use this define, instead of directly referencing
TEGRA_NR_GPIOS.

This fixes a regression introduced by commit
6f168f2fa60f87e85e0df25e87e2372f22f5eb7c.
ARM: tegra: harmony: initialize the TPS65862 PMIC

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Colin Cross <ccross@android.com>
13 years agoMerge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/btrfs...
Linus Torvalds [Sat, 4 Jun 2011 21:17:23 +0000 (06:17 +0900)]
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/btrfs-unstable

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/btrfs-unstable: (25 commits)
  btrfs: fix uninitialized variable warning
  btrfs: add helper for fs_info->closing
  Btrfs: add mount -o inode_cache
  btrfs: scrub: add explicit plugging
  btrfs: use btrfs_ino to access inode number
  Btrfs: don't save the inode cache if we are deleting this root
  btrfs: false BUG_ON when degraded
  Btrfs: don't save the inode cache in non-FS roots
  Btrfs: make sure we don't overflow the free space cache crc page
  Btrfs: fix uninit variable in the delayed inode code
  btrfs: scrub: don't reuse bios and pages
  Btrfs: leave spinning on lookup and map the leaf
  Btrfs: check for duplicate entries in the free space cache
  Btrfs: don't try to allocate from a block group that doesn't have enough space
  Btrfs: don't always do readahead
  Btrfs: try not to sleep as much when doing slow caching
  Btrfs: kill BTRFS_I(inode)->block_group
  Btrfs: don't look at the extent buffer level 3 times in a row
  Btrfs: map the node block when looking for readahead targets
  Btrfs: set range_start to the right start in count_range_bits
  ...

13 years agohwmon: (max6642): Better chip detection schema
Per Dalén [Thu, 26 May 2011 13:08:53 +0000 (09:08 -0400)]
hwmon: (max6642): Better chip detection schema

Improve detection of MAX6642 by reading non existing registers (0x04, 0x06
and 0xff). Reading those registers returns the previously read value.

Signed-off-by: Per Dalen <per.dalen@appeartv.com>
[guenter.roeck@ericsson.com: added second set of register reads]
Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
13 years agoMerge git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-rc-fixes-2.6
Linus Torvalds [Sat, 4 Jun 2011 14:19:51 +0000 (23:19 +0900)]
Merge git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-rc-fixes-2.6

* git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-rc-fixes-2.6:
  [SCSI] Fix oops caused by queue refcounting failure

13 years agoMerge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6
Linus Torvalds [Sat, 4 Jun 2011 14:16:00 +0000 (23:16 +0900)]
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6

* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6: (40 commits)
  tg3: Fix tg3_skb_error_unmap()
  net: tracepoint of net_dev_xmit sees freed skb and causes panic
  drivers/net/can/flexcan.c: add missing clk_put
  net: dm9000: Get the chip in a known good state before enabling interrupts
  drivers/net/davinci_emac.c: add missing clk_put
  af-packet: Add flag to distinguish VID 0 from no-vlan.
  caif: Fix race when conditionally taking rtnl lock
  usbnet/cdc_ncm: add missing .reset_resume hook
  vlan: fix typo in vlan_dev_hard_start_xmit()
  net/ipv4: Check for mistakenly passed in non-IPv4 address
  iwl4965: correctly validate temperature value
  bluetooth l2cap: fix locking in l2cap_global_chan_by_psm
  ath9k: fix two more bugs in tx power
  cfg80211: don't drop p2p probe responses
  Revert "net: fix section mismatches"
  drivers/net/usb/catc.c: Fix potential deadlock in catc_ctrl_run()
  sctp: stop pending timers and purge queues when peer restart asoc
  drivers/net: ks8842 Fix crash on received packet when in PIO mode.
  ip_options_compile: properly handle unaligned pointer
  iwlagn: fix incorrect PCI subsystem id for 6150 devices
  ...

13 years agobtrfs: fix uninitialized variable warning
David Sterba [Fri, 3 Jun 2011 14:29:08 +0000 (16:29 +0200)]
btrfs: fix uninitialized variable warning

With Linus' tree, today's linux-next build (powercp ppc64_defconfig)
produced this warning:

fs/btrfs/delayed-inode.c: In function 'btrfs_delayed_update_inode':
fs/btrfs/delayed-inode.c:1598:6: warning: 'ret' may be used
uninitialized in this function

Introduced by commit 16cdcec736cd ("btrfs: implement delayed inode items
operation").

This fixes a bug in btrfs_update_inode(): if the returned value from
btrfs_delayed_update_inode is a nonzero garbage, inode stat data are not
updated and several call paths may hit a BUG_ON or fail with strange
code.

Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: David Sterba <dsterba@suse.cz>
13 years agobtrfs: add helper for fs_info->closing
David Sterba [Tue, 31 May 2011 16:07:27 +0000 (18:07 +0200)]
btrfs: add helper for fs_info->closing

wrap checking of filesystem 'closing' flag and fix a few missing memory
barriers.

Signed-off-by: David Sterba <dsterba@suse.cz>
13 years agoBtrfs: add mount -o inode_cache
Chris Mason [Fri, 3 Jun 2011 13:36:29 +0000 (09:36 -0400)]
Btrfs: add mount -o inode_cache

This makes the inode map cache default to off until we
fix the overflow problem when the free space crcs don't fit
inside a single page.

Signed-off-by: Chris Mason <chris.mason@oracle.com>
13 years agobtrfs: scrub: add explicit plugging
Arne Jansen [Sat, 28 May 2011 20:58:38 +0000 (20:58 +0000)]
btrfs: scrub: add explicit plugging

With the removal of the implicit plugging scrub ends up doing more and
smaller I/O than necessary. This patch adds explicit plugging per chunk.

Signed-off-by: Arne Jansen <sensille@gmx.net>
Signed-off-by: Chris Mason <chris.mason@oracle.com>
13 years agobtrfs: use btrfs_ino to access inode number
David Sterba [Tue, 31 May 2011 17:08:14 +0000 (17:08 +0000)]
btrfs: use btrfs_ino to access inode number

commit 4cb5300bc ("Btrfs: add mount -o auto_defrag") accesses inode
number directly while it should use the helper with the new inode
number allocator.

Signed-off-by: David Sterba <dsterba@suse.cz>
Signed-off-by: Chris Mason <chris.mason@oracle.com>
13 years agoBtrfs: don't save the inode cache if we are deleting this root
Josef Bacik [Tue, 31 May 2011 19:33:33 +0000 (19:33 +0000)]
Btrfs: don't save the inode cache if we are deleting this root

With xfstest 254 I can panic the box every time with the inode number caching
stuff on.  This is because we clean the inodes out when we delete the subvolume,
but then we write out the inode cache which adds an inode to the subvolume inode
tree, and then when it gets evicted again the root gets added back on the dead
roots list and is deleted again, so we have a double free.  To stop this from
happening just return 0 if refs is 0 (and we're not the tree root since tree
root always has refs of 0).  With this fix 254 no longer panics.  Thanks,

Signed-off-by: Josef Bacik <josef@redhat.com>
Tested-by: David Sterba <dsterba@suse.cz>
Signed-off-by: Chris Mason <chris.mason@oracle.com>
13 years agobtrfs: false BUG_ON when degraded
Arne Jansen [Mon, 30 May 2011 08:36:16 +0000 (08:36 +0000)]
btrfs: false BUG_ON when degraded

In degraded mode the struct btrfs_device of missing devs don't have
device->name set. A kstrdup of NULL correctly returns NULL. Don't
BUG in this case.

Signed-off-by: Arne Jansen <sensille@gmx.net>
Signed-off-by: Chris Mason <chris.mason@oracle.com>
13 years agoBtrfs: don't save the inode cache in non-FS roots
liubo [Wed, 1 Jun 2011 09:42:49 +0000 (09:42 +0000)]
Btrfs: don't save the inode cache in non-FS roots

This adds extra checks to make sure the inode map we are caching really
belongs to a FS root instead of a special relocation tree.  It
prevents crashes during balancing operations.

Signed-off-by: Liu Bo <liubo2009@cn.fujitsu.com>
Signed-off-by: Chris Mason <chris.mason@oracle.com>
13 years agoBtrfs: make sure we don't overflow the free space cache crc page
Chris Mason [Fri, 3 Jun 2011 05:26:53 +0000 (01:26 -0400)]
Btrfs: make sure we don't overflow the free space cache crc page

The free space cache uses only one page for crcs right now,
which means we can't have a cache file bigger than the
crcs we can fit in the first page.  This adds a check to
enforce that restriction.

Signed-off-by: Chris Mason <chris.mason@oracle.com>
13 years agoBtrfs: fix uninit variable in the delayed inode code
Chris Mason [Fri, 3 Jun 2011 05:13:45 +0000 (01:13 -0400)]
Btrfs: fix uninit variable in the delayed inode code

The nitems counter needs to start at zero

Signed-off-by: Chris Mason <chris.mason@oracle.com>
13 years agobtrfs: scrub: don't reuse bios and pages
Arne Jansen [Sat, 28 May 2011 19:57:55 +0000 (21:57 +0200)]
btrfs: scrub: don't reuse bios and pages

The current scrub implementation reuses bios and pages as often as possible,
allocating them only on start and releasing them when finished. This leads
to more problems with the block layer than it's worth. The elevator gets
confused when there are more pages added to the bio than bi_size suggests.
This patch completely rips out the reuse of bios and pages and allocates
them freshly for each submit.

Signed-off-by: Arne Jansen <sensille@gmx.net>
Signed-off-by: Chris Maosn <chris.mason@oracle.com>
13 years agoMerge branch 'for-linus' of git://git.kernel.dk/linux-block
Linus Torvalds [Fri, 3 Jun 2011 23:11:26 +0000 (08:11 +0900)]
Merge branch 'for-linus' of git://git.kernel.dk/linux-block

* 'for-linus' of git://git.kernel.dk/linux-block:
  block: Use hlist_entry() for io_context.cic_list.first
  cfq-iosched: Remove bogus check in queue_fail path
  xen/blkback: potential null dereference in error handling
  xen/blkback: don't call vbd_size() if bd_disk is NULL
  block: blkdev_get() should access ->bd_disk only after success
  CFQ: Fix typo and remove unnecessary semicolon
  block: remove unwanted semicolons
  Revert "block: Remove extra discard_alignment from hd_struct."
  nbd: adjust 'max_part' according to part_shift
  nbd: limit module parameters to a sane value
  nbd: pass MSG_* flags to kernel_recvmsg()
  block: improve the bio_add_page() and bio_add_pc_page() descriptions

13 years agoMerge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/vapier...
Linus Torvalds [Fri, 3 Jun 2011 23:04:10 +0000 (08:04 +0900)]
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/vapier/blackfin

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/vapier/blackfin:
  Blackfin: strncpy: fix handling of zero lengths

13 years agoMerge branch 'stable' of git://git.kernel.org/pub/scm/linux/kernel/git/cmetcalf/linux...
Linus Torvalds [Fri, 3 Jun 2011 23:03:16 +0000 (08:03 +0900)]
Merge branch 'stable' of git://git.kernel.org/pub/scm/linux/kernel/git/cmetcalf/linux-tile

* 'stable' of git://git.kernel.org/pub/scm/linux/kernel/git/cmetcalf/linux-tile:
  asm-generic/unistd.h: support sendmmsg syscall
  tile: enable CONFIG_BUGVERBOSE

13 years agoMerge branch 'linux-next' of git://git.infradead.org/ubifs-2.6
Linus Torvalds [Fri, 3 Jun 2011 22:59:32 +0000 (07:59 +0900)]
Merge branch 'linux-next' of git://git.infradead.org/ubifs-2.6

* 'linux-next' of git://git.infradead.org/ubifs-2.6:
  UBIFS: fix-up free space earlier
  UBIFS: intialize LPT earlier
  UBIFS: assert no fixup when writing a node
  UBIFS: fix clean znode counter corruption in error cases
  UBIFS: fix memory leak on error path
  UBIFS: fix shrinker object count reports
  UBIFS: fix recovery broken by the previous recovery fix
  UBIFS: amend ubifs_recover_leb interface
  UBIFS: introduce a "grouped" journal head flag
  UBIFS: supress false error messages

13 years agoMerge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt...
Linus Torvalds [Fri, 3 Jun 2011 22:58:48 +0000 (07:58 +0900)]
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-2.6-ktest

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-2.6-ktest:
  ktest: Ignore unset values of the minconfig in config_bisect
  ktest: Fix result of rebooting the kernel
  ktest: Fix off-by-one in config bisect result

13 years agoMerge branch 'rmobile-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
Linus Torvalds [Fri, 3 Jun 2011 22:53:23 +0000 (07:53 +0900)]
Merge branch 'rmobile-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/lethal/sh-2.6

* 'rmobile-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/lethal/sh-2.6:
  ARM: mach-shmobile: add DMAC clock definitions on SH7372
  ARM: arch-shmobile: support SDHI card detection on mackerel, using a GPIO
  sh_mobile_meram: MERAM platform data for LCDC