[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: RFC: new cp option: --efficient-sparse=HOW

From: Eric Blake
Subject: Re: RFC: new cp option: --efficient-sparse=HOW
Date: Mon, 31 Jan 2011 16:10:24 -0700
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv: Gecko/20101209 Fedora/3.1.7-0.35.b3pre.fc14 Lightning/1.0b3pre Mnenhy/0.8.3 Thunderbird/3.1.7

On 01/31/2011 03:27 PM, Jim Meyering wrote:
> It's orthogonal.
> --sparse=always still does the hole-punching, independently
> of whether we're copying normally or via the efficient FIEMAP-based
> code.
> E.g., if you have a sparse file, where one non-sparse chunk
> contains all-zero blocks (currently 32KiB minimum), then --sparse=always
> will convert those blocks to holes, with or without
> --efficient-sparse=never.
> --efficient-sparse=... controls efficiency while reading
> --sparse=...           controls hole-punching (or preserving)

Still thinking about it.  Isn't there still a bit of a penalty between
reading a block without inspecting its contents, vs. reading a block and
checking if it is all zeros (whether or not there is an optimization of
skipping the read in the first place thanks to fiemap)?  That is,
shouldn't I be able to specify that I want the fastest copying possible,
even if it results in a less than optimal output size, by telling the
read side to not check for all zero blocks?  Or is that check much
smaller than the corresponding I/O savings of not writing the block but
just seeking ahead, at which point punching holes in the output is
inherently more efficient even if it takes longer on the input to tell
if holes were present?

Supposing that we stick with your proposal of just 3 levels for the two
options, then my matrix of the previous mail could be rewritten as
follows for the above 9 combinations:

--sparse=always --efficient-sparse=always
    if input is sparse, require fiemap; always scan for holes to punch
--sparse=always --efficient-sparse=auto
    always scan for holes to punch; use fiemap if available but not
required (smallest output)
--sparse=always --efficient-sparse=never
    always scan for holes to punch; avoid fiemap
--sparse=auto --efficient-sparse=always
    if input is sparse, require fiemap; output is equally sparse as
input because we skip scanning for additional holes (fastest), even if
additional holes could be made
--sparse=auto --efficient-sparse=auto
    if input is sparse, then scan for holes; if fiemap is available then
output will match input sparseness, otherwise output might be smaller as
a result
--sparse=auto --efficient-sparse=never
    if input is sparse, then scan for holes; avoid fiemap
--sparse=never --efficient-sparse=always
    output will not be sparse, but if input is sparse, then require
fiemap to make reading faster
--sparse=never --efficient-sparse=auto
    output will not be sparse, use fiemap if available
--sparse=never --efficient-sparse=never
    output will not be sparse and fiemap is avoided (slowest, but great
way to exercise I/O)

Eric Blake   address@hidden    +1-801-349-2682
Libvirt virtualization library

Attachment: signature.asc
Description: OpenPGP digital signature

reply via email to

[Prev in Thread] Current Thread [Next in Thread]