scsi: target: tcmu: Join tcmu_cmd_get_data_length() and tcmu_cmd_get_block_cnt()
authorBodo Stroesser <bstroesser@ts.fujitsu.com>
Thu, 10 Sep 2020 15:50:39 +0000 (17:50 +0200)
committerMartin K. Petersen <martin.petersen@oracle.com>
Tue, 22 Sep 2020 21:31:42 +0000 (17:31 -0400)
commit52ef2743f16cca9884a9dfd3a8bb013b8e136e4a
tree4d12d890a4d1b06caea769373bf8e26bd0fe05e9
parented5dd6a67d5eac5fb8873697b55dc1699752a9f3
scsi: target: tcmu: Join tcmu_cmd_get_data_length() and tcmu_cmd_get_block_cnt()

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.com
Acked-by: Mike Christie <michael.christie@oracle.com>
Signed-off-by: Bodo Stroesser <bstroesser@ts.fujitsu.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/target/target_core_user.c