aboutsummaryrefslogtreecommitdiff
path: root/fs/nilfs2/bmap.c
diff options
context:
space:
mode:
authorRyusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>2009-05-03 21:43:01 +0900
committerRyusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>2009-06-10 23:41:09 +0900
commitd97a51a7e3c298d9899ea91165dfa0783fa5cc5c (patch)
tree31c3b082565cd3004c2036fe79657297a29a5824 /fs/nilfs2/bmap.c
parent65822070646ed7f2cf520439006dd863529be16e (diff)
nilfs2: unify bmap operations starting use of indirect block address
This simplifies some low level functions of bmap. Three bmap pointer operations, nilfs_bmap_start_v(), nilfs_bmap_commit_v(), and nilfs_bmap_abort_v(), are unified into one nilfs_bmap_start_v() function. And the related indirect function calls are replaced with it. Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
Diffstat (limited to 'fs/nilfs2/bmap.c')
-rw-r--r--fs/nilfs2/bmap.c36
1 files changed, 8 insertions, 28 deletions
diff --git a/fs/nilfs2/bmap.c b/fs/nilfs2/bmap.c
index 064279e33bb..4f2523f5c0b 100644
--- a/fs/nilfs2/bmap.c
+++ b/fs/nilfs2/bmap.c
@@ -511,24 +511,16 @@ static void nilfs_bmap_abort_alloc_v(struct nilfs_bmap *bmap,
nilfs_dat_abort_alloc(nilfs_bmap_get_dat(bmap), &req->bpr_req);
}
-static int nilfs_bmap_prepare_start_v(struct nilfs_bmap *bmap,
- union nilfs_bmap_ptr_req *req)
+int nilfs_bmap_start_v(struct nilfs_bmap *bmap, union nilfs_bmap_ptr_req *req,
+ sector_t blocknr)
{
- return nilfs_dat_prepare_start(nilfs_bmap_get_dat(bmap), &req->bpr_req);
-}
-
-static void nilfs_bmap_commit_start_v(struct nilfs_bmap *bmap,
- union nilfs_bmap_ptr_req *req,
- sector_t blocknr)
-{
- nilfs_dat_commit_start(nilfs_bmap_get_dat(bmap), &req->bpr_req,
- blocknr);
-}
+ struct inode *dat = nilfs_bmap_get_dat(bmap);
+ int ret;
-static void nilfs_bmap_abort_start_v(struct nilfs_bmap *bmap,
- union nilfs_bmap_ptr_req *req)
-{
- nilfs_dat_abort_start(nilfs_bmap_get_dat(bmap), &req->bpr_req);
+ ret = nilfs_dat_prepare_start(dat, &req->bpr_req);
+ if (likely(!ret))
+ nilfs_dat_commit_start(dat, &req->bpr_req, blocknr);
+ return ret;
}
static int nilfs_bmap_prepare_end_v(struct nilfs_bmap *bmap,
@@ -636,9 +628,6 @@ static const struct nilfs_bmap_ptr_operations nilfs_bmap_ptr_ops_v = {
.bpop_prepare_alloc_ptr = nilfs_bmap_prepare_alloc_v,
.bpop_commit_alloc_ptr = nilfs_bmap_commit_alloc_v,
.bpop_abort_alloc_ptr = nilfs_bmap_abort_alloc_v,
- .bpop_prepare_start_ptr = nilfs_bmap_prepare_start_v,
- .bpop_commit_start_ptr = nilfs_bmap_commit_start_v,
- .bpop_abort_start_ptr = nilfs_bmap_abort_start_v,
.bpop_prepare_end_ptr = nilfs_bmap_prepare_end_v,
.bpop_commit_end_ptr = nilfs_bmap_commit_end_v,
.bpop_abort_end_ptr = nilfs_bmap_abort_end_v,
@@ -650,9 +639,6 @@ static const struct nilfs_bmap_ptr_operations nilfs_bmap_ptr_ops_vmdt = {
.bpop_prepare_alloc_ptr = nilfs_bmap_prepare_alloc_v,
.bpop_commit_alloc_ptr = nilfs_bmap_commit_alloc_v,
.bpop_abort_alloc_ptr = nilfs_bmap_abort_alloc_v,
- .bpop_prepare_start_ptr = nilfs_bmap_prepare_start_v,
- .bpop_commit_start_ptr = nilfs_bmap_commit_start_v,
- .bpop_abort_start_ptr = nilfs_bmap_abort_start_v,
.bpop_prepare_end_ptr = nilfs_bmap_prepare_end_v,
.bpop_commit_end_ptr = nilfs_bmap_commit_end_vmdt,
.bpop_abort_end_ptr = nilfs_bmap_abort_end_v,
@@ -664,9 +650,6 @@ static const struct nilfs_bmap_ptr_operations nilfs_bmap_ptr_ops_p = {
.bpop_prepare_alloc_ptr = nilfs_bmap_prepare_alloc_p,
.bpop_commit_alloc_ptr = nilfs_bmap_commit_alloc_p,
.bpop_abort_alloc_ptr = nilfs_bmap_abort_alloc_p,
- .bpop_prepare_start_ptr = NULL,
- .bpop_commit_start_ptr = NULL,
- .bpop_abort_start_ptr = NULL,
.bpop_prepare_end_ptr = NULL,
.bpop_commit_end_ptr = NULL,
.bpop_abort_end_ptr = NULL,
@@ -678,9 +661,6 @@ static const struct nilfs_bmap_ptr_operations nilfs_bmap_ptr_ops_gc = {
.bpop_prepare_alloc_ptr = NULL,
.bpop_commit_alloc_ptr = NULL,
.bpop_abort_alloc_ptr = NULL,
- .bpop_prepare_start_ptr = NULL,
- .bpop_commit_start_ptr = NULL,
- .bpop_abort_start_ptr = NULL,
.bpop_prepare_end_ptr = NULL,
.bpop_commit_end_ptr = NULL,
.bpop_abort_end_ptr = NULL,