vfs: introduce some 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 i/o freq refresh hooks

  Add i/o freq refresh hooks in real read/write code path

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

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
That is, the shrinker accelerates the aging process.

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

  Add a directory '<dev_name>' in /sys/kernel/debug/hot_track/
for each volume that contains four files which are 'inode_stat',
'extent_stat', 'inode_spot', and 'extent_spot'.

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>
proc: add two hot_track proc interfaces

  Add two proc interfaces hot-age-interval and hot-update-interval
under the dir /proc/sys/fs/ in order to turn HOT_AGE_INTERVAL and
HOT_UPDATE_INTERVAL 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

Reviewed-by:   David Sterba <dsterba@suse.cz>
Signed-off-by: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>
vfs: add documentation

  Add Documentation for VFS hot tracking feature

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

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

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

  Add one list_head field 'reloc_list' to accommodate
hot relocation support.

Signed-off-by: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>
btrfs: add one new mount option

  Add one new mount option '-o hot_move' for hot
relocation support

Signed-off-by: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>
btrfs: Introduce one new block group for SSD

  Introduce one new block group BTRFS_BLOCK_GROUP_DATA_SSD,
which is used to differentiate if the block space is reserved
and allocated from one HDD disk or SSD disk.

Signed-off-by: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>
btrfs: add one task for hot relocation

   Add the task logic for hot relocation.

Signed-off-by: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>
proc: add three hot_reloc proc interfaces

  Add three proc interfaces hot-reloc-interval, hot-reloc-threshold,
and hot-reloc-max-items under the dir /proc/sys/fs/ in order to
turn HOT_RELOC_INTERVAL, HOT_RELOC_THRESHOLD, and HOT_RELOC_MAX_ITEMS
into be tunable.

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

  When hot relocation is enabled, hot tracking will be
enabled automatically.
  Its usage looks like:
    mount -o hot_move
    mount -o nouser,hot_move
    mount -o nouser,hot_move,loop
    mount -o hot_move,nouser

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