-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
staging: erofs: move stagingpage operations to compress.h
stagingpages are behaved as bounce pages for temporary use. Move to compress.h since the upcoming decompressor will allocate stagingpages as well. Reviewed-by: Chao Yu <yuchao0@huawei.com> Signed-off-by: Gao Xiang <gaoxiang25@huawei.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
- Loading branch information
Gao Xiang
authored and
Greg Kroah-Hartman
committed
Jun 26, 2019
1 parent
fa61a33
commit 2748123
Showing
3 changed files
with
46 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/* SPDX-License-Identifier: GPL-2.0 */ | ||
/* | ||
* linux/drivers/staging/erofs/compress.h | ||
* | ||
* Copyright (C) 2019 HUAWEI, Inc. | ||
* http://www.huawei.com/ | ||
* Created by Gao Xiang <gaoxiang25@huawei.com> | ||
*/ | ||
#ifndef __EROFS_FS_COMPRESS_H | ||
#define __EROFS_FS_COMPRESS_H | ||
|
||
/* | ||
* - 0x5A110C8D ('sallocated', Z_EROFS_MAPPING_STAGING) - | ||
* used to mark temporary allocated pages from other | ||
* file/cached pages and NULL mapping pages. | ||
*/ | ||
#define Z_EROFS_MAPPING_STAGING ((void *)0x5A110C8D) | ||
|
||
/* check if a page is marked as staging */ | ||
static inline bool z_erofs_page_is_staging(struct page *page) | ||
{ | ||
return page->mapping == Z_EROFS_MAPPING_STAGING; | ||
} | ||
|
||
static inline bool z_erofs_put_stagingpage(struct list_head *pagepool, | ||
struct page *page) | ||
{ | ||
if (!z_erofs_page_is_staging(page)) | ||
return false; | ||
|
||
/* staging pages should not be used by others at the same time */ | ||
if (page_ref_count(page) > 1) | ||
put_page(page); | ||
else | ||
list_add(&page->lru, pagepool); | ||
return true; | ||
} | ||
|
||
#endif | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters