Commit 50b78c24 authored by Chris Mason's avatar Chris Mason

btrfs_get_extent should treat inline extents as though they hold a whole block

Signed-off-by: default avatarChris Mason <chris.mason@oracle.com>
parent b3cfa35a
...@@ -1505,13 +1505,13 @@ again: ...@@ -1505,13 +1505,13 @@ again:
size = btrfs_file_extent_inline_len(leaf->items + size = btrfs_file_extent_inline_len(leaf->items +
path->slots[0]); path->slots[0]);
extent_end = extent_start + size; extent_end = extent_start | ((u64)root->blocksize - 1);
if (start < extent_start || start >= extent_end) { if (start < extent_start || start >= extent_end) {
em->start = start; em->start = start;
if (start < extent_start) { if (start < extent_start) {
if (end < extent_start) if (end < extent_start)
goto not_found; goto not_found;
em->end = extent_end - 1; em->end = extent_end;
} else { } else {
em->end = end; em->end = end;
} }
...@@ -1520,17 +1520,19 @@ again: ...@@ -1520,17 +1520,19 @@ again:
em->block_start = EXTENT_MAP_INLINE; em->block_start = EXTENT_MAP_INLINE;
em->block_end = EXTENT_MAP_INLINE; em->block_end = EXTENT_MAP_INLINE;
em->start = extent_start; em->start = extent_start;
em->end = extent_end - 1; em->end = extent_end;
if (!page) { if (!page) {
goto insert; goto insert;
} }
ptr = btrfs_file_extent_inline_start(item); ptr = btrfs_file_extent_inline_start(item);
map = kmap(page); map = kmap(page);
memcpy(map + page_offset, ptr, size); memcpy(map + page_offset, ptr, size);
flush_dcache_page(result->b_page); memset(map + page_offset + size, 0,
root->blocksize - (page_offset + size));
flush_dcache_page(page);
kunmap(page); kunmap(page);
set_extent_uptodate(em_tree, extent_start, set_extent_uptodate(em_tree, extent_start,
extent_end - 1, GFP_NOFS); extent_end, GFP_NOFS);
goto insert; goto insert;
} else { } else {
printk("unkknown found_type %d\n", found_type); printk("unkknown found_type %d\n", found_type);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment