Skip to content

Commit

Permalink
ocfs2: refcounttree.c cleanup.
Browse files Browse the repository at this point in the history
sparse check finds some endian problem and some other minor issues.
There is an obsolete function which should be removed.
So this patch resolve all these.

Signed-off-by: Tao Ma <tao.ma@oracle.com>
Signed-off-by: Joel Becker <joel.becker@oracle.com>
  • Loading branch information
Tao Ma authored and Joel Becker committed Dec 3, 2009
1 parent 38a04e4 commit 12d4cec
Showing 1 changed file with 8 additions and 25 deletions.
33 changes: 8 additions & 25 deletions fs/ocfs2/refcounttree.c
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ static void ocfs2_erase_refcount_tree_from_list(struct ocfs2_super *osb,
spin_unlock(&osb->osb_lock);
}

void ocfs2_kref_remove_refcount_tree(struct kref *kref)
static void ocfs2_kref_remove_refcount_tree(struct kref *kref)
{
struct ocfs2_refcount_tree *tree =
container_of(kref, struct ocfs2_refcount_tree, rf_getcnt);
Expand Down Expand Up @@ -524,23 +524,6 @@ int ocfs2_lock_refcount_tree(struct ocfs2_super *osb,
return ret;
}

int ocfs2_lock_refcount_tree_by_inode(struct inode *inode, int rw,
struct ocfs2_refcount_tree **ret_tree,
struct buffer_head **ref_bh)
{
int ret;
u64 ref_blkno;

ret = ocfs2_get_refcount_block(inode, &ref_blkno);
if (ret) {
mlog_errno(ret);
return ret;
}

return ocfs2_lock_refcount_tree(OCFS2_SB(inode->i_sb), ref_blkno,
rw, ret_tree, ref_bh);
}

void ocfs2_unlock_refcount_tree(struct ocfs2_super *osb,
struct ocfs2_refcount_tree *tree, int rw)
{
Expand Down Expand Up @@ -1519,7 +1502,7 @@ static int ocfs2_divide_leaf_refcount_block(struct buffer_head *ref_leaf_bh,

/* change old and new rl_used accordingly. */
le16_add_cpu(&rl->rl_used, -num_moved);
new_rl->rl_used = cpu_to_le32(num_moved);
new_rl->rl_used = cpu_to_le16(num_moved);

sort(&rl->rl_recs, le16_to_cpu(rl->rl_used),
sizeof(struct ocfs2_refcount_rec),
Expand Down Expand Up @@ -1898,7 +1881,8 @@ static int ocfs2_split_refcount_rec(handle_t *handle,
recs_need++;

/* If the leaf block don't have enough record, expand it. */
if (le16_to_cpu(rf_list->rl_used) + recs_need > rf_list->rl_count) {
if (le16_to_cpu(rf_list->rl_used) + recs_need >
le16_to_cpu(rf_list->rl_count)) {
struct ocfs2_refcount_rec tmp_rec;
u64 cpos = le64_to_cpu(orig_rec->r_cpos);
len = le32_to_cpu(orig_rec->r_clusters);
Expand Down Expand Up @@ -1960,7 +1944,7 @@ static int ocfs2_split_refcount_rec(handle_t *handle,
memcpy(tail_rec, orig_rec, sizeof(struct ocfs2_refcount_rec));
le64_add_cpu(&tail_rec->r_cpos,
le32_to_cpu(tail_rec->r_clusters) - len);
tail_rec->r_clusters = le32_to_cpu(len);
tail_rec->r_clusters = cpu_to_le32(len);
}

/*
Expand Down Expand Up @@ -3941,8 +3925,7 @@ static int ocfs2_add_refcounted_extent(struct inode *inode,
}

ret = ocfs2_insert_extent(handle, et, cpos,
cpu_to_le64(ocfs2_clusters_to_blocks(inode->i_sb,
p_cluster)),
ocfs2_clusters_to_blocks(inode->i_sb, p_cluster),
num_clusters, ext_flags, meta_ac);
if (ret) {
mlog_errno(ret);
Expand Down Expand Up @@ -4354,8 +4337,8 @@ static int ocfs2_user_path_parent(const char __user *path,
* @new_dentry: target dentry
* @preserve: if true, preserve all file attributes
*/
int ocfs2_vfs_reflink(struct dentry *old_dentry, struct inode *dir,
struct dentry *new_dentry, bool preserve)
static int ocfs2_vfs_reflink(struct dentry *old_dentry, struct inode *dir,
struct dentry *new_dentry, bool preserve)
{
struct inode *inode = old_dentry->d_inode;
int error;
Expand Down

0 comments on commit 12d4cec

Please sign in to comment.