03 May, 2010

2 commits


11 Apr, 2010

1 commit


30 Mar, 2010

1 commit

  • …it slab.h inclusion from percpu.h

    percpu.h is included by sched.h and module.h and thus ends up being
    included when building most .c files. percpu.h includes slab.h which
    in turn includes gfp.h making everything defined by the two files
    universally available and complicating inclusion dependencies.

    percpu.h -> slab.h dependency is about to be removed. Prepare for
    this change by updating users of gfp and slab facilities include those
    headers directly instead of assuming availability. As this conversion
    needs to touch large number of source files, the following script is
    used as the basis of conversion.

    http://userweb.kernel.org/~tj/misc/slabh-sweep.py

    The script does the followings.

    * Scan files for gfp and slab usages and update includes such that
    only the necessary includes are there. ie. if only gfp is used,
    gfp.h, if slab is used, slab.h.

    * When the script inserts a new include, it looks at the include
    blocks and try to put the new include such that its order conforms
    to its surrounding. It's put in the include block which contains
    core kernel includes, in the same order that the rest are ordered -
    alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
    doesn't seem to be any matching order.

    * If the script can't find a place to put a new include (mostly
    because the file doesn't have fitting include block), it prints out
    an error message indicating which .h file needs to be added to the
    file.

    The conversion was done in the following steps.

    1. The initial automatic conversion of all .c files updated slightly
    over 4000 files, deleting around 700 includes and adding ~480 gfp.h
    and ~3000 slab.h inclusions. The script emitted errors for ~400
    files.

    2. Each error was manually checked. Some didn't need the inclusion,
    some needed manual addition while adding it to implementation .h or
    embedding .c file was more appropriate for others. This step added
    inclusions to around 150 files.

    3. The script was run again and the output was compared to the edits
    from #2 to make sure no file was left behind.

    4. Several build tests were done and a couple of problems were fixed.
    e.g. lib/decompress_*.c used malloc/free() wrappers around slab
    APIs requiring slab.h to be added manually.

    5. The script was run on all .h files but without automatically
    editing them as sprinkling gfp.h and slab.h inclusions around .h
    files could easily lead to inclusion dependency hell. Most gfp.h
    inclusion directives were ignored as stuff from gfp.h was usually
    wildly available and often used in preprocessor macros. Each
    slab.h inclusion directive was examined and added manually as
    necessary.

    6. percpu.h was updated not to include slab.h.

    7. Build test were done on the following configurations and failures
    were fixed. CONFIG_GCOV_KERNEL was turned off for all tests (as my
    distributed build env didn't work with gcov compiles) and a few
    more options had to be turned off depending on archs to make things
    build (like ipr on powerpc/64 which failed due to missing writeq).

    * x86 and x86_64 UP and SMP allmodconfig and a custom test config.
    * powerpc and powerpc64 SMP allmodconfig
    * sparc and sparc64 SMP allmodconfig
    * ia64 SMP allmodconfig
    * s390 SMP allmodconfig
    * alpha SMP allmodconfig
    * um on x86_64 SMP allmodconfig

    8. percpu.h modifications were reverted so that it could be applied as
    a separate patch and serve as bisection point.

    Given the fact that I had only a couple of failures from tests on step
    6, I'm fairly confident about the coverage of this conversion patch.
    If there is a breakage, it's likely to be something in one of the arch
    headers which should be easily discoverable easily on most builds of
    the specific arch.

    Signed-off-by: Tejun Heo <tj@kernel.org>
    Guess-its-ok-by: Christoph Lameter <cl@linux-foundation.org>
    Cc: Ingo Molnar <mingo@redhat.com>
    Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>

    Tejun Heo
     

18 Feb, 2010

4 commits

  • Move the decision which trace tag and trace level to use for the scsi
    result trace to zfcp_dbf.h. zfcp_dbf_scsi_result is already an inline
    function, so move the trace code there, simplifying the response
    handling in zfcp_fsf.c.

    Reviewed-by: Swen Schillig
    Signed-off-by: Christof Schmitt
    Signed-off-by: James Bottomley

    Christof Schmitt
     
  • Kernel code uses dev as short name for the struct device. Rename the
    sysfs_device in zfcp_unit and zfcp_port to match this convention.

    Reviewed-by: Swen Schillig
    Signed-off-by: Christof Schmitt
    Signed-off-by: James Bottomley

    Christof Schmitt
     
  • The smatch tool from http://repo.or.cz/w/smatch.git warns about this:

    drivers/s390/scsi/zfcp_scsi.c +64 zfcp_scsi_command_fail(5) warn: variable dereferenced before check 'scpnt->device'
    drivers/s390/scsi/zfcp_scsi.c +64 zfcp_scsi_command_fail(5) warn: variable dereferenced before check 'scpnt->device->host'
    drivers/s390/scsi/zfcp_scsi.c +93 zfcp_scsi_queuecommand(23) warn: variable dereferenced before check 'unit'

    Fix the first two warnings by removing the checks for scpnt->device
    and -> host: As long as the SCSI command exists, there is also a
    scsi_device and a Scsi_Host.

    Fix the last warning by removing the BUG_ON checks in
    zfcp_scsi_queuecommand, they are leftovers from previous paranoia
    about wrong pointers between data structures.

    Reviewed-by: Swen Schillig
    Signed-off-by: Christof Schmitt
    Signed-off-by: James Bottomley

    Christof Schmitt
     
  • Move the code for tracking FSF requests to new file to have this code
    in one place. The functions for adding and removing requests on the
    I/O path are already inline. The alloc and free functions are only
    called once, so it does not hurt to inline them and add them to the
    same file.

    Reviewed-by: Swen Schillig
    Signed-off-by: Christof Schmitt
    Signed-off-by: James Bottomley

    Christof Schmitt
     

18 Jan, 2010

1 commit

  • Introduce a zfcp callback for timeouts triggered from FC BSG. With
    zfcp, the underlying hardware cannot abort CT or ELS requests, so
    there is nothing to do when the block layer timeout expires. To avoid
    interference with the block layer timeout, simply indicate that the
    block layer timer should be reset. The timer running in the hardware
    for the pending CT or ELS request will return the request when it
    expires.

    Signed-off-by: Swen Schillig
    Signed-off-by: Christof Schmitt
    Signed-off-by: James Bottomley

    Swen Schillig
     

05 Dec, 2009

10 commits

  • The flag ZFCP_STATUS_FSFREQ_TMFUNCNOTSUPP is never set and hence can
    be removed. This is a leftover from the time when zfcp had to decide
    whether the target supports a "logical unit reset" or not. Nowadays,
    the SCSI midlayer calls the eh_device_reset_handler or the
    eh_target_reset_handler and zfcp simply maps this to a "logical unit
    reset" or a "target reset".

    Reviewed-by: Swen Schillig
    Signed-off-by: Christof Schmitt
    Signed-off-by: James Bottomley

    Christof Schmitt
     
  • Enable the display of supported and active fc4s for zfcp in the FC
    transport class. zfcp only supports FCP, so simply hard-code this
    information. The zfcp hbaapi already has this information hardcoded,
    but this would allow to switch from the coding in the zfcp hbaapi to
    the common FC transport attributes in the future.

    Reviewed-by: Swen Schillig
    Signed-off-by: Christof Schmitt
    Signed-off-by: James Bottomley

    Christof Schmitt
     
  • In case the SCSI error recovery starts because of a SCSI command
    timeout, but then something else triggers the rport to be deleted, the
    SCSI error recovery will run to the end and set the SCSI device
    offline. To prevent this, call the FC transport function
    fc_block_scsi_eh which waits until the rport leaves the BLOCKED state.
    This guarantees that communication is possible if the rport is ONLINE,
    or the SCSI devices will be removed if the rport state switches to
    NOT_PRESENT.

    Reviewed-by: Swen Schillig
    Signed-off-by: Christof Schmitt
    Signed-off-by: James Bottomley

    Christof Schmitt
     
  • Remove some redundancies in FC related code and trace:
    - drop redundant data from SAN trace (local s_id that only changes
    during link down, ls_code that is already part of payload, d_id in
    ct response trace that is always the same as in ct request trace)
    - use one common fsf struct to hold zfcp data for ct and els requests
    - leverage common fsf struct for FC passthrough job data, allocate it
    with dd_bsg_data for passthrough requests and unify common code for
    ct and els passthrough request
    - simplify callback handling in zfcp_fc

    Reviewed-by: Swen Schillig
    Signed-off-by: Christof Schmitt
    Signed-off-by: James Bottomley

    Christof Schmitt
     
  • Use common data structures for FCP CMND, FCP RSP and related
    definitions and remove zfcp private definitions. Split the FCP CMND
    setup and FCP RSP evaluation code in seperate functions. Use inline
    functions to not negatively impact the I/O path.

    Reviewed-by: Swen Schillig
    Signed-off-by: Christof Schmitt
    Signed-off-by: James Bottomley

    Christof Schmitt
     
  • If an error occurs that triggers the call to fc_remote_port_delete,
    ideally this call would happen before any I/O is passed back to the
    SCSI midlayer through scsi_done. The SCSI midlayer will retry the
    commands and fc_remote_port_chkready will return the correct status
    code. But with the delay between calling scsi_done in softirq context
    and the call to fc_remote_port_delete from the workqueue, there is a
    window where zfcp returns DID_ERROR. This leads to SCSI error recovery
    which then leads to offline SCSI devices since all recovery actions
    will fail with the rport now being blocked.

    In this window, zfcp has to return DID_IMM_RETRY just as the FC
    transport class would do in fc_remote_port_chkready for the blocked
    fc_rport. As soon as the fc_rport is BLOCKED, fc_remote_port_chkready
    will do the right thing.

    Additionally, there are two more cases to catch in zfcp_scsi_queuecommand:
    - After the port has been opened, the unit has to be opened. During
    this period I/O has to be retried. This can also be handled with
    DID_IMM_RETRY.
    - If the access to the unit fails, but the port is good, then
    this single unit cannot be accessed and I/O to this unit has to fail
    without involving the FC transport class.

    Reviewed-by: Swen Schillig
    Signed-off-by: Christof Schmitt
    Signed-off-by: James Bottomley

    Christof Schmitt
     
  • Replace the local reference counting by already available mechanisms
    offered by kref. Where possible existing device structures were used,
    including the same functionality.

    Signed-off-by: Swen Schillig
    Signed-off-by: Christof Schmitt
    Signed-off-by: James Bottomley

    Swen Schillig
     
  • The global config_lock was used to protect the configuration organized
    in independent lists. It is not necessary to have a lock on driver
    level for this purpose. This patch replaces the global config_lock
    with a set of local list locks.

    Signed-off-by: Swen Schillig
    Signed-off-by: Christof Schmitt
    Signed-off-by: James Bottomley

    Swen Schillig
     
  • Adapt the change_queue_depth callback in zfcp for the new reason
    parameter. Simply pass each call back to the SCSI midlayer, there are
    no resource adjustments necessary for zfcp.

    Signed-off-by: Christof Schmitt

    Removes check for (depth
    Signed-off-by: James Bottomley

    Christof Schmitt
     
  • This patch modifies scsi_host_template->change_queue_depth so that
    it takes an argument indicating why it is being called. This will be
    used so that if a LLD needs to do some extra processing when
    handling queue fulls or later ramp ups, it can do so.

    This is a simple port of the drivers setting a change_queue_depth
    callback. In the patch I just have these LLDs adjust the queue depth
    if the user was requesting it.

    Signed-off-by: Mike Christie

    [Vasu.Dev: v2
    Also converted pmcraid_change_queue_depth and then verified
    all modules compile using "make allmodconfig" for any new build
    warnings on X86_64.

    Updated original description after combing two original
    patches from Mike to make this patch git bisectable.]
    Signed-off-by: Vasu Dev
    [jejb: fixed up 53c700]
    Signed-off-by: James Bottomley

    Mike Christie
     

21 Sep, 2009

1 commit


05 Sep, 2009

7 commits

  • The fc_rport structure reserves a reference where a LLD can put
    information required in a situation where the fc transport class is
    triggering LLD callbacks. The zfcp driver was using this variable
    directly which is discouraged. This patch solves this issue by making
    this reference unnecessary. In addition the dev_loss_tmo callback is
    removed, it is not required: zfcp does not access the fc_rport after
    calling fc_remote_port_delete.

    Signed-off-by: Swen Schillig
    Signed-off-by: Christof Schmitt
    Signed-off-by: James Bottomley

    Swen Schillig
     
  • Change the dbf data and functions to use the zfcp_dbf prefix
    throughout the code. Also change the calls to dbf to use zfcp_dbf
    instead of zfcp_adapter.

    Signed-off-by: Swen Schillig
    Signed-off-by: Christof Schmitt
    Signed-off-by: James Bottomley

    Swen Schillig
     
  • The zfcp_adapter structure was growing over time to a size of almost
    one memory page. To reduce the size of the data structure and to
    seperate different layers, put all qdio related data in the new
    zfcp_qdio data structure.

    Signed-off-by: Swen Schillig
    Signed-off-by: Christof Schmitt
    Signed-off-by: James Bottomley

    Swen Schillig
     
  • Remove the global driver work queue and replace it with a workqueue
    local to the adapter. The usage of this workqueue makes this the
    correct place for the structure. In addition multiple adapters won't
    block each other due to the serialization of the queued work.

    Signed-off-by: Swen Schillig
    Signed-off-by: Christof Schmitt
    Signed-off-by: James Bottomley

    Swen Schillig
     
  • The combination wait_queue/wakeup in conjunction with the flag
    ZFCP_STATUS_FSFREQ_COMPLETED to signal the completion of an fsfreq
    was not race-safe and can be better solved by a completion.

    Signed-off-by: Swen Schillig
    Signed-off-by: Christof Schmitt
    Signed-off-by: James Bottomley

    Swen Schillig
     
  • The default trace level is to only trace failed SCSI commands. Thus it
    is not necessary to collect trace data for most SCSI commands since it
    will be thrown away later. Restructure the SCSI trace infrastructure
    to first check the trace level in a inline function and only do the
    expensive data collection for matching trace levels.

    Reviewed-by: Swen Schillig
    Signed-off-by: Christof Schmitt
    Signed-off-by: James Bottomley

    Christof Schmitt
     
  • In certain error scenarios ports, rports are getting attached,
    validated and removed from the systems environment. Depending on the
    layer this occurs asynchronously. This patch fixes the few races
    which existed and ensures all references and cross references are
    cleared at the time they're invalid. In addition fc transports
    actions are only scheduled when required.

    Signed-off-by: Swen Schillig
    Signed-off-by: Christof Schmitt
    Signed-off-by: James Bottomley

    Swen Schillig
     

30 Jul, 2009

2 commits


13 Jun, 2009

1 commit

  • Provide the ability to do fibre channel requests from the userspace to
    our zfcp driver. Patch builds upon extension to the fibre channel
    tranport class by James Smart and Seokmann Ju. See here
    http://marc.info/?l=linux-scsi&m=123808882309133&w=2

    Signed-off-by: Sven Schuetz
    Signed-off-by: Christof Schmitt
    Signed-off-by: James Bottomley

    Sven Schuetz
     

24 May, 2009

1 commit

  • zfcp did always set the queue_depth for SCSI devices to 32, not
    allowing to change this. Introduce a kernel parameter zfcp.queue_depth
    and the change_queue_depth callback to allow changing the queue_depth
    when it is required.

    Reviewed-by: Swen Schillig
    Signed-off-by: Christof Schmitt
    Signed-off-by: James Bottomley

    Christof Schmitt
     

27 Apr, 2009

3 commits

  • The zfcp_port might have been removed, while the FC fast_io_fail timer
    is still running and could trigger the terminate_rport_io callback.
    Set the pointer to the zfcp_port to NULL and check accordingly
    before using it.

    Reviewed-by: Martin Petermann
    Signed-off-by: Christof Schmitt
    Signed-off-by: James Bottomley

    Christof Schmitt
     
  • When the abort handler cannot find a pending FSF request, the request
    completion could just be running. This means we cannot return SUCCESS,
    since this would lead to call to scsi_done after exiting the SCSI
    error handler which is not allowed.

    Reviewed-by: Martin Petermann
    Signed-off-by: Christof Schmitt
    Signed-off-by: James Bottomley

    Christof Schmitt
     
  • When running the scsi_scan from the zfcp workqueue and the target
    device does not respond, the zfcp workqueue can block until the
    scsi_scan hits a timeout. Move the work to the scsi host workqueue,
    since this one is also used for the scan from the SCSI midlayer.

    Signed-off-by: Swen Schillig
    Signed-off-by: Christof Schmitt
    Signed-off-by: James Bottomley

    Swen Schillig
     

13 Mar, 2009

5 commits

  • It will not be necessary to set the erp failed status bit
    in case a SCSI device is removed by the SCSI mid layer.
    In the case a SCSI device is unavailable for a short time
    (15 to 20 seconds) a FCP unit will not get on-line again.

    Signed-off-by: Martin Petermann
    Signed-off-by: Christof Schmitt
    Signed-off-by: James Bottomley

    Martin Petermann
     
  • Use the I/O blocking mechanism in the FC transport class to allow
    faster failovers for multipathing:
    - Call fc_remote_port_delete early to set the rport to BLOCKED.
    - Check the rport status in queuecommand with fc_remote_portchkready
    to no longer accept new I/O for this port and fail the I/O with the
    appropriate scsi_cmnd result.
    - Implement the terminate_rport_io handler to abort all pending I/O
    requests
    - Return SCSI commands with DID_TRANSPORT_DISRUPTED while erp is
    running.
    - When updating the remote port status, check for late changes and
    update the remote ports status accordingly.

    Acked-by: Swen Schillig
    Signed-off-by: Christof Schmitt
    Signed-off-by: James Bottomley

    Christof Schmitt
     
  • The current number based id ERP logging is replaced by a string
    based tag version. The benefit is an easier location of the code in
    question and the removal of the lengthy array referencing the
    individual messages.
    The string (7 bytes) based version does not use more space since those
    bytes were "used" anyway due to the alignment of the structure.
    The encoding of the 7 byte string is as follows
    [0-1] = filename
    [2-5] = task/function
    [6] = section
    Due to the character of this string (fixed length) a string
    termination is not required here.

    Signed-off-by: Swen Schillig
    Signed-off-by: Christof Schmitt
    Signed-off-by: James Bottomley

    Swen Schillig
     
  • When the SCSI midlayer is running error recovery, the low-level error
    recovery in zfcp could be running and preventing the SCSI midlayer to
    issue error recovery requests. To avoid unnecessary error recovery
    escalation, wait for the zfcp erp to finish and retry if necessary.

    While reworking the SCSI eh handlers, alsa cleanup the code and
    simplify the interface from zfcp_scsi to the fsf layer.

    Acked-by: Swen Schillig
    Signed-off-by: Christof Schmitt
    Signed-off-by: James Bottomley

    Christof Schmitt
     
  • Use the device pointer in zfcp_unit for tracking if we have a
    registered SCSI device. With this approach, the flag
    ZFCP_STATUS_UNIT_REGISTERED is only redundant and can be removed.

    Acked-by: Swen Schillig
    Signed-off-by: Christof Schmitt
    Signed-off-by: James Bottomley

    Christof Schmitt
     

25 Dec, 2008

1 commit