Blame SOURCES/e2fsprogs-1.42.9-defrag-backwards-files.patch

252946
commit c7c539e8fd86de691475eea00409c6c030f312cd
252946
Author: Darrick J. Wong <darrick.wong@oracle.com>
252946
Date:   Tue Jul 22 12:40:56 2014 -0400
252946
252946
    e4defrag: backwards-allocated files should be defragmented too
252946
    
252946
    Currently, e4defrag avoids increasing file fragmentation by comparing
252946
    the number of runs of physical extents of both the original and the
252946
    donor files.  Unfortunately, there is a bug in the routine that counts
252946
    physical extents, since it doesn't look at the logical block offsets
252946
    of the extents.  Therefore, a file whose blocks were allocated in
252946
    reverse order will be seen as only having one big physical extent, and
252946
    therefore will not be defragmented.
252946
    
252946
    Fix the counting routine to consider logical extent offset so that we
252946
    defragment backwards-allocated files.  This could be problematic if we
252946
    ever gain the ability to lay out logically sparse extents in a
252946
    physically contiguous manner, but presumably one wouldn't call defrag
252946
    on such a file.
252946
    
252946
    Reported-by: Xiaoguang Wang <wangxg.fnst@cn.fujitsu.com>
252946
    Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
252946
    Signed-off-by: Theodore Ts'o <tytso@mit.edu>
252946
252946
Index: e2fsprogs-1.42.9/misc/e4defrag.c
252946
===================================================================
252946
--- e2fsprogs-1.42.9.orig/misc/e4defrag.c
252946
+++ e2fsprogs-1.42.9/misc/e4defrag.c
252946
@@ -941,7 +941,9 @@ static int get_physical_count(struct fie
252946
 
252946
 	do {
252946
 		if ((ext_list_tmp->data.physical + ext_list_tmp->data.len)
252946
-				!= ext_list_tmp->next->data.physical) {
252946
+				!= ext_list_tmp->next->data.physical ||
252946
+		    (ext_list_tmp->data.logical + ext_list_tmp->data.len)
252946
+				!= ext_list_tmp->next->data.logical) {
252946
 			/* This extent and next extent are not continuous. */
252946
 			ret++;
252946
 		}