diff mbox

[v2,6/8] fsstress: translate flags in fiemap_f

Message ID 1394034699-21187-7-git-send-email-lczerner@redhat.com
State Not Applicable, archived
Headers show

Commit Message

Lukas Czerner March 5, 2014, 3:51 p.m. UTC
Translate flags in fiemap_f output to human readable strings.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
---
 ltp/fsstress.c | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

Comments

Christoph Hellwig March 6, 2014, 5:48 p.m. UTC | #1
> +#ifdef HAVE_LINUX_FIEMAP_H
> +struct print_flags fiemap_flags[] = {
> +	{ FIEMAP_FLAG_SYNC, "SYNC"},
> +	{ FIEMAP_FLAG_XATTR, "XATTR"},
> +	{ -1, NULL}
> +};

Can be static.

> +
> +#define translate_fiemap_flags(mode)	\
> +	({translate_flags(mode, "|", fiemap_flags);})
> +#endif

Any reason to not have these two inside fiemap_f?

Otherwise:

Reviewed-by: Christoph Hellwig <hch@lst.de>
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Lukas Czerner March 6, 2014, 6:02 p.m. UTC | #2
On Thu, 6 Mar 2014, Christoph Hellwig wrote:

> Date: Thu, 6 Mar 2014 09:48:13 -0800
> From: Christoph Hellwig <hch@infradead.org>
> To: Lukas Czerner <lczerner@redhat.com>
> Cc: linux-ext4@vger.kernel.org, linux-fsdevel@vger.kernel.org, xfs@oss.sgi.com
> Subject: Re: [PATCH v2 6/8] fsstress: translate flags in fiemap_f
> 
> > +#ifdef HAVE_LINUX_FIEMAP_H
> > +struct print_flags fiemap_flags[] = {
> > +	{ FIEMAP_FLAG_SYNC, "SYNC"},
> > +	{ FIEMAP_FLAG_XATTR, "XATTR"},
> > +	{ -1, NULL}
> > +};
> 
> Can be static.

Right. The same applies to falloc_flags

> 
> > +
> > +#define translate_fiemap_flags(mode)	\
> > +	({translate_flags(mode, "|", fiemap_flags);})
> > +#endif
> 
> Any reason to not have these two inside fiemap_f?

Not really, other than I think it's ugly.

> 
> Otherwise:
> 
> Reviewed-by: Christoph Hellwig <hch@lst.de>

Thanks!
-Lukas

> --
> To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/ltp/fsstress.c b/ltp/fsstress.c
index 00fda36..40f9a03 100644
--- a/ltp/fsstress.c
+++ b/ltp/fsstress.c
@@ -2266,6 +2266,18 @@  fdatasync_f(int opno, long r)
 	free_pathname(&f);
 	close(fd);
 }
+
+#ifdef HAVE_LINUX_FIEMAP_H
+struct print_flags fiemap_flags[] = {
+	{ FIEMAP_FLAG_SYNC, "SYNC"},
+	{ FIEMAP_FLAG_XATTR, "XATTR"},
+	{ -1, NULL}
+};
+
+#define translate_fiemap_flags(mode)	\
+	({translate_flags(mode, "|", fiemap_flags);})
+#endif
+
 void
 fiemap_f(int opno, long r)
 {
@@ -2328,9 +2340,10 @@  fiemap_f(int opno, long r)
 
 	e = ioctl(fd, FS_IOC_FIEMAP, (unsigned long)fiemap);
 	if (v)
-		printf("%d/%d: ioctl(FIEMAP) %s%s %lld %lld %x %d\n",
+		printf("%d/%d: ioctl(FIEMAP) %s%s %lld %lld (%s) %d\n",
 		       procid, opno, f.path, st, (long long)fiemap->fm_start,
-		       (long long) fiemap->fm_length, fiemap->fm_flags, e);
+		       (long long) fiemap->fm_length,
+		       translate_fiemap_flags(fiemap->fm_flags), e);
 	free(fiemap);
 	free_pathname(&f);
 	close(fd);