[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20240814052111.GA30979@lst.de>
Date: Wed, 14 Aug 2024 07:21:11 +0200
From: Christoph Hellwig <hch@....de>
To: Dave Chinner <david@...morbit.com>
Cc: Christoph Hellwig <hch@....de>,
Chandan Babu R <chandan.babu@...cle.com>,
Matthew Wilcox <willy@...radead.org>,
"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 Wed, Aug 14, 2024 at 02:59:23PM +1000, Dave Chinner wrote:
> Can we split the implementation change and the API change into two
> separate patches, please?
I don't think that is entirely possible, but things can be split
a bit more. I've actually done some of that including more API
changes in the meantime, so this might only need small adjustments
anyway.
> So what's the overall plan for avoiding this sort of mess
> everywhere? Can we re-implement the existing iterators more
> efficiently with xarray iterators, or does xarray-based iteration
> require going back to the old way of open coding all iterations?
We can reimplement them, but they won't be more efficient. That
being said using the xas iterator for places that don't need to
unlock works really nicely, and I've added a little syntactic sugar
to make this even nicer as in:
rcu_read_lock();
for_each_perag_marked(mp, pag, XFS_PERAG_RECLAIM_MARK) {
/* do stuff */
}
rcu_read_unlock();
which is about as good as it gets in terms of efficiency and readability.
For the ones that need to sleep I'm now doing:
struct xfs_perag *pag = NULL;
while ((pag = xfs_iwalk_next_ag(mp, pag, XFS_PERAG_BLOCKGC_MARK))) {
/* do stuff */
}
which is also nice, and except for the _MARK stuff due to the sparse
__bitwise annotations can be one in a prep patch.
Powered by blists - more mailing lists