erofs-utils: lib/cache.c: replace &g_sbi with sbi
PATCH v2 1/2 erofs-utils: lib/cache.c: replace &g_sbi with sbi
Prepare for the upcoming per-sbi buffer.
Signed-off-by Hongzhen Luo <[email protected]>
---
v2: Changes since v1: remain unchanged
v1: https://lore.kernel.org/all/[email protected]/
--- include/erofs/cache.h | 9 ++++++--- lib/cache.c | 28 +++++++++++++++++----------- 2 files changed, 23 insertions(+), 14 deletions(-)
include/erofs/cache.h +6 -3
@@ -55,15 +55,17 @@ struct erofs_buffer_block {static inline const int get_alignsize (int type,int *type_ret) { +struct erofs_sb_info *sbi = &g_sbi; +if (type ==DATA ) -return erofs_blksiz (&g_sbi); +return erofs_blksiz (sbi);if (type ==INODE ) { *type_ret =META ;return sizeof (struct erofs_inode_compact ); }else if (type ==DIRA ) { *type_ret =META ; -return erofs_blksiz (&g_sbi); +return erofs_blksiz (sbi); }else if (type ==XATTR ) { *type_ret =META ;return sizeof (struct erofs_xattr_entry );
@@ -83,11 +85,12 @@ extern const struct erofs_bhops erofs_skip_write_bhops;static inline erofs_off_t erofs_btell (struct erofs_buffer_head *bh,bool end) {const struct erofs_buffer_block *bb = bh->block; +struct erofs_sb_info *sbi = &g_sbi;if (bb->blkaddr ==NULL_ADDR )return NULL_ADDR_UL ; -return erofs_pos (&g_sbi, bb->blkaddr) + +return erofs_pos (sbi, bb->blkaddr) + (end ?list_next_entry (bh, list)->off : bh->off); }
lib/cache.c +17 -11
@@ -51,12 +51,13 @@ void erofs_buffer_init(erofs_blk_t startblk)static void erofs_bupdate_mapped (struct erofs_buffer_block *bb) {struct list_head *bkt; +struct erofs_sb_info *sbi = &g_sbi;if (bb->blkaddr ==NULL_ADDR )return ; bkt = mapped_buckets[bb->type] + - (bb->buffers.off & (erofs_blksiz (&g_sbi) -1 )); + (bb->buffers.off & (erofs_blksiz (sbi) -1 ));list_del (&bb->mapped_list);list_add_tail (&bb->mapped_list, bkt); }
@@ -69,7 +70,8 @@ static int __erofs_battach(struct erofs_buffer_block *bb, unsigned int extrasize, bool dryrun) { -const unsigned int blksiz =erofs_blksiz (&g_sbi); +struct erofs_sb_info *sbi = &g_sbi; +const unsigned int blksiz =erofs_blksiz (sbi);const unsigned int blkmask = blksiz -1 ;erofs_off_t boff = bb->buffers.off;const erofs_off_t alignedoffset =roundup (boff, alignsize);
@@ -86,7 +88,7 @@ static int __erofs_battach(struct erofs_buffer_block *bb, blkaddr = bb->blkaddr;if (blkaddr !=NULL_ADDR ) { tailupdate = (tail_blkaddr == blkaddr + -BLK_ROUND_UP (&g_sbi, boff)); +BLK_ROUND_UP (sbi, boff));if (oob && !tailupdate)return -EINVAL ; }
@@ -102,7 +104,7 @@ static int __erofs_battach(struct erofs_buffer_block *bb, bb->buffers.off = boff;/* need to update the tail_blkaddr */ if (tailupdate) - tail_blkaddr = blkaddr +BLK_ROUND_UP (&g_sbi, boff); + tail_blkaddr = blkaddr +BLK_ROUND_UP (sbi, boff);erofs_bupdate_mapped (bb); }return ((alignedoffset + incr -1 ) & blkmask) +1 ;
@@ -125,7 +127,8 @@ static int erofs_bfind_for_attach(int type, erofs_off_t size,unsigned int alignsize, struct erofs_buffer_block **bbp) { -const unsigned int blksiz =erofs_blksiz (&g_sbi); + struct erofs_sb_info *sbi = &g_sbi; +const unsigned int blksiz =erofs_blksiz (sbi);struct erofs_buffer_block *cur, *bb;unsigned int used0, used_before, usedmax, used;int ret;
@@ -315,6 +318,7 @@ struct erofs_buffer_head *erofs_battach(struct erofs_buffer_head *bh,static erofs_blk_t __erofs_mapbh (struct erofs_buffer_block *bb) {erofs_blk_t blkaddr; +struct erofs_sb_info *sbi = &g_sbi;if (bb->blkaddr ==NULL_ADDR ) { bb->blkaddr = tail_blkaddr;
@@ -322,7 +326,7 @@ static erofs_blk_t __erofs_mapbh(struct erofs_buffer_block *bb)erofs_bupdate_mapped (bb); } - blkaddr = bb->blkaddr +BLK_ROUND_UP (&g_sbi, bb->buffers.off); + blkaddr = bb->blkaddr +BLK_ROUND_UP (sbi, bb->buffers.off);if (blkaddr > tail_blkaddr) tail_blkaddr = blkaddr;
@@ -360,7 +364,8 @@ static void erofs_bfree(struct erofs_buffer_block *bb)int erofs_bflush (struct erofs_buffer_block *bb) { -const unsigned int blksiz =erofs_blksiz (&g_sbi); +struct erofs_sb_info *sbi = &g_sbi; +const unsigned int blksiz =erofs_blksiz (sbi);struct erofs_buffer_block *p, *n;erofs_blk_t blkaddr;
@@ -392,11 +397,11 @@ int erofs_bflush(struct erofs_buffer_block *bb) padding = blksiz - (p->buffers.off & (blksiz -1 ));if (padding != blksiz) -erofs_dev_fillzero (&g_sbi,erofs_pos (&g_sbi, blkaddr) - padding, +erofs_dev_fillzero (sbi,erofs_pos (sbi, blkaddr) - padding, padding, true);if (p->type !=DATA ) - erofs_metablkcnt +=BLK_ROUND_UP (&g_sbi, p->buffers.off); + erofs_metablkcnt +=BLK_ROUND_UP (sbi, p->buffers.off);erofs_dbg ("block %u to %u flushed" , p->blkaddr, blkaddr -1 );erofs_bfree (p); }
@@ -408,10 +413,11 @@ void erofs_bdrop(struct erofs_buffer_head *bh, bool tryrevoke)struct erofs_buffer_block *const bb = bh->block;const erofs_blk_t blkaddr = bh->block->blkaddr;bool rollback = false; +struct erofs_sb_info *sbi = &g_sbi;/* tail_blkaddr could be rolled back after revoking all bhs */ if (tryrevoke && blkaddr !=NULL_ADDR && - tail_blkaddr == blkaddr +BLK_ROUND_UP (&g_sbi, bb->buffers.off)) + tail_blkaddr == blkaddr +BLK_ROUND_UP (sbi, bb->buffers.off)) rollback = true; bh->op = &erofs_drop_directly_bhops;
@@ -421,7 +427,7 @@ void erofs_bdrop(struct erofs_buffer_head *bh, bool tryrevoke)return ;if (!rollback && bb->type !=DATA ) - erofs_metablkcnt +=BLK_ROUND_UP (&g_sbi, bb->buffers.off); + erofs_metablkcnt +=BLK_ROUND_UP (sbi, bb->buffers.off);erofs_bfree (bb);if (rollback) tail_blkaddr = blkaddr;
Signature · 1 line
2.43.5
PATCH v2 2/2 erofs-utils: add per-sbi buffer support
This updates all relevant function definitions and callers to get rid of the global g_sbi, making it suitable for external use in liberofs.
Signed-off-by Hongzhen Luo <[email protected]>
---
v2: Changes since v1: utilize bb->buffers.fsprivate to store sbi to minimize code changes.
v1: https://lore.kernel.org/all/[email protected]/
--- include/erofs/cache.h | 31 ++++++--- include/erofs/internal.h | 5 +- lib/blobchunk.c | 10 +-- lib/cache.c | 135 +++++++++++++++++++++++---------------- lib/compress.c | 16 ++--- lib/inode.c | 23 +++---- lib/super.c | 11 ++-- lib/xattr.c | 4 +- mkfs/main.c | 15 +++-- 9 files changed, 146 insertions(+), 104 deletions(-)
include/erofs/cache.h +22 -9
@@ -53,10 +53,20 @@ struct erofs_buffer_block {struct erofs_buffer_head buffers; }; -static inline const int get_alignsize (int type,int *type_ret) -{ -struct erofs_sb_info *sbi = &g_sbi; +struct erofs_buffer_manager { +struct erofs_buffer_block blkh; +erofs_blk_t tail_blkaddr, erofs_metablkcnt; + +/* buckets for all mapped buffer blocks to boost up allocation */ +struct list_head mapped_buckets[META +1 ][EROFS_MAX_BLOCK_SIZE ]; +/* last mapped buffer block to accelerate erofs_mapbh() */ +struct erofs_buffer_block *last_mapped_block; +}; + +static inline const int get_alignsize (struct erofs_sb_info *sbi,int type, +int *type_ret) +{if (type ==DATA )return erofs_blksiz (sbi);
@@ -85,7 +95,7 @@ extern const struct erofs_bhops erofs_skip_write_bhops;static inline erofs_off_t erofs_btell (struct erofs_buffer_head *bh,bool end) {const struct erofs_buffer_block *bb = bh->block; -struct erofs_sb_info *sbi = &g_sbi; +struct erofs_sb_info *sbi = (struct erofs_sb_info *)bb->buffers.fsprivate;if (bb->blkaddr ==NULL_ADDR )return NULL_ADDR_UL ;
@@ -101,20 +111,23 @@ static inline int erofs_bh_flush_generic_end(struct erofs_buffer_head *bh)return 0 ; } -void erofs_buffer_init (erofs_blk_t startblk); +void erofs_buffer_init (struct erofs_sb_info *sbi,erofs_blk_t startblk);int erofs_bh_balloon (struct erofs_buffer_head *bh,erofs_off_t incr); -struct erofs_buffer_head *erofs_balloc (int type,erofs_off_t size, +struct erofs_buffer_head *erofs_balloc (struct erofs_sb_info *sbi, +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); -erofs_blk_t erofs_mapbh (struct erofs_buffer_block *bb); -int erofs_bflush (struct erofs_buffer_block *bb); +erofs_blk_t erofs_mapbh (struct erofs_sb_info *sbi, +struct erofs_buffer_block *bb); +int erofs_bflush (struct erofs_sb_info *sbi,struct erofs_buffer_block *bb);void erofs_bdrop (struct erofs_buffer_head *bh,bool tryrevoke); -erofs_blk_t erofs_total_metablocks (void ); +erofs_blk_t erofs_total_metablocks (struct erofs_sb_info *sbi); +void erofs_buffer_exit (struct erofs_sb_info *sbi); #ifdef __cplusplus }
include/erofs/internal.h +4 -1
@@ -58,6 +58,7 @@ extern struct erofs_sb_info g_sbi; (roundup(addr, erofs_blksiz(sbi)) >> (sbi)->blkszbits)struct erofs_buffer_head ; +struct erofs_buffer_manager ;struct erofs_device_info {u8 tag[64 ];
@@ -132,6 +133,8 @@ struct erofs_sb_info {struct erofs_mkfs_dfops *mkfs_dfops;#endif bool useqpl; + +struct erofs_buffer_manager *bmngr; };#define EROFS_SUPER_END (EROFS_SUPER_OFFSET + sizeof(struct erofs_super_block))
@@ -402,7 +405,7 @@ int erofs_read_superblock(struct erofs_sb_info *sbi);void erofs_put_super (struct erofs_sb_info *sbi);int erofs_writesb (struct erofs_sb_info *sbi,struct erofs_buffer_head *sb_bh,erofs_blk_t *blocks); -struct erofs_buffer_head *erofs_reserve_sb (void ); +struct erofs_buffer_head *erofs_reserve_sb (struct erofs_sb_info *sbi);int erofs_enable_sb_chksum (struct erofs_sb_info *sbi,u32 *crc);/* namei.c */
lib/blobchunk.c +5 -5
@@ -496,7 +496,7 @@ int erofs_mkfs_dump_blobs(struct erofs_sb_info *sbi)unsigned int i, ret;erofs_blk_t nblocks; - nblocks =erofs_mapbh (NULL ); + nblocks =erofs_mapbh (sbi,NULL ); pos_out =erofs_btell (bh_devt, false); i =0 ; do {
@@ -517,11 +517,11 @@ int erofs_mkfs_dump_blobs(struct erofs_sb_info *sbi)return 0 ; } - bh =erofs_balloc (DATA , datablob_size,0 ,0 ); + bh =erofs_balloc (sbi,DATA , datablob_size,0 ,0 );if (IS_ERR (bh))return PTR_ERR (bh); -erofs_mapbh (bh->block); +erofs_mapbh (sbi, bh->block); pos_out =erofs_btell (bh, false); remapped_base =erofs_blknr (sbi, pos_out);
@@ -626,13 +626,13 @@ int erofs_mkfs_init_devices(struct erofs_sb_info *sbi, unsigned int devices)if (!sbi->devs)return -ENOMEM ; - bh_devt =erofs_balloc (DEVT , + bh_devt =erofs_balloc (sbi,DEVT ,sizeof (struct erofs_deviceslot ) * devices,0 ,0 );if (IS_ERR (bh_devt)) {free (sbi->devs);return PTR_ERR (bh_devt); } -erofs_mapbh (bh_devt->block); +erofs_mapbh (sbi, bh_devt->block); bh_devt->op = &erofs_skip_write_bhops; sbi->devt_slotoff =erofs_btell (bh_devt, false) /EROFS_DEVT_SLOT_SIZE ; sbi->extra_devices = devices;
lib/cache.c +79 -56
309 lines not on this page · raw message
lib/compress.c +8 -8
@@ -1366,14 +1366,14 @@ 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 (DATA ,0 ,0 ,0 ); + bh =erofs_balloc (ictx->inode->sbi,DATA ,0 ,0 ,0 );if (IS_ERR (bh)) { ret =PTR_ERR (bh); goto out; }DBG_BUGON (!head); - blkaddr =erofs_mapbh (bh->block); + blkaddr =erofs_mapbh (ictx->inode->sbi, bh->block); ret =0 ; do {
@@ -1531,12 +1531,12 @@ int erofs_write_compressed_file(struct z_erofs_compress_ictx *ictx)#endif /* allocate main data buffer */ - bh =erofs_balloc (DATA ,0 ,0 ,0 ); + bh =erofs_balloc (inode->sbi,DATA ,0 ,0 ,0 );if (IS_ERR (bh)) { ret =PTR_ERR (bh); goto err_free_idata; } - blkaddr =erofs_mapbh (bh->block);/* start_blkaddr */ + blkaddr =erofs_mapbh (inode->sbi, bh->block);/* start_blkaddr */ ictx->seg_num =1 ; sctx = (struct z_erofs_compress_sctx ) {
@@ -1601,7 +1601,7 @@ static int z_erofs_build_compr_cfgs(struct erofs_sb_info *sbi,DBG_BUGON (1 );return PTR_ERR (bh); } -erofs_mapbh (bh->block); +erofs_mapbh (sbi, bh->block); ret =erofs_dev_write (sbi, &lz4alg,erofs_btell (bh, false),sizeof (lz4alg)); bh->op = &erofs_drop_directly_bhops;
@@ -1625,7 +1625,7 @@ static int z_erofs_build_compr_cfgs(struct erofs_sb_info *sbi,DBG_BUGON (1 );return PTR_ERR (bh); } -erofs_mapbh (bh->block); +erofs_mapbh (sbi, bh->block); ret =erofs_dev_write (sbi, &lzmaalg,erofs_btell (bh, false),sizeof (lzmaalg)); bh->op = &erofs_drop_directly_bhops;
@@ -1649,7 +1649,7 @@ static int z_erofs_build_compr_cfgs(struct erofs_sb_info *sbi,DBG_BUGON (1 );return PTR_ERR (bh); } -erofs_mapbh (bh->block); +erofs_mapbh (sbi, bh->block); ret =erofs_dev_write (sbi, &zalg,erofs_btell (bh, false),sizeof (zalg)); bh->op = &erofs_drop_directly_bhops;
@@ -1672,7 +1672,7 @@ static int z_erofs_build_compr_cfgs(struct erofs_sb_info *sbi,DBG_BUGON (1 );return PTR_ERR (bh); } -erofs_mapbh (bh->block); +erofs_mapbh (sbi, bh->block); ret =erofs_dev_write (sbi, &zalg,erofs_btell (bh, false),sizeof (zalg)); bh->op = &erofs_drop_directly_bhops;
lib/inode.c +12 -11
@@ -186,7 +186,8 @@ static int __allocate_inode_bh_data(struct erofs_inode *inode, }/* allocate main data buffer */ - bh =erofs_balloc (type,erofs_pos (inode->sbi, nblocks),0 ,0 ); + bh =erofs_balloc (inode->sbi, type,erofs_pos (inode->sbi, nblocks), +0 ,0 );if (IS_ERR (bh))return PTR_ERR (bh);
@@ -194,7 +195,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); + ret =erofs_mapbh (inode->sbi, bh->block);DBG_BUGON (ret <0 );/* write blocks except for the tail-end block */
@@ -314,7 +315,7 @@ erofs_nid_t erofs_lookupnid(struct erofs_inode *inode)erofs_off_t off, meta_offset;if (bh && (long long )inode->nid <=0 ) { -erofs_mapbh (bh->block); +erofs_mapbh (sbi, bh->block); off =erofs_btell (bh, false); meta_offset =erofs_pos (sbi, sbi->meta_blkaddr);
@@ -768,7 +769,7 @@ static int erofs_prepare_inode_buffer(struct erofs_inode *inode) inode->datalayout =EROFS_INODE_FLAT_PLAIN ; } - bh =erofs_balloc (INODE , inodesize,0 , inode->idata_size); + bh =erofs_balloc (inode->sbi,INODE , inodesize,0 , inode->idata_size);if (bh ==ERR_PTR (-ENOSPC )) {int ret;
@@ -781,7 +782,7 @@ noinline: ret =erofs_prepare_tail_block (inode);if (ret)return ret; - bh =erofs_balloc (INODE , inodesize,0 ,0 ); + bh =erofs_balloc (inode->sbi,INODE , inodesize,0 ,0 );if (IS_ERR (bh))return PTR_ERR (bh);DBG_BUGON (inode->bh_inline);
@@ -860,13 +861,13 @@ static int erofs_write_tail_end(struct erofs_inode *inode)erofs_off_t pos, zero_pos;if (!bh) { - bh =erofs_balloc (DATA ,erofs_blksiz (sbi),0 ,0 ); + bh =erofs_balloc (sbi,DATA ,erofs_blksiz (sbi),0 ,0 );if (IS_ERR (bh))return PTR_ERR (bh); bh->op = &erofs_skip_write_bhops;/* get blkaddr of bh */ - ret =erofs_mapbh (bh->block); + ret =erofs_mapbh (sbi, bh->block); inode->u.i_blkaddr = bh->block->blkaddr; inode->bh_data = bh; }else {
@@ -879,7 +880,7 @@ static int erofs_write_tail_end(struct erofs_inode *inode) } inode->lazy_tailblock = false; } - ret =erofs_mapbh (bh->block); + ret =erofs_mapbh (sbi, bh->block); }DBG_BUGON (ret <0 ); pos =erofs_btell (bh, true) -erofs_blksiz (sbi);
@@ -1157,7 +1158,7 @@ static void erofs_fixup_meta_blkaddr(struct erofs_inode *rootdir)struct erofs_sb_info *sbi = rootdir->sbi;erofs_off_t off, meta_offset; -erofs_mapbh (bh->block); +erofs_mapbh (sbi, bh->block); off =erofs_btell (bh, false);if (off > rootnid_maxoffset)
@@ -1176,12 +1177,12 @@ static int erofs_inode_reserve_data_blocks(struct erofs_inode *inode)struct erofs_buffer_head *bh;/* allocate data blocks */ - bh =erofs_balloc (DATA , alignedsz,0 ,0 ); + bh =erofs_balloc (sbi,DATA , alignedsz,0 ,0 );if (IS_ERR (bh))return PTR_ERR (bh);/* get blkaddr of the bh */ - (void )erofs_mapbh (bh->block); + (void )erofs_mapbh (sbi, bh->block);/* write blocks except for the tail-end block */ inode->u.i_blkaddr = bh->block->blkaddr;
lib/super.c +6 -5
@@ -149,6 +149,7 @@ void erofs_put_super(struct erofs_sb_info *sbi) sbi->devs =NULL ; }erofs_xattr_prefixes_cleanup (sbi); +erofs_buffer_exit (sbi); } int erofs_writesb(struct erofs_sb_info *sbi, struct erofs_buffer_head *sb_bh,
@@ -176,7 +177,7 @@ int erofs_writesb(struct erofs_sb_info *sbi, struct erofs_buffer_head *sb_bh,char *buf;int ret; - *blocks =erofs_mapbh (NULL ); + *blocks =erofs_mapbh (sbi,NULL ); sb.blocks =cpu_to_le32 (*blocks);memcpy (sb.uuid, sbi->uuid,sizeof (sb.uuid));memcpy (sb.volume_name, sbi->volume_name,sizeof (sb.volume_name));
@@ -202,13 +203,13 @@ int erofs_writesb(struct erofs_sb_info *sbi, struct erofs_buffer_head *sb_bh,return ret; } -struct erofs_buffer_head *erofs_reserve_sb (void ) +struct erofs_buffer_head *erofs_reserve_sb (struct erofs_sb_info *sbi) {struct erofs_buffer_head *bh;int err; -erofs_buffer_init (0 ); - bh =erofs_balloc (META ,0 ,0 ,0 ); +erofs_buffer_init (sbi,0 ); + bh =erofs_balloc (sbi,META ,0 ,0 ,0 );if (IS_ERR (bh)) {erofs_err ("failed to allocate super: %s" ,PTR_ERR (bh));return bh;
@@ -221,7 +222,7 @@ struct erofs_buffer_head *erofs_reserve_sb(void) }/* make sure that the super block should be the very first blocks */ - (void )erofs_mapbh (bh->block); + (void )erofs_mapbh (sbi, bh->block);if (erofs_btell (bh, false) !=0 ) {erofs_err ("failed to pin super block @ 0" ); err = -EFAULT ;
lib/xattr.c +2 -2
@@ -906,7 +906,7 @@ int erofs_build_shared_xattrs_from_path(struct erofs_sb_info *sbi, const char *preturn -ENOMEM ; } - bh =erofs_balloc (XATTR , shared_xattrs_size,0 ,0 ); + bh =erofs_balloc (sbi,XATTR , shared_xattrs_size,0 ,0 );if (IS_ERR (bh)) {free (sorted_n);free (buf);
@@ -914,7 +914,7 @@ int erofs_build_shared_xattrs_from_path(struct erofs_sb_info *sbi, const char *p } bh->op = &erofs_skip_write_bhops; -erofs_mapbh (bh->block); +erofs_mapbh (sbi, bh->block); off =erofs_btell (bh, false); sbi->xattr_blkaddr = off /erofs_blksiz (sbi);
mkfs/main.c +8 -7
@@ -1105,7 +1105,7 @@ static int erofs_mkfs_rebuild_load_trees(struct erofs_inode *root)return 0 ; } -static void erofs_mkfs_showsummaries (erofs_blk_t nblocks) +static void erofs_mkfs_showsummaries (struct erofs_sb_info *sbi,erofs_blk_t nblocks) {char uuid_str[37 ] = {};char *incr = incremental_mode ?"new" :"total" ;
@@ -1121,7 +1121,7 @@ static void erofs_mkfs_showsummaries(erofs_blk_t nblocks)"Filesystem %s metadata blocks: %u\n" "Filesystem %s deduplicated bytes (of source files): %llu\n" , uuid_str, nblocks,1U << g_sbi.blkszbits, g_sbi.inos |0ULL , - incr,erofs_total_metablocks (), + incr,erofs_total_metablocks (sbi), incr, g_sbi.saved_by_deduplication | 0ULL); }
@@ -1245,7 +1245,7 @@ int main(int argc, char **argv) }if (!incremental_mode) { - sb_bh =erofs_reserve_sb (); + sb_bh =erofs_reserve_sb (&g_sbi);if (IS_ERR (sb_bh)) { err =PTR_ERR (sb_bh); goto exit;
@@ -1270,7 +1270,7 @@ int main(int argc, char **argv) u.startblk =DIV_ROUND_UP (u.st.st_size,erofs_blksiz (&g_sbi)); else u.startblk = g_sbi.primarydevice_blocks; -erofs_buffer_init (u.startblk); +erofs_buffer_init (&g_sbi, u.startblk); sb_bh =NULL ; }
@@ -1392,7 +1392,7 @@ int main(int argc, char **argv) }/* flush all buffers except for the superblock */ - err =erofs_bflush (NULL ); + err =erofs_bflush (&g_sbi,NULL );if (err) goto exit;
@@ -1405,7 +1405,7 @@ int main(int argc, char **argv) goto exit;/* flush all remaining buffers */ - err =erofs_bflush (NULL ); + err =erofs_bflush (&g_sbi,NULL );if (err) goto exit;
@@ -1448,6 +1448,7 @@ exit:return 1 ; }erofs_update_progressinfo ("Build completed.\n" ); -erofs_mkfs_showsummaries (nblocks); +erofs_mkfs_showsummaries (&g_sbi, nblocks); +erofs_put_super (&g_sbi);return 0 ; }
Signature · 1 line
2.43.5