All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chandan Rajendra <chandan@linux.vnet.ibm.com>
To: fstests@vger.kernel.org
Cc: Chandan Rajendra <chandan@linux.vnet.ibm.com>, guaneryu@gmail.com
Subject: [PATCH] src/t_stripealign.c: Use block size reported by fstatfs()
Date: Wed, 21 Nov 2018 21:56:46 +0530	[thread overview]
Message-ID: <20181121162646.18117-1-chandan@linux.vnet.ibm.com> (raw)

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>
---
 src/t_stripealign.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/t_stripealign.c b/src/t_stripealign.c
index c61e7632..5cdadaae 100644
--- a/src/t_stripealign.c
+++ b/src/t_stripealign.c
@@ -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",
-- 
2.19.1

             reply	other threads:[~2018-11-22  3:02 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-21 16:26 Chandan Rajendra [this message]
2018-11-23  6:20 ` [PATCH] src/t_stripealign.c: Use block size reported by fstatfs() Eryu Guan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181121162646.18117-1-chandan@linux.vnet.ibm.com \
    --to=chandan@linux.vnet.ibm.com \
    --cc=fstests@vger.kernel.org \
    --cc=guaneryu@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.