[LTP] [PATCH v4 3/4] syscalls/statx11: Add basic test for STATX_DIOALIGN on block device

Yang Xu (Fujitsu) xuyang2018.jy@fujitsu.com
Mon May 8 10:26:03 CEST 2023



on 2023/05/02 1:49, Eric Biggers wrote:
> On Thu, Apr 27, 2023 at 03:50:25AM +0000, Yang Xu (Fujitsu) wrote:
>>>>> +	sprintf(sys_bdev_logical_path, "/sys/block/%s/queue/logical_block_size", dev_name);
>>>>> +	while (access(sys_bdev_logical_path, F_OK) != 0) {
>>>>> +		dev_name[strlen(dev_name)-1] = '\0';
>>>>> +		sprintf(sys_bdev_logical_path, "/sys/block/%s/queue/logical_block_size", dev_name);
>>>>> +	}
>>>>
>>>> What is this code doing?  Is it trying to strip off the partition number of the
>>>> block device name?
>>>
>>> Yes.
>>>
>>>> If so, it is incorrect because it assumes the partition
>>>> number is only 1 digit long, which is not guaranteed.
>>>
>>> I don't assume the partition number is only 1 digit long, this code has
>>> a while circulate. Also, I try the /dev/vdb11 and it also works.
>>>
>>>
>>>>
>>>> How about just using /sys/class/block/%s/queue, which works for partitions?
>>
>>    /sys/class/block/%s/queue for partitions does't exist.
> 
> Okay, sorry, I forgot that /sys/class/block/%s/queue doesn't exist for
> partitions.
> 
> Please at least add a comment that explains what this code is doing, as it's
> hard to understand.

Yes, will add a comment for this

Best Regards
Yang Xu
> 
> - Eric


More information about the ltp mailing list