aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike Marshall <hubcap@omnibond.com>2015-07-17 10:38:11 -0400
committerMike Marshall <hubcap@omnibond.com>2015-10-03 11:39:53 -0400
commitf7ab093f74bf638ed98fd1115f3efa17e308bb7f (patch)
tree89080f7e7eae969b6edaffcda5935d28ac08e947
parent9ffecb10283508260936b96022d4ee43a7798b4c (diff)
Orangefs: kernel client part 1
OrangeFS (formerly PVFS) is an lgpl licensed userspace networked parallel file system. OrangeFS can be accessed through included system utilities, user integration libraries, MPI-IO and can be used by the Hadoop ecosystem as an alternative to the HDFS filesystem. OrangeFS is used widely for parallel science, data analytics and engineering applications. While applications often don't require Orangefs to be mounted into the VFS, users do like to be able to access their files in the normal way. The Orangefs kernel client allows Orangefs filesystems to be mounted as a VFS. The kernel client communicates with a userspace daemon which in turn communicates with the Orangefs server daemons that implement the filesystem. The server daemons (there's almost always more than one) need not be running on the same host as the kernel client. Orangefs filesystems can also be mounted with FUSE, and we ship code and instructions to facilitate that, but most of our users report preferring to use our kernel module instead. Further, as an example of a problem we can't solve with fuse, we have in the works a not-yet-ready-for-prime-time version of a file_operations lock function that accounts for the server daemons being distributed across more than one running kernel. Many people and organizations, including Clemson University, Argonne National Laboratories and Acxiom Corporation have helped to create what has become Orangefs over more than twenty years. Some of the more recent contributors to the kernel client include: Mike Marshall Christoph Hellwig Randy Martin Becky Ligon Walt Ligon Michael Moore Rob Ross Phil Carnes Signed-off-by: Mike Marshall <hubcap@omnibond.com>
-rw-r--r--fs/orangefs/downcall.h138
-rw-r--r--fs/orangefs/protocol.h681
-rw-r--r--fs/orangefs/pvfs2-bufmap.h76
-rw-r--r--fs/orangefs/pvfs2-debug.h290
-rw-r--r--fs/orangefs/pvfs2-debugfs.h3
-rw-r--r--fs/orangefs/pvfs2-dev-proto.h102
-rw-r--r--fs/orangefs/pvfs2-kernel.h864
-rw-r--r--fs/orangefs/pvfs2-sysfs.h2
-rw-r--r--fs/orangefs/upcall.h255
9 files changed, 2411 insertions, 0 deletions
diff --git a/fs/orangefs/downcall.h b/fs/orangefs/downcall.h
new file mode 100644
index 000000000000..a79129f875f3
--- /dev/null
+++ b/fs/orangefs/downcall.h
@@ -0,0 +1,138 @@
1/*
2 * (C) 2001 Clemson University and The University of Chicago
3 *
4 * See COPYING in top-level directory.
5 */
6
7/*
8 * Definitions of downcalls used in Linux kernel module.
9 */
10
11#ifndef __DOWNCALL_H
12#define __DOWNCALL_H
13
14/*
15 * Sanitized the device-client core interaction
16 * for clean 32-64 bit usage
17 */
18struct pvfs2_io_response {
19 __s64 amt_complete;
20};
21
22struct pvfs2_iox_response {
23 __s64 amt_complete;
24};
25
26struct pvfs2_lookup_response {
27 struct pvfs2_object_kref refn;
28};
29
30struct pvfs2_create_response {
31 struct pvfs2_object_kref refn;
32};
33
34struct pvfs2_symlink_response {
35 struct pvfs2_object_kref refn;
36};
37
38struct pvfs2_getattr_response {
39 struct PVFS_sys_attr_s attributes;
40 char link_target[PVFS2_NAME_LEN];
41};
42
43struct pvfs2_mkdir_response {
44 struct pvfs2_object_kref refn;
45};
46
47/*
48 * duplication of some system interface structures so that I don't have
49 * to allocate extra memory
50 */
51struct pvfs2_dirent {
52 char *d_name;
53 int d_length;
54 struct pvfs2_khandle khandle;
55};
56
57struct pvfs2_statfs_response {
58 __s64 block_size;
59 __s64 blocks_total;
60 __s64 blocks_avail;
61 __s64 files_total;
62 __s64 files_avail;
63};
64
65struct pvfs2_fs_mount_response {
66 __s32 fs_id;
67 __s32 id;
68 struct pvfs2_khandle root_khandle;
69};
70
71/* the getxattr response is the attribute value */
72struct pvfs2_getxattr_response {
73 __s32 val_sz;
74 __s32 __pad1;
75 char val[PVFS_MAX_XATTR_VALUELEN];
76};
77
78/* the listxattr response is an array of attribute names */
79struct pvfs2_listxattr_response {
80 __s32 returned_count;
81 __s32 __pad1;
82 __u64 token;
83 char key[PVFS_MAX_XATTR_LISTLEN * PVFS_MAX_XATTR_NAMELEN];
84 __s32 keylen;
85 __s32 __pad2;
86 __s32 lengths[PVFS_MAX_XATTR_LISTLEN];
87};
88
89struct pvfs2_param_response {
90 __s64 value;
91};
92
93#define PERF_COUNT_BUF_SIZE 4096
94struct pvfs2_perf_count_response {
95 char buffer[PERF_COUNT_BUF_SIZE];
96};
97
98#define FS_KEY_BUF_SIZE 4096
99struct pvfs2_fs_key_response {
100 __s32 fs_keylen;
101 __s32 __pad1;
102 char fs_key[FS_KEY_BUF_SIZE];
103};
104
105struct pvfs2_downcall_s {
106 __s32 type;
107 __s32 status;
108 /* currently trailer is used only by readdir */
109 __s64 trailer_size;
110 char * trailer_buf;
111
112 union {
113 struct pvfs2_io_response io;
114 struct pvfs2_iox_response iox;
115 struct pvfs2_lookup_response lookup;
116 struct pvfs2_create_response create;
117 struct pvfs2_symlink_response sym;
118 struct pvfs2_getattr_response getattr;
119 struct pvfs2_mkdir_response mkdir;
120 struct pvfs2_statfs_response statfs;
121 struct pvfs2_fs_mount_response fs_mount;
122 struct pvfs2_getxattr_response getxattr;
123 struct pvfs2_listxattr_response listxattr;
124 struct pvfs2_param_response param;
125 struct pvfs2_perf_count_response perf_count;
126 struct pvfs2_fs_key_response fs_key;
127 } resp;
128};
129
130struct pvfs2_readdir_response_s {
131 __u64 token;
132 __u64 directory_version;
133 __u32 __pad2;
134 __u32 pvfs_dirent_outcount;
135 struct pvfs2_dirent *dirent_array;
136};
137
138#endif /* __DOWNCALL_H */
diff --git a/fs/orangefs/protocol.h b/fs/orangefs/protocol.h
new file mode 100644
index 000000000000..2fb3a63ae9ab
--- /dev/null
+++ b/fs/orangefs/protocol.h
@@ -0,0 +1,681 @@
1#include <linux/spinlock_types.h>
2#include <linux/types.h>
3#include <linux/slab.h>
4
5extern struct client_debug_mask *cdm_array;
6extern char *debug_help_string;
7extern int help_string_initialized;
8extern struct dentry *debug_dir;
9extern struct dentry *help_file_dentry;
10extern struct dentry *client_debug_dentry;
11extern const struct file_operations debug_help_fops;
12extern int client_all_index;
13extern int client_verbose_index;
14extern int cdm_element_count;
15#define DEBUG_HELP_STRING_SIZE 4096
16#define HELP_STRING_UNINITIALIZED \
17 "Client Debug Keywords are unknown until the first time\n" \
18 "the client is started after boot.\n"
19#define ORANGEFS_KMOD_DEBUG_HELP_FILE "debug-help"
20#define ORANGEFS_KMOD_DEBUG_FILE "kernel-debug"
21#define ORANGEFS_CLIENT_DEBUG_FILE "client-debug"
22#define PVFS2_VERBOSE "verbose"
23#define PVFS2_ALL "all"
24
25/* pvfs2-config.h ***********************************************************/
26#define PVFS2_VERSION_MAJOR 2
27#define PVFS2_VERSION_MINOR 9
28#define PVFS2_VERSION_SUB 0
29
30/* khandle stuff ***********************************************************/
31
32/*
33 * The 2.9 core will put 64 bit handles in here like this:
34 * 1234 0000 0000 5678
35 * The 3.0 and beyond cores will put 128 bit handles in here like this:
36 * 1234 5678 90AB CDEF
37 * The kernel module will always use the first four bytes and
38 * the last four bytes as an inum.
39 */
40struct pvfs2_khandle {
41 unsigned char u[16];
42} __aligned(8);
43
44/*
45 * kernel version of an object ref.
46 */
47struct pvfs2_object_kref {
48 struct pvfs2_khandle khandle;
49 __s32 fs_id;
50 __s32 __pad1;
51};
52
53/*
54 * compare 2 khandles assumes little endian thus from large address to
55 * small address
56 */
57static inline int PVFS_khandle_cmp(const struct pvfs2_khandle *kh1,
58 const struct pvfs2_khandle *kh2)
59{
60 int i;
61
62 for (i = 15; i >= 0; i--) {
63 if (kh1->u[i] > kh2->u[i])
64 return 1;
65 if (kh1->u[i] < kh2->u[i])
66 return -1;
67 }
68
69 return 0;
70}
71
72/* copy a khandle to a field of arbitrary size */
73static inline void PVFS_khandle_to(const struct pvfs2_khandle *kh,
74 void *p, int size)
75{
76 int i;
77 unsigned char *c = p;
78
79 memset(p, 0, size);
80
81 for (i = 0; i < 16 && i < size; i++)
82 c[i] = kh->u[i];
83}
84
85/* copy a khandle from a field of arbitrary size */
86static inline void PVFS_khandle_from(struct pvfs2_khandle *kh,
87 void *p, int size)
88{
89 int i;
90 unsigned char *c = p;
91
92 memset(kh, 0, 16);
93
94 for (i = 0; i < 16 && i < size; i++)
95 kh->u[i] = c[i];
96}
97
98/* pvfs2-types.h ************************************************************/
99typedef __u32 PVFS_uid;
100typedef __u32 PVFS_gid;
101typedef __s32 PVFS_fs_id;
102typedef __u32 PVFS_permissions;
103typedef __u64 PVFS_time;
104typedef __s64 PVFS_size;
105typedef __u64 PVFS_flags;
106typedef __u64 PVFS_ds_position;
107typedef __s32 PVFS_error;
108typedef __s64 PVFS_offset;
109
110#define PVFS2_SUPER_MAGIC 0x20030528
111#define PVFS_ERROR_BIT (1 << 30)
112#define PVFS_NON_ERRNO_ERROR_BIT (1 << 29)
113#define IS_PVFS_ERROR(__error) ((__error)&(PVFS_ERROR_BIT))
114#define IS_PVFS_NON_ERRNO_ERROR(__error) \
115(((__error)&(PVFS_NON_ERRNO_ERROR_BIT)) && IS_PVFS_ERROR(__error))
116#define PVFS_ERROR_TO_ERRNO(__error) PVFS_get_errno_mapping(__error)
117
118/* 7 bits are used for the errno mapped error codes */
119#define PVFS_ERROR_CODE(__error) \
120((__error) & (__s32)(0x7f|PVFS_ERROR_BIT))
121#define PVFS_ERROR_CLASS(__error) \
122((__error) & ~((__s32)(0x7f|PVFS_ERROR_BIT|PVFS_NON_ERRNO_ERROR_BIT)))
123#define PVFS_NON_ERRNO_ERROR_CODE(__error) \
124((__error) & (__s32)(127|PVFS_ERROR_BIT|PVFS_NON_ERRNO_ERROR_BIT))
125
126/* PVFS2 error codes, compliments of asm/errno.h */
127#define PVFS_EPERM E(1) /* Operation not permitted */
128#define PVFS_ENOENT E(2) /* No such file or directory */
129#define PVFS_EINTR E(3) /* Interrupted system call */
130#define PVFS_EIO E(4) /* I/O error */
131#define PVFS_ENXIO E(5) /* No such device or address */
132#define PVFS_EBADF E(6) /* Bad file number */
133#define PVFS_EAGAIN E(7) /* Try again */
134#define PVFS_ENOMEM E(8) /* Out of memory */
135#define PVFS_EFAULT E(9) /* Bad address */
136#define PVFS_EBUSY E(10) /* Device or resource busy */
137#define PVFS_EEXIST E(11) /* File exists */
138#define PVFS_ENODEV E(12) /* No such device */
139#define PVFS_ENOTDIR E(13) /* Not a directory */
140#define PVFS_EISDIR E(14) /* Is a directory */
141#define PVFS_EINVAL E(15) /* Invalid argument */
142#define PVFS_EMFILE E(16) /* Too many open files */
143#define PVFS_EFBIG E(17) /* File too large */
144#define PVFS_ENOSPC E(18) /* No space left on device */
145#define PVFS_EROFS E(19) /* Read-only file system */
146#define PVFS_EMLINK E(20) /* Too many links */
147#define PVFS_EPIPE E(21) /* Broken pipe */
148#define PVFS_EDEADLK E(22) /* Resource deadlock would occur */
149#define PVFS_ENAMETOOLONG E(23) /* File name too long */
150#define PVFS_ENOLCK E(24) /* No record locks available */
151#define PVFS_ENOSYS E(25) /* Function not implemented */
152#define PVFS_ENOTEMPTY E(26) /* Directory not empty */
153 /*
154#define PVFS_ELOOP E(27) * Too many symbolic links encountered
155 */
156#define PVFS_EWOULDBLOCK E(28) /* Operation would block */
157#define PVFS_ENOMSG E(29) /* No message of desired type */
158#define PVFS_EUNATCH E(30) /* Protocol driver not attached */
159#define PVFS_EBADR E(31) /* Invalid request descriptor */
160#define PVFS_EDEADLOCK E(32)
161#define PVFS_ENODATA E(33) /* No data available */
162#define PVFS_ETIME E(34) /* Timer expired */
163#define PVFS_ENONET E(35) /* Machine is not on the network */
164#define PVFS_EREMOTE E(36) /* Object is remote */
165#define PVFS_ECOMM E(37) /* Communication error on send */
166#define PVFS_EPROTO E(38) /* Protocol error */
167#define PVFS_EBADMSG E(39) /* Not a data message */
168 /*
169#define PVFS_EOVERFLOW E(40) * Value too large for defined data
170 * type
171 */
172 /*
173#define PVFS_ERESTART E(41) * Interrupted system call should be
174 * restarted
175 */
176#define PVFS_EMSGSIZE E(42) /* Message too long */
177#define PVFS_EPROTOTYPE E(43) /* Protocol wrong type for socket */
178#define PVFS_ENOPROTOOPT E(44) /* Protocol not available */
179#define PVFS_EPROTONOSUPPORT E(45) /* Protocol not supported */
180 /*
181#define PVFS_EOPNOTSUPP E(46) * Operation not supported on transport
182 * endpoint
183 */
184#define PVFS_EADDRINUSE E(47) /* Address already in use */
185#define PVFS_EADDRNOTAVAIL E(48) /* Cannot assign requested address */
186#define PVFS_ENETDOWN E(49) /* Network is down */
187#define PVFS_ENETUNREACH E(50) /* Network is unreachable */
188 /*
189#define PVFS_ENETRESET E(51) * Network dropped connection because
190 * of reset
191 */
192#define PVFS_ENOBUFS E(52) /* No buffer space available */
193#define PVFS_ETIMEDOUT E(53) /* Connection timed out */
194#define PVFS_ECONNREFUSED E(54) /* Connection refused */
195#define PVFS_EHOSTDOWN E(55) /* Host is down */
196#define PVFS_EHOSTUNREACH E(56) /* No route to host */
197#define PVFS_EALREADY E(57) /* Operation already in progress */
198#define PVFS_EACCES E(58) /* Access not allowed */
199#define PVFS_ECONNRESET E(59) /* Connection reset by peer */
200#define PVFS_ERANGE E(60) /* Math out of range or buf too small */
201
202/***************** non-errno/pvfs2 specific error codes *****************/
203#define PVFS_ECANCEL (1|(PVFS_NON_ERRNO_ERROR_BIT|PVFS_ERROR_BIT))
204#define PVFS_EDEVINIT (2|(PVFS_NON_ERRNO_ERROR_BIT|PVFS_ERROR_BIT))
205#define PVFS_EDETAIL (3|(PVFS_NON_ERRNO_ERROR_BIT|PVFS_ERROR_BIT))
206#define PVFS_EHOSTNTFD (4|(PVFS_NON_ERRNO_ERROR_BIT|PVFS_ERROR_BIT))
207#define PVFS_EADDRNTFD (5|(PVFS_NON_ERRNO_ERROR_BIT|PVFS_ERROR_BIT))
208#define PVFS_ENORECVR (6|(PVFS_NON_ERRNO_ERROR_BIT|PVFS_ERROR_BIT))
209#define PVFS_ETRYAGAIN (7|(PVFS_NON_ERRNO_ERROR_BIT|PVFS_ERROR_BIT))
210#define PVFS_ENOTPVFS (8|(PVFS_NON_ERRNO_ERROR_BIT|PVFS_ERROR_BIT))
211#define PVFS_ESECURITY (9|(PVFS_NON_ERRNO_ERROR_BIT|PVFS_ERROR_BIT))
212
213/*
214 * NOTE: PLEASE DO NOT ARBITRARILY ADD NEW ERRNO ERROR CODES!
215 *
216 * IF YOU CHOOSE TO ADD A NEW ERROR CODE (DESPITE OUR PLEA), YOU ALSO
217 * NEED TO INCREMENT PVFS_ERRNO MAX (BELOW) AND ADD A MAPPING TO A
218 * UNIX ERRNO VALUE IN THE MACROS BELOW (USED IN
219 * src/common/misc/errno-mapping.c and the kernel module)
220 */
221#define PVFS_ERRNO_MAX 61
222
223#define PVFS_ERROR_BMI (1 << 7) /* BMI-specific error */
224#define PVFS_ERROR_TROVE (2 << 7) /* Trove-specific error */
225#define PVFS_ERROR_FLOW (3 << 7)
226#define PVFS_ERROR_SM (4 << 7) /* state machine specific error */
227#define PVFS_ERROR_SCHED (5 << 7)
228#define PVFS_ERROR_CLIENT (6 << 7)
229#define PVFS_ERROR_DEV (7 << 7) /* device file interaction */
230
231#define PVFS_ERROR_CLASS_BITS \
232 (PVFS_ERROR_BMI | \
233 PVFS_ERROR_TROVE | \
234 PVFS_ERROR_FLOW | \
235 PVFS_ERROR_SM | \
236 PVFS_ERROR_SCHED | \
237 PVFS_ERROR_CLIENT | \
238 PVFS_ERROR_DEV)
239
240#define DECLARE_ERRNO_MAPPING() \
241__s32 PINT_errno_mapping[PVFS_ERRNO_MAX + 1] = { \
242 0, /* leave this one empty */ \
243 EPERM, /* 1 */ \
244 ENOENT, \
245 EINTR, \
246 EIO, \
247 ENXIO, \
248 EBADF, \
249 EAGAIN, \
250 ENOMEM, \
251 EFAULT, \
252 EBUSY, /* 10 */ \
253 EEXIST, \
254 ENODEV, \
255 ENOTDIR, \
256 EISDIR, \
257 EINVAL, \
258 EMFILE, \
259 EFBIG, \
260 ENOSPC, \
261 EROFS, \
262 EMLINK, /* 20 */ \
263 EPIPE, \
264 EDEADLK, \
265 ENAMETOOLONG, \
266 ENOLCK, \
267 ENOSYS, \
268 ENOTEMPTY, \
269 ELOOP, \
270 EWOULDBLOCK, \
271 ENOMSG, \
272 EUNATCH, /* 30 */ \
273 EBADR, \
274 EDEADLOCK, \
275 ENODATA, \
276 ETIME, \
277 ENONET, \
278 EREMOTE, \
279 ECOMM, \
280 EPROTO, \
281 EBADMSG, \
282 EOVERFLOW, /* 40 */ \
283 ERESTART, \
284 EMSGSIZE, \
285 EPROTOTYPE, \
286 ENOPROTOOPT, \
287 EPROTONOSUPPORT, \
288 EOPNOTSUPP, \
289 EADDRINUSE, \
290 EADDRNOTAVAIL, \
291 ENETDOWN, \
292 ENETUNREACH, /* 50 */ \
293 ENETRESET, \
294 ENOBUFS, \
295 ETIMEDOUT, \
296 ECONNREFUSED, \
297 EHOSTDOWN, \
298 EHOSTUNREACH, \
299 EALREADY, \
300 EACCES, \
301 ECONNRESET, /* 59 */ \
302 ERANGE, \
303 0 /* PVFS_ERRNO_MAX */ \
304}; \
305const char *PINT_non_errno_strerror_mapping[] = { \
306 "Success", /* 0 */ \
307 "Operation cancelled (possibly due to timeout)", \
308 "Device initialization failed", \
309 "Detailed per-server errors are available", \
310 "Unknown host", \
311 "No address associated with name", \
312 "Unknown server error", \
313 "Host name lookup failure", \
314 "Path contains non-PVFS elements", \
315 "Security error", \
316}; \
317__s32 PINT_non_errno_mapping[] = { \
318 0, /* leave this one empty */ \
319 PVFS_ECANCEL, /* 1 */ \
320 PVFS_EDEVINIT, /* 2 */ \
321 PVFS_EDETAIL, /* 3 */ \
322 PVFS_EHOSTNTFD, /* 4 */ \
323 PVFS_EADDRNTFD, /* 5 */ \
324 PVFS_ENORECVR, /* 6 */ \
325 PVFS_ETRYAGAIN, /* 7 */ \
326 PVFS_ENOTPVFS, /* 8 */ \
327 PVFS_ESECURITY, /* 9 */ \
328}
329
330/*
331 * NOTE: PVFS_get_errno_mapping will convert a PVFS_ERROR_CODE to an
332 * errno value. If the error code is a pvfs2 specific error code
333 * (i.e. a PVFS_NON_ERRNO_ERROR_CODE), PVFS_get_errno_mapping will
334 * return an index into the PINT_non_errno_strerror_mapping array which
335 * can be used for getting the pvfs2 specific strerror message given
336 * the error code. if the value is not a recognized error code, the
337 * passed in value will be returned unchanged.
338 */
339#define DECLARE_ERRNO_MAPPING_AND_FN() \
340extern __s32 PINT_errno_mapping[]; \
341extern __s32 PINT_non_errno_mapping[]; \
342extern const char *PINT_non_errno_strerror_mapping[]; \
343__s32 PVFS_get_errno_mapping(__s32 error) \
344{ \
345 __s32 ret = error, mask = 0; \
346 __s32 positive = ((error > -1) ? 1 : 0); \
347 if (IS_PVFS_NON_ERRNO_ERROR((positive ? error : -error))) { \
348 mask = (PVFS_NON_ERRNO_ERROR_BIT | \
349 PVFS_ERROR_BIT | \
350 PVFS_ERROR_CLASS_BITS); \
351 ret = PVFS_NON_ERRNO_ERROR_CODE(((positive ? \
352 error : \
353 abs(error))) & \
354 ~mask); \
355 } \
356 else if (IS_PVFS_ERROR((positive ? error : -error))) { \
357 mask = (PVFS_ERROR_BIT | \
358 PVFS_ERROR_CLASS_BITS); \
359 ret = PINT_errno_mapping[PVFS_ERROR_CODE(((positive ? \
360 error : \
361 abs(error))) & \
362 ~mask)]; \
363 } \
364 return ret; \
365} \
366__s32 PVFS_errno_to_error(int err) \
367{ \
368 __s32 e = 0; \
369 \
370 for (; e < PVFS_ERRNO_MAX; ++e) \
371 if (PINT_errno_mapping[e] == err) \
372 return e | PVFS_ERROR_BIT; \
373 \
374 return err; \
375} \
376DECLARE_ERRNO_MAPPING()
377
378/* permission bits */
379#define PVFS_O_EXECUTE (1 << 0)
380#define PVFS_O_WRITE (1 << 1)
381#define PVFS_O_READ (1 << 2)
382#define PVFS_G_EXECUTE (1 << 3)
383#define PVFS_G_WRITE (1 << 4)
384#define PVFS_G_READ (1 << 5)
385#define PVFS_U_EXECUTE (1 << 6)
386#define PVFS_U_WRITE (1 << 7)
387#define PVFS_U_READ (1 << 8)
388/* no PVFS_U_VTX (sticky bit) */
389#define PVFS_G_SGID (1 << 10)
390#define PVFS_U_SUID (1 << 11)
391
392/* definition taken from stdint.h */
393#define INT32_MAX (2147483647)
394#define PVFS_ITERATE_START (INT32_MAX - 1)
395#define PVFS_ITERATE_END (INT32_MAX - 2)
396#define PVFS_READDIR_START PVFS_ITERATE_START
397#define PVFS_READDIR_END PVFS_ITERATE_END
398#define PVFS_IMMUTABLE_FL FS_IMMUTABLE_FL
399#define PVFS_APPEND_FL FS_APPEND_FL
400#define PVFS_NOATIME_FL FS_NOATIME_FL
401#define PVFS_MIRROR_FL 0x01000000ULL
402#define PVFS_O_EXECUTE (1 << 0)
403#define PVFS_FS_ID_NULL ((__s32)0)
404#define PVFS_ATTR_SYS_UID (1 << 0)
405#define PVFS_ATTR_SYS_GID (1 << 1)
406#define PVFS_ATTR_SYS_PERM (1 << 2)
407#define PVFS_ATTR_SYS_ATIME (1 << 3)
408#define PVFS_ATTR_SYS_CTIME (1 << 4)
409#define PVFS_ATTR_SYS_MTIME (1 << 5)
410#define PVFS_ATTR_SYS_TYPE (1 << 6)
411#define PVFS_ATTR_SYS_ATIME_SET (1 << 7)
412#define PVFS_ATTR_SYS_MTIME_SET (1 << 8)
413#define PVFS_ATTR_SYS_SIZE (1 << 20)
414#define PVFS_ATTR_SYS_LNK_TARGET (1 << 24)
415#define PVFS_ATTR_SYS_DFILE_COUNT (1 << 25)
416#define PVFS_ATTR_SYS_DIRENT_COUNT (1 << 26)
417#define PVFS_ATTR_SYS_BLKSIZE (1 << 28)
418#define PVFS_ATTR_SYS_MIRROR_COPIES_COUNT (1 << 29)
419#define PVFS_ATTR_SYS_COMMON_ALL \
420 (PVFS_ATTR_SYS_UID | \
421 PVFS_ATTR_SYS_GID | \
422 PVFS_ATTR_SYS_PERM | \
423 PVFS_ATTR_SYS_ATIME | \
424 PVFS_ATTR_SYS_CTIME | \
425 PVFS_ATTR_SYS_MTIME | \
426 PVFS_ATTR_SYS_TYPE)
427
428#define PVFS_ATTR_SYS_ALL_SETABLE \
429(PVFS_ATTR_SYS_COMMON_ALL-PVFS_ATTR_SYS_TYPE)
430
431#define PVFS_ATTR_SYS_ALL_NOHINT \
432 (PVFS_ATTR_SYS_COMMON_ALL | \
433 PVFS_ATTR_SYS_SIZE | \
434 PVFS_ATTR_SYS_LNK_TARGET | \
435 PVFS_ATTR_SYS_DFILE_COUNT | \
436 PVFS_ATTR_SYS_MIRROR_COPIES_COUNT | \
437 PVFS_ATTR_SYS_DIRENT_COUNT | \
438 PVFS_ATTR_SYS_BLKSIZE)
439#define PVFS_XATTR_REPLACE 0x2
440#define PVFS_XATTR_CREATE 0x1
441#define PVFS_MAX_SERVER_ADDR_LEN 256
442#define PVFS_NAME_MAX 256
443/*
444 * max extended attribute name len as imposed by the VFS and exploited for the
445 * upcall request types.
446 * NOTE: Please retain them as multiples of 8 even if you wish to change them
447 * This is *NECESSARY* for supporting 32 bit user-space binaries on a 64-bit
448 * kernel. Due to implementation within DBPF, this really needs to be
449 * PVFS_NAME_MAX, which it was the same value as, but no reason to let it
450 * break if that changes in the future.
451 */
452#define PVFS_MAX_XATTR_NAMELEN PVFS_NAME_MAX /* Not the same as
453 * XATTR_NAME_MAX defined
454 * by <linux/xattr.h>
455 */
456#define PVFS_MAX_XATTR_VALUELEN 8192 /* Not the same as XATTR_SIZE_MAX
457 * defined by <linux/xattr.h>
458 */
459#define PVFS_MAX_XATTR_LISTLEN 16 /* Not the same as XATTR_LIST_MAX
460 * defined by <linux/xattr.h>
461 */
462/*
463 * PVFS I/O operation types, used in both system and server interfaces.
464 */
465enum PVFS_io_type {
466 PVFS_IO_READ = 1,
467 PVFS_IO_WRITE = 2
468};
469
470/*
471 * If this enum is modified the server parameters related to the precreate pool
472 * batch and low threshold sizes may need to be modified to reflect this
473 * change.
474 */
475enum pvfs2_ds_type {
476 PVFS_TYPE_NONE = 0,
477 PVFS_TYPE_METAFILE = (1 << 0),
478 PVFS_TYPE_DATAFILE = (1 << 1),
479 PVFS_TYPE_DIRECTORY = (1 << 2),
480 PVFS_TYPE_SYMLINK = (1 << 3),
481 PVFS_TYPE_DIRDATA = (1 << 4),
482 PVFS_TYPE_INTERNAL = (1 << 5) /* for the server's private use */
483};
484
485/*
486 * PVFS_certificate simply stores a buffer with the buffer size.
487 * The buffer can be converted to an OpenSSL X509 struct for use.
488 */
489struct PVFS_certificate {
490 __u32 buf_size;
491 unsigned char *buf;
492};
493
494/*
495 * A credential identifies a user and is signed by the client/user
496 * private key.
497 */
498struct PVFS_credential {
499 __u32 userid; /* user id */
500 __u32 num_groups; /* length of group_array */
501 __u32 *group_array; /* groups for which the user is a member */
502 char *issuer; /* alias of the issuing server */
503 __u64 timeout; /* seconds after epoch to time out */
504 __u32 sig_size; /* length of the signature in bytes */
505 unsigned char *signature; /* digital signature */
506 struct PVFS_certificate certificate; /* user certificate buffer */
507};
508#define extra_size_PVFS_credential (PVFS_REQ_LIMIT_GROUPS * \
509 sizeof(__u32) + \
510 PVFS_REQ_LIMIT_ISSUER + \
511 PVFS_REQ_LIMIT_SIGNATURE + \
512 extra_size_PVFS_certificate)
513
514/* This structure is used by the VFS-client interaction alone */
515struct PVFS_keyval_pair {
516 char key[PVFS_MAX_XATTR_NAMELEN];
517 __s32 key_sz; /* __s32 for portable, fixed-size structures */
518 __s32 val_sz;
519 char val[PVFS_MAX_XATTR_VALUELEN];
520};
521
522/* pvfs2-sysint.h ***********************************************************/
523/* Describes attributes for a file, directory, or symlink. */
524struct PVFS_sys_attr_s {
525 __u32 owner;
526 __u32 group;
527 __u32 perms;
528 __u64 atime;
529 __u64 mtime;
530 __u64 ctime;
531 __s64 size;
532
533 /* NOTE: caller must free if valid */
534 char *link_target;
535
536 /* Changed to __s32 so that size of structure does not change */
537 __s32 dfile_count;
538
539 /* Changed to __s32 so that size of structure does not change */
540 __s32 distr_dir_servers_initial;
541
542 /* Changed to __s32 so that size of structure does not change */
543 __s32 distr_dir_servers_max;
544
545 /* Changed to __s32 so that size of structure does not change */
546 __s32 distr_dir_split_size;
547
548 __u32 mirror_copies_count;
549
550 /* NOTE: caller must free if valid */
551 char *dist_name;
552
553 /* NOTE: caller must free if valid */
554 char *dist_params;
555
556 __s64 dirent_count;
557 enum pvfs2_ds_type objtype;
558 __u64 flags;
559 __u32 mask;
560 __s64 blksize;
561};
562
563#define PVFS2_LOOKUP_LINK_NO_FOLLOW 0
564#define PVFS2_LOOKUP_LINK_FOLLOW 1
565
566/* pint-dev.h ***************************************************************/
567
568/* parameter structure used in PVFS_DEV_DEBUG ioctl command */
569struct dev_mask_info_s {
570 enum {
571 KERNEL_MASK,
572 CLIENT_MASK,
573 } mask_type;
574 __u64 mask_value;
575};
576
577struct dev_mask2_info_s {
578 __u64 mask1_value;
579 __u64 mask2_value;
580};
581
582/* pvfs2-util.h *************************************************************/
583#define PVFS_util_min(x1, x2) (((x1) > (x2)) ? (x2) : (x1))
584__s32 PVFS_util_translate_mode(int mode);
585
586/* pvfs2-debug.h ************************************************************/
587#include "pvfs2-debug.h"
588
589/* pvfs2-internal.h *********************************************************/
590#define llu(x) (unsigned long long)(x)
591#define lld(x) (long long)(x)
592
593/* pint-dev-shared.h ********************************************************/
594#define PVFS_DEV_MAGIC 'k'
595
596#define PVFS2_READDIR_DEFAULT_DESC_COUNT 5
597
598#define DEV_GET_MAGIC 0x1
599#define DEV_GET_MAX_UPSIZE 0x2
600#define DEV_GET_MAX_DOWNSIZE 0x3
601#define DEV_MAP 0x4
602#define DEV_REMOUNT_ALL 0x5
603#define DEV_DEBUG 0x6
604#define DEV_UPSTREAM 0x7
605#define DEV_CLIENT_MASK 0x8
606#define DEV_CLIENT_STRING 0x9
607#define DEV_MAX_NR 0xa
608
609/* supported ioctls, codes are with respect to user-space */
610enum {
611 PVFS_DEV_GET_MAGIC = _IOW(PVFS_DEV_MAGIC, DEV_GET_MAGIC, __s32),
612 PVFS_DEV_GET_MAX_UPSIZE =
613 _IOW(PVFS_DEV_MAGIC, DEV_GET_MAX_UPSIZE, __s32),
614 PVFS_DEV_GET_MAX_DOWNSIZE =
615 _IOW(PVFS_DEV_MAGIC, DEV_GET_MAX_DOWNSIZE, __s32),
616 PVFS_DEV_MAP = _IO(PVFS_DEV_MAGIC, DEV_MAP),
617 PVFS_DEV_REMOUNT_ALL = _IO(PVFS_DEV_MAGIC, DEV_REMOUNT_ALL),
618 PVFS_DEV_DEBUG = _IOR(PVFS_DEV_MAGIC, DEV_DEBUG, __s32),
619 PVFS_DEV_UPSTREAM = _IOW(PVFS_DEV_MAGIC, DEV_UPSTREAM, int),
620 PVFS_DEV_CLIENT_MASK = _IOW(PVFS_DEV_MAGIC,
621 DEV_CLIENT_MASK,
622 struct dev_mask2_info_s),
623 PVFS_DEV_CLIENT_STRING = _IOW(PVFS_DEV_MAGIC,
624 DEV_CLIENT_STRING,
625 char *),
626 PVFS_DEV_MAXNR = DEV_MAX_NR,
627};
628
629/*
630 * version number for use in communicating between kernel space and user
631 * space
632 */
633/*
634#define PVFS_KERNEL_PROTO_VERSION \
635 ((PVFS2_VERSION_MAJOR * 10000) + \
636 (PVFS2_VERSION_MINOR * 100) + \
637 PVFS2_VERSION_SUB)
638*/
639#define PVFS_KERNEL_PROTO_VERSION 0
640
641/*
642 * describes memory regions to map in the PVFS_DEV_MAP ioctl.
643 * NOTE: See devpvfs2-req.c for 32 bit compat structure.
644 * Since this structure has a variable-sized layout that is different
645 * on 32 and 64 bit platforms, we need to normalize to a 64 bit layout
646 * on such systems before servicing ioctl calls from user-space binaries
647 * that may be 32 bit!
648 */
649struct PVFS_dev_map_desc {
650 void *ptr;
651 __s32 total_size;
652 __s32 size;
653 __s32 count;
654};
655
656/* gossip.h *****************************************************************/
657
658#ifdef GOSSIP_DISABLE_DEBUG
659#define gossip_debug(mask, format, f...) do {} while (0)
660#else
661extern __u64 gossip_debug_mask;
662extern struct client_debug_mask client_debug_mask;
663
664/* try to avoid function call overhead by checking masks in macro */
665#define gossip_debug(mask, format, f...) \
666do { \
667 if (gossip_debug_mask & mask) \
668 printk(format, ##f); \
669} while (0)
670#endif /* GOSSIP_DISABLE_DEBUG */
671
672/* do file and line number printouts w/ the GNU preprocessor */
673#define gossip_ldebug(mask, format, f...) \
674 gossip_debug(mask, "%s: " format, __func__, ##f)
675
676#define gossip_err printk
677#define gossip_lerr(format, f...) \
678 gossip_err("%s line %d: " format, \
679 __FILE__, \
680 __LINE__, \
681 ##f)
diff --git a/fs/orangefs/pvfs2-bufmap.h b/fs/orangefs/pvfs2-bufmap.h
new file mode 100644
index 000000000000..e269deafbb74
--- /dev/null
+++ b/fs/orangefs/pvfs2-bufmap.h
@@ -0,0 +1,76 @@
1/*
2 * (C) 2001 Clemson University and The University of Chicago
3 *
4 * See COPYING in top-level directory.
5 */
6
7#ifndef __PVFS2_BUFMAP_H
8#define __PVFS2_BUFMAP_H
9
10/* used to describe mapped buffers */
11struct pvfs_bufmap_desc {
12 void *uaddr; /* user space address pointer */
13 struct page **page_array; /* array of mapped pages */
14 int array_count; /* size of above arrays */
15 struct list_head list_link;
16};
17
18struct pvfs2_bufmap;
19
20struct pvfs2_bufmap *pvfs2_bufmap_ref(void);
21void pvfs2_bufmap_unref(struct pvfs2_bufmap *bufmap);
22
23/*
24 * pvfs_bufmap_size_query is now an inline function because buffer
25 * sizes are not hardcoded
26 */
27int pvfs_bufmap_size_query(void);
28
29int pvfs_bufmap_shift_query(void);
30
31int pvfs_bufmap_initialize(struct PVFS_dev_map_desc *user_desc);
32
33int get_bufmap_init(void);
34
35void pvfs_bufmap_finalize(void);
36
37int pvfs_bufmap_get(struct pvfs2_bufmap **mapp, int *buffer_index);
38
39void pvfs_bufmap_put(struct pvfs2_bufmap *bufmap, int buffer_index);
40
41int readdir_index_get(struct pvfs2_bufmap **mapp, int *buffer_index);
42
43void readdir_index_put(struct pvfs2_bufmap *bufmap, int buffer_index);
44
45int pvfs_bufmap_copy_iovec_from_user(struct pvfs2_bufmap *bufmap,
46 int buffer_index,
47 const struct iovec *iov,
48 unsigned long nr_segs,
49 size_t size);
50
51int pvfs_bufmap_copy_iovec_from_kernel(struct pvfs2_bufmap *bufmap,
52 int buffer_index,
53 const struct iovec *iov,
54 unsigned long nr_segs,
55 size_t size);
56
57int pvfs_bufmap_copy_to_user_iovec(struct pvfs2_bufmap *bufmap,
58 int buffer_index,
59 const struct iovec *iov,
60 unsigned long nr_segs,
61 size_t size);
62
63int pvfs_bufmap_copy_to_kernel_iovec(struct pvfs2_bufmap *bufmap,
64 int buffer_index,
65 const struct iovec *iov,
66 unsigned long nr_segs,
67 size_t size);
68
69size_t pvfs_bufmap_copy_to_user_task_iovec(struct task_struct *tsk,
70 struct iovec *iovec,
71 unsigned long nr_segs,
72 struct pvfs2_bufmap *bufmap,
73 int buffer_index,
74 size_t bytes_to_be_copied);
75
76#endif /* __PVFS2_BUFMAP_H */
diff --git a/fs/orangefs/pvfs2-debug.h b/fs/orangefs/pvfs2-debug.h
new file mode 100644
index 000000000000..4c27ad77fa16
--- /dev/null
+++ b/fs/orangefs/pvfs2-debug.h
@@ -0,0 +1,290 @@
1/*
2 * (C) 2001 Clemson University and The University of Chicago
3 *
4 * See COPYING in top-level directory.
5 */
6
7/* This file just defines debugging masks to be used with the gossip
8 * logging utility. All debugging masks for PVFS2 are kept here to make
9 * sure we don't have collisions.
10 */
11
12#ifndef __PVFS2_DEBUG_H
13#define __PVFS2_DEBUG_H
14
15#ifdef __KERNEL__
16#include <linux/types.h>
17#else
18#include <stdint.h>
19#endif
20
21#define GOSSIP_NO_DEBUG (__u64)0
22#define GOSSIP_BMI_DEBUG_TCP ((__u64)1 << 0)
23#define GOSSIP_BMI_DEBUG_CONTROL ((__u64)1 << 1)
24#define GOSSIP_BMI_DEBUG_OFFSETS ((__u64)1 << 2)
25#define GOSSIP_BMI_DEBUG_GM ((__u64)1 << 3)
26#define GOSSIP_JOB_DEBUG ((__u64)1 << 4)
27#define GOSSIP_SERVER_DEBUG ((__u64)1 << 5)
28#define GOSSIP_STO_DEBUG_CTRL ((__u64)1 << 6)
29#define GOSSIP_STO_DEBUG_DEFAULT ((__u64)1 << 7)
30#define GOSSIP_FLOW_DEBUG ((__u64)1 << 8)
31#define GOSSIP_BMI_DEBUG_GM_MEM ((__u64)1 << 9)
32#define GOSSIP_REQUEST_DEBUG ((__u64)1 << 10)
33#define GOSSIP_FLOW_PROTO_DEBUG ((__u64)1 << 11)
34#define GOSSIP_NCACHE_DEBUG ((__u64)1 << 12)
35#define GOSSIP_CLIENT_DEBUG ((__u64)1 << 13)
36#define GOSSIP_REQ_SCHED_DEBUG ((__u64)1 << 14)
37#define GOSSIP_ACACHE_DEBUG ((__u64)1 << 15)
38#define GOSSIP_TROVE_DEBUG ((__u64)1 << 16)
39#define GOSSIP_TROVE_OP_DEBUG ((__u64)1 << 17)
40#define GOSSIP_DIST_DEBUG ((__u64)1 << 18)
41#define GOSSIP_BMI_DEBUG_IB ((__u64)1 << 19)
42#define GOSSIP_DBPF_ATTRCACHE_DEBUG ((__u64)1 << 20)
43#define GOSSIP_MMAP_RCACHE_DEBUG ((__u64)1 << 21)
44#define GOSSIP_LOOKUP_DEBUG ((__u64)1 << 22)
45#define GOSSIP_REMOVE_DEBUG ((__u64)1 << 23)
46#define GOSSIP_GETATTR_DEBUG ((__u64)1 << 24)
47#define GOSSIP_READDIR_DEBUG ((__u64)1 << 25)
48#define GOSSIP_IO_DEBUG ((__u64)1 << 26)
49#define GOSSIP_DBPF_OPEN_CACHE_DEBUG ((__u64)1 << 27)
50#define GOSSIP_PERMISSIONS_DEBUG ((__u64)1 << 28)
51#define GOSSIP_CANCEL_DEBUG ((__u64)1 << 29)
52#define GOSSIP_MSGPAIR_DEBUG ((__u64)1 << 30)
53#define GOSSIP_CLIENTCORE_DEBUG ((__u64)1 << 31)
54#define GOSSIP_CLIENTCORE_TIMING_DEBUG ((__u64)1 << 32)
55#define GOSSIP_SETATTR_DEBUG ((__u64)1 << 33)
56#define GOSSIP_MKDIR_DEBUG ((__u64)1 << 34)
57#define GOSSIP_VARSTRIP_DEBUG ((__u64)1 << 35)
58#define GOSSIP_GETEATTR_DEBUG ((__u64)1 << 36)
59#define GOSSIP_SETEATTR_DEBUG ((__u64)1 << 37)
60#define GOSSIP_ENDECODE_DEBUG ((__u64)1 << 38)
61#define GOSSIP_DELEATTR_DEBUG ((__u64)1 << 39)
62#define GOSSIP_ACCESS_DEBUG ((__u64)1 << 40)
63#define GOSSIP_ACCESS_DETAIL_DEBUG ((__u64)1 << 41)
64#define GOSSIP_LISTEATTR_DEBUG ((__u64)1 << 42)
65#define GOSSIP_PERFCOUNTER_DEBUG ((__u64)1 << 43)
66#define GOSSIP_STATE_MACHINE_DEBUG ((__u64)1 << 44)
67#define GOSSIP_DBPF_KEYVAL_DEBUG ((__u64)1 << 45)
68#define GOSSIP_LISTATTR_DEBUG ((__u64)1 << 46)
69#define GOSSIP_DBPF_COALESCE_DEBUG ((__u64)1 << 47)
70#define GOSSIP_ACCESS_HOSTNAMES ((__u64)1 << 48)
71#define GOSSIP_FSCK_DEBUG ((__u64)1 << 49)
72#define GOSSIP_BMI_DEBUG_MX ((__u64)1 << 50)
73#define GOSSIP_BSTREAM_DEBUG ((__u64)1 << 51)
74#define GOSSIP_BMI_DEBUG_PORTALS ((__u64)1 << 52)
75#define GOSSIP_USER_DEV_DEBUG ((__u64)1 << 53)
76#define GOSSIP_DIRECTIO_DEBUG ((__u64)1 << 54)
77#define GOSSIP_MGMT_DEBUG ((__u64)1 << 55)
78#define GOSSIP_MIRROR_DEBUG ((__u64)1 << 56)
79#define GOSSIP_WIN_CLIENT_DEBUG ((__u64)1 << 57)
80#define GOSSIP_SECURITY_DEBUG ((__u64)1 << 58)
81#define GOSSIP_USRINT_DEBUG ((__u64)1 << 59)
82#define GOSSIP_RCACHE_DEBUG ((__u64)1 << 60)
83#define GOSSIP_SECCACHE_DEBUG ((__u64)1 << 61)
84
85#define GOSSIP_BMI_DEBUG_ALL ((__u64) (GOSSIP_BMI_DEBUG_TCP + \
86 GOSSIP_BMI_DEBUG_CONTROL + \
87 GOSSIP_BMI_DEBUG_GM + \
88 GOSSIP_BMI_DEBUG_OFFSETS + \
89 GOSSIP_BMI_DEBUG_IB + \
90 GOSSIP_BMI_DEBUG_MX + \
91 GOSSIP_BMI_DEBUG_PORTALS))
92
93const char *PVFS_debug_get_next_debug_keyword(int position);
94
95#define GOSSIP_SUPER_DEBUG ((__u64)1 << 0)
96#define GOSSIP_INODE_DEBUG ((__u64)1 << 1)
97#define GOSSIP_FILE_DEBUG ((__u64)1 << 2)
98#define GOSSIP_DIR_DEBUG ((__u64)1 << 3)
99#define GOSSIP_UTILS_DEBUG ((__u64)1 << 4)
100#define GOSSIP_WAIT_DEBUG ((__u64)1 << 5)
101#define GOSSIP_ACL_DEBUG ((__u64)1 << 6)
102#define GOSSIP_DCACHE_DEBUG ((__u64)1 << 7)
103#define GOSSIP_DEV_DEBUG ((__u64)1 << 8)
104#define GOSSIP_NAME_DEBUG ((__u64)1 << 9)
105#define GOSSIP_BUFMAP_DEBUG ((__u64)1 << 10)
106#define GOSSIP_CACHE_DEBUG ((__u64)1 << 11)
107#define GOSSIP_DEBUGFS_DEBUG ((__u64)1 << 12)
108#define GOSSIP_XATTR_DEBUG ((__u64)1 << 13)
109#define GOSSIP_INIT_DEBUG ((__u64)1 << 14)
110#define GOSSIP_SYSFS_DEBUG ((__u64)1 << 15)
111
112#define GOSSIP_MAX_NR 16
113#define GOSSIP_MAX_DEBUG (((__u64)1 << GOSSIP_MAX_NR) - 1)
114
115/*function prototypes*/
116__u64 PVFS_kmod_eventlog_to_mask(const char *event_logging);
117__u64 PVFS_debug_eventlog_to_mask(const char *event_logging);
118char *PVFS_debug_mask_to_eventlog(__u64 mask);
119char *PVFS_kmod_mask_to_eventlog(__u64 mask);
120
121/* a private internal type */
122struct __keyword_mask_s {
123 const char *keyword;
124 __u64 mask_val;
125};
126
127#define __DEBUG_ALL ((__u64) -1)
128
129/* map all config keywords to pvfs2 debug masks here */
130static struct __keyword_mask_s s_keyword_mask_map[] = {
131 /* Log trove debugging info. Same as 'trove'. */
132 {"storage", GOSSIP_TROVE_DEBUG},
133 /* Log trove debugging info. Same as 'storage'. */
134 {"trove", GOSSIP_TROVE_DEBUG},
135 /* Log trove operations. */
136 {"trove_op", GOSSIP_TROVE_OP_DEBUG},
137 /* Log network debug info. */
138 {"network", GOSSIP_BMI_DEBUG_ALL},
139 /* Log server info, including new operations. */
140 {"server", GOSSIP_SERVER_DEBUG},
141 /* Log client sysint info. This is only useful for the client. */
142 {"client", GOSSIP_CLIENT_DEBUG},
143 /* Debug the varstrip distribution */
144 {"varstrip", GOSSIP_VARSTRIP_DEBUG},
145 /* Log job info */
146 {"job", GOSSIP_JOB_DEBUG},
147 /* Debug PINT_process_request calls. EXTREMELY verbose! */
148 {"request", GOSSIP_REQUEST_DEBUG},
149 /* Log request scheduler events */
150 {"reqsched", GOSSIP_REQ_SCHED_DEBUG},
151 /* Log the flow protocol events, including flowproto_multiqueue */
152 {"flowproto", GOSSIP_FLOW_PROTO_DEBUG},
153 /* Log flow calls */
154 {"flow", GOSSIP_FLOW_DEBUG},
155 /* Debug the client name cache. Only useful on the client. */
156 {"ncache", GOSSIP_NCACHE_DEBUG},
157 /* Debug read-ahead cache events. Only useful on the client. */
158 {"mmaprcache", GOSSIP_MMAP_RCACHE_DEBUG},
159 /* Debug the attribute cache. Only useful on the client. */
160 {"acache", GOSSIP_ACACHE_DEBUG},
161 /* Log/Debug distribution calls */
162 {"distribution", GOSSIP_DIST_DEBUG},
163 /* Debug the server-side dbpf attribute cache */
164 {"dbpfattrcache", GOSSIP_DBPF_ATTRCACHE_DEBUG},
165 /* Debug the client lookup state machine. */
166 {"lookup", GOSSIP_LOOKUP_DEBUG},
167 /* Debug the client remove state macine. */
168 {"remove", GOSSIP_REMOVE_DEBUG},
169 /* Debug the server getattr state machine. */
170 {"getattr", GOSSIP_GETATTR_DEBUG},
171 /* Debug the server setattr state machine. */
172 {"setattr", GOSSIP_SETATTR_DEBUG},
173 /* vectored getattr server state machine */
174 {"listattr", GOSSIP_LISTATTR_DEBUG},
175 /* Debug the client and server get ext attributes SM. */
176 {"geteattr", GOSSIP_GETEATTR_DEBUG},
177 /* Debug the client and server set ext attributes SM. */
178 {"seteattr", GOSSIP_SETEATTR_DEBUG},
179 /* Debug the readdir operation (client and server) */
180 {"readdir", GOSSIP_READDIR_DEBUG},
181 /* Debug the mkdir operation (server only) */
182 {"mkdir", GOSSIP_MKDIR_DEBUG},
183 /* Debug the io operation (reads and writes)
184 * for both the client and server */
185 {"io", GOSSIP_IO_DEBUG},
186 /* Debug the server's open file descriptor cache */
187 {"open_cache", GOSSIP_DBPF_OPEN_CACHE_DEBUG},
188 /* Debug permissions checking on the server */
189 {"permissions", GOSSIP_PERMISSIONS_DEBUG},
190 /* Debug the cancel operation */
191 {"cancel", GOSSIP_CANCEL_DEBUG},
192 /* Debug the msgpair state machine */
193 {"msgpair", GOSSIP_MSGPAIR_DEBUG},
194 /* Debug the client core app */
195 {"clientcore", GOSSIP_CLIENTCORE_DEBUG},
196 /* Debug the client timing state machines (job timeout, etc.) */
197 {"clientcore_timing", GOSSIP_CLIENTCORE_TIMING_DEBUG},
198 /* network encoding */
199 {"endecode", GOSSIP_ENDECODE_DEBUG},
200 /* Show server file (metadata) accesses (both modify and read-only). */
201 {"access", GOSSIP_ACCESS_DEBUG},
202 /* Show more detailed server file accesses */
203 {"access_detail", GOSSIP_ACCESS_DETAIL_DEBUG},
204 /* Debug the listeattr operation */
205 {"listeattr", GOSSIP_LISTEATTR_DEBUG},
206 /* Debug the state machine management code */
207 {"sm", GOSSIP_STATE_MACHINE_DEBUG},
208 /* Debug the metadata dbpf keyval functions */
209 {"keyval", GOSSIP_DBPF_KEYVAL_DEBUG},
210 /* Debug the metadata sync coalescing code */
211 {"coalesce", GOSSIP_DBPF_COALESCE_DEBUG},
212 /* Display the hostnames instead of IP addrs in debug output */
213 {"access_hostnames", GOSSIP_ACCESS_HOSTNAMES},
214 /* Show the client device events */
215 {"user_dev", GOSSIP_USER_DEV_DEBUG},
216 /* Debug the fsck tool */
217 {"fsck", GOSSIP_FSCK_DEBUG},
218 /* Debug the bstream code */
219 {"bstream", GOSSIP_BSTREAM_DEBUG},
220 /* Debug trove in direct io mode */
221 {"directio", GOSSIP_DIRECTIO_DEBUG},
222 /* Debug direct io thread management */
223 {"mgmt", GOSSIP_MGMT_DEBUG},
224 /* Debug mirroring process */
225 {"mirror", GOSSIP_MIRROR_DEBUG},
226 /* Windows client */
227 {"win_client", GOSSIP_WIN_CLIENT_DEBUG},
228 /* Debug robust security code */
229 {"security", GOSSIP_SECURITY_DEBUG},
230 /* Capability Cache */
231 {"seccache", GOSSIP_SECCACHE_DEBUG},
232 /* Client User Interface */
233 {"usrint", GOSSIP_USRINT_DEBUG},
234 /* rcache */
235 {"rcache", GOSSIP_RCACHE_DEBUG},
236 /* Everything except the periodic events. Useful for debugging */
237 {"verbose",
238 (__DEBUG_ALL &
239 ~(GOSSIP_PERFCOUNTER_DEBUG | GOSSIP_STATE_MACHINE_DEBUG |
240 GOSSIP_ENDECODE_DEBUG | GOSSIP_USER_DEV_DEBUG))
241 },
242 /* No debug output */
243 {"none", GOSSIP_NO_DEBUG},
244 /* Everything */
245 {"all", __DEBUG_ALL}
246};
247
248#undef __DEBUG_ALL
249
250/*
251 * Map all kmod keywords to kmod debug masks here. Keep this
252 * structure "packed":
253 *
254 * "all" is always last...
255 *
256 * keyword mask_val index
257 * foo 1 0
258 * bar 2 1
259 * baz 4 2
260 * qux 8 3
261 * . . .
262 */
263static struct __keyword_mask_s s_kmod_keyword_mask_map[] = {
264 {"super", GOSSIP_SUPER_DEBUG},
265 {"inode", GOSSIP_INODE_DEBUG},
266 {"file", GOSSIP_FILE_DEBUG},
267 {"dir", GOSSIP_DIR_DEBUG},
268 {"utils", GOSSIP_UTILS_DEBUG},
269 {"wait", GOSSIP_WAIT_DEBUG},
270 {"acl", GOSSIP_ACL_DEBUG},
271 {"dcache", GOSSIP_DCACHE_DEBUG},
272 {"dev", GOSSIP_DEV_DEBUG},
273 {"name", GOSSIP_NAME_DEBUG},
274 {"bufmap", GOSSIP_BUFMAP_DEBUG},
275 {"cache", GOSSIP_CACHE_DEBUG},
276 {"debugfs", GOSSIP_DEBUGFS_DEBUG},
277 {"xattr", GOSSIP_XATTR_DEBUG},
278 {"init", GOSSIP_INIT_DEBUG},
279 {"sysfs", GOSSIP_SYSFS_DEBUG},
280 {"none", GOSSIP_NO_DEBUG},
281 {"all", GOSSIP_MAX_DEBUG}
282};
283
284static const int num_kmod_keyword_mask_map = (int)
285 (sizeof(s_kmod_keyword_mask_map) / sizeof(struct __keyword_mask_s));
286
287static const int num_keyword_mask_map = (int)
288 (sizeof(s_keyword_mask_map) / sizeof(struct __keyword_mask_s));
289
290#endif /* __PVFS2_DEBUG_H */
diff --git a/fs/orangefs/pvfs2-debugfs.h b/fs/orangefs/pvfs2-debugfs.h
new file mode 100644
index 000000000000..a66b7d08c14d
--- /dev/null
+++ b/fs/orangefs/pvfs2-debugfs.h
@@ -0,0 +1,3 @@
1int pvfs2_debugfs_init(void);
2int pvfs2_kernel_debug_init(void);
3void pvfs2_debugfs_cleanup(void);
diff --git a/fs/orangefs/pvfs2-dev-proto.h b/fs/orangefs/pvfs2-dev-proto.h
new file mode 100644
index 000000000000..9c82e6e651f3
--- /dev/null
+++ b/fs/orangefs/pvfs2-dev-proto.h
@@ -0,0 +1,102 @@
1/*
2 * (C) 2001 Clemson University and The University of Chicago
3 *
4 * See COPYING in top-level directory.
5 */
6
7#ifndef _PVFS2_DEV_PROTO_H
8#define _PVFS2_DEV_PROTO_H
9
10/*
11 * types and constants shared between user space and kernel space for
12 * device interaction using a common protocol
13 */
14
15/*
16 * valid pvfs2 kernel operation types
17 */
18#define PVFS2_VFS_OP_INVALID 0xFF000000
19#define PVFS2_VFS_OP_FILE_IO 0xFF000001
20#define PVFS2_VFS_OP_LOOKUP 0xFF000002
21#define PVFS2_VFS_OP_CREATE 0xFF000003
22#define PVFS2_VFS_OP_GETATTR 0xFF000004
23#define PVFS2_VFS_OP_REMOVE 0xFF000005
24#define PVFS2_VFS_OP_MKDIR 0xFF000006
25#define PVFS2_VFS_OP_READDIR 0xFF000007
26#define PVFS2_VFS_OP_SETATTR 0xFF000008
27#define PVFS2_VFS_OP_SYMLINK 0xFF000009
28#define PVFS2_VFS_OP_RENAME 0xFF00000A
29#define PVFS2_VFS_OP_STATFS 0xFF00000B
30#define PVFS2_VFS_OP_TRUNCATE 0xFF00000C
31#define PVFS2_VFS_OP_MMAP_RA_FLUSH 0xFF00000D
32#define PVFS2_VFS_OP_FS_MOUNT 0xFF00000E
33#define PVFS2_VFS_OP_FS_UMOUNT 0xFF00000F
34#define PVFS2_VFS_OP_GETXATTR 0xFF000010
35#define PVFS2_VFS_OP_SETXATTR 0xFF000011
36#define PVFS2_VFS_OP_LISTXATTR 0xFF000012
37#define PVFS2_VFS_OP_REMOVEXATTR 0xFF000013
38#define PVFS2_VFS_OP_PARAM 0xFF000014
39#define PVFS2_VFS_OP_PERF_COUNT 0xFF000015
40#define PVFS2_VFS_OP_CANCEL 0xFF00EE00
41#define PVFS2_VFS_OP_FSYNC 0xFF00EE01
42#define PVFS2_VFS_OP_FSKEY 0xFF00EE02
43#define PVFS2_VFS_OP_READDIRPLUS 0xFF00EE03
44#define PVFS2_VFS_OP_FILE_IOX 0xFF00EE04
45
46/*
47 * Misc constants. Please retain them as multiples of 8!
48 * Otherwise 32-64 bit interactions will be messed up :)
49 */
50#define PVFS2_NAME_LEN 0x00000100
51#define PVFS2_MAX_DEBUG_STRING_LEN 0x00000400
52#define PVFS2_MAX_DEBUG_ARRAY_LEN 0x00000800
53
54/*
55 * MAX_DIRENT_COUNT cannot be larger than PVFS_REQ_LIMIT_LISTATTR.
56 * The value of PVFS_REQ_LIMIT_LISTATTR has been changed from 113 to 60
57 * to accomodate an attribute object with mirrored handles.
58 * MAX_DIRENT_COUNT is replaced by MAX_DIRENT_COUNT_READDIR and
59 * MAX_DIRENT_COUNT_READDIRPLUS, since readdir doesn't trigger a listattr
60 * but readdirplus might.
61*/
62#define MAX_DIRENT_COUNT_READDIR 0x00000060
63#define MAX_DIRENT_COUNT_READDIRPLUS 0x0000003C
64
65#include "upcall.h"
66#include "downcall.h"
67
68/*
69 * These macros differ from proto macros in that they don't do any
70 * byte-swappings and are used to ensure that kernel-clientcore interactions
71 * don't cause any unaligned accesses etc on 64 bit machines
72 */
73#ifndef roundup4
74#define roundup4(x) (((x)+3) & ~3)
75#endif
76
77#ifndef roundup8
78#define roundup8(x) (((x)+7) & ~7)
79#endif
80
81/* strings; decoding just points into existing character data */
82#define enc_string(pptr, pbuf) do { \
83 __u32 len = strlen(*pbuf); \
84 *(__u32 *) *(pptr) = (len); \
85 memcpy(*(pptr)+4, *pbuf, len+1); \
86 *(pptr) += roundup8(4 + len + 1); \
87} while (0)
88
89#define dec_string(pptr, pbuf, plen) do { \
90 __u32 len = (*(__u32 *) *(pptr)); \
91 *pbuf = *(pptr) + 4; \
92 *(pptr) += roundup8(4 + len + 1); \
93 if (plen) \
94 *plen = len;\
95} while (0)
96
97struct read_write_x {
98 __s64 off;
99 __s64 len;
100};
101
102#endif
diff --git a/fs/orangefs/pvfs2-kernel.h b/fs/orangefs/pvfs2-kernel.h
new file mode 100644
index 000000000000..6c787c4797d0
--- /dev/null
+++ b/fs/orangefs/pvfs2-kernel.h
@@ -0,0 +1,864 @@
1/*
2 * (C) 2001 Clemson University and The University of Chicago
3 *
4 * See COPYING in top-level directory.
5 */
6
7/*
8 * The PVFS2 Linux kernel support allows PVFS2 volumes to be mounted and
9 * accessed through the Linux VFS (i.e. using standard I/O system calls).
10 * This support is only needed on clients that wish to mount the file system.
11 *
12 */
13
14/*
15 * Declarations and macros for the PVFS2 Linux kernel support.
16 */
17
18#ifndef __PVFS2KERNEL_H
19#define __PVFS2KERNEL_H
20
21#include <linux/kernel.h>
22#include <linux/moduleparam.h>
23#include <linux/statfs.h>
24#include <linux/backing-dev.h>
25#include <linux/device.h>
26#include <linux/mpage.h>
27#include <linux/namei.h>
28#include <linux/errno.h>
29#include <linux/init.h>
30#include <linux/module.h>
31#include <linux/slab.h>
32#include <linux/types.h>
33#include <linux/fs.h>
34#include <linux/vmalloc.h>
35
36#include <linux/aio.h>
37#include <linux/posix_acl.h>
38#include <linux/posix_acl_xattr.h>
39#include <linux/compat.h>
40#include <linux/mount.h>
41#include <linux/uaccess.h>
42#include <linux/atomic.h>
43#include <linux/uio.h>
44#include <linux/sched.h>
45#include <linux/mm.h>
46#include <linux/wait.h>
47#include <linux/dcache.h>
48#include <linux/pagemap.h>
49#include <linux/poll.h>
50#include <linux/rwsem.h>
51#include <linux/xattr.h>
52#include <linux/exportfs.h>
53
54#include <asm/unaligned.h>
55
56#include "pvfs2-dev-proto.h"
57
58#ifdef PVFS2_KERNEL_DEBUG
59#define PVFS2_DEFAULT_OP_TIMEOUT_SECS 10
60#else
61#define PVFS2_DEFAULT_OP_TIMEOUT_SECS 20
62#endif
63
64#define PVFS2_BUFMAP_WAIT_TIMEOUT_SECS 30
65
66#define PVFS2_DEFAULT_SLOT_TIMEOUT_SECS 900 /* 15 minutes */
67
68#define PVFS2_REQDEVICE_NAME "pvfs2-req"
69
70#define PVFS2_DEVREQ_MAGIC 0x20030529
71#define PVFS2_LINK_MAX 0x000000FF
72#define PVFS2_PURGE_RETRY_COUNT 0x00000005
73#define PVFS2_SEEK_END 0x00000002
74#define PVFS2_MAX_NUM_OPTIONS 0x00000004
75#define PVFS2_MAX_MOUNT_OPT_LEN 0x00000080
76#define PVFS2_MAX_FSKEY_LEN 64
77
78#define MAX_DEV_REQ_UPSIZE (2*sizeof(__s32) + \
79sizeof(__u64) + sizeof(struct pvfs2_upcall_s))
80#define MAX_DEV_REQ_DOWNSIZE (2*sizeof(__s32) + \
81sizeof(__u64) + sizeof(struct pvfs2_downcall_s))
82
83#define BITS_PER_LONG_DIV_8 (BITS_PER_LONG >> 3)
84
85/* borrowed from irda.h */
86#ifndef MSECS_TO_JIFFIES
87#define MSECS_TO_JIFFIES(ms) (((ms)*HZ+999)/1000)
88#endif
89
90#define MAX_ALIGNED_DEV_REQ_UPSIZE \
91 (MAX_DEV_REQ_UPSIZE + \
92 ((((MAX_DEV_REQ_UPSIZE / \
93 (BITS_PER_LONG_DIV_8)) * \
94 (BITS_PER_LONG_DIV_8)) + \
95 (BITS_PER_LONG_DIV_8)) - \
96 MAX_DEV_REQ_UPSIZE))
97
98#define MAX_ALIGNED_DEV_REQ_DOWNSIZE \
99 (MAX_DEV_REQ_DOWNSIZE + \
100 ((((MAX_DEV_REQ_DOWNSIZE / \
101 (BITS_PER_LONG_DIV_8)) * \
102 (BITS_PER_LONG_DIV_8)) + \
103 (BITS_PER_LONG_DIV_8)) - \
104 MAX_DEV_REQ_DOWNSIZE))
105
106/*
107 * valid pvfs2 kernel operation states
108 *
109 * unknown - op was just initialized
110 * waiting - op is on request_list (upward bound)
111 * inprogr - op is in progress (waiting for downcall)
112 * serviced - op has matching downcall; ok
113 * purged - op has to start a timer since client-core
114 * exited uncleanly before servicing op
115 */
116enum pvfs2_vfs_op_states {
117 OP_VFS_STATE_UNKNOWN = 0,
118 OP_VFS_STATE_WAITING = 1,
119 OP_VFS_STATE_INPROGR = 2,
120 OP_VFS_STATE_SERVICED = 4,
121 OP_VFS_STATE_PURGED = 8,
122};
123
124#define set_op_state_waiting(op) ((op)->op_state = OP_VFS_STATE_WAITING)
125#define set_op_state_inprogress(op) ((op)->op_state = OP_VFS_STATE_INPROGR)
126#define set_op_state_serviced(op) ((op)->op_state = OP_VFS_STATE_SERVICED)
127#define set_op_state_purged(op) ((op)->op_state |= OP_VFS_STATE_PURGED)
128
129#define op_state_waiting(op) ((op)->op_state & OP_VFS_STATE_WAITING)
130#define op_state_in_progress(op) ((op)->op_state & OP_VFS_STATE_INPROGR)
131#define op_state_serviced(op) ((op)->op_state & OP_VFS_STATE_SERVICED)
132#define op_state_purged(op) ((op)->op_state & OP_VFS_STATE_PURGED)
133
134#define get_op(op) \
135 do { \
136 atomic_inc(&(op)->aio_ref_count); \
137 gossip_debug(GOSSIP_DEV_DEBUG, \
138 "(get) Alloced OP (%p:%llu)\n", \
139 op, \
140 llu((op)->tag)); \
141 } while (0)
142
143#define put_op(op) \
144 do { \
145 if (atomic_sub_and_test(1, &(op)->aio_ref_count) == 1) { \
146 gossip_debug(GOSSIP_DEV_DEBUG, \
147 "(put) Releasing OP (%p:%llu)\n", \
148 op, \
149 llu((op)->tag)); \
150 op_release(op); \
151 } \
152 } while (0)
153
154#define op_wait(op) (atomic_read(&(op)->aio_ref_count) <= 2 ? 0 : 1)
155
156/*
157 * Defines for controlling whether I/O upcalls are for async or sync operations
158 */
159enum PVFS_async_io_type {
160 PVFS_VFS_SYNC_IO = 0,
161 PVFS_VFS_ASYNC_IO = 1,
162};
163
164/*
165 * An array of client_debug_mask will be built to hold debug keyword/mask
166 * values fetched from userspace.
167 */
168struct client_debug_mask {
169 char *keyword;
170 __u64 mask1;
171 __u64 mask2;
172};
173
174/*
175 * pvfs2 kernel memory related flags
176 */
177
178#if ((defined PVFS2_KERNEL_DEBUG) && (defined CONFIG_DEBUG_SLAB))
179#define PVFS2_CACHE_CREATE_FLAGS SLAB_RED_ZONE
180#else
181#define PVFS2_CACHE_CREATE_FLAGS 0
182#endif /* ((defined PVFS2_KERNEL_DEBUG) && (defined CONFIG_DEBUG_SLAB)) */
183
184#define PVFS2_CACHE_ALLOC_FLAGS (GFP_KERNEL)
185#define PVFS2_GFP_FLAGS (GFP_KERNEL)
186#define PVFS2_BUFMAP_GFP_FLAGS (GFP_KERNEL)
187
188#define pvfs2_kmap(page) kmap(page)
189#define pvfs2_kunmap(page) kunmap(page)
190
191/* pvfs2 xattr and acl related defines */
192#define PVFS2_XATTR_INDEX_POSIX_ACL_ACCESS 1
193#define PVFS2_XATTR_INDEX_POSIX_ACL_DEFAULT 2
194#define PVFS2_XATTR_INDEX_TRUSTED 3
195#define PVFS2_XATTR_INDEX_DEFAULT 4
196
197#if 0
198#ifndef POSIX_ACL_XATTR_ACCESS
199#define POSIX_ACL_XATTR_ACCESS "system.posix_acl_access"
200#endif
201#ifndef POSIX_ACL_XATTR_DEFAULT
202#define POSIX_ACL_XATTR_DEFAULT "system.posix_acl_default"
203#endif
204#endif
205
206#define PVFS2_XATTR_NAME_ACL_ACCESS POSIX_ACL_XATTR_ACCESS
207#define PVFS2_XATTR_NAME_ACL_DEFAULT POSIX_ACL_XATTR_DEFAULT
208#define PVFS2_XATTR_NAME_TRUSTED_PREFIX "trusted."
209#define PVFS2_XATTR_NAME_DEFAULT_PREFIX ""
210
211/* these functions are defined in pvfs2-utils.c */
212int orangefs_prepare_cdm_array(char *debug_array_string);
213int orangefs_prepare_debugfs_help_string(int);
214
215/* defined in pvfs2-debugfs.c */
216int pvfs2_client_debug_init(void);
217
218void debug_string_to_mask(char *, void *, int);
219void do_c_mask(int, char *, struct client_debug_mask **);
220void do_k_mask(int, char *, __u64 **);
221
222void debug_mask_to_string(void *, int);
223void do_k_string(void *, int);
224void do_c_string(void *, int);
225int check_amalgam_keyword(void *, int);
226int keyword_is_amalgam(char *);
227
228/*these variables are defined in pvfs2-mod.c */
229extern char kernel_debug_string[PVFS2_MAX_DEBUG_STRING_LEN];
230extern char client_debug_string[PVFS2_MAX_DEBUG_STRING_LEN];
231extern char client_debug_array_string[PVFS2_MAX_DEBUG_STRING_LEN];
232/* HELLO
233extern struct client_debug_mask current_client_mask;
234*/
235extern unsigned int kernel_mask_set_mod_init;
236
237extern int pvfs2_init_acl(struct inode *inode, struct inode *dir);
238extern const struct xattr_handler *pvfs2_xattr_handlers[];
239
240extern struct posix_acl *pvfs2_get_acl(struct inode *inode, int type);
241extern int pvfs2_set_acl(struct inode *inode, struct posix_acl *acl, int type);
242
243int pvfs2_xattr_set_default(struct dentry *dentry,
244 const char *name,
245 const void *buffer,
246 size_t size,
247 int flags,
248 int handler_flags);
249
250int pvfs2_xattr_get_default(struct dentry *dentry,
251 const char *name,
252 void *buffer,
253 size_t size,
254 int handler_flags);
255
256/*
257 * Redefine xtvec structure so that we could move helper functions out of
258 * the define
259 */
260struct xtvec {
261 __kernel_off_t xtv_off; /* must be off_t */
262 __kernel_size_t xtv_len; /* must be size_t */
263};
264
265/*
266 * pvfs2 data structures
267 */
268struct pvfs2_kernel_op_s {
269 enum pvfs2_vfs_op_states op_state;
270 __u64 tag;
271
272 /*
273 * Set uses_shared_memory to 1 if this operation uses shared memory.
274 * If true, then a retry on the op must also get a new shared memory
275 * buffer and re-populate it.
276 */
277 int uses_shared_memory;
278
279 struct pvfs2_upcall_s upcall;
280 struct pvfs2_downcall_s downcall;
281
282 wait_queue_head_t waitq;
283 spinlock_t lock;
284
285 int io_completed;
286 wait_queue_head_t io_completion_waitq;
287
288 /*
289 * upcalls requiring variable length trailers require that this struct
290 * be in the request list even after client-core does a read() on the
291 * device to dequeue the upcall.
292 * if op_linger field goes to 0, we dequeue this op off the list.
293 * else we let it stay. What gets passed to the read() is
294 * a) if op_linger field is = 1, pvfs2_kernel_op_s itself
295 * b) else if = 0, we pass ->upcall.trailer_buf
296 * We expect to have only a single upcall trailer buffer,
297 * so we expect callers with trailers
298 * to set this field to 2 and others to set it to 1.
299 */
300 __s32 op_linger, op_linger_tmp;
301 /* VFS aio fields */
302
303 /* used by the async I/O code to stash the pvfs2_kiocb_s structure */
304 void *priv;
305
306 /* used again for the async I/O code for deallocation */
307 atomic_t aio_ref_count;
308
309 int attempts;
310
311 struct list_head list;
312};
313
314/* per inode private pvfs2 info */
315struct pvfs2_inode_s {
316 struct pvfs2_object_kref refn;
317 char link_target[PVFS_NAME_MAX];
318 __s64 blksize;
319 /*
320 * Reading/Writing Extended attributes need to acquire the appropriate
321 * reader/writer semaphore on the pvfs2_inode_s structure.
322 */
323 struct rw_semaphore xattr_sem;
324
325 struct inode vfs_inode;
326 sector_t last_failed_block_index_read;
327
328 /*
329 * State of in-memory attributes not yet flushed to disk associated
330 * with this object
331 */
332 unsigned long pinode_flags;
333
334 /* All allocated pvfs2_inode_s objects are chained to a list */
335 struct list_head list;
336};
337
338#define P_ATIME_FLAG 0
339#define P_MTIME_FLAG 1
340#define P_CTIME_FLAG 2
341#define P_MODE_FLAG 3
342
343#define ClearAtimeFlag(pinode) clear_bit(P_ATIME_FLAG, &(pinode)->pinode_flags)
344#define SetAtimeFlag(pinode) set_bit(P_ATIME_FLAG, &(pinode)->pinode_flags)
345#define AtimeFlag(pinode) test_bit(P_ATIME_FLAG, &(pinode)->pinode_flags)
346
347#define ClearMtimeFlag(pinode) clear_bit(P_MTIME_FLAG, &(pinode)->pinode_flags)
348#define SetMtimeFlag(pinode) set_bit(P_MTIME_FLAG, &(pinode)->pinode_flags)
349#define MtimeFlag(pinode) test_bit(P_MTIME_FLAG, &(pinode)->pinode_flags)
350
351#define ClearCtimeFlag(pinode) clear_bit(P_CTIME_FLAG, &(pinode)->pinode_flags)
352#define SetCtimeFlag(pinode) set_bit(P_CTIME_FLAG, &(pinode)->pinode_flags)
353#define CtimeFlag(pinode) test_bit(P_CTIME_FLAG, &(pinode)->pinode_flags)
354
355#define ClearModeFlag(pinode) clear_bit(P_MODE_FLAG, &(pinode)->pinode_flags)
356#define SetModeFlag(pinode) set_bit(P_MODE_FLAG, &(pinode)->pinode_flags)
357#define ModeFlag(pinode) test_bit(P_MODE_FLAG, &(pinode)->pinode_flags)
358
359/* per superblock private pvfs2 info */
360struct pvfs2_sb_info_s {
361 struct pvfs2_khandle root_khandle;
362 __s32 fs_id;
363 int id;
364 int flags;
365#define PVFS2_OPT_INTR 0x01
366#define PVFS2_OPT_LOCAL_LOCK 0x02
367 char devname[PVFS_MAX_SERVER_ADDR_LEN];
368 struct super_block *sb;
369 int mount_pending;
370 struct list_head list;
371};
372
373/*
374 * a temporary structure used only for sb mount time that groups the
375 * mount time data provided along with a private superblock structure
376 * that is allocated before a 'kernel' superblock is allocated.
377*/
378struct pvfs2_mount_sb_info_s {
379 void *data;
380 struct pvfs2_khandle root_khandle;
381 __s32 fs_id;
382 int id;
383};
384
385/*
386 * structure that holds the state of any async I/O operation issued
387 * through the VFS. Needed especially to handle cancellation requests
388 * or even completion notification so that the VFS client-side daemon
389 * can free up its vfs_request slots.
390 */
391struct pvfs2_kiocb_s {
392 /* the pointer to the task that initiated the AIO */
393 struct task_struct *tsk;
394
395 /* pointer to the kiocb that kicked this operation */
396 struct kiocb *kiocb;
397
398 /* buffer index that was used for the I/O */
399 struct pvfs2_bufmap *bufmap;
400 int buffer_index;
401
402 /* pvfs2 kernel operation type */
403 struct pvfs2_kernel_op_s *op;
404
405 /* The user space buffers from/to which I/O is being staged */
406 struct iovec *iov;
407
408 /* number of elements in the iovector */
409 unsigned long nr_segs;
410
411 /* set to indicate the type of the operation */
412 int rw;
413
414 /* file offset */
415 loff_t offset;
416
417 /* and the count in bytes */
418 size_t bytes_to_be_copied;
419
420 ssize_t bytes_copied;
421 int needs_cleanup;
422};
423
424struct pvfs2_stats {
425 unsigned long cache_hits;
426 unsigned long cache_misses;
427 unsigned long reads;
428 unsigned long writes;
429};
430
431extern struct pvfs2_stats g_pvfs2_stats;
432
433/*
434 NOTE: See Documentation/filesystems/porting for information
435 on implementing FOO_I and properly accessing fs private data
436*/
437static inline struct pvfs2_inode_s *PVFS2_I(struct inode *inode)
438{
439 return container_of(inode, struct pvfs2_inode_s, vfs_inode);
440}
441
442static inline struct pvfs2_sb_info_s *PVFS2_SB(struct super_block *sb)
443{
444 return (struct pvfs2_sb_info_s *) sb->s_fs_info;
445}
446
447/* ino_t descends from "unsigned long", 8 bytes, 64 bits. */
448static inline ino_t pvfs2_khandle_to_ino(struct pvfs2_khandle *khandle)
449{
450 union {
451 unsigned char u[8];
452 __u64 ino;
453 } ihandle;
454
455 ihandle.u[0] = khandle->u[0] ^ khandle->u[4];
456 ihandle.u[1] = khandle->u[1] ^ khandle->u[5];
457 ihandle.u[2] = khandle->u[2] ^ khandle->u[6];
458 ihandle.u[3] = khandle->u[3] ^ khandle->u[7];
459 ihandle.u[4] = khandle->u[12] ^ khandle->u[8];
460 ihandle.u[5] = khandle->u[13] ^ khandle->u[9];
461 ihandle.u[6] = khandle->u[14] ^ khandle->u[10];
462 ihandle.u[7] = khandle->u[15] ^ khandle->u[11];
463
464 return ihandle.ino;
465}
466
467static inline struct pvfs2_khandle *get_khandle_from_ino(struct inode *inode)
468{
469 return &(PVFS2_I(inode)->refn.khandle);
470}
471
472static inline __s32 get_fsid_from_ino(struct inode *inode)
473{
474 return PVFS2_I(inode)->refn.fs_id;
475}
476
477static inline ino_t get_ino_from_khandle(struct inode *inode)
478{
479 struct pvfs2_khandle *khandle;
480 ino_t ino;
481
482 khandle = get_khandle_from_ino(inode);
483 ino = pvfs2_khandle_to_ino(khandle);
484 return ino;
485}
486
487static inline ino_t get_parent_ino_from_dentry(struct dentry *dentry)
488{
489 return get_ino_from_khandle(dentry->d_parent->d_inode);
490}
491
492static inline int is_root_handle(struct inode *inode)
493{
494 gossip_debug(GOSSIP_DCACHE_DEBUG,
495 "%s: root handle: %pU, this handle: %pU:\n",
496 __func__,
497 &PVFS2_SB(inode->i_sb)->root_khandle,
498 get_khandle_from_ino(inode));
499
500 if (PVFS_khandle_cmp(&(PVFS2_SB(inode->i_sb)->root_khandle),
501 get_khandle_from_ino(inode)))
502 return 0;
503 else
504 return 1;
505}
506
507static inline int match_handle(struct pvfs2_khandle resp_handle,
508 struct inode *inode)
509{
510 gossip_debug(GOSSIP_DCACHE_DEBUG,
511 "%s: one handle: %pU, another handle:%pU:\n",
512 __func__,
513 &resp_handle,
514 get_khandle_from_ino(inode));
515
516 if (PVFS_khandle_cmp(&resp_handle, get_khandle_from_ino(inode)))
517 return 0;
518 else
519 return 1;
520}
521
522/*
523 * defined in pvfs2-cache.c
524 */
525int op_cache_initialize(void);
526int op_cache_finalize(void);
527struct pvfs2_kernel_op_s *op_alloc(__s32 type);
528struct pvfs2_kernel_op_s *op_alloc_trailer(__s32 type);
529char *get_opname_string(struct pvfs2_kernel_op_s *new_op);
530void op_release(struct pvfs2_kernel_op_s *op);
531
532int dev_req_cache_initialize(void);
533int dev_req_cache_finalize(void);
534void *dev_req_alloc(void);
535void dev_req_release(void *);
536
537int pvfs2_inode_cache_initialize(void);
538int pvfs2_inode_cache_finalize(void);
539
540int kiocb_cache_initialize(void);
541int kiocb_cache_finalize(void);
542struct pvfs2_kiocb_s *kiocb_alloc(void);
543void kiocb_release(struct pvfs2_kiocb_s *ptr);
544
545/*
546 * defined in pvfs2-mod.c
547 */
548void purge_inprogress_ops(void);
549
550/*
551 * defined in waitqueue.c
552 */
553int wait_for_matching_downcall(struct pvfs2_kernel_op_s *op);
554int wait_for_cancellation_downcall(struct pvfs2_kernel_op_s *op);
555void pvfs2_clean_up_interrupted_operation(struct pvfs2_kernel_op_s *op);
556void purge_waiting_ops(void);
557
558/*
559 * defined in super.c
560 */
561struct dentry *pvfs2_mount(struct file_system_type *fst,
562 int flags,
563 const char *devname,
564 void *data);
565
566void pvfs2_kill_sb(struct super_block *sb);
567int pvfs2_remount(struct super_block *sb);
568
569int fsid_key_table_initialize(void);
570void fsid_key_table_finalize(void);
571
572/*
573 * defined in inode.c
574 */
575__u32 convert_to_pvfs2_mask(unsigned long lite_mask);
576struct inode *pvfs2_new_inode(struct super_block *sb,
577 struct inode *dir,
578 int mode,
579 dev_t dev,
580 struct pvfs2_object_kref *ref);
581
582int pvfs2_setattr(struct dentry *dentry, struct iattr *iattr);
583
584int pvfs2_getattr(struct vfsmount *mnt,
585 struct dentry *dentry,
586 struct kstat *kstat);
587
588/*
589 * defined in xattr.c
590 */
591int pvfs2_setxattr(struct dentry *dentry,
592 const char *name,
593 const void *value,
594 size_t size,
595 int flags);
596
597ssize_t pvfs2_getxattr(struct dentry *dentry,
598 const char *name,
599 void *buffer,
600 size_t size);
601
602ssize_t pvfs2_listxattr(struct dentry *dentry, char *buffer, size_t size);
603
604/*
605 * defined in namei.c
606 */
607struct inode *pvfs2_iget(struct super_block *sb,
608 struct pvfs2_object_kref *ref);
609
610ssize_t pvfs2_inode_read(struct inode *inode,
611 char *buf,
612 size_t count,
613 loff_t *offset,
614 loff_t readahead_size);
615
616/*
617 * defined in devpvfs2-req.c
618 */
619int pvfs2_dev_init(void);
620void pvfs2_dev_cleanup(void);
621int is_daemon_in_service(void);
622int fs_mount_pending(__s32 fsid);
623
624/*
625 * defined in pvfs2-utils.c
626 */
627__s32 fsid_of_op(struct pvfs2_kernel_op_s *op);
628
629int pvfs2_flush_inode(struct inode *inode);
630
631ssize_t pvfs2_inode_getxattr(struct inode *inode,
632 const char *prefix,
633 const char *name,
634 void *buffer,
635 size_t size);
636
637int pvfs2_inode_setxattr(struct inode *inode,
638 const char *prefix,
639 const char *name,
640 const void *value,
641 size_t size,
642 int flags);
643
644int pvfs2_inode_getattr(struct inode *inode, __u32 mask);
645
646int pvfs2_inode_setattr(struct inode *inode, struct iattr *iattr);
647
648void pvfs2_op_initialize(struct pvfs2_kernel_op_s *op);
649
650void pvfs2_make_bad_inode(struct inode *inode);
651
652void mask_blocked_signals(sigset_t *orig_sigset);
653
654void unmask_blocked_signals(sigset_t *orig_sigset);
655
656int pvfs2_unmount_sb(struct super_block *sb);
657
658int pvfs2_cancel_op_in_progress(__u64 tag);
659
660__u64 pvfs2_convert_time_field(void *time_ptr);
661
662int pvfs2_normalize_to_errno(__s32 error_code);
663
664extern struct mutex devreq_mutex;
665extern struct mutex request_mutex;
666extern int debug;
667extern int op_timeout_secs;
668extern int slot_timeout_secs;
669extern struct list_head pvfs2_superblocks;
670extern spinlock_t pvfs2_superblocks_lock;
671extern struct list_head pvfs2_request_list;
672extern spinlock_t pvfs2_request_list_lock;
673extern wait_queue_head_t pvfs2_request_list_waitq;
674extern struct list_head *htable_ops_in_progress;
675extern spinlock_t htable_ops_in_progress_lock;
676extern int hash_table_size;
677
678extern const struct address_space_operations pvfs2_address_operations;
679extern struct backing_dev_info pvfs2_backing_dev_info;
680extern struct inode_operations pvfs2_file_inode_operations;
681extern const struct file_operations pvfs2_file_operations;
682extern struct inode_operations pvfs2_symlink_inode_operations;
683extern struct inode_operations pvfs2_dir_inode_operations;
684extern const struct file_operations pvfs2_dir_operations;
685extern const struct dentry_operations pvfs2_dentry_operations;
686extern const struct file_operations pvfs2_devreq_file_operations;
687
688extern wait_queue_head_t pvfs2_bufmap_init_waitq;
689
690/*
691 * misc convenience macros
692 */
693#define add_op_to_request_list(op) \
694do { \
695 spin_lock(&pvfs2_request_list_lock); \
696 spin_lock(&op->lock); \
697 set_op_state_waiting(op); \
698 list_add_tail(&op->list, &pvfs2_request_list); \
699 spin_unlock(&pvfs2_request_list_lock); \
700 spin_unlock(&op->lock); \
701 wake_up_interruptible(&pvfs2_request_list_waitq); \
702} while (0)
703
704#define add_priority_op_to_request_list(op) \
705 do { \
706 spin_lock(&pvfs2_request_list_lock); \
707 spin_lock(&op->lock); \
708 set_op_state_waiting(op); \
709 \
710 list_add(&op->list, &pvfs2_request_list); \
711 spin_unlock(&pvfs2_request_list_lock); \
712 spin_unlock(&op->lock); \
713 wake_up_interruptible(&pvfs2_request_list_waitq); \
714} while (0)
715
716#define remove_op_from_request_list(op) \
717 do { \
718 struct list_head *tmp = NULL; \
719 struct list_head *tmp_safe = NULL; \
720 struct pvfs2_kernel_op_s *tmp_op = NULL; \
721 \
722 spin_lock(&pvfs2_request_list_lock); \
723 list_for_each_safe(tmp, tmp_safe, &pvfs2_request_list) { \
724 tmp_op = list_entry(tmp, \
725 struct pvfs2_kernel_op_s, \
726 list); \
727 if (tmp_op && (tmp_op == op)) { \
728 list_del(&tmp_op->list); \
729 break; \
730 } \
731 } \
732 spin_unlock(&pvfs2_request_list_lock); \
733 } while (0)
734
735#define PVFS2_OP_INTERRUPTIBLE 1 /* service_operation() is interruptible */
736#define PVFS2_OP_PRIORITY 2 /* service_operation() is high priority */
737#define PVFS2_OP_CANCELLATION 4 /* this is a cancellation */
738#define PVFS2_OP_NO_SEMAPHORE 8 /* don't acquire semaphore */
739#define PVFS2_OP_ASYNC 16 /* Queue it, but don't wait */
740
741int service_operation(struct pvfs2_kernel_op_s *op,
742 const char *op_name,
743 int flags);
744
745/*
746 * handles two possible error cases, depending on context.
747 *
748 * by design, our vfs i/o errors need to be handled in one of two ways,
749 * depending on where the error occured.
750 *
751 * if the error happens in the waitqueue code because we either timed
752 * out or a signal was raised while waiting, we need to cancel the
753 * userspace i/o operation and free the op manually. this is done to
754 * avoid having the device start writing application data to our shared
755 * bufmap pages without us expecting it.
756 *
757 * FIXME: POSSIBLE OPTIMIZATION:
758 * However, if we timed out or if we got a signal AND our upcall was never
759 * picked off the queue (i.e. we were in OP_VFS_STATE_WAITING), then we don't
760 * need to send a cancellation upcall. The way we can handle this is
761 * set error_exit to 2 in such cases and 1 whenever cancellation has to be
762 * sent and have handle_error
763 * take care of this situation as well..
764 *
765 * if a pvfs2 sysint level error occured and i/o has been completed,
766 * there is no need to cancel the operation, as the user has finished
767 * using the bufmap page and so there is no danger in this case. in
768 * this case, we wake up the device normally so that it may free the
769 * op, as normal.
770 *
771 * note the only reason this is a macro is because both read and write
772 * cases need the exact same handling code.
773 */
774#define handle_io_error() \
775do { \
776 if (!op_state_serviced(new_op)) { \
777 pvfs2_cancel_op_in_progress(new_op->tag); \
778 op_release(new_op); \
779 } else { \
780 wake_up_daemon_for_return(new_op); \
781 } \
782 new_op = NULL; \
783 pvfs_bufmap_put(bufmap, buffer_index); \
784 buffer_index = -1; \
785} while (0)
786
787#define get_interruptible_flag(inode) \
788 ((PVFS2_SB(inode->i_sb)->flags & PVFS2_OPT_INTR) ? \
789 PVFS2_OP_INTERRUPTIBLE : 0)
790
791#define add_pvfs2_sb(sb) \
792do { \
793 gossip_debug(GOSSIP_SUPER_DEBUG, \
794 "Adding SB %p to pvfs2 superblocks\n", \
795 PVFS2_SB(sb)); \
796 spin_lock(&pvfs2_superblocks_lock); \
797 list_add_tail(&PVFS2_SB(sb)->list, &pvfs2_superblocks); \
798 spin_unlock(&pvfs2_superblocks_lock); \
799} while (0)
800
801#define remove_pvfs2_sb(sb) \
802do { \
803 struct list_head *tmp = NULL; \
804 struct list_head *tmp_safe = NULL; \
805 struct pvfs2_sb_info_s *pvfs2_sb = NULL; \
806 \
807 spin_lock(&pvfs2_superblocks_lock); \
808 list_for_each_safe(tmp, tmp_safe, &pvfs2_superblocks) { \
809 pvfs2_sb = list_entry(tmp, \
810 struct pvfs2_sb_info_s, \
811 list); \
812 if (pvfs2_sb && (pvfs2_sb->sb == sb)) { \
813 gossip_debug(GOSSIP_SUPER_DEBUG, \
814 "Removing SB %p from pvfs2 superblocks\n", \
815 pvfs2_sb); \
816 list_del(&pvfs2_sb->list); \
817 break; \
818 } \
819 } \
820 spin_unlock(&pvfs2_superblocks_lock); \
821} while (0)
822
823#define pvfs2_lock_inode(inode) spin_lock(&inode->i_lock)
824#define pvfs2_unlock_inode(inode) spin_unlock(&inode->i_lock)
825#define pvfs2_current_signal_lock current->sighand->siglock
826#define pvfs2_current_sigaction current->sighand->action
827
828#define fill_default_sys_attrs(sys_attr, type, mode) \
829do { \
830 sys_attr.owner = from_kuid(current_user_ns(), current_fsuid()); \
831 sys_attr.group = from_kgid(current_user_ns(), current_fsgid()); \
832 sys_attr.size = 0; \
833 sys_attr.perms = PVFS_util_translate_mode(mode); \
834 sys_attr.objtype = type; \
835 sys_attr.mask = PVFS_ATTR_SYS_ALL_SETABLE; \
836} while (0)
837
838#define pvfs2_inode_lock(__i) mutex_lock(&(__i)->i_mutex)
839
840#define pvfs2_inode_unlock(__i) mutex_unlock(&(__i)->i_mutex)
841
842static inline void pvfs2_i_size_write(struct inode *inode, loff_t i_size)
843{
844#if BITS_PER_LONG == 32 && defined(CONFIG_SMP)
845 pvfs2_inode_lock(inode);
846#endif
847 i_size_write(inode, i_size);
848#if BITS_PER_LONG == 32 && defined(CONFIG_SMP)
849 pvfs2_inode_unlock(inode);
850#endif
851}
852
853static inline unsigned int diff(struct timeval *end, struct timeval *begin)
854{
855 if (end->tv_usec < begin->tv_usec) {
856 end->tv_usec += 1000000;
857 end->tv_sec--;
858 }
859 end->tv_sec -= begin->tv_sec;
860 end->tv_usec -= begin->tv_usec;
861 return (end->tv_sec * 1000000) + end->tv_usec;
862}
863
864#endif /* __PVFS2KERNEL_H */
diff --git a/fs/orangefs/pvfs2-sysfs.h b/fs/orangefs/pvfs2-sysfs.h
new file mode 100644
index 000000000000..f0b76382db02
--- /dev/null
+++ b/fs/orangefs/pvfs2-sysfs.h
@@ -0,0 +1,2 @@
1extern int orangefs_sysfs_init(void);
2extern void orangefs_sysfs_exit(void);
diff --git a/fs/orangefs/upcall.h b/fs/orangefs/upcall.h
new file mode 100644
index 000000000000..1e07f626aac6
--- /dev/null
+++ b/fs/orangefs/upcall.h
@@ -0,0 +1,255 @@
1/*
2 * (C) 2001 Clemson University and The University of Chicago
3 *
4 * See COPYING in top-level directory.
5 */
6
7#ifndef __UPCALL_H
8#define __UPCALL_H
9
10/*
11 * Sanitized this header file to fix
12 * 32-64 bit interaction issues between
13 * client-core and device
14 */
15struct pvfs2_io_request_s {
16 __s32 async_vfs_io;
17 __s32 buf_index;
18 __s32 count;
19 __s32 __pad1;
20 __s64 offset;
21 struct pvfs2_object_kref refn;
22 enum PVFS_io_type io_type;
23 __s32 readahead_size;
24};
25
26struct pvfs2_iox_request_s {
27 __s32 buf_index;
28 __s32 count;
29 struct pvfs2_object_kref refn;
30 enum PVFS_io_type io_type;
31 __s32 __pad1;
32};
33
34struct pvfs2_lookup_request_s {
35 __s32 sym_follow;
36 __s32 __pad1;
37 struct pvfs2_object_kref parent_refn;
38 char d_name[PVFS2_NAME_LEN];
39};
40
41struct pvfs2_create_request_s {
42 struct pvfs2_object_kref parent_refn;
43 struct PVFS_sys_attr_s attributes;
44 char d_name[PVFS2_NAME_LEN];
45};
46
47struct pvfs2_symlink_request_s {
48 struct pvfs2_object_kref parent_refn;
49 struct PVFS_sys_attr_s attributes;
50 char entry_name[PVFS2_NAME_LEN];
51 char target[PVFS2_NAME_LEN];
52};
53
54struct pvfs2_getattr_request_s {
55 struct pvfs2_object_kref refn;
56 __u32 mask;
57 __u32 __pad1;
58};
59
60struct pvfs2_setattr_request_s {
61 struct pvfs2_object_kref refn;
62 struct PVFS_sys_attr_s attributes;
63};
64
65struct pvfs2_remove_request_s {
66 struct pvfs2_object_kref parent_refn;
67 char d_name[PVFS2_NAME_LEN];
68};
69
70struct pvfs2_mkdir_request_s {
71 struct pvfs2_object_kref parent_refn;
72 struct PVFS_sys_attr_s attributes;
73 char d_name[PVFS2_NAME_LEN];
74};
75
76struct pvfs2_readdir_request_s {
77 struct pvfs2_object_kref refn;
78 __u64 token;
79 __s32 max_dirent_count;
80 __s32 buf_index;
81};
82
83struct pvfs2_readdirplus_request_s {
84 struct pvfs2_object_kref refn;
85 __u64 token;
86 __s32 max_dirent_count;
87 __u32 mask;
88 __s32 buf_index;
89 __s32 __pad1;
90};
91
92struct pvfs2_rename_request_s {
93 struct pvfs2_object_kref old_parent_refn;
94 struct pvfs2_object_kref new_parent_refn;
95 char d_old_name[PVFS2_NAME_LEN];
96 char d_new_name[PVFS2_NAME_LEN];
97};
98
99struct pvfs2_statfs_request_s {
100 __s32 fs_id;
101 __s32 __pad1;
102};
103
104struct pvfs2_truncate_request_s {
105 struct pvfs2_object_kref refn;
106 __s64 size;
107};
108
109struct pvfs2_mmap_ra_cache_flush_request_s {
110 struct pvfs2_object_kref refn;
111};
112
113struct pvfs2_fs_mount_request_s {
114 char pvfs2_config_server[PVFS_MAX_SERVER_ADDR_LEN];
115};
116
117struct pvfs2_fs_umount_request_s {
118 __s32 id;
119 __s32 fs_id;
120 char pvfs2_config_server[PVFS_MAX_SERVER_ADDR_LEN];
121};
122
123struct pvfs2_getxattr_request_s {
124 struct pvfs2_object_kref refn;
125 __s32 key_sz;
126 __s32 __pad1;
127 char key[PVFS_MAX_XATTR_NAMELEN];
128};
129
130struct pvfs2_setxattr_request_s {
131 struct pvfs2_object_kref refn;
132 struct PVFS_keyval_pair keyval;
133 __s32 flags;
134 __s32 __pad1;
135};
136
137struct pvfs2_listxattr_request_s {
138 struct pvfs2_object_kref refn;
139 __s32 requested_count;
140 __s32 __pad1;
141 __u64 token;
142};
143
144struct pvfs2_removexattr_request_s {
145 struct pvfs2_object_kref refn;
146 __s32 key_sz;
147 __s32 __pad1;
148 char key[PVFS_MAX_XATTR_NAMELEN];
149};
150
151struct pvfs2_op_cancel_s {
152 __u64 op_tag;
153};
154
155struct pvfs2_fsync_request_s {
156 struct pvfs2_object_kref refn;
157};
158
159enum pvfs2_param_request_type {
160 PVFS2_PARAM_REQUEST_SET = 1,
161 PVFS2_PARAM_REQUEST_GET = 2
162};
163
164enum pvfs2_param_request_op {
165 PVFS2_PARAM_REQUEST_OP_ACACHE_TIMEOUT_MSECS = 1,
166 PVFS2_PARAM_REQUEST_OP_ACACHE_HARD_LIMIT = 2,
167 PVFS2_PARAM_REQUEST_OP_ACACHE_SOFT_LIMIT = 3,
168 PVFS2_PARAM_REQUEST_OP_ACACHE_RECLAIM_PERCENTAGE = 4,
169 PVFS2_PARAM_REQUEST_OP_PERF_TIME_INTERVAL_SECS = 5,
170 PVFS2_PARAM_REQUEST_OP_PERF_HISTORY_SIZE = 6,
171 PVFS2_PARAM_REQUEST_OP_PERF_RESET = 7,
172 PVFS2_PARAM_REQUEST_OP_NCACHE_TIMEOUT_MSECS = 8,
173 PVFS2_PARAM_REQUEST_OP_NCACHE_HARD_LIMIT = 9,
174 PVFS2_PARAM_REQUEST_OP_NCACHE_SOFT_LIMIT = 10,
175 PVFS2_PARAM_REQUEST_OP_NCACHE_RECLAIM_PERCENTAGE = 11,
176 PVFS2_PARAM_REQUEST_OP_STATIC_ACACHE_TIMEOUT_MSECS = 12,
177 PVFS2_PARAM_REQUEST_OP_STATIC_ACACHE_HARD_LIMIT = 13,
178 PVFS2_PARAM_REQUEST_OP_STATIC_ACACHE_SOFT_LIMIT = 14,
179 PVFS2_PARAM_REQUEST_OP_STATIC_ACACHE_RECLAIM_PERCENTAGE = 15,
180 PVFS2_PARAM_REQUEST_OP_CLIENT_DEBUG = 16,
181 PVFS2_PARAM_REQUEST_OP_CCACHE_TIMEOUT_SECS = 17,
182 PVFS2_PARAM_REQUEST_OP_CCACHE_HARD_LIMIT = 18,
183 PVFS2_PARAM_REQUEST_OP_CCACHE_SOFT_LIMIT = 19,
184 PVFS2_PARAM_REQUEST_OP_CCACHE_RECLAIM_PERCENTAGE = 20,
185 PVFS2_PARAM_REQUEST_OP_CAPCACHE_TIMEOUT_SECS = 21,
186 PVFS2_PARAM_REQUEST_OP_CAPCACHE_HARD_LIMIT = 22,
187 PVFS2_PARAM_REQUEST_OP_CAPCACHE_SOFT_LIMIT = 23,
188 PVFS2_PARAM_REQUEST_OP_CAPCACHE_RECLAIM_PERCENTAGE = 24,
189 PVFS2_PARAM_REQUEST_OP_TWO_MASK_VALUES = 25,
190};
191
192struct pvfs2_param_request_s {
193 enum pvfs2_param_request_type type;
194 enum pvfs2_param_request_op op;
195 __s64 value;
196 char s_value[PVFS2_MAX_DEBUG_STRING_LEN];
197};
198
199enum pvfs2_perf_count_request_type {
200 PVFS2_PERF_COUNT_REQUEST_ACACHE = 1,
201 PVFS2_PERF_COUNT_REQUEST_NCACHE = 2,
202 PVFS2_PERF_COUNT_REQUEST_CAPCACHE = 3,
203};
204
205struct pvfs2_perf_count_request_s {
206 enum pvfs2_perf_count_request_type type;
207 __s32 __pad1;
208};
209
210struct pvfs2_fs_key_request_s {
211 __s32 fsid;
212 __s32 __pad1;
213};
214
215struct pvfs2_upcall_s {
216 __s32 type;
217 __u32 uid;
218 __u32 gid;
219 int pid;
220 int tgid;
221 /* currently trailer is used only by readx/writex (iox) */
222 __s64 trailer_size;
223 char *trailer_buf;
224
225 union {
226 struct pvfs2_io_request_s io;
227 struct pvfs2_iox_request_s iox;
228 struct pvfs2_lookup_request_s lookup;
229 struct pvfs2_create_request_s create;
230 struct pvfs2_symlink_request_s sym;
231 struct pvfs2_getattr_request_s getattr;
232 struct pvfs2_setattr_request_s setattr;
233 struct pvfs2_remove_request_s remove;
234 struct pvfs2_mkdir_request_s mkdir;
235 struct pvfs2_readdir_request_s readdir;
236 struct pvfs2_readdirplus_request_s readdirplus;
237 struct pvfs2_rename_request_s rename;
238 struct pvfs2_statfs_request_s statfs;
239 struct pvfs2_truncate_request_s truncate;
240 struct pvfs2_mmap_ra_cache_flush_request_s ra_cache_flush;
241 struct pvfs2_fs_mount_request_s fs_mount;
242 struct pvfs2_fs_umount_request_s fs_umount;
243 struct pvfs2_getxattr_request_s getxattr;
244 struct pvfs2_setxattr_request_s setxattr;
245 struct pvfs2_listxattr_request_s listxattr;
246 struct pvfs2_removexattr_request_s removexattr;
247 struct pvfs2_op_cancel_s cancel;
248 struct pvfs2_fsync_request_s fsync;
249 struct pvfs2_param_request_s param;
250 struct pvfs2_perf_count_request_s perf_count;
251 struct pvfs2_fs_key_request_s fs_key;
252 } req;
253};
254
255#endif /* __UPCALL_H */