mds: fix MDCache::truncate_inode_finish() journal

we should add projected parent directory's context to the journal

Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
mds: re-integrate stray when link count >= 1

no reason not to rename inode out of the stray directory if the
inode's link count > 1

Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
mds: touch dentry bottom recursively

Deleted directory inode's dirfrags may contain some null dentries.
When touch_dentry_bottom() is called, also move these null dentries
to the tail of LRU.

Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
mds: allow delay in evaluating stray

Add a new parameter 'delay' to MDCache::eval_stray(). If 'delay'
is true, MDCache::eval_stray() adds the stray dentry to a delayed
list. Delayed stray dentries are processed in MDCache::trim().

This change is required by later commit that evaluates stray when
reference to cache object is released.

Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
mds: evaluate stray when releasing inode/dentry's reference

Current method to purge stray inode is call MDCache::maybe_eval_stray()
after releasing a reference to the stray inode/dentry. It's difficult
to make this method work correct, because there are so many places that
can release reference.

This patch solves the issue by calling MDCache::maybe_eval_stray()
in MDSCacheObject::put(). This avoids adding code that calls
MDCache::maybe_eval_stray() to each place that releases reference.
A new state 'STATE_STRAY' and a new virtual function 'stray_put' are
added to MDSCacheObject. The new state indicates if a given object is
stray inode/dentry. MDSCacheObject::put() calls the virtual function
when releasing stray inode/dentry's reference. CInode and CDentry
re-implement the virtual function, call MDCache::maybe_eval_stray()
if puring stray is possible.

Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
mds: remove unnecessary MDCache::maybe_eval_stray() calls

Now we call MDCache::maybe_eval_stray() in MDSCacheObject::put().
So there is no need to call MDCache::maybe_eval_stray() after
releasing inode/dentry's refernece.

Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
mds: don't trim stray inode from the cache.

don't trim stray inode from the cache, purge it instead. This ensures
the stary directories at minimum size.

Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
mds: avoid fetching backtrace when purging stray

we save old data pools in both inode_backtrace_t::old_pools and
inode_t::old_pools. We have the inode in the cache when purging
stray, so no need to fetch backtrace to find old data pools.

Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
mds: remove dirfrags when purging stray directory

Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>