]> git.baikalelectronics.ru Git - kernel.git/commit
xfs: remove a superflous hash lookup when inserting new buffers
authorDave Chinner <dchinner@redhat.com>
Thu, 14 Jul 2022 02:04:43 +0000 (12:04 +1000)
committerDave Chinner <david@fromorbit.com>
Thu, 14 Jul 2022 02:04:43 +0000 (12:04 +1000)
commit578aecf2e3bb987c1667125463213d43adf57a28
tree3609c32414136ae8fd8df7d812283b0d784332c0
parentd97fe393133481ee1b96ddf15ba0af369236c1dd
xfs: remove a superflous hash lookup when inserting new buffers

Currently on the slow path insert we repeat the initial hash table
lookup before we attempt the insert, resulting in a two traversals
of the hash table to ensure the insert is valid. The rhashtable API
provides a method for an atomic lookup and insert operation, so we
can avoid one of the hash table traversals by using this method.

Adapted from a large patch containing this optimisation by Christoph
Hellwig.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
fs/xfs/xfs_buf.c