public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
* REVIEW: fix xfs_bmap -vp confusion
@ 2007-07-11  3:18 Barry Naujok
  2007-07-11  5:53 ` David Chinner
  0 siblings, 1 reply; 4+ messages in thread
From: Barry Naujok @ 2007-07-11  3:18 UTC (permalink / raw)
  To: xfs@oss.sgi.com, xfs-dev

[-- Attachment #1: Type: text/plain, Size: 234 bytes --]

If xfs_bmap -vp is run on a file without unwritten extents
and the filesystem does not use sunit/swidth, the FLAGS
column is not shown. This leads to some confusion.

So, when -vp option is used, it will always print the
FLAGS column.

[-- Attachment #2: xfs_bmap_pflag.patch --]
[-- Type: application/octet-stream, Size: 1225 bytes --]

--- a/xfsprogs/io/bmap.c	2007-07-11 13:11:42.000000000 +1000
+++ b/xfsprogs/io/bmap.c	2007-07-11 12:34:33.519572709 +1000
@@ -74,6 +74,7 @@ bmap_f(
 	int			aflag = 0;
 	int			lflag = 0;
 	int			nflag = 0;
+	int			pflag = 0;
 	int			vflag = 0;
 	int			is_rt = 0;
 	int			bmv_iflags = 0;	/* flags for XFS_IOC_GETBMAPX */
@@ -99,6 +100,7 @@ bmap_f(
 			break;
 		case 'p':
 		/* report unwritten preallocated blocks */
+			pflag = 1;
 			bmv_iflags |= BMV_IF_PREALLOC;
 			break;
 		case 'v':	/* Verbose output */
@@ -289,7 +291,7 @@ bmap_f(
 			sunit = (fsgeo.sunit * fsgeo.blocksize) / BBSIZE;
 			swidth = (fsgeo.swidth * fsgeo.blocksize) / BBSIZE;
 		}
-		flg = sunit;
+		flg = sunit | pflag;
 
 		/*
 		 * Go through the extents and figure out the width
@@ -397,14 +399,14 @@ bmap_f(
 					printf("  ");
 				printf(" %*lld", tot_w,
 					(long long)map[i+1].bmv_length);
-				if (flg == FLG_NULL) {
+				if (flg == FLG_NULL && !pflag) {
 					printf("\n");
 				} else {
 					printf(" %-*.*o\n", NFLG, NFLG, flg);
 				}
 			}
 		}
-		if (flg && vflag > 1) {
+		if ((flg || pflag) && vflag > 1) {
 			printf(_(" FLAG Values:\n"));
 			printf(_("    %*.*o Unwritten preallocated extent\n"),
 				NFLG+1, NFLG+1, FLG_PRE);

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2007-07-11  8:06 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-07-11  3:18 REVIEW: fix xfs_bmap -vp confusion Barry Naujok
2007-07-11  5:53 ` David Chinner
2007-07-11  6:04   ` Barry Naujok
2007-07-11  8:05     ` David Chinner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox