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 (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
30 * Use is subject to license terms.
31 * Copyright (c) 2011 Whamcloud, Inc.
34 * This file is part of Lustre, http://www.lustre.org/
35 * Lustre is a trademark of Sun Microsystems, Inc.
46 #include <lustre/lustre_idl.h>
47 #include <lustre_mdt.h>
48 #include <dt_object.h>
50 #include <libcfs/libcfs.h>
57 extern const struct dt_index_features fld_index_features;
58 extern const char fld_index_name[];
61 * FLD (Fid Location Database) interface.
64 LUSTRE_CLI_FLD_HASH_DHT = 0,
65 LUSTRE_CLI_FLD_HASH_RRB
69 struct lu_fld_target {
71 struct obd_export *ft_exp;
72 struct lu_server_fld *ft_srv;
76 struct lu_server_fld {
78 * Fld dir proc entry. */
79 cfs_proc_dir_entry_t *lsf_proc_dir;
82 * /fld file object device */
83 struct dt_object *lsf_obj;
86 * super sequence controller export, needed to forward fld
88 struct obd_export *lsf_control_exp;
91 * Client FLD cache. */
92 struct fld_cache *lsf_cache;
95 * Protect index modifications */
99 * Fld service name in form "fld-srv-lustre-MDTXXX" */
103 struct lu_client_fld {
105 * Client side proc entry. */
106 cfs_proc_dir_entry_t *lcf_proc_dir;
109 * List of exports client FLD knows about. */
110 cfs_list_t lcf_targets;
113 * Current hash to be used to chose an export. */
114 struct lu_fld_hash *lcf_hash;
121 * Lock protecting exports list and fld_hash. */
122 cfs_spinlock_t lcf_lock;
125 * Client FLD cache. */
126 struct fld_cache *lcf_cache;
129 * Client fld proc entry name. */
132 const struct lu_context *lcf_ctx;
138 * number of blocks to reserve for particular operations. Should be function of
139 * ... something. Stub for now.
142 /* one insert operation can involve two delete and one insert */
143 FLD_TXN_INDEX_INSERT_CREDITS = 60,
144 FLD_TXN_INDEX_DELETE_CREDITS = 20,
147 int fld_query(struct com_thread_info *info);
150 int fld_server_init(struct lu_server_fld *fld,
151 struct dt_device *dt,
153 const struct lu_env *env,
156 void fld_server_fini(struct lu_server_fld *fld,
157 const struct lu_env *env);
159 int fld_declare_server_create(struct lu_server_fld *fld,
160 const struct lu_env *env,
163 int fld_server_create(struct lu_server_fld *fld,
164 const struct lu_env *env,
165 struct lu_seq_range *add_range,
168 int fld_server_delete(struct lu_server_fld *fld,
169 const struct lu_env *env,
170 struct lu_seq_range *range);
172 int fld_server_lookup(struct lu_server_fld *fld,
173 const struct lu_env *env,
174 seqno_t seq, struct lu_seq_range *range);
177 int fld_client_init(struct lu_client_fld *fld,
178 const char *prefix, int hash);
180 void fld_client_fini(struct lu_client_fld *fld);
182 void fld_client_flush(struct lu_client_fld *fld);
184 int fld_client_lookup(struct lu_client_fld *fld, seqno_t seq, mdsno_t *mds,
185 __u32 flags, const struct lu_env *env);
187 int fld_client_create(struct lu_client_fld *fld,
188 struct lu_seq_range *range,
189 const struct lu_env *env);
191 int fld_client_delete(struct lu_client_fld *fld,
193 const struct lu_env *env);
195 int fld_client_add_target(struct lu_client_fld *fld,
196 struct lu_fld_target *tar);
198 int fld_client_del_target(struct lu_client_fld *fld,
201 void fld_client_proc_fini(struct lu_client_fld *fld);