@@ -143,22 +143,17 @@ static inline void z_erofs_onlinepage_split(struct page *page)
143
143
atomic_inc ((atomic_t * )& page -> private );
144
144
}
145
145
146
- static inline void z_erofs_page_mark_eio (struct page * page )
146
+ static void z_erofs_onlinepage_endio (struct page * page , int err )
147
147
{
148
- int orig ;
148
+ int orig , v ;
149
+
150
+ DBG_BUGON (!PagePrivate (page ));
149
151
150
152
do {
151
153
orig = atomic_read ((atomic_t * )& page -> private );
152
- } while (atomic_cmpxchg ((atomic_t * )& page -> private , orig ,
153
- orig | Z_EROFS_PAGE_EIO ) != orig );
154
- }
155
-
156
- static inline void z_erofs_onlinepage_endio (struct page * page )
157
- {
158
- unsigned int v ;
154
+ v = (orig - 1 ) | (err ? Z_EROFS_PAGE_EIO : 0 );
155
+ } while (atomic_cmpxchg ((atomic_t * )& page -> private , orig , v ) != orig );
159
156
160
- DBG_BUGON (!PagePrivate (page ));
161
- v = atomic_dec_return ((atomic_t * )& page -> private );
162
157
if (!(v & ~Z_EROFS_PAGE_EIO )) {
163
158
set_page_private (page , 0 );
164
159
ClearPagePrivate (page );
@@ -1067,9 +1062,7 @@ static int z_erofs_do_read_page(struct z_erofs_decompress_frontend *fe,
1067
1062
goto repeat ;
1068
1063
1069
1064
out :
1070
- if (err )
1071
- z_erofs_page_mark_eio (page );
1072
- z_erofs_onlinepage_endio (page );
1065
+ z_erofs_onlinepage_endio (page , err );
1073
1066
return err ;
1074
1067
}
1075
1068
@@ -1172,9 +1165,7 @@ static void z_erofs_fill_other_copies(struct z_erofs_decompress_backend *be,
1172
1165
cur += len ;
1173
1166
}
1174
1167
kunmap_local (dst );
1175
- if (err )
1176
- z_erofs_page_mark_eio (bvi -> bvec .page );
1177
- z_erofs_onlinepage_endio (bvi -> bvec .page );
1168
+ z_erofs_onlinepage_endio (bvi -> bvec .page , err );
1178
1169
list_del (p );
1179
1170
kfree (bvi );
1180
1171
}
@@ -1345,9 +1336,7 @@ static int z_erofs_decompress_pcluster(struct z_erofs_decompress_backend *be,
1345
1336
/* recycle all individual short-lived pages */
1346
1337
if (z_erofs_put_shortlivedpage (be -> pagepool , page ))
1347
1338
continue ;
1348
- if (err )
1349
- z_erofs_page_mark_eio (page );
1350
- z_erofs_onlinepage_endio (page );
1339
+ z_erofs_onlinepage_endio (page , err );
1351
1340
}
1352
1341
1353
1342
if (be -> decompressed_pages != be -> onstack_pages )
0 commit comments