erofs: get rid of `buf->kmap_type`
PATCH 1/1 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 <[email protected]>
Signed-off-by Gao Xiang <[email protected]>
--- fs/erofs/data.c | 18 +++++------------- fs/erofs/internal.h | 1 - 2 files changed, 5 insertions(+), 14 deletions(-)
fs/erofs/data.c +5 -13
@@ -10,10 +10,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)
@@ -45,15 +45,8 @@ void *erofs_bread(struct erofs_buf *buf, erofs_off_t offset,return folio; } buf->page =folio_file_page (folio, index); - -if (buf->kmap_type ==EROFS_NO_KMAP ) { -if (type ==EROFS_KMAP ) - buf->base =kmap_local_page (buf->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 (buf->page);if (type ==EROFS_NO_KMAP )return NULL ;return buf->base + (offset & ~PAGE_MASK );
@@ -352,7 +345,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 );
fs/erofs/internal.h +0 -1
@@ -212,7 +212,6 @@ struct erofs_buf {struct file *file;struct page *page;void *base; -enum erofs_kmap_type kmap_type; };#define __EROFS_BUF_INITIALIZER ((struct erofs_buf){ .page = NULL })
Signature · 1 line
2.43.5