Whamcloud - gitweb
- make HEAD from b_post_cmd3
[fs/lustre-release.git] / lustre / include / lustre_mdc.h
1 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
2  * vim:expandtab:shiftwidth=8:tabstop=8:
3  *
4  *   This file is part of Lustre, http://www.lustre.org
5  *
6  * MDS data structures.
7  * See also lustre_idl.h for wire formats of requests.
8  */
9
10 #ifndef _LUSTRE_MDC_H
11 #define _LUSTRE_MDC_H
12
13 #ifdef __KERNEL__
14 # include <linux/fs.h>
15 # include <linux/dcache.h>
16 # ifdef CONFIG_FS_POSIX_ACL
17 # include <linux/xattr_acl.h>
18 # endif
19 #endif
20 #include <lustre_handles.h>
21 #include <libcfs/kp30.h>
22 #include <lustre/lustre_idl.h>
23 #include <lustre_lib.h>
24 #include <lustre_dlm.h>
25 #include <lustre_log.h>
26 #include <lustre_export.h>
27
28 struct ptlrpc_client;
29 struct obd_export;
30 struct ptlrpc_request;
31 struct obd_device;
32
33 struct mdc_rpc_lock {
34         struct semaphore rpcl_sem;
35         struct lookup_intent *rpcl_it;
36 };
37
38 static inline void mdc_init_rpc_lock(struct mdc_rpc_lock *lck)
39 {
40         sema_init(&lck->rpcl_sem, 1);
41         lck->rpcl_it = NULL;
42 }
43
44 static inline void mdc_get_rpc_lock(struct mdc_rpc_lock *lck,
45                                     struct lookup_intent *it)
46 {
47         ENTRY;
48         if (!it || (it->it_op != IT_GETATTR && it->it_op != IT_LOOKUP)) {
49                 down(&lck->rpcl_sem);
50                 LASSERT(lck->rpcl_it == NULL);
51                 lck->rpcl_it = it;
52         }
53 }
54
55 static inline void mdc_put_rpc_lock(struct mdc_rpc_lock *lck,
56                                     struct lookup_intent *it)
57 {
58         if (!it || (it->it_op != IT_GETATTR && it->it_op != IT_LOOKUP)) {
59                 LASSERT(it == lck->rpcl_it);
60                 lck->rpcl_it = NULL;
61                 up(&lck->rpcl_sem);
62         }
63         EXIT;
64 }
65
66 struct mdc_cache_waiter {       
67         struct list_head        mcw_entry;
68         wait_queue_head_t       mcw_waitq;
69 };
70
71 /* mdc/mdc_locks.c */
72 int it_disposition(struct lookup_intent *it, int flag);
73 void it_clear_disposition(struct lookup_intent *it, int flag);
74 void it_set_disposition(struct lookup_intent *it, int flag);
75 int it_open_error(int phase, struct lookup_intent *it);
76 #ifdef HAVE_SPLIT_SUPPORT
77 int mdc_sendpage(struct obd_export *exp, const struct lu_fid *fid,
78                  const struct page *page, int offset);
79 #endif
80 #endif