mirror of
https://github.com/torvalds/linux.git
synced 2024-11-12 23:23:03 +00:00
inode: remove __I_DIO_WAKEUP
Afaict, we can just rely on inode->i_dio_count for waiting instead of this awkward indirection through __I_DIO_WAKEUP. This survives LTP dio and xfstests dio tests. Link: https://lore.kernel.org/r/20240816-vfs-misc-dio-v1-1-80fe21a2c710@kernel.org Reviewed-by: Josef Bacik <josef@toxicpanda.com> Reviewed-by: Jeff Layton <jlayton@kernel.org> Signed-off-by: Christian Brauner <brauner@kernel.org>
This commit is contained in:
parent
3717bbcb59
commit
1c48d44146
23
fs/inode.c
23
fs/inode.c
@ -2500,18 +2500,11 @@ EXPORT_SYMBOL(inode_owner_or_capable);
|
|||||||
/*
|
/*
|
||||||
* Direct i/o helper functions
|
* Direct i/o helper functions
|
||||||
*/
|
*/
|
||||||
static void __inode_dio_wait(struct inode *inode)
|
bool inode_dio_finished(const struct inode *inode)
|
||||||
{
|
{
|
||||||
wait_queue_head_t *wq = bit_waitqueue(&inode->i_state, __I_DIO_WAKEUP);
|
return atomic_read(&inode->i_dio_count) == 0;
|
||||||
DEFINE_WAIT_BIT(q, &inode->i_state, __I_DIO_WAKEUP);
|
|
||||||
|
|
||||||
do {
|
|
||||||
prepare_to_wait(wq, &q.wq_entry, TASK_UNINTERRUPTIBLE);
|
|
||||||
if (atomic_read(&inode->i_dio_count))
|
|
||||||
schedule();
|
|
||||||
} while (atomic_read(&inode->i_dio_count));
|
|
||||||
finish_wait(wq, &q.wq_entry);
|
|
||||||
}
|
}
|
||||||
|
EXPORT_SYMBOL(inode_dio_finished);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* inode_dio_wait - wait for outstanding DIO requests to finish
|
* inode_dio_wait - wait for outstanding DIO requests to finish
|
||||||
@ -2525,11 +2518,17 @@ static void __inode_dio_wait(struct inode *inode)
|
|||||||
*/
|
*/
|
||||||
void inode_dio_wait(struct inode *inode)
|
void inode_dio_wait(struct inode *inode)
|
||||||
{
|
{
|
||||||
if (atomic_read(&inode->i_dio_count))
|
wait_var_event(&inode->i_dio_count, inode_dio_finished(inode));
|
||||||
__inode_dio_wait(inode);
|
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(inode_dio_wait);
|
EXPORT_SYMBOL(inode_dio_wait);
|
||||||
|
|
||||||
|
void inode_dio_wait_interruptible(struct inode *inode)
|
||||||
|
{
|
||||||
|
wait_var_event_interruptible(&inode->i_dio_count,
|
||||||
|
inode_dio_finished(inode));
|
||||||
|
}
|
||||||
|
EXPORT_SYMBOL(inode_dio_wait_interruptible);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* inode_set_flags - atomically set some inode flags
|
* inode_set_flags - atomically set some inode flags
|
||||||
*
|
*
|
||||||
|
@ -19,25 +19,13 @@
|
|||||||
* Must be called under a lock that serializes taking new references
|
* Must be called under a lock that serializes taking new references
|
||||||
* to i_dio_count, usually by inode->i_mutex.
|
* to i_dio_count, usually by inode->i_mutex.
|
||||||
*/
|
*/
|
||||||
static int inode_dio_wait_interruptible(struct inode *inode)
|
static int netfs_inode_dio_wait_interruptible(struct inode *inode)
|
||||||
{
|
{
|
||||||
if (!atomic_read(&inode->i_dio_count))
|
if (inode_dio_finished(inode))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
wait_queue_head_t *wq = bit_waitqueue(&inode->i_state, __I_DIO_WAKEUP);
|
inode_dio_wait_interruptible(inode);
|
||||||
DEFINE_WAIT_BIT(q, &inode->i_state, __I_DIO_WAKEUP);
|
return !inode_dio_finished(inode) ? -ERESTARTSYS : 0;
|
||||||
|
|
||||||
for (;;) {
|
|
||||||
prepare_to_wait(wq, &q.wq_entry, TASK_INTERRUPTIBLE);
|
|
||||||
if (!atomic_read(&inode->i_dio_count))
|
|
||||||
break;
|
|
||||||
if (signal_pending(current))
|
|
||||||
break;
|
|
||||||
schedule();
|
|
||||||
}
|
|
||||||
finish_wait(wq, &q.wq_entry);
|
|
||||||
|
|
||||||
return atomic_read(&inode->i_dio_count) ? -ERESTARTSYS : 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Call with exclusively locked inode->i_rwsem */
|
/* Call with exclusively locked inode->i_rwsem */
|
||||||
@ -46,7 +34,7 @@ static int netfs_block_o_direct(struct netfs_inode *ictx)
|
|||||||
if (!test_bit(NETFS_ICTX_ODIRECT, &ictx->flags))
|
if (!test_bit(NETFS_ICTX_ODIRECT, &ictx->flags))
|
||||||
return 0;
|
return 0;
|
||||||
clear_bit(NETFS_ICTX_ODIRECT, &ictx->flags);
|
clear_bit(NETFS_ICTX_ODIRECT, &ictx->flags);
|
||||||
return inode_dio_wait_interruptible(&ictx->inode);
|
return netfs_inode_dio_wait_interruptible(&ictx->inode);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -2373,8 +2373,6 @@ static inline void kiocb_clone(struct kiocb *kiocb, struct kiocb *kiocb_src,
|
|||||||
*
|
*
|
||||||
* I_REFERENCED Marks the inode as recently references on the LRU list.
|
* I_REFERENCED Marks the inode as recently references on the LRU list.
|
||||||
*
|
*
|
||||||
* I_DIO_WAKEUP Never set. Only used as a key for wait_on_bit().
|
|
||||||
*
|
|
||||||
* I_WB_SWITCH Cgroup bdi_writeback switching in progress. Used to
|
* I_WB_SWITCH Cgroup bdi_writeback switching in progress. Used to
|
||||||
* synchronize competing switching instances and to tell
|
* synchronize competing switching instances and to tell
|
||||||
* wb stat updates to grab the i_pages lock. See
|
* wb stat updates to grab the i_pages lock. See
|
||||||
@ -2409,8 +2407,6 @@ static inline void kiocb_clone(struct kiocb *kiocb, struct kiocb *kiocb_src,
|
|||||||
#define __I_SYNC 7
|
#define __I_SYNC 7
|
||||||
#define I_SYNC (1 << __I_SYNC)
|
#define I_SYNC (1 << __I_SYNC)
|
||||||
#define I_REFERENCED (1 << 8)
|
#define I_REFERENCED (1 << 8)
|
||||||
#define __I_DIO_WAKEUP 9
|
|
||||||
#define I_DIO_WAKEUP (1 << __I_DIO_WAKEUP)
|
|
||||||
#define I_LINKABLE (1 << 10)
|
#define I_LINKABLE (1 << 10)
|
||||||
#define I_DIRTY_TIME (1 << 11)
|
#define I_DIRTY_TIME (1 << 11)
|
||||||
#define I_WB_SWITCH (1 << 13)
|
#define I_WB_SWITCH (1 << 13)
|
||||||
@ -3227,7 +3223,9 @@ static inline ssize_t blockdev_direct_IO(struct kiocb *iocb,
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
bool inode_dio_finished(const struct inode *inode);
|
||||||
void inode_dio_wait(struct inode *inode);
|
void inode_dio_wait(struct inode *inode);
|
||||||
|
void inode_dio_wait_interruptible(struct inode *inode);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* inode_dio_begin - signal start of a direct I/O requests
|
* inode_dio_begin - signal start of a direct I/O requests
|
||||||
@ -3251,7 +3249,7 @@ static inline void inode_dio_begin(struct inode *inode)
|
|||||||
static inline void inode_dio_end(struct inode *inode)
|
static inline void inode_dio_end(struct inode *inode)
|
||||||
{
|
{
|
||||||
if (atomic_dec_and_test(&inode->i_dio_count))
|
if (atomic_dec_and_test(&inode->i_dio_count))
|
||||||
wake_up_bit(&inode->i_state, __I_DIO_WAKEUP);
|
wake_up_var(&inode->i_dio_count);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern void inode_set_flags(struct inode *inode, unsigned int flags,
|
extern void inode_set_flags(struct inode *inode, unsigned int flags,
|
||||||
|
Loading…
Reference in New Issue
Block a user