1. 14 12月, 2011 13 次提交
    • N
      target: Remove legacy device status check from transport_execute_tasks · 6d5b5975
      Nicholas Bellinger 提交于
      This patch removes a legacy se_dev_check_online() check from within
      transport_execute_tasks() that should no longer be necessary as
      transport_lookup_cmd_lun() is already making this call.
      
      Using transport_cmd_check_stop() from transport_execute_tasks() should
      already be checking per se_cmd context for each descriptor upon active
      I/O shutdown, so no need to acquire dev->dev_status_lock again while
      executing se_task submission.
      
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Roland Dreier <roland@purestorage.com>
      Cc: Joern Engel <joern@logfs.org>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      6d5b5975
    • N
      target: Remove __transport_execute_tasks() for each processing context · beb55a0c
      Nicholas Bellinger 提交于
      This patch removes the original usage of __transport_execute_tasks() ahead
      of every transport_get_cmd_from_queue() call in transport_processing_thread().
      This helps reduce se_device->execute_task_lock contention between qla2xxx wq
      with target_submit_cmd() for READs and transport_processing_thread()
      context servicing WRITEs with full payloads for I/O submission.
      
      It also adds a __transport_execute_tasks() to kick the task queue again
      without a *se_cmd descriptor with existing queue full logic, but this may
      end up not being necessary.
      
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Roland Dreier <roland@purestorage.com>
      Cc: Joern Engel <joern@logfs.org>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      beb55a0c
    • N
      target: Remove extra se_device->execute_task_lock access in fast path · 4d2300cc
      Nicholas Bellinger 提交于
      This patch makes __transport_execute_tasks() perform the addition of
      tasks to dev->execute_task_list via __transport_add_tasks_from_cmd()
      while holding dev->execute_task_lock during normal I/O fast path
      submission.
      
      It effectively removes the unnecessary re-acquire of dev->execute_task_lock
      during transport_execute_tasks() -> transport_add_tasks_from_cmd() ahead
      of calling  __transport_execute_tasks() to queue tasks for the passed
      *se_cmd descriptor.
      
      (v2: Re-add goto check_depth usage for multi-task submission for now..)
      
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Roland Dreier <roland@purestorage.com>
      Cc: Joern Engel <joern@logfs.org>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      4d2300cc
    • N
      target: Drop se_device TCQ queue_depth usage from I/O path · 65586d51
      Nicholas Bellinger 提交于
      Historically, pSCSI devices have been the ones that required target-core
      to enforce a per se_device->depth_left.  This patch changes target-core
      to no longer (by default) enforce a per se_device->depth_left or sleep in
      transport_tcq_window_closed() when we out of queue slots for all backend
      export cases.
      
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Roland Dreier <roland@purestorage.com>
      Cc: Joern Engel <joern@logfs.org>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      65586d51
    • N
      target: Fix possible NULL pointer with __transport_execute_tasks · 40be67f4
      Nicholas Bellinger 提交于
      This patch makes __transport_execute_tasks() use a local *se_dev
      reference to prevent direct se_cmd->se_dev access after
      transport_cmd_check_stop() -> transport_add_tasks_from_cmd()
      has been called, as in the current implementation we can expect
      __transport_execute_tasks() may be called from another context
      that may have already completed the I/O.
      
      Cc: Christoph Hellwig <hch@lst.de>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      40be67f4
    • N
      target: Add target_submit_cmd() for process context fabric submission · a6360785
      Nicholas Bellinger 提交于
      This patch adds a target_submit_cmd() caller that can be used by fabrics
      to submit an uninitialized se_cmd descriptor to an struct se_session +
      unpacked_lun from workqueue process context.  This call will invoke the
      following steps:
      
      - transport_init_se_cmd() to setup se_cmd specific pointers
      - Obtain se_cmd->cmd_kref references with target_get_sess_cmd()
      - set se_cmd->t_tasks_bidi
      - transport_lookup_cmd_lun() to setup struct se_cmd->se_lun from
        the passed unpacked_lun
      - transport_generic_allocate_tasks() to setup the passed *cdb, and
      - transport_handle_cdb_direct() handle READ dispatch or WRITE
        ready-to-transfer callback to fabric
      
      v2 changes from hch feedback:
      
      *) Add target_sc_flags_table for target_submit_cmd flags
      *) Rename bidi parameter to flags, add TARGET_SCF_BIDI_OP
      *) Convert checks to BUG_ON
      *) Add out_check_cond for transport_send_check_condition_and_sense
         usage
      
      v3 changes:
      
      *) Add TARGET_SCF_ACK_KREF for target_submit_cmd into
         target_get_sess_cmd to determine when the fabric caller is expecting
         a second kref_put() from fabric packet acknowledgement.
      
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Roland Dreier <roland@purestorage.com>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      a6360785
    • N
      target: Make target_put_sess_cmd use target_release_cmd_kref · 7481deb4
      Nicholas Bellinger 提交于
      This patch moves target_put_sess_cmd() to use a se_cmd->cmd_kref
      callback target_release_cmd_kref when performing driver release of
      fabric->se_cmd descriptor memory.  It sets the default cmd_kref
      count value to '2' within target_get_sess_cmd() setup, and
      currently assumes TFO->check_stop_free() usage.
      
      It drops se_tfo->check_release_cmd() usage in the main
      transport_release_cmd codepath.
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      7481deb4
    • J
      target: remove useless casts · 8359cf43
      Jörn Engel 提交于
      A reader should spend an extra moment whenever noticing a cast,
      because either something special is going on that deserves extra
      attention or, as is all too often the case, the code is wrong.
      
      These casts, afaics, have all been useless.  They cast a foo* to a
      foo*, cast a void* to the assigned type, cast a foo* to void*, before
      assigning it to a void* variable, etc.
      
      In a few cases I also removed an additional &...[0], which is equally
      useless.
      
      Lastly I added three FIXMEs where, to the best of my judgement, the
      code appears to have a bug.  It would be good if someone could check
      these.
      Signed-off-by: NJoern Engel <joern@logfs.org>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      8359cf43
    • C
      target: make the se_task task_state_active a normal bool · 1880807a
      Christoph Hellwig 提交于
      There is no need to make task_state_active an atomic_t given that it is
      always set under the execute_task_lock so we can make it a simple bool.
      Also rename it to t_state_active to be closer to the list it guards,
      and make sure all checks before the list addion/removal actually happen
      under execute_task_lock.
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      1880807a
    • C
      target: remove the se_task task_error_status field · 41e16e98
      Christoph Hellwig 提交于
      We only reach transport_complete_task once per task, so the test and set on
      task_error_status is never going to have an effect.
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      41e16e98
    • C
      ef804a84
    • C
      target: header reshuffle, part2 · c4795fb2
      Christoph Hellwig 提交于
      This reorganized the headers under include/target into:
      
       - target_core_base.h stays as is with all target-wide data stuctures and defines
       - target_core_backend.h contains the whole interface to I/O backends
       - target_core_fabric.h contains the whole interface to fabric modules
      
      Except for those only the various configfs macro headers stay around.
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      c4795fb2
    • C
      target: reshuffle headers · e26d99ae
      Christoph Hellwig 提交于
      Create a new headers, drivers/target/target_core_internal.h that is supposed
      to hold all target_core-internal prototypes.  Move all non-exported includes
      from include/target to it, and merge the smaller prototype-only includes
      inside drivers/target into it as well.  Mark functions that were found to
      not be called outside their implementation file static.
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      e26d99ae
  2. 06 12月, 2011 11 次提交
  3. 04 11月, 2011 6 次提交
    • C
      target: use ->exectute_task for all CDB emulation · 5bda90c8
      Christoph Hellwig 提交于
      Instead of calling into transport_emulate_control_cdb from
      __transport_execute_tasks for some CDBs always set up ->exectute_tasks
      in the command sequence and use it uniformly.
      
      (nab: Add default passthrough break for SERVICE_ACTION_IN)
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      5bda90c8
    • C
      target: remove SCF_EMULATE_CDB_ASYNC · d29a5b6a
      Christoph Hellwig 提交于
      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: NChristoph Hellwig <hch@lst.de>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      d29a5b6a
    • C
      target: pass the se_task to the CDB emulation callback · e76a35d6
      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: NChristoph Hellwig <hch@lst.de>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      e76a35d6
    • C
      target: split core_scsi3_emulate_pr · 617c0e06
      Christoph Hellwig 提交于
      Split core_scsi2_emulate_crh into one routine each for the
      PERSISTENT_RESERVE_IN and PERSISTENT_RESERVE_OUT side.
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      617c0e06
    • C
      target: split core_scsi2_emulate_crh · eacac00c
      Christoph Hellwig 提交于
      Split core_scsi2_emulate_crh into one routine each for the reserve and
      release side.  The common code now is in a helper called by both
      routines.
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      eacac00c
    • N
      target: Add generic active I/O shutdown logic · a17f091d
      Nicholas Bellinger 提交于
      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 <hch@lst.de>
      Cc: Roland Dreier <roland@purestorage.com>
      Signed-off-by: NNicholas A. Bellinger <nab@linux-iscsi.org>
      a17f091d
  4. 03 11月, 2011 1 次提交
  5. 02 11月, 2011 2 次提交
    • N
      target: Remove core TRANSPORT_FREE_CMD_INTR usage · 3151d069
      Nicholas Bellinger 提交于
      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: NChristoph Hellwig <hch@lst.de>
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Roland Dreier <roland@purestorage.com>
      Cc: Madhuranath Iyengar <mni@risingtidesystems.com>
      Signed-off-by: NNicholas Bellinger <nab@risingtidesystems.com>
      3151d069
    • N
      target: Make TFO->check_stop_free return free status · 88dd9e26
      Nicholas Bellinger 提交于
      This patch converts target_core_fabric_ops->check_stop_free() usage in
      transport_cmd_check_stop() and associated fabric module usage to
      return '1' when the passed se_cmd has been released directly within
      ->check_stop_free(), or return '0' when the passed se_cmd has not
      been released.
      
      This addresses an issue where transport_cmd_finish_abort() ->
      transport_cmd_check_stop_to_fabric() was leaking descriptors during
      LUN_RESET for modules using ->check_stop_free(), but not directly
      releasing se_cmd in all cases.
      
      Cc: stable@kernel.org
      Signed-off-by: NNicholas Bellinger <nab@risingtidesystems.com>
      88dd9e26
  6. 01 11月, 2011 1 次提交
  7. 27 10月, 2011 1 次提交
    • N
      target: Check -ENOMEM to signal QUEUE_FULL from fabric callbacks · f147abb4
      Nicholas Bellinger 提交于
      This patch changes target core to also check for -ENOMEM from fabric callbacks
      to signal QUEUE_FULL status, instead of just -EAGAIN in order to catch a
      larger set of fabric failure cases that want to trigger QUEUE_FULL logic.
      This includes the callbacks for ->write_pending(), ->queue_data_in() and
      ->queue_status().
      
      It also makes transport_generic_write_pending() return zero upon QUEUE_FULL,
      and removes two unnecessary -EAGAIN checks to catch write pending QUEUE_FULL
      cases from transport_generic_new_cmd() failures in transport_handle_cdb_direct()
      and transport_processing_thread():TRANSPORT_NEW_CMD_MAP state.
      Reported-by: NBart Van Assche <bvanassche@acm.org>
      Cc: Bart Van Assche <bvanassche@acm.org>
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Roland Dreier <roland@purestorage.com>
      Signed-off-by: NNicholas A. Bellinger <nab@linux-iscsi.org>
      f147abb4
  8. 24 10月, 2011 5 次提交