diff options
author | Mark Fasheh <mark.fasheh@oracle.com> | 2007-03-08 03:46:57 +0300 |
---|---|---|
committer | Mark Fasheh <mark.fasheh@oracle.com> | 2007-04-27 02:02:37 +0400 |
commit | e48edee2d8eab812f31f0ff62c6ba635ca2e1e21 (patch) | |
tree | 6afb9fe59a06ce621cb11d570e432e7d739376ff /fs/ocfs2/extent_map.c | |
parent | 6af67d8205cf65fbaaa743edc7ebb46e486e34ff (diff) | |
download | linux-e48edee2d8eab812f31f0ff62c6ba635ca2e1e21.tar.xz |
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.c | 19 |
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, int ret = -1; int i; struct ocfs2_extent_rec *rec; - u32 rec_end, rec_start; + u32 rec_end, rec_start, clusters; for(i = 0; i < le16_to_cpu(el->l_next_free_rec); i++) { rec = &el->l_recs[i]; rec_start = le32_to_cpu(rec->e_cpos); - rec_end = rec_start + le32_to_cpu(rec->e_clusters); + clusters = ocfs2_rec_clusters(el, rec); + + rec_end = rec_start + clusters; if (v_cluster >= rec_start && v_cluster < rec_end) { ret = i; @@ -98,6 +100,15 @@ int ocfs2_get_clusters(struct inode *inode, u32 v_cluster, eb = (struct ocfs2_extent_block *) eb_bh->b_data; el = &eb->h_list; + + if (el->l_tree_depth) { + ocfs2_error(inode->i_sb, + "Inode %lu has non zero tree depth in " + "leaf block %llu\n", inode->i_ino, + (unsigned long long)eb_bh->b_blocknr); + ret = -EROFS; + goto out; + } } i = ocfs2_search_extent_list(el, v_cluster); @@ -118,7 +129,7 @@ int ocfs2_get_clusters(struct inode *inode, u32 v_cluster, ocfs2_error(inode->i_sb, "Inode %lu has bad extent " "record (%u, %u, 0)", inode->i_ino, le32_to_cpu(rec->e_cpos), - le32_to_cpu(rec->e_clusters)); + ocfs2_rec_clusters(el, rec)); ret = -EROFS; goto out; } @@ -130,7 +141,7 @@ int ocfs2_get_clusters(struct inode *inode, u32 v_cluster, *p_cluster = *p_cluster + coff; if (num_clusters) - *num_clusters = le32_to_cpu(rec->e_clusters) - coff; + *num_clusters = ocfs2_rec_clusters(el, rec) - coff; } out: |