Skip to contentSkip to conversation

AOSP: erofs-utils: mkfs: remove block list implementation

PATCH In review Gao Xiang 2 participants 3 messages Apr 6, 2025 – Apr 11, 2025 Library code

lore
Share & tools
lore

Gao Xiang

author
#0 lore raw

PATCH 1/1 AOSP: erofs-utils: mkfs: remove block list implementation

The current Android doesn't use this method. Let's remove it for simplicity, as it's difficult to verify its functionality without setuping the Android environment.

Cc Kelvin Zhang <[email protected]>
---
 include/erofs/block_list.h | 20 ----------
 lib/blobchunk.c            | 11 ------
 lib/block_list.c           | 77 --------------------------------------
 lib/compress.c             |  3 --
 lib/inode.c                |  5 ---
 mkfs/main.c                | 13 -------
 6 files changed, 129 deletions(-)
include/erofs/block_list.h +0 -20
index 8cc87d7..9d06c9c 100644
@@ -18,26 +18,6 @@ FILE *erofs_blocklist_close(void);
 
 void tarerofs_blocklist_write(erofs_blk_t blkaddr, erofs_blk_t nblocks,
 			      erofs_off_t srcoff, unsigned int zeroedlen);
-#ifdef WITH_ANDROID
-void erofs_droid_blocklist_write(struct erofs_inode *inode,
-				 erofs_blk_t blk_start, erofs_blk_t nblocks);
-void erofs_droid_blocklist_write_tail_end(struct erofs_inode *inode,
-					  erofs_blk_t blkaddr);
-void erofs_droid_blocklist_write_extent(struct erofs_inode *inode,
-					erofs_blk_t blk_start, erofs_blk_t nblocks,
-					bool first_extent, bool last_extent);
-#else
-static inline void erofs_droid_blocklist_write(struct erofs_inode *inode,
-				 erofs_blk_t blk_start, erofs_blk_t nblocks) {}
-static inline void
-erofs_droid_blocklist_write_tail_end(struct erofs_inode *inode,
-					  erofs_blk_t blkaddr) {}
-static inline void
-erofs_droid_blocklist_write_extent(struct erofs_inode *inode,
-				   erofs_blk_t blk_start, erofs_blk_t nblocks,
-				   bool first_extent, bool last_extent) {}
-#endif
-
 #ifdef __cplusplus
 }
 #endif
lib/blobchunk.c +0 -11
index e6386d6..de9150f 100644
@@ -145,7 +145,6 @@ int erofs_blob_write_chunk_indexes(struct erofs_inode *inode,
 	erofs_blk_t extent_end, chunkblks;
 	erofs_off_t source_offset;
 	unsigned int dst, src, unit, zeroedlen;
-	bool first_extent = true;
 
 	if (inode->u.chunkformat & EROFS_CHUNK_FORMAT_INDEXES)
 		unit = sizeof(struct erofs_inode_chunk_index);
@@ -176,11 +175,6 @@ int erofs_blob_write_chunk_indexes(struct erofs_inode *inode,
 				tarerofs_blocklist_write(extent_start,
 						extent_end - extent_start,
 						source_offset, 0);
-				erofs_droid_blocklist_write_extent(inode,
-					extent_start,
-					extent_end - extent_start,
-					first_extent, false);
-				first_extent = false;
 			}
 			extent_start = idx.blkaddr;
 			source_offset = chunk->sourceoffset;
@@ -203,11 +197,6 @@ int erofs_blob_write_chunk_indexes(struct erofs_inode *inode,
 		tarerofs_blocklist_write(extent_start, extent_end - extent_start,
 					 source_offset, zeroedlen);
 	}
-	erofs_droid_blocklist_write_extent(inode, extent_start,
-			extent_start == EROFS_NULL_ADDR ?
-					0 : extent_end - extent_start,
-					   first_extent, true);
-
 	return erofs_dev_write(inode->sbi, inode->chunkindexes, off,
 			       inode->extent_isize);
 }
lib/block_list.c +0 -77

80 lines not on this page · raw message

lib/compress.c +0 -3
index 1742529..d046112 100644
@@ -1238,9 +1238,6 @@ int erofs_commit_compressed_file(struct z_erofs_compress_ictx *ictx,
 		DBG_BUGON(ret);
 	}
 	inode->compressmeta = compressmeta;
-	if (!erofs_is_packed_inode(inode))
-		erofs_droid_blocklist_write(inode, pstart >> bbits,
-					    inode->u.i_blocks);
 	return 0;
 
 err_free_meta:
lib/inode.c +0 -5
index 108aa9e..7a10624 100644
@@ -564,7 +564,6 @@ static int write_uncompressed_file_from_fd(struct erofs_inode *inode, int fd)
 			return -EIO;
 		}
 	}
-	erofs_droid_blocklist_write(inode, inode->u.i_blkaddr, nblocks);
 	return 0;
 }
 
@@ -843,8 +842,6 @@ static int erofs_write_tail_end(struct erofs_inode *inode)
 
 		ibh->fsprivate = erofs_igrab(inode);
 		ibh->op = &erofs_write_inline_bhops;
-
-		erofs_droid_blocklist_write_tail_end(inode, NULL_ADDR);
 	} else {
 		int ret;
 		erofs_off_t pos, zero_pos;
@@ -899,8 +896,6 @@ static int erofs_write_tail_end(struct erofs_inode *inode)
 		inode->idata_size = 0;
 		free(inode->idata);
 		inode->idata = NULL;
-
-		erofs_droid_blocklist_write_tail_end(inode, erofs_blknr(sbi, pos));
 	}
 out:
 	/* now bh_data can drop directly */
mkfs/main.c +0 -13
index 6d1a2de..2907789 100644
@@ -63,7 +63,6 @@ static struct option long_options[] = {
 #ifdef WITH_ANDROID
 	{"product-out", required_argument, NULL, 513},
 	{"fs-config-file", required_argument, NULL, 514},
-	{"block-list-file", required_argument, NULL, 515},
 #endif
 	{"ovlfs-strip", optional_argument, NULL, 516},
 	{"offset", required_argument, NULL, 517},
@@ -213,7 +212,6 @@ static void usage(int argc, char **argv)
 		"Android-specific options:\n"
 		" --product-out=X       X=product_out directory\n"
 		" --fs-config-file=X    X=fs_config file\n"
-		" --block-list-file=X   X=block_list file\n"
 #endif
 #ifdef EROFS_MT_ENABLED
 		, erofs_get_available_processors() /* --workers= */
@@ -723,9 +721,6 @@ static int mkfs_parse_options_cfg(int argc, char *argv[])
 		case 514:
 			cfg.fs_config_file = optarg;
 			break;
-		case 515:
-			cfg.block_list_file = optarg;
-			break;
 #endif
 		case 'C':
 			i = strtoull(optarg, &endptr, 0);
@@ -1241,14 +1236,6 @@ int main(int argc, char **argv)
 		erofs_err("failed to load fs config %s", cfg.fs_config_file);
 		return 1;
 	}
-
-	if (cfg.block_list_file) {
-		blklst = fopen(cfg.block_list_file, "w");
-		if (!blklst || erofs_blocklist_open(blklst, false)) {
-			erofs_err("failed to open %s", cfg.block_list_file);
-			return 1;
-		}
-	}
 #endif
 	erofs_show_config();
 	if (cfg.c_fragments || cfg.c_extra_ea_name_prefixes) {
Signature · 1 line
2.43.5
author
#2 lore raw

Hi Sandeep,

Quoted 6 lines · Sandeep Dhavale

Hi Gao,
I checked with Kelvin, and now AOSP has an EROFS image parser so block list functionality is redundant.

With that,

Thanks for your confirmation. Currently I have hard time, I will reply your patch this weekend.

Thanks,
Gao Xiang