GNU bug report logs - #6131
[PATCH]: fiemap support for efficient sparse file copy

Previous Next

Package: coreutils;

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


View this message in rfc822 format

From: Jim Meyering <jim <at> meyering.net>
To: "jeff.liu" <jeff.liu <at> oracle.com>
Cc: Sunil Mushran <sunil.mushran <at> oracle.com>, Tao Ma <tao.ma <at> oracle.com>, bug-coreutils <at> gnu.org, Joel Becker <Joel.Becker <at> oracle.com>, Chris Mason <chris.mason <at> oracle.com>
Subject: bug#6131: [PATCH]: fiemap support for efficient sparse file copy
Date: Mon, 24 May 2010 09:41:27 +0200
jeff.liu wrote:
> Jim Meyering wrote:
>> jeff.liu wrote:
>> ...
>>>>> Subject: [PATCH 1/1] tests: add a new test for FIEMAP-copy
>>>>>
>>>>> * tests/cp/sparse-fiemap: Add a new test for FIEMAP-copy against a
>>>>> loopbacked ext4 partition.
>>>>> * tests/Makefile.am (sparse-fiemap): Reference the new test.
>>
>> BTW, I've just made this additional change to your test,
>>
>> diff --git a/tests/cp/sparse-fiemap b/tests/cp/sparse-fiemap
>> index 6312a4c..bdc7ded 100755
>> --- a/tests/cp/sparse-fiemap
>> +++ b/tests/cp/sparse-fiemap
>> @@ -27,6 +27,7 @@ require_root_
>>  cwd=`pwd`
>>  cleanup_() { cd /; umount "$cwd/mnt"; }
>>
>> +skip=0

More fixes for the test:
- remove useless rm
- $sparse and $fiemap were not defined in that final test,
    so cd into mnt/ and just use the file names instead.
- I prefer $(...) to `...`, and it's portable in this context

diff --git a/tests/cp/sparse-fiemap b/tests/cp/sparse-fiemap
index 32ca5fc..cec5224 100755
--- a/tests/cp/sparse-fiemap
+++ b/tests/cp/sparse-fiemap
@@ -40,18 +40,18 @@ test -s mnt/f                                  || skip=1
 test $skip = 1 &&
   skip_test_ "insufficient mount/ext4 support"

-rm -f mnt/f
-
 # Create a 1TiB sparse file
 dd if=/dev/zero of=mnt/sparse bs=1k count=1 seek=1G || framework_failure

+cd mnt || fail=1
+
 # It takes many minutes to copy this sparse file using the old method.
 # By contrast, it takes far less than 1 second using FIEMAP-copy.
-timeout 10 cp --sparse=always mnt/sparse mnt/sparse_fiemap || fail=1
+timeout 10 cp --sparse=always sparse fiemap || fail=1

 # Ensure that the sparse file copied through fiemap has the same size
 # in bytes as the original.
-test `stat --printf %s $sparse` = `stat --printf %s $fiemap` || fail=1
+test $(stat --printf %s sparse) = $(stat --printf %s fiemap) || fail=1

 # =================================================
 # Ensure that we exercise the FIEMAP-copying code enough
--
1.7.1.262.g5ef3d




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.