06 Dec, 2011

9 commits


04 Nov, 2011

3 commits

  • All ->execute_task instances now need to complete the I/O explicitly,
    which can either happen synchronously or asynchronously.

    Note that a lot of the CDB emulations appear to return success even if
    some lowlevel operations failed. Given that this is an existing issue
    this patch doesn't change that fact.

    (nab: Adding missing switch breaks in PR-IN + PR_OUT)

    Signed-off-by: Christoph Hellwig
    Signed-off-by: Nicholas Bellinger

    Christoph Hellwig
     
  • We want to be able to handle all CDBs through it and remove hacks like
    always using the first task in a CDB in target_report_luns.

    Also rename the callback to ->execute_task to better describe its use.

    Signed-off-by: Christoph Hellwig
    Signed-off-by: Nicholas Bellinger

    Christoph Hellwig
     
  • This patch adds the initial pieces of generic active I/O shutdown logic.
    This is intended to be a 'opt-in' feature for fabric modules that
    includes the following functions to provide a mechinism for fabric
    modules to track se_cmd via se_session->sess_cmd_list:

    *) target_get_sess_cmd() - Add se_cmd to sess->sess_cmd_list, called
    from fabric module incoming I/O path.
    *) target_put_sess_cmd() - Check for completion or drop se_cmd from
    ->sess_cmd_list
    *) target_splice_sess_cmd_list() - Splice active I/O list from
    ->sess_cmd_list to ->sess_wait_list, can called with HW fabric
    lock held.
    *) target_wait_for_sess_cmds() - Walk ->sess_wait_list waiting on
    individual ->cmd_wait_comp. Optional transport_wait_for_tasks()
    call.

    target_splice_sess_cmd_list() is allowed to be called under HW fabric
    lock, and performs the splice into se_sess->sess_wait_list and set
    se_cmd->cmd_wait_set. Then target_wait_for_sess_cmds() walks the list
    waiting for individual target_put_sess_cmd() fabric callbacks to
    complete.

    It also adds TFO->check_release_cmd() to split the completion and memory
    release calls, where a fabric module uses target_put_sess_cmd() to check
    for I/O completion during session shutdown. This is currently pushed out
    into fabric modules as current fabric code may sleep here waiting for
    TFO->check_stop_free() to complete in main response path, and because
    target_wait_for_sess_cmds() calling TFO->release_cmd() to free fabric
    descriptor memory directly.

    Cc: Christoph Hellwig
    Cc: Roland Dreier
    Signed-off-by: Nicholas A. Bellinger

    Nicholas Bellinger
     

02 Nov, 2011

1 commit

  • This patch drops TRANSPORT_FREE_CMD_INTR usage from target core, which
    includes the removal of transport_generic_free_cmd_intr() symbol,
    TRANSPORT_FREE_CMD_INTR usage in transport_processing_thread(), and
    special case LUN_RESET handling to skip TRANSPORT_FREE_CMD_INTR processing
    in core_tmr_drain_cmd_list(). We now expect that fabric modules will
    use an internal workqueue to provide process context when releasing
    se_cmd descriptor resources via transport_generic_free_cmd().

    Reported-by: Christoph Hellwig
    Cc: Christoph Hellwig
    Cc: Roland Dreier
    Cc: Madhuranath Iyengar
    Signed-off-by: Nicholas Bellinger

    Nicholas Bellinger
     

24 Oct, 2011

19 commits

  • This patch removes the legacy usage of se_task->task_timer and associated
    infrastructure that originally was used as a way to help manage buggy backend
    SCSI LLDs that in certain cases would never return back an outstanding task.

    This includes the removal of target_complete_timeout_work(), timeout logic
    from transport_complete_task(), transport_task_timeout_handler(),
    transport_start_task_timer(), the per device task_timeout configfs attribute,
    and all task_timeout associated structure members and defines in
    target_core_base.h

    This is being removed in preparation to make transport_complete_task() run
    in lock-less mode.

    Cc: Christoph Hellwig
    Signed-off-by: Nicholas Bellinger

    Nicholas Bellinger
     
  • This patch converts target-core to use se_cmd->t_transport_sent instead of
    a duplicated se_cmd->transport_sent member in a handful of locations.
    It also updates iscsi_target to properly use ->t_transport_sent instead of
    it's own iscsi_cmd_t->transport_sent value that was not being assigned.

    Reported-by: Christoph Hellwig
    Cc: Christoph Hellwig
    Signed-off-by: Nicholas Bellinger

    Nicholas Bellinger
     
  • This field is never used given that BIDI handling happens at the
    command and not the task level. Remove it and the dead code in
    pscsi that tries to work on it.

    It also prevents pSCSI passthrough for the two currently enabled BIDI
    commands now that task->task_sg_bidi support has been removed.

    Signed-off-by: Christoph Hellwig
    Cc: Boaz Harrosh
    Signed-off-by: Nicholas Bellinger

    Christoph Hellwig
     
  • Instead of abusing the target processing thread for offloading I/O
    completion in the backends to user context add a new workqueue. This means
    completions can be processed as fast as available CPU time allows it,
    including in parallel with other completions and more importantly I/O
    submission or QUEUE FULL retries. This should give much better performance
    especially on loaded systems.

    As a fallout we can merge all the completed states into a single
    one.

    On the downside this change complicates lun reset handling a bit by
    requiring us to cancel a work item only for those states that have it
    initialized. The alternative would be to either always initialize the work
    item to a dummy handler, or always use the same handler and do a switch on
    the state. The long term solution will be a flag that says that the command
    has an initialized work item, but that's only going to be useful once we
    have more users.

    Signed-off-by: Christoph Hellwig
    Signed-off-by: Nicholas Bellinger

    Christoph Hellwig
     
  • Signed-off-by: Christoph Hellwig
    Signed-off-by: Nicholas Bellinger

    Christoph Hellwig
     
  • We never check for this state, and it makes testing for a completed
    state much harder given that it overrides the existing state.

    Also remove the unused deferred_t_state which is related to it.

    Signed-off-by: Christoph Hellwig
    Signed-off-by: Nicholas Bellinger

    Christoph Hellwig
     
  • We never queue an command with this state, and only set it in a completely
    bogus place in tcm_fc.

    Signed-off-by: Christoph Hellwig
    Signed-off-by: Nicholas Bellinger

    Christoph Hellwig
     
  • Currently we stop the timers for all tasks in a command fairly late during
    I/O completion, which is fairly pointless and requires all kinds of safety
    checks.

    Instead delete pending timers early on in transport_complete_task, thus
    ensuring no new timers firest after that. We take t_state_lock a bit later
    in that function thus making sure currenly running timers are out of the
    criticial section. To be completely sure the timer has finished we also
    add another del_timer_sync call when freeing the task.

    This also allows removing TF_TIMER_RUNNING as it would be equivalent
    to TF_ACTIVE now.

    Signed-off-by: Christoph Hellwig
    Signed-off-by: Nicholas Bellinger

    Christoph Hellwig
     
  • TF_TIMER_STOP is useless as it only helps to mitigate a tiny race during
    deleting the timer. But given that we have cleared TF_ACTIVE at this point
    we already have another mitigation a few lines down the function.

    Signed-off-by: Christoph Hellwig
    Signed-off-by: Nicholas Bellinger

    Christoph Hellwig
     
  • Add a new boolean at_head parameter to transport_add_cmd_to_queue and thus
    obsolete the SCF_EMULATE_QUEUE_FULL flag.

    Signed-off-by: Christoph Hellwig
    Signed-off-by: Nicholas Bellinger

    Christoph Hellwig
     
  • Remove the need for the transport_qf_callback callback by making
    sure we have specific states with specific handlers for the two
    queue full cases.

    Signed-off-by: Christoph Hellwig
    Signed-off-by: Nicholas Bellinger

    Christoph Hellwig
     
  • Add a switch statement implementing the CDB LBA/len update directly
    in target_get_task_cdb and remove the old ->transport_split_cdb
    callback and all its implementations.

    Signed-off-by: Christoph Hellwig
    Signed-off-by: Nicholas Bellinger

    Christoph Hellwig
     
  • Rearrange the fields in se_task to avoid holes. Also increase the
    flags field to 16 bits as we have the space for it, and this makes
    adding new flags safer.

    Signed-off-by: Christoph Hellwig
    Signed-off-by: Nicholas Bellinger

    Christoph Hellwig
     
  • This is a squashed version of the following unnecessary se_task structure
    member removal patches:

    target: remove the task_execute_queue field in se_task

    Instead of using a separate flag we can simply do list_emptry checks
    on t_execute_list if we make sure to always use list_del_init to remove
    a task from the list. Also factor some duplicate code into a new
    __transport_remove_task_from_execute_queue helper.

    target: remove the read-only task_no field in se_task

    The task_no field never was initialized and only used in debug printks,
    so kill it.

    target: remove the task_padded_sg field in se_task

    This field is only check in one place and not actually needed there.

    Rationale:
    - transport_do_task_sg_chain asserts that we have task_sg_chaining
    set early on
    - we only make use of the sg_prev_nents field we calculate based on it
    if there is another sg list that gets chained onto this one, which
    never happens for the last (or only) task.

    Signed-off-by: Christoph Hellwig
    Signed-off-by: Nicholas Bellinger

    Christoph Hellwig
     
  • Replace various atomic_t variables that were mostly under t_state_lock
    with new flags in task_flags. Note that the execution error path
    didn't take t_state_lock before, so add it there.

    Signed-off-by: Christoph Hellwig
    Signed-off-by: Nicholas Bellinger

    Christoph Hellwig
     
  • This is a squashed version of the following se_task cleanup patches:

    target: remove the unused task_state_flags field in se_task
    target: remove the unused se_obj_ptr field in se_task
    target: remove the se_dev field in se_task

    Signed-off-by: Christoph Hellwig
    Signed-off-by: Nicholas Bellinger

    Christoph Hellwig
     
  • This is a squashed version of the following target_core_base.h
    cleanup patches:

    target: remove the unused SHUTDOWN_SIGS defintion
    target: remove unused se_mem leftovers
    target: remove the unused map_func_t typedef
    target: move TRANSPORT_IOV_DATA_BUFFER to the iscsi-specific code

    Signed-off-by: Christoph Hellwig
    Signed-off-by: Nicholas Bellinger

    Christoph Hellwig
     
  • This patch converts se_cmd->transport_wait_for_tasks(se_cmd, 1) usage to use
    transport_generic_free_cmd() directly in target-core and iscsi-target fabric
    usage. The includes:

    *) Removal of the optional transport_generic_free_cmd() call from within
    transport_generic_wait_for_tasks()
    *) Usage of existing SCF_SUPPORTED_SAM_OPCODE to determine when
    transport_generic_wait_for_tasks() processing may occur instead of
    checking se_cmd->transport_wait_for_tasks()
    *) Move transport_generic_wait_for_tasks() call ahead of core_dec_lacl_count()
    and transport_lun_remove_cmd() in transport_generic_free_cmd() to follow
    existing logic for iscsi-target w/ se_cmd->transport_wait_for_tasks(se_cmd, 1)
    *) Removal of se_cmd->transport_wait_for_tasks() function pointer
    *) Rename transport_generic_wait_for_tasks() -> transport_wait_for_tasks(), and
    add docbook comment.
    *) Add EXPORT_SYMBOL for transport_wait_for_tasks()

    For the case in iscsi_target_erl2.c:iscsit_prepare_cmds_for_realligance()
    where se_cmd->transport_wait_for_tasks(se_cmd, 0) is called, this patch
    adds a direct call to transport_wait_for_tasks().

    (hch: Fix transport_generic_free_cmd() usage in iscsit_release_commands_from_conn)
    (nab: Add patch: Ensure that TMRs hit wait_for_tasks logic during release)

    Reported-by: Christoph Hellwig
    Cc: Christoph Hellwig
    Signed-off-by: Nicholas Bellinger

    Nicholas Bellinger
     
  • This patch removes the unnecessary session_reinstatement parameter from
    se_cmd->transport_wait_for_tasks(), logic in transport_generic_wait_for_tasks,
    and usage within iscsi-target code.

    This also includes the removal of the 'bool' return from transport_put_cmd() +
    transport_generic_free_cmd() that is no longer necessary.

    Cc: Christoph Hellwig
    Signed-off-by: Nicholas Bellinger

    Nicholas Bellinger
     

22 Jul, 2011

8 commits

  • This patch bumps the target core version to v4.1.0-rc1 now that we are
    in sync with upstream lio-core-2.6.git/master

    Signed-off-by: Nicholas Bellinger

    Nicholas Bellinger
     
  • This patch adds the default 'Unrestricted reordering allowed' for SCSI
    control mode page QUEUE ALGORITHM MODIFIER on a per se_device basis in
    target_modesense_control() following spc4r23. This includes a new
    emuluate_rest_reord configfs attribute that currently (only) accepts
    zero to signal 'Unrestricted reordering allowed' in control mode page
    usage by the backend target device.

    Reported-by: Roland Dreier
    Signed-off-by: Nicholas Bellinger

    Nicholas Bellinger
     
  • This patch contains the squashed version of forth round series cleanups
    from Andy and Christoph following the post heavy lifting in the preceeding:
    'Eliminate usage of struct se_mem' and 'Make all control CDBs scatter-gather'
    changes. This also includes a conversion of target core and the v3.0
    mainline fabric modules (loopback and tcm_fc) to use pr_debug and the
    CONFIG_DYNAMIC_DEBUG infrastructure!

    These have been squashed into this third and final round for v3.1.

    target: Remove ifdeffed code in t_g_process_write
    target: Remove direct ramdisk code
    target: Rename task_sg_num to task_sg_nents
    target: Remove custom debug macros for pr_debug. Use pr_err().
    target: Remove custom debug macros in mainline fabrics
    target: Set WSNZ=1 in block limits VPD. Abort if WRITE_SAME sectors = 0
    target: Remove transport do_se_mem_map callback
    target: Further simplify transport_free_pages
    target: Redo task allocation return value handling
    target: Remove extra parentheses
    target: change alloc_task call to take *cdb, not *cmd

    (nab: Fix bogus struct file assignments in fd_do_readv and fd_do_writev)

    Signed-off-by: Andy Grover
    Reviewed-by: Christoph Hellwig
    Signed-off-by: Nicholas Bellinger

    Andy Grover
     
  • Both backstores and fabrics use arrays of struct scatterlist to describe
    data buffers. However TCM used struct se_mems, basically a linked list
    of scatterlist entries. We are able to simplify the code by eliminating
    this intermediate data structure and just using struct scatterlist[]
    throughout.

    Also, moved attachment of task to cmd out of transport_generic_get_task
    and into allocate_control_task and allocate_data_tasks. The reasoning
    is that it's nonintuitive that get_task should automatically add it to
    the cmd's task list -- it should just return an allocated, initialized
    task. That's all it should do, based on the function's name, so either the
    function shouldn't do it, or the name should change to encapsulate the
    entire essence of what it does.

    (nab: Fix compile warnings in tcm_fc, and make transport_kmap_first_data_page
    honor sg->offset for SGLs from contigious memory with TCM_Loop, and
    fix control se_cmd descriptor memory leak)

    Signed-off-by: Andy Grover
    Signed-off-by: Nicholas Bellinger

    Andy Grover
     
  • Since sectors is not modified, it's more straightforward to do this.

    Signed-off-by: Andy Grover
    Signed-off-by: Nicholas Bellinger

    Andy Grover
     
  • Due to all cdbs' data buffers being referenced by scatterlists, buffers
    of more than a page are not contiguous. Instead of handling this in all
    control command handlers, we may be able to get away with just limiting
    control cdb data buffers to one page. The only control CDBs we handle that
    have potentially large data buffers are REPORT LUNS and UNMAP, so if we
    didn't want to live with this limitation, they would need to be modified
    to walk the pages in the data buffer's sgl.

    Signed-off-by: Andy Grover
    Signed-off-by: Nicholas Bellinger

    Andy Grover
     
  • Previously, some control CDBs did not allocate memory in pages for their
    data buffer, but just did a kmalloc. This patch makes all cdbs allocate
    pages.

    This has the benefit of streamlining some paths that had to behave
    differently when we used two allocation methods. The downside is that
    all accesses to the data buffer need to kmap it before use, and need to
    handle data in page-sized chunks if more than a page is needed for a given
    command's data buffer.

    Finally, note that cdbs with no data buffers are handled a little
    differently. Before, SCSI_NON_DATA_CDBs would not call get_mem at all
    (they'd be in the final else in transport_allocate_resources) but now
    these will make it into generic_get_mem, but just not allocate any
    buffers.

    Signed-off-by: Andy Grover
    Signed-off-by: Nicholas Bellinger

    Andy Grover
     
  • Implement page B1h, Block Device Characteristics, so that we can report
    a medium rotation rate of 1 (non-rotating / solid state) if the
    is_nonrot device attribute is set; we update the iblock backend to set
    this attribute if the underlying Linux block device has its nonrot
    flag set.

    Signed-off-by: Roland Dreier
    Reviewed-by: Christoph Hellwig
    Signed-off-by: Nicholas Bellinger

    Roland Dreier