[LTP] [PATCH v2] syscalls/ioctl_loop05: Use correct blockdev to get logical_block_size

Jan Stancek jstancek@redhat.com
Wed Jun 10 15:04:03 CEST 2020



----- Original Message -----
> >>
> >> What I had in mind when I referred to df was something like:
> >>    stat("test.img", &statbuf);
> >>    SAFE_MKNOD("blkdev", S_IFBLK | S_IRWXU, statbuf.st_dev);
> >>    block_devfd = SAFE_OPEN("blkdev", O_RDWR);
> >> What do you think?
> >>
> It works well on ext4 or xfs filesystem(user may mount wanted filesystem
> on tmpdir). But if we use btrfs, this
> BLKSSZGET will fail because major dev numer is 0. When we meet this
> situation, we don't need to call this ioctl and we can directly test
> becuase it doesn' t have backing file block device align limit.
> What do you thin about it?

This I didn't expect. If it's not reliable then perhaps your method
in v1 that incrementally increases it until it works is perhaps most
universal approach. Sorry for the detour to get there.



More information about the ltp mailing list