forked from Minki/linux
47e4937a4a
EROFS filesystem has been merged into linux-staging for a year. EROFS is designed to be a better solution of saving extra storage space with guaranteed end-to-end performance for read-only files with the help of reduced metadata, fixed-sized output compression and decompression inplace technologies. In the past year, EROFS was greatly improved by many people as a staging driver, self-tested, betaed by a large number of our internal users, successfully applied to almost all in-service HUAWEI smartphones as the part of EMUI 9.1 and proven to be stable enough to be moved out of staging. EROFS is a self-contained filesystem driver. Although there are still some TODOs to be more generic, we have a dedicated team actively keeping on working on EROFS in order to make it better with the evolution of Linux kernel as the other in-kernel filesystems. As Pavel suggested, it's better to do as one commit since git can do moves and all histories will be saved in this way. Let's promote it from staging and enhance it more actively as a "real" part of kernel for more wider scenarios! Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: Alexander Viro <viro@zeniv.linux.org.uk> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Stephen Rothwell <sfr@canb.auug.org.au> Cc: Theodore Ts'o <tytso@mit.edu> Cc: Pavel Machek <pavel@denx.de> Cc: David Sterba <dsterba@suse.cz> Cc: Amir Goldstein <amir73il@gmail.com> Cc: Christoph Hellwig <hch@infradead.org> Cc: Darrick J . Wong <darrick.wong@oracle.com> Cc: Dave Chinner <david@fromorbit.com> Cc: Jaegeuk Kim <jaegeuk@kernel.org> Cc: Jan Kara <jack@suse.cz> Cc: Richard Weinberger <richard@nod.at> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Chao Yu <yuchao0@huawei.com> Cc: Miao Xie <miaoxie@huawei.com> Cc: Li Guifu <bluce.liguifu@huawei.com> Cc: Fang Wei <fangwei1@huawei.com> Signed-off-by: Gao Xiang <gaoxiang25@huawei.com> Link: https://lore.kernel.org/r/20190822213659.5501-1-hsiangkao@aol.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
61 lines
1.4 KiB
C
61 lines
1.4 KiB
C
/* SPDX-License-Identifier: GPL-2.0-only */
|
|
/*
|
|
* 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
|
|
|
|
#include "internal.h"
|
|
|
|
enum {
|
|
Z_EROFS_COMPRESSION_SHIFTED = Z_EROFS_COMPRESSION_MAX,
|
|
Z_EROFS_COMPRESSION_RUNTIME_MAX
|
|
};
|
|
|
|
struct z_erofs_decompress_req {
|
|
struct super_block *sb;
|
|
struct page **in, **out;
|
|
|
|
unsigned short pageofs_out;
|
|
unsigned int inputsize, outputsize;
|
|
|
|
/* indicate the algorithm will be used for decompression */
|
|
unsigned int alg;
|
|
bool inplace_io, partial_decoding;
|
|
};
|
|
|
|
/*
|
|
* - 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;
|
|
}
|
|
|
|
int z_erofs_decompress(struct z_erofs_decompress_req *rq,
|
|
struct list_head *pagepool);
|
|
|
|
#endif
|
|
|