On Mon, Sep 30, 2013 at 5:12 PM, Roland Mainz <[email protected]> wrote:
> On Mon, Sep 30, 2013 at 4:17 PM, Dan Shelton <[email protected]> wrote:
>> I'm just forwarding the old conversation as a reminder - AST pax still
>> does not support SEEK_HOLE or SEEK_DATA (nor does it SUN.holesdata pax
>> header), nor do AST cp and mv support files with holes.
>>
>> As consequence neither AST pax, cp or mv are competitive to any of
>> such implementations which support SEEK_HOLE and SEEK_DATA.
>>
>> For example moving a 200GB file with 99% holes with GNU mv (GNU
>> supports SEEK_HOLE/SEEK_DATA since 2010) across filesystem takes less
>> than a 4 seconds with GNU mv but takes a WHOPPING 18 minutes with AST
>> mv.
> [snip]
>
> Erm...
> ... AFAIK a copy-file-data algorithm would be just this:
> 1. Test whether $ getconf MIN_HOLE_SIZE <srcpath> # returns a value > 0
> 2. If [1] is true then check whether the file has at least one hole
> (via |SEEK_HOLE|)
> 3. If [2] is true switch to a special version of the data copying code
> which "simply" copies data via |write()| until it hits a hole and then
> uses |lseek()| to seek forward to the next position and then uses
> |write()| again.
>
> Glenn: Does that sound correct ?

Some notes for myself:
1. Test code:
-- snip --
bool
support_seek_hole (int fd)
{
    off_t pos;

    if (fpathconf(fd, _PC_MIN_HOLE_SIZE) < 0)
        return (false);

    /*
     * Test two error conditions:
     * 1. we have been compiled on an OS revision that
     * supports |SEEK_HOLE| but run on an OS revision
     * that does not support |SEEK_HOLE|, we get |EINVAL|.
     * 2. the underlying filesystem does not support
     * |SEEK_HOLE|, we get |ENOTSUP|.
     */
    pos = lseek (fd, 0LL, SEEK_HOLE);
    if (pos < 0LL)
    {
        if ((errno == EINVAL) || (errno == ENOTSUP))
            return (false);
    }

    /* Do the same for |SEEK_DATA| */
    pos = lseek (fd, 0LL, SEEK_DATA);
    if (pos < 0LL)
    {
        if ((errno == EINVAL) || (errno == ENOTSUP))
            return (false);
    }

    return (true);
}
-- snip --


2. |lseek(fd, pos, SEEK_DATA)|/|lseek(fd, pos, SEEK_HOLE)| return
|ENXIO| if no further hole/data block can be found from position |pos|
on...

----

Bye,
Roland

-- 
  __ .  . __
 (o.\ \/ /.o) [email protected]
  \__\/\/__/  MPEG specialist, C&&JAVA&&Sun&&Unix programmer
  /O /==\ O\  TEL +49 641 3992797
 (;O/ \/ \O;)
_______________________________________________
ast-users mailing list
[email protected]
http://lists.research.att.com/mailman/listinfo/ast-users

Reply via email to