1 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
2 * vim:expandtab:shiftwidth=8:tabstop=8:
4 * Copyright (C) 2006 Cluster File Systems, Inc.
6 * This file is part of Lustre, http://www.lustre.org.
8 * Lustre is free software; you can redistribute it and/or
9 * modify it under the terms of version 2 of the GNU General Public
10 * License as published by the Free Software Foundation.
12 * Lustre is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with Lustre; if not, write to the Free Software
19 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
30 * FLD (Fid Location Database) interface.
33 LUSTRE_CLI_FLD_HASH_DHT = 0,
34 LUSTRE_CLI_FLD_HASH_RRB
37 typedef int (*fld_hash_func_t) (struct lu_client_fld *, __u64);
41 fld_hash_func_t fh_func;
44 struct lu_server_fld {
45 /* service proc entry */
46 cfs_proc_dir_entry_t *fld_proc_entry;
48 /* fld dir proc entry */
49 cfs_proc_dir_entry_t *fld_proc_dir;
51 /* pointer to started server service */
52 struct ptlrpc_service *fld_service;
54 /* device for access object index methods */
55 struct dt_device *fld_dt;
57 /* /fld file object device */
58 struct dt_object *fld_obj;
61 struct lu_fid fld_fid;
63 /* fld service name in form "fld-MDTXXX" */
67 struct fld_cache_entry {
68 struct hlist_node fce_list;
73 struct fld_cache_info {
74 struct hlist_head *fci_hash;
80 struct lu_client_fld {
81 /* client side proc entry */
82 cfs_proc_dir_entry_t *fld_proc_dir;
84 /* list of exports client FLD knows about */
85 struct list_head fld_targets;
87 /* current hash to be used to chose an export */
88 struct lu_fld_hash *fld_hash;
93 /* lock protecting exports list and fld_hash */
96 /* client FLD cache */
97 struct fld_cache_info *fld_cache;
99 /* client fld proc entry name */
104 int fld_server_init(struct lu_server_fld *fld,
105 const struct lu_context *ctx,
106 struct dt_device *dt,
109 void fld_server_fini(struct lu_server_fld *fld,
110 const struct lu_context *ctx);
112 int fld_server_lookup(struct lu_server_fld *fld,
113 const struct lu_context *ctx,
114 seqno_t seq, mdsno_t *mds);
116 int fld_server_create(struct lu_server_fld *fld,
117 const struct lu_context *ctx,
118 seqno_t seq, mdsno_t mds);
120 int fld_server_delete(struct lu_server_fld *fld,
121 const struct lu_context *ctx,
125 int fld_client_init(struct lu_client_fld *fld,
129 void fld_client_fini(struct lu_client_fld *fld);
131 int fld_client_lookup(struct lu_client_fld *fld,
132 seqno_t seq, mdsno_t *mds);
134 int fld_client_create(struct lu_client_fld *fld,
135 seqno_t seq, mdsno_t mds);
137 int fld_client_delete(struct lu_client_fld *fld,
140 int fld_client_add_target(struct lu_client_fld *fld,
141 struct obd_export *exp);
143 int fld_client_del_target(struct lu_client_fld *fld,
144 struct obd_export *exp);
147 struct fld_cache_info *fld_cache_init(int size);
149 void fld_cache_fini(struct fld_cache_info *cache);
151 int fld_cache_insert(struct fld_cache_info *cache,
152 seqno_t seq, mdsno_t mds);
154 void fld_cache_delete(struct fld_cache_info *cache,
158 fld_cache_lookup(struct fld_cache_info *cache,
159 seqno_t seq, mdsno_t *mds);