mksquashfs: queue fragment and empty file buffers directly to main thread

Queue these buffers directly to the main thread, rather than
queuing them to the deflate threads which pass them to the main thread.

For empty file buffers these are passed directly to the main thread,
and it is unnecessary overhead to pass them to the deflate threads.
For fragments these were passed to the deflate threads for sparse
checking, but move sparse checking for fragments to the main
thread.

Doing this frees up the deflate threads to concentrate on
compressing buffers.  It also means the reader thread to deflate
queue now accurately represents the number of uncompressed
buffers in flight to the deflate threads, without the value being
obscured by the presence of the other buffers.  The number of
uncompressed fragment buffers in flight from the reader thead
to the main thread can be seen from the uncompressed fragment queue.

Also add a function which centralises the logic which decides where
to send the buffers.

Signed-off-by: Phillip Lougher <phillip@squashfs.org.uk>
mksquashfs: move error reporting from read_from_disk(2) to the caller

this allows the error message to be more descriptive

Signed-off-by: Phillip Lougher <phillip@squashfs.org.uk>
mksquashfs: fix bug introduced changing fragment index in writer buffer

A recent commit changed the index used when storing compressed fragment
buffers in the writer cache to be negative.  This was to ensure
compressed fragments stored in the writer cache (indexed on the fragment
index) were distinct from compressed block buffers stored in the cache
(indexed on the start block in the output filesystem).

Unfortunately this broke compressed fragment buffer lookup in the
writer cache, which is done when looking up fragments in duplicate checking,
and the original uncompressed fragment buffer is no longer available
in the fragment cache.

Fragment->index is an unsigned int, and so when converted to a
negative index via FRAG_INDEX we get a large value rather than the
desired negative value.  Fix by casting to a long long.

Signed-off-by: Phillip Lougher <phillip@squashfs.org.uk>