diff options
author | Miao Xie <miaox@cn.fujitsu.com> | 2012-12-21 04:17:45 -0500 |
---|---|---|
committer | Josef Bacik <jbacik@fusionio.com> | 2013-02-20 09:36:43 -0500 |
commit | 4eee4fa4f8ab8c2b2623c22be4c3cb91d525aa57 (patch) | |
tree | 683eda1d306b23d1a82a918d869850256237c432 /fs/btrfs/extent_io.c | |
parent | da633a42170165cbf20a2d3886c7480ccc832ec3 (diff) |
Btrfs: use wrapper page_offset
Use wrapper page_offset to get byte-offset into filesystem object for page.
Signed-off-by: Liu Bo <liubo2009@cn.fujitsu.com>
Signed-off-by: Miao Xie <miaox@cn.fujitsu.com>
Signed-off-by: Josef Bacik <jbacik@fusionio.com>
Diffstat (limited to 'fs/btrfs/extent_io.c')
-rw-r--r-- | fs/btrfs/extent_io.c | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c index 1b319df29eee..bda36fef301e 100644 --- a/fs/btrfs/extent_io.c +++ b/fs/btrfs/extent_io.c | |||
@@ -1834,7 +1834,7 @@ int test_range_bit(struct extent_io_tree *tree, u64 start, u64 end, | |||
1834 | */ | 1834 | */ |
1835 | static void check_page_uptodate(struct extent_io_tree *tree, struct page *page) | 1835 | static void check_page_uptodate(struct extent_io_tree *tree, struct page *page) |
1836 | { | 1836 | { |
1837 | u64 start = (u64)page->index << PAGE_CACHE_SHIFT; | 1837 | u64 start = page_offset(page); |
1838 | u64 end = start + PAGE_CACHE_SIZE - 1; | 1838 | u64 end = start + PAGE_CACHE_SIZE - 1; |
1839 | if (test_range_bit(tree, start, end, EXTENT_UPTODATE, 1, NULL)) | 1839 | if (test_range_bit(tree, start, end, EXTENT_UPTODATE, 1, NULL)) |
1840 | SetPageUptodate(page); | 1840 | SetPageUptodate(page); |
@@ -1846,7 +1846,7 @@ static void check_page_uptodate(struct extent_io_tree *tree, struct page *page) | |||
1846 | */ | 1846 | */ |
1847 | static void check_page_locked(struct extent_io_tree *tree, struct page *page) | 1847 | static void check_page_locked(struct extent_io_tree *tree, struct page *page) |
1848 | { | 1848 | { |
1849 | u64 start = (u64)page->index << PAGE_CACHE_SHIFT; | 1849 | u64 start = page_offset(page); |
1850 | u64 end = start + PAGE_CACHE_SIZE - 1; | 1850 | u64 end = start + PAGE_CACHE_SIZE - 1; |
1851 | if (!test_range_bit(tree, start, end, EXTENT_LOCKED, 0, NULL)) | 1851 | if (!test_range_bit(tree, start, end, EXTENT_LOCKED, 0, NULL)) |
1852 | unlock_page(page); | 1852 | unlock_page(page); |
@@ -1960,7 +1960,7 @@ int repair_io_failure(struct btrfs_fs_info *fs_info, u64 start, | |||
1960 | return -EIO; | 1960 | return -EIO; |
1961 | } | 1961 | } |
1962 | bio->bi_bdev = dev->bdev; | 1962 | bio->bi_bdev = dev->bdev; |
1963 | bio_add_page(bio, page, length, start-page_offset(page)); | 1963 | bio_add_page(bio, page, length, start - page_offset(page)); |
1964 | btrfsic_submit_bio(WRITE_SYNC, bio); | 1964 | btrfsic_submit_bio(WRITE_SYNC, bio); |
1965 | wait_for_completion(&compl); | 1965 | wait_for_completion(&compl); |
1966 | 1966 | ||
@@ -2293,8 +2293,7 @@ static void end_bio_extent_writepage(struct bio *bio, int err) | |||
2293 | struct page *page = bvec->bv_page; | 2293 | struct page *page = bvec->bv_page; |
2294 | tree = &BTRFS_I(page->mapping->host)->io_tree; | 2294 | tree = &BTRFS_I(page->mapping->host)->io_tree; |
2295 | 2295 | ||
2296 | start = ((u64)page->index << PAGE_CACHE_SHIFT) + | 2296 | start = page_offset(page) + bvec->bv_offset; |
2297 | bvec->bv_offset; | ||
2298 | end = start + bvec->bv_len - 1; | 2297 | end = start + bvec->bv_len - 1; |
2299 | 2298 | ||
2300 | if (bvec->bv_offset == 0 && bvec->bv_len == PAGE_CACHE_SIZE) | 2299 | if (bvec->bv_offset == 0 && bvec->bv_len == PAGE_CACHE_SIZE) |
@@ -2353,8 +2352,7 @@ static void end_bio_extent_readpage(struct bio *bio, int err) | |||
2353 | (long int)bio->bi_bdev); | 2352 | (long int)bio->bi_bdev); |
2354 | tree = &BTRFS_I(page->mapping->host)->io_tree; | 2353 | tree = &BTRFS_I(page->mapping->host)->io_tree; |
2355 | 2354 | ||
2356 | start = ((u64)page->index << PAGE_CACHE_SHIFT) + | 2355 | start = page_offset(page) + bvec->bv_offset; |
2357 | bvec->bv_offset; | ||
2358 | end = start + bvec->bv_len - 1; | 2356 | end = start + bvec->bv_len - 1; |
2359 | 2357 | ||
2360 | if (bvec->bv_offset == 0 && bvec->bv_len == PAGE_CACHE_SIZE) | 2358 | if (bvec->bv_offset == 0 && bvec->bv_len == PAGE_CACHE_SIZE) |
@@ -2471,7 +2469,7 @@ static int __must_check submit_one_bio(int rw, struct bio *bio, | |||
2471 | struct extent_io_tree *tree = bio->bi_private; | 2469 | struct extent_io_tree *tree = bio->bi_private; |
2472 | u64 start; | 2470 | u64 start; |
2473 | 2471 | ||
2474 | start = ((u64)page->index << PAGE_CACHE_SHIFT) + bvec->bv_offset; | 2472 | start = page_offset(page) + bvec->bv_offset; |
2475 | 2473 | ||
2476 | bio->bi_private = NULL; | 2474 | bio->bi_private = NULL; |
2477 | 2475 | ||
@@ -2595,7 +2593,7 @@ static int __extent_read_full_page(struct extent_io_tree *tree, | |||
2595 | unsigned long *bio_flags) | 2593 | unsigned long *bio_flags) |
2596 | { | 2594 | { |
2597 | struct inode *inode = page->mapping->host; | 2595 | struct inode *inode = page->mapping->host; |
2598 | u64 start = (u64)page->index << PAGE_CACHE_SHIFT; | 2596 | u64 start = page_offset(page); |
2599 | u64 page_end = start + PAGE_CACHE_SIZE - 1; | 2597 | u64 page_end = start + PAGE_CACHE_SIZE - 1; |
2600 | u64 end; | 2598 | u64 end; |
2601 | u64 cur = start; | 2599 | u64 cur = start; |
@@ -2806,7 +2804,7 @@ static int __extent_writepage(struct page *page, struct writeback_control *wbc, | |||
2806 | struct inode *inode = page->mapping->host; | 2804 | struct inode *inode = page->mapping->host; |
2807 | struct extent_page_data *epd = data; | 2805 | struct extent_page_data *epd = data; |
2808 | struct extent_io_tree *tree = epd->tree; | 2806 | struct extent_io_tree *tree = epd->tree; |
2809 | u64 start = (u64)page->index << PAGE_CACHE_SHIFT; | 2807 | u64 start = page_offset(page); |
2810 | u64 delalloc_start; | 2808 | u64 delalloc_start; |
2811 | u64 page_end = start + PAGE_CACHE_SIZE - 1; | 2809 | u64 page_end = start + PAGE_CACHE_SIZE - 1; |
2812 | u64 end; | 2810 | u64 end; |
@@ -3674,7 +3672,7 @@ int extent_invalidatepage(struct extent_io_tree *tree, | |||
3674 | struct page *page, unsigned long offset) | 3672 | struct page *page, unsigned long offset) |
3675 | { | 3673 | { |
3676 | struct extent_state *cached_state = NULL; | 3674 | struct extent_state *cached_state = NULL; |
3677 | u64 start = ((u64)page->index << PAGE_CACHE_SHIFT); | 3675 | u64 start = page_offset(page); |
3678 | u64 end = start + PAGE_CACHE_SIZE - 1; | 3676 | u64 end = start + PAGE_CACHE_SIZE - 1; |
3679 | size_t blocksize = page->mapping->host->i_sb->s_blocksize; | 3677 | size_t blocksize = page->mapping->host->i_sb->s_blocksize; |
3680 | 3678 | ||
@@ -3700,7 +3698,7 @@ int try_release_extent_state(struct extent_map_tree *map, | |||
3700 | struct extent_io_tree *tree, struct page *page, | 3698 | struct extent_io_tree *tree, struct page *page, |
3701 | gfp_t mask) | 3699 | gfp_t mask) |
3702 | { | 3700 | { |
3703 | u64 start = (u64)page->index << PAGE_CACHE_SHIFT; | 3701 | u64 start = page_offset(page); |
3704 | u64 end = start + PAGE_CACHE_SIZE - 1; | 3702 | u64 end = start + PAGE_CACHE_SIZE - 1; |
3705 | int ret = 1; | 3703 | int ret = 1; |
3706 | 3704 | ||
@@ -3739,7 +3737,7 @@ int try_release_extent_mapping(struct extent_map_tree *map, | |||
3739 | gfp_t mask) | 3737 | gfp_t mask) |
3740 | { | 3738 | { |
3741 | struct extent_map *em; | 3739 | struct extent_map *em; |
3742 | u64 start = (u64)page->index << PAGE_CACHE_SHIFT; | 3740 | u64 start = page_offset(page); |
3743 | u64 end = start + PAGE_CACHE_SIZE - 1; | 3741 | u64 end = start + PAGE_CACHE_SIZE - 1; |
3744 | 3742 | ||
3745 | if ((mask & __GFP_WAIT) && | 3743 | if ((mask & __GFP_WAIT) && |