.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
---|
1 | 2 | /* |
---|
2 | 3 | * Copyright (c) 2013 |
---|
3 | 4 | * 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. |
---|
7 | 5 | */ |
---|
8 | 6 | |
---|
9 | 7 | #include <linux/types.h> |
---|
10 | 8 | #include <linux/slab.h> |
---|
11 | 9 | #include <linux/percpu.h> |
---|
12 | 10 | #include <linux/buffer_head.h> |
---|
13 | | -#include <linux/locallock.h> |
---|
| 11 | +#include <linux/local_lock.h> |
---|
14 | 12 | |
---|
15 | 13 | #include "squashfs_fs.h" |
---|
16 | 14 | #include "squashfs_fs_sb.h" |
---|
.. | .. |
---|
23 | 21 | */ |
---|
24 | 22 | |
---|
25 | 23 | struct squashfs_stream { |
---|
26 | | - void *stream; |
---|
| 24 | + void *stream; |
---|
| 25 | + local_lock_t lock; |
---|
27 | 26 | }; |
---|
28 | | - |
---|
29 | | -static DEFINE_LOCAL_IRQ_LOCK(stream_lock); |
---|
30 | 27 | |
---|
31 | 28 | void *squashfs_decompressor_create(struct squashfs_sb_info *msblk, |
---|
32 | 29 | void *comp_opts) |
---|
.. | .. |
---|
46 | 43 | err = PTR_ERR(stream->stream); |
---|
47 | 44 | goto out; |
---|
48 | 45 | } |
---|
| 46 | + local_lock_init(&stream->lock); |
---|
49 | 47 | } |
---|
50 | 48 | |
---|
51 | 49 | kfree(comp_opts); |
---|
.. | .. |
---|
77 | 75 | } |
---|
78 | 76 | } |
---|
79 | 77 | |
---|
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) |
---|
82 | 80 | { |
---|
83 | | - struct squashfs_stream __percpu *percpu = |
---|
84 | | - (struct squashfs_stream __percpu *) msblk->stream; |
---|
85 | 81 | struct squashfs_stream *stream; |
---|
86 | 82 | int res; |
---|
87 | 83 | |
---|
88 | | - stream = get_locked_ptr(stream_lock, percpu); |
---|
| 84 | + local_lock(&msblk->stream->lock); |
---|
| 85 | + stream = this_cpu_ptr(msblk->stream); |
---|
89 | 86 | |
---|
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); |
---|
92 | 89 | |
---|
93 | | - put_locked_ptr(stream_lock, stream); |
---|
| 90 | + local_unlock(&msblk->stream->lock); |
---|
94 | 91 | |
---|
95 | 92 | if (res < 0) |
---|
96 | 93 | ERROR("%s decompression failed, data probably corrupt\n", |
---|