diff options
author | Junling Zheng <zhengjunling@huawei.com> | 2016-02-23 21:43:41 +0800 |
---|---|---|
committer | luca020400 <luca.stefani.ge1@gmail.com> | 2016-04-04 17:17:55 +0200 |
commit | 65ad52cb62ee1c797d0ffb613e6ccf04ec00e5a9 (patch) | |
tree | a7bba19f272a7628cab6f972701fcb96034b89b9 | |
parent | 10bd289690f62dec712848bbb1b118d226470051 (diff) | |
download | android_external_f2fs-tools-65ad52cb62ee1c797d0ffb613e6ccf04ec00e5a9.tar.gz android_external_f2fs-tools-65ad52cb62ee1c797d0ffb613e6ccf04ec00e5a9.tar.bz2 android_external_f2fs-tools-65ad52cb62ee1c797d0ffb613e6ccf04ec00e5a9.zip |
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>
-rw-r--r-- | lib/libf2fs.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/libf2fs.c b/lib/libf2fs.c index 0eb1477..bae8096 100644 --- a/lib/libf2fs.c +++ b/lib/libf2fs.c @@ -710,6 +710,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 * |