diff options
Diffstat (limited to 'fs/jbd2/commit.c')
-rw-r--r-- | fs/jbd2/commit.c | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/fs/jbd2/commit.c b/fs/jbd2/commit.c index c8c1d6cc6e5d..132fb92098c7 100644 --- a/fs/jbd2/commit.c +++ b/fs/jbd2/commit.c | |||
@@ -187,14 +187,15 @@ static int journal_wait_on_commit_record(journal_t *journal, | |||
187 | * use writepages() because with delayed allocation we may be doing | 187 | * use writepages() because with delayed allocation we may be doing |
188 | * block allocation in writepages(). | 188 | * block allocation in writepages(). |
189 | */ | 189 | */ |
190 | static int journal_submit_inode_data_buffers(struct address_space *mapping) | 190 | static int journal_submit_inode_data_buffers(struct address_space *mapping, |
191 | loff_t dirty_start, loff_t dirty_end) | ||
191 | { | 192 | { |
192 | int ret; | 193 | int ret; |
193 | struct writeback_control wbc = { | 194 | struct writeback_control wbc = { |
194 | .sync_mode = WB_SYNC_ALL, | 195 | .sync_mode = WB_SYNC_ALL, |
195 | .nr_to_write = mapping->nrpages * 2, | 196 | .nr_to_write = mapping->nrpages * 2, |
196 | .range_start = 0, | 197 | .range_start = dirty_start, |
197 | .range_end = i_size_read(mapping->host), | 198 | .range_end = dirty_end, |
198 | }; | 199 | }; |
199 | 200 | ||
200 | ret = generic_writepages(mapping, &wbc); | 201 | ret = generic_writepages(mapping, &wbc); |
@@ -218,6 +219,9 @@ static int journal_submit_data_buffers(journal_t *journal, | |||
218 | 219 | ||
219 | spin_lock(&journal->j_list_lock); | 220 | spin_lock(&journal->j_list_lock); |
220 | list_for_each_entry(jinode, &commit_transaction->t_inode_list, i_list) { | 221 | list_for_each_entry(jinode, &commit_transaction->t_inode_list, i_list) { |
222 | loff_t dirty_start = jinode->i_dirty_start; | ||
223 | loff_t dirty_end = jinode->i_dirty_end; | ||
224 | |||
221 | if (!(jinode->i_flags & JI_WRITE_DATA)) | 225 | if (!(jinode->i_flags & JI_WRITE_DATA)) |
222 | continue; | 226 | continue; |
223 | mapping = jinode->i_vfs_inode->i_mapping; | 227 | mapping = jinode->i_vfs_inode->i_mapping; |
@@ -230,7 +234,8 @@ static int journal_submit_data_buffers(journal_t *journal, | |||
230 | * only allocated blocks here. | 234 | * only allocated blocks here. |
231 | */ | 235 | */ |
232 | trace_jbd2_submit_inode_data(jinode->i_vfs_inode); | 236 | trace_jbd2_submit_inode_data(jinode->i_vfs_inode); |
233 | err = journal_submit_inode_data_buffers(mapping); | 237 | err = journal_submit_inode_data_buffers(mapping, dirty_start, |
238 | dirty_end); | ||
234 | if (!ret) | 239 | if (!ret) |
235 | ret = err; | 240 | ret = err; |
236 | spin_lock(&journal->j_list_lock); | 241 | spin_lock(&journal->j_list_lock); |
@@ -257,12 +262,16 @@ static int journal_finish_inode_data_buffers(journal_t *journal, | |||
257 | /* For locking, see the comment in journal_submit_data_buffers() */ | 262 | /* For locking, see the comment in journal_submit_data_buffers() */ |
258 | spin_lock(&journal->j_list_lock); | 263 | spin_lock(&journal->j_list_lock); |
259 | list_for_each_entry(jinode, &commit_transaction->t_inode_list, i_list) { | 264 | list_for_each_entry(jinode, &commit_transaction->t_inode_list, i_list) { |
265 | loff_t dirty_start = jinode->i_dirty_start; | ||
266 | loff_t dirty_end = jinode->i_dirty_end; | ||
267 | |||
260 | if (!(jinode->i_flags & JI_WAIT_DATA)) | 268 | if (!(jinode->i_flags & JI_WAIT_DATA)) |
261 | continue; | 269 | continue; |
262 | jinode->i_flags |= JI_COMMIT_RUNNING; | 270 | jinode->i_flags |= JI_COMMIT_RUNNING; |
263 | spin_unlock(&journal->j_list_lock); | 271 | spin_unlock(&journal->j_list_lock); |
264 | err = filemap_fdatawait_keep_errors( | 272 | err = filemap_fdatawait_range_keep_errors( |
265 | jinode->i_vfs_inode->i_mapping); | 273 | jinode->i_vfs_inode->i_mapping, dirty_start, |
274 | dirty_end); | ||
266 | if (!ret) | 275 | if (!ret) |
267 | ret = err; | 276 | ret = err; |
268 | spin_lock(&journal->j_list_lock); | 277 | spin_lock(&journal->j_list_lock); |
@@ -282,6 +291,8 @@ static int journal_finish_inode_data_buffers(journal_t *journal, | |||
282 | &jinode->i_transaction->t_inode_list); | 291 | &jinode->i_transaction->t_inode_list); |
283 | } else { | 292 | } else { |
284 | jinode->i_transaction = NULL; | 293 | jinode->i_transaction = NULL; |
294 | jinode->i_dirty_start = 0; | ||
295 | jinode->i_dirty_end = 0; | ||
285 | } | 296 | } |
286 | } | 297 | } |
287 | spin_unlock(&journal->j_list_lock); | 298 | spin_unlock(&journal->j_list_lock); |