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.sun.com/software/products/lustre/docs/GPLv2.pdf
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
27 * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
28 * Use is subject to license terms.
30 * Copyright (c) 2011, 2012, Whamcloud, Inc.
33 * This file is part of Lustre, http://www.lustre.org/
34 * Lustre is a trademark of Sun Microsystems, Inc.
45 #include <lustre/lustre_idl.h>
46 #include <lustre_mdt.h>
47 #include <dt_object.h>
49 #include <libcfs/libcfs.h>
56 extern const struct dt_index_features fld_index_features;
57 extern const char fld_index_name[];
60 * FLD (Fid Location Database) interface.
63 LUSTRE_CLI_FLD_HASH_DHT = 0,
64 LUSTRE_CLI_FLD_HASH_RRB
68 struct lu_fld_target {
70 struct obd_export *ft_exp;
71 struct lu_server_fld *ft_srv;
75 struct lu_server_fld {
77 * Fld dir proc entry. */
78 cfs_proc_dir_entry_t *lsf_proc_dir;
81 * /fld file object device */
82 struct dt_object *lsf_obj;
85 * super sequence controller export, needed to forward fld
87 struct obd_export *lsf_control_exp;
90 * Client FLD cache. */
91 struct fld_cache *lsf_cache;
94 * Protect index modifications */
95 struct mutex lsf_lock;
98 * Fld service name in form "fld-srv-lustre-MDTXXX" */
102 * Backend does not support range lookups,
103 * indexes other that 0 will be prohibited */
104 int lsf_no_range_lookup;
107 struct lu_client_fld {
109 * Client side proc entry. */
110 cfs_proc_dir_entry_t *lcf_proc_dir;
113 * List of exports client FLD knows about. */
114 cfs_list_t lcf_targets;
117 * Current hash to be used to chose an export. */
118 struct lu_fld_hash *lcf_hash;
125 * Lock protecting exports list and fld_hash. */
129 * Client FLD cache. */
130 struct fld_cache *lcf_cache;
133 * Client fld proc entry name. */
136 const struct lu_context *lcf_ctx;
142 * number of blocks to reserve for particular operations. Should be function of
143 * ... something. Stub for now.
146 /* one insert operation can involve two delete and one insert */
147 FLD_TXN_INDEX_INSERT_CREDITS = 60,
148 FLD_TXN_INDEX_DELETE_CREDITS = 20,
151 int fld_query(struct com_thread_info *info);
154 int fld_server_init(struct lu_server_fld *fld,
155 struct dt_device *dt,
157 const struct lu_env *env,
160 void fld_server_fini(struct lu_server_fld *fld,
161 const struct lu_env *env);
163 int fld_declare_server_create(struct lu_server_fld *fld,
164 const struct lu_env *env,
167 int fld_server_create(struct lu_server_fld *fld,
168 const struct lu_env *env,
169 struct lu_seq_range *add_range,
172 int fld_server_delete(struct lu_server_fld *fld,
173 const struct lu_env *env,
174 struct lu_seq_range *range);
176 int fld_server_lookup(struct lu_server_fld *fld,
177 const struct lu_env *env,
178 seqno_t seq, struct lu_seq_range *range);
181 int fld_client_init(struct lu_client_fld *fld,
182 const char *prefix, int hash);
184 void fld_client_fini(struct lu_client_fld *fld);
186 void fld_client_flush(struct lu_client_fld *fld);
188 int fld_client_lookup(struct lu_client_fld *fld, seqno_t seq, mdsno_t *mds,
189 __u32 flags, const struct lu_env *env);
191 int fld_client_create(struct lu_client_fld *fld,
192 struct lu_seq_range *range,
193 const struct lu_env *env);
195 int fld_client_delete(struct lu_client_fld *fld,
197 const struct lu_env *env);
199 int fld_client_add_target(struct lu_client_fld *fld,
200 struct lu_fld_target *tar);
202 int fld_client_del_target(struct lu_client_fld *fld,
205 void fld_client_proc_fini(struct lu_client_fld *fld);