#define MAX_DEV_REQ_DOWNSIZE (2 * sizeof(__s32) + \
sizeof(__u64) + sizeof(struct orangefs_downcall_s))
-/* borrowed from irda.h */
-#ifndef MSECS_TO_JIFFIES
-#define MSECS_TO_JIFFIES(ms) (((ms)*HZ+999)/1000)
-#endif
-
/*
* valid orangefs kernel operation states
*
* serviced - op has matching downcall; ok
* purged - op has to start a timer since client-core
* exited uncleanly before servicing op
+ * given up - submitter has given up waiting for it
*/
enum orangefs_vfs_op_states {
OP_VFS_STATE_UNKNOWN = 0,
OP_VFS_STATE_INPROGR = 2,
OP_VFS_STATE_SERVICED = 4,
OP_VFS_STATE_PURGED = 8,
+ OP_VFS_STATE_GIVEN_UP = 16,
};
-#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)
-static inline void set_op_state_serviced(struct orangefs_kernel_op_s *op)
-{
- op->op_state = OP_VFS_STATE_SERVICED;
- wake_up_interruptible(&op->waitq);
-}
-static inline void set_op_state_purged(struct orangefs_kernel_op_s *op)
-{
- op->op_state |= OP_VFS_STATE_PURGED;
- wake_up_interruptible(&op->waitq);
-}
-
-#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)
-
-#define get_op(op) \
- do { \
- atomic_inc(&(op)->ref_count); \
- gossip_debug(GOSSIP_DEV_DEBUG, \
- "(get) Alloced OP (%p:%llu)\n", \
- op, \
- llu((op)->tag)); \
- } while (0)
-
-#define put_op(op) \
- do { \
- if (atomic_sub_and_test(1, &(op)->ref_count) == 1) { \
- gossip_debug(GOSSIP_DEV_DEBUG, \
- "(put) Releasing OP (%p:%llu)\n", \
- op, \
- llu((op)->tag)); \
- op_release(op); \
- } \
- } while (0)
-
-#define op_wait(op) (atomic_read(&(op)->ref_count) <= 2 ? 0 : 1)
-
/*
* Defines for controlling whether I/O upcalls are for async or sync operations
*/
#define ORANGEFS_CACHE_CREATE_FLAGS 0
#endif /* ((defined ORANGEFS_KERNEL_DEBUG) && (defined CONFIG_DEBUG_SLAB)) */
-#define ORANGEFS_CACHE_ALLOC_FLAGS (GFP_KERNEL)
#define ORANGEFS_GFP_FLAGS (GFP_KERNEL)
#define ORANGEFS_BUFMAP_GFP_FLAGS (GFP_KERNEL)
wait_queue_head_t waitq;
spinlock_t lock;
- int io_completed;
- wait_queue_head_t io_completion_waitq;
+ struct completion done;
atomic_t ref_count;
/* VFS aio fields */
- /* used by the async I/O code to stash the orangefs_kiocb_s structure */
- void *priv;
-
int attempts;
struct list_head list;
};
+#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)
+#define set_op_state_given_up(op) ((op)->op_state = OP_VFS_STATE_GIVEN_UP)
+static inline void set_op_state_serviced(struct orangefs_kernel_op_s *op)
+{
+ op->op_state = OP_VFS_STATE_SERVICED;
+ wake_up_interruptible(&op->waitq);
+}
+static inline void set_op_state_purged(struct orangefs_kernel_op_s *op)
+{
+ op->op_state |= OP_VFS_STATE_PURGED;
+ wake_up_interruptible(&op->waitq);
+}
+
+#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)
+#define op_state_given_up(op) ((op)->op_state & OP_VFS_STATE_GIVEN_UP)
+
+static inline void get_op(struct orangefs_kernel_op_s *op)
+{
+ atomic_inc(&op->ref_count);
+ gossip_debug(GOSSIP_DEV_DEBUG,
+ "(get) Alloced OP (%p:%llu)\n", op, llu(op->tag));
+}
+
+void __op_release(struct orangefs_kernel_op_s *op);
+
+static inline void op_release(struct orangefs_kernel_op_s *op)
+{
+ if (atomic_dec_and_test(&op->ref_count)) {
+ gossip_debug(GOSSIP_DEV_DEBUG,
+ "(put) Releasing OP (%p:%llu)\n", op, llu((op)->tag));
+ __op_release(op);
+ }
+}
+
/* per inode private orangefs info */
struct orangefs_inode_s {
struct orangefs_object_kref refn;
int op_cache_finalize(void);
struct orangefs_kernel_op_s *op_alloc(__s32 type);
char *get_opname_string(struct orangefs_kernel_op_s *new_op);
-void op_release(struct orangefs_kernel_op_s *op);
-
-int dev_req_cache_initialize(void);
-int dev_req_cache_finalize(void);
-void *dev_req_alloc(void);
-void dev_req_release(void *);
int orangefs_inode_cache_initialize(void);
int orangefs_inode_cache_finalize(void);
-int kiocb_cache_initialize(void);
-int kiocb_cache_finalize(void);
-struct orangefs_kiocb_s *kiocb_alloc(void);
-void kiocb_release(struct orangefs_kiocb_s *ptr);
-
/*
* defined in orangefs-mod.c
*/
struct dentry *dentry,
struct kstat *kstat);
+int orangefs_permission(struct inode *inode, int mask);
+
/*
* defined in xattr.c
*/
size_t size,
int flags);
-int orangefs_inode_getattr(struct inode *inode, __u32 mask);
+int orangefs_inode_getattr(struct inode *inode, __u32 mask, int check);
int orangefs_inode_setattr(struct inode *inode, struct iattr *iattr);
-void orangefs_op_initialize(struct orangefs_kernel_op_s *op);
-
void orangefs_make_bad_inode(struct inode *inode);
void orangefs_block_signals(sigset_t *);
const char *op_name,
int flags);
-/*
- * handles two possible error cases, depending on context.
- *
- * by design, our vfs i/o errors need to be handled in one of two ways,
- * depending on where the error occured.
- *
- * if the error happens in the waitqueue code because we either timed
- * out or a signal was raised while waiting, we need to cancel the
- * userspace i/o operation and free the op manually. this is done to
- * avoid having the device start writing application data to our shared
- * bufmap pages without us expecting it.
- *
- * FIXME: POSSIBLE OPTIMIZATION:
- * However, if we timed out or if we got a signal AND our upcall was never
- * picked off the queue (i.e. we were in OP_VFS_STATE_WAITING), then we don't
- * need to send a cancellation upcall. The way we can handle this is
- * set error_exit to 2 in such cases and 1 whenever cancellation has to be
- * sent and have handle_error
- * take care of this situation as well..
- *
- * if a orangefs sysint level error occured and i/o has been completed,
- * there is no need to cancel the operation, as the user has finished
- * using the bufmap page and so there is no danger in this case. in
- * this case, we wake up the device normally so that it may free the
- * op, as normal.
- *
- * note the only reason this is a macro is because both read and write
- * cases need the exact same handling code.
- */
-#define handle_io_error() \
-do { \
- if (!op_state_serviced(new_op)) { \
- orangefs_cancel_op_in_progress(new_op->tag); \
- op_release(new_op); \
- } else { \
- wake_up_daemon_for_return(new_op); \
- } \
- new_op = NULL; \
- orangefs_bufmap_put(bufmap, buffer_index); \
- buffer_index = -1; \
-} while (0)
-
#define get_interruptible_flag(inode) \
((ORANGEFS_SB(inode->i_sb)->flags & ORANGEFS_OPT_INTR) ? \
ORANGEFS_OP_INTERRUPTIBLE : 0)