aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorChris Mason <chris.mason@oracle.com>2007-09-20 14:14:42 -0400
committerChris Mason <chris.mason@oracle.com>2008-09-25 11:03:56 -0400
commit50b78c24d594e6985f36a9a8d8e2fb74e1664e90 (patch)
tree531ae4659fc4b5a6fb4f15c0349210afdb26ecbb /fs
parentb3cfa35a493866cffd00952438b6c77364d42d3c (diff)
btrfs_get_extent should treat inline extents as though they hold a whole block
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/btrfs/inode.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 0df325f89d62..b03d40a907ca 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -1505,13 +1505,13 @@ again:
1505 1505
1506 size = btrfs_file_extent_inline_len(leaf->items + 1506 size = btrfs_file_extent_inline_len(leaf->items +
1507 path->slots[0]); 1507 path->slots[0]);
1508 extent_end = extent_start + size; 1508 extent_end = extent_start | ((u64)root->blocksize - 1);
1509 if (start < extent_start || start >= extent_end) { 1509 if (start < extent_start || start >= extent_end) {
1510 em->start = start; 1510 em->start = start;
1511 if (start < extent_start) { 1511 if (start < extent_start) {
1512 if (end < extent_start) 1512 if (end < extent_start)
1513 goto not_found; 1513 goto not_found;
1514 em->end = extent_end - 1; 1514 em->end = extent_end;
1515 } else { 1515 } else {
1516 em->end = end; 1516 em->end = end;
1517 } 1517 }
@@ -1520,17 +1520,19 @@ again:
1520 em->block_start = EXTENT_MAP_INLINE; 1520 em->block_start = EXTENT_MAP_INLINE;
1521 em->block_end = EXTENT_MAP_INLINE; 1521 em->block_end = EXTENT_MAP_INLINE;
1522 em->start = extent_start; 1522 em->start = extent_start;
1523 em->end = extent_end - 1; 1523 em->end = extent_end;
1524 if (!page) { 1524 if (!page) {
1525 goto insert; 1525 goto insert;
1526 } 1526 }
1527 ptr = btrfs_file_extent_inline_start(item); 1527 ptr = btrfs_file_extent_inline_start(item);
1528 map = kmap(page); 1528 map = kmap(page);
1529 memcpy(map + page_offset, ptr, size); 1529 memcpy(map + page_offset, ptr, size);
1530 flush_dcache_page(result->b_page); 1530 memset(map + page_offset + size, 0,
1531 root->blocksize - (page_offset + size));
1532 flush_dcache_page(page);
1531 kunmap(page); 1533 kunmap(page);
1532 set_extent_uptodate(em_tree, extent_start, 1534 set_extent_uptodate(em_tree, extent_start,
1533 extent_end - 1, GFP_NOFS); 1535 extent_end, GFP_NOFS);
1534 goto insert; 1536 goto insert;
1535 } else { 1537 } else {
1536 printk("unkknown found_type %d\n", found_type); 1538 printk("unkknown found_type %d\n", found_type);