Re: [PATCH 1/2] erofs: avoid memory allocation failure during rolling decompression

2021-03-04 Thread Gao Xiang
On Fri, Mar 05, 2021 at 02:22:18PM +0800, Huang Jianan via Linux-erofs wrote:
> It should be better to ensure memory allocation during rolling
> decompression to avoid io error.

Currently, err would be treated as io error. Therefore, it'd be
better to ensure memory allocation during rolling decompression
to avoid such io error.

In the long term, we might consider adding another !Uptodate case
for such case.

> 
> Signed-off-by: Huang Jianan 
> Signed-off-by: Guo Weichao 
> ---
>  fs/erofs/decompressor.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/erofs/decompressor.c b/fs/erofs/decompressor.c
> index 49347e681a53..fb0fa4e5b9ea 100644
> --- a/fs/erofs/decompressor.c
> +++ b/fs/erofs/decompressor.c
> @@ -86,7 +86,7 @@ static int z_erofs_lz4_prepare_destpages(struct 
> z_erofs_decompress_req *rq,
>   victim = availables[--top];
>   get_page(victim);
>   } else {
> - victim = erofs_allocpage(pagepool, GFP_KERNEL);
> + victim = erofs_allocpage(pagepool, GFP_KERNEL | 
> __GFP_NOFAIL);

80 char limitation.

Thanks,
Gao Xiang

>   if (!victim)
>   return -ENOMEM;
>   set_page_private(victim, Z_EROFS_SHORTLIVED_PAGE);
> -- 
> 2.25.1
> 



[PATCH 1/2] erofs: avoid memory allocation failure during rolling decompression

2021-03-04 Thread Huang Jianan
It should be better to ensure memory allocation during rolling
decompression to avoid io error.

Signed-off-by: Huang Jianan 
Signed-off-by: Guo Weichao 
---
 fs/erofs/decompressor.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/erofs/decompressor.c b/fs/erofs/decompressor.c
index 49347e681a53..fb0fa4e5b9ea 100644
--- a/fs/erofs/decompressor.c
+++ b/fs/erofs/decompressor.c
@@ -86,7 +86,7 @@ static int z_erofs_lz4_prepare_destpages(struct 
z_erofs_decompress_req *rq,
victim = availables[--top];
get_page(victim);
} else {
-   victim = erofs_allocpage(pagepool, GFP_KERNEL);
+   victim = erofs_allocpage(pagepool, GFP_KERNEL | 
__GFP_NOFAIL);
if (!victim)
return -ENOMEM;
set_page_private(victim, Z_EROFS_SHORTLIVED_PAGE);
-- 
2.25.1