aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ocfs2/extent_map.c
diff options
context:
space:
mode:
authorMark Fasheh <mark.fasheh@oracle.com>2007-03-07 19:46:57 -0500
committerMark Fasheh <mark.fasheh@oracle.com>2007-04-26 18:02:37 -0400
commite48edee2d8eab812f31f0ff62c6ba635ca2e1e21 (patch)
tree6afb9fe59a06ce621cb11d570e432e7d739376ff /fs/ocfs2/extent_map.c
parent6af67d8205cf65fbaaa743edc7ebb46e486e34ff (diff)
ocfs2: make room for unwritten extents flag
Due to the size of our group bitmaps, we'll never have a leaf node extent record with more than 16 bits worth of clusters. Split e_clusters up so that leaf nodes can get a flags field where we can mark unwritten extents. Interior nodes whose length references all the child nodes beneath it can't split their e_clusters field, so we use a union to preserve sizing there. Signed-off-by: Mark Fasheh <mark.fasheh@oracle.com>
Diffstat (limited to 'fs/ocfs2/extent_map.c')
-rw-r--r--fs/ocfs2/extent_map.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/fs/ocfs2/extent_map.c b/fs/ocfs2/extent_map.c
index 937c2722b753..ea0ce41d4193 100644
--- a/fs/ocfs2/extent_map.c
+++ b/fs/ocfs2/extent_map.c
@@ -50,13 +50,15 @@ static int ocfs2_search_extent_list(struct ocfs2_extent_list *el,
50 int ret = -1; 50 int ret = -1;
51 int i; 51 int i;
52 struct ocfs2_extent_rec *rec; 52 struct ocfs2_extent_rec *rec;
53 u32 rec_end, rec_start; 53 u32 rec_end, rec_start, clusters;
54 54
55 for(i = 0; i < le16_to_cpu(el->l_next_free_rec); i++) { 55 for(i = 0; i < le16_to_cpu(el->l_next_free_rec); i++) {
56 rec = &el->l_recs[i]; 56 rec = &el->l_recs[i];
57 57
58 rec_start = le32_to_cpu(rec->e_cpos); 58 rec_start = le32_to_cpu(rec->e_cpos);
59 rec_end = rec_start + le32_to_cpu(rec->e_clusters); 59 clusters = ocfs2_rec_clusters(el, rec);
60
61 rec_end = rec_start + clusters;
60 62
61 if (v_cluster >= rec_start && v_cluster < rec_end) { 63 if (v_cluster >= rec_start && v_cluster < rec_end) {
62 ret = i; 64 ret = i;
@@ -98,6 +100,15 @@ int ocfs2_get_clusters(struct inode *inode, u32 v_cluster,
98 100
99 eb = (struct ocfs2_extent_block *) eb_bh->b_data; 101 eb = (struct ocfs2_extent_block *) eb_bh->b_data;
100 el = &eb->h_list; 102 el = &eb->h_list;
103
104 if (el->l_tree_depth) {
105 ocfs2_error(inode->i_sb,
106 "Inode %lu has non zero tree depth in "
107 "leaf block %llu\n", inode->i_ino,
108 (unsigned long long)eb_bh->b_blocknr);
109 ret = -EROFS;
110 goto out;
111 }
101 } 112 }
102 113
103 i = ocfs2_search_extent_list(el, v_cluster); 114 i = ocfs2_search_extent_list(el, v_cluster);
@@ -118,7 +129,7 @@ int ocfs2_get_clusters(struct inode *inode, u32 v_cluster,
118 ocfs2_error(inode->i_sb, "Inode %lu has bad extent " 129 ocfs2_error(inode->i_sb, "Inode %lu has bad extent "
119 "record (%u, %u, 0)", inode->i_ino, 130 "record (%u, %u, 0)", inode->i_ino,
120 le32_to_cpu(rec->e_cpos), 131 le32_to_cpu(rec->e_cpos),
121 le32_to_cpu(rec->e_clusters)); 132 ocfs2_rec_clusters(el, rec));
122 ret = -EROFS; 133 ret = -EROFS;
123 goto out; 134 goto out;
124 } 135 }
@@ -130,7 +141,7 @@ int ocfs2_get_clusters(struct inode *inode, u32 v_cluster,
130 *p_cluster = *p_cluster + coff; 141 *p_cluster = *p_cluster + coff;
131 142
132 if (num_clusters) 143 if (num_clusters)
133 *num_clusters = le32_to_cpu(rec->e_clusters) - coff; 144 *num_clusters = ocfs2_rec_clusters(el, rec) - coff;
134 } 145 }
135 146
136out: 147out: