diff options
-rw-r--r-- | fs/buffer.c | 9 | ||||
-rw-r--r-- | fs/mpage.c | 2 | ||||
-rw-r--r-- | include/linux/buffer_head.h | 1 |
3 files changed, 11 insertions, 1 deletions
diff --git a/fs/buffer.c b/fs/buffer.c index e7a1461f4387..a507b58550f1 100644 --- a/fs/buffer.c +++ b/fs/buffer.c | |||
@@ -1738,6 +1738,7 @@ static int __block_write_full_page(struct inode *inode, struct page *page, | |||
1738 | sector_t block; | 1738 | sector_t block; |
1739 | sector_t last_block; | 1739 | sector_t last_block; |
1740 | struct buffer_head *bh, *head; | 1740 | struct buffer_head *bh, *head; |
1741 | const unsigned blocksize = 1 << inode->i_blkbits; | ||
1741 | int nr_underway = 0; | 1742 | int nr_underway = 0; |
1742 | 1743 | ||
1743 | BUG_ON(!PageLocked(page)); | 1744 | BUG_ON(!PageLocked(page)); |
@@ -1745,7 +1746,7 @@ static int __block_write_full_page(struct inode *inode, struct page *page, | |||
1745 | last_block = (i_size_read(inode) - 1) >> inode->i_blkbits; | 1746 | last_block = (i_size_read(inode) - 1) >> inode->i_blkbits; |
1746 | 1747 | ||
1747 | if (!page_has_buffers(page)) { | 1748 | if (!page_has_buffers(page)) { |
1748 | create_empty_buffers(page, 1 << inode->i_blkbits, | 1749 | create_empty_buffers(page, blocksize, |
1749 | (1 << BH_Dirty)|(1 << BH_Uptodate)); | 1750 | (1 << BH_Dirty)|(1 << BH_Uptodate)); |
1750 | } | 1751 | } |
1751 | 1752 | ||
@@ -1780,6 +1781,7 @@ static int __block_write_full_page(struct inode *inode, struct page *page, | |||
1780 | clear_buffer_dirty(bh); | 1781 | clear_buffer_dirty(bh); |
1781 | set_buffer_uptodate(bh); | 1782 | set_buffer_uptodate(bh); |
1782 | } else if (!buffer_mapped(bh) && buffer_dirty(bh)) { | 1783 | } else if (!buffer_mapped(bh) && buffer_dirty(bh)) { |
1784 | WARN_ON(bh->b_size != blocksize); | ||
1783 | err = get_block(inode, block, bh, 1); | 1785 | err = get_block(inode, block, bh, 1); |
1784 | if (err) | 1786 | if (err) |
1785 | goto recover; | 1787 | goto recover; |
@@ -1933,6 +1935,7 @@ static int __block_prepare_write(struct inode *inode, struct page *page, | |||
1933 | if (buffer_new(bh)) | 1935 | if (buffer_new(bh)) |
1934 | clear_buffer_new(bh); | 1936 | clear_buffer_new(bh); |
1935 | if (!buffer_mapped(bh)) { | 1937 | if (!buffer_mapped(bh)) { |
1938 | WARN_ON(bh->b_size != blocksize); | ||
1936 | err = get_block(inode, block, bh, 1); | 1939 | err = get_block(inode, block, bh, 1); |
1937 | if (err) | 1940 | if (err) |
1938 | break; | 1941 | break; |
@@ -2088,6 +2091,7 @@ int block_read_full_page(struct page *page, get_block_t *get_block) | |||
2088 | 2091 | ||
2089 | fully_mapped = 0; | 2092 | fully_mapped = 0; |
2090 | if (iblock < lblock) { | 2093 | if (iblock < lblock) { |
2094 | WARN_ON(bh->b_size != blocksize); | ||
2091 | err = get_block(inode, iblock, bh, 0); | 2095 | err = get_block(inode, iblock, bh, 0); |
2092 | if (err) | 2096 | if (err) |
2093 | SetPageError(page); | 2097 | SetPageError(page); |
@@ -2409,6 +2413,7 @@ int nobh_prepare_write(struct page *page, unsigned from, unsigned to, | |||
2409 | create = 1; | 2413 | create = 1; |
2410 | if (block_start >= to) | 2414 | if (block_start >= to) |
2411 | create = 0; | 2415 | create = 0; |
2416 | map_bh.b_size = blocksize; | ||
2412 | ret = get_block(inode, block_in_file + block_in_page, | 2417 | ret = get_block(inode, block_in_file + block_in_page, |
2413 | &map_bh, create); | 2418 | &map_bh, create); |
2414 | if (ret) | 2419 | if (ret) |
@@ -2669,6 +2674,7 @@ int block_truncate_page(struct address_space *mapping, | |||
2669 | 2674 | ||
2670 | err = 0; | 2675 | err = 0; |
2671 | if (!buffer_mapped(bh)) { | 2676 | if (!buffer_mapped(bh)) { |
2677 | WARN_ON(bh->b_size != blocksize); | ||
2672 | err = get_block(inode, iblock, bh, 0); | 2678 | err = get_block(inode, iblock, bh, 0); |
2673 | if (err) | 2679 | if (err) |
2674 | goto unlock; | 2680 | goto unlock; |
@@ -2755,6 +2761,7 @@ sector_t generic_block_bmap(struct address_space *mapping, sector_t block, | |||
2755 | struct inode *inode = mapping->host; | 2761 | struct inode *inode = mapping->host; |
2756 | tmp.b_state = 0; | 2762 | tmp.b_state = 0; |
2757 | tmp.b_blocknr = 0; | 2763 | tmp.b_blocknr = 0; |
2764 | tmp.b_size = 1 << inode->i_blkbits; | ||
2758 | get_block(inode, block, &tmp, 0); | 2765 | get_block(inode, block, &tmp, 0); |
2759 | return tmp.b_blocknr; | 2766 | return tmp.b_blocknr; |
2760 | } | 2767 | } |
diff --git a/fs/mpage.c b/fs/mpage.c index e431cb3878d6..7903b740cc11 100644 --- a/fs/mpage.c +++ b/fs/mpage.c | |||
@@ -192,6 +192,7 @@ do_mpage_readpage(struct bio *bio, struct page *page, unsigned nr_pages, | |||
192 | page_block++, block_in_file++) { | 192 | page_block++, block_in_file++) { |
193 | bh.b_state = 0; | 193 | bh.b_state = 0; |
194 | if (block_in_file < last_block) { | 194 | if (block_in_file < last_block) { |
195 | bh.b_size = blocksize; | ||
195 | if (get_block(inode, block_in_file, &bh, 0)) | 196 | if (get_block(inode, block_in_file, &bh, 0)) |
196 | goto confused; | 197 | goto confused; |
197 | } | 198 | } |
@@ -472,6 +473,7 @@ __mpage_writepage(struct bio *bio, struct page *page, get_block_t get_block, | |||
472 | for (page_block = 0; page_block < blocks_per_page; ) { | 473 | for (page_block = 0; page_block < blocks_per_page; ) { |
473 | 474 | ||
474 | map_bh.b_state = 0; | 475 | map_bh.b_state = 0; |
476 | map_bh.b_size = 1 << blkbits; | ||
475 | if (get_block(inode, block_in_file, &map_bh, 1)) | 477 | if (get_block(inode, block_in_file, &map_bh, 1)) |
476 | goto confused; | 478 | goto confused; |
477 | if (buffer_new(&map_bh)) | 479 | if (buffer_new(&map_bh)) |
diff --git a/include/linux/buffer_head.h b/include/linux/buffer_head.h index 464f068f8b16..fb7e9b7ccbe3 100644 --- a/include/linux/buffer_head.h +++ b/include/linux/buffer_head.h | |||
@@ -280,6 +280,7 @@ map_bh(struct buffer_head *bh, struct super_block *sb, sector_t block) | |||
280 | set_buffer_mapped(bh); | 280 | set_buffer_mapped(bh); |
281 | bh->b_bdev = sb->s_bdev; | 281 | bh->b_bdev = sb->s_bdev; |
282 | bh->b_blocknr = block; | 282 | bh->b_blocknr = block; |
283 | bh->b_size = sb->s_blocksize; | ||
283 | } | 284 | } |
284 | 285 | ||
285 | /* | 286 | /* |