* [PATCH-e2fsprogs-resend] filefrag: fix fm_start in filefrag_fiemap loop
@ 2009-06-04 1:18 Peng Tao
2009-07-02 4:24 ` Theodore Tso
0 siblings, 1 reply; 2+ messages in thread
From: Peng Tao @ 2009-06-04 1:18 UTC (permalink / raw)
To: linux-ext4; +Cc: Theodore Tso, Andreas Dilger, Peng Tao
When used with -v and the targeted file has more than 144 extents(double of
the length of fm_extents array provided by buf), filefrag_fiemap loops and
calls fiemap ioctl() multiple times to calculate the actual number of extents
in a file. Each call to fiemap ioctl() uses fm_start as the starting logical
offset. The patch fixes fm_start in each loop( except for the first one) and
makes the extent calculation correct for files with more that 144 extents.
To produce the problem, first run filefrag -v on a highly fragmented file.
Then change the buf size in filefrag_fiemap to make it large enough to have
all the extent mapped in a single loop and run filefrag -v after recompiling.
The former will produce a much smaller extent count because of the false
fm_start used in the loop. And the two will produce different extent output
since the 145th extent.
Signed-off-by: Peng Tao <bergwolf@gmail.com>
---
misc/filefrag.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/misc/filefrag.c b/misc/filefrag.c
index 6bea2cd..7786646 100644
--- a/misc/filefrag.c
+++ b/misc/filefrag.c
@@ -239,7 +239,7 @@ int filefrag_fiemap(int fd, int blk_shift, int *num_extents)
n++;
}
- fiemap->fm_start += fm_ext[i-1].fe_logical +
+ fiemap->fm_start = fm_ext[i-1].fe_logical +
fm_ext[i-1].fe_length;
} while (last == 0);
--
1.6.2.GIT
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH-e2fsprogs-resend] filefrag: fix fm_start in filefrag_fiemap loop
2009-06-04 1:18 [PATCH-e2fsprogs-resend] filefrag: fix fm_start in filefrag_fiemap loop Peng Tao
@ 2009-07-02 4:24 ` Theodore Tso
0 siblings, 0 replies; 2+ messages in thread
From: Theodore Tso @ 2009-07-02 4:24 UTC (permalink / raw)
To: Peng Tao; +Cc: linux-ext4, Andreas Dilger
On Thu, Jun 04, 2009 at 09:18:40AM +0800, Peng Tao wrote:
> When used with -v and the targeted file has more than 144 extents(double of
> the length of fm_extents array provided by buf), filefrag_fiemap loops and
> calls fiemap ioctl() multiple times to calculate the actual number of extents
> in a file. Each call to fiemap ioctl() uses fm_start as the starting logical
> offset. The patch fixes fm_start in each loop( except for the first one) and
> makes the extent calculation correct for files with more that 144 extents.
>
> To produce the problem, first run filefrag -v on a highly fragmented file.
> Then change the buf size in filefrag_fiemap to make it large enough to have
> all the extent mapped in a single loop and run filefrag -v after recompiling.
> The former will produce a much smaller extent count because of the false
> fm_start used in the loop. And the two will produce different extent output
> since the 145th extent.
Thanks, applied.
- Ted
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2009-07-02 4:25 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-06-04 1:18 [PATCH-e2fsprogs-resend] filefrag: fix fm_start in filefrag_fiemap loop Peng Tao
2009-07-02 4:24 ` Theodore Tso
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).