staging: erofs: tidy up zpvec.h

- use shorter function names:
  z_erofs_pagevec_enqueue and z_erofs_pagevec_dequeue;
- minor code cleanup.

In order to keep in line with erofs-outofstaging patchset.

Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Gao Xiang <gaoxiang25@huawei.com>
Link: https://lore.kernel.org/r/20190731155752.210602-16-gaoxiang25@huawei.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Gao Xiang 2019-07-31 23:57:45 +08:00 committed by Greg Kroah-Hartman
parent 46c2d14943
commit 046d64e118
2 changed files with 12 additions and 19 deletions

View File

@ -314,8 +314,8 @@ static int z_erofs_vle_work_add_page(
try_to_reuse_as_compressed_page(builder, page))
return 0;
ret = z_erofs_pagevec_ctor_enqueue(&builder->vector,
page, type, &occupied);
ret = z_erofs_pagevec_enqueue(&builder->vector,
page, type, &occupied);
builder->work->vcnt += (unsigned int)ret;
return ret ? 0 : -EAGAIN;
@ -938,7 +938,7 @@ static int z_erofs_vle_unzip(struct super_block *sb,
for (i = 0; i < work->vcnt; ++i) {
unsigned int pagenr;
page = z_erofs_pagevec_ctor_dequeue(&ctor, &page_type);
page = z_erofs_pagevec_dequeue(&ctor, &page_type);
/* all pages in pagevec ought to be valid */
DBG_BUGON(!page);

View File

@ -11,7 +11,7 @@
#include "tagptr.h"
/* page type in pagevec for unzip subsystem */
/* page type in pagevec for decompress subsystem */
enum z_erofs_page_type {
/* including Z_EROFS_VLE_PAGE_TAIL_EXCLUSIVE */
Z_EROFS_PAGE_TYPE_EXCLUSIVE,
@ -103,16 +103,14 @@ static inline void z_erofs_pagevec_ctor_init(struct z_erofs_pagevec_ctor *ctor,
z_erofs_pagevec_ctor_pagedown(ctor, false);
}
}
ctor->next = z_erofs_pagevec_ctor_next_page(ctor, i);
ctor->index = i;
}
static inline bool
z_erofs_pagevec_ctor_enqueue(struct z_erofs_pagevec_ctor *ctor,
struct page *page,
enum z_erofs_page_type type,
bool *occupied)
static inline bool z_erofs_pagevec_enqueue(struct z_erofs_pagevec_ctor *ctor,
struct page *page,
enum z_erofs_page_type type,
bool *occupied)
{
*occupied = false;
if (unlikely(!ctor->next && type))
@ -131,15 +129,13 @@ z_erofs_pagevec_ctor_enqueue(struct z_erofs_pagevec_ctor *ctor,
ctor->next = page;
*occupied = true;
}
ctor->pages[ctor->index++] =
tagptr_fold(erofs_vtptr_t, page, type);
ctor->pages[ctor->index++] = tagptr_fold(erofs_vtptr_t, page, type);
return true;
}
static inline struct page *
z_erofs_pagevec_ctor_dequeue(struct z_erofs_pagevec_ctor *ctor,
enum z_erofs_page_type *type)
z_erofs_pagevec_dequeue(struct z_erofs_pagevec_ctor *ctor,
enum z_erofs_page_type *type)
{
erofs_vtptr_t t;
@ -156,11 +152,8 @@ z_erofs_pagevec_ctor_dequeue(struct z_erofs_pagevec_ctor *ctor,
if (*type == (uintptr_t)ctor->next)
ctor->next = tagptr_unfold_ptr(t);
ctor->pages[ctor->index++] =
tagptr_fold(erofs_vtptr_t, NULL, 0);
ctor->pages[ctor->index++] = tagptr_fold(erofs_vtptr_t, NULL, 0);
return tagptr_unfold_ptr(t);
}
#endif