]> git.apps.os.sepia.ceph.com Git - xfstests-dev.git/commitdiff
src/t_stripealign.c: Use block size reported by fstatfs()
authorChandan Rajendra <chandan@linux.vnet.ibm.com>
Wed, 21 Nov 2018 16:26:46 +0000 (21:56 +0530)
committerEryu Guan <guaneryu@gmail.com>
Fri, 23 Nov 2018 06:23:52 +0000 (14:23 +0800)
On ppc64le, block size reported by fstat(2) is 64k (the page size)
i.e. the "preferred I/O size". However src/t_stripealign.c requires the
actual block size of the filesystem. Hence this commit now makes use of
the block size reported by fstatfs(2) syscall.

Signed-off-by: Chandan Rajendra <chandan@linux.vnet.ibm.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
src/t_stripealign.c

index c61e7632525931bdcce4f87cb9a2f8142f6bda0a..5cdadaaee09c96a9829ecdd5556d9ef716b08b92 100644 (file)
@@ -7,7 +7,7 @@
 #include <unistd.h>
 #include <stdlib.h>
 #include <sys/types.h>
-#include <sys/stat.h>
+#include <sys/vfs.h>
 #include <fcntl.h>
 #include <stdio.h>
 #include <sys/ioctl.h>
@@ -31,7 +31,7 @@
 
 int main(int argc, char ** argv)
 {
-       struct stat             sb;
+       struct statfs           sb;
        struct fiemap           *fie;
        struct fiemap_extent    *fe;
        int                     fd;
@@ -54,7 +54,7 @@ int main(int argc, char ** argv)
                 return 1;
         }
 
-       ret = fstat(fd, &sb);
+       ret = fstatfs(fd, &sb);
        if (ret) {
                perror(filename);
                close(fd);
@@ -101,7 +101,7 @@ int main(int argc, char ** argv)
                return 1;
        }
 
-       block = fie->fm_extents[0].fe_physical / sb.st_blksize;
+       block = fie->fm_extents[0].fe_physical / sb.f_bsize;
 check:
        if (block % sunit) {
                printf("%s: Start block %llu not multiple of sunit %u\n",