Whamcloud - gitweb
LU-1303 osp: code to update per-OST last_id in OSP
[fs/lustre-release.git] / lustre / osp / osp_object.c
1 /*
2  * GPL HEADER START
3  *
4  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License version 2 only,
8  * as published by the Free Software Foundation.
9  *
10  * This program is distributed in the hope that it will be useful, but
11  * WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * General Public License version 2 for more details (a copy is included
14  * in the LICENSE file that accompanied this code).
15  *
16  * You should have received a copy of the GNU General Public License
17  * version 2 along with this program; If not, see
18  * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf
19  *
20  * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
21  * CA 95054 USA or visit www.sun.com if you need additional information or
22  * have any questions.
23  *
24  * GPL HEADER END
25  */
26 /*
27  * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
28  * Use is subject to license terms.
29  *
30  * Copyright (c) 2011, 2012, Intel, Inc.
31  */
32 /*
33  * This file is part of Lustre, http://www.lustre.org/
34  * Lustre is a trademark of Sun Microsystems, Inc.
35  *
36  * lustre/osp/osp_object.c
37  *
38  * Lustre OST Proxy Device
39  *
40  * Author: Alex Zhuravlev <alexey.zhuravlev@intel.com>
41  * Author: Mikhail Pershin <mike.tappro@intel.com>
42  */
43
44 #ifndef EXPORT_SYMTAB
45 # define EXPORT_SYMTAB
46 #endif
47 #define DEBUG_SUBSYSTEM S_MDS
48
49 #include "osp_internal.h"
50
51 struct dt_object_operations osp_obj_ops = {
52 };
53
54 static int osp_object_init(const struct lu_env *env, struct lu_object *o,
55                            const struct lu_object_conf *unused)
56 {
57         struct osp_object *po = lu2osp_obj(o);
58
59         po->opo_obj.do_ops = &osp_obj_ops;
60
61         return 0;
62 }
63
64 static void osp_object_free(const struct lu_env *env, struct lu_object *o)
65 {
66         struct osp_object       *obj = lu2osp_obj(o);
67         struct lu_object_header *h = o->lo_header;
68
69         dt_object_fini(&obj->opo_obj);
70         lu_object_header_fini(h);
71         OBD_SLAB_FREE_PTR(obj, osp_object_kmem);
72 }
73
74 static void osp_object_release(const struct lu_env *env, struct lu_object *o)
75 {
76         return;
77 }
78
79 static int osp_object_print(const struct lu_env *env, void *cookie,
80                             lu_printer_t p, const struct lu_object *l)
81 {
82         const struct osp_object *o = lu2osp_obj((struct lu_object *)l);
83
84         return (*p)(env, cookie, LUSTRE_OSP_NAME"-object@%p", o);
85 }
86
87 static int osp_object_invariant(const struct lu_object *o)
88 {
89         LBUG();
90 }
91
92 struct lu_object_operations osp_lu_obj_ops = {
93         .loo_object_init        = osp_object_init,
94         .loo_object_free        = osp_object_free,
95         .loo_object_release     = osp_object_release,
96         .loo_object_print       = osp_object_print,
97         .loo_object_invariant   = osp_object_invariant
98 };