1 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
2 * vim:expandtab:shiftwidth=8:tabstop=8:
6 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
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.
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).
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
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
29 * Copyright 2008 Sun Microsystems, Inc. All rights reserved
30 * Use is subject to license terms.
33 * This file is part of Lustre, http://www.lustre.org/
34 * Lustre is a trademark of Sun Microsystems, Inc.
40 #include <lustre/lustre_idl.h>
41 #include <lustre_mdt.h>
42 #include <dt_object.h>
44 #include <libcfs/libcfs.h>
51 extern const struct dt_index_features fld_index_features;
52 extern const char fld_index_name[];
55 * FLD (Fid Location Database) interface.
58 LUSTRE_CLI_FLD_HASH_DHT = 0,
59 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 proc entry. */
73 cfs_proc_dir_entry_t *lsf_proc_dir;
76 * /fld file object device */
77 struct dt_object *lsf_obj;
80 * super sequence controller export, needed to forward fld
82 struct obd_export *lsf_control_exp;
85 * Client FLD cache. */
86 struct fld_cache *lsf_cache;
89 * Protect index modifications */
90 struct mutex lsf_lock;
93 * Fld service name in form "fld-srv-lustre-MDTXXX" */
97 struct lu_client_fld {
99 * Client side proc entry. */
100 cfs_proc_dir_entry_t *lcf_proc_dir;
103 * List of exports client FLD knows about. */
104 struct list_head lcf_targets;
107 * Current hash to be used to chose an export. */
108 struct lu_fld_hash *lcf_hash;
115 * Lock protecting exports list and fld_hash. */
119 * Client FLD cache. */
120 struct fld_cache *lcf_cache;
123 * Client fld proc entry name. */
126 const struct lu_context *lcf_ctx;
132 * number of blocks to reserve for particular operations. Should be function of
133 * ... something. Stub for now.
136 /* one insert operation can involve two delete and one insert */
137 FLD_TXN_INDEX_INSERT_CREDITS = 60,
138 FLD_TXN_INDEX_DELETE_CREDITS = 20,
141 int fld_query(struct com_thread_info *info);
144 int fld_server_init(struct lu_server_fld *fld,
145 struct dt_device *dt,
147 const struct lu_env *env,
150 void fld_server_fini(struct lu_server_fld *fld,
151 const struct lu_env *env);
153 int fld_server_create(struct lu_server_fld *fld,
154 const struct lu_env *env,
155 struct lu_seq_range *add_range,
158 int fld_server_delete(struct lu_server_fld *fld,
159 const struct lu_env *env,
160 struct lu_seq_range *range);
162 int fld_server_lookup(struct lu_server_fld *fld,
163 const struct lu_env *env,
164 seqno_t seq, struct lu_seq_range *range);
167 int fld_client_init(struct lu_client_fld *fld,
168 const char *prefix, int hash);
170 void fld_client_fini(struct lu_client_fld *fld);
172 void fld_client_flush(struct lu_client_fld *fld);
174 int fld_client_lookup(struct lu_client_fld *fld,
175 seqno_t seq, mdsno_t *mds,
176 const struct lu_env *env);
178 int fld_client_create(struct lu_client_fld *fld,
179 struct lu_seq_range *range,
180 const struct lu_env *env);
182 int fld_client_delete(struct lu_client_fld *fld,
184 const struct lu_env *env);
186 int fld_client_add_target(struct lu_client_fld *fld,
187 struct lu_fld_target *tar);
189 int fld_client_del_target(struct lu_client_fld *fld,