Re: [PATCH 3/4] target/core: add unknown size flag to target_submit_cmd()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I realize this has already been merged, but:

On Tue, Jan 10, 2012 at 5:16 AM, Sebastian Andrzej Siewior
<bigeasy@xxxxxxxxxxxxx> wrote:
> diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c
> index a31fdcc..72aca8a 100644
> --- a/drivers/target/target_core_transport.c
> +++ b/drivers/target/target_core_transport.c
> @@ -1675,6 +1675,8 @@ int target_submit_cmd(struct se_cmd *se_cmd, struct se_session *se_sess,
>         */
>        transport_init_se_cmd(se_cmd, se_tpg->se_tpg_tfo, se_sess,
>                                data_length, data_dir, task_attr, sense);
> +       if (flags & TARGET_SCF_UNKNOWN_SIZE)
> +               se_cmd->unknown_data_length = 1;
>        /*
>         * Obtain struct se_cmd->cmd_kref reference and add new cmd to
>         * se_sess->sess_cmd_list.  A second kref_get here is necessary
> @@ -3044,6 +3046,9 @@ static int transport_generic_cmd_sequencer(
>                goto out_unsupported_cdb;
>        }
>
> +       if (cmd->unknown_data_length)
> +               cmd->data_length = size;
> +
>        if (size != cmd->data_length) {
>                pr_warn("TARGET_CORE[%s]: Expected Transfer Length:"
>                        " %u does not match SCSI CDB Length: %u for SAM Opcode:"
> diff --git a/include/target/target_core_base.h b/include/target/target_core_base.h
> index daf532b..a21844d 100644
> --- a/include/target/target_core_base.h
> +++ b/include/target/target_core_base.h
> @@ -230,6 +230,7 @@ enum tcm_sense_reason_table {
>  enum target_sc_flags_table {
>        TARGET_SCF_BIDI_OP              = 0x01,
>        TARGET_SCF_ACK_KREF             = 0x02,
> +       TARGET_SCF_UNKNOWN_SIZE         = 0x04,
>  };
>
>  /* fabric independent task management function values */
> @@ -522,6 +523,7 @@ struct se_cmd {
>        /* Used to signal cmd->se_tfo->check_release_cmd() usage per cmd */
>        unsigned                check_release:1;
>        unsigned                cmd_wait_set:1;
> +       unsigned                unknown_data_length:1;
>        /* See se_cmd_flags_table */
>        u32                     se_cmd_flags;
>        u32                     se_ordered_id;

why do we need this unknown_data_length member?  As far
as I can see from Nic's tree (which has the usb-gadget fabric
driver merged up), the only place it is used is in this one function.

Why not just do

        if (flags & TARGET_SCF_UNKNOWN_SIZE)
                cmd->data_length = size;

at the end and avoid the obfuscation?  Is there some other
use for this member planned?

 - R.
--
To unsubscribe from this list: send the line "unsubscribe target-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux SCSI]     [Kernel Newbies]     [Linux SCSI Target Infrastructure]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Device Mapper]

  Powered by Linux