]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
Report unwritten extents in optional flags section of verbose bmap output
authorNathan Scott <nathans@sgi.com>
Thu, 17 Jul 2003 23:18:56 +0000 (23:18 +0000)
committerNathan Scott <nathans@sgi.com>
Thu, 17 Jul 2003 23:18:56 +0000 (23:18 +0000)
doc/CHANGES
io/bmap.c

index 9ec09ad44afa6fa9286e1598cec5f19c0514823a..28f5aca8c4631eaad7fe59fb152397de6350e839 100644 (file)
@@ -1,3 +1,7 @@
+[cvs]
+       - Update xfs_io bmap command to report unwritten extent flag
+         if it is set on an extent (in verbose mode only).
+
 xfsprogs-2.5.3 (07 July 2003)
        - Update xfs_io commands which take user input in terms of
          byte counts to now also allow unit prefixes like mkfs.xfs.
index d6668377995d1ea5dac09271ec8f1ef495936472..20e48ca6c23eea2d4bc1d0f0b6733cc57c21eeef 100644 (file)
--- a/io/bmap.c
+++ b/io/bmap.c
@@ -282,11 +282,13 @@ bmap_f(
 #define MINAG_WIDTH    2
 #define MINTOT_WIDTH   5
 #define        max(a,b)        (a > b ? a : b)
-#define        FLG_NULL        00000   /* Null flag */
-#define        FLG_BSU         01000   /* Not on begin of stripe unit  */
-#define        FLG_ESU         00100   /* Not on end   of stripe unit  */
-#define        FLG_BSW         00010   /* Not on begin of stripe width */
-#define        FLG_ESW         00001   /* Not on end   of stripe width */
+#define NFLG           5       /* count of flags */
+#define        FLG_NULL        000000  /* Null flag */
+#define        FLG_PRE         010000  /* Unwritten extent */
+#define        FLG_BSU         001000  /* Not on begin of stripe unit  */
+#define        FLG_ESU         000100  /* Not on end   of stripe unit  */
+#define        FLG_BSW         000010  /* Not on begin of stripe width */
+#define        FLG_ESW         000001  /* Not on end   of stripe width */
                int     agno;
                off64_t agoff, bbperag;
                int     foff_w, boff_w, aoff_w, tot_w, agno_w;
@@ -299,6 +301,7 @@ bmap_f(
                          (off64_t)fsgeo.blocksize / BBSIZE;
                sunit = fsgeo.sunit;
                swidth = fsgeo.swidth;
+               flg = sunit;
 
                /*
                 * Go through the extents and figure out the width
@@ -309,6 +312,8 @@ bmap_f(
                                (long long) map[i + 1].bmv_offset,
                                (long long)(map[i + 1].bmv_offset +
                                map[i + 1].bmv_length - 1LL));
+                       if (map[i + 1].bmv_oflags & BMV_OF_PREALLOC)
+                               flg = 1;
                        if (map[i + 1].bmv_block == -1) {
                                foff_w = max(foff_w, strlen(rbuf));
                                tot_w = max(tot_w,
@@ -331,16 +336,20 @@ bmap_f(
                        }
                }
                agno_w = max(MINAG_WIDTH, numlen(fsgeo.agcount));
-               printf("%4s: %-*s %-*s %*s %-*s %*s\n",
+               printf("%4s: %-*s %-*s %*s %-*s %*s%s\n",
                        _("EXT"),
                        foff_w, _("FILE-OFFSET"),
                        boff_w, _("BLOCK-RANGE"),
                        agno_w, _("AG"),
                        aoff_w, _("AG-OFFSET"),
-                       tot_w, _("TOTAL"));
+                       tot_w, _("TOTAL"),
+                       flg ? _(" FLAGS") : "");
                for (i = 0; i < map->bmv_entries; i++) {
+                       flg = FLG_NULL;
+                       if (map[i + 1].bmv_oflags & BMV_OF_PREALLOC) {
+                               flg |= FLG_PRE;
+                       }
                        if (sunit) {
-                               flg = FLG_NULL;
                                if (map[i + 1].bmv_block  % sunit != 0) {
                                        flg |= FLG_BSU;
                                }
@@ -388,20 +397,22 @@ bmap_f(
                                if (flg == FLG_NULL) {
                                        printf("\n");
                                } else {
-                                       printf(" %-4.4o\n", flg);
+                                       printf(" %-*.*o\n", NFLG, NFLG, flg);
                                }
                        }
                }
-               if ( flg ) {
-                       printf(_(" FLG Values:\n"));
-                       printf(_("    %5.5o Doesn't begin on stripe unit\n"),
-                               FLG_BSU);
-                       printf(_("    %5.5o Doesn't end   on stripe unit\n"),
-                               FLG_ESU);
-                       printf(_("    %5.5o Doesn't begin on stripe width\n"),
-                               FLG_BSW);
-                       printf(_("    %5.5o Doesn't end   on stripe width\n"),
-                               FLG_ESW);
+               if (flg && vflag > 1) {
+                       printf(_(" FLAG Values:\n"));
+                       printf(_("    %*.*o Unwritten preallocated extent\n"),
+                               NFLG+1, NFLG+1, FLG_PRE);
+                       printf(_("    %*.*o Doesn't begin on stripe unit\n"),
+                               NFLG+1, NFLG+1, FLG_BSU);
+                       printf(_("    %*.*o Doesn't end   on stripe unit\n"),
+                               NFLG+1, NFLG+1, FLG_ESU);
+                       printf(_("    %*.*o Doesn't begin on stripe width\n"),
+                               NFLG+1, NFLG+1, FLG_BSW);
+                       printf(_("    %*.*o Doesn't end   on stripe width\n"),
+                               NFLG+1, NFLG+1, FLG_ESW);
                }
        }
        free(map);