Whamcloud - gitweb
landing b_cmobd_merge on HEAD
[fs/lustre-release.git] / lustre / mds / mds_internal.h
1 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
2  * vim:expandtab:shiftwidth=8:tabstop=8:
3  */
4
5 #ifndef _MDS_INTERNAL_H
6 #define _MDS_INTERNAL_H
7
8 #include <linux/lustre_mds.h>
9
10 #define MAX_ATIME_DIFF 60
11
12 struct mds_filter_data {
13         __u64 io_epoch;
14 };
15
16 #define MDS_FILTERDATA(inode) ((struct mds_filter_data *)(inode)->i_filterdata)
17 #define DENTRY_VALID(dentry)    \
18         ((dentry)->d_inode || ((dentry)->d_flags & DCACHE_CROSS_REF))
19
20 static inline struct mds_obd *mds_req2mds(struct ptlrpc_request *req)
21 {
22         return &req->rq_export->exp_obd->u.mds;
23 }
24 static inline struct obd_device *req2obd(struct ptlrpc_request *req)
25 {
26         return req->rq_export->exp_obd;
27 }
28
29 /* mds/mds_reint.c */
30 int enqueue_ordered_locks(struct obd_device *obd, struct ldlm_res_id *p1_res_id,
31                           struct lustre_handle *p1_lockh, int p1_lock_mode,
32                           ldlm_policy_data_t *p1_policy,
33                           struct ldlm_res_id *p2_res_id,
34                           struct lustre_handle *p2_lockh, int p2_lock_mode,
35                           ldlm_policy_data_t *p2_policy);
36 void mds_commit_cb(struct obd_device *, __u64 last_rcvd, void *data, int error);
37 int mds_finish_transno(struct mds_obd *mds, struct inode *inode, void *handle,
38                        struct ptlrpc_request *req, int rc, __u32 op_data);
39 void mds_reconstruct_generic(struct ptlrpc_request *req);
40 void mds_req_from_mcd(struct ptlrpc_request *req, struct mds_client_data *mcd);
41 int mds_get_parent_child_locked(struct obd_device *obd, struct mds_obd *mds,
42                                 struct ll_fid *fid,
43                                 struct lustre_handle *parent_lockh,
44                                 struct dentry **dparentp, int parent_mode,
45                                 __u64 parent_lockpart,
46                                 char *name, int namelen,
47                                 struct lustre_handle *child_lockh,
48                                 struct dentry **dchildp, int child_mode,
49                                 __u64 child_lockpart);
50 int mds_lock_new_child(struct obd_device *obd, struct inode *inode,
51                        struct lustre_handle *child_lockh);
52
53 /* mds/mds_lib.c */
54 int mds_update_unpack(struct ptlrpc_request *, int offset,
55                       struct mds_update_record *);
56
57 /* mds/mds_unlink_open.c */
58 int mds_open_unlink_rename(struct mds_update_record *rec,
59                            struct obd_device *obd, struct dentry *dparent,
60                            struct dentry *dchild, void **handle);
61 int mds_cleanup_orphans(struct obd_device *obd);
62
63
64 /* mds/mds_log.c */
65 int mds_log_op_unlink(struct obd_device *obd, struct inode *inode,
66                       struct lov_mds_md *lmm, int lmm_size,
67                       struct llog_cookie *logcookies, int cookies_size);
68 int mds_llog_init(struct obd_device *obd, struct obd_llogs *,
69                   struct obd_device *tgt, int count, struct llog_catid *logid);
70 int mds_llog_finish(struct obd_device *obd, struct obd_llogs *, int count);
71
72 /* mds/mds_lov.c */
73 int mds_lov_connect(struct obd_device *obd, char * lov_name);
74 int mds_lov_disconnect(struct obd_device *obd, int flags);
75 int mds_get_lovtgts(struct obd_device *, int tgt_count, struct obd_uuid *);
76 int mds_lov_write_objids(struct obd_device *obd);
77 void mds_lov_update_objids(struct obd_device *obd, obd_id *ids);
78 int mds_lov_set_growth(struct mds_obd *mds, int count);
79 int mds_lov_set_nextid(struct obd_device *obd);
80 int mds_post_mds_lovconf(struct obd_device *obd);
81 int mds_notify(struct obd_device *obd, struct obd_device *watched, int active);
82 int mds_convert_lov_ea(struct obd_device *obd, struct inode *inode,
83                        struct lov_mds_md *lmm, int lmm_size);
84
85 /* mds/mds_open.c */
86 int mds_query_write_access(struct inode *inode);
87 int mds_open(struct mds_update_record *rec, int offset,
88              struct ptlrpc_request *req, struct lustre_handle *);
89 int mds_pin(struct ptlrpc_request *req);
90 int mds_mfd_close(struct ptlrpc_request *req, struct obd_device *obd,
91                   struct mds_file_data *mfd, int unlink_orphan);
92 int mds_close(struct ptlrpc_request *req);
93 int mds_done_writing(struct ptlrpc_request *req);
94
95
96 /* mds/mds_fs.c */
97 int mds_client_add(struct obd_device *obd, struct mds_obd *mds,
98                    struct mds_export_data *med, int cl_off);
99 int mds_client_free(struct obd_export *exp, int clear_client);
100 int mds_obd_create(struct obd_export *exp, struct obdo *oa,
101                       struct lov_stripe_md **ea, struct obd_trans_info *oti);
102 int mds_obd_destroy(struct obd_export *exp, struct obdo *oa,
103                     struct lov_stripe_md *ea, struct obd_trans_info *oti);
104
105 /* mds/handler.c */
106 extern struct lvfs_callback_ops mds_lvfs_ops;
107 int mds_lov_clean(struct obd_device *obd);
108 extern int mds_iocontrol(unsigned int cmd, struct obd_export *exp,
109                          int len, void *karg, void *uarg);
110 #ifdef __KERNEL__
111 int mds_get_md(struct obd_device *, struct inode *, void *md, int *size, 
112                int lock);
113 int mds_pack_md(struct obd_device *, struct lustre_msg *, int offset,
114                 struct mds_body *, struct inode *, int lock);
115 void mds_pack_inode2fid(struct obd_device *, struct ll_fid *, struct inode *);
116 void mds_pack_inode2body(struct obd_device *, struct mds_body *, struct inode *);
117 #endif
118
119 /* mds/mds_lmv.c */
120 int mds_lmv_postsetup(struct obd_device *obd);
121 int mds_lmv_connect(struct obd_device *obd, char * lov_name);
122 int mds_lmv_disconnect(struct obd_device *obd, int flags);
123 int mds_try_to_split_dir(struct obd_device *, struct dentry *, struct mea **,
124                          int);
125 int mds_get_lmv_attr(struct obd_device *, struct inode *, struct mea **, int *);
126 int mds_choose_mdsnum(struct obd_device *, const char *, int, int);
127 int mds_lmv_postsetup(struct obd_device *);
128
129 #endif /* _MDS_INTERNAL_H */