diff options
author | Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp> | 2010-09-05 23:05:43 -0400 |
---|---|---|
committer | Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp> | 2010-10-22 20:24:37 -0400 |
commit | ebdfed4dc59d177cf26013a0c9b8ee9652e9a140 (patch) | |
tree | 6ef90f068ae41c55234181c93d8e30a303126c43 /fs/nilfs2/mdt.h | |
parent | a8070dd365dd995f6139a2fc3aeee10159bdcc45 (diff) |
nilfs2: add routines to roll back state of DAT file
This adds optional function to metadata files which makes a copy of
bmap, page caches, and b-tree node cache, and rolls back to the copy
as needed.
This enhancement is intended to displace gcdat inode that provides a
similar function in a different way.
In this patch, nilfs_shadow_map structure is added to store a copy of
the foregoing states. nilfs_mdt_setup_shadow_map relates this
structure to a metadata file. And, nilfs_mdt_save_to_shadow_map() and
nilfs_mdt_restore_from_shadow_map() provides save and restore
functions respectively. Finally, nilfs_mdt_clear_shadow_map() clears
states of nilfs_shadow_map.
The copy of b-tree node cache and page cache is made by duplicating
only dirty pages into corresponding caches in nilfs_shadow_map. Their
restoration is done by clearing dirty pages from original caches and
by copying dirty pages back from nilfs_shadow_map.
Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
Diffstat (limited to 'fs/nilfs2/mdt.h')
-rw-r--r-- | fs/nilfs2/mdt.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/fs/nilfs2/mdt.h b/fs/nilfs2/mdt.h index f44560224bd1..e7f0d158c527 100644 --- a/fs/nilfs2/mdt.h +++ b/fs/nilfs2/mdt.h | |||
@@ -28,6 +28,13 @@ | |||
28 | #include "nilfs.h" | 28 | #include "nilfs.h" |
29 | #include "page.h" | 29 | #include "page.h" |
30 | 30 | ||
31 | struct nilfs_shadow_map { | ||
32 | struct nilfs_bmap_store bmap_store; | ||
33 | struct address_space frozen_data; | ||
34 | struct address_space frozen_btnodes; | ||
35 | struct list_head frozen_buffers; | ||
36 | }; | ||
37 | |||
31 | /** | 38 | /** |
32 | * struct nilfs_mdt_info - on-memory private data of meta data files | 39 | * struct nilfs_mdt_info - on-memory private data of meta data files |
33 | * @mi_nilfs: back pointer to the_nilfs struct | 40 | * @mi_nilfs: back pointer to the_nilfs struct |
@@ -37,6 +44,7 @@ | |||
37 | * @mi_first_entry_offset: offset to the first entry | 44 | * @mi_first_entry_offset: offset to the first entry |
38 | * @mi_entries_per_block: number of entries in a block | 45 | * @mi_entries_per_block: number of entries in a block |
39 | * @mi_palloc_cache: persistent object allocator cache | 46 | * @mi_palloc_cache: persistent object allocator cache |
47 | * @mi_shadow: shadow of bmap and page caches | ||
40 | * @mi_blocks_per_group: number of blocks in a group | 48 | * @mi_blocks_per_group: number of blocks in a group |
41 | * @mi_blocks_per_desc_block: number of blocks per descriptor block | 49 | * @mi_blocks_per_desc_block: number of blocks per descriptor block |
42 | */ | 50 | */ |
@@ -48,6 +56,7 @@ struct nilfs_mdt_info { | |||
48 | unsigned mi_first_entry_offset; | 56 | unsigned mi_first_entry_offset; |
49 | unsigned long mi_entries_per_block; | 57 | unsigned long mi_entries_per_block; |
50 | struct nilfs_palloc_cache *mi_palloc_cache; | 58 | struct nilfs_palloc_cache *mi_palloc_cache; |
59 | struct nilfs_shadow_map *mi_shadow; | ||
51 | unsigned long mi_blocks_per_group; | 60 | unsigned long mi_blocks_per_group; |
52 | unsigned long mi_blocks_per_desc_block; | 61 | unsigned long mi_blocks_per_desc_block; |
53 | }; | 62 | }; |
@@ -86,6 +95,11 @@ void nilfs_mdt_destroy(struct inode *); | |||
86 | void nilfs_mdt_set_entry_size(struct inode *, unsigned, unsigned); | 95 | void nilfs_mdt_set_entry_size(struct inode *, unsigned, unsigned); |
87 | void nilfs_mdt_set_shadow(struct inode *, struct inode *); | 96 | void nilfs_mdt_set_shadow(struct inode *, struct inode *); |
88 | 97 | ||
98 | int nilfs_mdt_setup_shadow_map(struct inode *inode, | ||
99 | struct nilfs_shadow_map *shadow); | ||
100 | int nilfs_mdt_save_to_shadow_map(struct inode *inode); | ||
101 | void nilfs_mdt_restore_from_shadow_map(struct inode *inode); | ||
102 | void nilfs_mdt_clear_shadow_map(struct inode *inode); | ||
89 | 103 | ||
90 | #define nilfs_mdt_mark_buffer_dirty(bh) nilfs_mark_buffer_dirty(bh) | 104 | #define nilfs_mdt_mark_buffer_dirty(bh) nilfs_mark_buffer_dirty(bh) |
91 | 105 | ||