On 06/13/2017 03:12 PM, Andreas Dilger wrote:
>> +static int nvme_streams_params(struct nvme_ns *ns)
>> +{
>> +    struct nvme_ctrl *ctrl = ns->ctrl;
>> +    struct streams_directive_params s;
>> +    struct nvme_command c;
>> +    int ret;
>> +
>> +    memset(&c, 0, sizeof(c));
>> +    memset(&s, 0, sizeof(s));
> 
> Minor nit in a few places in this code - is it more efficient to initialize
> these structs at declaration time instead of calling memset(), like:
> 
>       struct streams_directive_params s = {};
>       struct nvme_command c = {};
> 
> or alternately initializing them fully at declaration time to avoid zeroing
> fields that are immediately being set:
> 
>       struct nvme_command c =
>       {
>               .directive.opcode = nvme_admin_directive_recv;
>               .directive.nsid = cpu_to_le32(ns->ns_id);
>               .directive.numd = sizeof(s);
>               .directive.doper = NVME_DIR_RCV_ST_OP_PARAM;
>               .directive.dtype = NVME_DIR_STREAMS;
>       };

I'm just following the style of the driver for that part.
 
-- 
Jens Axboe

Reply via email to