Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 165084
b: refs/heads/master
c: 4c911ee
h: refs/heads/master
v: v3
  • Loading branch information
Joel Becker committed Sep 4, 2009
1 parent 14f912d commit fcb8c83
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 7 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 043beebb6c467a07ccd7aa666095f87fade1c28e
refs/heads/master: 4c911eefca316f580f174940cd67d561b4b7e6e8
37 changes: 31 additions & 6 deletions trunk/fs/ocfs2/alloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,13 @@ struct ocfs2_extent_tree_operations {
void (*eo_update_clusters)(struct ocfs2_extent_tree *et,
u32 new_clusters);

/*
* If this extent tree is supported by an extent map, truncate the
* map to clusters,
*/
void (*eo_extent_map_truncate)(struct ocfs2_extent_tree *et,
u32 clusters);

/*
* If ->eo_insert_check() exists, it is called before rec is
* inserted into the extent tree. It is optional.
Expand Down Expand Up @@ -120,6 +127,8 @@ static void ocfs2_dinode_set_last_eb_blk(struct ocfs2_extent_tree *et,
u64 blkno);
static void ocfs2_dinode_update_clusters(struct ocfs2_extent_tree *et,
u32 clusters);
static void ocfs2_dinode_extent_map_truncate(struct ocfs2_extent_tree *et,
u32 clusters);
static int ocfs2_dinode_insert_check(struct ocfs2_extent_tree *et,
struct ocfs2_extent_rec *rec);
static int ocfs2_dinode_sanity_check(struct ocfs2_extent_tree *et);
Expand All @@ -128,6 +137,7 @@ static struct ocfs2_extent_tree_operations ocfs2_dinode_et_ops = {
.eo_set_last_eb_blk = ocfs2_dinode_set_last_eb_blk,
.eo_get_last_eb_blk = ocfs2_dinode_get_last_eb_blk,
.eo_update_clusters = ocfs2_dinode_update_clusters,
.eo_extent_map_truncate = ocfs2_dinode_extent_map_truncate,
.eo_insert_check = ocfs2_dinode_insert_check,
.eo_sanity_check = ocfs2_dinode_sanity_check,
.eo_fill_root_el = ocfs2_dinode_fill_root_el,
Expand Down Expand Up @@ -162,6 +172,14 @@ static void ocfs2_dinode_update_clusters(struct ocfs2_extent_tree *et,
spin_unlock(&oi->ip_lock);
}

static void ocfs2_dinode_extent_map_truncate(struct ocfs2_extent_tree *et,
u32 clusters)
{
struct inode *inode = &cache_info_to_inode(et->et_ci)->vfs_inode;

ocfs2_extent_map_trunc(inode, clusters);
}

static int ocfs2_dinode_insert_check(struct ocfs2_extent_tree *et,
struct ocfs2_extent_rec *rec)
{
Expand Down Expand Up @@ -400,6 +418,13 @@ static inline void ocfs2_et_update_clusters(struct ocfs2_extent_tree *et,
et->et_ops->eo_update_clusters(et, clusters);
}

static inline void ocfs2_et_extent_map_truncate(struct ocfs2_extent_tree *et,
u32 clusters)
{
if (et->et_ops->eo_extent_map_truncate)
et->et_ops->eo_extent_map_truncate(et, clusters);
}

static inline int ocfs2_et_root_journal_access(handle_t *handle,
struct ocfs2_extent_tree *et,
int type)
Expand Down Expand Up @@ -5106,12 +5131,8 @@ int ocfs2_mark_extent_written(struct inode *inode,
/*
* XXX: This should be fixed up so that we just re-insert the
* next extent records.
*
* XXX: This is a hack on the extent tree, maybe it should be
* an op?
*/
if (et->et_ops == &ocfs2_dinode_et_ops)
ocfs2_extent_map_trunc(inode, 0);
ocfs2_et_extent_map_truncate(et, 0);

left_path = ocfs2_new_path_from_et(et);
if (!left_path) {
Expand Down Expand Up @@ -5393,7 +5414,11 @@ int ocfs2_remove_extent(struct inode *inode,
struct ocfs2_extent_list *el;
struct ocfs2_path *path = NULL;

ocfs2_extent_map_trunc(inode, 0);
/*
* XXX: Why are we truncating to 0 instead of wherever this
* affects us?
*/
ocfs2_et_extent_map_truncate(et, 0);

path = ocfs2_new_path_from_et(et);
if (!path) {
Expand Down

0 comments on commit fcb8c83

Please sign in to comment.