aboutsummaryrefslogtreecommitdiffstats
path: root/fs/buffer.c
diff options
context:
space:
mode:
authorBadari Pulavarty <pbadari@us.ibm.com>2006-03-26 04:38:00 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-03-26 11:57:01 -0500
commitb0cf2321c6599138f860517745503691556d8453 (patch)
tree39ecfea09c13ce09172ab3ec5a5b6d2fef657cac /fs/buffer.c
parent205f87f6b342444f722e4559d33318686f7df2ca (diff)
[PATCH] pass b_size to ->get_block()
Pass amount of disk needs to be mapped to get_block(). This way one can modify the fs ->get_block() functions to map multiple blocks at the same time. [akpm@osdl.org: performance tweak] [akpm@osdl.org: remove unneeded assignments] Signed-off-by: Badari Pulavarty <pbadari@us.ibm.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs/buffer.c')
-rw-r--r--fs/buffer.c9
1 files changed, 8 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}