0003-erofs-utils-lib-fix-blobdev-without-Eforce-chunk-ind.patch 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. From eb255afa101b52096bd3e5e48f990576190f03bd Mon Sep 17 00:00:00 2001
  2. From: Gao Xiang <hsiangkao@linux.alibaba.com>
  3. Date: Thu, 23 Dec 2021 16:49:07 +0800
  4. Subject: [PATCH] erofs-utils: lib: fix --blobdev without -Eforce-chunk-indexes
  5. blockmap is used by default, chunk indexes should be switched
  6. instead if --blobdev is specified.
  7. Link: https://lore.kernel.org/r/20211223084907.93020-1-hsiangkao@linux.alibaba.com
  8. Fixes: 016bd812be1e ("erofs-utils: mkfs: enable block map chunk format")
  9. Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
  10. ---
  11. lib/blobchunk.c | 4 +++-
  12. 1 file changed, 3 insertions(+), 1 deletion(-)
  13. diff --git a/lib/blobchunk.c b/lib/blobchunk.c
  14. index 5e9a88a30af3..a145be917b4a 100644
  15. --- a/lib/blobchunk.c
  16. +++ b/lib/blobchunk.c
  17. @@ -113,7 +113,7 @@ int erofs_blob_write_chunk_indexes(struct erofs_inode *inode,
  18. if (multidev) {
  19. idx.device_id = 1;
  20. - inode->u.chunkformat |= EROFS_CHUNK_FORMAT_INDEXES;
  21. + DBG_BUGON(!(inode->u.chunkformat & EROFS_CHUNK_FORMAT_INDEXES));
  22. } else {
  23. base_blkaddr = remapped_base;
  24. }
  25. @@ -171,6 +171,8 @@ int erofs_blob_write_chunked_file(struct erofs_inode *inode)
  26. int fd, ret;
  27. inode->u.chunkformat |= inode->u.chunkbits - LOG_BLOCK_SIZE;
  28. + if (multidev)
  29. + inode->u.chunkformat |= EROFS_CHUNK_FORMAT_INDEXES;
  30. if (inode->u.chunkformat & EROFS_CHUNK_FORMAT_INDEXES)
  31. unit = sizeof(struct erofs_inode_chunk_index);
  32. --
  33. 2.30.2