diff options
Diffstat (limited to 'fs/btrfs/compression.h')
-rw-r--r-- | fs/btrfs/compression.h | 66 |
1 files changed, 48 insertions, 18 deletions
diff --git a/fs/btrfs/compression.h b/fs/btrfs/compression.h index 421f5b4aa715..9b5f2f365b79 100644 --- a/fs/btrfs/compression.h +++ b/fs/btrfs/compression.h | |||
@@ -19,24 +19,22 @@ | |||
19 | #ifndef __BTRFS_COMPRESSION_ | 19 | #ifndef __BTRFS_COMPRESSION_ |
20 | #define __BTRFS_COMPRESSION_ | 20 | #define __BTRFS_COMPRESSION_ |
21 | 21 | ||
22 | int btrfs_zlib_decompress(unsigned char *data_in, | 22 | int btrfs_init_compress(void); |
23 | struct page *dest_page, | 23 | void btrfs_exit_compress(void); |
24 | unsigned long start_byte, | 24 | |
25 | size_t srclen, size_t destlen); | 25 | int btrfs_compress_pages(int type, struct address_space *mapping, |
26 | int btrfs_zlib_compress_pages(struct address_space *mapping, | 26 | u64 start, unsigned long len, |
27 | u64 start, unsigned long len, | 27 | struct page **pages, |
28 | struct page **pages, | 28 | unsigned long nr_dest_pages, |
29 | unsigned long nr_dest_pages, | 29 | unsigned long *out_pages, |
30 | unsigned long *out_pages, | 30 | unsigned long *total_in, |
31 | unsigned long *total_in, | 31 | unsigned long *total_out, |
32 | unsigned long *total_out, | 32 | unsigned long max_out); |
33 | unsigned long max_out); | 33 | int btrfs_decompress_biovec(int type, struct page **pages_in, u64 disk_start, |
34 | int btrfs_zlib_decompress_biovec(struct page **pages_in, | 34 | struct bio_vec *bvec, int vcnt, size_t srclen); |
35 | u64 disk_start, | 35 | int btrfs_decompress(int type, unsigned char *data_in, struct page *dest_page, |
36 | struct bio_vec *bvec, | 36 | unsigned long start_byte, size_t srclen, size_t destlen); |
37 | int vcnt, | 37 | |
38 | size_t srclen); | ||
39 | void btrfs_zlib_exit(void); | ||
40 | int btrfs_submit_compressed_write(struct inode *inode, u64 start, | 38 | int btrfs_submit_compressed_write(struct inode *inode, u64 start, |
41 | unsigned long len, u64 disk_start, | 39 | unsigned long len, u64 disk_start, |
42 | unsigned long compressed_len, | 40 | unsigned long compressed_len, |
@@ -44,4 +42,36 @@ int btrfs_submit_compressed_write(struct inode *inode, u64 start, | |||
44 | unsigned long nr_pages); | 42 | unsigned long nr_pages); |
45 | int btrfs_submit_compressed_read(struct inode *inode, struct bio *bio, | 43 | int btrfs_submit_compressed_read(struct inode *inode, struct bio *bio, |
46 | int mirror_num, unsigned long bio_flags); | 44 | int mirror_num, unsigned long bio_flags); |
45 | |||
46 | struct btrfs_compress_op { | ||
47 | struct list_head *(*alloc_workspace)(void); | ||
48 | |||
49 | void (*free_workspace)(struct list_head *workspace); | ||
50 | |||
51 | int (*compress_pages)(struct list_head *workspace, | ||
52 | struct address_space *mapping, | ||
53 | u64 start, unsigned long len, | ||
54 | struct page **pages, | ||
55 | unsigned long nr_dest_pages, | ||
56 | unsigned long *out_pages, | ||
57 | unsigned long *total_in, | ||
58 | unsigned long *total_out, | ||
59 | unsigned long max_out); | ||
60 | |||
61 | int (*decompress_biovec)(struct list_head *workspace, | ||
62 | struct page **pages_in, | ||
63 | u64 disk_start, | ||
64 | struct bio_vec *bvec, | ||
65 | int vcnt, | ||
66 | size_t srclen); | ||
67 | |||
68 | int (*decompress)(struct list_head *workspace, | ||
69 | unsigned char *data_in, | ||
70 | struct page *dest_page, | ||
71 | unsigned long start_byte, | ||
72 | size_t srclen, size_t destlen); | ||
73 | }; | ||
74 | |||
75 | extern struct btrfs_compress_op btrfs_zlib_compress; | ||
76 | |||
47 | #endif | 77 | #endif |