mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-05 18:41:58 +09:00
erofs: get rid of the remaining kmap_atomic()
[ Upstream commit 123ec246eb ]
It's unnecessary to use kmap_atomic() compared with kmap_local_page().
In addition, kmap_atomic() is deprecated now.
Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
Reviewed-by: Yue Hu <huyue2@coolpad.com>
Reviewed-by: Chao Yu <chao@kernel.org>
Link: https://lore.kernel.org/r/20230627161240.331-1-hsiangkao@linux.alibaba.com
Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
Stable-dep-of: 3c12466b6b7b ("erofs: fix lz4 inplace decompression")
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
471ab2e8b7
commit
2197389e1a
@@ -148,7 +148,7 @@ static void *z_erofs_lz4_handle_overlap(struct z_erofs_lz4_decompress_ctx *ctx,
|
|||||||
*maptype = 0;
|
*maptype = 0;
|
||||||
return inpage;
|
return inpage;
|
||||||
}
|
}
|
||||||
kunmap_atomic(inpage);
|
kunmap_local(inpage);
|
||||||
might_sleep();
|
might_sleep();
|
||||||
src = erofs_vm_map_ram(rq->in, ctx->inpages);
|
src = erofs_vm_map_ram(rq->in, ctx->inpages);
|
||||||
if (!src)
|
if (!src)
|
||||||
@@ -162,7 +162,7 @@ docopy:
|
|||||||
src = erofs_get_pcpubuf(ctx->inpages);
|
src = erofs_get_pcpubuf(ctx->inpages);
|
||||||
if (!src) {
|
if (!src) {
|
||||||
DBG_BUGON(1);
|
DBG_BUGON(1);
|
||||||
kunmap_atomic(inpage);
|
kunmap_local(inpage);
|
||||||
return ERR_PTR(-EFAULT);
|
return ERR_PTR(-EFAULT);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -173,9 +173,9 @@ docopy:
|
|||||||
min_t(unsigned int, total, PAGE_SIZE - *inputmargin);
|
min_t(unsigned int, total, PAGE_SIZE - *inputmargin);
|
||||||
|
|
||||||
if (!inpage)
|
if (!inpage)
|
||||||
inpage = kmap_atomic(*in);
|
inpage = kmap_local_page(*in);
|
||||||
memcpy(tmp, inpage + *inputmargin, page_copycnt);
|
memcpy(tmp, inpage + *inputmargin, page_copycnt);
|
||||||
kunmap_atomic(inpage);
|
kunmap_local(inpage);
|
||||||
inpage = NULL;
|
inpage = NULL;
|
||||||
tmp += page_copycnt;
|
tmp += page_copycnt;
|
||||||
total -= page_copycnt;
|
total -= page_copycnt;
|
||||||
@@ -214,7 +214,7 @@ static int z_erofs_lz4_decompress_mem(struct z_erofs_lz4_decompress_ctx *ctx,
|
|||||||
int ret, maptype;
|
int ret, maptype;
|
||||||
|
|
||||||
DBG_BUGON(*rq->in == NULL);
|
DBG_BUGON(*rq->in == NULL);
|
||||||
headpage = kmap_atomic(*rq->in);
|
headpage = kmap_local_page(*rq->in);
|
||||||
|
|
||||||
/* LZ4 decompression inplace is only safe if zero_padding is enabled */
|
/* LZ4 decompression inplace is only safe if zero_padding is enabled */
|
||||||
if (erofs_sb_has_zero_padding(EROFS_SB(rq->sb))) {
|
if (erofs_sb_has_zero_padding(EROFS_SB(rq->sb))) {
|
||||||
@@ -223,7 +223,7 @@ static int z_erofs_lz4_decompress_mem(struct z_erofs_lz4_decompress_ctx *ctx,
|
|||||||
min_t(unsigned int, rq->inputsize,
|
min_t(unsigned int, rq->inputsize,
|
||||||
EROFS_BLKSIZ - rq->pageofs_in));
|
EROFS_BLKSIZ - rq->pageofs_in));
|
||||||
if (ret) {
|
if (ret) {
|
||||||
kunmap_atomic(headpage);
|
kunmap_local(headpage);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
may_inplace = !((rq->pageofs_in + rq->inputsize) &
|
may_inplace = !((rq->pageofs_in + rq->inputsize) &
|
||||||
@@ -261,7 +261,7 @@ static int z_erofs_lz4_decompress_mem(struct z_erofs_lz4_decompress_ctx *ctx,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (maptype == 0) {
|
if (maptype == 0) {
|
||||||
kunmap_atomic(headpage);
|
kunmap_local(headpage);
|
||||||
} else if (maptype == 1) {
|
} else if (maptype == 1) {
|
||||||
vm_unmap_ram(src, ctx->inpages);
|
vm_unmap_ram(src, ctx->inpages);
|
||||||
} else if (maptype == 2) {
|
} else if (maptype == 2) {
|
||||||
@@ -289,7 +289,7 @@ static int z_erofs_lz4_decompress(struct z_erofs_decompress_req *rq,
|
|||||||
/* one optimized fast path only for non bigpcluster cases yet */
|
/* one optimized fast path only for non bigpcluster cases yet */
|
||||||
if (ctx.inpages == 1 && ctx.outpages == 1 && !rq->inplace_io) {
|
if (ctx.inpages == 1 && ctx.outpages == 1 && !rq->inplace_io) {
|
||||||
DBG_BUGON(!*rq->out);
|
DBG_BUGON(!*rq->out);
|
||||||
dst = kmap_atomic(*rq->out);
|
dst = kmap_local_page(*rq->out);
|
||||||
dst_maptype = 0;
|
dst_maptype = 0;
|
||||||
goto dstmap_out;
|
goto dstmap_out;
|
||||||
}
|
}
|
||||||
@@ -311,7 +311,7 @@ static int z_erofs_lz4_decompress(struct z_erofs_decompress_req *rq,
|
|||||||
dstmap_out:
|
dstmap_out:
|
||||||
ret = z_erofs_lz4_decompress_mem(&ctx, dst + rq->pageofs_out);
|
ret = z_erofs_lz4_decompress_mem(&ctx, dst + rq->pageofs_out);
|
||||||
if (!dst_maptype)
|
if (!dst_maptype)
|
||||||
kunmap_atomic(dst);
|
kunmap_local(dst);
|
||||||
else if (dst_maptype == 2)
|
else if (dst_maptype == 2)
|
||||||
vm_unmap_ram(dst, ctx.outpages);
|
vm_unmap_ram(dst, ctx.outpages);
|
||||||
return ret;
|
return ret;
|
||||||
|
|||||||
Reference in New Issue
Block a user