Skip to content

Commit 5dc23bd

Browse files
jankaratytso
authored andcommitted
ext4: remove ext4_ioend_wait()
Now that we clear PageWriteback after extent conversion, there's no need to wait for io_end processing in ext4_evict_inode(). Running AIO/DIO keeps file reference until aio_complete() is called so ext4_evict_inode() cannot be called. For io_end structures resulting from buffered IO waiting is happening because we wait for PageWriteback in truncate_inode_pages(). Reviewed-by: Zheng Liu <wenqing.lz@taobao.com> Signed-off-by: Jan Kara <jack@suse.cz> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
1 parent c724585 commit 5dc23bd

3 files changed

Lines changed: 3 additions & 22 deletions

File tree

‎fs/ext4/ext4.h‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2651,7 +2651,6 @@ extern int ext4_move_extents(struct file *o_filp, struct file *d_filp,
26512651
/* page-io.c */
26522652
extern int __init ext4_init_pageio(void);
26532653
extern void ext4_exit_pageio(void);
2654-
extern void ext4_ioend_shutdown(struct inode *);
26552654
extern ext4_io_end_t *ext4_init_io_end(struct inode *inode, gfp_t flags);
26562655
extern ext4_io_end_t *ext4_get_io_end(ext4_io_end_t *io_end);
26572656
extern int ext4_put_io_end(ext4_io_end_t *io_end);

‎fs/ext4/inode.c‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,8 @@ void ext4_evict_inode(struct inode *inode)
215215
filemap_write_and_wait(&inode->i_data);
216216
}
217217
truncate_inode_pages(&inode->i_data, 0);
218-
ext4_ioend_shutdown(inode);
218+
219+
WARN_ON(atomic_read(&EXT4_I(inode)->i_ioend_count));
219220
goto no_delete;
220221
}
221222

@@ -225,8 +226,8 @@ void ext4_evict_inode(struct inode *inode)
225226
if (ext4_should_order_data(inode))
226227
ext4_begin_ordered_truncate(inode, 0);
227228
truncate_inode_pages(&inode->i_data, 0);
228-
ext4_ioend_shutdown(inode);
229229

230+
WARN_ON(atomic_read(&EXT4_I(inode)->i_ioend_count));
230231
if (is_bad_inode(inode))
231232
goto no_delete;
232233

‎fs/ext4/page-io.c‎

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -45,25 +45,6 @@ void ext4_exit_pageio(void)
4545
kmem_cache_destroy(io_end_cachep);
4646
}
4747

48-
/*
49-
* This function is called by ext4_evict_inode() to make sure there is
50-
* no more pending I/O completion work left to do.
51-
*/
52-
void ext4_ioend_shutdown(struct inode *inode)
53-
{
54-
wait_queue_head_t *wq = ext4_ioend_wq(inode);
55-
56-
wait_event(*wq, (atomic_read(&EXT4_I(inode)->i_ioend_count) == 0));
57-
/*
58-
* We need to make sure the work structure is finished being
59-
* used before we let the inode get destroyed.
60-
*/
61-
if (work_pending(&EXT4_I(inode)->i_rsv_conversion_work))
62-
cancel_work_sync(&EXT4_I(inode)->i_rsv_conversion_work);
63-
if (work_pending(&EXT4_I(inode)->i_unrsv_conversion_work))
64-
cancel_work_sync(&EXT4_I(inode)->i_unrsv_conversion_work);
65-
}
66-
6748
/*
6849
* Print an buffer I/O error compatible with the fs/buffer.c. This
6950
* provides compatibility with dmesg scrapers that look for a specific

0 commit comments

Comments
 (0)