erofs: get rid of `buf->kmap_type`

JIRA: https://issues.redhat.com/browse/RHEL-31991
Upstream status: Linus

Conflicts: There's a hunk #2 reject for fs/erofs/data.c due to missing
	upstream commit 5d3bb77e5fce (:erofs: support multi-page folios
	for erofs_bread()").
	There's hunk #1 fuzz 1 for fs/erofs/internal.h due to missing
	upstream commit 3a23787ca8756 ("erofs: fix file-backed mounts
	over FUSE")

commit ec4f59d1a99de86e5c14cf97946e94d5cef98ab0
Author: Gao Xiang <xiang@kernel.org>
Date:   Thu Nov 14 17:58:13 2024 +0800

    erofs: get rid of `buf->kmap_type`

    After commit 927e5010ff5b ("erofs: use kmap_local_page() only for
    erofs_bread()"), `buf->kmap_type` actually has no use at all.

    Let's get rid of `buf->kmap_type` now.

    Suggested-by: Al Viro <viro@zeniv.linux.org.uk>
    Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
    Link: https://lore.kernel.org/r/20241114095813.839866-1-hsiangkao@linux.alibaba.com

Signed-off-by: Ian Kent <ikent@redhat.com>
This commit is contained in:
Ian Kent 2024-12-21 11:20:59 +08:00
parent e333fb49d3
commit be79be09c6
2 changed files with 5 additions and 13 deletions

View File

@ -12,10 +12,10 @@
void erofs_unmap_metabuf(struct erofs_buf *buf)
{
if (buf->kmap_type == EROFS_KMAP)
kunmap_local(buf->base);
if (!buf->base)
return;
kunmap_local(buf->base);
buf->base = NULL;
buf->kmap_type = EROFS_NO_KMAP;
}
void erofs_put_metabuf(struct erofs_buf *buf)
@ -54,14 +54,8 @@ void *erofs_bread(struct erofs_buf *buf, struct inode *inode,
page = folio_file_page(folio, index);
buf->page = page;
}
if (buf->kmap_type == EROFS_NO_KMAP) {
if (type == EROFS_KMAP)
buf->base = kmap_local_page(page);
buf->kmap_type = type;
} else if (buf->kmap_type != type) {
DBG_BUGON(1);
return ERR_PTR(-EFAULT);
}
if (!buf->base && type == EROFS_KMAP)
buf->base = kmap_local_page(page);
if (type == EROFS_NO_KMAP)
return NULL;
return buf->base + (offset & ~PAGE_MASK);
@ -313,7 +307,6 @@ static int erofs_iomap_end(struct inode *inode, loff_t pos, loff_t length,
struct erofs_buf buf = {
.page = kmap_to_page(ptr),
.base = ptr,
.kmap_type = EROFS_KMAP,
};
DBG_BUGON(iomap->type != IOMAP_INLINE);

View File

@ -246,7 +246,6 @@ enum erofs_kmap_type {
struct erofs_buf {
struct page *page;
void *base;
enum erofs_kmap_type kmap_type;
};
#define __EROFS_BUF_INITIALIZER ((struct erofs_buf){ .page = NULL })