[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZroepUyYganq8UHJ@casper.infradead.org>
Date: Mon, 12 Aug 2024 15:39:33 +0100
From: Matthew Wilcox <willy@...radead.org>
To: Christoph Hellwig <hch@....de>
Cc: Chandan Babu R <chandan.babu@...cle.com>,
"Darrick J. Wong" <djwong@...nel.org>,
Andrew Morton <akpm@...ux-foundation.org>,
linux-xfs@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-fsdevel@...r.kernel.org
Subject: Re: [PATCH 2/3] xfs: convert perag lookup to xarray
On Mon, Aug 12, 2024 at 08:31:01AM +0200, Christoph Hellwig wrote:
> @@ -1020,14 +1016,16 @@ xfs_reclaim_inodes_count(
> struct xfs_mount *mp)
> {
> struct xfs_perag *pag;
> - xfs_agnumber_t ag = 0;
> + unsigned long index = 0;
> long reclaimable = 0;
>
> - while ((pag = xfs_perag_get_tag(mp, ag, XFS_ICI_RECLAIM_TAG))) {
> - ag = pag->pag_agno + 1;
> + rcu_read_lock();
> + xa_for_each_marked(&mp->m_perags, index, pag, XFS_ICI_RECLAIM_TAG) {
> + trace_xfs_reclaim_inodes_count(pag, _THIS_IP_);
> reclaimable += pag->pag_ici_reclaimable;
> - xfs_perag_put(pag);
> }
> + rcu_read_unlock();
Would you rather use xas_for_each_marked() here? O(n) rather than
O(n.log(n)).
Other than that, looks like a straightforward and correct conversion.
Powered by blists - more mailing lists