diff options
author | Christoph Hellwig <hch@lst.de> | 2010-06-04 05:29:57 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2010-08-09 16:47:32 -0400 |
commit | 6e1db88d536adcbbfe562b2d4b7d6425784fff12 (patch) | |
tree | 8cfcb5a6190722db6249b2e4978f39247975abcf /fs/ext4 | |
parent | f4e420dc423148fba637af1ab618fa8896dfb2d6 (diff) |
introduce __block_write_begin
Split up the block_write_begin implementation - __block_write_begin is a new
trivial wrapper for block_prepare_write that always takes an already
allocated page and can be either called from block_write_begin or filesystem
code that already has a page allocated. Remove the handling of already
allocated pages from block_write_begin after switching all callers that
do it to __block_write_begin.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/ext4')
-rw-r--r-- | fs/ext4/inode.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index d6a7701018a6..3da3c9646e5e 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c | |||
@@ -1578,11 +1578,9 @@ retry: | |||
1578 | *pagep = page; | 1578 | *pagep = page; |
1579 | 1579 | ||
1580 | if (ext4_should_dioread_nolock(inode)) | 1580 | if (ext4_should_dioread_nolock(inode)) |
1581 | ret = block_write_begin(file, mapping, pos, len, flags, pagep, | 1581 | ret = __block_write_begin(page, pos, len, ext4_get_block_write); |
1582 | fsdata, ext4_get_block_write); | ||
1583 | else | 1582 | else |
1584 | ret = block_write_begin(file, mapping, pos, len, flags, pagep, | 1583 | ret = __block_write_begin(page, pos, len, ext4_get_block); |
1585 | fsdata, ext4_get_block); | ||
1586 | 1584 | ||
1587 | if (!ret && ext4_should_journal_data(inode)) { | 1585 | if (!ret && ext4_should_journal_data(inode)) { |
1588 | ret = walk_page_buffers(handle, page_buffers(page), | 1586 | ret = walk_page_buffers(handle, page_buffers(page), |
@@ -1593,7 +1591,7 @@ retry: | |||
1593 | unlock_page(page); | 1591 | unlock_page(page); |
1594 | page_cache_release(page); | 1592 | page_cache_release(page); |
1595 | /* | 1593 | /* |
1596 | * block_write_begin may have instantiated a few blocks | 1594 | * __block_write_begin may have instantiated a few blocks |
1597 | * outside i_size. Trim these off again. Don't need | 1595 | * outside i_size. Trim these off again. Don't need |
1598 | * i_size_read because we hold i_mutex. | 1596 | * i_size_read because we hold i_mutex. |
1599 | * | 1597 | * |
@@ -3185,8 +3183,7 @@ retry: | |||
3185 | } | 3183 | } |
3186 | *pagep = page; | 3184 | *pagep = page; |
3187 | 3185 | ||
3188 | ret = block_write_begin(file, mapping, pos, len, flags, pagep, fsdata, | 3186 | ret = __block_write_begin(page, pos, len, ext4_da_get_block_prep); |
3189 | ext4_da_get_block_prep); | ||
3190 | if (ret < 0) { | 3187 | if (ret < 0) { |
3191 | unlock_page(page); | 3188 | unlock_page(page); |
3192 | ext4_journal_stop(handle); | 3189 | ext4_journal_stop(handle); |