From: Gao Ming <gaoming20@huawei.com>
To: linux-f2fs-devel@lists.sourceforge.net, yuchao0@huawei.com,
jaegeuk@kernel.org
Cc: harry.shen@huawei.com, weidu.du@huawei.com,
wvitao.wang@huawei.com, wangfei66@huawei.com
Subject: [PATCH] f2fs-tools: add the max chunk size limit in sparse image
Date: Mon, 15 Oct 2018 21:24:57 +0800 [thread overview]
Message-ID: <1539609897-88068-1-git-send-email-gaoming20@huawei.com> (raw)
Malloc Failure occurs in 32bit Windows, when using fastboot.exe flash the
f2fs sparse image filling with up to 2G chunk size.
Signed-off-by: Gao Ming <gaoming20@huawei.com>
---
lib/libf2fs_io.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/lib/libf2fs_io.c b/lib/libf2fs_io.c
index 76d283d..47917ab 100644
--- a/lib/libf2fs_io.c
+++ b/lib/libf2fs_io.c
@@ -311,6 +311,7 @@ int f2fs_init_sparse_file(void)
#endif
}
+#define MAX_CHUNK_SIZE (1 * 1024 * 1024 * 1024ULL)
int f2fs_finalize_device(void)
{
int i;
@@ -337,6 +338,12 @@ int f2fs_finalize_device(void)
chunk_start = -1;
} else if (blocks[j] && chunk_start == -1) {
chunk_start = j;
+ } else if (blocks[j] && (chunk_start != -1) &&
+ (j + 1 - chunk_start >=
+ (MAX_CHUNK_SIZE / F2FS_BLKSIZE))) {
+ ret = sparse_merge_blocks(chunk_start,
+ j + 1 - chunk_start);
+ chunk_start = -1;
}
ASSERT(!ret);
}
--
2.8.1
next reply other threads:[~2018-10-15 13:25 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-15 13:24 Gao Ming [this message]
2018-10-29 10:30 ` [PATCH] f2fs-tools: add the max chunk size limit in sparse image Chao Yu
2018-10-30 10:21 ` Junling Zheng
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1539609897-88068-1-git-send-email-gaoming20@huawei.com \
--to=gaoming20@huawei.com \
--cc=harry.shen@huawei.com \
--cc=jaegeuk@kernel.org \
--cc=linux-f2fs-devel@lists.sourceforge.net \
--cc=wangfei66@huawei.com \
--cc=weidu.du@huawei.com \
--cc=wvitao.wang@huawei.com \
--cc=yuchao0@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).