mds: track snap inodes through sorted map
Current mds track both head inodes and snap inodes through unsorted
map. The unsorted map makes finding snap inode that follows a given
snapid difficult. Currnt MDCache::pick_inode_snap() use snap set to
guess snap inode's last. The method isn't reliable because snap set
may change after creating the snap inode. For example:
MDS cows inode[2,head] with snap set[5,6], which results inode[2,6]
and inode[7,head].
Later mds wants to find snap inode that follows snapid 2. But the
snap set become [5], mds can't find snap inode [2,5].
Signed-off-by: "Yan, Zheng" <zyan@redhat.com>
(cherry picked from commit
7b9eae62c8c654ff82684451c222257d2c93be64)
Conflicts:
src/mds/MDCache.cc: when i cherry-picked
3ca602e, there were conflicts in same file. to fix conflicts, i need to introduce snap_inode_map because it's not in luminous. to intoroduce this, i need to cherry-pick
7b9eae62. After cherry-picking
7b9eae62, there were conflicts. i picked code from head because it's introduced by
3ca602e which is required to fix http://tracker.ceph.com/issues/21928.