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/page.c | |
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/page.c')
-rw-r--r-- | fs/nilfs2/page.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/fs/nilfs2/page.c b/fs/nilfs2/page.c index aab11db2cb08..6384ac14c0c8 100644 --- a/fs/nilfs2/page.c +++ b/fs/nilfs2/page.c | |||
@@ -513,6 +513,31 @@ unsigned nilfs_page_count_clean_buffers(struct page *page, | |||
513 | } | 513 | } |
514 | return nc; | 514 | return nc; |
515 | } | 515 | } |
516 | |||
517 | void nilfs_mapping_init_once(struct address_space *mapping) | ||
518 | { | ||
519 | memset(mapping, 0, sizeof(*mapping)); | ||
520 | INIT_RADIX_TREE(&mapping->page_tree, GFP_ATOMIC); | ||
521 | spin_lock_init(&mapping->tree_lock); | ||
522 | INIT_LIST_HEAD(&mapping->private_list); | ||
523 | spin_lock_init(&mapping->private_lock); | ||
524 | |||
525 | spin_lock_init(&mapping->i_mmap_lock); | ||
526 | INIT_RAW_PRIO_TREE_ROOT(&mapping->i_mmap); | ||
527 | INIT_LIST_HEAD(&mapping->i_mmap_nonlinear); | ||
528 | } | ||
529 | |||
530 | void nilfs_mapping_init(struct address_space *mapping, | ||
531 | struct backing_dev_info *bdi, | ||
532 | const struct address_space_operations *aops) | ||
533 | { | ||
534 | mapping->host = NULL; | ||
535 | mapping->flags = 0; | ||
536 | mapping_set_gfp_mask(mapping, GFP_NOFS); | ||
537 | mapping->assoc_mapping = NULL; | ||
538 | mapping->backing_dev_info = bdi; | ||
539 | mapping->a_ops = aops; | ||
540 | } | ||
516 | 541 | ||
517 | /* | 542 | /* |
518 | * NILFS2 needs clear_page_dirty() in the following two cases: | 543 | * NILFS2 needs clear_page_dirty() in the following two cases: |