aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ext4/inode.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/ext4/inode.c')
-rw-r--r--fs/ext4/inode.c28
1 files changed, 15 insertions, 13 deletions
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index ec367bce721..5c5bc5dafff 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -1146,8 +1146,8 @@ static int check_block_validity(struct inode *inode, const char *msg,
1146} 1146}
1147 1147
1148/* 1148/*
1149 * Return the number of dirty pages in the given inode starting at 1149 * Return the number of contiguous dirty pages in a given inode
1150 * page frame idx. 1150 * starting at page frame idx.
1151 */ 1151 */
1152static pgoff_t ext4_num_dirty_pages(struct inode *inode, pgoff_t idx, 1152static pgoff_t ext4_num_dirty_pages(struct inode *inode, pgoff_t idx,
1153 unsigned int max_pages) 1153 unsigned int max_pages)
@@ -1181,15 +1181,15 @@ static pgoff_t ext4_num_dirty_pages(struct inode *inode, pgoff_t idx,
1181 unlock_page(page); 1181 unlock_page(page);
1182 break; 1182 break;
1183 } 1183 }
1184 head = page_buffers(page); 1184 if (page_has_buffers(page)) {
1185 bh = head; 1185 bh = head = page_buffers(page);
1186 do { 1186 do {
1187 if (!buffer_delay(bh) && 1187 if (!buffer_delay(bh) &&
1188 !buffer_unwritten(bh)) { 1188 !buffer_unwritten(bh))
1189 done = 1; 1189 done = 1;
1190 break; 1190 bh = bh->b_this_page;
1191 } 1191 } while (!done && (bh != head));
1192 } while ((bh = bh->b_this_page) != head); 1192 }
1193 unlock_page(page); 1193 unlock_page(page);
1194 if (done) 1194 if (done)
1195 break; 1195 break;
@@ -3378,6 +3378,7 @@ static ssize_t ext4_ind_direct_IO(int rw, struct kiocb *iocb,
3378 ssize_t ret; 3378 ssize_t ret;
3379 int orphan = 0; 3379 int orphan = 0;
3380 size_t count = iov_length(iov, nr_segs); 3380 size_t count = iov_length(iov, nr_segs);
3381 int retries = 0;
3381 3382
3382 if (rw == WRITE) { 3383 if (rw == WRITE) {
3383 loff_t final_size = offset + count; 3384 loff_t final_size = offset + count;
@@ -3400,9 +3401,12 @@ static ssize_t ext4_ind_direct_IO(int rw, struct kiocb *iocb,
3400 } 3401 }
3401 } 3402 }
3402 3403
3404retry:
3403 ret = blockdev_direct_IO(rw, iocb, inode, inode->i_sb->s_bdev, iov, 3405 ret = blockdev_direct_IO(rw, iocb, inode, inode->i_sb->s_bdev, iov,
3404 offset, nr_segs, 3406 offset, nr_segs,
3405 ext4_get_block, NULL); 3407 ext4_get_block, NULL);
3408 if (ret == -ENOSPC && ext4_should_retry_alloc(inode->i_sb, &retries))
3409 goto retry;
3406 3410
3407 if (orphan) { 3411 if (orphan) {
3408 int err; 3412 int err;
@@ -5612,14 +5616,12 @@ int ext4_mark_inode_dirty(handle_t *handle, struct inode *inode)
5612 */ 5616 */
5613void ext4_dirty_inode(struct inode *inode) 5617void ext4_dirty_inode(struct inode *inode)
5614{ 5618{
5615 handle_t *current_handle = ext4_journal_current_handle();
5616 handle_t *handle; 5619 handle_t *handle;
5617 5620
5618 handle = ext4_journal_start(inode, 2); 5621 handle = ext4_journal_start(inode, 2);
5619 if (IS_ERR(handle)) 5622 if (IS_ERR(handle))
5620 goto out; 5623 goto out;
5621 5624
5622 jbd_debug(5, "marking dirty. outer handle=%p\n", current_handle);
5623 ext4_mark_inode_dirty(handle, inode); 5625 ext4_mark_inode_dirty(handle, inode);
5624 5626
5625 ext4_journal_stop(handle); 5627 ext4_journal_stop(handle);