@@ -1819,6 +1819,17 @@ int inode_needs_sync(struct inode *inode)
}
EXPORT_SYMBOL(inode_needs_sync);
+wait_queue_head_t *prepare_wait_on_freeing_inode(
+ struct inode *inode, struct wait_bit_queue *wait)
+{
+ wait_queue_head_t *wq = bit_waitqueue(&inode->i_state, __I_NEW);
+
+ init_wait_bit(wait, &inode->i_state, __I_NEW);
+ prepare_to_wait(wq, &wait->wait, TASK_UNINTERRUPTIBLE);
+ return wq;
+}
+EXPORT_SYMBOL(prepare_wait_on_freeing_inode);
+
/*
* If we try to find an inode in the inode hash while it is being
* deleted, we have to wait until the filesystem completes its
@@ -1832,10 +1843,10 @@ EXPORT_SYMBOL(inode_needs_sync);
*/
static void __wait_on_freeing_inode(struct inode *inode)
{
+ struct wait_bit_queue wait;
wait_queue_head_t *wq;
- DEFINE_WAIT_BIT(wait, &inode->i_state, __I_NEW);
- wq = bit_waitqueue(&inode->i_state, __I_NEW);
- prepare_to_wait(wq, &wait.wait, TASK_UNINTERRUPTIBLE);
+
+ wq = prepare_wait_on_freeing_inode(inode, &wait);
spin_unlock(&inode->i_lock);
spin_unlock(&inode_hash_lock);
schedule();
@@ -2686,6 +2686,7 @@ extern void address_space_init_once(struct address_space *mapping);
extern struct inode * igrab(struct inode *);
extern ino_t iunique(struct super_block *, ino_t);
extern int inode_needs_sync(struct inode *inode);
+extern wait_queue_head_t *prepare_wait_on_freeing_inode(struct inode *inode, struct wait_bit_queue *wait);
extern int generic_delete_inode(struct inode *inode);
static inline int generic_drop_inode(struct inode *inode)
{
@@ -991,6 +991,14 @@ int wake_bit_function(wait_queue_t *wait, unsigned mode, int sync, void *key);
#define DEFINE_WAIT(name) DEFINE_WAIT_FUNC(name, autoremove_wake_function)
+#define init_wait(wait) \
+ do { \
+ (wait)->private = current; \
+ (wait)->func = autoremove_wake_function; \
+ INIT_LIST_HEAD(&(wait)->task_list); \
+ (wait)->flags = 0; \
+ } while (0)
+
#define DEFINE_WAIT_BIT(name, word, bit) \
struct wait_bit_queue name = { \
.key = __WAIT_BIT_KEY_INITIALIZER(word, bit), \
@@ -1002,15 +1010,16 @@ int wake_bit_function(wait_queue_t *wait, unsigned mode, int sync, void *key);
}, \
}
-#define init_wait(wait) \
+#define init_wait_bit(wbit, word, bit) \
do { \
- (wait)->private = current; \
- (wait)->func = autoremove_wake_function; \
- INIT_LIST_HEAD(&(wait)->task_list); \
- (wait)->flags = 0; \
+ (wbit)->key.flags = word; \
+ (wbit)->key.bit_nr = bit; \
+ (wbit)->wait.private = current; \
+ (wbit)->wait.func = wake_bit_function; \
+ INIT_LIST_HEAD(&(wbit)->wait.task_list); \
+ (wbit)->wait.flags = 0; \
} while (0)
-
extern int bit_wait(struct wait_bit_key *, int);
extern int bit_wait_io(struct wait_bit_key *, int);
extern int bit_wait_timeout(struct wait_bit_key *, int);