From 6d6a85c53c7be07912e8d9e7fff4beb0871718e8 Mon Sep 17 00:00:00 2001 From: NeilBrown Date: Wed, 12 Dec 2018 18:20:36 +1100 Subject: [PATCH] LU-9679 osc: use overlapped() consistently. osc_extent_is_overlapped() open-codes exactly the test that overlapped() performs. So use overlapped() instead, to make the code more obviously consistent. Linux-Commit: 270995b08634 ("lustre: osc: use overlapped() consistently.") Reviewed-by: Andreas Dilger Signed-off-by: Mr NeilBrown Change-Id: I3a3ed2ee04343a294ae94f205f5d12be98f99bf3 Reviewed-on: https://review.whamcloud.com/37602 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Wang Shilong Reviewed-by: James Simmons --- lustre/osc/osc_cache.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/lustre/osc/osc_cache.c b/lustre/osc/osc_cache.c index 18c676a..38a64d1 100644 --- a/lustre/osc/osc_cache.c +++ b/lustre/osc/osc_cache.c @@ -280,6 +280,11 @@ out: __res; \ }) +static inline bool +overlapped(const struct osc_extent *ex1, const struct osc_extent *ex2) +{ + return !(ex1->oe_end < ex2->oe_start || ex2->oe_end < ex1->oe_start); +} /** * sanity check - to make sure there is no overlapped extent in the tree. @@ -297,8 +302,7 @@ static int osc_extent_is_overlapped(struct osc_object *obj, for (tmp = first_extent(obj); tmp != NULL; tmp = next_extent(tmp)) { if (tmp == ext) continue; - if (tmp->oe_end >= ext->oe_start && - tmp->oe_start <= ext->oe_end) + if (overlapped(tmp, ext)) return 1; } return 0; @@ -611,12 +615,6 @@ int osc_extent_release(const struct lu_env *env, struct osc_extent *ext) RETURN(rc); } -static inline bool -overlapped(const struct osc_extent *ex1, const struct osc_extent *ex2) -{ - return !(ex1->oe_end < ex2->oe_start || ex2->oe_end < ex1->oe_start); -} - /** * Find or create an extent which includes @index, core function to manage * extent tree. -- 1.8.3.1