Hi Mike,
On 3/26/25 4:37 PM, Mike Christie wrote:
> On 3/17/25 7:04 PM, Dongli Zhang wrote:
>> @@ -1390,6 +1424,24 @@ vhost_scsi_handle_vq(struct vhost_scsi *vs, struct
>> vhost_virtqueue *vq)
>> goto err;
>> }
>>
>> + if (unlikely(vq_log && log_num)) {
>> + if (!cmd->tvc_log)
>> + cmd->tvc_log = kmalloc_array(vq->dev->iov_limit,
>> +
>> sizeof(*cmd->tvc_log),
>> + GFP_KERNEL);
>> +
>> + if (likely(cmd->tvc_log)) {
>> + memcpy(cmd->tvc_log, vq->log,> +
>> sizeof(*cmd->tvc_log) * log_num);
>> + cmd->tvc_log_num = log_num;
>
>
> Hey Dongli, this approach seems ok.
>
> Could you just move this to a function?
Sure. I may re-send v3 following this approach (allocate on-demand in runtime),
and encapsulate above code into a function.
Thank you very much!
Dongli Zhang