diff options
Diffstat (limited to 'fs/ocfs2/alloc.h')
-rw-r--r-- | fs/ocfs2/alloc.h | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/fs/ocfs2/alloc.h b/fs/ocfs2/alloc.h index 3cb39cd5e478..fbcb5934a081 100644 --- a/fs/ocfs2/alloc.h +++ b/fs/ocfs2/alloc.h | |||
@@ -85,4 +85,23 @@ int ocfs2_commit_truncate(struct ocfs2_super *osb, | |||
85 | int ocfs2_find_leaf(struct inode *inode, struct ocfs2_extent_list *root_el, | 85 | int ocfs2_find_leaf(struct inode *inode, struct ocfs2_extent_list *root_el, |
86 | u32 cpos, struct buffer_head **leaf_bh); | 86 | u32 cpos, struct buffer_head **leaf_bh); |
87 | 87 | ||
88 | /* | ||
89 | * Helper function to look at the # of clusters in an extent record. | ||
90 | */ | ||
91 | static inline unsigned int ocfs2_rec_clusters(struct ocfs2_extent_list *el, | ||
92 | struct ocfs2_extent_rec *rec) | ||
93 | { | ||
94 | /* | ||
95 | * Cluster count in extent records is slightly different | ||
96 | * between interior nodes and leaf nodes. This is to support | ||
97 | * unwritten extents which need a flags field in leaf node | ||
98 | * records, thus shrinking the available space for a clusters | ||
99 | * field. | ||
100 | */ | ||
101 | if (el->l_tree_depth) | ||
102 | return le32_to_cpu(rec->e_int_clusters); | ||
103 | else | ||
104 | return le16_to_cpu(rec->e_leaf_clusters); | ||
105 | } | ||
106 | |||
88 | #endif /* OCFS2_ALLOC_H */ | 107 | #endif /* OCFS2_ALLOC_H */ |