vfs: introduce some key data structures

  One root structure hot_info is defined, is hooked
up in super_block, and will be used to hold radix tree
root, hash list root and some other information, etc.
  Adds hot_inode_tree struct to keep track of
frequently accessed files, and be keyed by {inode, offset}.
Trees contain hot_inode_items representing those files
and ranges.
  Having these trees means that vfs can quickly determine the
temperature of some data by doing some calculations on the
hot_freq_data struct that hangs off of the tree item.
  Define two items hot_inode_item and hot_range_item,
one of them represents one tracked file
to keep track of its access frequency and the tree of
ranges in this file, while the latter represents
a file range of one inode.
  Each of the two structures contains a hot_freq_data
struct with its frequency of access metrics (number of
{reads, writes}, last {read,write} time, frequency of
{reads,writes}).
  Also, each hot_inode_item contains one hot_range_tree
struct which is keyed by {inode, offset, length}
and used to keep track of all the ranges in this file.

Signed-off-by: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>
vfs: add init and cleanup functions

  Add initialization function to create some
key data structures when hot tracking is enabled;
Clean up them when hot tracking is disabled

Signed-off-by: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>
vfs: add I/O frequency update function

  Add some util helpers to update access frequencies
for one file or its range.

Signed-off-by: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>
vfs: add two map info arrays

  Adds two map arrays which contains
a lot of list and is used to efficiently
look up the data temperature of a file or its
ranges.
  In each list of map arrays, the array node
will keep track of temperature info.

Signed-off-by: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>
vfs: add hooks to enable hot tracking

  Miscellaneous features that implement hot data tracking
and generally make the hot data functions a bit more friendly.

Signed-off-by: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>
vfs: add temp calculation function

Signed-off-by: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>
vfs: add map info update function

Signed-off-by: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>
vfs: add aging function

Signed-off-by: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>
vfs: add one work queue

  Add a per-superblock workqueue and a delayed_work
to run periodic work to update map info on each superblock.

Signed-off-by: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>
vfs: introduce hot func register framework

  Introduce one framwork to enable that specific FS
can register its own hot tracking functions.

Signed-off-by: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>
vfs: register one shrinker

  Register a shrinker to control the amount of
memory that is used in tracking hot regions - if we are throwing
inodes out of memory due to memory pressure, we most definitely are
going to need to reduce the amount of memory the tracking code is
using, even if it means losing useful information (i.e. the shrinker
accelerates the aging process).

Signed-off-by: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>
vfs: add one ioctl interface

  FS_IOC_GET_HEAT_INFO: return a struct containing the various
metrics collected in hot_freq_data structs, and also return a
calculated data temperature based on those metrics. Optionally, retrieve
the temperature from the hot data hash list instead of recalculating it.

Signed-off-by: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>
vfs: add debugfs support

  Add a /sys/kernel/debug/hot_track/<device_name>/ directory for each
volume that contains two files. The first, `inode_stats', contains the
heat information for inodes that have been brought into the hot data map
structures. The second, `range_stats', contains similar information for
subfile ranges.

Signed-off-by: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>
procfs: add two hot_track proc files

  Add two proc files hot-kick-time and hot-update-delay
under the dir /proc/sys/fs/ in order to turn
TIME_TO_KICK and HEAT_UPDATE_DELAY into be tunable.

Signed-off-by: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>
btrfs: add hot tracking support

  Introduce one new mount option '-o hot_track',
and add its parsing support.
  Its usage looks like:
   mount -o hot_track
   mount -o nouser,hot_track
   mount -o nouser,hot_track,loop
   mount -o hot_track,nouser

Signed-off-by: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>
xfs: add hot tracking support

  Connect up the VFS hot tracking support
so XFS filesystems can make use of it.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
ext4: add hot tracking support

  Define a new mount option to add VFS hot
tracking support in order to use it in ext4.

CC: Zhi Yong Wu <zwu.kernel@gmail.com>
Signed-off-by: Zheng Liu <wenqing.lz@taobao.com>
vfs: add documentation

  Add one doc for VFS hot tracking feature

Signed-off-by: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>