aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/extent_map.c
diff options
context:
space:
mode:
authorYan <yanzheng@21cn.com>2007-10-25 15:42:57 -0400
committerChris Mason <chris.mason@oracle.com>2008-09-25 11:03:57 -0400
commit65555a06b4d1ae116ce223dc4b82d6068b36df96 (patch)
tree5233852538b4bb34337a21f80d5d6af129ce5c53 /fs/btrfs/extent_map.c
parentf578d4bd7e141dd03ca7e8695c1cc118c326e69e (diff)
Btrfs: Off by one fixes in extent_map.c
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/extent_map.c')
-rw-r--r--fs/btrfs/extent_map.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/fs/btrfs/extent_map.c b/fs/btrfs/extent_map.c
index a61379230dd2..c44989a1e520 100644
--- a/fs/btrfs/extent_map.c
+++ b/fs/btrfs/extent_map.c
@@ -2045,7 +2045,7 @@ struct extent_buffer *alloc_extent_buffer(struct extent_map_tree *tree,
2045 struct extent_buffer *eb; 2045 struct extent_buffer *eb;
2046 struct page *p; 2046 struct page *p;
2047 struct address_space *mapping = tree->mapping; 2047 struct address_space *mapping = tree->mapping;
2048 int uptodate = 0; 2048 int uptodate = 1;
2049 2049
2050 eb = __alloc_extent_buffer(tree, start, len, mask); 2050 eb = __alloc_extent_buffer(tree, start, len, mask);
2051 if (!eb || IS_ERR(eb)) 2051 if (!eb || IS_ERR(eb))
@@ -2197,7 +2197,7 @@ int clear_extent_buffer_dirty(struct extent_map_tree *tree,
2197 */ 2197 */
2198 if ((i == 0 && (eb->start & (PAGE_CACHE_SIZE - 1))) || 2198 if ((i == 0 && (eb->start & (PAGE_CACHE_SIZE - 1))) ||
2199 ((i == num_pages - 1) && 2199 ((i == num_pages - 1) &&
2200 ((eb->start + eb->len - 1) & (PAGE_CACHE_SIZE - 1)))) { 2200 ((eb->start + eb->len) & (PAGE_CACHE_SIZE - 1)))) {
2201 start = page->index << PAGE_CACHE_SHIFT; 2201 start = page->index << PAGE_CACHE_SHIFT;
2202 end = start + PAGE_CACHE_SIZE - 1; 2202 end = start + PAGE_CACHE_SIZE - 1;
2203 if (test_range_bit(tree, start, end, 2203 if (test_range_bit(tree, start, end,
@@ -2265,7 +2265,7 @@ int set_extent_buffer_uptodate(struct extent_map_tree *tree,
2265 page = extent_buffer_page(eb, i); 2265 page = extent_buffer_page(eb, i);
2266 if ((i == 0 && (eb->start & (PAGE_CACHE_SIZE - 1))) || 2266 if ((i == 0 && (eb->start & (PAGE_CACHE_SIZE - 1))) ||
2267 ((i == num_pages - 1) && 2267 ((i == num_pages - 1) &&
2268 ((eb->start + eb->len - 1) & (PAGE_CACHE_SIZE - 1)))) { 2268 ((eb->start + eb->len) & (PAGE_CACHE_SIZE - 1)))) {
2269 check_page_uptodate(tree, page); 2269 check_page_uptodate(tree, page);
2270 continue; 2270 continue;
2271 } 2271 }
@@ -2401,7 +2401,7 @@ int map_private_extent_buffer(struct extent_buffer *eb, unsigned long start,
2401 struct page *p; 2401 struct page *p;
2402 size_t start_offset = eb->start & ((u64)PAGE_CACHE_SIZE - 1); 2402 size_t start_offset = eb->start & ((u64)PAGE_CACHE_SIZE - 1);
2403 unsigned long i = (start_offset + start) >> PAGE_CACHE_SHIFT; 2403 unsigned long i = (start_offset + start) >> PAGE_CACHE_SHIFT;
2404 unsigned long end_i = (start_offset + start + min_len) >> 2404 unsigned long end_i = (start_offset + start + min_len - 1) >>
2405 PAGE_CACHE_SHIFT; 2405 PAGE_CACHE_SHIFT;
2406 2406
2407 if (i != end_i) 2407 if (i != end_i)
@@ -2414,7 +2414,7 @@ int map_private_extent_buffer(struct extent_buffer *eb, unsigned long start,
2414 offset = 0; 2414 offset = 0;
2415 *map_start = (i << PAGE_CACHE_SHIFT) - start_offset; 2415 *map_start = (i << PAGE_CACHE_SHIFT) - start_offset;
2416 } 2416 }
2417 if (start + min_len >= eb->len) { 2417 if (start + min_len > eb->len) {
2418printk("bad mapping eb start %Lu len %lu, wanted %lu %lu\n", eb->start, eb->len, start, min_len); 2418printk("bad mapping eb start %Lu len %lu, wanted %lu %lu\n", eb->start, eb->len, start, min_len);
2419 WARN_ON(1); 2419 WARN_ON(1);
2420 } 2420 }