diff options
author | Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp> | 2009-08-15 04:22:13 -0400 |
---|---|---|
committer | Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp> | 2009-09-14 05:27:15 -0400 |
commit | bd8169efae8bdd292675c386010f6b35f0771057 (patch) | |
tree | aea73bd670910874eb78fd1f2c8ce8b2a494dfcb /fs/nilfs2/bmap.c | |
parent | 7a102b09232be1ad7c180dfd1f46c7aa95dff1e0 (diff) |
nilfs2: add update functions of virtual block address to dat
This is a preparation for the successive cleanup ("nilfs2: allow btree
to directly call dat operations").
This adds functions bundling a few operations to change an entry of
virtual block address on the dat file.
Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
Diffstat (limited to 'fs/nilfs2/bmap.c')
-rw-r--r-- | fs/nilfs2/bmap.c | 27 |
1 files changed, 7 insertions, 20 deletions
diff --git a/fs/nilfs2/bmap.c b/fs/nilfs2/bmap.c index 99d58a028b94..13e95a907ece 100644 --- a/fs/nilfs2/bmap.c +++ b/fs/nilfs2/bmap.c | |||
@@ -533,38 +533,25 @@ int nilfs_bmap_prepare_update_v(struct nilfs_bmap *bmap, | |||
533 | union nilfs_bmap_ptr_req *oldreq, | 533 | union nilfs_bmap_ptr_req *oldreq, |
534 | union nilfs_bmap_ptr_req *newreq) | 534 | union nilfs_bmap_ptr_req *newreq) |
535 | { | 535 | { |
536 | struct inode *dat = nilfs_bmap_get_dat(bmap); | 536 | return nilfs_dat_prepare_update(nilfs_bmap_get_dat(bmap), |
537 | int ret; | 537 | &oldreq->bpr_req, &newreq->bpr_req); |
538 | |||
539 | ret = nilfs_dat_prepare_end(dat, &oldreq->bpr_req); | ||
540 | if (ret < 0) | ||
541 | return ret; | ||
542 | ret = nilfs_dat_prepare_alloc(dat, &newreq->bpr_req); | ||
543 | if (ret < 0) | ||
544 | nilfs_dat_abort_end(dat, &oldreq->bpr_req); | ||
545 | |||
546 | return ret; | ||
547 | } | 538 | } |
548 | 539 | ||
549 | void nilfs_bmap_commit_update_v(struct nilfs_bmap *bmap, | 540 | void nilfs_bmap_commit_update_v(struct nilfs_bmap *bmap, |
550 | union nilfs_bmap_ptr_req *oldreq, | 541 | union nilfs_bmap_ptr_req *oldreq, |
551 | union nilfs_bmap_ptr_req *newreq) | 542 | union nilfs_bmap_ptr_req *newreq) |
552 | { | 543 | { |
553 | struct inode *dat = nilfs_bmap_get_dat(bmap); | 544 | nilfs_dat_commit_update(nilfs_bmap_get_dat(bmap), |
554 | 545 | &oldreq->bpr_req, &newreq->bpr_req, | |
555 | nilfs_dat_commit_end(dat, &oldreq->bpr_req, | 546 | bmap->b_ptr_type == NILFS_BMAP_PTR_VS); |
556 | bmap->b_ptr_type == NILFS_BMAP_PTR_VS); | ||
557 | nilfs_dat_commit_alloc(dat, &newreq->bpr_req); | ||
558 | } | 547 | } |
559 | 548 | ||
560 | void nilfs_bmap_abort_update_v(struct nilfs_bmap *bmap, | 549 | void nilfs_bmap_abort_update_v(struct nilfs_bmap *bmap, |
561 | union nilfs_bmap_ptr_req *oldreq, | 550 | union nilfs_bmap_ptr_req *oldreq, |
562 | union nilfs_bmap_ptr_req *newreq) | 551 | union nilfs_bmap_ptr_req *newreq) |
563 | { | 552 | { |
564 | struct inode *dat = nilfs_bmap_get_dat(bmap); | 553 | nilfs_dat_abort_update(nilfs_bmap_get_dat(bmap), |
565 | 554 | &oldreq->bpr_req, &newreq->bpr_req); | |
566 | nilfs_dat_abort_end(dat, &oldreq->bpr_req); | ||
567 | nilfs_dat_abort_alloc(dat, &newreq->bpr_req); | ||
568 | } | 555 | } |
569 | 556 | ||
570 | static struct lock_class_key nilfs_bmap_dat_lock_key; | 557 | static struct lock_class_key nilfs_bmap_dat_lock_key; |