staging: erofs: move stagingpage operations to compress.h
[linux/fpc-iii.git] / drivers / staging / erofs / compress.h
blob1dcfc3b3511804a26b0e1ee9d1540ba81148b54f
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3 * linux/drivers/staging/erofs/compress.h
5 * Copyright (C) 2019 HUAWEI, Inc.
6 * http://www.huawei.com/
7 * Created by Gao Xiang <gaoxiang25@huawei.com>
8 */
9 #ifndef __EROFS_FS_COMPRESS_H
10 #define __EROFS_FS_COMPRESS_H
13 * - 0x5A110C8D ('sallocated', Z_EROFS_MAPPING_STAGING) -
14 * used to mark temporary allocated pages from other
15 * file/cached pages and NULL mapping pages.
17 #define Z_EROFS_MAPPING_STAGING ((void *)0x5A110C8D)
19 /* check if a page is marked as staging */
20 static inline bool z_erofs_page_is_staging(struct page *page)
22 return page->mapping == Z_EROFS_MAPPING_STAGING;
25 static inline bool z_erofs_put_stagingpage(struct list_head *pagepool,
26 struct page *page)
28 if (!z_erofs_page_is_staging(page))
29 return false;
31 /* staging pages should not be used by others at the same time */
32 if (page_ref_count(page) > 1)
33 put_page(page);
34 else
35 list_add(&page->lru, pagepool);
36 return true;
39 #endif