sheepfs: modify configure file to work with sheepfs

Signed-off-by: Liu Yuan <tailai.ly@taobao.com>
Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
sheep: move strbuf and rmdir_t into lib

Those are needed by sheepfs.

Signed-off-by: Liu Yuan <tailai.ly@taobao.com>
Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
sheepfs: core infrastructure

Sheepfs is FUSE-based pseudo file system in userland to access both sheepdog's
internal state (for e.g, cluster info, vdi list) as well as sheepdog's high
reliable stroage.

This building block is supposed to be modular enough to allow us ease adding
more powerful tools.

Signed-off-by: Liu Yuan <tailai.ly@taobao.com>
Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
sheepfs: add 'cluster' entry

This export cluster state as collie cluster command.

You can read the those info by simply ordinary read/write. For e.g,

tailai.ly@taobao:~/sheepdog$ cat sheepfs_dir/cluster/info
Cluster status: running

Cluster created at Mon May 14 15:45:37 2012

Epoch Time           Version
2012-05-14 15:45:38      1 [127.0.0.1:7000, 127.0.0.1:7001, 127.0.0.1:7002]

Signed-off-by: Liu Yuan <tailai.ly@taobao.com>
Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
sheepfs: add 'vdi' entry

Support 'collie vdi list', mount & unmount (used by volume)

Signed-off-by: Liu Yuan <tailai.ly@taobao.com>
Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
sheepfs: implement shadow file mechanism

Sheepfs use this shadow file mechanism to mostly manage dentries. We
might also make use of those shadow file to cache non-volatile states.

Signed-off-by: Liu Yuan <tailai.ly@taobao.com>
Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
sheepfs: add 'volume' entry

This is where we can access sheepdog's storage from well received 'file'
abstraction. All the attatched volume will be seen as a file in volume
directory.

To attatch a volume:
echo test > sheepfs_dir/vdi/mount

Then you will see a file entry in sheepfs_dir/volume/test, which you can do
the tricks you are fond of. For, e.g, we can boot an sheepdog image as normally
as for an ordinary raw image:

$ qemu-system-x86_64 --enable-kvm -m 1024 -drive \
  file=sheepfs_dir/volume/test,cache=writeback.

This file abstraction integrates well with kernel's other component such as
pagecache.

Signed-off-by: Liu Yuan <tailai.ly@taobao.com>
Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
sheepfs: implement 'sync' operation for volumes

When we use page cache to cache vdi in sheepdog storage, we need sync operation
to flush dirty bits back into sheep storage. This is wired up to the 'writeback'
of the kernel's page cache.

Signed-off-by: Liu Yuan <tailai.ly@taobao.com>
Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
sheepfs: implement 'open' operation

This is useful to control whether we use page cache or not.

Signed-off-by: Liu Yuan <tailai.ly@taobao.com>
Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
sheepfs: teach volumes to unmount

This is how we can deattach the volumes from sheep cluster storage.

Usage:
echo vdi_name > sheepfs_dir/vdi/unmount

Signed-off-by: Liu Yuan <tailai.ly@taobao.com>
Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
sheepfs: add 'node' entry

Support vdi node list & info.

Signed-off-by: Liu Yuan <tailai.ly@taobao.com>
Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
sheepfs: add a socket pool to speedup connection

Socket pool is used for FUSE read threads, which use threads to simulate aysnc
read. All sockets point to the same gateway.

- add a read/write lock to be thead safe.
- add an option to dis/enable page cache for volumes.

Signed-off-by: Liu Yuan <tailai.ly@taobao.com>
Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
sheepfs: add options to pass the address and port of the sheep

Signed-off-by: Liu Yuan <tailai.ly@taobao.com>
Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
sheepfs: teach volume to read/write COW objects

Now we can opreate on the volume with cloned vdi, for e.g, we can boot up vdi
named of 'clone' by below command:

$ qemu-system-x86_64 --enable-kvm -m 1024 -drive \
  file=sheepfs_dir/volume/clone,cache=writeback

tailai.ly@taobao:~/sheepdog$ cat sheepfs_dir/vdi/list
  Name        Id    Size    Used  Shared    Creation time   VDI id  Tag
c clone        1   20 MB  0.0 MB   20 MB 2012-05-14 12:01   72a1e2
s test1        1   20 MB   20 MB  0.0 MB 2012-05-14 11:57   fd32fc  snap
  test1        2   20 MB  0.0 MB   20 MB 2012-05-14 11:58   fd32fd

- add an option to disable 'object cache' for volumes

Signed-off-by: Liu Yuan <tailai.ly@taobao.com>
Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
sheepfs: add config entry

config exports internal state of sheepfs and enable us even to change those
state on the fly.

For e.g, control over which sheep to connect:
echo 192.168.10.113:7000 > sheepfs_dir/config/sheep_info

Signed-off-by: Liu Yuan <tailai.ly@taobao.com>
Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>