ACPI / EC: Work around method reentrancy limit in ACPICA for _Qxx
[cascardo/linux.git] / drivers / staging / lustre / lustre / include / lustre_fld.h
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, 2015, Intel Corporation.
31  */
32 /*
33  * This file is part of Lustre, http://www.lustre.org/
34  * Lustre is a trademark of Sun Microsystems, Inc.
35  */
36
37 #ifndef __LINUX_FLD_H
38 #define __LINUX_FLD_H
39
40 /** \defgroup fld fld
41  *
42  * @{
43  */
44
45 #include "lustre/lustre_idl.h"
46 #include "../../include/linux/libcfs/libcfs.h"
47
48 struct lu_client_fld;
49 struct lu_server_fld;
50 struct lu_fld_hash;
51 struct fld_cache;
52
53 extern const struct dt_index_features fld_index_features;
54 extern const char fld_index_name[];
55
56 /*
57  * FLD (Fid Location Database) interface.
58  */
59 enum {
60         LUSTRE_CLI_FLD_HASH_DHT = 0,
61         LUSTRE_CLI_FLD_HASH_RRB
62 };
63
64 struct lu_fld_target {
65         struct list_head               ft_chain;
66         struct obd_export       *ft_exp;
67         struct lu_server_fld    *ft_srv;
68         __u64               ft_idx;
69 };
70
71 struct lu_server_fld {
72         /**
73          * super sequence controller export, needed to forward fld
74          * lookup  request.
75          */
76         struct obd_export       *lsf_control_exp;
77
78         /** Client FLD cache. */
79         struct fld_cache        *lsf_cache;
80
81         /** Protect index modifications */
82         struct mutex            lsf_lock;
83
84         /** Fld service name in form "fld-srv-lustre-MDTXXX" */
85         char                 lsf_name[LUSTRE_MDT_MAXNAMELEN];
86
87 };
88
89 struct lu_client_fld {
90         /** Client side debugfs entry. */
91         struct dentry           *lcf_debugfs_entry;
92
93         /** List of exports client FLD knows about. */
94         struct list_head               lcf_targets;
95
96         /** Current hash to be used to chose an export. */
97         struct lu_fld_hash      *lcf_hash;
98
99         /** Exports count. */
100         int                   lcf_count;
101
102         /** Lock protecting exports list and fld_hash. */
103         spinlock_t               lcf_lock;
104
105         /** Client FLD cache. */
106         struct fld_cache        *lcf_cache;
107
108         /** Client fld debugfs entry name. */
109         char                     lcf_name[LUSTRE_MDT_MAXNAMELEN];
110
111         int                      lcf_flags;
112 };
113
114 /* Client methods */
115 int fld_client_init(struct lu_client_fld *fld,
116                     const char *prefix, int hash);
117
118 void fld_client_fini(struct lu_client_fld *fld);
119
120 void fld_client_flush(struct lu_client_fld *fld);
121
122 int fld_client_lookup(struct lu_client_fld *fld, u64 seq, u32 *mds,
123                       __u32 flags, const struct lu_env *env);
124
125 int fld_client_create(struct lu_client_fld *fld,
126                       struct lu_seq_range *range,
127                       const struct lu_env *env);
128
129 int fld_client_delete(struct lu_client_fld *fld, u64 seq,
130                       const struct lu_env *env);
131
132 int fld_client_add_target(struct lu_client_fld *fld,
133                           struct lu_fld_target *tar);
134
135 int fld_client_del_target(struct lu_client_fld *fld,
136                           __u64 idx);
137
138 void fld_client_debugfs_fini(struct lu_client_fld *fld);
139
140 /** @} fld */
141
142 #endif