shared_cache: expose prior existence when inserting an element

The LRU now handles you attempting to insert multiple values for the
same key, by telling you that you've done so and returning the
existing value before it manages to muck up existing data.
The param 'existed' is not mandatory, default value is NULL.

Signed-off-by: Greg Farnum <greg@inktank.com>

Signed-off-by: Somnath Roy <somnath.roy@sandisk.com>
FDCache: implement a basic sharding of the FDCache

This is just a basic sharding. A more sophisticated implementation would
rely on something other than luck for keeping the distribution equitable.

Signed-off-by: Greg Farnum <greg@inktank.com>

Signed-off-by: Somnath Roy <somnath.roy@sandisk.com>
FileStore: remove the fdcache_lock

With the changes to the shared_cache, we no longer need the fdcache_lock
to prevent us from inserting a second fd for the same hobject into the cache.

Signed-off-by: Greg Farnum <greg@inktank.com>

Merged conflict fixed.

Signed-off-by: Somnath Roy <somnath.roy@sandisk.com>

Conflicts:
	src/os/FileStore.cc
shared_cache: pass key (K) by const ref in interface methods

Signed-off-by: Somnath Roy <somnath.roy@sandisk.com>
FileStore: FDCache lookup is rearranged

In lfn_open() there is no point of building the Index if the
cache lookup is successful. So, it is moved up in the function.

Signed-off-by: Somnath Roy <somnath.roy@sandisk.com>
FileStore: Index caching is introduced for performance improvement

IndexManager now has a Index caching. Index will only be created if not
found in the cache. Earlier, each op is creating an Index object and other
ops requesting the same index needed to wait till previous op is done.
Also, after finishing lookup, this Index object was destroyed.
Now, a Index cache is been implemented to persists these Indexes since
there is a major performance hit because each op is creating and destroying
these. A RWlock is been introduced in the CollectionIndex class and that is
responsible for sync between lookup and create.
Also, since these Index objects are persistent there is no need to use
smart pointers. So, Index is a wrapper class of CollecIndex* now.
It is the responsibility of the users of Index now to lock explicitely
before using them. Index object is sufficient now for locking and no need
to hold IndexPath for locking. The function interfaces of lfn_open,lfn_find
are changed accordingly.

Signed-off-by: Somnath Roy <somnath.roy@sandisk.com>
FileStore: FDCache hit is not creating Index objects

If caller is requesting to populate Index objects, it is not honoring
that in case of FDCache hit. The logic is changed to populate it
if there is a cache hit and the param Index object is not null.

Signed-off-by: Somnath Roy <somnath.roy@sandisk.com>