@@ -65,6 +65,18 @@ static int xfs_icwalk_ag(struct xfs_perag *pag,
6565 XFS_ICWALK_FLAG_RECLAIM_SICK | \
6666 XFS_ICWALK_FLAG_UNION)
6767
68+ /* Marks for the perag xarray */
69+ #define XFS_PERAG_RECLAIM_MARK XA_MARK_0
70+ #define XFS_PERAG_BLOCKGC_MARK XA_MARK_1
71+
72+ static inline xa_mark_t ici_tag_to_mark (unsigned int tag )
73+ {
74+ if (tag == XFS_ICI_RECLAIM_TAG )
75+ return XFS_PERAG_RECLAIM_MARK ;
76+ ASSERT (tag == XFS_ICI_BLOCKGC_TAG );
77+ return XFS_PERAG_BLOCKGC_MARK ;
78+ }
79+
6880/*
6981 * Allocate and initialise an xfs_inode.
7082 */
@@ -191,7 +203,7 @@ xfs_reclaim_work_queue(
191203{
192204
193205 rcu_read_lock ();
194- if (radix_tree_tagged (& mp -> m_perag_tree , XFS_ICI_RECLAIM_TAG )) {
206+ if (xa_marked (& mp -> m_perags , XFS_PERAG_RECLAIM_MARK )) {
195207 queue_delayed_work (mp -> m_reclaim_workqueue , & mp -> m_reclaim_work ,
196208 msecs_to_jiffies (xfs_syncd_centisecs / 6 * 10 ));
197209 }
@@ -241,9 +253,7 @@ xfs_perag_set_inode_tag(
241253 return ;
242254
243255 /* propagate the tag up into the perag radix tree */
244- spin_lock (& mp -> m_perag_lock );
245- radix_tree_tag_set (& mp -> m_perag_tree , pag -> pag_agno , tag );
246- spin_unlock (& mp -> m_perag_lock );
256+ xa_set_mark (& mp -> m_perags , pag -> pag_agno , ici_tag_to_mark (tag ));
247257
248258 /* start background work */
249259 switch (tag ) {
@@ -285,9 +295,7 @@ xfs_perag_clear_inode_tag(
285295 return ;
286296
287297 /* clear the tag from the perag radix tree */
288- spin_lock (& mp -> m_perag_lock );
289- radix_tree_tag_clear (& mp -> m_perag_tree , pag -> pag_agno , tag );
290- spin_unlock (& mp -> m_perag_lock );
298+ xa_clear_mark (& mp -> m_perags , pag -> pag_agno , ici_tag_to_mark (tag ));
291299
292300 trace_xfs_perag_clear_inode_tag (pag , _RET_IP_ );
293301}
@@ -302,22 +310,18 @@ xfs_perag_get_next_tag(
302310 unsigned int tag )
303311{
304312 unsigned long index = 0 ;
305- int found ;
306313
307314 if (pag ) {
308315 index = pag -> pag_agno + 1 ;
309316 xfs_perag_rele (pag );
310317 }
311318
312319 rcu_read_lock ();
313- found = radix_tree_gang_lookup_tag (& mp -> m_perag_tree ,
314- (void * * )& pag , index , 1 , tag );
315- if (found <= 0 ) {
316- rcu_read_unlock ();
317- return NULL ;
320+ pag = xa_find (& mp -> m_perags , & index , ULONG_MAX , ici_tag_to_mark (tag ));
321+ if (pag ) {
322+ trace_xfs_perag_get_next_tag (pag , _RET_IP_ );
323+ atomic_inc (& pag -> pag_ref );
318324 }
319- trace_xfs_perag_get_next_tag (pag , _RET_IP_ );
320- atomic_inc (& pag -> pag_ref );
321325 rcu_read_unlock ();
322326 return pag ;
323327}
@@ -332,23 +336,19 @@ xfs_perag_grab_next_tag(
332336 int tag )
333337{
334338 unsigned long index = 0 ;
335- int found ;
336339
337340 if (pag ) {
338341 index = pag -> pag_agno + 1 ;
339342 xfs_perag_rele (pag );
340343 }
341344
342345 rcu_read_lock ();
343- found = radix_tree_gang_lookup_tag (& mp -> m_perag_tree ,
344- ( void * * ) & pag , index , 1 , tag );
345- if ( found <= 0 ) {
346- rcu_read_unlock ();
347- return NULL ;
346+ pag = xa_find (& mp -> m_perags , & index , ULONG_MAX , ici_tag_to_mark ( tag ));
347+ if ( pag ) {
348+ trace_xfs_perag_grab_next_tag ( pag , _RET_IP_ );
349+ if (! atomic_inc_not_zero ( & pag -> pag_active_ref ))
350+ pag = NULL ;
348351 }
349- trace_xfs_perag_grab_next_tag (pag , _RET_IP_ );
350- if (!atomic_inc_not_zero (& pag -> pag_active_ref ))
351- pag = NULL ;
352352 rcu_read_unlock ();
353353 return pag ;
354354}
@@ -1038,7 +1038,7 @@ xfs_reclaim_inodes(
10381038 if (xfs_want_reclaim_sick (mp ))
10391039 icw .icw_flags |= XFS_ICWALK_FLAG_RECLAIM_SICK ;
10401040
1041- while (radix_tree_tagged (& mp -> m_perag_tree , XFS_ICI_RECLAIM_TAG )) {
1041+ while (xa_marked (& mp -> m_perags , XFS_PERAG_RECLAIM_MARK )) {
10421042 xfs_ail_push_all_sync (mp -> m_ail );
10431043 xfs_icwalk (mp , XFS_ICWALK_RECLAIM , & icw );
10441044 }
0 commit comments