tests/functional/058: refine the test to catch more bug

This found bug will be addressed by later patch

Signed-off-by: Liu Yuan <namei.unix@gmail.com>
cache: add oid_to_entry helper

This is a prepare patch

Signed-off-by: Liu Yuan <namei.unix@gmail.com>
sheep: remove cache object for discard operation

Signed-off-by: Liu Yuan <namei.unix@gmail.com>
sheep: don't trim before calculating sha1

Trim the object before getting sha1 don't give us much benefit because
1. Most of objects can't be trimmed
2. Require farm to trim the object again
   - need malloc() tmp space for the trim

This is all about sha1ing more bytes vs triming the object, which is faster.
Both will take cpu cycles and no big win one over another.

Without triming the object, farm gets life easier.

Signed-off-by: Liu Yuan <namei.unix@gmail.com>
farm: clean up trunk.c

Signed-off-by: Liu Yuan <namei.unix@gmail.com>
farm: slice.c proper

Slice is a fixed chunk of one object to be stored in farm. We slice
the object into smaller chunks to get better deduplication.

Signed-off-by: Liu Yuan <namei.unix@gmail.com>
farm: use slice_{read, write} to read/write object

For a test with 200M cluster with 2 copies (so roughly 100M data to backup),
I got the following resualt:

                   size  time
w/ slice (64K)  :  51M   2.037s
w/ slice (128K) :  53M   1.223s
w/ slice (256K) :  57M   1.216s
w/ slice (512K) :  61M   1.205s
w/o slice (4M)  :  97M   1.174s

This is why I choose 128K as slice size.

Signed-off-by: Liu Yuan <namei.unix@gmail.com>
collie: move show_progress to common.c

- support non-vdi user

Signed-off-by: Liu Yuan <namei.unix@gmail.com>
farm: show progress bar for load/save operations

Signed-off-by: Liu Yuan <namei.unix@gmail.com>
cache: add more debug info to push_cache_object()

Signed-off-by: Liu Yuan <namei.unix@gmail.com>