Whamcloud - gitweb
LU-9679 osc: discard oe_intree 00/37600/7
authorNeilBrown <neilb@suse.com>
Wed, 12 Dec 2018 03:06:35 +0000 (14:06 +1100)
committerOleg Drokin <green@whamcloud.com>
Tue, 24 Mar 2020 05:15:38 +0000 (05:15 +0000)
An rbnode knows if it is in the tree or not, using RB_EMPTY_NODE().
There is no need for an extra flag.

Linux-Commit: a25a82301800 ("lustre: osc_cache: discard oe_intree")

Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Signed-off-by: Mr NeilBrown <neilb@suse.com>
Change-Id: Iddd4ef623d96c1cf2e0789343c02ecb095f7b6a1
Reviewed-on: https://review.whamcloud.com/37600
Reviewed-by: Wang Shilong <wshilong@ddn.com>
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/include/lustre_osc.h
lustre/osc/osc_cache.c

index 376830c..4c243ed 100644 (file)
@@ -900,9 +900,8 @@ struct osc_extent {
        /** state of this extent */
        enum osc_extent_state   oe_state;
        /** flags for this extent. */
-       unsigned int            oe_intree:1,
        /** 0 is write, 1 is read */
-                               oe_rw:1,
+       unsigned int            oe_rw:1,
        /** sync extent, queued by osc_queue_sync_pages() */
                                oe_sync:1,
        /** set if this extent has partial, sync pages.
index a9f2cc1..56fd9e4 100644 (file)
@@ -74,7 +74,7 @@ static inline char *ext_flags(struct osc_extent *ext, char *flags)
 {
        char *buf = flags;
        *buf++ = ext->oe_rw ? 'r' : 'w';
-       if (ext->oe_intree)
+       if (!RB_EMPTY_NODE(&ext->oe_node))
                *buf++ = 'i';
        if (ext->oe_sync)
                *buf++ = 'S';
@@ -154,7 +154,7 @@ static inline struct osc_extent *next_extent(struct osc_extent *ext)
        if (ext == NULL)
                return NULL;
 
-       LASSERT(ext->oe_intree);
+       LASSERT(!RB_EMPTY_NODE(&ext->oe_node));
        return rb_extent(rb_next(&ext->oe_node));
 }
 
@@ -163,7 +163,7 @@ static inline struct osc_extent *prev_extent(struct osc_extent *ext)
        if (ext == NULL)
                return NULL;
 
-       LASSERT(ext->oe_intree);
+       LASSERT(!RB_EMPTY_NODE(&ext->oe_node));
        return rb_extent(rb_prev(&ext->oe_node));
 }
 
@@ -359,7 +359,7 @@ static void osc_extent_put(const struct lu_env *env, struct osc_extent *ext)
                LASSERT(list_empty(&ext->oe_link));
                LASSERT(atomic_read(&ext->oe_users) == 0);
                LASSERT(ext->oe_state == OES_INV);
-               LASSERT(!ext->oe_intree);
+               LASSERT(RB_EMPTY_NODE(&ext->oe_node));
 
                if (ext->oe_dlmlock != NULL) {
                        lu_ref_del(&ext->oe_dlmlock->l_reference,
@@ -431,7 +431,7 @@ static void osc_extent_insert(struct osc_object *obj, struct osc_extent *ext)
        struct rb_node    *parent = NULL;
        struct osc_extent *tmp;
 
-       LASSERT(ext->oe_intree == 0);
+       LASSERT(RB_EMPTY_NODE(&ext->oe_node));
        LASSERT(ext->oe_obj == obj);
        assert_osc_object_is_locked(obj);
        while (*n != NULL) {
@@ -448,7 +448,6 @@ static void osc_extent_insert(struct osc_object *obj, struct osc_extent *ext)
        rb_link_node(&ext->oe_node, parent, n);
        rb_insert_color(&ext->oe_node, &obj->oo_root);
        osc_extent_get(ext);
-       ext->oe_intree = 1;
 }
 
 /* caller must have held object lock. */
@@ -456,9 +455,9 @@ static void osc_extent_erase(struct osc_extent *ext)
 {
        struct osc_object *obj = ext->oe_obj;
        assert_osc_object_is_locked(obj);
-       if (ext->oe_intree) {
+       if (!RB_EMPTY_NODE(&ext->oe_node)) {
                rb_erase(&ext->oe_node, &obj->oo_root);
-               ext->oe_intree = 0;
+               RB_CLEAR_NODE(&ext->oe_node);
                /* rbtree held a refcount */
                osc_extent_put_trust(ext);
        }