Whamcloud - gitweb
LU-19098 hsm: don't print progname twice with lhsmtool
[fs/lustre-release.git] / lustre / obdclass / local_storage.h
index 7ff6faa..3142abd 100644 (file)
@@ -1,34 +1,17 @@
-/*
- * GPL HEADER START
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 only,
- * as published by the Free Software Foundation.
-
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License version 2 for more details.  A copy is
- * included in the COPYING file that accompanied this code.
+/* SPDX-License-Identifier: GPL-2.0 */
 
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * GPL HEADER END
- */
 /*
  * Copyright (c) 2012, 2014, Intel Corporation.
  */
+
 /*
- * lustre/obdclass/local_storage.c
+ * This file is part of Lustre, http://www.lustre.org/
  *
  * Local storage for file/objects with fid generation. Works on top of OSD.
  *
  * Author: Mikhail Pershin <mike.pershin@intel.com>
  */
+
 #ifndef __LOCAL_STORAGE_H
 #define __LOCAL_STORAGE_H
 
@@ -42,7 +25,7 @@ struct ls_device {
        /* all initialized ls_devices on this node linked by this */
        struct list_head         ls_linkage;
        /* how many handle's reference this local storage */
-       atomic_t                 ls_refcount;
+       struct kref              ls_refcount;
        /* underlaying OSD device */
        struct dt_device        *ls_osd;
        /* list of all local OID storages */
@@ -52,7 +35,7 @@ struct ls_device {
 
 static inline struct ls_device *dt2ls_dev(struct dt_device *d)
 {
-       return container_of0(d, struct ls_device, ls_top_dev);
+       return container_of_safe(d, struct ls_device, ls_top_dev);
 }
 
 struct ls_object {
@@ -62,7 +45,7 @@ struct ls_object {
 
 static inline struct ls_object *lu2ls_obj(struct lu_object *o)
 {
-       return container_of0(o, struct ls_object, ls_obj.do_lu);
+       return container_of_safe(o, struct ls_object, ls_obj.do_lu);
 }
 
 static inline struct dt_object *ls_locate(const struct lu_env *env,
@@ -74,7 +57,7 @@ static inline struct dt_object *ls_locate(const struct lu_env *env,
                            &ls->ls_top_dev.dd_lu_dev, conf);
 }
 
-struct ls_device *ls_device_get(struct dt_device *dev);
+struct ls_device *ls_device_find_or_init(struct dt_device *dev);
 void ls_device_put(const struct lu_env *env, struct ls_device *ls);
 struct local_oid_storage *dt_los_find(struct ls_device *ls, __u64 seq);
 void dt_los_put(struct local_oid_storage *los);