Whamcloud - gitweb
Branch: b_new_cmd
[fs/lustre-release.git] / lustre / fld / fld_internal.h
1 /* -*- MODE: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
2  * vim:expandtab:shiftwidth=8:tabstop=8:
3  *
4  *  fld/fld.c
5  *
6  *  Copyright (C) 2006 Cluster File Systems, Inc.
7  *
8  *   This file is part of the Lustre file system, http://www.lustre.org
9  *   Lustre is a trademark of Cluster File Systems, Inc.
10  *
11  *   You may have signed or agreed to another license before downloading
12  *   this software.  If so, you are bound by the terms and conditions
13  *   of that agreement, and the following does not apply to you.  See the
14  *   LICENSE file included with this distribution for more information.
15  *
16  *   If you did not agree to a different license, then this copy of Lustre
17  *   is open source software; you can redistribute it and/or modify it
18  *   under the terms of version 2 of the GNU General Public License as
19  *   published by the Free Software Foundation.
20  *
21  *   In either case, Lustre is distributed in the hope that it will be
22  *   useful, but WITHOUT ANY WARRANTY; without even the implied warranty
23  *   of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
24  *   license text for more details.
25  */
26 #ifndef _FLD_INTERNAL_H
27 #define _FLD_INTERNAL_H
28
29 #define mdsno_t  __u64
30 #define fidseq_t __u64
31
32 #define key_cmp(e1, e2) ({                              \
33         typeof(e1) __e1 = (e1);                         \
34         typeof(e2) __e2 = (e2);                         \
35         __e1 > __e2 ? +1 : (__e1 < __e2 ? -1 : 0);      \
36 })
37
38 struct fld_cache {
39         struct hlist_node fld_list;
40         __u64             fld_mds;
41         __u64             fld_seq;
42 };
43 struct fld_cache_info {
44         struct hlist_head *fld_hash;
45         spinlock_t fld_lock;
46         int fld_hash_mask;
47 };
48 /*XXX use linked list temp for fld in this prototype*/
49 struct fld_list {
50         struct list_head fld_list;
51         spinlock_t       fld_lock;
52 };
53 struct fld_item{
54         struct list_head fld_list;
55         __u64 fld_seq;
56         __u64 fld_mds;
57 };
58
59 enum fld_op {
60         FLD_CREATE = 0,
61         FLD_DELETE = 1,
62         FLD_GET    = 2
63 };
64
65 #define FLD_SERVICE_WATCHDOG_TIMEOUT (obd_timeout * 1000)
66
67
68 struct fld_info {
69         struct iam_container fi_container;
70 };
71
72 int fld_handle_insert(struct fld_info *fld, fidseq_t seq_num, mdsno_t mdsno);
73 int fld_handle_delete(struct fld_info *fld, fidseq_t seq_num, mdsno_t mdsno);
74 int fld_handle_lookup(struct fld_info *fld, fidseq_t seq_num, mdsno_t *mds);
75  
76 int fld_info_init(struct fld_info *fld_info);
77 void fld_info_fini(struct fld_info *fld_info);
78 #endif