Whamcloud - gitweb
b=22828 fix unnormalized Linux symbols
[fs/lustre-release.git] / lustre / cmm / mdc_internal.h
1 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
2  * vim:expandtab:shiftwidth=8:tabstop=8:
3  *
4  * GPL HEADER START
5  *
6  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License version 2 only,
10  * as published by the Free Software Foundation.
11  *
12  * This program is distributed in the hope that it will be useful, but
13  * WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * General Public License version 2 for more details (a copy is included
16  * in the LICENSE file that accompanied this code).
17  *
18  * You should have received a copy of the GNU General Public License
19  * version 2 along with this program; If not, see
20  * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf
21  *
22  * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
23  * CA 95054 USA or visit www.sun.com if you need additional information or
24  * have any questions.
25  *
26  * GPL HEADER END
27  */
28 /*
29  * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
30  * Use is subject to license terms.
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/cmm/mdc_internal.h
37  *
38  * Lustre Cluster Metadata Manager (cmm), MDC device
39  *
40  * Author: Mike Pershin <tappro@clusterfs.com>
41  */
42
43 #ifndef _CMM_MDC_INTERNAL_H
44 #define _CMM_MDC_INTERNAL_H
45
46 #if defined(__KERNEL__)
47
48 #include <lustre_net.h>
49 #include <obd.h>
50 #include <md_object.h>
51 /**
52  * \addtogroup cmm
53  * @{
54  */
55 /**
56  * \defgroup cmm_mdc cmm_mdc
57  *
58  * This is mdc wrapper device to work with old MDC obd-based devices.
59  * @{
60  */
61 /**
62  * MDC client description.
63  */
64 struct mdc_cli_desc {
65         /** uuid of remote MDT to connect */
66         struct obd_uuid          cl_srv_uuid;
67         /** mdc uuid */
68         struct obd_uuid          cl_cli_uuid;
69         /** export of mdc obd */
70         struct obd_export        *cl_exp;
71 };
72
73 /**
74  * MDC device.
75  */
76 struct mdc_device {
77         /** md_device instance for MDC */
78         struct md_device        mc_md_dev;
79         /** other MD servers in cluster */
80         cfs_list_t              mc_linkage;
81         /** number of current device */
82         mdsno_t                 mc_num;
83         /** mdc client description */
84         struct mdc_cli_desc     mc_desc;
85         /** Protects ??*/
86         cfs_semaphore_t         mc_fid_sem;
87 };
88
89 /**
90  * mdc thread info. Local storage for varios data.
91  */
92 struct mdc_thread_info {
93         /** Storage for md_op_data */
94         struct md_op_data       mci_opdata;
95         /** Storage for ptlrpc request */
96         struct ptlrpc_request  *mci_req;
97 };
98
99 /** mdc object. */
100 struct mdc_object {
101         /** md_object instance for mdc_object */
102         struct md_object        mco_obj;
103 };
104
105 /** Get lu_device from mdc_device. */
106 static inline struct lu_device *mdc2lu_dev(struct mdc_device *mc)
107 {
108         return (&mc->mc_md_dev.md_lu_dev);
109 }
110
111 /** Get mdc_device from md_device. */
112 static inline struct mdc_device *md2mdc_dev(struct md_device *md)
113 {
114         return container_of0(md, struct mdc_device, mc_md_dev);
115 }
116
117 /** Get mdc_device from mdc_object. */
118 static inline struct mdc_device *mdc_obj2dev(struct mdc_object *mco)
119 {
120         return (md2mdc_dev(md_obj2dev(&mco->mco_obj)));
121 }
122
123 /** Get mdc_object from lu_object. */
124 static inline struct mdc_object *lu2mdc_obj(struct lu_object *lo)
125 {
126         return container_of0(lo, struct mdc_object, mco_obj.mo_lu);
127 }
128
129 /** Get mdc_object from md_object. */
130 static inline struct mdc_object *md2mdc_obj(struct md_object *mo)
131 {
132         return container_of0(mo, struct mdc_object, mco_obj);
133 }
134
135 /** Get mdc_device from lu_device. */
136 static inline struct mdc_device *lu2mdc_dev(struct lu_device *ld)
137 {
138         return container_of0(ld, struct mdc_device, mc_md_dev.md_lu_dev);
139 }
140
141 struct lu_object *mdc_object_alloc(const struct lu_env *,
142                                    const struct lu_object_header *,
143                                    struct lu_device *);
144
145 void cmm_mdc_init_ea_size(const struct lu_env *env, struct mdc_device *mc,
146                       int max_mdsize, int max_cookiesize);
147 #ifdef HAVE_SPLIT_SUPPORT
148 int mdc_send_page(struct cmm_device *cmm, const struct lu_env *env,
149                   struct md_object *mo, struct page *page, __u32 end);
150 #endif
151 /** @} */
152 /** @} */
153 #endif /* __KERNEL__ */
154 #endif /* _CMM_MDC_INTERNAL_H */