diff options
author | Tao Ma <tao.ma@oracle.com> | 2010-12-23 02:30:44 -0500 |
---|---|---|
committer | Joel Becker <joel.becker@oracle.com> | 2011-01-07 21:03:00 -0500 |
commit | aecf58661961a553c254cf14536f70349127affb (patch) | |
tree | 13817998b41e1871ba80c20f50a789004ab697a6 /fs/ocfs2 | |
parent | cc548166b2aadba7a566fb0a42884a9d2ff684b0 (diff) |
ocfs2: Remove unused truncate function from alloc.c
Tristan Ye has done some refactoring against our truncate
process, so some functions like ocfs2_prepare_truncate and
ocfs2_free_truncate_context are no use and we'd better
remove them.
Signed-off-by: Tao Ma <tao.ma@oracle.com>
Signed-off-by: Joel Becker <joel.becker@oracle.com>
Diffstat (limited to 'fs/ocfs2')
-rw-r--r-- | fs/ocfs2/alloc.c | 74 | ||||
-rw-r--r-- | fs/ocfs2/alloc.h | 4 |
2 files changed, 0 insertions, 78 deletions
diff --git a/fs/ocfs2/alloc.c b/fs/ocfs2/alloc.c index 8ec418dd9e36..e4984e259cb6 100644 --- a/fs/ocfs2/alloc.c +++ b/fs/ocfs2/alloc.c | |||
@@ -565,7 +565,6 @@ static inline int ocfs2_et_sanity_check(struct ocfs2_extent_tree *et) | |||
565 | return ret; | 565 | return ret; |
566 | } | 566 | } |
567 | 567 | ||
568 | static void ocfs2_free_truncate_context(struct ocfs2_truncate_context *tc); | ||
569 | static int ocfs2_cache_extent_block_free(struct ocfs2_cached_dealloc_ctxt *ctxt, | 568 | static int ocfs2_cache_extent_block_free(struct ocfs2_cached_dealloc_ctxt *ctxt, |
570 | struct ocfs2_extent_block *eb); | 569 | struct ocfs2_extent_block *eb); |
571 | static void ocfs2_adjust_rightmost_records(handle_t *handle, | 570 | static void ocfs2_adjust_rightmost_records(handle_t *handle, |
@@ -7142,64 +7141,6 @@ bail: | |||
7142 | } | 7141 | } |
7143 | 7142 | ||
7144 | /* | 7143 | /* |
7145 | * Expects the inode to already be locked. | ||
7146 | */ | ||
7147 | int ocfs2_prepare_truncate(struct ocfs2_super *osb, | ||
7148 | struct inode *inode, | ||
7149 | struct buffer_head *fe_bh, | ||
7150 | struct ocfs2_truncate_context **tc) | ||
7151 | { | ||
7152 | int status; | ||
7153 | unsigned int new_i_clusters; | ||
7154 | struct ocfs2_dinode *fe; | ||
7155 | struct ocfs2_extent_block *eb; | ||
7156 | struct buffer_head *last_eb_bh = NULL; | ||
7157 | |||
7158 | mlog_entry_void(); | ||
7159 | |||
7160 | *tc = NULL; | ||
7161 | |||
7162 | new_i_clusters = ocfs2_clusters_for_bytes(osb->sb, | ||
7163 | i_size_read(inode)); | ||
7164 | fe = (struct ocfs2_dinode *) fe_bh->b_data; | ||
7165 | |||
7166 | mlog(0, "fe->i_clusters = %u, new_i_clusters = %u, fe->i_size =" | ||
7167 | "%llu\n", le32_to_cpu(fe->i_clusters), new_i_clusters, | ||
7168 | (unsigned long long)le64_to_cpu(fe->i_size)); | ||
7169 | |||
7170 | *tc = kzalloc(sizeof(struct ocfs2_truncate_context), GFP_KERNEL); | ||
7171 | if (!(*tc)) { | ||
7172 | status = -ENOMEM; | ||
7173 | mlog_errno(status); | ||
7174 | goto bail; | ||
7175 | } | ||
7176 | ocfs2_init_dealloc_ctxt(&(*tc)->tc_dealloc); | ||
7177 | |||
7178 | if (fe->id2.i_list.l_tree_depth) { | ||
7179 | status = ocfs2_read_extent_block(INODE_CACHE(inode), | ||
7180 | le64_to_cpu(fe->i_last_eb_blk), | ||
7181 | &last_eb_bh); | ||
7182 | if (status < 0) { | ||
7183 | mlog_errno(status); | ||
7184 | goto bail; | ||
7185 | } | ||
7186 | eb = (struct ocfs2_extent_block *) last_eb_bh->b_data; | ||
7187 | } | ||
7188 | |||
7189 | (*tc)->tc_last_eb_bh = last_eb_bh; | ||
7190 | |||
7191 | status = 0; | ||
7192 | bail: | ||
7193 | if (status < 0) { | ||
7194 | if (*tc) | ||
7195 | ocfs2_free_truncate_context(*tc); | ||
7196 | *tc = NULL; | ||
7197 | } | ||
7198 | mlog_exit_void(); | ||
7199 | return status; | ||
7200 | } | ||
7201 | |||
7202 | /* | ||
7203 | * 'start' is inclusive, 'end' is not. | 7144 | * 'start' is inclusive, 'end' is not. |
7204 | */ | 7145 | */ |
7205 | int ocfs2_truncate_inline(struct inode *inode, struct buffer_head *di_bh, | 7146 | int ocfs2_truncate_inline(struct inode *inode, struct buffer_head *di_bh, |
@@ -7273,18 +7214,3 @@ out_commit: | |||
7273 | out: | 7214 | out: |
7274 | return ret; | 7215 | return ret; |
7275 | } | 7216 | } |
7276 | |||
7277 | static void ocfs2_free_truncate_context(struct ocfs2_truncate_context *tc) | ||
7278 | { | ||
7279 | /* | ||
7280 | * The caller is responsible for completing deallocation | ||
7281 | * before freeing the context. | ||
7282 | */ | ||
7283 | if (tc->tc_dealloc.c_first_suballocator != NULL) | ||
7284 | mlog(ML_NOTICE, | ||
7285 | "Truncate completion has non-empty dealloc context\n"); | ||
7286 | |||
7287 | brelse(tc->tc_last_eb_bh); | ||
7288 | |||
7289 | kfree(tc); | ||
7290 | } | ||
diff --git a/fs/ocfs2/alloc.h b/fs/ocfs2/alloc.h index 55762b554b99..3bd08a03251c 100644 --- a/fs/ocfs2/alloc.h +++ b/fs/ocfs2/alloc.h | |||
@@ -228,10 +228,6 @@ struct ocfs2_truncate_context { | |||
228 | 228 | ||
229 | int ocfs2_zero_range_for_truncate(struct inode *inode, handle_t *handle, | 229 | int ocfs2_zero_range_for_truncate(struct inode *inode, handle_t *handle, |
230 | u64 range_start, u64 range_end); | 230 | u64 range_start, u64 range_end); |
231 | int ocfs2_prepare_truncate(struct ocfs2_super *osb, | ||
232 | struct inode *inode, | ||
233 | struct buffer_head *fe_bh, | ||
234 | struct ocfs2_truncate_context **tc); | ||
235 | int ocfs2_commit_truncate(struct ocfs2_super *osb, | 231 | int ocfs2_commit_truncate(struct ocfs2_super *osb, |
236 | struct inode *inode, | 232 | struct inode *inode, |
237 | struct buffer_head *di_bh); | 233 | struct buffer_head *di_bh); |