From: Hu Weiwen <sehuww@mail.scut.edu.cn>
To: Gao Xiang <hsiangkao@redhat.com>,
Li Guifu <bluce.liguifu@huawei.com>,
Miao Xie <miaoxie@huawei.com>, Fang Wei <fangwei1@huawei.com>
Cc: Hu Weiwen <sehuww@mail.scut.edu.cn>, linux-erofs@lists.ozlabs.org
Subject: [PATCH v2 2/2] erofs-utils: refactor: remove end argument from erofs_mapbh
Date: Sat, 9 Jan 2021 16:28:10 +0800 [thread overview]
Message-ID: <20210109082810.32169-3-sehuww@mail.scut.edu.cn> (raw)
In-Reply-To: <20210109082810.32169-1-sehuww@mail.scut.edu.cn>
Signed-off-by: Hu Weiwen <sehuww@mail.scut.edu.cn>
---
include/erofs/cache.h | 2 +-
lib/cache.c | 3 +--
lib/compress.c | 2 +-
lib/inode.c | 10 +++++-----
lib/xattr.c | 2 +-
mkfs/main.c | 2 +-
6 files changed, 10 insertions(+), 11 deletions(-)
diff --git a/include/erofs/cache.h b/include/erofs/cache.h
index b5bf6c0..26d341e 100644
--- a/include/erofs/cache.h
+++ b/include/erofs/cache.h
@@ -96,7 +96,7 @@ struct erofs_buffer_head *erofs_balloc(int type, erofs_off_t size,
struct erofs_buffer_head *erofs_battach(struct erofs_buffer_head *bh,
int type, unsigned int size);
-erofs_blk_t erofs_mapbh(struct erofs_buffer_block *bb, bool end);
+erofs_blk_t erofs_mapbh(struct erofs_buffer_block *bb);
bool erofs_bflush(struct erofs_buffer_block *bb);
void erofs_bdrop(struct erofs_buffer_head *bh, bool tryrevoke);
diff --git a/lib/cache.c b/lib/cache.c
index aa972d8..bddb237 100644
--- a/lib/cache.c
+++ b/lib/cache.c
@@ -316,9 +316,8 @@ static erofs_blk_t __erofs_mapbh(struct erofs_buffer_block *bb)
return blkaddr;
}
-erofs_blk_t erofs_mapbh(struct erofs_buffer_block *bb, bool end)
+erofs_blk_t erofs_mapbh(struct erofs_buffer_block *bb)
{
- DBG_BUGON(!end);
struct erofs_buffer_block *t = last_mapped_block;
while (1) {
t = list_next_entry(t, list);
diff --git a/lib/compress.c b/lib/compress.c
index 86db940..2b1f93c 100644
--- a/lib/compress.c
+++ b/lib/compress.c
@@ -416,7 +416,7 @@ int erofs_write_compressed_file(struct erofs_inode *inode)
memset(compressmeta, 0, Z_EROFS_LEGACY_MAP_HEADER_SIZE);
- blkaddr = erofs_mapbh(bh->block, true); /* start_blkaddr */
+ blkaddr = erofs_mapbh(bh->block); /* start_blkaddr */
ctx.blkaddr = blkaddr;
ctx.metacur = compressmeta + Z_EROFS_LEGACY_MAP_HEADER_SIZE;
ctx.head = ctx.tail = 0;
diff --git a/lib/inode.c b/lib/inode.c
index d0b4d51..4ed6aed 100644
--- a/lib/inode.c
+++ b/lib/inode.c
@@ -148,7 +148,7 @@ static int __allocate_inode_bh_data(struct erofs_inode *inode,
inode->bh_data = bh;
/* get blkaddr of the bh */
- ret = erofs_mapbh(bh->block, true);
+ ret = erofs_mapbh(bh->block);
DBG_BUGON(ret < 0);
/* write blocks except for the tail-end block */
@@ -522,7 +522,7 @@ int erofs_prepare_tail_block(struct erofs_inode *inode)
bh->op = &erofs_skip_write_bhops;
/* get blkaddr of bh */
- ret = erofs_mapbh(bh->block, true);
+ ret = erofs_mapbh(bh->block);
DBG_BUGON(ret < 0);
inode->u.i_blkaddr = bh->block->blkaddr;
@@ -632,7 +632,7 @@ int erofs_write_tail_end(struct erofs_inode *inode)
int ret;
erofs_off_t pos;
- erofs_mapbh(bh->block, true);
+ erofs_mapbh(bh->block);
pos = erofs_btell(bh, true) - EROFS_BLKSIZ;
ret = dev_write(inode->idata, pos, inode->idata_size);
if (ret)
@@ -879,7 +879,7 @@ void erofs_fixup_meta_blkaddr(struct erofs_inode *rootdir)
struct erofs_buffer_head *const bh = rootdir->bh;
erofs_off_t off, meta_offset;
- erofs_mapbh(bh->block, true);
+ erofs_mapbh(bh->block);
off = erofs_btell(bh, false);
if (off > rootnid_maxoffset)
@@ -898,7 +898,7 @@ erofs_nid_t erofs_lookupnid(struct erofs_inode *inode)
if (!bh)
return inode->nid;
- erofs_mapbh(bh->block, true);
+ erofs_mapbh(bh->block);
off = erofs_btell(bh, false);
meta_offset = blknr_to_addr(sbi.meta_blkaddr);
diff --git a/lib/xattr.c b/lib/xattr.c
index 49ebb9c..8b7bcb1 100644
--- a/lib/xattr.c
+++ b/lib/xattr.c
@@ -575,7 +575,7 @@ int erofs_build_shared_xattrs_from_path(const char *path)
}
bh->op = &erofs_skip_write_bhops;
- erofs_mapbh(bh->block, true);
+ erofs_mapbh(bh->block);
off = erofs_btell(bh, false);
sbi.xattr_blkaddr = off / EROFS_BLKSIZ;
diff --git a/mkfs/main.c b/mkfs/main.c
index abd48be..d9c4c7f 100644
--- a/mkfs/main.c
+++ b/mkfs/main.c
@@ -304,7 +304,7 @@ int erofs_mkfs_update_super_block(struct erofs_buffer_head *bh,
round_up(EROFS_SUPER_END, EROFS_BLKSIZ);
char *buf;
- *blocks = erofs_mapbh(NULL, true);
+ *blocks = erofs_mapbh(NULL);
sb.blocks = cpu_to_le32(*blocks);
sb.root_nid = cpu_to_le16(root_nid);
memcpy(sb.uuid, sbi.uuid, sizeof(sb.uuid));
--
2.17.1
prev parent reply other threads:[~2021-01-09 8:48 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-01 9:11 [PATCH 1/2] erofs-utils: optimize mkfs to O(N), N = #files 胡玮文
2021-01-01 9:50 ` 胡 玮文
2021-01-02 5:09 ` Gao Xiang
2021-01-08 18:15 ` Gao Xiang
2021-01-09 8:28 ` [PATCH v2 0/2] Optimize " Hu Weiwen
2021-01-09 8:28 ` [PATCH v2 1/2] erofs-utils: optimize " Hu Weiwen
2021-01-09 8:28 ` Hu Weiwen [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210109082810.32169-3-sehuww@mail.scut.edu.cn \
--to=sehuww@mail.scut.edu.cn \
--cc=bluce.liguifu@huawei.com \
--cc=fangwei1@huawei.com \
--cc=hsiangkao@redhat.com \
--cc=linux-erofs@lists.ozlabs.org \
--cc=miaoxie@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).