diff options
author | Jens Axboe <jaxboe@fusionio.com> | 2010-11-16 04:09:42 -0500 |
---|---|---|
committer | Jens Axboe <jaxboe@fusionio.com> | 2010-11-16 04:09:42 -0500 |
commit | a02056349cdea2252cd2b21643ebf025e83a29f2 (patch) | |
tree | b7c889d6cbe8e7188d07d99a5c9da858c53a5b6c /fs/buffer.c | |
parent | 34db1d595ef6f183fbc1e42cda45a3dfa0035258 (diff) | |
parent | e53beacd23d9cb47590da6a7a7f6d417b941a994 (diff) |
Merge branch 'v2.6.37-rc2' into for-2.6.38/core
Diffstat (limited to 'fs/buffer.c')
-rw-r--r-- | fs/buffer.c | 36 |
1 files changed, 11 insertions, 25 deletions
diff --git a/fs/buffer.c b/fs/buffer.c index 3e7dca279d1c..5930e382959b 100644 --- a/fs/buffer.c +++ b/fs/buffer.c | |||
@@ -156,7 +156,7 @@ void end_buffer_write_sync(struct buffer_head *bh, int uptodate) | |||
156 | if (uptodate) { | 156 | if (uptodate) { |
157 | set_buffer_uptodate(bh); | 157 | set_buffer_uptodate(bh); |
158 | } else { | 158 | } else { |
159 | if (!buffer_eopnotsupp(bh) && !quiet_error(bh)) { | 159 | if (!quiet_error(bh)) { |
160 | buffer_io_error(bh); | 160 | buffer_io_error(bh); |
161 | printk(KERN_WARNING "lost page write due to " | 161 | printk(KERN_WARNING "lost page write due to " |
162 | "I/O error on %s\n", | 162 | "I/O error on %s\n", |
@@ -905,7 +905,6 @@ try_again: | |||
905 | 905 | ||
906 | bh->b_state = 0; | 906 | bh->b_state = 0; |
907 | atomic_set(&bh->b_count, 0); | 907 | atomic_set(&bh->b_count, 0); |
908 | bh->b_private = NULL; | ||
909 | bh->b_size = size; | 908 | bh->b_size = size; |
910 | 909 | ||
911 | /* Link the buffer to its page */ | 910 | /* Link the buffer to its page */ |
@@ -1706,7 +1705,7 @@ static int __block_write_full_page(struct inode *inode, struct page *page, | |||
1706 | * and kswapd activity, but those code paths have their own | 1705 | * and kswapd activity, but those code paths have their own |
1707 | * higher-level throttling. | 1706 | * higher-level throttling. |
1708 | */ | 1707 | */ |
1709 | if (wbc->sync_mode != WB_SYNC_NONE || !wbc->nonblocking) { | 1708 | if (wbc->sync_mode != WB_SYNC_NONE) { |
1710 | lock_buffer(bh); | 1709 | lock_buffer(bh); |
1711 | } else if (!trylock_buffer(bh)) { | 1710 | } else if (!trylock_buffer(bh)) { |
1712 | redirty_page_for_writepage(wbc, page); | 1711 | redirty_page_for_writepage(wbc, page); |
@@ -1834,9 +1833,11 @@ void page_zero_new_buffers(struct page *page, unsigned from, unsigned to) | |||
1834 | } | 1833 | } |
1835 | EXPORT_SYMBOL(page_zero_new_buffers); | 1834 | EXPORT_SYMBOL(page_zero_new_buffers); |
1836 | 1835 | ||
1837 | int block_prepare_write(struct page *page, unsigned from, unsigned to, | 1836 | int __block_write_begin(struct page *page, loff_t pos, unsigned len, |
1838 | get_block_t *get_block) | 1837 | get_block_t *get_block) |
1839 | { | 1838 | { |
1839 | unsigned from = pos & (PAGE_CACHE_SIZE - 1); | ||
1840 | unsigned to = from + len; | ||
1840 | struct inode *inode = page->mapping->host; | 1841 | struct inode *inode = page->mapping->host; |
1841 | unsigned block_start, block_end; | 1842 | unsigned block_start, block_end; |
1842 | sector_t block; | 1843 | sector_t block; |
@@ -1916,7 +1917,7 @@ int block_prepare_write(struct page *page, unsigned from, unsigned to, | |||
1916 | } | 1917 | } |
1917 | return err; | 1918 | return err; |
1918 | } | 1919 | } |
1919 | EXPORT_SYMBOL(block_prepare_write); | 1920 | EXPORT_SYMBOL(__block_write_begin); |
1920 | 1921 | ||
1921 | static int __block_commit_write(struct inode *inode, struct page *page, | 1922 | static int __block_commit_write(struct inode *inode, struct page *page, |
1922 | unsigned from, unsigned to) | 1923 | unsigned from, unsigned to) |
@@ -1953,15 +1954,6 @@ static int __block_commit_write(struct inode *inode, struct page *page, | |||
1953 | return 0; | 1954 | return 0; |
1954 | } | 1955 | } |
1955 | 1956 | ||
1956 | int __block_write_begin(struct page *page, loff_t pos, unsigned len, | ||
1957 | get_block_t *get_block) | ||
1958 | { | ||
1959 | unsigned start = pos & (PAGE_CACHE_SIZE - 1); | ||
1960 | |||
1961 | return block_prepare_write(page, start, start + len, get_block); | ||
1962 | } | ||
1963 | EXPORT_SYMBOL(__block_write_begin); | ||
1964 | |||
1965 | /* | 1957 | /* |
1966 | * 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 |
1967 | * bringing partial write blocks uptodate first. | 1959 | * bringing partial write blocks uptodate first. |
@@ -2379,7 +2371,7 @@ block_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf, | |||
2379 | else | 2371 | else |
2380 | end = PAGE_CACHE_SIZE; | 2372 | end = PAGE_CACHE_SIZE; |
2381 | 2373 | ||
2382 | ret = block_prepare_write(page, 0, end, get_block); | 2374 | ret = __block_write_begin(page, 0, end, get_block); |
2383 | if (!ret) | 2375 | if (!ret) |
2384 | ret = block_commit_write(page, 0, end); | 2376 | ret = block_commit_write(page, 0, end); |
2385 | 2377 | ||
@@ -2466,11 +2458,10 @@ int nobh_write_begin(struct address_space *mapping, | |||
2466 | *fsdata = NULL; | 2458 | *fsdata = NULL; |
2467 | 2459 | ||
2468 | if (page_has_buffers(page)) { | 2460 | if (page_has_buffers(page)) { |
2469 | unlock_page(page); | 2461 | ret = __block_write_begin(page, pos, len, get_block); |
2470 | page_cache_release(page); | 2462 | if (unlikely(ret)) |
2471 | *pagep = NULL; | 2463 | goto out_release; |
2472 | return block_write_begin(mapping, pos, len, flags, pagep, | 2464 | return ret; |
2473 | get_block); | ||
2474 | } | 2465 | } |
2475 | 2466 | ||
2476 | if (PageMappedToDisk(page)) | 2467 | if (PageMappedToDisk(page)) |
@@ -2891,7 +2882,6 @@ static void end_bio_bh_io_sync(struct bio *bio, int err) | |||
2891 | 2882 | ||
2892 | if (err == -EOPNOTSUPP) { | 2883 | if (err == -EOPNOTSUPP) { |
2893 | set_bit(BIO_EOPNOTSUPP, &bio->bi_flags); | 2884 | set_bit(BIO_EOPNOTSUPP, &bio->bi_flags); |
2894 | set_bit(BH_Eopnotsupp, &bh->b_state); | ||
2895 | } | 2885 | } |
2896 | 2886 | ||
2897 | if (unlikely (test_bit(BIO_QUIET,&bio->bi_flags))) | 2887 | if (unlikely (test_bit(BIO_QUIET,&bio->bi_flags))) |
@@ -3031,10 +3021,6 @@ int __sync_dirty_buffer(struct buffer_head *bh, int rw) | |||
3031 | bh->b_end_io = end_buffer_write_sync; | 3021 | bh->b_end_io = end_buffer_write_sync; |
3032 | ret = submit_bh(rw, bh); | 3022 | ret = submit_bh(rw, bh); |
3033 | wait_on_buffer(bh); | 3023 | wait_on_buffer(bh); |
3034 | if (buffer_eopnotsupp(bh)) { | ||
3035 | clear_buffer_eopnotsupp(bh); | ||
3036 | ret = -EOPNOTSUPP; | ||
3037 | } | ||
3038 | if (!ret && !buffer_uptodate(bh)) | 3024 | if (!ret && !buffer_uptodate(bh)) |
3039 | ret = -EIO; | 3025 | ret = -EIO; |
3040 | } else { | 3026 | } else { |