Whamcloud - gitweb
- fixes in fld:
[fs/lustre-release.git] / lustre / include / lustre_fld.h
1 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
2  * vim:expandtab:shiftwidth=8:tabstop=8:
3  *
4  *  Copyright (C) 2006 Cluster File Systems, Inc.
5  *
6  *   This file is part of Lustre, http://www.lustre.org.
7  *
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.
11  *
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.
16  *
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.
20  *
21  */
22
23 #ifndef __LINUX_FLD_H
24 #define __LINUX_FLD_H
25
26 struct lu_client_fld;
27 struct lu_server_fld;
28
29 /*
30  * FLD (Fid Location Database) interface.
31  */
32 enum {
33         LUSTRE_CLI_FLD_HASH_DHT = 0,
34         LUSTRE_CLI_FLD_HASH_RRB,
35         LUSTRE_CLI_FLD_HASH_LAST
36 };
37         
38 typedef int (*fld_hash_func_t) (struct lu_client_fld *, __u64);
39
40 struct lu_fld_hash {
41         const char              *fh_name;
42         fld_hash_func_t          fh_func;
43 };
44
45 struct lu_server_fld {
46         struct proc_dir_entry   *fld_proc_entry;
47         struct ptlrpc_service   *fld_service;
48         struct dt_device        *fld_dt;
49         struct dt_object        *fld_obj;
50         struct lu_fid            fld_fid; /* used during initialization */
51         struct dt_index_cookie  *fld_cookie;
52 };
53
54 struct lu_client_fld {
55         struct proc_dir_entry   *fld_proc_entry;
56         struct list_head         fld_exports;
57         struct lu_fld_hash      *fld_hash;
58         int                      fld_count;
59         spinlock_t               fld_lock;
60 };
61
62 /* server methods */
63 int fld_server_init(struct lu_server_fld *fld,
64                     const struct lu_context *ctx, 
65                     struct dt_device *dt);
66
67 void fld_server_fini(struct lu_server_fld *fld,
68                      const struct lu_context *ctx);
69
70 /* client methods */
71 int fld_client_init(struct lu_client_fld *fld,
72                     int hash);
73
74 void fld_client_fini(struct lu_client_fld *fld);
75
76 int fld_client_add_export(struct lu_client_fld *fld,
77                           struct obd_export *exp);
78
79 int fld_client_del_export(struct lu_client_fld *fld,
80                           struct obd_export *exp);
81
82 int fld_client_create(struct lu_client_fld *fld,
83                       __u64 seq, __u64 mds_num);
84
85 int fld_client_delete(struct lu_client_fld *fld,
86                       __u64 seq, __u64 mds_num);
87
88 int fld_client_get(struct lu_client_fld *fld,
89                    __u64 lu_seq, __u64 *mds_num);
90
91 int fld_client_lookup(struct lu_client_fld *fld,
92                       __u64 lu_seq, __u64 *mds_num);
93
94 #endif