4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
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.
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).
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.gnu.org/licenses/gpl-2.0.html
23 * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
24 * Use is subject to license terms.
26 * Copyright (c) 2011, 2015, Intel Corporation.
29 * This file is part of Lustre, http://www.lustre.org/
30 * Lustre is a trademark of Sun Microsystems, Inc.
41 #include <uapi/linux/lustre/lustre_idl.h>
42 #include <libcfs/libcfs.h>
43 #include <seq_range.h>
44 #include <lustre_fid.h>
56 * FLD (Fid Location Database) interface.
59 LUSTRE_CLI_FLD_HASH_DHT = 0,
60 LUSTRE_CLI_FLD_HASH_RRB
63 struct lu_fld_target {
64 struct list_head ft_chain;
65 struct obd_export *ft_exp;
66 struct lu_server_fld *ft_srv;
70 struct lu_server_fld {
72 * Fld dir debugfs entry.
74 struct dentry *lsf_debugfs_entry;
77 * /fld file object device */
78 struct dt_object *lsf_obj;
81 * super sequence controller export, needed to forward fld
83 struct obd_export *lsf_control_exp;
86 * Client FLD cache. */
87 struct fld_cache *lsf_cache;
90 * Protect index modifications */
91 struct mutex lsf_lock;
94 * Fld service name in form "fld-srv-lustre-MDTXXX"
96 char lsf_name[LUSTRE_MDT_MAXNAMELEN];
98 int (*lsf_seq_lookup)(const struct lu_env *env,
99 struct lu_server_fld *fld, u64 seq,
100 struct lu_seq_range *range);
103 * Just reformatted or upgraded, and this flag is being
104 * used to check whether the local FLDB is needs to be
105 * synced with global FLDB(in MDT0), and it is only needed
106 * if the MDT is upgraded from < 2.6 to 2.6, i.e. when the
107 * local FLDB is being invited */
108 unsigned int lsf_new:1;
112 struct lu_client_fld {
114 * Client side debugfs entry.
116 struct dentry *lcf_debugfs_entry;
119 * List of exports client FLD knows about. */
120 struct list_head lcf_targets;
123 * Current hash to be used to chose an export. */
124 struct lu_fld_hash *lcf_hash;
131 * Lock protecting exports list and fld_hash. */
135 * Client FLD cache. */
136 struct fld_cache *lcf_cache;
139 * Client fld debugfs entry name.
141 char lcf_name[LUSTRE_MDT_MAXNAMELEN];
145 int fld_server_init(const struct lu_env *env, struct lu_server_fld *fld,
146 struct dt_device *dt, const char *prefix, int type);
148 void fld_server_fini(const struct lu_env *env, struct lu_server_fld *fld);
150 int fld_declare_server_create(const struct lu_env *env,
151 struct lu_server_fld *fld,
152 const struct lu_seq_range *range,
155 int fld_server_create(const struct lu_env *env,
156 struct lu_server_fld *fld,
157 const struct lu_seq_range *add_range,
160 int fld_insert_entry(const struct lu_env *env,
161 struct lu_server_fld *fld,
162 const struct lu_seq_range *range);
164 int fld_server_lookup(const struct lu_env *env, struct lu_server_fld *fld,
165 u64 seq, struct lu_seq_range *range);
167 int fld_local_lookup(const struct lu_env *env, struct lu_server_fld *fld,
168 u64 seq, struct lu_seq_range *range);
170 int fld_update_from_controller(const struct lu_env *env,
171 struct lu_server_fld *fld);
174 int fld_client_init(struct lu_client_fld *fld,
175 const char *prefix, int hash);
177 void fld_client_fini(struct lu_client_fld *fld);
179 void fld_client_flush(struct lu_client_fld *fld);
181 int fld_client_lookup(struct lu_client_fld *fld, u64 seq, u32 *mds,
182 __u32 flags, const struct lu_env *env);
184 int fld_client_create(struct lu_client_fld *fld,
185 struct lu_seq_range *range,
186 const struct lu_env *env);
188 int fld_client_delete(struct lu_client_fld *fld, u64 seq,
189 const struct lu_env *env);
191 int fld_client_add_target(struct lu_client_fld *fld,
192 struct lu_fld_target *tar);
194 int fld_client_del_target(struct lu_client_fld *fld,
197 void fld_client_debugfs_fini(struct lu_client_fld *fld);