aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/ocfs2/alloc.c29
1 files changed, 27 insertions, 2 deletions
diff --git a/fs/ocfs2/alloc.c b/fs/ocfs2/alloc.c
index 3d09f4ba39eb..ed869889c4fb 100644
--- a/fs/ocfs2/alloc.c
+++ b/fs/ocfs2/alloc.c
@@ -83,6 +83,13 @@ struct ocfs2_extent_tree_operations {
83 u32 new_clusters); 83 u32 new_clusters);
84 84
85 /* 85 /*
86 * If this extent tree is supported by an extent map, insert
87 * a record into the map.
88 */
89 void (*eo_extent_map_insert)(struct ocfs2_extent_tree *et,
90 struct ocfs2_extent_rec *rec);
91
92 /*
86 * If this extent tree is supported by an extent map, truncate the 93 * If this extent tree is supported by an extent map, truncate the
87 * map to clusters, 94 * map to clusters,
88 */ 95 */
@@ -127,6 +134,8 @@ static void ocfs2_dinode_set_last_eb_blk(struct ocfs2_extent_tree *et,
127 u64 blkno); 134 u64 blkno);
128static void ocfs2_dinode_update_clusters(struct ocfs2_extent_tree *et, 135static void ocfs2_dinode_update_clusters(struct ocfs2_extent_tree *et,
129 u32 clusters); 136 u32 clusters);
137static void ocfs2_dinode_extent_map_insert(struct ocfs2_extent_tree *et,
138 struct ocfs2_extent_rec *rec);
130static void ocfs2_dinode_extent_map_truncate(struct ocfs2_extent_tree *et, 139static void ocfs2_dinode_extent_map_truncate(struct ocfs2_extent_tree *et,
131 u32 clusters); 140 u32 clusters);
132static int ocfs2_dinode_insert_check(struct ocfs2_extent_tree *et, 141static int ocfs2_dinode_insert_check(struct ocfs2_extent_tree *et,
@@ -137,6 +146,7 @@ static struct ocfs2_extent_tree_operations ocfs2_dinode_et_ops = {
137 .eo_set_last_eb_blk = ocfs2_dinode_set_last_eb_blk, 146 .eo_set_last_eb_blk = ocfs2_dinode_set_last_eb_blk,
138 .eo_get_last_eb_blk = ocfs2_dinode_get_last_eb_blk, 147 .eo_get_last_eb_blk = ocfs2_dinode_get_last_eb_blk,
139 .eo_update_clusters = ocfs2_dinode_update_clusters, 148 .eo_update_clusters = ocfs2_dinode_update_clusters,
149 .eo_extent_map_insert = ocfs2_dinode_extent_map_insert,
140 .eo_extent_map_truncate = ocfs2_dinode_extent_map_truncate, 150 .eo_extent_map_truncate = ocfs2_dinode_extent_map_truncate,
141 .eo_insert_check = ocfs2_dinode_insert_check, 151 .eo_insert_check = ocfs2_dinode_insert_check,
142 .eo_sanity_check = ocfs2_dinode_sanity_check, 152 .eo_sanity_check = ocfs2_dinode_sanity_check,
@@ -172,6 +182,14 @@ static void ocfs2_dinode_update_clusters(struct ocfs2_extent_tree *et,
172 spin_unlock(&oi->ip_lock); 182 spin_unlock(&oi->ip_lock);
173} 183}
174 184
185static void ocfs2_dinode_extent_map_insert(struct ocfs2_extent_tree *et,
186 struct ocfs2_extent_rec *rec)
187{
188 struct inode *inode = &cache_info_to_inode(et->et_ci)->vfs_inode;
189
190 ocfs2_extent_map_insert_rec(inode, rec);
191}
192
175static void ocfs2_dinode_extent_map_truncate(struct ocfs2_extent_tree *et, 193static void ocfs2_dinode_extent_map_truncate(struct ocfs2_extent_tree *et,
176 u32 clusters) 194 u32 clusters)
177{ 195{
@@ -418,6 +436,13 @@ static inline void ocfs2_et_update_clusters(struct ocfs2_extent_tree *et,
418 et->et_ops->eo_update_clusters(et, clusters); 436 et->et_ops->eo_update_clusters(et, clusters);
419} 437}
420 438
439static inline void ocfs2_et_extent_map_insert(struct ocfs2_extent_tree *et,
440 struct ocfs2_extent_rec *rec)
441{
442 if (et->et_ops->eo_extent_map_insert)
443 et->et_ops->eo_extent_map_insert(et, rec);
444}
445
421static inline void ocfs2_et_extent_map_truncate(struct ocfs2_extent_tree *et, 446static inline void ocfs2_et_extent_map_truncate(struct ocfs2_extent_tree *et,
422 u32 clusters) 447 u32 clusters)
423{ 448{
@@ -4717,8 +4742,8 @@ int ocfs2_insert_extent(struct ocfs2_super *osb,
4717 status = ocfs2_do_insert_extent(handle, et, &rec, &insert); 4742 status = ocfs2_do_insert_extent(handle, et, &rec, &insert);
4718 if (status < 0) 4743 if (status < 0)
4719 mlog_errno(status); 4744 mlog_errno(status);
4720 else if (et->et_ops == &ocfs2_dinode_et_ops) 4745 else
4721 ocfs2_extent_map_insert_rec(inode, &rec); 4746 ocfs2_et_extent_map_insert(et, &rec);
4722 4747
4723bail: 4748bail:
4724 brelse(last_eb_bh); 4749 brelse(last_eb_bh);