GNU bug report logs -
#6131
[PATCH]: fiemap support for efficient sparse file copy
Previous Next
Reported by: "jeff.liu" <jeff.liu <at> oracle.com>
Date: Fri, 7 May 2010 14:16:02 UTC
Severity: normal
Tags: patch
Done: Jim Meyering <jim <at> meyering.net>
Bug is archived. No further changes may be made.
Full log
Message #41 received at submit <at> debbugs.gnu.org (full text, mbox):
jeff.liu wrote:
...
> Sorry for the lack of detailed info for this point, except for removing the fiemap->fm_start from
> the loop, I need to remove "fiemap->fm_start = (fm_ext[i-1].fe_logical + fm_ext[i-1].fe_length);"
> out of the 'for (i = 0; i < fiemap->fm_mapped_extents; i++)" as well.
> So, if there is only one extent, at least 'i == 1' when the loop finished, we'll not hit the
> 'fm_ext[-1]' issue.
>
> my thoughts of the fix looks like below:
>
> memset (fiemap, 0, sizeof fiemap_buf);
> do
> {
> ioctl (...);
>
> for (i = 0; i < fiemap->fm_mapped_extents; i++)
> {
> ...
> }
> fiemap->fm_start = (fm_ext[i-1].fe_logical + fm_ext[i-1].fe_length);
> } while (! last);
That is better.
Equivalent semantics to my change, but yours avoids unnecessarily
updating fiemap->fm_start for each iteration of the for loop.
...
>> For reference, here's what filefrag -v output looks like,
>> given a file with a nontrivial list of extents:
>>
>> $ perl -e 'BEGIN{$n=16*1024; *F=*STDOUT}' \
>> -e 'for (1..5) { sysseek(*F,$n,1)' \
>> -e '&& syswrite *F,"."x$n or die "$!"}' > j
>> $ filefrag -v j
>> Filesystem type is: ef53
>> File size of j is 163840 (40 blocks, blocksize 4096)
>> ext logical physical expected length flags
>> 0 4 6258884 4
>> 1 12 6258892 6258887 4
>> 2 20 6258900 6258895 4
>> 3 28 6258908 6258903 4
>> 4 36 6258916 6258911 4 eof
>> j: 6 extents found
> Do we need another test script for this test if we choose `filefrag' to examine the extent info?
Yes, that's why I took the time to do the above.
I've already written most of it. Will post shortly.
This bug report was last modified 14 years and 119 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.