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

Eric Biggers ebiggers@kernel.org
Mon May 1 19:49:02 CEST 2023


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.

- Eric


More information about the ltp mailing list