Merge remote-tracking branch 'staging/staging-next'
[deliverable/linux.git] / drivers / staging / lustre / lustre / mdc / mdc_internal.h
CommitLineData
d7e09d03
PT
1/*
2 * GPL HEADER START
3 *
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 only,
8 * as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License version 2 for more details (a copy is included
14 * in the LICENSE file that accompanied this code).
15 *
16 * You should have received a copy of the GNU General Public License
17 * version 2 along with this program; If not, see
6a5b99a4 18 * http://www.gnu.org/licenses/gpl-2.0.html
d7e09d03 19 *
d7e09d03
PT
20 * GPL HEADER END
21 */
22/*
23 * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
24 * Use is subject to license terms.
25 *
1dc563a6 26 * Copyright (c) 2011, 2015 Intel Corporation.
d7e09d03
PT
27 */
28/*
29 * This file is part of Lustre, http://www.lustre.org/
30 * Lustre is a trademark of Sun Microsystems, Inc.
31 */
32
33#ifndef _MDC_INTERNAL_H
34#define _MDC_INTERNAL_H
35
05932307 36#include "../include/lustre_mdc.h"
d7e09d03 37
d7e09d03 38void lprocfs_mdc_init_vars(struct lprocfs_static_vars *lvars);
d7e09d03
PT
39
40void mdc_pack_body(struct ptlrpc_request *req, const struct lu_fid *fid,
ef2e0f55 41 __u64 valid, int ea_size, __u32 suppgid, int flags);
d7e09d03
PT
42void mdc_swap_layouts_pack(struct ptlrpc_request *req,
43 struct md_op_data *op_data);
44void mdc_readdir_pack(struct ptlrpc_request *req, __u64 pgoff, __u32 size,
ef2e0f55 45 const struct lu_fid *fid);
d7e09d03
PT
46void mdc_getattr_pack(struct ptlrpc_request *req, __u64 valid, int flags,
47 struct md_op_data *data, int ea_size);
48void mdc_setattr_pack(struct ptlrpc_request *req, struct md_op_data *op_data,
22e0bc6a 49 void *ea, int ealen, void *ea2, int ea2len);
d7e09d03
PT
50void mdc_create_pack(struct ptlrpc_request *req, struct md_op_data *op_data,
51 const void *data, int datalen, __u32 mode, __u32 uid,
52 __u32 gid, cfs_cap_t capability, __u64 rdev);
53void mdc_open_pack(struct ptlrpc_request *req, struct md_op_data *op_data,
d3a8a4e2 54 __u32 mode, __u64 rdev, __u64 flags, const void *data,
d7e09d03
PT
55 int datalen);
56void mdc_unlink_pack(struct ptlrpc_request *req, struct md_op_data *op_data);
57void mdc_link_pack(struct ptlrpc_request *req, struct md_op_data *op_data);
58void mdc_rename_pack(struct ptlrpc_request *req, struct md_op_data *op_data,
59 const char *old, int oldlen, const char *new, int newlen);
60void mdc_close_pack(struct ptlrpc_request *req, struct md_op_data *op_data);
d7e09d03
PT
61
62/* mdc/mdc_locks.c */
63int mdc_set_lock_data(struct obd_export *exp,
bc30c172
JH
64 const struct lustre_handle *lockh,
65 void *data, __u64 *bits);
d7e09d03
PT
66
67int mdc_null_inode(struct obd_export *exp, const struct lu_fid *fid);
68
d7e09d03 69int mdc_intent_lock(struct obd_export *exp,
70a251f6
JH
70 struct md_op_data *op_data,
71 struct lookup_intent *it,
d7e09d03
PT
72 struct ptlrpc_request **reqp,
73 ldlm_blocking_callback cb_blocking,
74 __u64 extra_lock_flags);
70a251f6 75
d7e09d03 76int mdc_enqueue(struct obd_export *exp, struct ldlm_enqueue_info *einfo,
70a251f6 77 const ldlm_policy_data_t *policy,
d7e09d03 78 struct lookup_intent *it, struct md_op_data *op_data,
70a251f6 79 struct lustre_handle *lockh, __u64 extra_lock_flags);
d7e09d03 80
e93a3082 81int mdc_resource_get_unused(struct obd_export *exp, const struct lu_fid *fid,
52ee0d20 82 struct list_head *cancels, enum ldlm_mode mode,
d7e09d03
PT
83 __u64 bits);
84/* mdc/mdc_request.c */
8f18c8a4 85int mdc_fid_alloc(const struct lu_env *env, struct obd_export *exp,
86 struct lu_fid *fid, struct md_op_data *op_data);
d7e09d03
PT
87struct obd_client_handle;
88
d7e09d03
PT
89int mdc_set_open_replay_data(struct obd_export *exp,
90 struct obd_client_handle *och,
63d42578 91 struct lookup_intent *it);
d7e09d03 92
d7e09d03
PT
93void mdc_commit_open(struct ptlrpc_request *req);
94void mdc_replay_open(struct ptlrpc_request *req);
95
96int mdc_create(struct obd_export *exp, struct md_op_data *op_data,
97 const void *data, int datalen, int mode, __u32 uid, __u32 gid,
98 cfs_cap_t capability, __u64 rdev,
99 struct ptlrpc_request **request);
100int mdc_link(struct obd_export *exp, struct md_op_data *op_data,
101 struct ptlrpc_request **request);
102int mdc_rename(struct obd_export *exp, struct md_op_data *op_data,
103 const char *old, int oldlen, const char *new, int newlen,
104 struct ptlrpc_request **request);
105int mdc_setattr(struct obd_export *exp, struct md_op_data *op_data,
106 void *ea, int ealen, void *ea2, int ea2len,
107 struct ptlrpc_request **request, struct md_open_data **mod);
108int mdc_unlink(struct obd_export *exp, struct md_op_data *op_data,
109 struct ptlrpc_request **request);
110int mdc_cancel_unused(struct obd_export *exp, const struct lu_fid *fid,
52ee0d20 111 ldlm_policy_data_t *policy, enum ldlm_mode mode,
f833ee42 112 enum ldlm_cancel_flags flags, void *opaque);
d7e09d03 113
d7e09d03
PT
114int mdc_revalidate_lock(struct obd_export *exp, struct lookup_intent *it,
115 struct lu_fid *fid, __u64 *bits);
116
117int mdc_intent_getattr_async(struct obd_export *exp,
118 struct md_enqueue_info *minfo,
119 struct ldlm_enqueue_info *einfo);
120
52ee0d20
OD
121enum ldlm_mode mdc_lock_match(struct obd_export *exp, __u64 flags,
122 const struct lu_fid *fid, enum ldlm_type type,
123 ldlm_policy_data_t *policy, enum ldlm_mode mode,
124 struct lustre_handle *lockh);
d7e09d03
PT
125
126static inline int mdc_prep_elc_req(struct obd_export *exp,
127 struct ptlrpc_request *req, int opc,
128 struct list_head *cancels, int count)
129{
130 return ldlm_prep_elc_req(exp, req, LUSTRE_MDS_VERSION, opc, 0, cancels,
131 count);
132}
133
4f76f0ec 134static inline unsigned long hash_x_index(__u64 hash, int hash64)
135{
136 if (BITS_PER_LONG == 32 && hash64)
137 hash >>= 32;
138 /* save hash 0 with hash 1 */
139 return ~0UL - (hash + !hash);
140}
141
d7e09d03 142#endif
This page took 0.449938 seconds and 5 git commands to generate.