hc
2024-12-19 9370bb92b2d16684ee45cf24e879c93c509162da
kernel/fs/squashfs/decompressor_multi_percpu.c
....@@ -1,16 +1,14 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * Copyright (c) 2013
34 * Phillip Lougher <phillip@squashfs.org.uk>
4
- *
5
- * This work is licensed under the terms of the GNU GPL, version 2. See
6
- * the COPYING file in the top-level directory.
75 */
86
97 #include <linux/types.h>
108 #include <linux/slab.h>
119 #include <linux/percpu.h>
1210 #include <linux/buffer_head.h>
13
-#include <linux/locallock.h>
11
+#include <linux/local_lock.h>
1412
1513 #include "squashfs_fs.h"
1614 #include "squashfs_fs_sb.h"
....@@ -23,10 +21,9 @@
2321 */
2422
2523 struct squashfs_stream {
26
- void *stream;
24
+ void *stream;
25
+ local_lock_t lock;
2726 };
28
-
29
-static DEFINE_LOCAL_IRQ_LOCK(stream_lock);
3027
3128 void *squashfs_decompressor_create(struct squashfs_sb_info *msblk,
3229 void *comp_opts)
....@@ -46,6 +43,7 @@
4643 err = PTR_ERR(stream->stream);
4744 goto out;
4845 }
46
+ local_lock_init(&stream->lock);
4947 }
5048
5149 kfree(comp_opts);
....@@ -77,20 +75,19 @@
7775 }
7876 }
7977
80
-int squashfs_decompress(struct squashfs_sb_info *msblk, struct buffer_head **bh,
81
- int b, int offset, int length, struct squashfs_page_actor *output)
78
+int squashfs_decompress(struct squashfs_sb_info *msblk, struct bio *bio,
79
+ int offset, int length, struct squashfs_page_actor *output)
8280 {
83
- struct squashfs_stream __percpu *percpu =
84
- (struct squashfs_stream __percpu *) msblk->stream;
8581 struct squashfs_stream *stream;
8682 int res;
8783
88
- stream = get_locked_ptr(stream_lock, percpu);
84
+ local_lock(&msblk->stream->lock);
85
+ stream = this_cpu_ptr(msblk->stream);
8986
90
- res = msblk->decompressor->decompress(msblk, stream->stream, bh, b,
91
- offset, length, output);
87
+ res = msblk->decompressor->decompress(msblk, stream->stream, bio,
88
+ offset, length, output);
9289
93
- put_locked_ptr(stream_lock, stream);
90
+ local_unlock(&msblk->stream->lock);
9491
9592 if (res < 0)
9693 ERROR("%s decompression failed, data probably corrupt\n",