Whamcloud - gitweb
7b43f4febb11e84cc41b408ca6081ea99ade8b94
[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 #  ifdef HAVE_XATTR_ACL
18 #   include <linux/xattr_acl.h>
19 #  endif
20 #  ifdef HAVE_LINUX_POSIX_ACL_XATTR_H
21 #   include <linux/posix_acl_xattr.h>
22 #  endif
23 # endif
24 #endif
25 #include <lustre_handles.h>
26 #include <libcfs/kp30.h>
27 #include <lustre/lustre_idl.h>
28 #include <lustre_lib.h>
29 #include <lustre_dlm.h>
30 #include <lustre_log.h>
31 #include <lustre_export.h>
32
33 struct ptlrpc_client;
34 struct obd_export;
35 struct ptlrpc_request;
36 struct obd_device;
37
38 struct mdc_rpc_lock {
39         struct semaphore rpcl_sem;
40         struct lookup_intent *rpcl_it;
41 };
42
43 static inline void mdc_init_rpc_lock(struct mdc_rpc_lock *lck)
44 {
45         sema_init(&lck->rpcl_sem, 1);
46         lck->rpcl_it = NULL;
47 }
48
49 static inline void mdc_get_rpc_lock(struct mdc_rpc_lock *lck,
50                                     struct lookup_intent *it)
51 {
52         ENTRY;
53         if (!it || (it->it_op != IT_GETATTR && it->it_op != IT_LOOKUP)) {
54                 down(&lck->rpcl_sem);
55                 LASSERT(lck->rpcl_it == NULL);
56                 lck->rpcl_it = it;
57         }
58 }
59
60 static inline void mdc_put_rpc_lock(struct mdc_rpc_lock *lck,
61                                     struct lookup_intent *it)
62 {
63         if (!it || (it->it_op != IT_GETATTR && it->it_op != IT_LOOKUP)) {
64                 LASSERT(it == lck->rpcl_it);
65                 lck->rpcl_it = NULL;
66                 up(&lck->rpcl_sem);
67         }
68         EXIT;
69 }
70
71 struct mdc_cache_waiter {       
72         struct list_head        mcw_entry;
73         wait_queue_head_t       mcw_waitq;
74 };
75
76 /* mdc/mdc_locks.c */
77 int it_disposition(struct lookup_intent *it, int flag);
78 void it_clear_disposition(struct lookup_intent *it, int flag);
79 void it_set_disposition(struct lookup_intent *it, int flag);
80 int it_open_error(int phase, struct lookup_intent *it);
81 #ifdef HAVE_SPLIT_SUPPORT
82 int mdc_sendpage(struct obd_export *exp, const struct lu_fid *fid,
83                  const struct page *page, int offset);
84 #endif
85 #endif