[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Bug-tar] seek_hole proposal
From: |
Joerg Schilling |
Subject: |
Re: [Bug-tar] seek_hole proposal |
Date: |
Wed, 5 Mar 2014 12:14:17 +0100 |
User-agent: |
nail 11.22 3/20/05 |
Pavel Raiskup <address@hidden> wrote:
> Hello all,
>
> I am trying to prepare patch which would reuse lseek's
> SEEK_HOLE/SEEK_DATA, the [v1] is attached. Some info:
>
> Note that after discussion [1] I still think that existing ST_IS_SPARSE
> macro is better for file-sparseness detection than using SEEK_HOLE (not
> worth having additional syscalls open~>seek~>close).
Your code is not compatible to the SEEK_HOLE interface. A file is sparse in
case that pathconf()/fpathconf(f, _PC_MIN_HOLE_SIZE) return a positive number
and lseek(f, (off_t)0, SEEK_HOLE) returns a number < stat.st_size.
see "man pathconf":
11. If a filesystem supports the reporting of holes
(see lseek(2), pathconf() and fpathconf() return a
positive number that represents the minimum hole
size returned in bytes. The offsets of holes
returned will be aligned to this same value. A spe-
cial value of 1 is returned if the filesystem does
not specify the minimum hole size but still reports
holes.
In other cases, the file stil may be sparse, but the filesystem does not
support SEEK_HOLE. I e.g. doubt that Linux correctly implements SEEK_HOLE
for NFS.
Jörg
--
EMail:address@hidden (home) Jörg Schilling D-13353 Berlin
address@hidden (uni)
address@hidden (work) Blog: http://schily.blogspot.com/
URL: http://cdrecord.berlios.de/private/ ftp://ftp.berlios.de/pub/schily
- Re: [Bug-tar] seek_hole proposal,
Joerg Schilling <=