hc
2024-12-19 9370bb92b2d16684ee45cf24e879c93c509162da
kernel/fs/btrfs/lzo.c
....@@ -27,7 +27,7 @@
2727 * Records the total size (including the header) of compressed data.
2828 *
2929 * 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
3131 * payload.
3232 * One regular LZO compressed extent can have one or more segments.
3333 * For inlined LZO compressed extent, only one segment is allowed.
....@@ -61,7 +61,9 @@
6161 struct list_head list;
6262 };
6363
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)
6567 {
6668 struct workspace *workspace = list_entry(ws, struct workspace, list);
6769
....@@ -71,7 +73,7 @@
7173 kfree(workspace);
7274 }
7375
74
-static struct list_head *lzo_alloc_workspace(void)
76
+struct list_head *lzo_alloc_workspace(unsigned int level)
7577 {
7678 struct workspace *workspace;
7779
....@@ -109,13 +111,9 @@
109111 return le32_to_cpu(dlen);
110112 }
111113
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)
119117 {
120118 struct workspace *workspace = list_entry(ws, struct workspace, list);
121119 int ret = 0;
....@@ -281,7 +279,7 @@
281279 return ret;
282280 }
283281
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)
285283 {
286284 struct workspace *workspace = list_entry(ws, struct workspace, list);
287285 int ret = 0, ret2;
....@@ -422,10 +420,9 @@
422420 return ret;
423421 }
424422
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)
429426 {
430427 struct workspace *workspace = list_entry(ws, struct workspace, list);
431428 size_t in_len;
....@@ -485,15 +482,8 @@
485482 return ret;
486483 }
487484
488
-static void lzo_set_level(struct list_head *ws, unsigned int type)
489
-{
490
-}
491
-
492485 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,
499489 };