It's never used and doesn't have clear meanings.

Signed-off-by: Gao Xiang <hsiang...@linux.alibaba.com>
---
 include/erofs/cache.h |  1 -
 lib/blobchunk.c       |  4 ++--
 lib/cache.c           | 22 +++++++++-------------
 lib/compress.c        |  4 ++--
 lib/inode.c           | 10 +++++-----
 lib/super.c           |  2 +-
 lib/xattr.c           |  2 +-
 7 files changed, 20 insertions(+), 25 deletions(-)

diff --git a/include/erofs/cache.h b/include/erofs/cache.h
index 5411eed..646d6de 100644
--- a/include/erofs/cache.h
+++ b/include/erofs/cache.h
@@ -120,7 +120,6 @@ int erofs_bh_balloon(struct erofs_buffer_head *bh, 
erofs_off_t incr);
 
 struct erofs_buffer_head *erofs_balloc(struct erofs_bufmgr *bmgr,
                                       int type, erofs_off_t size,
-                                      unsigned int required_ext,
                                       unsigned int inline_ext);
 struct erofs_buffer_head *erofs_battach(struct erofs_buffer_head *bh,
                                        int type, unsigned int size);
diff --git a/lib/blobchunk.c b/lib/blobchunk.c
index 119dd82..8e2360f 100644
--- a/lib/blobchunk.c
+++ b/lib/blobchunk.c
@@ -525,7 +525,7 @@ int erofs_mkfs_dump_blobs(struct erofs_sb_info *sbi)
                return 0;
        }
 
-       bh = erofs_balloc(sbi->bmgr, DATA, datablob_size, 0, 0);
+       bh = erofs_balloc(sbi->bmgr, DATA, datablob_size, 0);
        if (IS_ERR(bh))
                return PTR_ERR(bh);
 
@@ -647,7 +647,7 @@ int erofs_mkfs_init_devices(struct erofs_sb_info *sbi, 
unsigned int devices)
                return -ENOMEM;
 
        bh_devt = erofs_balloc(sbi->bmgr, DEVT,
-               sizeof(struct erofs_deviceslot) * devices, 0, 0);
+               sizeof(struct erofs_deviceslot) * devices, 0);
        if (IS_ERR(bh_devt)) {
                free(sbi->devs);
                return PTR_ERR(bh_devt);
diff --git a/lib/cache.c b/lib/cache.c
index 3208e9f..66bbdca 100644
--- a/lib/cache.c
+++ b/lib/cache.c
@@ -127,7 +127,6 @@ int erofs_bh_balloon(struct erofs_buffer_head *bh, 
erofs_off_t incr)
 
 static int erofs_bfind_for_attach(struct erofs_bufmgr *bmgr,
                                  int type, erofs_off_t size,
-                                 unsigned int required_ext,
                                  unsigned int inline_ext,
                                  unsigned int alignsize,
                                  struct erofs_buffer_block **bbp)
@@ -137,7 +136,7 @@ static int erofs_bfind_for_attach(struct erofs_bufmgr *bmgr,
        unsigned int used0, used_before, usedmax, used;
        int ret;
 
-       used0 = ((size + required_ext) & (blksiz - 1)) + inline_ext;
+       used0 = (size & (blksiz - 1)) + inline_ext;
        /* inline data should be in the same fs block */
        if (used0 > blksiz)
                return -ENOSPC;
@@ -151,11 +150,10 @@ static int erofs_bfind_for_attach(struct erofs_bufmgr 
*bmgr,
        bb = NULL;
 
        /* try to find a most-fit mapped buffer block first */
-       if (size + required_ext + inline_ext >= blksiz)
+       if (size + inline_ext >= blksiz)
                goto skip_mapped;
 
-       used_before = rounddown(blksiz -
-                               (size + required_ext + inline_ext), alignsize);
+       used_before = rounddown(blksiz - (size + inline_ext), alignsize);
        for (; used_before; --used_before) {
                struct list_head *bt = bmgr->mapped_buckets[type] + used_before;
 
@@ -175,14 +173,14 @@ static int erofs_bfind_for_attach(struct erofs_bufmgr 
*bmgr,
                DBG_BUGON(used_before != (cur->buffers.off & (blksiz - 1)));
 
                ret = __erofs_battach(cur, NULL, size, alignsize,
-                                     required_ext + inline_ext, true);
+                                     inline_ext, true);
                if (ret < 0) {
                        DBG_BUGON(1);
                        continue;
                }
 
                /* should contain all data in the current block */
-               used = ret + required_ext + inline_ext;
+               used = ret + inline_ext;
                DBG_BUGON(used > blksiz);
 
                bb = cur;
@@ -207,11 +205,11 @@ skip_mapped:
                        continue;
 
                ret = __erofs_battach(cur, NULL, size, alignsize,
-                                     required_ext + inline_ext, true);
+                                     inline_ext, true);
                if (ret < 0)
                        continue;
 
-               used = ((ret + required_ext) & (blksiz - 1)) + inline_ext;
+               used = (ret & (blksiz - 1)) + inline_ext;
 
                /* should contain inline data in current block */
                if (used > blksiz)
@@ -235,7 +233,6 @@ skip_mapped:
 
 struct erofs_buffer_head *erofs_balloc(struct erofs_bufmgr *bmgr,
                                       int type, erofs_off_t size,
-                                      unsigned int required_ext,
                                       unsigned int inline_ext)
 {
        struct erofs_buffer_block *bb;
@@ -251,7 +248,7 @@ struct erofs_buffer_head *erofs_balloc(struct erofs_bufmgr 
*bmgr,
        alignsize = ret;
 
        /* try to find if we could reuse an allocated buffer block */
-       ret = erofs_bfind_for_attach(bmgr, type, size, required_ext, inline_ext,
+       ret = erofs_bfind_for_attach(bmgr, type, size, inline_ext,
                                     alignsize, &bb);
        if (ret)
                return ERR_PTR(ret);
@@ -285,8 +282,7 @@ struct erofs_buffer_head *erofs_balloc(struct erofs_bufmgr 
*bmgr,
                }
        }
 
-       ret = __erofs_battach(bb, bh, size, alignsize,
-                             required_ext + inline_ext, false);
+       ret = __erofs_battach(bb, bh, size, alignsize, inline_ext, false);
        if (ret < 0) {
                free(bh);
                return ERR_PTR(ret);
diff --git a/lib/compress.c b/lib/compress.c
index 65edd00..8446fe4 100644
--- a/lib/compress.c
+++ b/lib/compress.c
@@ -1378,7 +1378,7 @@ int erofs_mt_write_compressed_file(struct 
z_erofs_compress_ictx *ictx)
                pthread_cond_wait(&ictx->cond, &ictx->mutex);
        pthread_mutex_unlock(&ictx->mutex);
 
-       bh = erofs_balloc(sbi->bmgr, DATA, 0, 0, 0);
+       bh = erofs_balloc(sbi->bmgr, DATA, 0, 0);
        if (IS_ERR(bh)) {
                ret = PTR_ERR(bh);
                goto out;
@@ -1544,7 +1544,7 @@ int erofs_write_compressed_file(struct 
z_erofs_compress_ictx *ictx)
 #endif
 
        /* allocate main data buffer */
-       bh = erofs_balloc(inode->sbi->bmgr, DATA, 0, 0, 0);
+       bh = erofs_balloc(inode->sbi->bmgr, DATA, 0, 0);
        if (IS_ERR(bh)) {
                ret = PTR_ERR(bh);
                goto err_free_idata;
diff --git a/lib/inode.c b/lib/inode.c
index 0404a8d..de6d020 100644
--- a/lib/inode.c
+++ b/lib/inode.c
@@ -189,7 +189,7 @@ int erofs_allocate_inode_bh_data(struct erofs_inode *inode, 
erofs_blk_t nblocks)
 
        /* allocate main data buffer */
        type = S_ISDIR(inode->i_mode) ? DIRA : DATA;
-       bh = erofs_balloc(bmgr, type, erofs_pos(inode->sbi, nblocks), 0, 0);
+       bh = erofs_balloc(bmgr, type, erofs_pos(inode->sbi, nblocks), 0);
        if (IS_ERR(bh))
                return PTR_ERR(bh);
 
@@ -777,7 +777,7 @@ static int erofs_prepare_inode_buffer(struct erofs_inode 
*inode)
                        inode->datalayout = EROFS_INODE_FLAT_PLAIN;
        }
 
-       bh = erofs_balloc(bmgr, INODE, inodesize, 0, inode->idata_size);
+       bh = erofs_balloc(bmgr, INODE, inodesize, inode->idata_size);
        if (bh == ERR_PTR(-ENOSPC)) {
                int ret;
 
@@ -790,7 +790,7 @@ noinline:
                ret = erofs_prepare_tail_block(inode);
                if (ret)
                        return ret;
-               bh = erofs_balloc(bmgr, INODE, inodesize, 0, 0);
+               bh = erofs_balloc(bmgr, INODE, inodesize, 0);
                if (IS_ERR(bh))
                        return PTR_ERR(bh);
                DBG_BUGON(inode->bh_inline);
@@ -871,7 +871,7 @@ static int erofs_write_tail_end(struct erofs_inode *inode)
 
                if (!bh) {
                        bh = erofs_balloc(sbi->bmgr, DATA,
-                                         erofs_blksiz(sbi), 0, 0);
+                                         erofs_blksiz(sbi), 0);
                        if (IS_ERR(bh))
                                return PTR_ERR(bh);
                        bh->op = &erofs_skip_write_bhops;
@@ -1186,7 +1186,7 @@ static int erofs_inode_reserve_data_blocks(struct 
erofs_inode *inode)
        struct erofs_buffer_head *bh;
 
        /* allocate data blocks */
-       bh = erofs_balloc(sbi->bmgr, DATA, alignedsz, 0, 0);
+       bh = erofs_balloc(sbi->bmgr, DATA, alignedsz, 0);
        if (IS_ERR(bh))
                return PTR_ERR(bh);
 
diff --git a/lib/super.c b/lib/super.c
index d4cea50..6c8fa52 100644
--- a/lib/super.c
+++ b/lib/super.c
@@ -211,7 +211,7 @@ struct erofs_buffer_head *erofs_reserve_sb(struct 
erofs_bufmgr *bmgr)
        struct erofs_buffer_head *bh;
        int err;
 
-       bh = erofs_balloc(bmgr, META, 0, 0, 0);
+       bh = erofs_balloc(bmgr, META, 0, 0);
        if (IS_ERR(bh)) {
                erofs_err("failed to allocate super: %s",
                          erofs_strerror(PTR_ERR(bh)));
diff --git a/lib/xattr.c b/lib/xattr.c
index e420775..c95928e 100644
--- a/lib/xattr.c
+++ b/lib/xattr.c
@@ -924,7 +924,7 @@ int erofs_build_shared_xattrs_from_path(struct 
erofs_sb_info *sbi, const char *p
                return -ENOMEM;
        }
 
-       bh = erofs_balloc(sbi->bmgr, XATTR, shared_xattrs_size, 0, 0);
+       bh = erofs_balloc(sbi->bmgr, XATTR, shared_xattrs_size, 0);
        if (IS_ERR(bh)) {
                free(sorted_n);
                free(buf);
-- 
2.43.5

Reply via email to