From: Geliang Tang Date: Tue, 20 Dec 2016 13:56:55 +0000 (+0800) Subject: LU-9679 osc: use rb_entry_safe X-Git-Tag: 2.13.53~134 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=refs%2Fchanges%2F04%2F37604%2F2;p=fs%2Flustre-release.git LU-9679 osc: use rb_entry_safe 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 Signed-off-by: Greg Kroah-Hartman Signed-off-by: Mr NeilBrown Change-Id: I9f8e19d45d859a6c7b7aa01093a1c2211063874c Reviewed-on: https://review.whamcloud.com/37604 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Wang Shilong Reviewed-by: James Simmons Reviewed-by: Oleg Drokin --- diff --git a/lustre/osc/osc_cache.c b/lustre/osc/osc_cache.c index 9bb9896..234e527 100644 --- a/lustre/osc/osc_cache.c +++ b/lustre/osc/osc_cache.c @@ -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)