From: Gao Xiang Date: Thu, 19 Dec 2024 06:43:28 +0000 (+0800) Subject: erofs-utils: lib: cache: get rid of required_ext X-Git-Tag: accepted/tizen/unified/20250610.081809~17 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=2d0a6b6b0681ef3a31f6b9d1234bee2d03737a3f;p=platform%2Fupstream%2Ferofs-utils.git erofs-utils: lib: cache: get rid of required_ext It's never used and doesn't have clear meanings. Signed-off-by: Gao Xiang Link: https://lore.kernel.org/r/20241219064331.2223001-1-hsiangkao@linux.alibaba.com --- 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 abbcba4..e6386d6 100644 --- a/lib/blobchunk.c +++ b/lib/blobchunk.c @@ -529,7 +529,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 cc7dce0..5ecb9c8 100644 --- a/lib/compress.c +++ b/lib/compress.c @@ -1480,7 +1480,7 @@ int erofs_mt_write_compressed_file(struct z_erofs_compress_ictx *ictx) erofs_off_t pstart, ptotal = 0; int ret; - 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; @@ -1681,7 +1681,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 91ff4ce..108aa9e 100644 --- a/lib/inode.c +++ b/lib/inode.c @@ -195,7 +195,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); @@ -757,7 +757,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; @@ -770,7 +770,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); @@ -852,7 +852,7 @@ static int erofs_write_tail_end(struct erofs_inode *inode) if (!bh) { bh = erofs_balloc(sbi->bmgr, S_ISDIR(inode->i_mode) ? DIRA: DATA, - erofs_blksiz(sbi), 0, 0); + erofs_blksiz(sbi), 0); if (IS_ERR(bh)) return PTR_ERR(bh); bh->op = &erofs_skip_write_bhops; @@ -1167,7 +1167,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 5b4c98d..68a96cc 100644 --- a/lib/xattr.c +++ b/lib/xattr.c @@ -930,7 +930,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);