Whamcloud - gitweb
- merge 0.7rc1 from b_devel to HEAD (20030612 merge point)
[fs/lustre-release.git] / lustre / include / linux / lustre_import.h
1 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
2  * vim:expandtab:shiftwidth=8:tabstop=8:
3  *
4  * Copyright (C) 2001  Cluster File Systems, Inc.
5  *
6  * This code is issued under the GNU General Public License.
7  * See the file COPYING in this distribution
8  */
9
10 #ifndef __IMPORT_H
11 #define __IMPORT_H
12
13 #include <linux/lustre_handles.h>
14 #include <linux/lustre_idl.h>
15
16 struct obd_import {
17         struct portals_handle     imp_handle;
18         atomic_t                  imp_refcount;
19         struct lustre_handle      imp_dlm_handle; /* client's ldlm export */
20         struct ptlrpc_connection *imp_connection;
21         struct ptlrpc_client     *imp_client;
22         struct list_head          imp_observers;
23         struct list_head          imp_pinger_chain;
24
25         /* Lists of requests that are retained for replay, waiting for a reply,
26          * or waiting for recovery to complete, respectively.
27          */
28         struct list_head          imp_replay_list;
29         struct list_head          imp_sending_list;
30         struct list_head          imp_delayed_list;
31
32         struct obd_device        *imp_obd;
33         int                       imp_level;
34         int                       imp_generation;
35         __u64                     imp_max_transno;
36         __u64                     imp_peer_committed_transno;
37         struct obd_uuid           imp_target_uuid; /* XXX -> lustre_name */
38         struct lustre_handle      imp_remote_handle;
39
40         /* Protects flags, level, generation, *_list */
41         spinlock_t                imp_lock;
42
43         /* flags */
44         int                       imp_invalid:1, imp_replayable:1,
45                                   imp_dlm_fake:1;
46         __u32                     imp_connect_op;
47 };
48
49 typedef void (*obd_import_callback)(struct obd_import *imp, void *closure,
50                                     int event, void *event_arg, void *cb_data);
51
52 struct obd_import_observer {
53         struct list_head     oio_chain;
54         obd_import_callback  oio_cb;
55         void                *oio_cb_data;
56 };
57
58 void class_observe_import(struct obd_import *imp, obd_import_callback cb,
59                           void *cb_data);
60 void class_unobserve_import(struct obd_import *imp, obd_import_callback cb,
61                             void *cb_data);
62 void class_notify_import_observers(struct obd_import *imp, int event,
63                                    void *event_arg);
64
65 #define IMP_EVENT_ACTIVE   1
66 #define IMP_EVENT_INACTIVE 2
67
68 /* genops.c */
69 extern struct obd_import *class_conn2cliimp(struct lustre_handle *);
70 extern struct obd_import *class_conn2ldlmimp(struct lustre_handle *);
71
72 #endif /* __IMPORT_H */