e4defrag: Use get_fragment_score() for decision of whether to defrag
PATCH RESEND 5/11 e4defrag: Use get_fragment_score() for decision of whether to defrag
This makes e4defrag use get_fragment_score() to calculate fragmentation score. If fragmentation score of the target file is zero or less than the destination file's one, e4defrag stops defragmentation.
The threshold that shows whether a fragment is good or not comes from "blocksize * 8 - 2048". It's the same value as filefrag.
Signed-off-by Kazuya Mio <[email protected]>
--- misc/Makefile.in | 4 +-- misc/e4defrag.c | 64 +++++++++++++++++++++++++++++++++++++++++++++++++------ 2 files changed, 60 insertions(+), 8 deletions(-)
misc/Makefile.in +2 -2
@@ -196,9 +196,9 @@ e2undo.profiled: $(PROFILED_E2UNDO_OBJS) $(PROFILED_DEPLIBS) $(Q) $(CC) $(ALL_LDFLAGS) -g -pg -o e2undo.profiled \ $(PROFILED_E2UNDO_OBJS) $(PROFILED_LIBS) $(LIBINTL) -e4defrag: $(E4DEFRAG_OBJS) $(DEPLIBS) +e4defrag: $(E4DEFRAG_OBJS) $(DEPLIBS) $(DEPLIBS_E2P) $(E) " LD $@" - $(Q) $(CC) $(ALL_LDFLAGS) -o e4defrag $(E4DEFRAG_OBJS) $(LIBS) + $(Q) $(CC) $(ALL_LDFLAGS) -o e4defrag $(E4DEFRAG_OBJS) $(LIBS) $(LIBE2P) e4defrag.profiled: $(PROFILED_E4DEFRAG_OBJS) $(PROFILED_DEPLIBS) $(E) " LD $@"
misc/e4defrag.c +58 -6
123 lines not on this page · raw message