@@ -1968,8 +1968,8 @@ static void bch2_do_discards_fast_work(struct work_struct *work)
19681968 break ;
19691969 }
19701970
1971- bch2_write_ref_put (c , BCH_WRITE_REF_discard_fast );
19721971 percpu_ref_put (& ca -> io_ref );
1972+ bch2_write_ref_put (c , BCH_WRITE_REF_discard_fast );
19731973}
19741974
19751975static void bch2_discard_one_bucket_fast (struct bch_dev * ca , u64 bucket )
@@ -1979,18 +1979,18 @@ static void bch2_discard_one_bucket_fast(struct bch_dev *ca, u64 bucket)
19791979 if (discard_in_flight_add (ca , bucket , false))
19801980 return ;
19811981
1982- if (!bch2_dev_get_ioref (c , ca -> dev_idx , WRITE ))
1982+ if (!bch2_write_ref_tryget (c , BCH_WRITE_REF_discard_fast ))
19831983 return ;
19841984
1985- if (!bch2_write_ref_tryget (c , BCH_WRITE_REF_discard_fast ))
1986- goto put_ioref ;
1985+ if (!bch2_dev_get_ioref (c , ca -> dev_idx , WRITE ))
1986+ goto put_ref ;
19871987
19881988 if (queue_work (c -> write_ref_wq , & ca -> discard_fast_work ))
19891989 return ;
19901990
1991- bch2_write_ref_put (c , BCH_WRITE_REF_discard_fast );
1992- put_ioref :
19931991 percpu_ref_put (& ca -> io_ref );
1992+ put_ref :
1993+ bch2_write_ref_put (c , BCH_WRITE_REF_discard_fast );
19941994}
19951995
19961996static int invalidate_one_bucket (struct btree_trans * trans ,
@@ -2132,26 +2132,26 @@ static void bch2_do_invalidates_work(struct work_struct *work)
21322132 bch2_trans_iter_exit (trans , & iter );
21332133err :
21342134 bch2_trans_put (trans );
2135- bch2_write_ref_put (c , BCH_WRITE_REF_invalidate );
21362135 percpu_ref_put (& ca -> io_ref );
2136+ bch2_write_ref_put (c , BCH_WRITE_REF_invalidate );
21372137}
21382138
21392139void bch2_dev_do_invalidates (struct bch_dev * ca )
21402140{
21412141 struct bch_fs * c = ca -> fs ;
21422142
2143- if (!bch2_dev_get_ioref (c , ca -> dev_idx , WRITE ))
2143+ if (!bch2_write_ref_tryget (c , BCH_WRITE_REF_invalidate ))
21442144 return ;
21452145
2146- if (!bch2_write_ref_tryget (c , BCH_WRITE_REF_invalidate ))
2147- goto put_ioref ;
2146+ if (!bch2_dev_get_ioref (c , ca -> dev_idx , WRITE ))
2147+ goto put_ref ;
21482148
21492149 if (queue_work (c -> write_ref_wq , & ca -> invalidate_work ))
21502150 return ;
21512151
2152- bch2_write_ref_put (c , BCH_WRITE_REF_invalidate );
2153- put_ioref :
21542152 percpu_ref_put (& ca -> io_ref );
2153+ put_ref :
2154+ bch2_write_ref_put (c , BCH_WRITE_REF_invalidate );
21552155}
21562156
21572157void bch2_do_invalidates (struct bch_fs * c )
0 commit comments