aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging/lustre/lustre/osc/osc_object.c
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.com>2018-03-29 15:26:48 +1100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-04-23 15:16:58 +0200
commit05e6557b8ed833546ee2b66ce6b58fecf09f439e (patch)
treea2cd87c97111677ec5a30d5f82260482c1d64f9f /drivers/staging/lustre/lustre/osc/osc_object.c
parentstaging: lustre: rearrange placement of CPU partition management code. (diff)
downloadlinux-dev-05e6557b8ed833546ee2b66ce6b58fecf09f439e.tar.xz
linux-dev-05e6557b8ed833546ee2b66ce6b58fecf09f439e.zip
staging: lustre: add container_of_safe()
Luster has a container_of0() function which is similar to container_of() but passes an IS_ERR_OR_NULL() pointer through unchanged. This could be generally useful: bcache at last has a similar function. Naming is hard, but the precedent set by hlist_entry_safe() suggests a _safe suffix might be most consistent. So add container_of_safe() to kernel.h, and replace all occurrences of container_of0() with one of - list_first_entry, list_next_entry, when that is a better fit, - container_of(), when the pointer is used as a validpointer in surrounding code, - container_of_safe() when there is no obviously better alternative. Signed-off-by: NeilBrown <neilb@suse.com> Reviewed-by: James Simmons <jsimmons@infradead.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/lustre/lustre/osc/osc_object.c')
-rw-r--r--drivers/staging/lustre/lustre/osc/osc_object.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/staging/lustre/lustre/osc/osc_object.c b/drivers/staging/lustre/lustre/osc/osc_object.c
index 4f81dd16f4f5..84240181c7ea 100644
--- a/drivers/staging/lustre/lustre/osc/osc_object.c
+++ b/drivers/staging/lustre/lustre/osc/osc_object.c
@@ -58,7 +58,7 @@ static struct lu_object *osc2lu(struct osc_object *osc)
static struct osc_object *lu2osc(const struct lu_object *obj)
{
LINVRNT(osc_is_object(obj));
- return container_of0(obj, struct osc_object, oo_cl.co_lu);
+ return container_of(obj, struct osc_object, oo_cl.co_lu);
}
/*****************************************************************************