Whamcloud - gitweb
16a4d03225c017197f34ba1e771a67ad0cf49036
[fs/lustre-release.git] / lustre / include / linux / obd_filter.h
1 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
2  * vim:expandtab:shiftwidth=8:tabstop=8:
3  *
4  *  Copyright (C) 2002 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 _OBD_FILTER_H
24 #define _OBD_FILTER_H
25
26 #ifndef OBD_FILTER_DEVICENAME
27 #define OBD_FILTER_DEVICENAME "obdfilter"
28 #endif
29
30 #define FILTER_LR_SERVER_SIZE    512
31
32 #define FILTER_LR_CLIENT_START   8192
33 #define FILTER_LR_CLIENT_SIZE    128
34
35 #define FILTER_MOUNT_RECOV 2
36 #define FILTER_RECOVERY_TIMEOUT (obd_timeout * 5 * HZ / 2) /* *waves hands* */
37
38 /* Data stored per server at the head of the last_rcvd file.  In le32 order. */
39 struct filter_server_data {
40         __u8  fsd_uuid[37];        /* server UUID */
41         __u8  fsd_uuid_padding[3]; /* unused */
42         __u64 fsd_last_objid;      /* last completed transaction ID */
43         __u64 fsd_last_rcvd;       /* last completed transaction ID */
44         __u64 fsd_mount_count;     /* FILTER incarnation number */
45         __u8  fsd_padding[FILTER_LR_SERVER_SIZE - 64]; /*  */
46 };
47
48 /* Data stored per client in the last_rcvd file.  In le32 order. */
49 struct filter_client_data {
50         __u8  fcd_uuid[37];        /* client UUID */
51         __u8  fcd_uuid_padding[3]; /* unused */
52         __u64 fcd_last_rcvd;       /* last completed transaction ID */
53         __u64 fcd_mount_count;     /* FILTER incarnation number */
54         __u64 fcd_last_xid;        /* client RPC xid for the last transaction */
55         __u8  fcd_padding[FILTER_LR_CLIENT_SIZE - 64]; 
56 };
57
58 /* In-memory access to client data from OST struct */
59 struct filter_export_data {
60         struct list_head  fed_open_head; /* files to close on disconnect */
61         spinlock_t        fed_lock;      /* protects fed_open_head */
62         struct filter_client_data  *fed_fcd;
63         int               fed_lr_off;
64 };
65
66 /* file data for open files on OST */
67 struct filter_file_data {
68         struct list_head  ffd_export_list;  /* export open list - fed_lock */
69         struct file      *ffd_file;         /* file handle */
70         __u64             ffd_servercookie; /* cookie for lustre handle */
71 };
72
73 struct filter_dentry_data {
74         atomic_t         fdd_open_count;
75         int              fdd_flags;
76 };
77
78 #define FILTER_FLAG_DESTROY 0x0001      /* destroy dentry on last file close */
79
80
81 #endif