Commit 72c5052d authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Al Viro

fs: move inode_dio_done to the end_io handler

For filesystems that delay their end_io processing we should keep our
i_dio_count until the the processing is done.  Enable this by moving
the inode_dio_done call to the end_io handler if one exist.  Note that
the actual move to the workqueue for ext4 and XFS is not done in
this patch yet, but left to the filesystem maintainers.  At least
for XFS it's not needed yet either as XFS has an internal equivalent
to i_dio_count.
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent aacfc19c
...@@ -293,11 +293,12 @@ static ssize_t dio_complete(struct dio *dio, loff_t offset, ssize_t ret, bool is ...@@ -293,11 +293,12 @@ static ssize_t dio_complete(struct dio *dio, loff_t offset, ssize_t ret, bool is
if (dio->end_io && dio->result) { if (dio->end_io && dio->result) {
dio->end_io(dio->iocb, offset, transferred, dio->end_io(dio->iocb, offset, transferred,
dio->map_bh.b_private, ret, is_async); dio->map_bh.b_private, ret, is_async);
} else if (is_async) { } else {
aio_complete(dio->iocb, ret, 0); if (is_async)
aio_complete(dio->iocb, ret, 0);
inode_dio_done(dio->inode);
} }
inode_dio_done(dio->inode);
return ret; return ret;
} }
......
...@@ -3573,6 +3573,7 @@ static void ext4_end_io_dio(struct kiocb *iocb, loff_t offset, ...@@ -3573,6 +3573,7 @@ static void ext4_end_io_dio(struct kiocb *iocb, loff_t offset,
ssize_t size, void *private, int ret, ssize_t size, void *private, int ret,
bool is_async) bool is_async)
{ {
struct inode *inode = iocb->ki_filp->f_path.dentry->d_inode;
ext4_io_end_t *io_end = iocb->private; ext4_io_end_t *io_end = iocb->private;
struct workqueue_struct *wq; struct workqueue_struct *wq;
unsigned long flags; unsigned long flags;
...@@ -3594,6 +3595,7 @@ static void ext4_end_io_dio(struct kiocb *iocb, loff_t offset, ...@@ -3594,6 +3595,7 @@ static void ext4_end_io_dio(struct kiocb *iocb, loff_t offset,
out: out:
if (is_async) if (is_async)
aio_complete(iocb, ret, 0); aio_complete(iocb, ret, 0);
inode_dio_done(inode);
return; return;
} }
...@@ -3614,6 +3616,9 @@ static void ext4_end_io_dio(struct kiocb *iocb, loff_t offset, ...@@ -3614,6 +3616,9 @@ static void ext4_end_io_dio(struct kiocb *iocb, loff_t offset,
/* queue the work to convert unwritten extents to written */ /* queue the work to convert unwritten extents to written */
queue_work(wq, &io_end->work); queue_work(wq, &io_end->work);
iocb->private = NULL; iocb->private = NULL;
/* XXX: probably should move into the real I/O completion handler */
inode_dio_done(inode);
} }
static void ext4_end_io_buffer_write(struct buffer_head *bh, int uptodate) static void ext4_end_io_buffer_write(struct buffer_head *bh, int uptodate)
......
...@@ -577,6 +577,7 @@ static void ocfs2_dio_end_io(struct kiocb *iocb, ...@@ -577,6 +577,7 @@ static void ocfs2_dio_end_io(struct kiocb *iocb,
if (is_async) if (is_async)
aio_complete(iocb, ret, 0); aio_complete(iocb, ret, 0);
inode_dio_done(inode);
} }
/* /*
......
...@@ -1339,6 +1339,9 @@ xfs_end_io_direct_write( ...@@ -1339,6 +1339,9 @@ xfs_end_io_direct_write(
} else { } else {
xfs_finish_ioend_sync(ioend); xfs_finish_ioend_sync(ioend);
} }
/* XXX: probably should move into the real I/O completion handler */
inode_dio_done(ioend->io_inode);
} }
STATIC ssize_t STATIC ssize_t
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment