All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] f2fs-tools: add the max chunk size limit in sparse image
@ 2018-10-15 13:24 Gao Ming
  2018-10-29 10:30 ` Chao Yu
  2018-10-30 10:21 ` Junling Zheng
  0 siblings, 2 replies; 3+ messages in thread
From: Gao Ming @ 2018-10-15 13:24 UTC (permalink / raw)
  To: linux-f2fs-devel, yuchao0, jaegeuk
  Cc: harry.shen, weidu.du, wvitao.wang, wangfei66

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

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] f2fs-tools: add the max chunk size limit in sparse image
  2018-10-15 13:24 [PATCH] f2fs-tools: add the max chunk size limit in sparse image Gao Ming
@ 2018-10-29 10:30 ` Chao Yu
  2018-10-30 10:21 ` Junling Zheng
  1 sibling, 0 replies; 3+ messages in thread
From: Chao Yu @ 2018-10-29 10:30 UTC (permalink / raw)
  To: Gao Ming, linux-f2fs-devel, jaegeuk
  Cc: harry.shen, weidu.du, wvitao.wang, wangfei66

On 2018/10/15 21:24, Gao Ming wrote:
> 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>

Reviewed-by: Chao Yu <yuchao0@huawei.com>

Thanks,

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] f2fs-tools: add the max chunk size limit in sparse image
  2018-10-15 13:24 [PATCH] f2fs-tools: add the max chunk size limit in sparse image Gao Ming
  2018-10-29 10:30 ` Chao Yu
@ 2018-10-30 10:21 ` Junling Zheng
  1 sibling, 0 replies; 3+ messages in thread
From: Junling Zheng @ 2018-10-30 10:21 UTC (permalink / raw)
  To: Gao Ming, linux-f2fs-devel, yuchao0, jaegeuk
  Cc: wangfei66, weidu.du, wvitao.wang, harry.shen

Hi, Jaegeuk, Chao, Ming

On 2018/10/15 21:24, Gao Ming wrote:
> 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)

Should we introduce an option for fsck.f2fs to get the MAX_CHUNK_SIZE ?

Thanks

>  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);
>  		}
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-10-30 10:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-15 13:24 [PATCH] f2fs-tools: add the max chunk size limit in sparse image Gao Ming
2018-10-29 10:30 ` Chao Yu
2018-10-30 10:21 ` Junling Zheng

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.