Skip to content

Commit 004a365

Browse files
committed
Merge tag 'erofs-for-6.15-rc2-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs
Pull erofs fixes from Gao Xiang: - Properly handle errors when file-backed I/O fails - Fix compilation issues on ARM platform (arm-linux-gnueabi) - Fix parsing of encoded extents - Minor cleanup * tag 'erofs-for-6.15-rc2-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs: erofs: remove duplicate code erofs: fix encoded extents handling erofs: add __packed annotation to union(__le16..) erofs: set error to bio if file-backed IO fails
2 parents 5aaaedb + f5ffef9 commit 004a365

File tree

4 files changed

+9
-7
lines changed

4 files changed

+9
-7
lines changed

fs/erofs/erofs_fs.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ struct erofs_super_block {
5656
union {
5757
__le16 rootnid_2b; /* nid of root directory */
5858
__le16 blocks_hi; /* (48BIT on) blocks count MSB */
59-
} rb;
59+
} __packed rb;
6060
__le64 inos; /* total valid ino # (== f_files - f_favail) */
6161
__le64 epoch; /* base seconds used for compact inodes */
6262
__le32 fixed_nsec; /* fixed nanoseconds for compact inodes */
@@ -148,7 +148,7 @@ union erofs_inode_i_nb {
148148
__le16 nlink; /* if EROFS_I_NLINK_1_BIT is unset */
149149
__le16 blocks_hi; /* total blocks count MSB */
150150
__le16 startblk_hi; /* starting block number MSB */
151-
};
151+
} __packed;
152152

153153
/* 32-byte reduced form of an ondisk inode */
154154
struct erofs_inode_compact {
@@ -369,9 +369,9 @@ struct z_erofs_map_header {
369369
* bit 7 : pack the whole file into packed inode
370370
*/
371371
__u8 h_clusterbits;
372-
};
372+
} __packed;
373373
__le16 h_extents_hi; /* extent count MSB */
374-
};
374+
} __packed;
375375
};
376376

377377
enum {

fs/erofs/fileio.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ static void erofs_fileio_ki_complete(struct kiocb *iocb, long ret)
3232
ret = 0;
3333
}
3434
if (rq->bio.bi_end_io) {
35+
if (ret < 0 && !rq->bio.bi_status)
36+
rq->bio.bi_status = errno_to_blk_status(ret);
3537
rq->bio.bi_end_io(&rq->bio);
3638
} else {
3739
bio_for_each_folio_all(fi, &rq->bio) {

fs/erofs/zdata.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -725,7 +725,6 @@ static int z_erofs_register_pcluster(struct z_erofs_frontend *fe)
725725
lockref_init(&pcl->lockref); /* one ref for this request */
726726
pcl->algorithmformat = map->m_algorithmformat;
727727
pcl->pclustersize = map->m_plen;
728-
pcl->pageofs_in = pageofs_in;
729728
pcl->length = 0;
730729
pcl->partial = true;
731730
pcl->next = fe->head;

fs/erofs/zmap.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -559,7 +559,8 @@ static int z_erofs_map_blocks_ext(struct inode *inode,
559559
pos += sizeof(__le64);
560560
lstart = 0;
561561
} else {
562-
lstart = map->m_la >> vi->z_lclusterbits;
562+
lstart = round_down(map->m_la, 1 << vi->z_lclusterbits);
563+
pos += (lstart >> vi->z_lclusterbits) * recsz;
563564
pa = EROFS_NULL_ADDR;
564565
}
565566

@@ -614,7 +615,7 @@ static int z_erofs_map_blocks_ext(struct inode *inode,
614615
if (last && (vi->z_advise & Z_EROFS_ADVISE_FRAGMENT_PCLUSTER)) {
615616
map->m_flags |= EROFS_MAP_MAPPED | EROFS_MAP_FRAGMENT;
616617
vi->z_fragmentoff = map->m_plen;
617-
if (recsz >= offsetof(struct z_erofs_extent, pstart_lo))
618+
if (recsz > offsetof(struct z_erofs_extent, pstart_lo))
618619
vi->z_fragmentoff |= map->m_pa << 32;
619620
} else if (map->m_plen) {
620621
map->m_flags |= EROFS_MAP_MAPPED |

0 commit comments

Comments
 (0)