[PATCH 1/2] zhashfs, detect fill pattern and suppress blocks in output

James Cameron quozl at laptop.org
Mon Apr 25 22:37:48 EDT 2011


On Mon, Apr 25, 2011 at 08:44:13PM +0100, Daniel Drake wrote:
> On 21 April 2011 05:46, James Cameron <quozl at laptop.org> wrote:
> > Allows the unused filesystem blocks of the image to be left out of
> > the .zd file, resulting in a factor of two reduction in fs-update
> > times on a typical build on a 4GB microSD. ?Greater reduction occurs
> > on larger microSD or SD cards.
> >
> > Has no effect if a fill pattern file is not found.
> 
> A more correct option would be to use the FIEMAP ioctl to detect the
> gaps in the file and determine the unused blocks that way. Have you
> investigated this?

No, because that would fail to detect blocks that have been read and
then written unchanged.  While I don't know of any examples of that
being done, it is still a possibility, either now or in the future.

Using FIEMAP will place a kernel version dependency on zhashfs 
unnecessarily, since the task can be done with memcmp.

It would also be more complex code to process the FIEMAP extents; more
complex than memcmp.

It would also require the output directory to be on a filesystem that
supports sparse files.  (Attempting to create a sparse file using dd on
a FAT filesystem results in a non-sparse file of the specified size ...
a FIEMAP ioctl on this would show no holes).

-- 
James Cameron
http://quozl.linux.org.au/



More information about the Devel mailing list