squash4: fix handling of fragments and sparse files
authorAndrei Borzenkov <arvidjaar@gmail.com>
Fri, 24 Feb 2017 16:10:43 +0000 (19:10 +0300)
committerAndrei Borzenkov <arvidjaar@gmail.com>
Fri, 24 Feb 2017 16:10:43 +0000 (19:10 +0300)
commit951306c5094d2bfb46d5baedfde84a2015c4a3fa
tree24952053028eea3babbf20904c8065b5f8efbbde
parent512bb31cbc80db22d6071b72a645e75f81c70291
squash4: fix handling of fragments and sparse files

1. Do not assume block list and fragment are mutually exclusive. Squash
can pack file tail as fragment (unless -no-fragments is specified); so
check read offset and read either from block list or from fragments as
appropriate.

2. Support sparse files with zero blocks.

3. Fix fragment read - frag.offset is absolute fragment position,
not offset relative to ino.chunk.

Reported and tested by Carlo Caione <carlo@endlessm.com>
grub-core/fs/squash4.c