@@ -57,8 +57,7 @@ static int z_erofs_fill_inode_lazy(struct inode *inode)
57
57
58
58
pos = ALIGN (iloc (EROFS_SB (sb ), vi -> nid ) + vi -> inode_isize +
59
59
vi -> xattr_isize , 8 );
60
- kaddr = erofs_read_metabuf (& buf , sb , erofs_blknr (pos ),
61
- EROFS_KMAP_ATOMIC );
60
+ kaddr = erofs_read_metabuf (& buf , sb , erofs_blknr (pos ), EROFS_KMAP );
62
61
if (IS_ERR (kaddr )) {
63
62
err = PTR_ERR (kaddr );
64
63
goto out_unlock ;
@@ -73,7 +72,7 @@ static int z_erofs_fill_inode_lazy(struct inode *inode)
73
72
vi -> z_advise = Z_EROFS_ADVISE_FRAGMENT_PCLUSTER ;
74
73
vi -> z_fragmentoff = le64_to_cpu (* (__le64 * )h ) ^ (1ULL << 63 );
75
74
vi -> z_tailextent_headlcn = 0 ;
76
- goto unmap_done ;
75
+ goto done ;
77
76
}
78
77
vi -> z_advise = le16_to_cpu (h -> h_advise );
79
78
vi -> z_algorithmtype [0 ] = h -> h_algorithmtype & 15 ;
@@ -85,7 +84,7 @@ static int z_erofs_fill_inode_lazy(struct inode *inode)
85
84
erofs_err (sb , "unknown HEAD%u format %u for nid %llu, please upgrade kernel" ,
86
85
headnr + 1 , vi -> z_algorithmtype [headnr ], vi -> nid );
87
86
err = - EOPNOTSUPP ;
88
- goto unmap_done ;
87
+ goto out_put_metabuf ;
89
88
}
90
89
91
90
vi -> z_logical_clusterbits = LOG_BLOCK_SIZE + (h -> h_clusterbits & 7 );
@@ -95,20 +94,16 @@ static int z_erofs_fill_inode_lazy(struct inode *inode)
95
94
erofs_err (sb , "per-inode big pcluster without sb feature for nid %llu" ,
96
95
vi -> nid );
97
96
err = - EFSCORRUPTED ;
98
- goto unmap_done ;
97
+ goto out_put_metabuf ;
99
98
}
100
99
if (vi -> datalayout == EROFS_INODE_FLAT_COMPRESSION &&
101
100
!(vi -> z_advise & Z_EROFS_ADVISE_BIG_PCLUSTER_1 ) ^
102
101
!(vi -> z_advise & Z_EROFS_ADVISE_BIG_PCLUSTER_2 )) {
103
102
erofs_err (sb , "big pcluster head1/2 of compact indexes should be consistent for nid %llu" ,
104
103
vi -> nid );
105
104
err = - EFSCORRUPTED ;
106
- goto unmap_done ;
105
+ goto out_put_metabuf ;
107
106
}
108
- unmap_done :
109
- erofs_put_metabuf (& buf );
110
- if (err )
111
- goto out_unlock ;
112
107
113
108
if (vi -> z_advise & Z_EROFS_ADVISE_INLINE_PCLUSTER ) {
114
109
struct erofs_map_blocks map = {
@@ -127,7 +122,7 @@ static int z_erofs_fill_inode_lazy(struct inode *inode)
127
122
err = - EFSCORRUPTED ;
128
123
}
129
124
if (err < 0 )
130
- goto out_unlock ;
125
+ goto out_put_metabuf ;
131
126
}
132
127
133
128
if (vi -> z_advise & Z_EROFS_ADVISE_FRAGMENT_PCLUSTER &&
@@ -141,11 +136,14 @@ static int z_erofs_fill_inode_lazy(struct inode *inode)
141
136
EROFS_GET_BLOCKS_FINDTAIL );
142
137
erofs_put_metabuf (& map .buf );
143
138
if (err < 0 )
144
- goto out_unlock ;
139
+ goto out_put_metabuf ;
145
140
}
141
+ done :
146
142
/* paired with smp_mb() at the beginning of the function */
147
143
smp_mb ();
148
144
set_bit (EROFS_I_Z_INITED_BIT , & vi -> flags );
145
+ out_put_metabuf :
146
+ erofs_put_metabuf (& buf );
149
147
out_unlock :
150
148
clear_and_wake_up_bit (EROFS_I_BL_Z_BIT , & vi -> flags );
151
149
return err ;
0 commit comments