checkpoint.c (188933ac139a6f8ab06cad369bd0200af947b00d) checkpoint.c (551414861fbd494d58d50f4750d1d1b7f42b6df1)
1/*
2 * fs/f2fs/checkpoint.c
3 *
4 * Copyright (c) 2012 Samsung Electronics Co., Ltd.
5 * http://www.samsung.com/
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as

--- 262 unchanged lines hidden (view full) ---

271 if (!PageDirty(page)) {
272 /* someone wrote it for us */
273 goto continue_unlock;
274 }
275
276 if (!clear_page_dirty_for_io(page))
277 goto continue_unlock;
278
1/*
2 * fs/f2fs/checkpoint.c
3 *
4 * Copyright (c) 2012 Samsung Electronics Co., Ltd.
5 * http://www.samsung.com/
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as

--- 262 unchanged lines hidden (view full) ---

271 if (!PageDirty(page)) {
272 /* someone wrote it for us */
273 goto continue_unlock;
274 }
275
276 if (!clear_page_dirty_for_io(page))
277 goto continue_unlock;
278
279 if (f2fs_write_meta_page(page, &wbc)) {
279 if (mapping->a_ops->writepage(page, &wbc)) {
280 unlock_page(page);
281 break;
282 }
283 nwritten++;
284 if (unlikely(nwritten >= nr_to_write))
285 break;
286 }
287 pagevec_release(&pvec);

--- 178 unchanged lines hidden (view full) ---

466{
467 block_t start_blk, orphan_blkaddr, i, j;
468
469 if (!is_set_ckpt_flags(F2FS_CKPT(sbi), CP_ORPHAN_PRESENT_FLAG))
470 return;
471
472 set_sbi_flag(sbi, SBI_POR_DOING);
473
280 unlock_page(page);
281 break;
282 }
283 nwritten++;
284 if (unlikely(nwritten >= nr_to_write))
285 break;
286 }
287 pagevec_release(&pvec);

--- 178 unchanged lines hidden (view full) ---

466{
467 block_t start_blk, orphan_blkaddr, i, j;
468
469 if (!is_set_ckpt_flags(F2FS_CKPT(sbi), CP_ORPHAN_PRESENT_FLAG))
470 return;
471
472 set_sbi_flag(sbi, SBI_POR_DOING);
473
474 start_blk = __start_cp_addr(sbi) + 1 +
475 le32_to_cpu(F2FS_RAW_SUPER(sbi)->cp_payload);
474 start_blk = __start_cp_addr(sbi) + 1 + __cp_payload(sbi);
476 orphan_blkaddr = __start_sum_addr(sbi) - 1;
477
478 ra_meta_pages(sbi, start_blk, orphan_blkaddr, META_CP);
479
480 for (i = 0; i < orphan_blkaddr; i++) {
481 struct page *page = get_meta_page(sbi, start_blk + i);
482 struct f2fs_orphan_block *orphan_blk;
483

--- 126 unchanged lines hidden (view full) ---

610int get_valid_checkpoint(struct f2fs_sb_info *sbi)
611{
612 struct f2fs_checkpoint *cp_block;
613 struct f2fs_super_block *fsb = sbi->raw_super;
614 struct page *cp1, *cp2, *cur_page;
615 unsigned long blk_size = sbi->blocksize;
616 unsigned long long cp1_version = 0, cp2_version = 0;
617 unsigned long long cp_start_blk_no;
475 orphan_blkaddr = __start_sum_addr(sbi) - 1;
476
477 ra_meta_pages(sbi, start_blk, orphan_blkaddr, META_CP);
478
479 for (i = 0; i < orphan_blkaddr; i++) {
480 struct page *page = get_meta_page(sbi, start_blk + i);
481 struct f2fs_orphan_block *orphan_blk;
482

--- 126 unchanged lines hidden (view full) ---

609int get_valid_checkpoint(struct f2fs_sb_info *sbi)
610{
611 struct f2fs_checkpoint *cp_block;
612 struct f2fs_super_block *fsb = sbi->raw_super;
613 struct page *cp1, *cp2, *cur_page;
614 unsigned long blk_size = sbi->blocksize;
615 unsigned long long cp1_version = 0, cp2_version = 0;
616 unsigned long long cp_start_blk_no;
618 unsigned int cp_blks = 1 + le32_to_cpu(F2FS_RAW_SUPER(sbi)->cp_payload);
617 unsigned int cp_blks = 1 + __cp_payload(sbi);
619 block_t cp_blk_no;
620 int i;
621
622 sbi->ckpt = kzalloc(cp_blks * blk_size, GFP_KERNEL);
623 if (!sbi->ckpt)
624 return -ENOMEM;
625 /*
626 * Finding out valid cp block involves read both

--- 252 unchanged lines hidden (view full) ---

879 unsigned long orphan_num = sbi->im[ORPHAN_INO].ino_num;
880 nid_t last_nid = nm_i->next_scan_nid;
881 block_t start_blk;
882 struct page *cp_page;
883 unsigned int data_sum_blocks, orphan_blocks;
884 __u32 crc32 = 0;
885 void *kaddr;
886 int i;
618 block_t cp_blk_no;
619 int i;
620
621 sbi->ckpt = kzalloc(cp_blks * blk_size, GFP_KERNEL);
622 if (!sbi->ckpt)
623 return -ENOMEM;
624 /*
625 * Finding out valid cp block involves read both

--- 252 unchanged lines hidden (view full) ---

878 unsigned long orphan_num = sbi->im[ORPHAN_INO].ino_num;
879 nid_t last_nid = nm_i->next_scan_nid;
880 block_t start_blk;
881 struct page *cp_page;
882 unsigned int data_sum_blocks, orphan_blocks;
883 __u32 crc32 = 0;
884 void *kaddr;
885 int i;
887 int cp_payload_blks = le32_to_cpu(F2FS_RAW_SUPER(sbi)->cp_payload);
886 int cp_payload_blks = __cp_payload(sbi);
888
889 /*
890 * This avoids to conduct wrong roll-forward operations and uses
891 * metapages, so should be called prior to sync_meta_pages below.
892 */
893 discard_next_dnode(sbi, NEXT_FREE_BLKADDR(sbi, curseg));
894
895 /* Flush all the NAT/SIT pages */

--- 240 unchanged lines hidden ---
887
888 /*
889 * This avoids to conduct wrong roll-forward operations and uses
890 * metapages, so should be called prior to sync_meta_pages below.
891 */
892 discard_next_dnode(sbi, NEXT_FREE_BLKADDR(sbi, curseg));
893
894 /* Flush all the NAT/SIT pages */

--- 240 unchanged lines hidden ---