uint8_t z_algorithmtype[2];
uint8_t z_logical_clusterbits;
uint8_t z_physical_clusterblks;
- uint64_t z_tailextent_headlcn;
- unsigned int z_idataoff;
+ union {
+ uint64_t z_tailextent_headlcn;
+ erofs_off_t fragment_size;
+ };
+ union {
+ unsigned int z_idataoff;
+ erofs_off_t fragmentoff;
+ };
#define z_idata_size idata_size
};
};
#ifdef WITH_ANDROID
uint64_t capabilities;
#endif
- erofs_off_t fragmentoff;
- unsigned int fragment_size;
};
static inline erofs_off_t erofs_iloc(struct erofs_inode *inode)
/* try to fix again if it gets larger (should be rare) */
if (inode->fragment_size < newsize) {
- ctx->pclustersize = min(z_erofs_get_max_pclustersize(inode),
- roundup(newsize - inode->fragment_size,
- erofs_blksiz(sbi)));
+ ctx->pclustersize = min_t(erofs_off_t, z_erofs_get_max_pclustersize(inode),
+ roundup(newsize - inode->fragment_size,
+ erofs_blksiz(sbi)));
return false;
}
sbi->saved_by_deduplication += inode->fragment_size;
/* if the entire file is a fragment, a simplified form is used. */
- if (inode->i_size == inode->fragment_size) {
+ if (inode->i_size <= inode->fragment_size) {
+ DBG_BUGON(inode->i_size < inode->fragment_size);
DBG_BUGON(inode->fragmentoff >> 63);
*(__le64 *)compressmeta =
cpu_to_le64(inode->fragmentoff | 1ULL << 63);