orangefs-kernel.h 17 KB

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