Whamcloud - gitweb
simplification of osd index interface
[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 };
52
53 struct lu_client_fld {
54         struct proc_dir_entry   *fld_proc_entry;
55         struct list_head         fld_exports;
56         struct lu_fld_hash      *fld_hash;
57         int                      fld_count;
58         spinlock_t               fld_lock;
59 };
60
61 /* server methods */
62 int fld_server_init(struct lu_server_fld *fld,
63                     const struct lu_context *ctx,
64                     struct dt_device *dt);
65
66 void fld_server_fini(struct lu_server_fld *fld,
67                      const struct lu_context *ctx);
68
69 /* client methods */
70 int fld_client_init(struct lu_client_fld *fld,
71                     int hash);
72
73 void fld_client_fini(struct lu_client_fld *fld);
74
75 int fld_client_add_export(struct lu_client_fld *fld,
76                           struct obd_export *exp);
77
78 int fld_client_del_export(struct lu_client_fld *fld,
79                           struct obd_export *exp);
80
81 int fld_client_create(struct lu_client_fld *fld,
82                       __u64 seq, __u64 mds);
83
84 int fld_client_delete(struct lu_client_fld *fld,
85                       __u64 seq, __u64 mds);
86
87 int fld_client_lookup(struct lu_client_fld *fld,
88                       __u64 seq, __u64 *mds);
89
90 #endif