Now that we allow logical-sector-sized DIOs even if our xfs
filesystem is set to physical-sector-sized "sectors," we can
allow the creation of filesystem images with block and sector
sizes down to the host device's logical sector size, rather
than the filesystem's sector size.
So in platform_findsizes(), change our query of the filesystem
to an XFS_IOC_DIOINFO query, and use the returned d_miniosz for
sector size in the S_IFREG case.
This allows the creation of i.e. a 2k block sized image on
an xfs filesystem w/ 4k sector size created on a 4k/512
block device, which would otherwise fail today.
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
progname, path, strerror(errno));
exit(1);
}
+
if ((st.st_mode & S_IFMT) == S_IFREG) {
- struct xfs_fsop_geom_v1 geom = { 0 };
+ struct dioattr da;
*sz = (long long)(st.st_size >> 9);
- if (ioctl(fd, XFS_IOC_FSGEOMETRY_V1, &geom) < 0) {
+
+ if (ioctl(fd, XFS_IOC_DIOINFO, &da) < 0) {
/*
* fall back to BBSIZE; mkfs might fail if there's a
* size mismatch between the image & the host fs...
*/
*bsz = BBSIZE;
} else
- *bsz = geom.sectsize;
+ *bsz = da.d_miniosz;
if (*bsz > max_block_alignment)
max_block_alignment = *bsz;