.. | .. |
---|
27 | 27 | * Records the total size (including the header) of compressed data. |
---|
28 | 28 | * |
---|
29 | 29 | * 2. Segment(s) |
---|
30 | | - * Variable size. Each segment includes one segment header, followd by data |
---|
| 30 | + * Variable size. Each segment includes one segment header, followed by data |
---|
31 | 31 | * payload. |
---|
32 | 32 | * One regular LZO compressed extent can have one or more segments. |
---|
33 | 33 | * For inlined LZO compressed extent, only one segment is allowed. |
---|
.. | .. |
---|
61 | 61 | struct list_head list; |
---|
62 | 62 | }; |
---|
63 | 63 | |
---|
64 | | -static void lzo_free_workspace(struct list_head *ws) |
---|
| 64 | +static struct workspace_manager wsm; |
---|
| 65 | + |
---|
| 66 | +void lzo_free_workspace(struct list_head *ws) |
---|
65 | 67 | { |
---|
66 | 68 | struct workspace *workspace = list_entry(ws, struct workspace, list); |
---|
67 | 69 | |
---|
.. | .. |
---|
71 | 73 | kfree(workspace); |
---|
72 | 74 | } |
---|
73 | 75 | |
---|
74 | | -static struct list_head *lzo_alloc_workspace(void) |
---|
| 76 | +struct list_head *lzo_alloc_workspace(unsigned int level) |
---|
75 | 77 | { |
---|
76 | 78 | struct workspace *workspace; |
---|
77 | 79 | |
---|
.. | .. |
---|
109 | 111 | return le32_to_cpu(dlen); |
---|
110 | 112 | } |
---|
111 | 113 | |
---|
112 | | -static int lzo_compress_pages(struct list_head *ws, |
---|
113 | | - struct address_space *mapping, |
---|
114 | | - u64 start, |
---|
115 | | - struct page **pages, |
---|
116 | | - unsigned long *out_pages, |
---|
117 | | - unsigned long *total_in, |
---|
118 | | - unsigned long *total_out) |
---|
| 114 | +int lzo_compress_pages(struct list_head *ws, struct address_space *mapping, |
---|
| 115 | + u64 start, struct page **pages, unsigned long *out_pages, |
---|
| 116 | + unsigned long *total_in, unsigned long *total_out) |
---|
119 | 117 | { |
---|
120 | 118 | struct workspace *workspace = list_entry(ws, struct workspace, list); |
---|
121 | 119 | int ret = 0; |
---|
.. | .. |
---|
281 | 279 | return ret; |
---|
282 | 280 | } |
---|
283 | 281 | |
---|
284 | | -static int lzo_decompress_bio(struct list_head *ws, struct compressed_bio *cb) |
---|
| 282 | +int lzo_decompress_bio(struct list_head *ws, struct compressed_bio *cb) |
---|
285 | 283 | { |
---|
286 | 284 | struct workspace *workspace = list_entry(ws, struct workspace, list); |
---|
287 | 285 | int ret = 0, ret2; |
---|
.. | .. |
---|
422 | 420 | return ret; |
---|
423 | 421 | } |
---|
424 | 422 | |
---|
425 | | -static int lzo_decompress(struct list_head *ws, unsigned char *data_in, |
---|
426 | | - struct page *dest_page, |
---|
427 | | - unsigned long start_byte, |
---|
428 | | - size_t srclen, size_t destlen) |
---|
| 423 | +int lzo_decompress(struct list_head *ws, unsigned char *data_in, |
---|
| 424 | + struct page *dest_page, unsigned long start_byte, size_t srclen, |
---|
| 425 | + size_t destlen) |
---|
429 | 426 | { |
---|
430 | 427 | struct workspace *workspace = list_entry(ws, struct workspace, list); |
---|
431 | 428 | size_t in_len; |
---|
.. | .. |
---|
485 | 482 | return ret; |
---|
486 | 483 | } |
---|
487 | 484 | |
---|
488 | | -static void lzo_set_level(struct list_head *ws, unsigned int type) |
---|
489 | | -{ |
---|
490 | | -} |
---|
491 | | - |
---|
492 | 485 | const struct btrfs_compress_op btrfs_lzo_compress = { |
---|
493 | | - .alloc_workspace = lzo_alloc_workspace, |
---|
494 | | - .free_workspace = lzo_free_workspace, |
---|
495 | | - .compress_pages = lzo_compress_pages, |
---|
496 | | - .decompress_bio = lzo_decompress_bio, |
---|
497 | | - .decompress = lzo_decompress, |
---|
498 | | - .set_level = lzo_set_level, |
---|
| 486 | + .workspace_manager = &wsm, |
---|
| 487 | + .max_level = 1, |
---|
| 488 | + .default_level = 1, |
---|
499 | 489 | }; |
---|