Use statvfs to fill in geometry block size and sector size in openfile() for "foreign" (non-xfs) files. Signed-off-by: Eric Sandeen <sandeen@xxxxxxxxxx> --- diff --git a/io/open.c b/io/open.c index f2ea7c3..b0dcabc 100644 --- a/io/open.c +++ b/io/open.c @@ -16,6 +16,7 @@ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ +#include <sys/statvfs.h> #include "command.h" #include "input.h" #include "init.h" @@ -94,13 +95,25 @@ openfile( } } - if (!geom || !platform_test_xfs_fd(fd)) + if (!geom) return fd; - if (xfsctl(path, fd, XFS_IOC_FSGEOMETRY, geom) < 0) { - perror("XFS_IOC_FSGEOMETRY"); - close(fd); - return -1; + if (platform_test_xfs_fd(fd)) { + if (xfsctl(path, fd, XFS_IOC_FSGEOMETRY, geom) < 0) { + perror("XFS_IOC_FSGEOMETRY"); + close(fd); + return -1; + } + } else { /* Fill in block & sector size for cvtnum */ + struct statvfs statbuf; + + if (fstatvfs(fd, &statbuf) < 0) { + perror("fstatvfs"); + close(fd); + return -1; + } + geom->blocksize = statbuf.f_bsize; + geom->sectsize = 512; } if (!(flags & IO_READONLY) && (flags & IO_REALTIME)) { -- To unsubscribe from this list: send the line "unsubscribe linux-xfs" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html