[Devel] [PATCH VZ9 3/3] block/blk-cbt: add BLKCBTLIST ioctl

Pavel Tikhomirov ptikhomirov at virtuozzo.com
Thu Jan 23 14:29:00 MSK 2025


>>>>> --- a/include/uapi/linux/fs.h
>>>>> +++ b/include/uapi/linux/fs.h
>>>>> @@ -169,12 +169,21 @@ struct blk_user_cbt_snap_create {
>>>>>       __u64 size;
>>>>>   };
>>>>> +struct blk_user_cbt_list {
>>>>> +    __u32 count;        /* Amount of name entries in names
>>>>> +                 * in - available, out - filled
>>>>> +                 */
>>>>> +    __u32 total_count;    /* Total bitmap count of this device 
>>>>> (out) */
>>>>
>>>> Why do we need to know how many cbts were filled? It would always be 
>>>> min(available, total). So it seems we can use just one "count" 
>>>> variable with the same effect.
>>>
>>> The only important case is when the amount of cbts is bigger then the 
>>> provided buffer. e.g. someone added a cbt in-between calls or someone 
>>> supplied static size buffer with the hopes that it will be enough
>>
>> Still, my point is that you don't need two variables to handle it.
> 
> Why not? If you want to list every bitmap and someone does create a new 
> one between first and second ioctls, you won't know.
> But I do not check it after second ioctl anyway, so probably we should 
> reduce it to a single field
> 

You will know, as on second ioctl the count will be set to bigger value 
than it was set by syscall on the first call, bigger than the buffer 
size you've given it, so you would know that some new cbt had appeared.


More information about the Devel mailing list