[PATCH v2 2/2] erofs: support reading chunk-based uncompressed files

Gao Xiang hsiangkao at linux.alibaba.com
Fri Aug 20 19:33:21 AEST 2021


On Fri, Aug 20, 2021 at 05:29:36PM +0800, Chao Yu wrote:
> On 2021/8/20 17:12, Gao Xiang wrote:
> > Hi Chao,
> > 
> > On Fri, Aug 20, 2021 at 05:04:13PM +0800, Chao Yu wrote:
> > > On 2021/8/19 14:33, Gao Xiang wrote:
> > 
> > ...
> > 
> > > >    }
> > > > +static int erofs_map_blocks(struct inode *inode,
> > > > +			    struct erofs_map_blocks *map, int flags)
> > > > +{
> > > > +	struct super_block *sb = inode->i_sb;
> > > > +	struct erofs_inode *vi = EROFS_I(inode);
> > > > +	struct erofs_inode_chunk_index *idx;
> > > > +	struct page *page;
> > > > +	u64 chunknr;
> > > > +	unsigned int unit;
> > > > +	erofs_off_t pos;
> > > > +	int err = 0;
> > > > +
> > > > +	if (map->m_la >= inode->i_size) {
> > > > +		/* leave out-of-bound access unmapped */
> > > > +		map->m_flags = 0;
> > > > +		map->m_plen = 0;
> > > > +		goto out;
> > > > +	}
> > > > +
> > > > +	if (vi->datalayout != EROFS_INODE_CHUNK_BASED)
> > > > +		return erofs_map_blocks_flatmode(inode, map, flags);
> > > > +
> > > > +	if (vi->chunkformat & EROFS_CHUNK_FORMAT_INDEXES)
> > > > +		unit = sizeof(*idx);	/* chunk index */
> > > > +	else
> > > > +		unit = 4;		/* block map */
> > > 
> > > You mean sizeof(__le32)?
> > 
> > Yeah, sizeof(__le32) == 4, either way works for me.
> > 
> > If some tendency about this, I will update when applying.
> 
> Xiang,
> 
> Yeah, I preper:
> 
> #define EROFS_BLOCK_MAP_ENTRY_SIZE	sizeof(__le32)
> 
> 	unit = EROFS_BLOCK_MAP_ENTRY_SIZE;
> 
> to improve readablity, but unit = sizeof(__le32) is fine as well.

Ok, looks much better, let me revise v3 here.

Thanks,
Gao Xiang

> 
> Thanks,
> 
> > 
> > > 
> > > Otherwise it looks good to me.
> > > 
> > > Reviewed-by: Chao Yu <chao at kernel.org>
> > > 
> > 
> > Thanks for the review!
> > 
> > Thanks,
> > Gao Xiang
> > 
> > > Thanks,
> > > 


More information about the Linux-erofs mailing list