Skip to content

Commit

Permalink
Merge tag 'erofs-for-6.3-rc2-fixes' of git://git.kernel.org/pub/scm/l…
Browse files Browse the repository at this point in the history
…inux/kernel/git/xiang/erofs

Pull erofs fixes from Gao Xiang:
 "The most important one reverts an improper fix which can cause an
  unexpected warning more often on specific images, and another one
  fixes LZMA decompression on 32-bit platforms. The others are minor
  fixes and cleanups.

   - Fix LZMA decompression failure on HIGHMEM platforms

   - Revert an inproper fix since it is actually an implementation issue
     of vmalloc()

   - Avoid a wrong DBG_BUGON since it could be triggered with -EINTR

   - Minor cleanups"

* tag 'erofs-for-6.3-rc2-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs:
  erofs: use wrapper i_blocksize() in erofs_file_read_iter()
  erofs: get rid of a useless DBG_BUGON
  erofs: Revert "erofs: fix kvcalloc() misuse with __GFP_NOFAIL"
  erofs: fix wrong kunmap when using LZMA on HIGHMEM platforms
  erofs: mark z_erofs_lzma_init/erofs_pcpubuf_init w/ __init
  • Loading branch information
Linus Torvalds committed Mar 10, 2023
2 parents 92cadfc + 3993f4f commit 388a810
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 15 deletions.
2 changes: 1 addition & 1 deletion fs/erofs/data.c
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ static ssize_t erofs_file_read_iter(struct kiocb *iocb, struct iov_iter *to)
if (bdev)
blksize_mask = bdev_logical_block_size(bdev) - 1;
else
blksize_mask = (1 << inode->i_blkbits) - 1;
blksize_mask = i_blocksize(inode) - 1;

if ((iocb->ki_pos | iov_iter_count(to) |
iov_iter_alignment(to)) & blksize_mask)
Expand Down
4 changes: 2 additions & 2 deletions fs/erofs/decompressor_lzma.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ void z_erofs_lzma_exit(void)
}
}

int z_erofs_lzma_init(void)
int __init z_erofs_lzma_init(void)
{
unsigned int i;

Expand Down Expand Up @@ -278,7 +278,7 @@ int z_erofs_lzma_decompress(struct z_erofs_decompress_req *rq,
}
}
if (no < nrpages_out && strm->buf.out)
kunmap(rq->in[no]);
kunmap(rq->out[no]);
if (ni < nrpages_in)
kunmap(rq->in[ni]);
/* 4. push back LZMA stream context to the global list */
Expand Down
4 changes: 2 additions & 2 deletions fs/erofs/internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,7 @@ static inline void *erofs_vm_map_ram(struct page **pages, unsigned int count)
void *erofs_get_pcpubuf(unsigned int requiredpages);
void erofs_put_pcpubuf(void *ptr);
int erofs_pcpubuf_growsize(unsigned int nrpages);
void erofs_pcpubuf_init(void);
void __init erofs_pcpubuf_init(void);
void erofs_pcpubuf_exit(void);

int erofs_register_sysfs(struct super_block *sb);
Expand Down Expand Up @@ -545,7 +545,7 @@ static inline int z_erofs_fill_inode(struct inode *inode) { return -EOPNOTSUPP;
#endif /* !CONFIG_EROFS_FS_ZIP */

#ifdef CONFIG_EROFS_FS_ZIP_LZMA
int z_erofs_lzma_init(void);
int __init z_erofs_lzma_init(void);
void z_erofs_lzma_exit(void);
int z_erofs_load_lzma_config(struct super_block *sb,
struct erofs_super_block *dsb,
Expand Down
2 changes: 1 addition & 1 deletion fs/erofs/pcpubuf.c
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ int erofs_pcpubuf_growsize(unsigned int nrpages)
return ret;
}

void erofs_pcpubuf_init(void)
void __init erofs_pcpubuf_init(void)
{
int cpu;

Expand Down
12 changes: 6 additions & 6 deletions fs/erofs/zdata.c
Original file line number Diff line number Diff line change
Expand Up @@ -1312,12 +1312,12 @@ static int z_erofs_decompress_pcluster(struct z_erofs_decompress_backend *be,

if (!be->decompressed_pages)
be->decompressed_pages =
kcalloc(be->nr_pages, sizeof(struct page *),
GFP_KERNEL | __GFP_NOFAIL);
kvcalloc(be->nr_pages, sizeof(struct page *),
GFP_KERNEL | __GFP_NOFAIL);
if (!be->compressed_pages)
be->compressed_pages =
kcalloc(pclusterpages, sizeof(struct page *),
GFP_KERNEL | __GFP_NOFAIL);
kvcalloc(pclusterpages, sizeof(struct page *),
GFP_KERNEL | __GFP_NOFAIL);

z_erofs_parse_out_bvecs(be);
err2 = z_erofs_parse_in_bvecs(be, &overlapped);
Expand Down Expand Up @@ -1365,7 +1365,7 @@ static int z_erofs_decompress_pcluster(struct z_erofs_decompress_backend *be,
}
if (be->compressed_pages < be->onstack_pages ||
be->compressed_pages >= be->onstack_pages + Z_EROFS_ONSTACK_PAGES)
kfree(be->compressed_pages);
kvfree(be->compressed_pages);
z_erofs_fill_other_copies(be, err);

for (i = 0; i < be->nr_pages; ++i) {
Expand All @@ -1384,7 +1384,7 @@ static int z_erofs_decompress_pcluster(struct z_erofs_decompress_backend *be,
}

if (be->decompressed_pages != be->onstack_pages)
kfree(be->decompressed_pages);
kvfree(be->decompressed_pages);

pcl->length = 0;
pcl->partial = true;
Expand Down
3 changes: 0 additions & 3 deletions fs/erofs/zmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -757,9 +757,6 @@ int z_erofs_map_blocks_iter(struct inode *inode, struct erofs_map_blocks *map,
err = z_erofs_do_map_blocks(inode, map, flags);
out:
trace_z_erofs_map_blocks_iter_exit(inode, map, flags, err);

/* aggressively BUG_ON iff CONFIG_EROFS_FS_DEBUG is on */
DBG_BUGON(err < 0 && err != -ENOMEM);
return err;
}

Expand Down

0 comments on commit 388a810

Please sign in to comment.