Package: e2fsprogs
 Version: 1.41.12-4
 Severity: wishlist
 Tags: patch

 When filefrag uses FIEMAP ioctl its logic differs for ordinary and verbose 
 (-v) modes. ext4 returns extent on every 32768 block so on large files it is
 possible that `filefrag large-file' tells about 4 extents while 
 `filefrag -v large-file' finds only one.

 Also when I tried to use generic_block_fiemap function to add FIEMAP for 
 reiserfs, every block was reported as a new extent resulting in thousands
 "extents" for continuous files.

 I think filefrag should merge adjacent extents even when -v is not
 specified.


 -- System Information:
 Debian Release: wheezy/sid
   APT prefers testing
   APT policy: (500, 'testing'), (50, 'unstable'), (1, 'experimental')
 Architecture: amd64 (x86_64)

 Kernel: Linux 3.0.0-rc3-amd64 (SMP w/2 CPU cores)
 Locale: LANG=ru_RU.utf8, LC_CTYPE=ru_RU.utf8 (charmap=UTF-8)
 Shell: /bin/sh linked to /bin/dash

 Versions of packages e2fsprogs depends on:
 ii e2fslibs 1.41.12-4 ext2/ext3/ext4 file system librari
 ii libblkid1 2.17.2-9.1 block device id library
 ii libc6 2.13-7 Embedded GNU C Library: Shared lib
 ii libcomerr2 1.41.12-4 common error description library
 ii libss2 1.41.12-4 command-line interface parsing lib
 ii libuuid1 2.17.2-9.1 Universally Unique ID library
 ii util-linux 2.17.2-9.1 Miscellaneous system utilities

 e2fsprogs recommends no packages.

 Versions of packages e2fsprogs suggests:
 pn e2fsck-static <none> (no description available)
 ii gpart 0.1h-11+b1 Guess PC disk partition table, fin
 ii parted 2.3-5 The GNU Parted disk partition resi

 -- debconf-show failed
diff -ur e2fsprogs-1.41.14-orig/misc/filefrag.c e2fsprogs-1.41.14/misc/filefrag.c
--- e2fsprogs-1.41.14-orig/misc/filefrag.c	2010-12-22 18:49:20.000000000 +0300
+++ e2fsprogs-1.41.14/misc/filefrag.c	2011-06-23 20:00:27.408000000 +0400
@@ -183,9 +183,6 @@
 
 	memset(fiemap, 0, sizeof(struct fiemap));
 
-	if (!verbose)
-		count = 0;
-
 	if (sync_file)
 		flags |= FIEMAP_FLAG_SYNC;
 
@@ -213,11 +210,6 @@
 			fiemap_header_printed = 1;
 		}
 
-		if (!verbose) {
-			*num_extents = fiemap->fm_mapped_extents;
-			goto out;
-		}
-
 		/* If 0 extents are returned, then more ioctls are not needed */
 		if (fiemap->fm_mapped_extents == 0)
 			break;
@@ -234,7 +226,9 @@
 				tot_extents++;
 			else
 				last_blk = 0;
-			print_extent_info(&fm_ext[i], n, last_blk, blk_shift);
+
+			if (verbose)
+				print_extent_info(&fm_ext[i], n, last_blk, blk_shift);
 
 			last_blk = phy_blk + ext_len - 1;
 			if (fm_ext[i].fe_flags & FIEMAP_EXTENT_LAST)

Reply via email to