summaryrefslogtreecommitdiffstats
path: root/fs/btrfs/extent_map.c
diff options
context:
space:
mode:
authorChris Mason <chris.mason@oracle.com>2007-10-15 16:14:27 -0400
committerChris Mason <chris.mason@oracle.com>2008-09-25 11:03:56 -0400
commit479965d66e320f1a095bb76027171daa675a9c72 (patch)
treee8b57bf49e2c0eb37e5dbd389f716e4dc21d54dc /fs/btrfs/extent_map.c
parent5f39d397dfbe140a14edecd4e73c34ce23c4f9ee (diff)
downloadop-kernel-dev-479965d66e320f1a095bb76027171daa675a9c72.zip
op-kernel-dev-479965d66e320f1a095bb76027171daa675a9c72.tar.gz
Btrfs: Optimizations for the extent_buffer code
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/extent_map.c')
-rw-r--r--fs/btrfs/extent_map.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/fs/btrfs/extent_map.c b/fs/btrfs/extent_map.c
index 55fefdf..8bef309 100644
--- a/fs/btrfs/extent_map.c
+++ b/fs/btrfs/extent_map.c
@@ -2140,14 +2140,20 @@ void read_extent_buffer(struct extent_buffer *eb, void *dstv,
EXPORT_SYMBOL(read_extent_buffer);
int map_extent_buffer(struct extent_buffer *eb, unsigned long start,
+ unsigned long min_len,
char **token, char **map,
unsigned long *map_start,
unsigned long *map_len, int km)
{
- size_t offset;
+ size_t offset = start & (PAGE_CACHE_SIZE - 1);
char *kaddr;
size_t start_offset = eb->start & ((u64)PAGE_CACHE_SIZE - 1);
unsigned long i = (start_offset + start) >> PAGE_CACHE_SHIFT;
+ unsigned long end_i = (start_offset + start + min_len) >>
+ PAGE_CACHE_SHIFT;
+
+ if (i != end_i)
+ return -EINVAL;
WARN_ON(start > eb->len);
@@ -2155,8 +2161,7 @@ int map_extent_buffer(struct extent_buffer *eb, unsigned long start,
offset = start_offset;
*map_start = 0;
} else {
- offset = 0;
- *map_start = (i << PAGE_CACHE_SHIFT) - offset;
+ *map_start = (i << PAGE_CACHE_SHIFT) - start_offset;
}
// kaddr = kmap_atomic(eb->pages[i], km);
OpenPOWER on IntegriCloud