2010/08/30 4:47, Andreas Rid wrote: > @@ -2327,8 +2320,44 @@ int main(int argc, char *argv[]) > } else > printf("ext4 defragmentation for %s\n", > argv[i]); > - /* Defrag single file process */ > - file_defrag(argv[i],&buf, FTW_F, NULL); > + > + if (mode_flag& RELEVANT&& i == optind) { > + if (i - argc == 1) > + /* not enought arguemnts */ > + goto out; I think this condition should be "argc - optind == 1" because "i" is smaller than argc at all times. > + goto out; > + } > + > + r_pstart = get_physical_offset(fd,&ret); If e4defrag is executed with the following arguments, e4defrag will move the extents of "move_file" near the "directory". # e4defrag -r base_file directory move_file To prevent this case, r_pstart should not be changed even if directories or devices are set to the argument of e4defrag after the physical block number of the "base_file" was assigned to r_pstart. I will fix your patch in above way. Any comments? Regards, Kazuya Mio -- To unsubscribe from this list: send the line "unsubscribe linux-ext4" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html