aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs
diff options
context:
space:
mode:
authorChris Mason <chris.mason@oracle.com>2007-11-06 15:09:29 -0500
committerChris Mason <chris.mason@oracle.com>2008-09-25 11:03:57 -0400
commite644d021e328d3902559e5db687383f2da85993c (patch)
tree12fa85275a3333c709ddc03c2f4fd426b97a9dcf /fs/btrfs
parentf84a8b362d9785ca1fa0598d8a90f35184bd8750 (diff)
Fix recursive KM_USER1 usage in btrfs_realloc_node
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs')
-rw-r--r--fs/btrfs/ctree.h11
-rw-r--r--fs/btrfs/struct-funcs.c16
2 files changed, 19 insertions, 8 deletions
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
index f7907b02fa7..030d21d7f98 100644
--- a/fs/btrfs/ctree.h
+++ b/fs/btrfs/ctree.h
@@ -557,14 +557,9 @@ static inline unsigned long btrfs_node_key_ptr_offset(int nr)
557 sizeof(struct btrfs_key_ptr) * nr; 557 sizeof(struct btrfs_key_ptr) * nr;
558} 558}
559 559
560static inline void btrfs_node_key(struct extent_buffer *eb, 560void btrfs_node_key(struct extent_buffer *eb,
561 struct btrfs_disk_key *disk_key, int nr) 561 struct btrfs_disk_key *disk_key, int nr);
562{ 562
563 unsigned long ptr;
564 ptr = btrfs_node_key_ptr_offset(nr);
565 read_eb_member(eb, (struct btrfs_key_ptr *)ptr,
566 struct btrfs_key_ptr, key, disk_key);
567}
568static inline void btrfs_set_node_key(struct extent_buffer *eb, 563static inline void btrfs_set_node_key(struct extent_buffer *eb,
569 struct btrfs_disk_key *disk_key, int nr) 564 struct btrfs_disk_key *disk_key, int nr)
570{ 565{
diff --git a/fs/btrfs/struct-funcs.c b/fs/btrfs/struct-funcs.c
index cf68fcf9b55..c5715a60554 100644
--- a/fs/btrfs/struct-funcs.c
+++ b/fs/btrfs/struct-funcs.c
@@ -95,3 +95,19 @@ void btrfs_set_##name(struct extent_buffer *eb, \
95 95
96#include "ctree.h" 96#include "ctree.h"
97 97
98void btrfs_node_key(struct extent_buffer *eb,
99 struct btrfs_disk_key *disk_key, int nr)
100{
101 unsigned long ptr = btrfs_node_key_ptr_offset(nr);
102 if (eb->map_token && ptr >= eb->map_start &&
103 ptr + sizeof(*disk_key) <= eb->map_start + eb->map_len) {
104 memcpy(disk_key, eb->kaddr + ptr - eb->map_start,
105 sizeof(*disk_key));
106 return;
107 } else if (eb->map_token) {
108 unmap_extent_buffer(eb, eb->map_token, KM_USER1);
109 eb->map_token = NULL;
110 }
111 read_eb_member(eb, (struct btrfs_key_ptr *)ptr,
112 struct btrfs_key_ptr, key, disk_key);
113}