Whamcloud - gitweb
LU-9679 osc: use rb_entry_safe 04/37604/2
authorGeliang Tang <geliangtang@gmail.com>
Tue, 20 Dec 2016 13:56:55 +0000 (21:56 +0800)
committerOleg Drokin <green@whamcloud.com>
Thu, 5 Mar 2020 22:35:30 +0000 (22:35 +0000)
Use rb_entry_safe() instead of container_of() to simplify the code.

Linux-Commit: e3e0293ca9b9 ("staging: lustre: osc: use rb_entry_safe")

Signed-off-by: Geliang Tang <geliangtang@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Mr NeilBrown <neilb@suse.de>
Change-Id: I9f8e19d45d859a6c7b7aa01093a1c2211063874c
Reviewed-on: https://review.whamcloud.com/37604
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>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/osc/osc_cache.c

index 9bb9896..234e527 100644 (file)
@@ -146,10 +146,7 @@ static const char *oes_strings[] = {
 
 static inline struct osc_extent *rb_extent(struct rb_node *n)
 {
-       if (n == NULL)
-               return NULL;
-
-       return container_of(n, struct osc_extent, oe_node);
+       return rb_entry_safe(n, struct osc_extent, oe_node);
 }
 
 static inline struct osc_extent *next_extent(struct osc_extent *ext)