Re: [PATCH v7 6/6] loop: Add support for REQ_ALLOCATE

From: Kirill Tkhai
Date: Thu Feb 13 2020 - 15:08:24 EST


On 13.02.2020 21:11, Darrick J. Wong wrote:
> On Thu, Feb 13, 2020 at 10:39:35AM +0300, Kirill Tkhai wrote:
>> Support for new modifier of REQ_OP_WRITE_ZEROES command.
>> This results in allocation extents in backing file instead
>> of actual blocks zeroing.
>>
>> Signed-off-by: Kirill Tkhai <ktkhai@xxxxxxxxxxxxx>
>> Reviewed-by: Bob Liu <bob.liu@xxxxxxxxxx>
>> Reviewed-by: Darrick J. Wong <darrick.wong@xxxxxxxxxx>
>> ---
>> drivers/block/loop.c | 20 +++++++++++++-------
>> 1 file changed, 13 insertions(+), 7 deletions(-)
>>
>> diff --git a/drivers/block/loop.c b/drivers/block/loop.c
>> index 739b372a5112..0704167a5aaa 100644
>> --- a/drivers/block/loop.c
>> +++ b/drivers/block/loop.c
>> @@ -581,6 +581,16 @@ static int lo_rw_aio(struct loop_device *lo, struct loop_cmd *cmd,
>> return 0;
>> }
>>
>
> Urgh, I meant "copy the comment directly to here", e.g.
>
> /*
> * Convert REQ_OP_WRITE_ZEROES modifiers into fallocate mode
> *
> * If the caller requires allocation, select that mode. If the caller
> * doesn't want deallocation, call zeroout to write zeroes the range.
> * Otherwise, punch out the blocks.
> */
>
> The goal here is to reinforce the notion that FL_ZERO_RANGE is how we
> achieve nounmap zeroing...

The function is pretty small, and its meaning is easily seen from the name
and description.

I don't think we have to retell every function code line in a separate
sentence, since this distract the attention from really difficult places,
which are really need it.

Kirill