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 <zhengjunl...@huawei.com>
---
 lib/libf2fs.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/lib/libf2fs.c b/lib/libf2fs.c
index 5eb5c33..a8ad324 100644
--- a/lib/libf2fs.c
+++ b/lib/libf2fs.c
@@ -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 *
-- 
1.9.1


------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

Reply via email to