diff options
author | Chris Mason <chris.mason@oracle.com> | 2007-10-30 16:56:53 -0400 |
---|---|---|
committer | Chris Mason <chris.mason@oracle.com> | 2008-09-25 11:03:57 -0400 |
commit | 35ebb934bd7fcc7ca991b155b7980c3c4ff9f1a5 (patch) | |
tree | ce2980aac2b06a75b18b0c523aa0d859f09c8fad /fs/btrfs | |
parent | 2ff3e9b61d02b03e3157f7d43ba20ee1452814de (diff) |
Btrfs: Fix PAGE_CACHE_SHIFT shifts on 32 bit machines
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs')
-rw-r--r-- | fs/btrfs/disk-io.c | 2 | ||||
-rw-r--r-- | fs/btrfs/extent_map.c | 27 | ||||
-rw-r--r-- | fs/btrfs/file.c | 3 | ||||
-rw-r--r-- | fs/btrfs/inode.c | 14 | ||||
-rw-r--r-- | fs/btrfs/transaction.c | 2 |
5 files changed, 26 insertions, 22 deletions
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index 5a7e60d7f443..8935eec31ee2 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c | |||
@@ -159,7 +159,7 @@ static int csum_tree_block(struct btrfs_root *root, struct extent_buffer *buf, | |||
159 | int csum_dirty_buffer(struct btrfs_root *root, struct page *page) | 159 | int csum_dirty_buffer(struct btrfs_root *root, struct page *page) |
160 | { | 160 | { |
161 | struct extent_map_tree *tree; | 161 | struct extent_map_tree *tree; |
162 | u64 start = page->index << PAGE_CACHE_SHIFT; | 162 | u64 start = (u64)page->index << PAGE_CACHE_SHIFT; |
163 | u64 found_start; | 163 | u64 found_start; |
164 | int found_level; | 164 | int found_level; |
165 | unsigned long len; | 165 | unsigned long len; |
diff --git a/fs/btrfs/extent_map.c b/fs/btrfs/extent_map.c index e4ee980cc138..238cb1d81d56 100644 --- a/fs/btrfs/extent_map.c +++ b/fs/btrfs/extent_map.c | |||
@@ -1229,7 +1229,7 @@ EXPORT_SYMBOL(test_range_bit); | |||
1229 | static int check_page_uptodate(struct extent_map_tree *tree, | 1229 | static int check_page_uptodate(struct extent_map_tree *tree, |
1230 | struct page *page) | 1230 | struct page *page) |
1231 | { | 1231 | { |
1232 | u64 start = page->index << PAGE_CACHE_SHIFT; | 1232 | u64 start = (u64)page->index << PAGE_CACHE_SHIFT; |
1233 | u64 end = start + PAGE_CACHE_SIZE - 1; | 1233 | u64 end = start + PAGE_CACHE_SIZE - 1; |
1234 | if (test_range_bit(tree, start, end, EXTENT_UPTODATE, 1)) | 1234 | if (test_range_bit(tree, start, end, EXTENT_UPTODATE, 1)) |
1235 | SetPageUptodate(page); | 1235 | SetPageUptodate(page); |
@@ -1243,7 +1243,7 @@ static int check_page_uptodate(struct extent_map_tree *tree, | |||
1243 | static int check_page_locked(struct extent_map_tree *tree, | 1243 | static int check_page_locked(struct extent_map_tree *tree, |
1244 | struct page *page) | 1244 | struct page *page) |
1245 | { | 1245 | { |
1246 | u64 start = page->index << PAGE_CACHE_SHIFT; | 1246 | u64 start = (u64)page->index << PAGE_CACHE_SHIFT; |
1247 | u64 end = start + PAGE_CACHE_SIZE - 1; | 1247 | u64 end = start + PAGE_CACHE_SIZE - 1; |
1248 | if (!test_range_bit(tree, start, end, EXTENT_LOCKED, 0)) | 1248 | if (!test_range_bit(tree, start, end, EXTENT_LOCKED, 0)) |
1249 | unlock_page(page); | 1249 | unlock_page(page); |
@@ -1257,7 +1257,7 @@ static int check_page_locked(struct extent_map_tree *tree, | |||
1257 | static int check_page_writeback(struct extent_map_tree *tree, | 1257 | static int check_page_writeback(struct extent_map_tree *tree, |
1258 | struct page *page) | 1258 | struct page *page) |
1259 | { | 1259 | { |
1260 | u64 start = page->index << PAGE_CACHE_SHIFT; | 1260 | u64 start = (u64)page->index << PAGE_CACHE_SHIFT; |
1261 | u64 end = start + PAGE_CACHE_SIZE - 1; | 1261 | u64 end = start + PAGE_CACHE_SIZE - 1; |
1262 | if (!test_range_bit(tree, start, end, EXTENT_WRITEBACK, 0)) | 1262 | if (!test_range_bit(tree, start, end, EXTENT_WRITEBACK, 0)) |
1263 | end_page_writeback(page); | 1263 | end_page_writeback(page); |
@@ -1296,7 +1296,8 @@ static int end_bio_extent_writepage(struct bio *bio, | |||
1296 | 1296 | ||
1297 | do { | 1297 | do { |
1298 | struct page *page = bvec->bv_page; | 1298 | struct page *page = bvec->bv_page; |
1299 | start = (page->index << PAGE_CACHE_SHIFT) + bvec->bv_offset; | 1299 | start = ((u64)page->index << PAGE_CACHE_SHIFT) + |
1300 | bvec->bv_offset; | ||
1300 | end = start + bvec->bv_len - 1; | 1301 | end = start + bvec->bv_len - 1; |
1301 | 1302 | ||
1302 | if (bvec->bv_offset == 0 && bvec->bv_len == PAGE_CACHE_SIZE) | 1303 | if (bvec->bv_offset == 0 && bvec->bv_len == PAGE_CACHE_SIZE) |
@@ -1361,7 +1362,8 @@ static int end_bio_extent_readpage(struct bio *bio, | |||
1361 | 1362 | ||
1362 | do { | 1363 | do { |
1363 | struct page *page = bvec->bv_page; | 1364 | struct page *page = bvec->bv_page; |
1364 | start = (page->index << PAGE_CACHE_SHIFT) + bvec->bv_offset; | 1365 | start = ((u64)page->index << PAGE_CACHE_SHIFT) + |
1366 | bvec->bv_offset; | ||
1365 | end = start + bvec->bv_len - 1; | 1367 | end = start + bvec->bv_len - 1; |
1366 | 1368 | ||
1367 | if (bvec->bv_offset == 0 && bvec->bv_len == PAGE_CACHE_SIZE) | 1369 | if (bvec->bv_offset == 0 && bvec->bv_len == PAGE_CACHE_SIZE) |
@@ -1427,7 +1429,8 @@ static int end_bio_extent_preparewrite(struct bio *bio, | |||
1427 | 1429 | ||
1428 | do { | 1430 | do { |
1429 | struct page *page = bvec->bv_page; | 1431 | struct page *page = bvec->bv_page; |
1430 | start = (page->index << PAGE_CACHE_SHIFT) + bvec->bv_offset; | 1432 | start = ((u64)page->index << PAGE_CACHE_SHIFT) + |
1433 | bvec->bv_offset; | ||
1431 | end = start + bvec->bv_len - 1; | 1434 | end = start + bvec->bv_len - 1; |
1432 | 1435 | ||
1433 | if (--bvec >= bio->bi_io_vec) | 1436 | if (--bvec >= bio->bi_io_vec) |
@@ -1503,7 +1506,7 @@ int extent_read_full_page(struct extent_map_tree *tree, struct page *page, | |||
1503 | get_extent_t *get_extent) | 1506 | get_extent_t *get_extent) |
1504 | { | 1507 | { |
1505 | struct inode *inode = page->mapping->host; | 1508 | struct inode *inode = page->mapping->host; |
1506 | u64 start = page->index << PAGE_CACHE_SHIFT; | 1509 | u64 start = (u64)page->index << PAGE_CACHE_SHIFT; |
1507 | u64 page_end = start + PAGE_CACHE_SIZE - 1; | 1510 | u64 page_end = start + PAGE_CACHE_SIZE - 1; |
1508 | u64 end; | 1511 | u64 end; |
1509 | u64 cur = start; | 1512 | u64 cur = start; |
@@ -1608,7 +1611,7 @@ int extent_write_full_page(struct extent_map_tree *tree, struct page *page, | |||
1608 | struct writeback_control *wbc) | 1611 | struct writeback_control *wbc) |
1609 | { | 1612 | { |
1610 | struct inode *inode = page->mapping->host; | 1613 | struct inode *inode = page->mapping->host; |
1611 | u64 start = page->index << PAGE_CACHE_SHIFT; | 1614 | u64 start = (u64)page->index << PAGE_CACHE_SHIFT; |
1612 | u64 page_end = start + PAGE_CACHE_SIZE - 1; | 1615 | u64 page_end = start + PAGE_CACHE_SIZE - 1; |
1613 | u64 end; | 1616 | u64 end; |
1614 | u64 cur = start; | 1617 | u64 cur = start; |
@@ -1750,7 +1753,7 @@ EXPORT_SYMBOL(extent_write_full_page); | |||
1750 | int extent_invalidatepage(struct extent_map_tree *tree, | 1753 | int extent_invalidatepage(struct extent_map_tree *tree, |
1751 | struct page *page, unsigned long offset) | 1754 | struct page *page, unsigned long offset) |
1752 | { | 1755 | { |
1753 | u64 start = (page->index << PAGE_CACHE_SHIFT); | 1756 | u64 start = ((u64)page->index << PAGE_CACHE_SHIFT); |
1754 | u64 end = start + PAGE_CACHE_SIZE - 1; | 1757 | u64 end = start + PAGE_CACHE_SIZE - 1; |
1755 | size_t blocksize = page->mapping->host->i_sb->s_blocksize; | 1758 | size_t blocksize = page->mapping->host->i_sb->s_blocksize; |
1756 | 1759 | ||
@@ -1792,7 +1795,7 @@ int extent_prepare_write(struct extent_map_tree *tree, | |||
1792 | struct inode *inode, struct page *page, | 1795 | struct inode *inode, struct page *page, |
1793 | unsigned from, unsigned to, get_extent_t *get_extent) | 1796 | unsigned from, unsigned to, get_extent_t *get_extent) |
1794 | { | 1797 | { |
1795 | u64 page_start = page->index << PAGE_CACHE_SHIFT; | 1798 | u64 page_start = (u64)page->index << PAGE_CACHE_SHIFT; |
1796 | u64 page_end = page_start + PAGE_CACHE_SIZE - 1; | 1799 | u64 page_end = page_start + PAGE_CACHE_SIZE - 1; |
1797 | u64 block_start; | 1800 | u64 block_start; |
1798 | u64 orig_block_start; | 1801 | u64 orig_block_start; |
@@ -1890,7 +1893,7 @@ EXPORT_SYMBOL(extent_prepare_write); | |||
1890 | int try_release_extent_mapping(struct extent_map_tree *tree, struct page *page) | 1893 | int try_release_extent_mapping(struct extent_map_tree *tree, struct page *page) |
1891 | { | 1894 | { |
1892 | struct extent_map *em; | 1895 | struct extent_map *em; |
1893 | u64 start = page->index << PAGE_CACHE_SHIFT; | 1896 | u64 start = (u64)page->index << PAGE_CACHE_SHIFT; |
1894 | u64 end = start + PAGE_CACHE_SIZE - 1; | 1897 | u64 end = start + PAGE_CACHE_SIZE - 1; |
1895 | u64 orig_start = start; | 1898 | u64 orig_start = start; |
1896 | int ret = 1; | 1899 | int ret = 1; |
@@ -2202,7 +2205,7 @@ int clear_extent_buffer_dirty(struct extent_map_tree *tree, | |||
2202 | if ((i == 0 && (eb->start & (PAGE_CACHE_SIZE - 1))) || | 2205 | if ((i == 0 && (eb->start & (PAGE_CACHE_SIZE - 1))) || |
2203 | ((i == num_pages - 1) && | 2206 | ((i == num_pages - 1) && |
2204 | ((eb->start + eb->len) & (PAGE_CACHE_SIZE - 1)))) { | 2207 | ((eb->start + eb->len) & (PAGE_CACHE_SIZE - 1)))) { |
2205 | start = page->index << PAGE_CACHE_SHIFT; | 2208 | start = (u64)page->index << PAGE_CACHE_SHIFT; |
2206 | end = start + PAGE_CACHE_SIZE - 1; | 2209 | end = start + PAGE_CACHE_SIZE - 1; |
2207 | if (test_range_bit(tree, start, end, | 2210 | if (test_range_bit(tree, start, end, |
2208 | EXTENT_DIRTY, 0)) { | 2211 | EXTENT_DIRTY, 0)) { |
diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c index 843e920388ed..abdd9caad94e 100644 --- a/fs/btrfs/file.c +++ b/fs/btrfs/file.c | |||
@@ -301,7 +301,8 @@ static int dirty_and_release_pages(struct btrfs_trans_handle *trans, | |||
301 | SetPageUptodate(p); | 301 | SetPageUptodate(p); |
302 | set_page_dirty(p); | 302 | set_page_dirty(p); |
303 | } | 303 | } |
304 | last_end = pages[num_pages -1]->index << PAGE_CACHE_SHIFT; | 304 | last_end = (u64)(pages[num_pages -1]->index) << |
305 | PAGE_CACHE_SHIFT; | ||
305 | last_end += PAGE_CACHE_SIZE - 1; | 306 | last_end += PAGE_CACHE_SIZE - 1; |
306 | set_extent_delalloc(em_tree, start_pos, end_of_last_block, | 307 | set_extent_delalloc(em_tree, start_pos, end_of_last_block, |
307 | GFP_NOFS); | 308 | GFP_NOFS); |
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 0ba1cdbdf112..5d10b64e42df 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c | |||
@@ -111,7 +111,7 @@ int btrfs_writepage_io_hook(struct page *page, u64 start, u64 end) | |||
111 | struct btrfs_trans_handle *trans; | 111 | struct btrfs_trans_handle *trans; |
112 | char *kaddr; | 112 | char *kaddr; |
113 | int ret; | 113 | int ret; |
114 | u64 page_start = page->index << PAGE_CACHE_SHIFT; | 114 | u64 page_start = (u64)page->index << PAGE_CACHE_SHIFT; |
115 | size_t offset = start - page_start; | 115 | size_t offset = start - page_start; |
116 | 116 | ||
117 | mutex_lock(&root->fs_info->fs_mutex); | 117 | mutex_lock(&root->fs_info->fs_mutex); |
@@ -160,7 +160,7 @@ out: | |||
160 | 160 | ||
161 | int btrfs_readpage_end_io_hook(struct page *page, u64 start, u64 end) | 161 | int btrfs_readpage_end_io_hook(struct page *page, u64 start, u64 end) |
162 | { | 162 | { |
163 | size_t offset = start - (page->index << PAGE_CACHE_SHIFT); | 163 | size_t offset = start - ((u64)page->index << PAGE_CACHE_SHIFT); |
164 | struct inode *inode = page->mapping->host; | 164 | struct inode *inode = page->mapping->host; |
165 | struct extent_map_tree *em_tree = &BTRFS_I(inode)->extent_tree; | 165 | struct extent_map_tree *em_tree = &BTRFS_I(inode)->extent_tree; |
166 | char *kaddr; | 166 | char *kaddr; |
@@ -688,7 +688,7 @@ static int btrfs_cow_one_page(struct inode *inode, struct page *page, | |||
688 | char *kaddr; | 688 | char *kaddr; |
689 | int ret = 0; | 689 | int ret = 0; |
690 | struct extent_map_tree *em_tree = &BTRFS_I(inode)->extent_tree; | 690 | struct extent_map_tree *em_tree = &BTRFS_I(inode)->extent_tree; |
691 | u64 page_start = page->index << PAGE_CACHE_SHIFT; | 691 | u64 page_start = (u64)page->index << PAGE_CACHE_SHIFT; |
692 | u64 page_end = page_start + PAGE_CACHE_SIZE - 1; | 692 | u64 page_end = page_start + PAGE_CACHE_SIZE - 1; |
693 | 693 | ||
694 | set_page_extent_mapped(page); | 694 | set_page_extent_mapped(page); |
@@ -739,7 +739,7 @@ static int btrfs_truncate_page(struct address_space *mapping, loff_t from) | |||
739 | goto out; | 739 | goto out; |
740 | } | 740 | } |
741 | } | 741 | } |
742 | page_start = page->index << PAGE_CACHE_SHIFT; | 742 | page_start = (u64)page->index << PAGE_CACHE_SHIFT; |
743 | 743 | ||
744 | ret = btrfs_cow_one_page(inode, page, offset); | 744 | ret = btrfs_cow_one_page(inode, page, offset); |
745 | 745 | ||
@@ -1618,7 +1618,7 @@ again: | |||
1618 | goto out; | 1618 | goto out; |
1619 | } | 1619 | } |
1620 | 1620 | ||
1621 | extent_offset = (page->index << PAGE_CACHE_SHIFT) - | 1621 | extent_offset = ((u64)page->index << PAGE_CACHE_SHIFT) - |
1622 | extent_start + page_offset; | 1622 | extent_start + page_offset; |
1623 | copy_size = min_t(u64, PAGE_CACHE_SIZE - page_offset, | 1623 | copy_size = min_t(u64, PAGE_CACHE_SIZE - page_offset, |
1624 | size - extent_offset); | 1624 | size - extent_offset); |
@@ -1769,7 +1769,7 @@ int btrfs_page_mkwrite(struct vm_area_struct *vma, struct page *page) | |||
1769 | lock_page(page); | 1769 | lock_page(page); |
1770 | wait_on_page_writeback(page); | 1770 | wait_on_page_writeback(page); |
1771 | size = i_size_read(inode); | 1771 | size = i_size_read(inode); |
1772 | page_start = page->index << PAGE_CACHE_SHIFT; | 1772 | page_start = (u64)page->index << PAGE_CACHE_SHIFT; |
1773 | 1773 | ||
1774 | if ((page->mapping != inode->i_mapping) || | 1774 | if ((page->mapping != inode->i_mapping) || |
1775 | (page_start > size)) { | 1775 | (page_start > size)) { |
@@ -2065,7 +2065,7 @@ int btrfs_defrag_file(struct file *file) { | |||
2065 | goto out_unlock; | 2065 | goto out_unlock; |
2066 | } | 2066 | } |
2067 | } | 2067 | } |
2068 | page_start = page->index << PAGE_CACHE_SHIFT; | 2068 | page_start = (u64)page->index << PAGE_CACHE_SHIFT; |
2069 | page_end = page_start + PAGE_CACHE_SIZE - 1; | 2069 | page_end = page_start + PAGE_CACHE_SIZE - 1; |
2070 | 2070 | ||
2071 | lock_extent(em_tree, page_start, page_end, GFP_NOFS); | 2071 | lock_extent(em_tree, page_start, page_end, GFP_NOFS); |
diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c index bdfe05cf26c6..4af1c0dab7f8 100644 --- a/fs/btrfs/transaction.c +++ b/fs/btrfs/transaction.c | |||
@@ -169,7 +169,7 @@ int btrfs_write_and_wait_transaction(struct btrfs_trans_handle *trans, | |||
169 | clear_extent_dirty(dirty_pages, start, end, GFP_NOFS); | 169 | clear_extent_dirty(dirty_pages, start, end, GFP_NOFS); |
170 | while(start <= end) { | 170 | while(start <= end) { |
171 | index = start >> PAGE_CACHE_SHIFT; | 171 | index = start >> PAGE_CACHE_SHIFT; |
172 | start = (index + 1) << PAGE_CACHE_SHIFT; | 172 | start = (u64)(index + 1) << PAGE_CACHE_SHIFT; |
173 | page = find_lock_page(btree_inode->i_mapping, index); | 173 | page = find_lock_page(btree_inode->i_mapping, index); |
174 | if (!page) | 174 | if (!page) |
175 | continue; | 175 | continue; |