Whamcloud - gitweb
LU-11085 ldlm: simplify use of interval-tree. 21/33221/28
authorNeilBrown <neilb@suse.de>
Wed, 25 Mar 2020 02:50:16 +0000 (22:50 -0400)
committerOleg Drokin <green@whamcloud.com>
Tue, 21 May 2024 18:20:04 +0000 (18:20 +0000)
commitc5b8ac83bdc199e564df3a9c3636e9ad89c03ef3
treef370eee809e58ca9e169dc8be0d9d3f27d7cfc78
parent3ba393a5cb21ff0f8bd8a09c341ee01e936321c7
LU-11085 ldlm: simplify use of interval-tree.

The interval tree used for keeping track of extent locks is currently
separate from those locks themselves.  A separate 'ldlm_interval'
structure is allocated and linked to all locks which have the same
extent.

This requires that the interval tree library handles an insert where
exactly the same interval already exists differently from any other
insert.  No other users of the interval tree library wants this, and
the library which is part of linux doesn't support it.  So it would be
good to remove this requirement.

This patch changes the library, removes the 'ldlm_interval' structure,
and stores each lock in the tree.  This substantially simplifies a lot
of code, but has some costs.

The ldlm_lock is now larger - it contains three pointers for the
rbtree where previously it had one, and it now has an extra copy of
the range start/end.  These will be resolved in later patches by
removing duplication and sharing space with other fields that aren't
used for extent locks.

The extent-tree can now be substantially larger as it now contains
every lock for a given extent rather than each extent only once.  As
the depth of the tree grows with the log of the number of elements,
this isn't an enormous cost, but it may still be measurable.  In
particular, locks that cover the full extent [0..MAX] are common and
can swamp other locks (citation needed).  Such locks can be easily
kept in a separate list.  This will restore some of the code
complexity, but is otherwise of little cost.

Linux-commit: 71236833ad7a98b69e6e675efefbdc04a74c1d4b

Change-Id: I6c82d971aabd02bb036ac0bd27a934d48e972895
Signed-off-by: NeilBrown <neilb@suse.de>
Signed-off-by: James Simmons <jsimmons@infradead.org>
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/33221
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Yang Sheng <ys@whamcloud.com>
lustre/include/lustre_dlm.h
lustre/ldlm/ldlm_extent.c
lustre/ldlm/ldlm_flock.c
lustre/ldlm/ldlm_internal.h
lustre/ldlm/ldlm_lock.c
lustre/ldlm/ldlm_lockd.c
lustre/obdclass/interval_tree.c
lustre/ofd/ofd_dlm.c