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@xxxxxxxxxx> --- V2: Just use XFS_IOC_DIOINFO to get the minimum DIO size, thanks Dave. diff --git a/libxfs/linux.c b/libxfs/linux.c index 885016a..f6ea1b2 100644 --- a/libxfs/linux.c +++ b/libxfs/linux.c @@ -142,18 +142,20 @@ platform_findsizes(char *path, int fd, long long *sz, int *bsz) 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; _______________________________________________ xfs mailing list xfs@xxxxxxxxxxx http://oss.sgi.com/mailman/listinfo/xfs