public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
* Re: REVIEW: xfs_bmap '-v' flag has no effect on a realtime file system
  2007-06-29  6:16 REVIEW: xfs_bmap '-v' flag has no effect on a realtime file system Barry Naujok
@ 2007-06-29  6:16 ` David Chinner
  0 siblings, 0 replies; 2+ messages in thread
From: David Chinner @ 2007-06-29  6:16 UTC (permalink / raw)
  To: Barry Naujok; +Cc: xfs-dev, xfs@oss.sgi.com

On Fri, Jun 29, 2007 at 04:16:53PM +1000, Barry Naujok wrote:
> It's rather confusing when you run xfs_bmap -v on a realtime file and
> it doesn't show any verbose information at all.
> 
> The attached patch presents verbose information but without the AG
> information for realtime files.

Looks ok to me.

Cheers,

Dave.
-- 
Dave Chinner
Principal Engineer
SGI Australian Software Group

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

* REVIEW: xfs_bmap '-v' flag has no effect on a realtime file system
@ 2007-06-29  6:16 Barry Naujok
  2007-06-29  6:16 ` David Chinner
  0 siblings, 1 reply; 2+ messages in thread
From: Barry Naujok @ 2007-06-29  6:16 UTC (permalink / raw)
  To: xfs-dev, xfs@oss.sgi.com

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

It's rather confusing when you run xfs_bmap -v on a realtime file and
it doesn't show any verbose information at all.

The attached patch presents verbose information but without the AG
information for realtime files.

Eg:

# xfs_bmap -v foo_rt
foo_rt:
  EXT: FILE-OFFSET      RT-BLOCK-RANGE     TOTAL
    0: [0..2047]:       0..2047             2048

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

--- a/xfsprogs/io/bmap.c	2007-06-29 16:12:23.000000000 +1000
+++ b/xfsprogs/io/bmap.c	2007-06-29 16:09:25.117572950 +1000
@@ -75,6 +75,7 @@ bmap_f(
 	int			lflag = 0;
 	int			nflag = 0;
 	int			vflag = 0;
+	int			is_rt = 0;
 	int			bmv_iflags = 0;	/* flags for XFS_IOC_GETBMAPX */
 	int			i = 0;
 	int			c;
@@ -133,7 +134,7 @@ bmap_f(
 			 * ag info not applicable to rt, continue
 			 * without ag output.
 			 */
-			vflag = 0;
+			is_rt = 1;
 		}
 	}
 
@@ -280,10 +281,14 @@ bmap_f(
 
 		foff_w = boff_w = aoff_w = MINRANGE_WIDTH;
 		tot_w = MINTOT_WIDTH;
-		bbperag = (off64_t)fsgeo.agblocks *
-			  (off64_t)fsgeo.blocksize / BBSIZE;
-		sunit = (fsgeo.sunit * fsgeo.blocksize) / BBSIZE;
-		swidth = (fsgeo.swidth * fsgeo.blocksize) / BBSIZE;
+		if (is_rt)
+			sunit = swidth = bbperag = 0;
+		else {
+			bbperag = (off64_t)fsgeo.agblocks *
+				  (off64_t)fsgeo.blocksize / BBSIZE;
+			sunit = (fsgeo.sunit * fsgeo.blocksize) / BBSIZE;
+			swidth = (fsgeo.swidth * fsgeo.blocksize) / BBSIZE;
+		}
 		flg = sunit;
 
 		/*
@@ -306,25 +311,31 @@ bmap_f(
 					(long long) map[i + 1].bmv_block,
 					(long long)(map[i + 1].bmv_block +
 						map[i + 1].bmv_length - 1LL));
-				agno = map[i + 1].bmv_block / bbperag;
-				agoff = map[i + 1].bmv_block - (agno * bbperag);
-				snprintf(abuf, sizeof(abuf), "(%lld..%lld)",
-					(long long)agoff,  (long long)
-					(agoff + map[i + 1].bmv_length - 1LL));
-				foff_w = max(foff_w, strlen(rbuf));
 				boff_w = max(boff_w, strlen(bbuf));
-				aoff_w = max(aoff_w, strlen(abuf));
+				if (!is_rt) {
+					agno = map[i + 1].bmv_block / bbperag;
+					agoff = map[i + 1].bmv_block -
+							(agno * bbperag);
+					snprintf(abuf, sizeof(abuf),
+						"(%lld..%lld)",
+						(long long)agoff,
+						(long long)(agoff +
+						 map[i + 1].bmv_length - 1LL));
+					aoff_w = max(aoff_w, strlen(abuf));
+				} else
+					aoff_w = 0;
+				foff_w = max(foff_w, strlen(rbuf));
 				tot_w = max(tot_w,
 					numlen(map[i+1].bmv_length));
 			}
 		}
-		agno_w = max(MINAG_WIDTH, numlen(fsgeo.agcount));
+		agno_w = is_rt ? 0 : max(MINAG_WIDTH, numlen(fsgeo.agcount));
 		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"),
+			boff_w, is_rt ? _("RT-BLOCK-RANGE") : _("BLOCK-RANGE"),
+			agno_w, is_rt ? "" : _("AG"),
+			aoff_w, is_rt ? "" : _("AG-OFFSET"),
 			tot_w, _("TOTAL"),
 			flg ? _(" FLAGS") : "");
 		for (i = 0; i < egcnt; i++) {
@@ -369,18 +380,23 @@ bmap_f(
 					(long long) map[i + 1].bmv_block,
 					(long long)(map[i + 1].bmv_block +
 						map[i + 1].bmv_length - 1LL));
-				agno = map[i + 1].bmv_block / bbperag;
-				agoff = map[i + 1].bmv_block - (agno * bbperag);
-				snprintf(abuf, sizeof(abuf), "(%lld..%lld)",
-					(long long)agoff,  (long long)
-					(agoff + map[i + 1].bmv_length - 1LL));
-				printf("%4d: %-*s %-*s %*d %-*s %*lld",
-					i,
-					foff_w, rbuf,
-					boff_w, bbuf,
-					agno_w, agno,
-					aoff_w, abuf,
-					tot_w, (long long)map[i+1].bmv_length);
+				printf("%4d: %-*s %-*s", i, foff_w, rbuf,
+					boff_w, bbuf);
+				if (!is_rt) {
+					agno = map[i + 1].bmv_block / bbperag;
+					agoff = map[i + 1].bmv_block -
+							(agno * bbperag);
+					snprintf(abuf, sizeof(abuf),
+						"(%lld..%lld)",
+						(long long)agoff,
+						(long long)(agoff +
+						 map[i + 1].bmv_length - 1LL));
+					printf(" %*d %-*s", agno_w, agno,
+						aoff_w, abuf);
+				} else
+					printf("  ");
+				printf(" %*lld", tot_w,
+					(long long)map[i+1].bmv_length);
 				if (flg == FLG_NULL) {
 					printf("\n");
 				} else {

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

end of thread, other threads:[~2007-06-29  6:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-06-29  6:16 REVIEW: xfs_bmap '-v' flag has no effect on a realtime file system Barry Naujok
2007-06-29  6:16 ` David Chinner

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