summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* tests: cp/fiemap: exercise previously-failing partsfiemap-copy-2Jim Meyering2011-01-292-0/+55
| | | | | * tests/cp/fiemap-2: New test. * tests/Makefile.am (TESTS): Add it.
* copy: make extent_copy use sparse_copy, rather than its own codeJim Meyering2011-01-291-60/+49
| | | | | | | * src/copy.c (extent_copy): Before this change, extent_copy would fail to create holes, thus breaking --sparse=auto and --sparse=always. I.e., copying a large enough file of all zeros, cp --sparse=always should introduce a hole, but with extent_copy, it would not.
* copy: remove obsolete commentJim Meyering2011-01-291-12/+9
| | | | | | * src/copy.c (sparse_copy): Remove now-obsolete comment about how we used to work around lack of ftruncate. Combine nested if conditions into one.
* copy: factor sparse-copying code into its own function, becauseJim Meyering2011-01-291-98/+114
| | | | | | | we're going to have to use it from within extent_copy, too. * src/copy.c (sparse_copy): New function, factored out of... (copy_reg): ...here. Remove now-unused locals.
* fiemap copy: avoid leak-on-errorJim Meyering2011-01-291-4/+6
| | | | | * src/copy.c (extent_copy): Don't leak an extent_scan buffer on failed lseek, read, or write.
* fiemap copy: avoid a performance hit due to very small bufferJim Meyering2011-01-291-3/+2
| | | | | | * src/copy.c (extent_copy): Don't let what should have been a temporary reduction of buf_size (to handle a short ext_len) become permanent and thus impact the performance of all further iterations.
* fiemap copy: simplify post-loop logic; improve commentsJim Meyering2011-01-291-30/+16
| | | | | * src/copy.c (extent_copy): Avoid duplication in post-loop extend-to-desired-length code.
* fiemap copy: rename some localsJim Meyering2011-01-291-11/+11
| | | | (extent_copy): Rename locals: s/*ext_logical/*ext_start/
* tests: ensure that FIEMAP-enabled cp copies a sparse file efficientlyJim Meyering2011-01-292-0/+33
| | | | | * tests/cp/fiemap-perf: New file. * tests/Makefile.am (TESTS): Add it.
* copy: don't allocate a separate buffer just for extent-based copyJim Meyering2011-01-221-19/+17
| | | | | | | * src/copy.c (copy_reg): Move use of extent_scan to just *after* we allocate the main copying buffer, so we can... (extent_scan): Take a new parameter, BUF, and use that rather than allocating a private buffer. Update caller.
* copy: tweak variable name; improve a commentJim Meyering2011-01-221-6/+6
| | | | | | | * src/copy.c (copy_reg): Rename a variable to make more sense from caller's perspective: s/require_normal_copy/normal_copy_required/. This is an output-only variable, and the original name could make it look like an input (or i&o) variable.
* copy: call extent_copy also when make_holes is false, ...Jim Meyering2011-01-221-16/+13
| | | | | | | | so that we benefit from using extents also when reading a sparse input file with --sparse=never. * src/copy.c (copy_reg): Remove erroneous test of "make_holes" so that we call extent_copy also when make_holes is false. Otherwise, what's the point of that parameter?
* * src/copy.c (copy_reg): Remove useless else-after-goto.Jim Meyering2011-01-221-6/+4
|
* copy.c: shorten a comment to fit in 80 columnsJim Meyering2011-01-221-1/+1
|
* extent-scan.c: don't include error.h or quote.hJim Meyering2011-01-221-2/+0
| | | | * src/extent-scan.c: Don't include error.h or quote.h. Neither is used.
* formattingJim Meyering2011-01-222-5/+8
|
* distribute extent-scan.h, tooJim Meyering2011-01-221-1/+1
| | | | * src/Makefile.am (copy_sources): Also distribute extent-scan.h.
* rename extent-scan functions to start with extent_scan_Jim Meyering2011-01-223-22/+22
|
* rename extent_scan memberJim Meyering2011-01-223-6/+6
| | | | | | * extent-scan.h [struct extent_scan]: Rename member: s/hit_last_extent/hit_final_extent/. "final" is clearer, since "last" can be interpreted as "preceding".
* fiemap copy: don't let write failure go unreported; adjust style, etc.Jim Meyering2011-01-221-9/+19
| | | | | | | | * src/copy.c (write_zeros): Add comments. (extent_copy): Move decls of "ok" and "i" down to scope where used. Adjust comments. Rename local: s/holes_len/hole_size/ Print a diagnostic upon failure to write zeros.
* bug#6131: [PATCH]: fiemap support for efficient sparse file copyjeff.liu2011-01-224-80/+296
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Jim Meyering wrote: > jeff.liu wrote: >> Sorry for the delay. >> >> This is the new patch to isolate the stuff regarding to extents reading to a new module. and teach >> cp(1) to make use of it. > > Jeff, > > I applied your patch to my rebased fiemap-copy branch. > My first step was to run the usual > > ./bootstrap && ./configure && make && make check > > "make check" failed on due to a double free in your new code: > (x86_64, Fedora 13, ext4 working directory) > > To get details, I made this temporary modification: Hi Jim, I am sorry for the fault, it fixed at the patch below. Would you please revie at your convenience? Changes: ======== 1. fix write_zeros() as Jim's comments, thanks for pointing this out. 2. remove char const *fname from struct extent_scan. 3. change the signature of open_extent_scan() from "void open_extent_scan(struct extent_scan **scan)" to "void open_extent_scan(struct extent_scan *scan)"; the reason is I'd like to reduce once memory allocation for the extent_scan variable, instead, using stack to save it. 4. remove close_extent_scan() from a function defined at extent-scan.c to extent-scan.h as a Macro definination, but it does nothing for now, since initial extent scan defined at stack. 5. add a macro "free_extents_info()" defined at extent-scan.h to release the memory allocated to extent info which should be called combine with get_extents_info(), it just one line, so IMHO, define it as macro should be ok. I have done the memory check via `valgrind`, no issue found. make test against cp/sparse-fiemap failed at the extent compare stage, but the file content is identical to each other by comparing those two files "j1/j2" manually. Is it make sense if we verify them through diff(1) since the testing file is in small size? or we have to merge the contig extents from the output of `filefrag', I admit I have not dig into the filefrag-extent-compare at the moment, I need to recall the perl language syntax. :-P. >From 50a3338db06442fa2d789fd65175172d140cc96e Mon Sep 17 00:00:00 2001 From: Jie Liu <jeff.liu@oracle.com> Date: Wed, 29 Sep 2010 15:35:43 +0800 Subject: [PATCH 1/1] cp: add a new module for scanning extents * src/extent-scan.c: Source code for scanning extents. Call open_extent_scan() to initialize extent scan. Call get_extents_info() to get a number of extents for each iteration. * src/extent-scan.h: Header file of extent-scan.c. Wrap free_extent_info() as macro define to release the space allocated extent_info per extent scan. Wrap close_extent_scan() as macro define but do nothing at the moment. * src/Makefile.am: Reference it and link it to copy_source. * src/copy.c: Make use of the new module, replace fiemap_copy() with extent_copy(). Signed-off-by: Jie Liu <jeff.liu@oracle.com>
* build: distribute new test script, filefrag-extent-compareJim Meyering2011-01-221-0/+1
| | | | * tests/Makefile.am (EXTRA_DIST): Add filefrag-extent-compare.
* build: distribute new file, fiemap.hJim Meyering2011-01-221-0/+1
| | | | * src/Makefile.am (noinst_HEADERS): Add fiemap.h.
* copy.c: add FIEMAP_FLAG_SYNC to fiemap ioctlJie Liu2011-01-221-0/+1
| | | | | * src/copy.c (fiemap_copy): Force kernel to sync the source file before mapping.
* tests: accommodate varying filefrag -v "flags" outputJim Meyering2011-01-221-1/+2
| | | | | * tests/cp/sparse-fiemap: Accommodate values other than "eof" in the "flags" column of filefrag -v output
* fiemap.h: include <stdint.h>, not <linux/types.h>Jim Meyering2011-01-221-1/+1
| | | | | * src/fiemap.h: Include stdint.h, not linux/types.h, now that this file uses only portable type names.
* copy.c: ensure proper alignment of fiemap bufferPaul Eggert2011-01-221-7/+8
| | | | | | * src/copy.c (fiemap_copy): Ensure that our fiemap buffer is large enough and well-aligned. Replace "0LL" with equivalent "0" as 3rd argument to lseek.
* copy.c: adjust comments, tweak semanticsJim Meyering2011-01-221-26/+36
| | | | | | | | | * src/copy.c (fiemap_copy): Rename from fiemap_copy_ok. Add/improve comments. Remove local, "fail". (fiemap_copy): Do not require caller to set "normal_copy_required" before calling fiemap_copy. Report ioctl failure if it's the 2nd or subsequent call.
* tests: improve fiemap test to work with 4 FS types; fall back on ext4Jim Meyering2011-01-222-11/+95
| | | | | * tests/cp/sparse-fiemap: Improve. * tests/filefrag-extent-compare: New file.
* tests: relax the root-tests cross-checkJim Meyering2011-01-221-1/+1
| | | | | * cfg.mk (sc_root_tests): Allow spaces before "require_root_", now that tests/cp/sparse-fiemap has a conditional use.
* tests: test fiemap-enabled cp more thoroughlyJim Meyering2011-01-221-29/+32
| | | | * tests/cp/sparse-fiemap: More tests.
* tests: require root only if current partition is neither btrfs nor xfsJim Meyering2011-01-221-22/+27
| | | | | | * tests/cp/sparse-fiemap: Don't require root access if current partition is btrfs or xfs. Use init.sh, not test-lib.sh.
* tests: exercise more of the new FIEMAP copying codeJim Meyering2011-01-221-0/+38
| | | | | * tests/cp/sparse-fiemap: Ensure that a file with many extents (more than fit in copy.c's internal 4KiB buffer) is copied properly.
* tests: sparse-fiemap: factor out some set-upJim Meyering2011-01-221-4/+4
| | | | * tests/cp/sparse-fiemap: Cd into test directory sooner.
* tests: add a new test for FIEMAP-copyJie Liu2011-01-222-0/+57
| | | | | | * 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.
* cp: Add FIEMAP support for efficient sparse file copyJie Liu2011-01-222-0/+261
| | | | | | | | * src/fiemap.h: Add fiemap.h for fiemap ioctl(2) support. Copied from linux's include/linux/fiemap.h, with minor formatting changes. * src/copy.c (copy_reg): Now, when `cp' invoked with --sparse=[WHEN] option, we will try to do FIEMAP-copy if the underlaying file system support it, fall back to a normal copy if it fails.
* doc: fix wording in warning about potential conflict with built-inJim Meyering2011-01-211-1/+1
| | | | * doc/coreutils.texi (mayConflictWithShellBuiltIn): Fix wording.
* manual: document floating point betterPaul Eggert2011-01-211-13/+39
| | | | | | | * doc/coreutils.texi (Floating point): New section. (od invocation, tail invocation, sort invocation, printf invocation): (sleep invocation, seq invocation): Refer and defer to it. See <http://lists.gnu.org/archive/html/bug-coreutils/2011-01/msg00031.html>.
* build: update gnulib submodule to latestJim Meyering2011-01-201-0/+0
| | | | | | | The previous gnulib submodule reference was *still* to a non-public commit. My submodule had a stray commit, so the reference was always to a local merge commit. Reported by Rob Vermaas.
* build: update gnulib submodule to latestJim Meyering2011-01-201-0/+0
| | | | | The previous gnulib submodule reference was to a non-public commit. Reported by Rob Vermaas.
* maint: use slightly more efficient process in README-releaseJim Meyering2011-01-191-7/+9
| | | | | * README-release: Run cheaper root-only tests first. Use half of processing units (not just 1) for the expensive tests.
* tests: avoid FP failure in new du testJim Meyering2011-01-181-2/+9
| | | | | | * tests/du/move-dir-while-traversing: Create a larger tree to avoid a false-positive failure due to du terminating before the rename is triggered.
* build: update gnulib submodule to latestJim Meyering2011-01-181-0/+0
|
* doc: update NEWSJim Meyering2011-01-181-0/+1
| | | | | * NEWS: Note when the uniq bug was introduced. It was mine, commit 1d9b3de9, "uniq: remove redundant test".
* doc: show how to shred more efficientlyJim Meyering2011-01-171-0/+14
| | | | | | * doc/coreutils.texi (shred invocation): Give an example showing how to invoke shred in single-pass mode, and warn that -n0 --zero may be inadequate.
* uniq: replace a wasteful loop with simple calculationJim Meyering2011-01-171-2/+1
| | | | | | * src/uniq.c (find_field): Remove the byte-skipping loop altogether. Instead, perform the simple calculation. This results in a 10% performance improvement for large byte offsets.
* tests: add a test for today's uniq bugJim Meyering2011-01-172-0/+26
| | | | | * tests/misc/uniq-perf: New file. * tests/Makefile.am (TESTS): Add it.
* uniq: don't continue field processing after end of lineSami Kerola2011-01-172-1/+3
| | | | | | | * NEWS (Bug fixes): Mention it. * src/uniq.c (find_field): Stop processing loop when end of line is reached. Before this fix, 'uniq -f 10000000000 /etc/passwd' would run for a very long time.
* doc: specify how tr, echo, printf treat octal numbersOndřej Vašík2011-01-151-6/+13
| | | | | | | * doc/coreutils.texi (tr's Character sets): Document how a 9-bit octal value is interpreted. tr does not ignore the ninth bit. (echo invocation, printf invocation): Document that any ninth bit in \OOO is ignored. (http://debbugs.gnu.org/7574)
* maint: refactor to use read-file from gnulibPádraig Brady2011-01-143-119/+12
| | | | | | | * bootstrap.conf: Add the read-file module * src/ptx.c: Replace the original code which would needlessly read SIZE_MAX bytes of files larger than this. * src/shuf.c: Replace the original code.