Mksquashfs: change cache_rehash() to cache_hash()

Originally caches in Mksquashfs on calling cache_get() were always
hashed to the index supplied on calling cache_get().

For writer blocks obtained in the deflator() threads this
created a problem because at the time of getting the cache
block the ultimate index was not known (the index is the disk
location where the block is finally stored, which is not known
until the writer block is processed by the main thread).

The solution adopted then was to cache_get() the writer block
with a dummy index, and later when the real index was known
to rehash the writer block.

This was good and worked well.

However, since then a new cache_get_nohash() call has been
implemented.  This was introduced for reader buffers which
are not looked up and therefore never need to be hashed.

We can use this new call here by changing cache_rehash() to
cache_hash() - get an initial unhashed buffer via cache_get_nohash()
and later create a hash mapping via cache_hash().

The semantic changes from cache_rehash() to cache_hash() are because
we are non-longer rehashing (removing an existing hash and adding a
new hash) but adding a hash to a cache entry that has never been hashed.

Signed-off-by: Phillip Lougher <phillip@squashfs.org.uk>
3 files changed
tree: 48eb47549d7c2a0b4c289c3e9b9001422362a798
  1. kernel/
  2. kernel-2.4/
  3. squashfs-tools/
  4. README