diff options
| -rw-r--r-- | fs/ext4/ext4.h | 1 | ||||
| -rw-r--r-- | fs/ext4/inode.c | 3 | ||||
| -rw-r--r-- | fs/ext4/page-io.c | 18 |
3 files changed, 18 insertions, 4 deletions
diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h index e717dfd2f2b4..b7d7bd0f066e 100644 --- a/fs/ext4/ext4.h +++ b/fs/ext4/ext4.h | |||
| @@ -175,6 +175,7 @@ struct mpage_da_data { | |||
| 175 | */ | 175 | */ |
| 176 | #define EXT4_IO_END_UNWRITTEN 0x0001 | 176 | #define EXT4_IO_END_UNWRITTEN 0x0001 |
| 177 | #define EXT4_IO_END_ERROR 0x0002 | 177 | #define EXT4_IO_END_ERROR 0x0002 |
| 178 | #define EXT4_IO_END_QUEUED 0x0004 | ||
| 178 | 179 | ||
| 179 | struct ext4_io_page { | 180 | struct ext4_io_page { |
| 180 | struct page *p_page; | 181 | struct page *p_page; |
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index c4da98a959ae..18d2558b7624 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c | |||
| @@ -121,9 +121,6 @@ void ext4_evict_inode(struct inode *inode) | |||
| 121 | 121 | ||
| 122 | trace_ext4_evict_inode(inode); | 122 | trace_ext4_evict_inode(inode); |
| 123 | 123 | ||
| 124 | mutex_lock(&inode->i_mutex); | ||
| 125 | ext4_flush_completed_IO(inode); | ||
| 126 | mutex_unlock(&inode->i_mutex); | ||
| 127 | ext4_ioend_wait(inode); | 124 | ext4_ioend_wait(inode); |
| 128 | 125 | ||
| 129 | if (inode->i_nlink) { | 126 | if (inode->i_nlink) { |
diff --git a/fs/ext4/page-io.c b/fs/ext4/page-io.c index 78839af7ce29..92f38ee13f8a 100644 --- a/fs/ext4/page-io.c +++ b/fs/ext4/page-io.c | |||
| @@ -142,7 +142,23 @@ static void ext4_end_io_work(struct work_struct *work) | |||
| 142 | unsigned long flags; | 142 | unsigned long flags; |
| 143 | int ret; | 143 | int ret; |
| 144 | 144 | ||
| 145 | mutex_lock(&inode->i_mutex); | 145 | if (!mutex_trylock(&inode->i_mutex)) { |
| 146 | /* | ||
| 147 | * Requeue the work instead of waiting so that the work | ||
| 148 | * items queued after this can be processed. | ||
| 149 | */ | ||
| 150 | queue_work(EXT4_SB(inode->i_sb)->dio_unwritten_wq, &io->work); | ||
| 151 | /* | ||
| 152 | * To prevent the ext4-dio-unwritten thread from keeping | ||
| 153 | * requeueing end_io requests and occupying cpu for too long, | ||
| 154 | * yield the cpu if it sees an end_io request that has already | ||
| 155 | * been requeued. | ||
| 156 | */ | ||
| 157 | if (io->flag & EXT4_IO_END_QUEUED) | ||
| 158 | yield(); | ||
| 159 | io->flag |= EXT4_IO_END_QUEUED; | ||
| 160 | return; | ||
| 161 | } | ||
| 146 | ret = ext4_end_io_nolock(io); | 162 | ret = ext4_end_io_nolock(io); |
| 147 | if (ret < 0) { | 163 | if (ret < 0) { |
| 148 | mutex_unlock(&inode->i_mutex); | 164 | mutex_unlock(&inode->i_mutex); |
