Skip to content

Commit

Permalink
nilfs2: clean up indirect function calling conventions
Browse files Browse the repository at this point in the history
This cleans up the strange indirect function calling convention used in
nilfs to follow the normal kernel coding style.

Signed-off-by: Pekka Enberg <[email protected]>
Acked-by: Ryusuke Konishi <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Pekka Enberg authored and torvalds committed Apr 7, 2009
1 parent 7fa10d2 commit 8acfbf0
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 69 deletions.
46 changes: 23 additions & 23 deletions fs/nilfs2/bmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@ int nilfs_bmap_lookup_at_level(struct nilfs_bmap *bmap, __u64 key, int level,
int ret;

down_read(&bmap->b_sem);
ret = (*bmap->b_ops->bop_lookup)(bmap, key, level, ptrp);
ret = bmap->b_ops->bop_lookup(bmap, key, level, ptrp);
if (ret < 0)
goto out;
if (bmap->b_pops->bpop_translate != NULL) {
ret = (*bmap->b_pops->bpop_translate)(bmap, *ptrp, &ptr);
ret = bmap->b_pops->bpop_translate(bmap, *ptrp, &ptr);
if (ret < 0)
goto out;
*ptrp = ptr;
Expand Down Expand Up @@ -94,9 +94,9 @@ static int nilfs_bmap_do_insert(struct nilfs_bmap *bmap, __u64 key, __u64 ptr)
int ret, n;

if (bmap->b_ops->bop_check_insert != NULL) {
ret = (*bmap->b_ops->bop_check_insert)(bmap, key);
ret = bmap->b_ops->bop_check_insert(bmap, key);
if (ret > 0) {
n = (*bmap->b_ops->bop_gather_data)(
n = bmap->b_ops->bop_gather_data(
bmap, keys, ptrs, NILFS_BMAP_SMALL_HIGH + 1);
if (n < 0)
return n;
Expand All @@ -111,7 +111,7 @@ static int nilfs_bmap_do_insert(struct nilfs_bmap *bmap, __u64 key, __u64 ptr)
return ret;
}

return (*bmap->b_ops->bop_insert)(bmap, key, ptr);
return bmap->b_ops->bop_insert(bmap, key, ptr);
}

/**
Expand Down Expand Up @@ -151,9 +151,9 @@ static int nilfs_bmap_do_delete(struct nilfs_bmap *bmap, __u64 key)
int ret, n;

if (bmap->b_ops->bop_check_delete != NULL) {
ret = (*bmap->b_ops->bop_check_delete)(bmap, key);
ret = bmap->b_ops->bop_check_delete(bmap, key);
if (ret > 0) {
n = (*bmap->b_ops->bop_gather_data)(
n = bmap->b_ops->bop_gather_data(
bmap, keys, ptrs, NILFS_BMAP_LARGE_LOW + 1);
if (n < 0)
return n;
Expand All @@ -168,7 +168,7 @@ static int nilfs_bmap_do_delete(struct nilfs_bmap *bmap, __u64 key)
return ret;
}

return (*bmap->b_ops->bop_delete)(bmap, key);
return bmap->b_ops->bop_delete(bmap, key);
}

int nilfs_bmap_last_key(struct nilfs_bmap *bmap, unsigned long *key)
Expand All @@ -177,7 +177,7 @@ int nilfs_bmap_last_key(struct nilfs_bmap *bmap, unsigned long *key)
int ret;

down_read(&bmap->b_sem);
ret = (*bmap->b_ops->bop_last_key)(bmap, &lastkey);
ret = bmap->b_ops->bop_last_key(bmap, &lastkey);
if (!ret)
*key = lastkey;
up_read(&bmap->b_sem);
Expand Down Expand Up @@ -216,7 +216,7 @@ static int nilfs_bmap_do_truncate(struct nilfs_bmap *bmap, unsigned long key)
__u64 lastkey;
int ret;

ret = (*bmap->b_ops->bop_last_key)(bmap, &lastkey);
ret = bmap->b_ops->bop_last_key(bmap, &lastkey);
if (ret < 0) {
if (ret == -ENOENT)
ret = 0;
Expand All @@ -227,7 +227,7 @@ static int nilfs_bmap_do_truncate(struct nilfs_bmap *bmap, unsigned long key)
ret = nilfs_bmap_do_delete(bmap, lastkey);
if (ret < 0)
return ret;
ret = (*bmap->b_ops->bop_last_key)(bmap, &lastkey);
ret = bmap->b_ops->bop_last_key(bmap, &lastkey);
if (ret < 0) {
if (ret == -ENOENT)
ret = 0;
Expand Down Expand Up @@ -272,7 +272,7 @@ void nilfs_bmap_clear(struct nilfs_bmap *bmap)
{
down_write(&bmap->b_sem);
if (bmap->b_ops->bop_clear != NULL)
(*bmap->b_ops->bop_clear)(bmap);
bmap->b_ops->bop_clear(bmap);
up_write(&bmap->b_sem);
}

Expand All @@ -296,7 +296,7 @@ int nilfs_bmap_propagate(struct nilfs_bmap *bmap, struct buffer_head *bh)
int ret;

down_write(&bmap->b_sem);
ret = (*bmap->b_ops->bop_propagate)(bmap, bh);
ret = bmap->b_ops->bop_propagate(bmap, bh);
up_write(&bmap->b_sem);
return ret;
}
Expand All @@ -310,7 +310,7 @@ void nilfs_bmap_lookup_dirty_buffers(struct nilfs_bmap *bmap,
struct list_head *listp)
{
if (bmap->b_ops->bop_lookup_dirty_buffers != NULL)
(*bmap->b_ops->bop_lookup_dirty_buffers)(bmap, listp);
bmap->b_ops->bop_lookup_dirty_buffers(bmap, listp);
}

/**
Expand Down Expand Up @@ -340,7 +340,7 @@ int nilfs_bmap_assign(struct nilfs_bmap *bmap,
int ret;

down_write(&bmap->b_sem);
ret = (*bmap->b_ops->bop_assign)(bmap, bh, blocknr, binfo);
ret = bmap->b_ops->bop_assign(bmap, bh, blocknr, binfo);
up_write(&bmap->b_sem);
return ret;
}
Expand Down Expand Up @@ -369,7 +369,7 @@ int nilfs_bmap_mark(struct nilfs_bmap *bmap, __u64 key, int level)
return 0;

down_write(&bmap->b_sem);
ret = (*bmap->b_ops->bop_mark)(bmap, key, level);
ret = bmap->b_ops->bop_mark(bmap, key, level);
up_write(&bmap->b_sem);
return ret;
}
Expand Down Expand Up @@ -572,12 +572,12 @@ int nilfs_bmap_prepare_update(struct nilfs_bmap *bmap,
{
int ret;

ret = (*bmap->b_pops->bpop_prepare_end_ptr)(bmap, oldreq);
ret = bmap->b_pops->bpop_prepare_end_ptr(bmap, oldreq);
if (ret < 0)
return ret;
ret = (*bmap->b_pops->bpop_prepare_alloc_ptr)(bmap, newreq);
ret = bmap->b_pops->bpop_prepare_alloc_ptr(bmap, newreq);
if (ret < 0)
(*bmap->b_pops->bpop_abort_end_ptr)(bmap, oldreq);
bmap->b_pops->bpop_abort_end_ptr(bmap, oldreq);

return ret;
}
Expand All @@ -586,16 +586,16 @@ void nilfs_bmap_commit_update(struct nilfs_bmap *bmap,
union nilfs_bmap_ptr_req *oldreq,
union nilfs_bmap_ptr_req *newreq)
{
(*bmap->b_pops->bpop_commit_end_ptr)(bmap, oldreq);
(*bmap->b_pops->bpop_commit_alloc_ptr)(bmap, newreq);
bmap->b_pops->bpop_commit_end_ptr(bmap, oldreq);
bmap->b_pops->bpop_commit_alloc_ptr(bmap, newreq);
}

void nilfs_bmap_abort_update(struct nilfs_bmap *bmap,
union nilfs_bmap_ptr_req *oldreq,
union nilfs_bmap_ptr_req *newreq)
{
(*bmap->b_pops->bpop_abort_end_ptr)(bmap, oldreq);
(*bmap->b_pops->bpop_abort_alloc_ptr)(bmap, newreq);
bmap->b_pops->bpop_abort_end_ptr(bmap, oldreq);
bmap->b_pops->bpop_abort_alloc_ptr(bmap, newreq);
}

static int nilfs_bmap_translate_v(const struct nilfs_bmap *bmap, __u64 ptr,
Expand Down
62 changes: 31 additions & 31 deletions fs/nilfs2/btree.c
Original file line number Diff line number Diff line change
Expand Up @@ -902,9 +902,9 @@ static int nilfs_btree_prepare_insert(struct nilfs_btree *btree,
/* allocate a new ptr for data block */
if (btree->bt_ops->btop_find_target != NULL)
path[level].bp_newreq.bpr_ptr =
(*btree->bt_ops->btop_find_target)(btree, path, key);
btree->bt_ops->btop_find_target(btree, path, key);

ret = (*btree->bt_bmap.b_pops->bpop_prepare_alloc_ptr)(
ret = btree->bt_bmap.b_pops->bpop_prepare_alloc_ptr(
&btree->bt_bmap, &path[level].bp_newreq);
if (ret < 0)
goto err_out_data;
Expand Down Expand Up @@ -965,7 +965,7 @@ static int nilfs_btree_prepare_insert(struct nilfs_btree *btree,
/* split */
path[level].bp_newreq.bpr_ptr =
path[level - 1].bp_newreq.bpr_ptr + 1;
ret = (*btree->bt_bmap.b_pops->bpop_prepare_alloc_ptr)(
ret = btree->bt_bmap.b_pops->bpop_prepare_alloc_ptr(
&btree->bt_bmap, &path[level].bp_newreq);
if (ret < 0)
goto err_out_child_node;
Expand Down Expand Up @@ -997,7 +997,7 @@ static int nilfs_btree_prepare_insert(struct nilfs_btree *btree,

/* grow */
path[level].bp_newreq.bpr_ptr = path[level - 1].bp_newreq.bpr_ptr + 1;
ret = (*btree->bt_bmap.b_pops->bpop_prepare_alloc_ptr)(
ret = btree->bt_bmap.b_pops->bpop_prepare_alloc_ptr(
&btree->bt_bmap, &path[level].bp_newreq);
if (ret < 0)
goto err_out_child_node;
Expand Down Expand Up @@ -1026,17 +1026,17 @@ static int nilfs_btree_prepare_insert(struct nilfs_btree *btree,

/* error */
err_out_curr_node:
(*btree->bt_bmap.b_pops->bpop_abort_alloc_ptr)(&btree->bt_bmap,
&path[level].bp_newreq);
btree->bt_bmap.b_pops->bpop_abort_alloc_ptr(&btree->bt_bmap,
&path[level].bp_newreq);
err_out_child_node:
for (level--; level > NILFS_BTREE_LEVEL_DATA; level--) {
nilfs_bmap_delete_block(&btree->bt_bmap, path[level].bp_sib_bh);
(*btree->bt_bmap.b_pops->bpop_abort_alloc_ptr)(
btree->bt_bmap.b_pops->bpop_abort_alloc_ptr(
&btree->bt_bmap, &path[level].bp_newreq);

}

(*btree->bt_bmap.b_pops->bpop_abort_alloc_ptr)(&btree->bt_bmap,
btree->bt_bmap.b_pops->bpop_abort_alloc_ptr(&btree->bt_bmap,
&path[level].bp_newreq);
err_out_data:
*levelp = level;
Expand All @@ -1053,14 +1053,14 @@ static void nilfs_btree_commit_insert(struct nilfs_btree *btree,
set_buffer_nilfs_volatile((struct buffer_head *)((unsigned long)ptr));
ptr = path[NILFS_BTREE_LEVEL_DATA].bp_newreq.bpr_ptr;
if (btree->bt_ops->btop_set_target != NULL)
(*btree->bt_ops->btop_set_target)(btree, key, ptr);
btree->bt_ops->btop_set_target(btree, key, ptr);

for (level = NILFS_BTREE_LEVEL_NODE_MIN; level <= maxlevel; level++) {
if (btree->bt_bmap.b_pops->bpop_commit_alloc_ptr != NULL) {
(*btree->bt_bmap.b_pops->bpop_commit_alloc_ptr)(
btree->bt_bmap.b_pops->bpop_commit_alloc_ptr(
&btree->bt_bmap, &path[level - 1].bp_newreq);
}
(*path[level].bp_op)(btree, path, level, &key, &ptr);
path[level].bp_op(btree, path, level, &key, &ptr);
}

if (!nilfs_bmap_dirty(&btree->bt_bmap))
Expand Down Expand Up @@ -1304,7 +1304,7 @@ static int nilfs_btree_prepare_delete(struct nilfs_btree *btree,
nilfs_btree_node_get_ptr(btree, node,
path[level].bp_index);
if (btree->bt_bmap.b_pops->bpop_prepare_end_ptr != NULL) {
ret = (*btree->bt_bmap.b_pops->bpop_prepare_end_ptr)(
ret = btree->bt_bmap.b_pops->bpop_prepare_end_ptr(
&btree->bt_bmap, &path[level].bp_oldreq);
if (ret < 0)
goto err_out_child_node;
Expand Down Expand Up @@ -1385,7 +1385,7 @@ static int nilfs_btree_prepare_delete(struct nilfs_btree *btree,
path[level].bp_oldreq.bpr_ptr =
nilfs_btree_node_get_ptr(btree, node, path[level].bp_index);
if (btree->bt_bmap.b_pops->bpop_prepare_end_ptr != NULL) {
ret = (*btree->bt_bmap.b_pops->bpop_prepare_end_ptr)(
ret = btree->bt_bmap.b_pops->bpop_prepare_end_ptr(
&btree->bt_bmap, &path[level].bp_oldreq);
if (ret < 0)
goto err_out_child_node;
Expand All @@ -1402,13 +1402,13 @@ static int nilfs_btree_prepare_delete(struct nilfs_btree *btree,
/* error */
err_out_curr_node:
if (btree->bt_bmap.b_pops->bpop_abort_end_ptr != NULL)
(*btree->bt_bmap.b_pops->bpop_abort_end_ptr)(
btree->bt_bmap.b_pops->bpop_abort_end_ptr(
&btree->bt_bmap, &path[level].bp_oldreq);
err_out_child_node:
for (level--; level >= NILFS_BTREE_LEVEL_NODE_MIN; level--) {
nilfs_bmap_put_block(&btree->bt_bmap, path[level].bp_sib_bh);
if (btree->bt_bmap.b_pops->bpop_abort_end_ptr != NULL)
(*btree->bt_bmap.b_pops->bpop_abort_end_ptr)(
btree->bt_bmap.b_pops->bpop_abort_end_ptr(
&btree->bt_bmap, &path[level].bp_oldreq);
}
*levelp = level;
Expand All @@ -1424,9 +1424,9 @@ static void nilfs_btree_commit_delete(struct nilfs_btree *btree,

for (level = NILFS_BTREE_LEVEL_NODE_MIN; level <= maxlevel; level++) {
if (btree->bt_bmap.b_pops->bpop_commit_end_ptr != NULL)
(*btree->bt_bmap.b_pops->bpop_commit_end_ptr)(
btree->bt_bmap.b_pops->bpop_commit_end_ptr(
&btree->bt_bmap, &path[level].bp_oldreq);
(*path[level].bp_op)(btree, path, level, NULL, NULL);
path[level].bp_op(btree, path, level, NULL, NULL);
}

if (!nilfs_bmap_dirty(&btree->bt_bmap))
Expand Down Expand Up @@ -1589,16 +1589,16 @@ nilfs_btree_prepare_convert_and_insert(struct nilfs_bmap *bmap, __u64 key,
/* cannot find near ptr */
if (btree->bt_ops->btop_find_target != NULL)
dreq->bpr_ptr
= (*btree->bt_ops->btop_find_target)(btree, NULL, key);
ret = (*bmap->b_pops->bpop_prepare_alloc_ptr)(bmap, dreq);
= btree->bt_ops->btop_find_target(btree, NULL, key);
ret = bmap->b_pops->bpop_prepare_alloc_ptr(bmap, dreq);
if (ret < 0)
return ret;

*bhp = NULL;
stats->bs_nblocks++;
if (nreq != NULL) {
nreq->bpr_ptr = dreq->bpr_ptr + 1;
ret = (*bmap->b_pops->bpop_prepare_alloc_ptr)(bmap, nreq);
ret = bmap->b_pops->bpop_prepare_alloc_ptr(bmap, nreq);
if (ret < 0)
goto err_out_dreq;

Expand All @@ -1615,9 +1615,9 @@ nilfs_btree_prepare_convert_and_insert(struct nilfs_bmap *bmap, __u64 key,

/* error */
err_out_nreq:
(*bmap->b_pops->bpop_abort_alloc_ptr)(bmap, nreq);
bmap->b_pops->bpop_abort_alloc_ptr(bmap, nreq);
err_out_dreq:
(*bmap->b_pops->bpop_abort_alloc_ptr)(bmap, dreq);
bmap->b_pops->bpop_abort_alloc_ptr(bmap, dreq);
stats->bs_nblocks = 0;
return ret;

Expand All @@ -1638,7 +1638,7 @@ nilfs_btree_commit_convert_and_insert(struct nilfs_bmap *bmap,

/* free resources */
if (bmap->b_ops->bop_clear != NULL)
(*bmap->b_ops->bop_clear)(bmap);
bmap->b_ops->bop_clear(bmap);

/* ptr must be a pointer to a buffer head. */
set_buffer_nilfs_volatile((struct buffer_head *)((unsigned long)ptr));
Expand All @@ -1648,8 +1648,8 @@ nilfs_btree_commit_convert_and_insert(struct nilfs_bmap *bmap,
nilfs_btree_init(bmap, low, high);
if (nreq != NULL) {
if (bmap->b_pops->bpop_commit_alloc_ptr != NULL) {
(*bmap->b_pops->bpop_commit_alloc_ptr)(bmap, dreq);
(*bmap->b_pops->bpop_commit_alloc_ptr)(bmap, nreq);
bmap->b_pops->bpop_commit_alloc_ptr(bmap, dreq);
bmap->b_pops->bpop_commit_alloc_ptr(bmap, nreq);
}

/* create child node at level 1 */
Expand All @@ -1673,7 +1673,7 @@ nilfs_btree_commit_convert_and_insert(struct nilfs_bmap *bmap,
2, 1, &keys[0], &tmpptr);
} else {
if (bmap->b_pops->bpop_commit_alloc_ptr != NULL)
(*bmap->b_pops->bpop_commit_alloc_ptr)(bmap, dreq);
bmap->b_pops->bpop_commit_alloc_ptr(bmap, dreq);

/* create root node at level 1 */
node = nilfs_btree_get_root(btree);
Expand All @@ -1686,7 +1686,7 @@ nilfs_btree_commit_convert_and_insert(struct nilfs_bmap *bmap,
}

if (btree->bt_ops->btop_set_target != NULL)
(*btree->bt_ops->btop_set_target)(btree, key, dreq->bpr_ptr);
btree->bt_ops->btop_set_target(btree, key, dreq->bpr_ptr);
}

/**
Expand Down Expand Up @@ -1937,7 +1937,7 @@ static int nilfs_btree_propagate(const struct nilfs_bmap *bmap,
goto out;
}

ret = (*btree->bt_ops->btop_propagate)(btree, path, level, bh);
ret = btree->bt_ops->btop_propagate(btree, path, level, bh);

out:
nilfs_btree_clear_path(btree, path);
Expand Down Expand Up @@ -2073,11 +2073,11 @@ static int nilfs_btree_assign_v(struct nilfs_btree *btree,
ptr = nilfs_btree_node_get_ptr(btree, parent,
path[level + 1].bp_index);
req.bpr_ptr = ptr;
ret = (*btree->bt_bmap.b_pops->bpop_prepare_start_ptr)(&btree->bt_bmap,
ret = btree->bt_bmap.b_pops->bpop_prepare_start_ptr(&btree->bt_bmap,
&req);
if (ret < 0)
return ret;
(*btree->bt_bmap.b_pops->bpop_commit_start_ptr)(&btree->bt_bmap,
btree->bt_bmap.b_pops->bpop_commit_start_ptr(&btree->bt_bmap,
&req, blocknr);

key = nilfs_btree_node_get_key(btree, parent,
Expand Down Expand Up @@ -2121,7 +2121,7 @@ static int nilfs_btree_assign(struct nilfs_bmap *bmap,
goto out;
}

ret = (*btree->bt_ops->btop_assign)(btree, path, level, bh,
ret = btree->bt_ops->btop_assign(btree, path, level, bh,
blocknr, binfo);

out:
Expand Down
Loading

0 comments on commit 8acfbf0

Please sign in to comment.