Whamcloud - gitweb
- change rename()/rename_tgt() format - source fid is used instead of object.
[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  *  Copyright (C) 2006 Cluster File Systems, Inc.
5  *
6  *   This file is part of Lustre, http://www.lustre.org.
7  *
8  *   Lustre is free software; you can redistribute it and/or
9  *   modify it under the terms of version 2 of the GNU General Public
10  *   License as published by the Free Software Foundation.
11  *
12  *   Lustre is distributed in the hope that it will be useful,
13  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
14  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  *   GNU General Public License for more details.
16  *
17  *   You should have received a copy of the GNU General Public License
18  *   along with Lustre; if not, write to the Free Software
19  *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20  *
21  */
22
23 #ifndef _CMM_MDC_INTERNAL_H
24 #define _CMM_MDC_INTERNAL_H
25
26 #if defined(__KERNEL__)
27
28 #include <lustre_net.h>
29 #include <obd.h>
30 #include <md_object.h>
31
32 struct mdc_cli_desc {
33         struct obd_connect_data  cl_conn_data;
34         struct obd_uuid          cl_cli_uuid;
35         struct obd_export        *cl_exp;
36 };
37
38 struct mdc_device {
39         struct md_device        mc_md_dev;
40         /* other MD servers in cluster */
41         struct list_head        mc_linkage;
42         __u32                   mc_num;
43         struct mdc_cli_desc     mc_desc;
44 };
45
46 #ifdef CMM_CODE
47 struct mdc_thread_info {
48         const struct lu_context *mci_ctxt;
49         struct md_op_data       mci_opdata;
50         struct ptlrpc_request   *mci_req;
51 };
52 #endif
53
54 struct mdc_object {
55         struct md_object        mco_obj;
56 };
57
58 static inline struct lu_device *mdc2lu_dev(struct mdc_device *mc)
59 {
60         return (&mc->mc_md_dev.md_lu_dev);
61 }
62
63 static inline struct mdc_device *md2mdc_dev(struct md_device *md)
64 {
65         return container_of0(md, struct mdc_device, mc_md_dev);
66 }
67
68 static inline struct mdc_device *mdc_obj2dev(struct mdc_object *mco)
69 {
70         return (md2mdc_dev(md_device_get(&mco->mco_obj)));
71 }
72
73 static inline struct mdc_object *lu2mdc_obj(struct lu_object *lo)
74 {
75         return container_of0(lo, struct mdc_object, mco_obj.mo_lu);
76 }
77
78 static inline struct mdc_object *md2mdc_obj(struct md_object *mo)
79 {
80         return container_of0(mo, struct mdc_object, mco_obj);
81 }
82
83 static inline struct mdc_device *lu2mdc_dev(struct lu_device *ld)
84 {
85         return container_of0(ld, struct mdc_device, mc_md_dev.md_lu_dev);
86 }
87
88 struct lu_object *mdc_object_alloc(const struct lu_context *,
89                                    const struct lu_object_header *,
90                                    struct lu_device *);
91 #endif /* __KERNEL__ */
92 #endif /* _CMM_MDC_INTERNAL_H */