diff options
Diffstat (limited to 'fs/squashfs')
-rw-r--r-- | fs/squashfs/decompressor_multi_percpu.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/fs/squashfs/decompressor_multi_percpu.c b/fs/squashfs/decompressor_multi_percpu.c index d93e12d9b712..b881b9283b7f 100644 --- a/fs/squashfs/decompressor_multi_percpu.c +++ b/fs/squashfs/decompressor_multi_percpu.c @@ -8,6 +8,7 @@ #include <linux/slab.h> #include <linux/percpu.h> #include <linux/buffer_head.h> +#include <linux/local_lock.h> #include "squashfs_fs.h" #include "squashfs_fs_sb.h" @@ -20,7 +21,8 @@ */ struct squashfs_stream { - void *stream; + void *stream; + local_lock_t lock; }; void *squashfs_decompressor_create(struct squashfs_sb_info *msblk, @@ -41,6 +43,7 @@ void *squashfs_decompressor_create(struct squashfs_sb_info *msblk, err = PTR_ERR(stream->stream); goto out; } + local_lock_init(&stream->lock); } kfree(comp_opts); @@ -75,15 +78,16 @@ void squashfs_decompressor_destroy(struct squashfs_sb_info *msblk) int squashfs_decompress(struct squashfs_sb_info *msblk, struct bio *bio, int offset, int length, struct squashfs_page_actor *output) { - struct squashfs_stream __percpu *percpu; struct squashfs_stream *stream; int res; - percpu = (struct squashfs_stream __percpu *)msblk->stream; - stream = get_cpu_ptr(percpu); + local_lock(&msblk->stream->lock); + stream = this_cpu_ptr(msblk->stream); + res = msblk->decompressor->decompress(msblk, stream->stream, bio, offset, length, output); - put_cpu_ptr(stream); + + local_unlock(&msblk->stream->lock); if (res < 0) ERROR("%s decompression failed, data probably corrupt\n", |