dm-latency: move struct mapped_device from dm.c to dm.h

Because struct mapped_device will be referenced in dm-sysfs.c, move its
definition into dm.h which is included by dm-sysfs.c

Signed-off-by: Coly Li <bosong.ly@alibaba-inc.com>
Reviewed-by: Robin Dong <sanbai@alibaba-inc.com>
dm-latency: add I/O latency measurement in device mapper

This patch adds I/O latency measurement code in dm.c. The basic idea is,
1) add timestamp in struct dm_io as unsigned long start_time_usec
2) set timestamp when dm_io issued to underlaying block layer.
3) when all sub-I/O completed, calculate time difference against
start_time_usec as I/O latency.
4) account the latency to corresponding counters like,
   - latency_stats_us
   - latency_stats_ms
   - latency_stats_s

Signed-off-by: Coly Li <bosong.ly@alibaba-inc.com>
Reviewed-by: Robin Dong <sanbai@alibaba-inc.com>
dm-latency: add sysfs interface

This patch adds sysfs interface to display io latency statistic info.
3 files are used to export statistic info based on delay unit level,
- /sys/block/dm-X/dm/io_latency_us
- /sys/block/dm-X/dm/io_latency_ms
- /sys/block/dm-X/dm/io_latency_s

The statistic counter is increasing only, a user space application
should calculate "delta" value for a sampling interval.

Signed-off-by: Coly Li <bosong.ly@alibaba-inc.com>
Reviewed-by: Robin Dong <sanbai@alibaba-inc.com>
dm-latency: add reset function to dm-latency in sysfs interface

Now echo any thing into /sys/block/dm-X/dm/io_latency_reset may
reset all counters in /sys/block/dm-X/dm/io_latency_{s,ms, us} to 0.

This function might be helpful to application developers.

Signed-off-by: Coly Li <bosong.ly@alibaba-inc.com>
Reviewed-by: Robin Dong <sanbai@alibaba-inc.com>