]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commit
xfs: get rid of unnecessary xfs_perag_{get,put} pairs
authorGao Xiang <hsiangkao@redhat.com>
Fri, 4 Sep 2020 20:00:20 +0000 (16:00 -0400)
committerEric Sandeen <sandeen@sandeen.net>
Fri, 4 Sep 2020 20:00:20 +0000 (16:00 -0400)
commit10c0a390aa7c54bbdf556d8db4c6fc6b1ada19b4
tree0e75064db9eae4879ee95df3713c991dbafd1f7b
parent1da5326f3e9472cbbfc89a605e21481f4affa81e
xfs: get rid of unnecessary xfs_perag_{get,put} pairs

Source kernel commit: 92a005448f6fed70b5e7a9f29a1f930118449f1b

In the course of some operations, we look up the perag from
the mount multiple times to get or change perag information.
These are often very short pieces of code, so while the
lookup cost is generally low, the cost of the lookup is far
higher than the cost of the operation we are doing on the
perag.

Since we changed buffers to hold references to the perag
they are cached in, many modification contexts already hold
active references to the perag that are held across these
operations. This is especially true for any operation that
is serialised by an allocation group header buffer.

In these cases, we can just use the buffer's reference to
the perag to avoid needing to do lookups to access the
perag. This means that many operations don't need to do
perag lookups at all to access the perag because they've
already looked up objects that own persistent references
and hence can use that reference instead.

Cc: Dave Chinner <dchinner@redhat.com>
Cc: "Darrick J. Wong" <darrick.wong@oracle.com>
Signed-off-by: Gao Xiang <hsiangkao@redhat.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
libxfs/xfs_ag.c
libxfs/xfs_ag_resv.h
libxfs/xfs_alloc.c
libxfs/xfs_alloc_btree.c
libxfs/xfs_ialloc.c
libxfs/xfs_refcount_btree.c
libxfs/xfs_rmap_btree.c