summaryrefslogtreecommitdiffstats
path: root/fs/nilfs2/bmap.c
diff options
context:
space:
mode:
authorRyusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>2010-08-30 23:42:18 +0900
committerRyusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>2010-10-23 09:24:37 +0900
commita8070dd365dd995f6139a2fc3aeee10159bdcc45 (patch)
tree11a16157b10ed0b6d3f773ded6bd5b82c3f8c4bc /fs/nilfs2/bmap.c
parentadbb39b5485b72dca963a2bc9b1b22bfc19d4967 (diff)
downloadop-kernel-dev-a8070dd365dd995f6139a2fc3aeee10159bdcc45.zip
op-kernel-dev-a8070dd365dd995f6139a2fc3aeee10159bdcc45.tar.gz
nilfs2: add routines to save and restore bmap state
This adds routines to save and restore the state of bmap structure. The bmap state is stored in a given nilfs_bmap_store object. These routines will be used to roll back the state of dat inode without using gcdat inode. Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
Diffstat (limited to 'fs/nilfs2/bmap.c')
-rw-r--r--fs/nilfs2/bmap.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/fs/nilfs2/bmap.c b/fs/nilfs2/bmap.c
index 3dbdc1d..0024440 100644
--- a/fs/nilfs2/bmap.c
+++ b/fs/nilfs2/bmap.c
@@ -548,3 +548,21 @@ void nilfs_bmap_commit_gcdat(struct nilfs_bmap *gcbmap, struct nilfs_bmap *bmap)
lockdep_set_class(&bmap->b_sem, &nilfs_bmap_dat_lock_key);
bmap->b_inode = &NILFS_BMAP_I(bmap)->vfs_inode;
}
+
+void nilfs_bmap_save(const struct nilfs_bmap *bmap,
+ struct nilfs_bmap_store *store)
+{
+ memcpy(store->data, bmap->b_u.u_data, sizeof(store->data));
+ store->last_allocated_key = bmap->b_last_allocated_key;
+ store->last_allocated_ptr = bmap->b_last_allocated_ptr;
+ store->state = bmap->b_state;
+}
+
+void nilfs_bmap_restore(struct nilfs_bmap *bmap,
+ const struct nilfs_bmap_store *store)
+{
+ memcpy(bmap->b_u.u_data, store->data, sizeof(store->data));
+ bmap->b_last_allocated_key = store->last_allocated_key;
+ bmap->b_last_allocated_ptr = store->last_allocated_ptr;
+ bmap->b_state = store->state;
+}
OpenPOWER on IntegriCloud