Skip to contentSkip to conversation

filefrag: fix frag count in bmap case

PATCH Applied Eric Sandeen 2 participants 2 messages Aug 6, 2009 – Aug 16, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 filefrag: fix frag count in bmap case

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

---

misc/filefrag.c +2 -0
index eed2b86..128a391 100644
@@ -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)
Applied
#1 lore raw
Quoted 6 lines · Eric Sandeen

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