sheep: let gateway node exit in a case of gateway only cluster

When a cluster has gateway nodes only, it means the gateway nodes
doesn't contribute to I/O of VMs. So this patch simply let them exit
and avoid the below recovery issue.

Related issue:
https://bugs.launchpad.net/sheepdog-project/+bug/1327037

Cc: duron800@qq.com
Tested-by: Yang Zhang <3100100878@zju.edu.cn>
Tested-by: Xiaolong Xu <nxtxiaolong@gmail.com>
Signed-off-by: Hitoshi Mitake <mitake.hitoshi@lab.ntt.co.jp>
sheep: handle a case of small buffer in cinfo collection

Current cinfo_collection_work() and SD_OP_VDI_STATE_SNAPSHOT_CTL
doesn't handle a case of small buffer. This patch solves it.

Cc: Saeki Masaki <saeki.masaki@po.ntts.co.jp>
Cc: Yuka Kawasaki <kawasaki.yuka@po.ntts.co.jp>
Signed-off-by: Hitoshi Mitake <mitake.hitoshi@lab.ntt.co.jp>
sheep: let vdi state have parent VID

This is a preparation patch.

Cc: Saeki Masaki <saeki.masaki@po.ntts.co.jp>
Cc: Yuka Kawasaki <kawasaki.yuka@po.ntts.co.jp>
Signed-off-by: Hitoshi Mitake <mitake.hitoshi@lab.ntt.co.jp>
sheep: construct data structures for representing family tree

This patch adds new data structres which represent VDI family tree. It
is different from the existing vdi_state_entry tree. The purpose of
these new data structres is efficient tracking of family relation
between VDIs. It is required for garbage collecting needless VIDs.

Cc: Saeki Masaki <saeki.masaki@po.ntts.co.jp>
Cc: Yuka Kawasaki <kawasaki.yuka@po.ntts.co.jp>
Signed-off-by: Hitoshi Mitake <mitake.hitoshi@lab.ntt.co.jp>
libsheepdog: provide atomic_clear_bit

The new function is required because the bitmaps (vdi_inuse and
vdi_deleted) can be cleared now.

Cc: Saeki Masaki <saeki.masaki@po.ntts.co.jp>
Cc: Yuka Kawasaki <kawasaki.yuka@po.ntts.co.jp>
Signed-off-by: Hitoshi Mitake <mitake.hitoshi@lab.ntt.co.jp>
sheep: garbage collect needless VIDs

Current sheepdog never recycles VIDs. But it will cause problems
e.g. VID space exhaustion, too much garbage inode objects.

Keeping deleted inode objects is required because living inodes
(snapshots or clones) can point objects of the deleted inodes. So if
every member of VDI family is deleted, it is safe to remove deleted
inode objects.

Cc: Saeki Masaki <saeki.masaki@po.ntts.co.jp>
Cc: Yuka Kawasaki <kawasaki.yuka@po.ntts.co.jp>
Signed-off-by: Hitoshi Mitake <mitake.hitoshi@lab.ntt.co.jp>