@@ -710,24 +710,6 @@ static int z_erofs_attach_page(struct z_erofs_decompress_frontend *fe,
710
710
return ret ;
711
711
}
712
712
713
- static void z_erofs_try_to_claim_pcluster (struct z_erofs_decompress_frontend * f )
714
- {
715
- struct z_erofs_pcluster * pcl = f -> pcl ;
716
- z_erofs_next_pcluster_t * owned_head = & f -> owned_head ;
717
-
718
- /* type 1, nil pcluster (this pcluster doesn't belong to any chain.) */
719
- if (cmpxchg (& pcl -> next , Z_EROFS_PCLUSTER_NIL ,
720
- * owned_head ) == Z_EROFS_PCLUSTER_NIL ) {
721
- * owned_head = & pcl -> next ;
722
- /* so we can attach this pcluster to our submission chain. */
723
- f -> mode = Z_EROFS_PCLUSTER_FOLLOWED ;
724
- return ;
725
- }
726
-
727
- /* type 2, it belongs to an ongoing chain */
728
- f -> mode = Z_EROFS_PCLUSTER_INFLIGHT ;
729
- }
730
-
731
713
static int z_erofs_register_pcluster (struct z_erofs_decompress_frontend * fe )
732
714
{
733
715
struct erofs_map_blocks * map = & fe -> map ;
@@ -803,7 +785,6 @@ static int z_erofs_pcluster_begin(struct z_erofs_decompress_frontend *fe)
803
785
int ret ;
804
786
805
787
DBG_BUGON (fe -> pcl );
806
-
807
788
/* must be Z_EROFS_PCLUSTER_TAIL or pointed to previous pcluster */
808
789
DBG_BUGON (fe -> owned_head == Z_EROFS_PCLUSTER_NIL );
809
790
@@ -823,7 +804,15 @@ static int z_erofs_pcluster_begin(struct z_erofs_decompress_frontend *fe)
823
804
824
805
if (ret == - EEXIST ) {
825
806
mutex_lock (& fe -> pcl -> lock );
826
- z_erofs_try_to_claim_pcluster (fe );
807
+ /* check if this pcluster hasn't been linked into any chain. */
808
+ if (cmpxchg (& fe -> pcl -> next , Z_EROFS_PCLUSTER_NIL ,
809
+ fe -> owned_head ) == Z_EROFS_PCLUSTER_NIL ) {
810
+ /* .. so it can be attached to our submission chain */
811
+ fe -> owned_head = & fe -> pcl -> next ;
812
+ fe -> mode = Z_EROFS_PCLUSTER_FOLLOWED ;
813
+ } else { /* otherwise, it belongs to an inflight chain */
814
+ fe -> mode = Z_EROFS_PCLUSTER_INFLIGHT ;
815
+ }
827
816
} else if (ret ) {
828
817
return ret ;
829
818
}
0 commit comments