fsstress: translate flags in fiemap_f
authorLukas Czerner <lczerner@redhat.com>
Thu, 13 Mar 2014 04:19:56 +0000 (15:19 +1100)
committerDave Chinner <david@fromorbit.com>
Thu, 13 Mar 2014 04:19:56 +0000 (15:19 +1100)
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>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dave Chinner <david@fromorbit.com>
ltp/fsstress.c

index 625309f546fd96a5360459308f680046b56ad7e9..fd258bf25aa912f5a877c09fa5be0c4179706e0c 100644 (file)
@@ -2274,6 +2274,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)
 {
@@ -2336,9 +2348,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);