f2fs: Reduce zoned block device memory usage
authorDamien Le Moal <damien.lemoal@wdc.com>
Sat, 16 Mar 2019 00:13:07 +0000 (09:13 +0900)
committerJaegeuk Kim <jaegeuk@kernel.org>
Fri, 5 Apr 2019 16:33:55 +0000 (09:33 -0700)
commit95175dafc4399ab5b9e937da205b2a6927b19227
tree2c09a8e8f4fd9cd970e8ed93a09dcabbf1e64e27
parent0916878da355650d7e77104a7ac0fa1784eca852
f2fs: Reduce zoned block device memory usage

For zoned block devices, an array of zone types for each device is
allocated and initialized in order to determine if a section is stored
on a sequential zone (zone reset needed) or a conventional zone (no
zone reset needed and regular discard applies). Considering this usage,
the zone types stored in memory can be replaced with a bitmap to
indicate an equivalent information, that is, if a zone is sequential or
not. This reduces the memory usage for each zoned device by roughly 8:
on a 14TB disk with zones of 256 MB, the zone type array consumes
13x4KB pages while the bitmap uses only 2x4KB pages.

This patch changes the f2fs_dev_info structure blkz_type field to the
bitmap blkz_seq. Access to this bitmap is done using the helper
function f2fs_blkz_is_seq(), which is a rewrite of the function
get_blkz_type().

Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
fs/f2fs/f2fs.h
fs/f2fs/segment.c
fs/f2fs/super.c