Blame view
fs/orangefs/orangefs-kernel.h
17.5 KB
f7ab093f7
|
1 2 3 4 5 6 7 |
/* * (C) 2001 Clemson University and The University of Chicago * * See COPYING in top-level directory. */ /* |
8bb8aefd5
|
8 |
* The ORANGEFS Linux kernel support allows ORANGEFS volumes to be mounted and |
f7ab093f7
|
9 10 11 12 13 14 |
* accessed through the Linux VFS (i.e. using standard I/O system calls). * This support is only needed on clients that wish to mount the file system. * */ /* |
8bb8aefd5
|
15 |
* Declarations and macros for the ORANGEFS Linux kernel support. |
f7ab093f7
|
16 |
*/ |
8bb8aefd5
|
17 18 |
#ifndef __ORANGEFSKERNEL_H #define __ORANGEFSKERNEL_H |
f7ab093f7
|
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
#include <linux/kernel.h> #include <linux/moduleparam.h> #include <linux/statfs.h> #include <linux/backing-dev.h> #include <linux/device.h> #include <linux/mpage.h> #include <linux/namei.h> #include <linux/errno.h> #include <linux/init.h> #include <linux/module.h> #include <linux/slab.h> #include <linux/types.h> #include <linux/fs.h> #include <linux/vmalloc.h> #include <linux/aio.h> #include <linux/posix_acl.h> #include <linux/posix_acl_xattr.h> #include <linux/compat.h> #include <linux/mount.h> #include <linux/uaccess.h> #include <linux/atomic.h> #include <linux/uio.h> #include <linux/sched.h> #include <linux/mm.h> #include <linux/wait.h> #include <linux/dcache.h> #include <linux/pagemap.h> #include <linux/poll.h> #include <linux/rwsem.h> #include <linux/xattr.h> #include <linux/exportfs.h> #include <asm/unaligned.h> |
575e94612
|
54 |
#include "orangefs-dev-proto.h" |
f7ab093f7
|
55 |
|
8bb8aefd5
|
56 57 |
#ifdef ORANGEFS_KERNEL_DEBUG #define ORANGEFS_DEFAULT_OP_TIMEOUT_SECS 10 |
f7ab093f7
|
58 |
#else |
8bb8aefd5
|
59 |
#define ORANGEFS_DEFAULT_OP_TIMEOUT_SECS 20 |
f7ab093f7
|
60 |
#endif |
8bb8aefd5
|
61 |
#define ORANGEFS_BUFMAP_WAIT_TIMEOUT_SECS 30 |
f7ab093f7
|
62 |
|
8bb8aefd5
|
63 |
#define ORANGEFS_DEFAULT_SLOT_TIMEOUT_SECS 900 /* 15 minutes */ |
f7ab093f7
|
64 |
|
8bb8aefd5
|
65 |
#define ORANGEFS_REQDEVICE_NAME "pvfs2-req" |
f7ab093f7
|
66 |
|
8bb8aefd5
|
67 68 69 |
#define ORANGEFS_DEVREQ_MAGIC 0x20030529 #define ORANGEFS_LINK_MAX 0x000000FF #define ORANGEFS_PURGE_RETRY_COUNT 0x00000005 |
8bb8aefd5
|
70 71 72 |
#define ORANGEFS_MAX_NUM_OPTIONS 0x00000004 #define ORANGEFS_MAX_MOUNT_OPT_LEN 0x00000080 #define ORANGEFS_MAX_FSKEY_LEN 64 |
f7ab093f7
|
73 |
|
cf0c27715
|
74 |
#define MAX_DEV_REQ_UPSIZE (2 * sizeof(__s32) + \ |
8bb8aefd5
|
75 |
sizeof(__u64) + sizeof(struct orangefs_upcall_s)) |
cf0c27715
|
76 |
#define MAX_DEV_REQ_DOWNSIZE (2 * sizeof(__s32) + \ |
8bb8aefd5
|
77 |
sizeof(__u64) + sizeof(struct orangefs_downcall_s)) |
f7ab093f7
|
78 |
|
f7ab093f7
|
79 |
/* |
8bb8aefd5
|
80 |
* valid orangefs kernel operation states |
f7ab093f7
|
81 82 83 84 85 86 87 |
* * unknown - op was just initialized * waiting - op is on request_list (upward bound) * inprogr - op is in progress (waiting for downcall) * serviced - op has matching downcall; ok * purged - op has to start a timer since client-core * exited uncleanly before servicing op |
ed42fe059
|
88 |
* given up - submitter has given up waiting for it |
f7ab093f7
|
89 |
*/ |
8bb8aefd5
|
90 |
enum orangefs_vfs_op_states { |
f7ab093f7
|
91 92 93 94 95 |
OP_VFS_STATE_UNKNOWN = 0, OP_VFS_STATE_WAITING = 1, OP_VFS_STATE_INPROGR = 2, OP_VFS_STATE_SERVICED = 4, OP_VFS_STATE_PURGED = 8, |
ed42fe059
|
96 |
OP_VFS_STATE_GIVEN_UP = 16, |
f7ab093f7
|
97 |
}; |
f7ab093f7
|
98 |
/* |
f7ab093f7
|
99 100 101 102 103 104 105 106 107 108 |
* An array of client_debug_mask will be built to hold debug keyword/mask * values fetched from userspace. */ struct client_debug_mask { char *keyword; __u64 mask1; __u64 mask2; }; /* |
8bb8aefd5
|
109 |
* orangefs kernel memory related flags |
f7ab093f7
|
110 |
*/ |
8bb8aefd5
|
111 112 |
#if ((defined ORANGEFS_KERNEL_DEBUG) && (defined CONFIG_DEBUG_SLAB)) #define ORANGEFS_CACHE_CREATE_FLAGS SLAB_RED_ZONE |
f7ab093f7
|
113 |
#else |
8bb8aefd5
|
114 115 |
#define ORANGEFS_CACHE_CREATE_FLAGS 0 #endif /* ((defined ORANGEFS_KERNEL_DEBUG) && (defined CONFIG_DEBUG_SLAB)) */ |
f7ab093f7
|
116 |
|
8bb8aefd5
|
117 118 119 120 121 |
/* orangefs xattr and acl related defines */ #define ORANGEFS_XATTR_INDEX_POSIX_ACL_ACCESS 1 #define ORANGEFS_XATTR_INDEX_POSIX_ACL_DEFAULT 2 #define ORANGEFS_XATTR_INDEX_TRUSTED 3 #define ORANGEFS_XATTR_INDEX_DEFAULT 4 |
f7ab093f7
|
122 |
|
fef8b67ce
|
123 124 |
#define ORANGEFS_XATTR_NAME_ACL_ACCESS XATTR_NAME_POSIX_ACL_ACCESS #define ORANGEFS_XATTR_NAME_ACL_DEFAULT XATTR_NAME_POSIX_ACL_DEFAULT |
8bb8aefd5
|
125 126 |
#define ORANGEFS_XATTR_NAME_TRUSTED_PREFIX "trusted." #define ORANGEFS_XATTR_NAME_DEFAULT_PREFIX "" |
f7ab093f7
|
127 |
|
8bb8aefd5
|
128 |
/* these functions are defined in orangefs-utils.c */ |
f7ab093f7
|
129 130 |
int orangefs_prepare_cdm_array(char *debug_array_string); int orangefs_prepare_debugfs_help_string(int); |
8bb8aefd5
|
131 132 |
/* defined in orangefs-debugfs.c */ int orangefs_client_debug_init(void); |
f7ab093f7
|
133 134 135 136 137 138 139 140 141 142 |
void debug_string_to_mask(char *, void *, int); void do_c_mask(int, char *, struct client_debug_mask **); void do_k_mask(int, char *, __u64 **); void debug_mask_to_string(void *, int); void do_k_string(void *, int); void do_c_string(void *, int); int check_amalgam_keyword(void *, int); int keyword_is_amalgam(char *); |
8bb8aefd5
|
143 144 145 146 |
/*these variables are defined in orangefs-mod.c */ extern char kernel_debug_string[ORANGEFS_MAX_DEBUG_STRING_LEN]; extern char client_debug_string[ORANGEFS_MAX_DEBUG_STRING_LEN]; extern char client_debug_array_string[ORANGEFS_MAX_DEBUG_STRING_LEN]; |
f7ab093f7
|
147 |
extern unsigned int kernel_mask_set_mod_init; |
8bb8aefd5
|
148 149 |
extern int orangefs_init_acl(struct inode *inode, struct inode *dir); extern const struct xattr_handler *orangefs_xattr_handlers[]; |
f7ab093f7
|
150 |
|
8bb8aefd5
|
151 152 |
extern struct posix_acl *orangefs_get_acl(struct inode *inode, int type); extern int orangefs_set_acl(struct inode *inode, struct posix_acl *acl, int type); |
f7ab093f7
|
153 |
|
f7ab093f7
|
154 155 156 157 158 159 160 161 162 163 |
/* * Redefine xtvec structure so that we could move helper functions out of * the define */ struct xtvec { __kernel_off_t xtv_off; /* must be off_t */ __kernel_size_t xtv_len; /* must be size_t */ }; /* |
8bb8aefd5
|
164 |
* orangefs data structures |
f7ab093f7
|
165 |
*/ |
8bb8aefd5
|
166 167 |
struct orangefs_kernel_op_s { enum orangefs_vfs_op_states op_state; |
f7ab093f7
|
168 169 170 |
__u64 tag; /* |
d37c0f307
|
171 172 173 174 175 176 |
* Set uses_shared_memory to non zero if this operation uses * shared memory. If true, then a retry on the op must also * get a new shared memory buffer and re-populate it. * Cancels don't care - it only matters for service_operation() * retry logics and cancels don't go through it anymore. It * safely stays non-zero when we use it as slot_to_free. |
f7ab093f7
|
177 |
*/ |
78699e29f
|
178 179 180 181 |
union { int uses_shared_memory; int slot_to_free; }; |
f7ab093f7
|
182 |
|
8bb8aefd5
|
183 184 |
struct orangefs_upcall_s upcall; struct orangefs_downcall_s downcall; |
f7ab093f7
|
185 |
|
d2d87a3b6
|
186 |
struct completion waitq; |
f7ab093f7
|
187 |
spinlock_t lock; |
f7ab093f7
|
188 189 190 191 |
int attempts; struct list_head list; }; |
60831949c
|
192 193 |
#define set_op_state_waiting(op) ((op)->op_state = OP_VFS_STATE_WAITING) #define set_op_state_inprogress(op) ((op)->op_state = OP_VFS_STATE_INPROGR) |
2d4cae0d1
|
194 |
#define set_op_state_given_up(op) ((op)->op_state = OP_VFS_STATE_GIVEN_UP) |
60831949c
|
195 196 197 |
static inline void set_op_state_serviced(struct orangefs_kernel_op_s *op) { op->op_state = OP_VFS_STATE_SERVICED; |
d2d87a3b6
|
198 |
complete(&op->waitq); |
60831949c
|
199 |
} |
60831949c
|
200 201 202 203 204 |
#define op_state_waiting(op) ((op)->op_state & OP_VFS_STATE_WAITING) #define op_state_in_progress(op) ((op)->op_state & OP_VFS_STATE_INPROGR) #define op_state_serviced(op) ((op)->op_state & OP_VFS_STATE_SERVICED) #define op_state_purged(op) ((op)->op_state & OP_VFS_STATE_PURGED) |
ed42fe059
|
205 |
#define op_state_given_up(op) ((op)->op_state & OP_VFS_STATE_GIVEN_UP) |
78699e29f
|
206 |
#define op_is_cancel(op) ((op)->upcall.type == ORANGEFS_VFS_OP_CANCEL) |
ed42fe059
|
207 |
|
c1223ca48
|
208 |
void op_release(struct orangefs_kernel_op_s *op); |
60831949c
|
209 |
|
78699e29f
|
210 211 212 213 214 215 216 217 218 219 220 |
extern void orangefs_bufmap_put(int); static inline void put_cancel(struct orangefs_kernel_op_s *op) { orangefs_bufmap_put(op->slot_to_free); op_release(op); } static inline void set_op_state_purged(struct orangefs_kernel_op_s *op) { spin_lock(&op->lock); if (unlikely(op_is_cancel(op))) { |
05a50a5be
|
221 |
list_del_init(&op->list); |
78699e29f
|
222 223 224 225 |
spin_unlock(&op->lock); put_cancel(op); } else { op->op_state |= OP_VFS_STATE_PURGED; |
d2d87a3b6
|
226 |
complete(&op->waitq); |
78699e29f
|
227 228 229 |
spin_unlock(&op->lock); } } |
8bb8aefd5
|
230 231 232 233 |
/* per inode private orangefs info */ struct orangefs_inode_s { struct orangefs_object_kref refn; char link_target[ORANGEFS_NAME_MAX]; |
f7ab093f7
|
234 235 236 |
__s64 blksize; /* * Reading/Writing Extended attributes need to acquire the appropriate |
8bb8aefd5
|
237 |
* reader/writer semaphore on the orangefs_inode_s structure. |
f7ab093f7
|
238 239 240 241 242 243 244 245 246 247 248 |
*/ struct rw_semaphore xattr_sem; struct inode vfs_inode; sector_t last_failed_block_index_read; /* * State of in-memory attributes not yet flushed to disk associated * with this object */ unsigned long pinode_flags; |
f7ab093f7
|
249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 |
}; #define P_ATIME_FLAG 0 #define P_MTIME_FLAG 1 #define P_CTIME_FLAG 2 #define P_MODE_FLAG 3 #define ClearAtimeFlag(pinode) clear_bit(P_ATIME_FLAG, &(pinode)->pinode_flags) #define SetAtimeFlag(pinode) set_bit(P_ATIME_FLAG, &(pinode)->pinode_flags) #define AtimeFlag(pinode) test_bit(P_ATIME_FLAG, &(pinode)->pinode_flags) #define ClearMtimeFlag(pinode) clear_bit(P_MTIME_FLAG, &(pinode)->pinode_flags) #define SetMtimeFlag(pinode) set_bit(P_MTIME_FLAG, &(pinode)->pinode_flags) #define MtimeFlag(pinode) test_bit(P_MTIME_FLAG, &(pinode)->pinode_flags) #define ClearCtimeFlag(pinode) clear_bit(P_CTIME_FLAG, &(pinode)->pinode_flags) #define SetCtimeFlag(pinode) set_bit(P_CTIME_FLAG, &(pinode)->pinode_flags) #define CtimeFlag(pinode) test_bit(P_CTIME_FLAG, &(pinode)->pinode_flags) #define ClearModeFlag(pinode) clear_bit(P_MODE_FLAG, &(pinode)->pinode_flags) #define SetModeFlag(pinode) set_bit(P_MODE_FLAG, &(pinode)->pinode_flags) #define ModeFlag(pinode) test_bit(P_MODE_FLAG, &(pinode)->pinode_flags) |
8bb8aefd5
|
271 272 273 |
/* per superblock private orangefs info */ struct orangefs_sb_info_s { struct orangefs_khandle root_khandle; |
f7ab093f7
|
274 275 276 |
__s32 fs_id; int id; int flags; |
8bb8aefd5
|
277 278 279 |
#define ORANGEFS_OPT_INTR 0x01 #define ORANGEFS_OPT_LOCAL_LOCK 0x02 char devname[ORANGEFS_MAX_SERVER_ADDR_LEN]; |
f7ab093f7
|
280 281 282 283 284 285 |
struct super_block *sb; int mount_pending; struct list_head list; }; /* |
f7ab093f7
|
286 287 288 289 290 |
* structure that holds the state of any async I/O operation issued * through the VFS. Needed especially to handle cancellation requests * or even completion notification so that the VFS client-side daemon * can free up its vfs_request slots. */ |
8bb8aefd5
|
291 |
struct orangefs_kiocb_s { |
f7ab093f7
|
292 293 294 295 296 297 298 |
/* the pointer to the task that initiated the AIO */ struct task_struct *tsk; /* pointer to the kiocb that kicked this operation */ struct kiocb *kiocb; /* buffer index that was used for the I/O */ |
8bb8aefd5
|
299 |
struct orangefs_bufmap *bufmap; |
f7ab093f7
|
300 |
int buffer_index; |
8bb8aefd5
|
301 302 |
/* orangefs kernel operation type */ struct orangefs_kernel_op_s *op; |
f7ab093f7
|
303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 |
/* The user space buffers from/to which I/O is being staged */ struct iovec *iov; /* number of elements in the iovector */ unsigned long nr_segs; /* set to indicate the type of the operation */ int rw; /* file offset */ loff_t offset; /* and the count in bytes */ size_t bytes_to_be_copied; ssize_t bytes_copied; int needs_cleanup; }; |
8bb8aefd5
|
322 |
struct orangefs_stats { |
f7ab093f7
|
323 324 325 326 327 |
unsigned long cache_hits; unsigned long cache_misses; unsigned long reads; unsigned long writes; }; |
8bb8aefd5
|
328 |
extern struct orangefs_stats g_orangefs_stats; |
f7ab093f7
|
329 330 |
/* |
548049495
|
331 332 333 |
* NOTE: See Documentation/filesystems/porting for information * on implementing FOO_I and properly accessing fs private data */ |
8bb8aefd5
|
334 |
static inline struct orangefs_inode_s *ORANGEFS_I(struct inode *inode) |
f7ab093f7
|
335 |
{ |
8bb8aefd5
|
336 |
return container_of(inode, struct orangefs_inode_s, vfs_inode); |
f7ab093f7
|
337 |
} |
8bb8aefd5
|
338 |
static inline struct orangefs_sb_info_s *ORANGEFS_SB(struct super_block *sb) |
f7ab093f7
|
339 |
{ |
8bb8aefd5
|
340 |
return (struct orangefs_sb_info_s *) sb->s_fs_info; |
f7ab093f7
|
341 342 343 |
} /* ino_t descends from "unsigned long", 8 bytes, 64 bits. */ |
8bb8aefd5
|
344 |
static inline ino_t orangefs_khandle_to_ino(struct orangefs_khandle *khandle) |
f7ab093f7
|
345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 |
{ union { unsigned char u[8]; __u64 ino; } ihandle; ihandle.u[0] = khandle->u[0] ^ khandle->u[4]; ihandle.u[1] = khandle->u[1] ^ khandle->u[5]; ihandle.u[2] = khandle->u[2] ^ khandle->u[6]; ihandle.u[3] = khandle->u[3] ^ khandle->u[7]; ihandle.u[4] = khandle->u[12] ^ khandle->u[8]; ihandle.u[5] = khandle->u[13] ^ khandle->u[9]; ihandle.u[6] = khandle->u[14] ^ khandle->u[10]; ihandle.u[7] = khandle->u[15] ^ khandle->u[11]; return ihandle.ino; } |
8bb8aefd5
|
362 |
static inline struct orangefs_khandle *get_khandle_from_ino(struct inode *inode) |
f7ab093f7
|
363 |
{ |
8bb8aefd5
|
364 |
return &(ORANGEFS_I(inode)->refn.khandle); |
f7ab093f7
|
365 366 367 368 |
} static inline __s32 get_fsid_from_ino(struct inode *inode) { |
8bb8aefd5
|
369 |
return ORANGEFS_I(inode)->refn.fs_id; |
f7ab093f7
|
370 371 372 373 |
} static inline ino_t get_ino_from_khandle(struct inode *inode) { |
8bb8aefd5
|
374 |
struct orangefs_khandle *khandle; |
f7ab093f7
|
375 376 377 |
ino_t ino; khandle = get_khandle_from_ino(inode); |
8bb8aefd5
|
378 |
ino = orangefs_khandle_to_ino(khandle); |
f7ab093f7
|
379 380 381 382 383 384 385 386 387 388 389 390 391 392 |
return ino; } static inline ino_t get_parent_ino_from_dentry(struct dentry *dentry) { return get_ino_from_khandle(dentry->d_parent->d_inode); } static inline int is_root_handle(struct inode *inode) { gossip_debug(GOSSIP_DCACHE_DEBUG, "%s: root handle: %pU, this handle: %pU: ", __func__, |
8bb8aefd5
|
393 |
&ORANGEFS_SB(inode->i_sb)->root_khandle, |
f7ab093f7
|
394 |
get_khandle_from_ino(inode)); |
8bb8aefd5
|
395 |
if (ORANGEFS_khandle_cmp(&(ORANGEFS_SB(inode->i_sb)->root_khandle), |
f7ab093f7
|
396 397 398 399 400 |
get_khandle_from_ino(inode))) return 0; else return 1; } |
8bb8aefd5
|
401 |
static inline int match_handle(struct orangefs_khandle resp_handle, |
f7ab093f7
|
402 403 404 405 406 407 408 409 |
struct inode *inode) { gossip_debug(GOSSIP_DCACHE_DEBUG, "%s: one handle: %pU, another handle:%pU: ", __func__, &resp_handle, get_khandle_from_ino(inode)); |
8bb8aefd5
|
410 |
if (ORANGEFS_khandle_cmp(&resp_handle, get_khandle_from_ino(inode))) |
f7ab093f7
|
411 412 413 414 415 416 |
return 0; else return 1; } /* |
8bb8aefd5
|
417 |
* defined in orangefs-cache.c |
f7ab093f7
|
418 419 420 |
*/ int op_cache_initialize(void); int op_cache_finalize(void); |
8bb8aefd5
|
421 |
struct orangefs_kernel_op_s *op_alloc(__s32 type); |
78699e29f
|
422 |
void orangefs_new_tag(struct orangefs_kernel_op_s *op); |
8bb8aefd5
|
423 |
char *get_opname_string(struct orangefs_kernel_op_s *new_op); |
f7ab093f7
|
424 |
|
8bb8aefd5
|
425 426 |
int orangefs_inode_cache_initialize(void); int orangefs_inode_cache_finalize(void); |
f7ab093f7
|
427 |
|
f7ab093f7
|
428 |
/* |
8bb8aefd5
|
429 |
* defined in orangefs-mod.c |
f7ab093f7
|
430 431 432 433 434 435 |
*/ void purge_inprogress_ops(void); /* * defined in waitqueue.c */ |
f7ab093f7
|
436 437 438 439 440 |
void purge_waiting_ops(void); /* * defined in super.c */ |
8bb8aefd5
|
441 |
struct dentry *orangefs_mount(struct file_system_type *fst, |
f7ab093f7
|
442 443 444 |
int flags, const char *devname, void *data); |
8bb8aefd5
|
445 |
void orangefs_kill_sb(struct super_block *sb); |
45996492e
|
446 |
int orangefs_remount(struct orangefs_sb_info_s *); |
f7ab093f7
|
447 448 449 450 451 452 453 |
int fsid_key_table_initialize(void); void fsid_key_table_finalize(void); /* * defined in inode.c */ |
8bb8aefd5
|
454 455 |
__u32 convert_to_orangefs_mask(unsigned long lite_mask); struct inode *orangefs_new_inode(struct super_block *sb, |
f7ab093f7
|
456 457 458 |
struct inode *dir, int mode, dev_t dev, |
8bb8aefd5
|
459 |
struct orangefs_object_kref *ref); |
f7ab093f7
|
460 |
|
8bb8aefd5
|
461 |
int orangefs_setattr(struct dentry *dentry, struct iattr *iattr); |
f7ab093f7
|
462 |
|
8bb8aefd5
|
463 |
int orangefs_getattr(struct vfsmount *mnt, |
f7ab093f7
|
464 465 |
struct dentry *dentry, struct kstat *kstat); |
933287da7
|
466 |
int orangefs_permission(struct inode *inode, int mask); |
f7ab093f7
|
467 468 469 |
/* * defined in xattr.c */ |
8bb8aefd5
|
470 |
int orangefs_setxattr(struct dentry *dentry, |
f7ab093f7
|
471 472 473 474 |
const char *name, const void *value, size_t size, int flags); |
8bb8aefd5
|
475 |
ssize_t orangefs_getxattr(struct dentry *dentry, |
f7ab093f7
|
476 477 478 |
const char *name, void *buffer, size_t size); |
8bb8aefd5
|
479 |
ssize_t orangefs_listxattr(struct dentry *dentry, char *buffer, size_t size); |
f7ab093f7
|
480 481 482 483 |
/* * defined in namei.c */ |
8bb8aefd5
|
484 485 |
struct inode *orangefs_iget(struct super_block *sb, struct orangefs_object_kref *ref); |
f7ab093f7
|
486 |
|
8bb8aefd5
|
487 488 489 490 |
ssize_t orangefs_inode_read(struct inode *inode, struct iov_iter *iter, loff_t *offset, loff_t readahead_size); |
f7ab093f7
|
491 492 |
/* |
8bb8aefd5
|
493 |
* defined in devorangefs-req.c |
f7ab093f7
|
494 |
*/ |
8bb8aefd5
|
495 496 |
int orangefs_dev_init(void); void orangefs_dev_cleanup(void); |
f7ab093f7
|
497 |
int is_daemon_in_service(void); |
78699e29f
|
498 |
bool __is_daemon_in_service(void); |
f7ab093f7
|
499 500 |
/* |
8bb8aefd5
|
501 |
* defined in orangefs-utils.c |
f7ab093f7
|
502 |
*/ |
8bb8aefd5
|
503 |
__s32 fsid_of_op(struct orangefs_kernel_op_s *op); |
f7ab093f7
|
504 |
|
8bb8aefd5
|
505 |
int orangefs_flush_inode(struct inode *inode); |
f7ab093f7
|
506 |
|
8bb8aefd5
|
507 |
ssize_t orangefs_inode_getxattr(struct inode *inode, |
f7ab093f7
|
508 509 510 511 |
const char *prefix, const char *name, void *buffer, size_t size); |
8bb8aefd5
|
512 |
int orangefs_inode_setxattr(struct inode *inode, |
f7ab093f7
|
513 514 515 516 517 |
const char *prefix, const char *name, const void *value, size_t size, int flags); |
3c9cf98d7
|
518 |
int orangefs_inode_getattr(struct inode *inode, int new, int size); |
f7ab093f7
|
519 |
|
5859d77e5
|
520 |
int orangefs_inode_check_changed(struct inode *inode); |
8bb8aefd5
|
521 |
int orangefs_inode_setattr(struct inode *inode, struct iattr *iattr); |
f7ab093f7
|
522 |
|
8bb8aefd5
|
523 |
void orangefs_make_bad_inode(struct inode *inode); |
f7ab093f7
|
524 |
|
8bb8aefd5
|
525 |
int orangefs_unmount_sb(struct super_block *sb); |
f7ab093f7
|
526 |
|
78699e29f
|
527 |
bool orangefs_cancel_op_in_progress(struct orangefs_kernel_op_s *op); |
f7ab093f7
|
528 |
|
8bb8aefd5
|
529 |
int orangefs_normalize_to_errno(__s32 error_code); |
f7ab093f7
|
530 531 532 533 534 535 |
extern struct mutex devreq_mutex; extern struct mutex request_mutex; extern int debug; extern int op_timeout_secs; extern int slot_timeout_secs; |
8bb8aefd5
|
536 537 538 539 540 |
extern struct list_head orangefs_superblocks; extern spinlock_t orangefs_superblocks_lock; extern struct list_head orangefs_request_list; extern spinlock_t orangefs_request_list_lock; extern wait_queue_head_t orangefs_request_list_waitq; |
f7ab093f7
|
541 542 543 |
extern struct list_head *htable_ops_in_progress; extern spinlock_t htable_ops_in_progress_lock; extern int hash_table_size; |
8bb8aefd5
|
544 545 546 547 548 549 550 551 552 |
extern const struct address_space_operations orangefs_address_operations; extern struct backing_dev_info orangefs_backing_dev_info; extern struct inode_operations orangefs_file_inode_operations; extern const struct file_operations orangefs_file_operations; extern struct inode_operations orangefs_symlink_inode_operations; extern struct inode_operations orangefs_dir_inode_operations; extern const struct file_operations orangefs_dir_operations; extern const struct dentry_operations orangefs_dentry_operations; extern const struct file_operations orangefs_devreq_file_operations; |
f7ab093f7
|
553 |
|
8bb8aefd5
|
554 |
extern wait_queue_head_t orangefs_bufmap_init_waitq; |
f7ab093f7
|
555 556 557 558 |
/* * misc convenience macros */ |
f7ab093f7
|
559 |
|
8bb8aefd5
|
560 561 562 |
#define ORANGEFS_OP_INTERRUPTIBLE 1 /* service_operation() is interruptible */ #define ORANGEFS_OP_PRIORITY 2 /* service_operation() is high priority */ #define ORANGEFS_OP_CANCELLATION 4 /* this is a cancellation */ |
adcf34a28
|
563 |
#define ORANGEFS_OP_NO_MUTEX 8 /* don't acquire request_mutex */ |
8bb8aefd5
|
564 |
#define ORANGEFS_OP_ASYNC 16 /* Queue it, but don't wait */ |
f7ab093f7
|
565 |
|
8bb8aefd5
|
566 |
int service_operation(struct orangefs_kernel_op_s *op, |
f7ab093f7
|
567 568 |
const char *op_name, int flags); |
f7ab093f7
|
569 |
#define get_interruptible_flag(inode) \ |
8bb8aefd5
|
570 571 |
((ORANGEFS_SB(inode->i_sb)->flags & ORANGEFS_OPT_INTR) ? \ ORANGEFS_OP_INTERRUPTIBLE : 0) |
f7ab093f7
|
572 |
|
f7ab093f7
|
573 574 575 576 |
#define fill_default_sys_attrs(sys_attr, type, mode) \ do { \ sys_attr.owner = from_kuid(current_user_ns(), current_fsuid()); \ sys_attr.group = from_kgid(current_user_ns(), current_fsgid()); \ |
8bb8aefd5
|
577 |
sys_attr.perms = ORANGEFS_util_translate_mode(mode); \ |
69a23de2f
|
578 579 580 |
sys_attr.mtime = 0; \ sys_attr.atime = 0; \ sys_attr.ctime = 0; \ |
8bb8aefd5
|
581 |
sys_attr.mask = ORANGEFS_ATTR_SYS_ALL_SETABLE; \ |
f7ab093f7
|
582 |
} while (0) |
8bb8aefd5
|
583 |
static inline void orangefs_i_size_write(struct inode *inode, loff_t i_size) |
f7ab093f7
|
584 585 |
{ #if BITS_PER_LONG == 32 && defined(CONFIG_SMP) |
93d53a488
|
586 |
mutex_lock(&inode->i_mutex); |
f7ab093f7
|
587 588 589 |
#endif i_size_write(inode, i_size); #if BITS_PER_LONG == 32 && defined(CONFIG_SMP) |
93d53a488
|
590 |
mutex_unlock(&inode->i_mutex); |
f7ab093f7
|
591 592 |
#endif } |
8bb8aefd5
|
593 |
#endif /* __ORANGEFSKERNEL_H */ |