zram: cleanup in zram_read_from_zspool()
Subsystems (2)
PATCH 1/1 zram: cleanup in zram_read_from_zspool()
We don't need a separate "if" branch to check whether size is equal to PAGE_SIZE. So remove the above "if" branch and move down 2 lines to cleanup code, no logic change.
--- drivers/block/zram/zram_drv.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/block/zram/zram_drv.c +3 -5
@@ -1561,11 +1561,6 @@ static int zram_read_from_zspool(struct zram *zram, struct page *page, size =zram_get_obj_size (zram, index); -if (size !=PAGE_SIZE ) { - prio =zram_get_priority (zram, index); - zstrm =zcomp_stream_get (zram->comps[prio]); - } - src =zs_map_object (zram->mem_pool, handle,ZS_MM_RO );if (size ==PAGE_SIZE ) { dst =kmap_local_page (page);
@@ -1573,6 +1568,9 @@ static int zram_read_from_zspool(struct zram *zram, struct page *page,kunmap_local (dst); ret =0 ; }else { + prio =zram_get_priority (zram, index); + zstrm =zcomp_stream_get (zram->comps[prio]); + dst =kmap_local_page (page); ret =zcomp_decompress (zram->comps[prio], zstrm, src, size, dst);
Signature · 1 line
2.45.0
Sergey Senozhatsky
maintainerQuoted 13 lines · Wenchao Hao
drivers/block/zram/zram_drv.c +0
-5@@ -1561,11 +1561,6 @@ static int zram_read_from_zspool(struct zram *zram, struct page *page, size =zram_get_obj_size (zram, index); -if (size !=PAGE_SIZE ) { - prio =zram_get_priority (zram, index); - zstrm =zcomp_stream_get (zram->comps[prio]); - } - src =zs_map_object (zram->mem_pool, handle,ZS_MM_RO );if (size ==PAGE_SIZE ) { dst =kmap_local_page (page);
drivers/block/zram/zram_drv.c static int zram_read_from_zspool(struct zram *zram, struct page *page, · line 1576
Quoted 9 lines
drivers/block/zram/zram_drv.c +3
-0@@ -1573,6 +1568,9 @@ static int zram_read_from_zspool(struct zram *zram, struct page *page,kunmap_local (dst); ret =0 ; }else { + prio =zram_get_priority (zram, index); + zstrm =zcomp_stream_get (zram->comps[prio]); + dst =kmap_local_page (page); ret =zcomp_decompress (zram->comps[prio], zstrm, src, size, dst);
I think you are looking at some old code base (or maybe vanilla kernel), that function does not look like this in the current mm tree (or linux-next).
Quoted 18 lines · Sergey Senozhatsky
Quoted 17 lines · Wenchao Hao
drivers/block/zram/zram_drv.c +1
-5@@ -1561,11 +1561,6 @@ static int zram_read_from_zspool(struct zram *zram, struct page *page, size =zram_get_obj_size (zram, index); -if (size !=PAGE_SIZE ) { - prio =zram_get_priority (zram, index); - zstrm =zcomp_stream_get (zram->comps[prio]); - } - src =zs_map_object (zram->mem_pool, handle,ZS_MM_RO );if (size ==PAGE_SIZE ) { dst =kmap_local_page (page);@@ -1573,6 +1568,9 @@ static int zram_read_from_zspool(struct zram *zram, struct page *page,kunmap_local (dst); ret =0 ; }else { + prio =zram_get_priority (zram, index);
Quoted 8 lines
drivers/block/zram/zram_drv.c static int zram_read_from_zspool(struct zram *zram, struct page *page, · line 1576
Quoted 5 lines
drivers/block/zram/zram_drv.c +2
-0+ zstrm =zcomp_stream_get (zram->comps[prio]); + dst =kmap_local_page (page); ret =zcomp_decompress (zram->comps[prio], zstrm, src, size, dst);I think you are looking at some old code base (or maybe vanilla kernel), that function does not look like this in the current mm tree (or linux-next).
Yes, it's from https://github.com/torvalds/linux. Sorry I did not examine the latest code, please ignore this thread.
Thanks.