diff mbox

filefrag: fix frag count in bmap case

Message ID 4A7A434B.9090007@redhat.com
State Accepted, archived
Headers show

Commit Message

Eric Sandeen Aug. 6, 2009, 2:43 a.m. UTC
The fragmentation count in the bmap case seems to be
off by one:

# echo foo > /mnt/test/bar
# filefrag /mnt/test/bar
/mnt/test/bar: 0 extents found

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



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

Comments

Theodore Ts'o Aug. 16, 2009, 3:50 a.m. UTC | #1
On Wed, Aug 05, 2009 at 09:43:23PM -0500, Eric Sandeen wrote:
> The fragmentation count in the bmap case seems to be
> off by one:
> 
> # echo foo > /mnt/test/bar
> # filefrag /mnt/test/bar
> /mnt/test/bar: 0 extents found

Thanks, applied.

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

Patch

diff --git a/misc/filefrag.c b/misc/filefrag.c
index eed2b86..128a391 100644
--- a/misc/filefrag.c
+++ b/misc/filefrag.c
@@ -342,6 +342,8 @@  static void frag_report(const char *filename)
 			rc = get_bmap(fd, i, &block);
 			if (block == 0)
 				continue;
+			if (!num_extents)
+				num_extents++;
 			count++;
 			if (last_block && (block != last_block+1) ) {
 				if (verbose)