1. 22 Sep, 2020 2 commits
    • Bodo Stroesser's avatar
      scsi: target: tcmu: Optimize queue_cmd_ring() · 7e98905e
      Bodo Stroesser authored
      queue_cmd_ring() needs to check whether there is enough space in cmd ring
      and data area for the cmd to queue.
      
      Currently the sequence is:
      
       1) Calculate size the cmd will occupy on the ring based on estimation of
          needed iovs.
      
       2) Check whether there is enough space on the ring based on size from 1)
      
       3) Allocate buffers in data area.
      
       4) Calculate number of iovs the command really needs while copying
          incoming data (if any) to data area.
      
       5) Re-calculate real size of cmd on ring based on real number of iovs.
      
       6) Set up possible padding and cmd on the ring.
      
      Step 1) must not underestimate the cmd size so use max possible number of
      iovs for the given I/O data size. The resulting overestimation can be
      really high so this sequence is not ideal. The earliest the real number of
      iovs can be calculated is after data buffer allocation. Therefore rework
      the code to implement the following sequence:
      
       A) Allocate buffers on data area and calculate number of necessary iovs
          during this.
      
       B) Calculate real size of cmd on ring based on number of iovs.
      
       C) Check whether there is enough space on the ring.
      
       D) Set up possible padding and cmd on the ring.
      
      The new sequence enforces the split of new function tcmu_alloc_data_space()
      from is_ring_space_avail(). Using this function, change queue_cmd_ring()
      according to the new sequence.
      
      Change routines called by tcmu_alloc_data_space() to allow calculating and
      returning the iov count. Remove counting of iovs in scatter_data_area().
      
      Link: https://lore.kernel.org/r/20200910155041.17654-3-bstroesser@ts.fujitsu.comAcked-by: default avatarMike Christie <michael.christie@oracle.com>
      Signed-off-by: default avatarBodo Stroesser <bstroesser@ts.fujitsu.com>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      7e98905e
    • Bodo Stroesser's avatar
      scsi: target: tcmu: Join tcmu_cmd_get_data_length() and tcmu_cmd_get_block_cnt() · 52ef2743
      Bodo Stroesser authored
      Simplify code by joining tcmu_cmd_get_data_length() and
      tcmu_cmd_get_block_cnt() into tcmu_cmd_set_block_cnts().  The new function
      sets tcmu_cmd->dbi_cnt and also the new field tcmu_cmd->dbi_bidi_cnt which
      is needed for further enhancements in following patches.  Simplify some
      code by using tcmu_cmd->dbi(_bidi)_cnt instead of calculation from length.
      
      Please note: The calculation of the number of dbis needed for bidi was
      wrong. It was based on the length of the first bidi sg only. I changed it
      to correctly sum up entire length of all bidi sgs.
      
      Link: https://lore.kernel.org/r/20200910155041.17654-2-bstroesser@ts.fujitsu.comAcked-by: default avatarMike Christie <michael.christie@oracle.com>
      Signed-off-by: default avatarBodo Stroesser <bstroesser@ts.fujitsu.com>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      52ef2743
  2. 16 Sep, 2020 15 commits
  3. 15 Sep, 2020 15 commits
  4. 10 Sep, 2020 8 commits