Re: [PATCH 5/5] null_blk: Zero-initialize read buffers in non-memory-backed mode

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

 



On 2020/05/18 11:56, Bart Van Assche wrote:
> On 2020-05-17 19:10, Damien Le Moal wrote:
>> On 2020/05/18 10:32, Bart Van Assche wrote:
>>> On 2020-05-17 18:12, Damien Le Moal wrote:
>>>> On 2020/05/16 9:19, Bart Van Assche wrote:
>>>>> +static void nullb_zero_rq_data_buffer(const struct request *rq)
>>>>> +{
>>>>> +	struct req_iterator iter;
>>>>> +	struct bio_vec bvec;
>>>>> +
>>>>> +	rq_for_each_bvec(bvec, rq, iter)
>>>>> +		zero_fill_bvec(&bvec);
>>>>> +}
>>>>> +
>>>>> +static void nullb_zero_read_cmd_buffer(struct nullb_cmd *cmd)
>>>>> +{
>>>>> +	struct nullb_device *dev = cmd->nq->dev;
>>>>> +
>>>>> +	if (dev->queue_mode == NULL_Q_BIO && bio_op(cmd->bio) == REQ_OP_READ)
>>>>> +		zero_fill_bio(cmd->bio);
>>>>> +	else if (req_op(cmd->rq) == REQ_OP_READ)
>>>>> +		nullb_zero_rq_data_buffer(cmd->rq);
>>>>> +}
>>>>
>>>> Shouldn't the definition of these two functions be under a "#ifdef CONFIG_KMSAN" ?
>>>
>>> It is on purpose that I used IS_ENABLED(CONFIG_KMSAN) below instead of
>>> #ifdef CONFIG_KMSAN. CONFIG_KMSAN is not yet upstream and I want to
>>> expose the above code to the build robot.
>>
>> But then you will get a "defined but unused" build warning, no ?
> 
> Not when using IS_ENABLED(...).

I do not understand: the "if (IS_ENABLED(CONFIG_KMSAN))" will be compiled out if
CONFIG_KMSAN is not enabled/defined, but the function definitions will still
remain, won't they ? That will lead to "defined but unused" warning, no ? What
am I missing here ?

> 
> Bart.
> 


-- 
Damien Le Moal
Western Digital Research





[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux