diff options
Diffstat (limited to 'fs/buffer.c')
| -rw-r--r-- | fs/buffer.c | 26 |
1 files changed, 9 insertions, 17 deletions
diff --git a/fs/buffer.c b/fs/buffer.c index 8d595ab2aed1..5930e382959b 100644 --- a/fs/buffer.c +++ b/fs/buffer.c | |||
| @@ -1833,9 +1833,11 @@ void page_zero_new_buffers(struct page *page, unsigned from, unsigned to) | |||
| 1833 | } | 1833 | } |
| 1834 | EXPORT_SYMBOL(page_zero_new_buffers); | 1834 | EXPORT_SYMBOL(page_zero_new_buffers); |
| 1835 | 1835 | ||
| 1836 | int block_prepare_write(struct page *page, unsigned from, unsigned to, | 1836 | int __block_write_begin(struct page *page, loff_t pos, unsigned len, |
| 1837 | get_block_t *get_block) | 1837 | get_block_t *get_block) |
| 1838 | { | 1838 | { |
| 1839 | unsigned from = pos & (PAGE_CACHE_SIZE - 1); | ||
| 1840 | unsigned to = from + len; | ||
| 1839 | struct inode *inode = page->mapping->host; | 1841 | struct inode *inode = page->mapping->host; |
| 1840 | unsigned block_start, block_end; | 1842 | unsigned block_start, block_end; |
| 1841 | sector_t block; | 1843 | sector_t block; |
| @@ -1915,7 +1917,7 @@ int block_prepare_write(struct page *page, unsigned from, unsigned to, | |||
| 1915 | } | 1917 | } |
| 1916 | return err; | 1918 | return err; |
| 1917 | } | 1919 | } |
| 1918 | EXPORT_SYMBOL(block_prepare_write); | 1920 | EXPORT_SYMBOL(__block_write_begin); |
| 1919 | 1921 | ||
| 1920 | static int __block_commit_write(struct inode *inode, struct page *page, | 1922 | static int __block_commit_write(struct inode *inode, struct page *page, |
| 1921 | unsigned from, unsigned to) | 1923 | unsigned from, unsigned to) |
| @@ -1952,15 +1954,6 @@ static int __block_commit_write(struct inode *inode, struct page *page, | |||
| 1952 | return 0; | 1954 | return 0; |
| 1953 | } | 1955 | } |
| 1954 | 1956 | ||
| 1955 | int __block_write_begin(struct page *page, loff_t pos, unsigned len, | ||
| 1956 | get_block_t *get_block) | ||
| 1957 | { | ||
| 1958 | unsigned start = pos & (PAGE_CACHE_SIZE - 1); | ||
| 1959 | |||
| 1960 | return block_prepare_write(page, start, start + len, get_block); | ||
| 1961 | } | ||
| 1962 | EXPORT_SYMBOL(__block_write_begin); | ||
| 1963 | |||
| 1964 | /* | 1957 | /* |
| 1965 | * block_write_begin takes care of the basic task of block allocation and | 1958 | * block_write_begin takes care of the basic task of block allocation and |
| 1966 | * bringing partial write blocks uptodate first. | 1959 | * bringing partial write blocks uptodate first. |
| @@ -2378,7 +2371,7 @@ block_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf, | |||
| 2378 | else | 2371 | else |
| 2379 | end = PAGE_CACHE_SIZE; | 2372 | end = PAGE_CACHE_SIZE; |
| 2380 | 2373 | ||
| 2381 | ret = block_prepare_write(page, 0, end, get_block); | 2374 | ret = __block_write_begin(page, 0, end, get_block); |
| 2382 | if (!ret) | 2375 | if (!ret) |
| 2383 | ret = block_commit_write(page, 0, end); | 2376 | ret = block_commit_write(page, 0, end); |
| 2384 | 2377 | ||
| @@ -2465,11 +2458,10 @@ int nobh_write_begin(struct address_space *mapping, | |||
| 2465 | *fsdata = NULL; | 2458 | *fsdata = NULL; |
| 2466 | 2459 | ||
| 2467 | if (page_has_buffers(page)) { | 2460 | if (page_has_buffers(page)) { |
| 2468 | unlock_page(page); | 2461 | ret = __block_write_begin(page, pos, len, get_block); |
| 2469 | page_cache_release(page); | 2462 | if (unlikely(ret)) |
| 2470 | *pagep = NULL; | 2463 | goto out_release; |
| 2471 | return block_write_begin(mapping, pos, len, flags, pagep, | 2464 | return ret; |
| 2472 | get_block); | ||
| 2473 | } | 2465 | } |
| 2474 | 2466 | ||
| 2475 | if (PageMappedToDisk(page)) | 2467 | if (PageMappedToDisk(page)) |
