libf2fs: limit the total size up to 16T

F2FS can support 16T bytes at most. Limit the config.total_sectors
so that most parameters calculated according to it in sb/cp can be
limited correctly too.

Signed-off-by: Junling Zheng <zhengjunling@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
This commit is contained in:
Junling Zheng 2016-02-23 21:43:41 +08:00 committed by Jaegeuk Kim
parent c00fe85bc7
commit ea34c1ce14

View File

@ -640,6 +640,11 @@ int f2fs_get_device_info(struct f2fs_configuration *c)
c->total_sectors = wanted_total_sectors;
}
if (c->total_sectors * c->sector_size >
(u_int64_t)F2FS_MAX_SEGMENT * 2 * 1024 * 1024) {
MSG(0, "\tError: F2FS can support 16TB at most!!!\n");
return -1;
}
MSG(0, "Info: sector size = %u\n", c->sector_size);
MSG(0, "Info: total sectors = %"PRIu64" (%"PRIu64" MB)\n",
c->total_sectors, (c->total_sectors *