2015-04-05 19:01 GMT+09:00 Sagi Grimberg <[email protected]>:
> On 4/4/2015 3:24 PM, Akinobu Mita wrote:
>>
>> Factor out code duplication in rd_execute_rw() into a helper function
>> rd_do_prot_rw().  This change is required to minimize the forthcoming
>> fix in rd_do_prot_rw().
>>
>> Signed-off-by: Akinobu Mita <[email protected]>
>> Cc: Nicholas Bellinger <[email protected]>
>> Cc: Asias He <[email protected]>
>> Cc: "Martin K. Petersen" <[email protected]>
>> Cc: Christoph Hellwig <[email protected]>
>> Cc: "James E.J. Bottomley" <[email protected]>
>> Cc: [email protected]
>> Cc: [email protected]
>> ---
>>   drivers/target/target_core_rd.c | 66
>> ++++++++++++++++++++---------------------
>>   1 file changed, 32 insertions(+), 34 deletions(-)
>>
>> diff --git a/drivers/target/target_core_rd.c
>> b/drivers/target/target_core_rd.c
>> index 98e83ac..4d614c9 100644
>> --- a/drivers/target/target_core_rd.c
>> +++ b/drivers/target/target_core_rd.c
>> @@ -382,6 +382,36 @@ static struct rd_dev_sg_table
>> *rd_get_prot_table(struct rd_dev *rd_dev, u32 page
>>         return NULL;
>>   }
>>
>> +static sense_reason_t rd_do_prot_rw(struct se_cmd *cmd, bool is_write)
>> +{
>> +       struct se_device *se_dev = cmd->se_dev;
>> +       struct rd_dev *dev = RD_DEV(se_dev);
>> +       struct rd_dev_sg_table *prot_table;
>> +       struct scatterlist *prot_sg;
>> +       u32 sectors = cmd->data_length / se_dev->dev_attrib.block_size;
>> +       u32 prot_offset, prot_page;
>> +       u64 tmp;
>> +       sense_reason_t rc;
>> +       sense_reason_t (*dif_verify)(struct se_cmd *, sector_t, unsigned
>> int,
>> +                       unsigned int, struct scatterlist *, int) =
>> +               is_write ?  sbc_dif_verify_write : sbc_dif_verify_read;
>
>
> Hi Akinobu,
>
> I think it would make more sense to pass the dif_verify() function
> pointer instead of is_write (only used for that anyway).

Make sense.  I'll update this series with that change.
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to