lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:	Wed, 05 Aug 2009 22:30:48 -0500
From:	Eric Sandeen <sandeen@...hat.com>
To:	ext4 development <linux-ext4@...r.kernel.org>
Subject: [PATCH] filefrag: don't print extent header on bmap fallback

The extent list header gets printed before we fall back to bmap:

# filefrag -v /mnt/test/bar
Filesystem type is: 58465342
File size of /mnt/test/bar is 12288 (3 blocks, blocksize 4096)
 ext logical physical expected length flags <---- HERE
Discontinuity: Block 2 is at 17 (was 16)
/mnt/test/bar: 2 extents found

so delay printing it until we know fiemap is working.

(though ideally it'd be nice to have the same verbose output
regardless of the interface we used, I think).

Signed-off-by: Eric Sandeen <sandeen@...hat.com>
---

diff --git a/misc/filefrag.c b/misc/filefrag.c
index 128a391..de0444c 100644
--- a/misc/filefrag.c
+++ b/misc/filefrag.c
@@ -173,6 +173,7 @@ static int filefrag_fiemap(int fd, int blk_shift, int *num_extents)
 	unsigned long flags = 0;
 	unsigned int i;
 	static int fiemap_incompat_printed;
+	int fiemap_header_printed = 0;
 	int tot_extents = 1, n = 0;
 	int last = 0;
 	int rc;
@@ -190,11 +191,6 @@ static int filefrag_fiemap(int fd, int blk_shift, int *num_extents)
 	if (xattr_map)
 		flags |= FIEMAP_FLAG_XATTR;
 
-	if (verbose)
-		printf(" ext %*s %*s %*s length flags\n", logical_width,
-		       "logical", physical_width, "physical",
-		       physical_width, "expected");
-
 	do {
 		fiemap->fm_length = ~0ULL;
 		fiemap->fm_flags = flags;
@@ -209,6 +205,13 @@ static int filefrag_fiemap(int fd, int blk_shift, int *num_extents)
 			return rc;
 		}
 
+		if (verbose && !fiemap_header_printed) {
+			printf(" ext %*s %*s %*s length flags\n", logical_width,
+			       "logical", physical_width, "physical",
+			       physical_width, "expected");
+			fiemap_header_printed = 1;
+		}
+
 		if (!verbose) {
 			*num_extents = fiemap->fm_mapped_extents;
 			goto out;


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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ