glfs-cache: reuse one glfs instance to access files from a given volume
glfs-cache: reuse one glfs instance to access files from a given volume

Currently glfs_init and friends are called thrice, twice by glfs_check_config
and then by tcmu_glfs_open. Hence caching the glfs connections straight away
saves two extra sets of glfs_init and friends on target creation.

Additionally, since this object any way need to be kept in memory untill
tcmu_glfs_close was invoked, it gives a benefit of sharing the glfs object
with other targets which are created using the same volume and server.

Points to support caching:

1. Also, currently glfs_fini() leaks about 7-10 MB, it is difficult for
gluster to address the leaks at least in the next couple of releases (need to
be implemented per xlator cleanups). So it is better avoid as many glfs_init's
as possible atleast for now.

2. One glfs instance on an average could consume ~300MB.

By maintaining the array of glfs objects and sharing them accross the targets,
we could save a lot of memory, aswell optimize the calls over network
and of course leaks.

Signed-off-by: Prasanna Kumar Kalever <a78d8f98557446023f5b3ba9944d7be259a978a3@redhat.com>

superlibj/tcmu-runner,JefferyHu/tcmu-runner,open-iscsi/tcmu-runner,liuy/tcmu-runner,lxbsz/tcmu-runner,agrover/tcmu-runner,open-iscsi/tcmu-runner