Blame view

fs/btrfs/compression.h 2.8 KB
c8b978188   Chris Mason   Btrfs: Add zlib c...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
  /*
   * Copyright (C) 2008 Oracle.  All rights reserved.
   *
   * This program is free software; you can redistribute it and/or
   * modify it under the terms of the GNU General Public
   * License v2 as published by the Free Software Foundation.
   *
   * This program is distributed in the hope that it will be useful,
   * but WITHOUT ANY WARRANTY; without even the implied warranty of
   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   * General Public License for more details.
   *
   * You should have received a copy of the GNU General Public
   * License along with this program; if not, write to the
   * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
   * Boston, MA 021110-1307, USA.
   */
  
  #ifndef __BTRFS_COMPRESSION_
  #define __BTRFS_COMPRESSION_
261507a02   Li Zefan   btrfs: Allow to a...
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
  int btrfs_init_compress(void);
  void btrfs_exit_compress(void);
  
  int btrfs_compress_pages(int type, struct address_space *mapping,
  			 u64 start, unsigned long len,
  			 struct page **pages,
  			 unsigned long nr_dest_pages,
  			 unsigned long *out_pages,
  			 unsigned long *total_in,
  			 unsigned long *total_out,
  			 unsigned long max_out);
  int btrfs_decompress_biovec(int type, struct page **pages_in, u64 disk_start,
  			    struct bio_vec *bvec, int vcnt, size_t srclen);
  int btrfs_decompress(int type, unsigned char *data_in, struct page *dest_page,
  		     unsigned long start_byte, size_t srclen, size_t destlen);
3a39c18d6   Li Zefan   btrfs: Extract du...
36
37
38
  int btrfs_decompress_buf2page(char *buf, unsigned long buf_start,
  			      unsigned long total_out, u64 disk_start,
  			      struct bio_vec *bvec, int vcnt,
306e16ce1   David Sterba   btrfs: rename var...
39
  			      unsigned long *pg_index,
3a39c18d6   Li Zefan   btrfs: Extract du...
40
  			      unsigned long *pg_offset);
261507a02   Li Zefan   btrfs: Allow to a...
41

c8b978188   Chris Mason   Btrfs: Add zlib c...
42
43
44
45
46
47
48
  int btrfs_submit_compressed_write(struct inode *inode, u64 start,
  				  unsigned long len, u64 disk_start,
  				  unsigned long compressed_len,
  				  struct page **compressed_pages,
  				  unsigned long nr_pages);
  int btrfs_submit_compressed_read(struct inode *inode, struct bio *bio,
  				 int mirror_num, unsigned long bio_flags);
261507a02   Li Zefan   btrfs: Allow to a...
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
  
  struct btrfs_compress_op {
  	struct list_head *(*alloc_workspace)(void);
  
  	void (*free_workspace)(struct list_head *workspace);
  
  	int (*compress_pages)(struct list_head *workspace,
  			      struct address_space *mapping,
  			      u64 start, unsigned long len,
  			      struct page **pages,
  			      unsigned long nr_dest_pages,
  			      unsigned long *out_pages,
  			      unsigned long *total_in,
  			      unsigned long *total_out,
  			      unsigned long max_out);
  
  	int (*decompress_biovec)(struct list_head *workspace,
  				 struct page **pages_in,
  				 u64 disk_start,
  				 struct bio_vec *bvec,
  				 int vcnt,
  				 size_t srclen);
  
  	int (*decompress)(struct list_head *workspace,
  			  unsigned char *data_in,
  			  struct page *dest_page,
  			  unsigned long start_byte,
  			  size_t srclen, size_t destlen);
  };
  
  extern struct btrfs_compress_op btrfs_zlib_compress;
a6fa6fae4   Li Zefan   btrfs: Add lzo co...
80
  extern struct btrfs_compress_op btrfs_lzo_compress;
261507a02   Li Zefan   btrfs: Allow to a...
81

c8b978188   Chris Mason   Btrfs: Add zlib c...
82
  #endif