Commit 441dfcc8 authored by Chao Yu's avatar Chao Yu Committed by Greg Kroah-Hartman

staging: erofs: avoid opened loop codes

Use __GFP_NOFAIL to avoid opened loop codes in z_erofs_vle_unzip().
Signed-off-by: default avatarChao Yu <yuchao0@huawei.com>
Reviewed-by: default avatarGao Xiang <gaoxiang25@huawei.com>
Link: https://lore.kernel.org/r/20190716094422.110805-1-yuchao0@huawei.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 44a22dc3
...@@ -921,20 +921,20 @@ static int z_erofs_vle_unzip(struct super_block *sb, ...@@ -921,20 +921,20 @@ static int z_erofs_vle_unzip(struct super_block *sb,
mutex_trylock(&z_pagemap_global_lock)) mutex_trylock(&z_pagemap_global_lock))
pages = z_pagemap_global; pages = z_pagemap_global;
else { else {
repeat: gfp_t gfp_flags = GFP_KERNEL;
if (nr_pages > Z_EROFS_VLE_VMAP_GLOBAL_PAGES)
gfp_flags |= __GFP_NOFAIL;
pages = kvmalloc_array(nr_pages, sizeof(struct page *), pages = kvmalloc_array(nr_pages, sizeof(struct page *),
GFP_KERNEL); gfp_flags);
/* fallback to global pagemap for the lowmem scenario */ /* fallback to global pagemap for the lowmem scenario */
if (unlikely(!pages)) { if (unlikely(!pages)) {
if (nr_pages > Z_EROFS_VLE_VMAP_GLOBAL_PAGES)
goto repeat;
else {
mutex_lock(&z_pagemap_global_lock); mutex_lock(&z_pagemap_global_lock);
pages = z_pagemap_global; pages = z_pagemap_global;
} }
} }
}
for (i = 0; i < nr_pages; ++i) for (i = 0; i < nr_pages; ++i)
pages[i] = NULL; pages[i] = NULL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment