summaryrefslogtreecommitdiff
path: root/drivers/staging/erofs/data.c
diff options
context:
space:
mode:
authorGao Xiang <gaoxiang25@huawei.com>2019-06-24 15:22:51 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-06-26 09:44:39 +0800
commitec8c24420501d4cf3ed495c4d026984194897276 (patch)
tree9ecde9f14e9b774cd311059f78e710afe756b816 /drivers/staging/erofs/data.c
parente36472145aa706c186a6bb4f6419c613b0b1305c (diff)
staging: erofs: add compacted ondisk compression indexes
This patch introduces new compacted compression indexes. In contract to legacy compression indexes that each 4k logical cluster has an 8-byte index, compacted ondisk compression indexes will have amortized 2 bytes for each 4k logical cluster (compacted 2B) amortized 4 bytes for each 4k logical cluster (compacted 4B) In detail, several continuous clusters will be encoded in a compacted pack with cluster types, offsets, and one blkaddr at the end of the pack to leave 4-byte margin for better decoding performance, as illustrated below: _____________________________________________ |___@_____ encoded bits __________|_ blkaddr _| 0 . amortized * vcnt . . . . amortized * vcnt - 4 . . .___________________. |_type_|_clusterofs_| Note that compacted 2 / 4B should be aligned with 32 / 8 bytes in order to avoid each pack crossing page boundary. Reviewed-by: Chao Yu <yuchao0@huawei.com> Signed-off-by: Gao Xiang <gaoxiang25@huawei.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/erofs/data.c')
-rw-r--r--drivers/staging/erofs/data.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/staging/erofs/data.c b/drivers/staging/erofs/data.c
index 746685f90564..cc31c3e5984c 100644
--- a/drivers/staging/erofs/data.c
+++ b/drivers/staging/erofs/data.c
@@ -124,7 +124,7 @@ static int erofs_map_blocks_flatmode(struct inode *inode,
trace_erofs_map_blocks_flatmode_enter(inode, map, flags);
nblocks = DIV_ROUND_UP(inode->i_size, PAGE_SIZE);
- lastblk = nblocks - is_inode_layout_inline(inode);
+ lastblk = nblocks - is_inode_flat_inline(inode);
if (unlikely(offset >= inode->i_size)) {
/* leave out-of-bound access unmapped */
@@ -139,7 +139,7 @@ static int erofs_map_blocks_flatmode(struct inode *inode,
if (offset < blknr_to_addr(lastblk)) {
map->m_pa = blknr_to_addr(vi->raw_blkaddr) + map->m_la;
map->m_plen = blknr_to_addr(lastblk) - offset;
- } else if (is_inode_layout_inline(inode)) {
+ } else if (is_inode_flat_inline(inode)) {
/* 2 - inode inline B: inode, [xattrs], inline last blk... */
struct erofs_sb_info *sbi = EROFS_SB(inode->i_sb);