Whamcloud - gitweb
LU-9679 osc: use overlapped() consistently. 02/37602/2
authorNeilBrown <neilb@suse.com>
Wed, 12 Dec 2018 07:20:36 +0000 (18:20 +1100)
committerOleg Drokin <green@whamcloud.com>
Sun, 1 Mar 2020 05:35:03 +0000 (05:35 +0000)
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 <adilger@whamcloud.com>
Signed-off-by: Mr NeilBrown <neilb@suse.com>
Change-Id: I3a3ed2ee04343a294ae94f205f5d12be98f99bf3
Reviewed-on: https://review.whamcloud.com/37602
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Wang Shilong <wshilong@ddn.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
lustre/osc/osc_cache.c

index 18c676a..38a64d1 100644 (file)
@@ -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.