From: NeilBrown Date: Wed, 12 Dec 2018 07:20:36 +0000 (+1100) Subject: LU-9679 osc: use overlapped() consistently. X-Git-Tag: 2.13.53~178 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=6d6a85c53c7be07912e8d9e7fff4beb0871718e8;ds=sidebyside 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 --- 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.