1 // SPDX-License-Identifier: GPL-2.0
5 * Copyright (c) 2012 Samsung Electronics Co., Ltd.
6 * http://www.samsung.com/
8 #include <asm/unaligned.h>
10 #include <linux/f2fs_fs.h>
11 #include <linux/sched/mm.h>
17 * Roll forward recovery scenarios.
19 * [Term] F: fsync_mark, D: dentry_mark
21 * 1. inode(x) | CP | inode(x) | dnode(F)
22 * -> Update the latest inode(x).
24 * 2. inode(x) | CP | inode(F) | dnode(F)
27 * 3. inode(x) | CP | dnode(F) | inode(x)
28 * -> Recover to the latest dnode(F), and drop the last inode(x)
30 * 4. inode(x) | CP | dnode(F) | inode(F)
33 * 5. CP | inode(x) | dnode(F)
34 * -> The inode(DF) was missing. Should drop this dnode(F).
36 * 6. CP | inode(DF) | dnode(F)
39 * 7. CP | dnode(F) | inode(DF)
40 * -> If f2fs_iget fails, then goto next to find inode(DF).
42 * 8. CP | dnode(F) | inode(x)
43 * -> If f2fs_iget fails, then goto next to find inode(DF).
44 * But it will fail due to no inode(DF).
47 static struct kmem_cache *fsync_entry_slab;
49 #if IS_ENABLED(CONFIG_UNICODE)
50 extern struct kmem_cache *f2fs_cf_name_slab;
53 bool f2fs_space_for_roll_forward(struct f2fs_sb_info *sbi)
55 s64 nalloc = percpu_counter_sum_positive(&sbi->alloc_valid_block_count);
57 if (sbi->last_valid_block_count + nalloc > sbi->user_block_count)
59 if (NM_I(sbi)->max_rf_node_blocks &&
60 percpu_counter_sum_positive(&sbi->rf_node_block_count) >=
61 NM_I(sbi)->max_rf_node_blocks)
66 static struct fsync_inode_entry *get_fsync_inode(struct list_head *head,
69 struct fsync_inode_entry *entry;
71 list_for_each_entry(entry, head, list)
72 if (entry->inode->i_ino == ino)
78 static struct fsync_inode_entry *add_fsync_inode(struct f2fs_sb_info *sbi,
79 struct list_head *head, nid_t ino, bool quota_inode)
82 struct fsync_inode_entry *entry;
85 inode = f2fs_iget_retry(sbi->sb, ino);
87 return ERR_CAST(inode);
89 err = f2fs_dquot_initialize(inode);
94 err = dquot_alloc_inode(inode);
99 entry = f2fs_kmem_cache_alloc(fsync_entry_slab,
100 GFP_F2FS_ZERO, true, NULL);
101 entry->inode = inode;
102 list_add_tail(&entry->list, head);
110 static void del_fsync_inode(struct fsync_inode_entry *entry, int drop)
113 /* inode should not be recovered, drop it */
114 f2fs_inode_synced(entry->inode);
117 list_del(&entry->list);
118 kmem_cache_free(fsync_entry_slab, entry);
121 static int init_recovered_filename(const struct inode *dir,
122 struct f2fs_inode *raw_inode,
123 struct f2fs_filename *fname,
124 struct qstr *usr_fname)
128 memset(fname, 0, sizeof(*fname));
129 fname->disk_name.len = le32_to_cpu(raw_inode->i_namelen);
130 fname->disk_name.name = raw_inode->i_name;
132 if (WARN_ON(fname->disk_name.len > F2FS_NAME_LEN))
133 return -ENAMETOOLONG;
135 if (!IS_ENCRYPTED(dir)) {
136 usr_fname->name = fname->disk_name.name;
137 usr_fname->len = fname->disk_name.len;
138 fname->usr_fname = usr_fname;
141 /* Compute the hash of the filename */
142 if (IS_ENCRYPTED(dir) && IS_CASEFOLDED(dir)) {
144 * In this case the hash isn't computable without the key, so it
147 if (fname->disk_name.len + sizeof(f2fs_hash_t) > F2FS_NAME_LEN)
149 fname->hash = get_unaligned((f2fs_hash_t *)
150 &raw_inode->i_name[fname->disk_name.len]);
151 } else if (IS_CASEFOLDED(dir)) {
152 err = f2fs_init_casefolded_name(dir, fname);
155 f2fs_hash_filename(dir, fname);
156 #if IS_ENABLED(CONFIG_UNICODE)
157 /* Case-sensitive match is fine for recovery */
158 kmem_cache_free(f2fs_cf_name_slab, fname->cf_name.name);
159 fname->cf_name.name = NULL;
162 f2fs_hash_filename(dir, fname);
167 static int recover_dentry(struct inode *inode, struct page *ipage,
168 struct list_head *dir_list)
170 struct f2fs_inode *raw_inode = F2FS_INODE(ipage);
171 nid_t pino = le32_to_cpu(raw_inode->i_pino);
172 struct f2fs_dir_entry *de;
173 struct f2fs_filename fname;
174 struct qstr usr_fname;
176 struct inode *dir, *einode;
177 struct fsync_inode_entry *entry;
181 entry = get_fsync_inode(dir_list, pino);
183 entry = add_fsync_inode(F2FS_I_SB(inode), dir_list,
186 dir = ERR_CAST(entry);
187 err = PTR_ERR(entry);
193 err = init_recovered_filename(dir, raw_inode, &fname, &usr_fname);
197 de = __f2fs_find_entry(dir, &fname, &page);
198 if (de && inode->i_ino == le32_to_cpu(de->ino))
202 einode = f2fs_iget_retry(inode->i_sb, le32_to_cpu(de->ino));
203 if (IS_ERR(einode)) {
205 err = PTR_ERR(einode);
211 err = f2fs_dquot_initialize(einode);
217 err = f2fs_acquire_orphan_inode(F2FS_I_SB(inode));
222 f2fs_delete_entry(de, page, dir, einode);
225 } else if (IS_ERR(page)) {
228 err = f2fs_add_dentry(dir, &fname, inode,
229 inode->i_ino, inode->i_mode);
236 f2fs_put_page(page, 0);
238 if (file_enc_name(inode))
239 name = "<encrypted>";
241 name = raw_inode->i_name;
242 f2fs_notice(F2FS_I_SB(inode), "%s: ino = %x, name = %s, dir = %lx, err = %d",
243 __func__, ino_of_node(ipage), name,
244 IS_ERR(dir) ? 0 : dir->i_ino, err);
248 static int recover_quota_data(struct inode *inode, struct page *page)
250 struct f2fs_inode *raw = F2FS_INODE(page);
252 uid_t i_uid = le32_to_cpu(raw->i_uid);
253 gid_t i_gid = le32_to_cpu(raw->i_gid);
256 memset(&attr, 0, sizeof(attr));
258 attr.ia_uid = make_kuid(inode->i_sb->s_user_ns, i_uid);
259 attr.ia_gid = make_kgid(inode->i_sb->s_user_ns, i_gid);
261 if (!uid_eq(attr.ia_uid, inode->i_uid))
262 attr.ia_valid |= ATTR_UID;
263 if (!gid_eq(attr.ia_gid, inode->i_gid))
264 attr.ia_valid |= ATTR_GID;
269 err = dquot_transfer(inode, &attr);
271 set_sbi_flag(F2FS_I_SB(inode), SBI_QUOTA_NEED_REPAIR);
275 static void recover_inline_flags(struct inode *inode, struct f2fs_inode *ri)
277 if (ri->i_inline & F2FS_PIN_FILE)
278 set_inode_flag(inode, FI_PIN_FILE);
280 clear_inode_flag(inode, FI_PIN_FILE);
281 if (ri->i_inline & F2FS_DATA_EXIST)
282 set_inode_flag(inode, FI_DATA_EXIST);
284 clear_inode_flag(inode, FI_DATA_EXIST);
287 static int recover_inode(struct inode *inode, struct page *page)
289 struct f2fs_inode *raw = F2FS_INODE(page);
293 inode->i_mode = le16_to_cpu(raw->i_mode);
295 err = recover_quota_data(inode, page);
299 i_uid_write(inode, le32_to_cpu(raw->i_uid));
300 i_gid_write(inode, le32_to_cpu(raw->i_gid));
302 if (raw->i_inline & F2FS_EXTRA_ATTR) {
303 if (f2fs_sb_has_project_quota(F2FS_I_SB(inode)) &&
304 F2FS_FITS_IN_INODE(raw, le16_to_cpu(raw->i_extra_isize),
309 i_projid = (projid_t)le32_to_cpu(raw->i_projid);
310 kprojid = make_kprojid(&init_user_ns, i_projid);
312 if (!projid_eq(kprojid, F2FS_I(inode)->i_projid)) {
313 err = f2fs_transfer_project_quota(inode,
317 F2FS_I(inode)->i_projid = kprojid;
322 f2fs_i_size_write(inode, le64_to_cpu(raw->i_size));
323 inode->i_atime.tv_sec = le64_to_cpu(raw->i_atime);
324 inode->i_ctime.tv_sec = le64_to_cpu(raw->i_ctime);
325 inode->i_mtime.tv_sec = le64_to_cpu(raw->i_mtime);
326 inode->i_atime.tv_nsec = le32_to_cpu(raw->i_atime_nsec);
327 inode->i_ctime.tv_nsec = le32_to_cpu(raw->i_ctime_nsec);
328 inode->i_mtime.tv_nsec = le32_to_cpu(raw->i_mtime_nsec);
330 F2FS_I(inode)->i_advise = raw->i_advise;
331 F2FS_I(inode)->i_flags = le32_to_cpu(raw->i_flags);
332 f2fs_set_inode_flags(inode);
333 F2FS_I(inode)->i_gc_failures[GC_FAILURE_PIN] =
334 le16_to_cpu(raw->i_gc_failures);
336 recover_inline_flags(inode, raw);
338 f2fs_mark_inode_dirty_sync(inode, true);
340 if (file_enc_name(inode))
341 name = "<encrypted>";
343 name = F2FS_INODE(page)->i_name;
345 f2fs_notice(F2FS_I_SB(inode), "recover_inode: ino = %x, name = %s, inline = %x",
346 ino_of_node(page), name, raw->i_inline);
350 static unsigned int adjust_por_ra_blocks(struct f2fs_sb_info *sbi,
351 unsigned int ra_blocks, unsigned int blkaddr,
352 unsigned int next_blkaddr)
354 if (blkaddr + 1 == next_blkaddr)
355 ra_blocks = min_t(unsigned int, RECOVERY_MAX_RA_BLOCKS,
357 else if (next_blkaddr % sbi->blocks_per_seg)
358 ra_blocks = max_t(unsigned int, RECOVERY_MIN_RA_BLOCKS,
363 static int find_fsync_dnodes(struct f2fs_sb_info *sbi, struct list_head *head,
366 struct curseg_info *curseg;
367 struct page *page = NULL;
369 unsigned int loop_cnt = 0;
370 unsigned int ra_blocks = RECOVERY_MAX_RA_BLOCKS;
371 unsigned int free_blocks = MAIN_SEGS(sbi) * sbi->blocks_per_seg -
372 valid_user_blocks(sbi);
375 /* get node pages in the current segment */
376 curseg = CURSEG_I(sbi, CURSEG_WARM_NODE);
377 blkaddr = NEXT_FREE_BLKADDR(sbi, curseg);
380 struct fsync_inode_entry *entry;
382 if (!f2fs_is_valid_blkaddr(sbi, blkaddr, META_POR))
385 page = f2fs_get_tmp_page(sbi, blkaddr);
391 if (!is_recoverable_dnode(page)) {
392 f2fs_put_page(page, 1);
396 if (!is_fsync_dnode(page))
399 entry = get_fsync_inode(head, ino_of_node(page));
401 bool quota_inode = false;
404 IS_INODE(page) && is_dent_dnode(page)) {
405 err = f2fs_recover_inode_page(sbi, page);
407 f2fs_put_page(page, 1);
414 * CP | dnode(F) | inode(DF)
415 * For this case, we should not give up now.
417 entry = add_fsync_inode(sbi, head, ino_of_node(page),
420 err = PTR_ERR(entry);
421 if (err == -ENOENT) {
425 f2fs_put_page(page, 1);
429 entry->blkaddr = blkaddr;
431 if (IS_INODE(page) && is_dent_dnode(page))
432 entry->last_dentry = blkaddr;
434 /* sanity check in order to detect looped node chain */
435 if (++loop_cnt >= free_blocks ||
436 blkaddr == next_blkaddr_of_node(page)) {
437 f2fs_notice(sbi, "%s: detect looped node chain, blkaddr:%u, next:%u",
439 next_blkaddr_of_node(page));
440 f2fs_put_page(page, 1);
445 ra_blocks = adjust_por_ra_blocks(sbi, ra_blocks, blkaddr,
446 next_blkaddr_of_node(page));
448 /* check next segment */
449 blkaddr = next_blkaddr_of_node(page);
450 f2fs_put_page(page, 1);
452 f2fs_ra_meta_pages_cond(sbi, blkaddr, ra_blocks);
457 static void destroy_fsync_dnodes(struct list_head *head, int drop)
459 struct fsync_inode_entry *entry, *tmp;
461 list_for_each_entry_safe(entry, tmp, head, list)
462 del_fsync_inode(entry, drop);
465 static int check_index_in_prev_nodes(struct f2fs_sb_info *sbi,
466 block_t blkaddr, struct dnode_of_data *dn)
468 struct seg_entry *sentry;
469 unsigned int segno = GET_SEGNO(sbi, blkaddr);
470 unsigned short blkoff = GET_BLKOFF_FROM_SEG0(sbi, blkaddr);
471 struct f2fs_summary_block *sum_node;
472 struct f2fs_summary sum;
473 struct page *sum_page, *node_page;
474 struct dnode_of_data tdn = *dn;
481 sentry = get_seg_entry(sbi, segno);
482 if (!f2fs_test_bit(blkoff, sentry->cur_valid_map))
485 /* Get the previous summary */
486 for (i = CURSEG_HOT_DATA; i <= CURSEG_COLD_DATA; i++) {
487 struct curseg_info *curseg = CURSEG_I(sbi, i);
489 if (curseg->segno == segno) {
490 sum = curseg->sum_blk->entries[blkoff];
495 sum_page = f2fs_get_sum_page(sbi, segno);
496 if (IS_ERR(sum_page))
497 return PTR_ERR(sum_page);
498 sum_node = (struct f2fs_summary_block *)page_address(sum_page);
499 sum = sum_node->entries[blkoff];
500 f2fs_put_page(sum_page, 1);
502 /* Use the locked dnode page and inode */
503 nid = le32_to_cpu(sum.nid);
504 if (dn->inode->i_ino == nid) {
506 if (!dn->inode_page_locked)
507 lock_page(dn->inode_page);
508 tdn.node_page = dn->inode_page;
509 tdn.ofs_in_node = le16_to_cpu(sum.ofs_in_node);
511 } else if (dn->nid == nid) {
512 tdn.ofs_in_node = le16_to_cpu(sum.ofs_in_node);
516 /* Get the node page */
517 node_page = f2fs_get_node_page(sbi, nid);
518 if (IS_ERR(node_page))
519 return PTR_ERR(node_page);
521 offset = ofs_of_node(node_page);
522 ino = ino_of_node(node_page);
523 f2fs_put_page(node_page, 1);
525 if (ino != dn->inode->i_ino) {
528 /* Deallocate previous index in the node page */
529 inode = f2fs_iget_retry(sbi->sb, ino);
531 return PTR_ERR(inode);
533 ret = f2fs_dquot_initialize(inode);
542 bidx = f2fs_start_bidx_of_node(offset, inode) +
543 le16_to_cpu(sum.ofs_in_node);
546 * if inode page is locked, unlock temporarily, but its reference
549 if (ino == dn->inode->i_ino && dn->inode_page_locked)
550 unlock_page(dn->inode_page);
552 set_new_dnode(&tdn, inode, NULL, NULL, 0);
553 if (f2fs_get_dnode_of_data(&tdn, bidx, LOOKUP_NODE))
556 if (tdn.data_blkaddr == blkaddr)
557 f2fs_truncate_data_blocks_range(&tdn, 1);
559 f2fs_put_dnode(&tdn);
561 if (ino != dn->inode->i_ino)
563 else if (dn->inode_page_locked)
564 lock_page(dn->inode_page);
568 if (f2fs_data_blkaddr(&tdn) == blkaddr)
569 f2fs_truncate_data_blocks_range(&tdn, 1);
570 if (dn->inode->i_ino == nid && !dn->inode_page_locked)
571 unlock_page(dn->inode_page);
575 static int do_recover_data(struct f2fs_sb_info *sbi, struct inode *inode,
578 struct dnode_of_data dn;
580 unsigned int start, end;
581 int err = 0, recovered = 0;
583 /* step 1: recover xattr */
584 if (IS_INODE(page)) {
585 err = f2fs_recover_inline_xattr(inode, page);
588 } else if (f2fs_has_xattr_block(ofs_of_node(page))) {
589 err = f2fs_recover_xattr_data(inode, page);
595 /* step 2: recover inline data */
596 err = f2fs_recover_inline_data(inode, page);
603 /* step 3: recover data indices */
604 start = f2fs_start_bidx_of_node(ofs_of_node(page), inode);
605 end = start + ADDRS_PER_PAGE(page, inode);
607 set_new_dnode(&dn, inode, NULL, NULL, 0);
609 err = f2fs_get_dnode_of_data(&dn, start, ALLOC_NODE);
611 if (err == -ENOMEM) {
612 memalloc_retry_wait(GFP_NOFS);
618 f2fs_wait_on_page_writeback(dn.node_page, NODE, true, true);
620 err = f2fs_get_node_info(sbi, dn.nid, &ni, false);
624 f2fs_bug_on(sbi, ni.ino != ino_of_node(page));
626 if (ofs_of_node(dn.node_page) != ofs_of_node(page)) {
627 f2fs_warn(sbi, "Inconsistent ofs_of_node, ino:%lu, ofs:%u, %u",
628 inode->i_ino, ofs_of_node(dn.node_page),
634 for (; start < end; start++, dn.ofs_in_node++) {
637 src = f2fs_data_blkaddr(&dn);
638 dest = data_blkaddr(dn.inode, page, dn.ofs_in_node);
640 if (__is_valid_data_blkaddr(src) &&
641 !f2fs_is_valid_blkaddr(sbi, src, META_POR)) {
646 if (__is_valid_data_blkaddr(dest) &&
647 !f2fs_is_valid_blkaddr(sbi, dest, META_POR)) {
652 /* skip recovering if dest is the same as src */
656 /* dest is invalid, just invalidate src block */
657 if (dest == NULL_ADDR) {
658 f2fs_truncate_data_blocks_range(&dn, 1);
662 if (!file_keep_isize(inode) &&
663 (i_size_read(inode) <= ((loff_t)start << PAGE_SHIFT)))
664 f2fs_i_size_write(inode,
665 (loff_t)(start + 1) << PAGE_SHIFT);
668 * dest is reserved block, invalidate src block
669 * and then reserve one new block in dnode page.
671 if (dest == NEW_ADDR) {
672 f2fs_truncate_data_blocks_range(&dn, 1);
673 f2fs_reserve_new_block(&dn);
677 /* dest is valid block, try to recover from src to dest */
678 if (f2fs_is_valid_blkaddr(sbi, dest, META_POR)) {
680 if (src == NULL_ADDR) {
681 err = f2fs_reserve_new_block(&dn);
683 IS_ENABLED(CONFIG_F2FS_FAULT_INJECTION))
684 err = f2fs_reserve_new_block(&dn);
685 /* We should not get -ENOSPC */
686 f2fs_bug_on(sbi, err);
691 /* Check the previous node page having this index */
692 err = check_index_in_prev_nodes(sbi, dest, &dn);
694 if (err == -ENOMEM) {
695 memalloc_retry_wait(GFP_NOFS);
701 /* write dummy data page */
702 f2fs_replace_block(sbi, &dn, src, dest,
703 ni.version, false, false);
708 copy_node_footer(dn.node_page, page);
709 fill_node_footer(dn.node_page, dn.nid, ni.ino,
710 ofs_of_node(page), false);
711 set_page_dirty(dn.node_page);
715 f2fs_notice(sbi, "recover_data: ino = %lx (i_size: %s) recovered = %d, err = %d",
716 inode->i_ino, file_keep_isize(inode) ? "keep" : "recover",
721 static int recover_data(struct f2fs_sb_info *sbi, struct list_head *inode_list,
722 struct list_head *tmp_inode_list, struct list_head *dir_list)
724 struct curseg_info *curseg;
725 struct page *page = NULL;
728 unsigned int ra_blocks = RECOVERY_MAX_RA_BLOCKS;
730 /* get node pages in the current segment */
731 curseg = CURSEG_I(sbi, CURSEG_WARM_NODE);
732 blkaddr = NEXT_FREE_BLKADDR(sbi, curseg);
735 struct fsync_inode_entry *entry;
737 if (!f2fs_is_valid_blkaddr(sbi, blkaddr, META_POR))
740 page = f2fs_get_tmp_page(sbi, blkaddr);
746 if (!is_recoverable_dnode(page)) {
747 f2fs_put_page(page, 1);
751 entry = get_fsync_inode(inode_list, ino_of_node(page));
755 * inode(x) | CP | inode(x) | dnode(F)
756 * In this case, we can lose the latest inode(x).
757 * So, call recover_inode for the inode update.
759 if (IS_INODE(page)) {
760 err = recover_inode(entry->inode, page);
762 f2fs_put_page(page, 1);
766 if (entry->last_dentry == blkaddr) {
767 err = recover_dentry(entry->inode, page, dir_list);
769 f2fs_put_page(page, 1);
773 err = do_recover_data(sbi, entry->inode, page);
775 f2fs_put_page(page, 1);
779 if (entry->blkaddr == blkaddr)
780 list_move_tail(&entry->list, tmp_inode_list);
782 ra_blocks = adjust_por_ra_blocks(sbi, ra_blocks, blkaddr,
783 next_blkaddr_of_node(page));
785 /* check next segment */
786 blkaddr = next_blkaddr_of_node(page);
787 f2fs_put_page(page, 1);
789 f2fs_ra_meta_pages_cond(sbi, blkaddr, ra_blocks);
792 f2fs_allocate_new_segments(sbi);
796 int f2fs_recover_fsync_data(struct f2fs_sb_info *sbi, bool check_only)
798 struct list_head inode_list, tmp_inode_list;
799 struct list_head dir_list;
802 unsigned long s_flags = sbi->sb->s_flags;
803 bool need_writecp = false;
804 bool fix_curseg_write_pointer = false;
809 if (s_flags & SB_RDONLY) {
810 f2fs_info(sbi, "recover fsync data on readonly fs");
811 sbi->sb->s_flags &= ~SB_RDONLY;
815 /* Turn on quotas so that they are updated correctly */
816 quota_enabled = f2fs_enable_quota_files(sbi, s_flags & SB_RDONLY);
819 INIT_LIST_HEAD(&inode_list);
820 INIT_LIST_HEAD(&tmp_inode_list);
821 INIT_LIST_HEAD(&dir_list);
823 /* prevent checkpoint */
824 f2fs_down_write(&sbi->cp_global_sem);
826 /* step #1: find fsynced inode numbers */
827 err = find_fsync_dnodes(sbi, &inode_list, check_only);
828 if (err || list_empty(&inode_list))
838 /* step #2: recover data */
839 err = recover_data(sbi, &inode_list, &tmp_inode_list, &dir_list);
841 f2fs_bug_on(sbi, !list_empty(&inode_list));
843 f2fs_bug_on(sbi, sbi->sb->s_flags & SB_ACTIVE);
845 fix_curseg_write_pointer = !check_only || list_empty(&inode_list);
847 destroy_fsync_dnodes(&inode_list, err);
848 destroy_fsync_dnodes(&tmp_inode_list, err);
850 /* truncate meta pages to be used by the recovery */
851 truncate_inode_pages_range(META_MAPPING(sbi),
852 (loff_t)MAIN_BLKADDR(sbi) << PAGE_SHIFT, -1);
855 truncate_inode_pages_final(NODE_MAPPING(sbi));
856 truncate_inode_pages_final(META_MAPPING(sbi));
860 * If fsync data succeeds or there is no fsync data to recover,
861 * and the f2fs is not read only, check and fix zoned block devices'
862 * write pointer consistency.
864 if (!err && fix_curseg_write_pointer && !f2fs_readonly(sbi->sb) &&
865 f2fs_sb_has_blkzoned(sbi)) {
866 err = f2fs_fix_curseg_write_pointer(sbi);
871 clear_sbi_flag(sbi, SBI_POR_DOING);
873 f2fs_up_write(&sbi->cp_global_sem);
875 /* let's drop all the directory inodes for clean checkpoint */
876 destroy_fsync_dnodes(&dir_list, err);
879 set_sbi_flag(sbi, SBI_IS_RECOVERED);
882 struct cp_control cpc = {
883 .reason = CP_RECOVERY,
885 err = f2fs_write_checkpoint(sbi, &cpc);
890 /* Turn quotas off */
892 f2fs_quota_off_umount(sbi->sb);
894 sbi->sb->s_flags = s_flags; /* Restore SB_RDONLY status */
896 return ret ? ret : err;
899 int __init f2fs_create_recovery_cache(void)
901 fsync_entry_slab = f2fs_kmem_cache_create("f2fs_fsync_inode_entry",
902 sizeof(struct fsync_inode_entry));
903 if (!fsync_entry_slab)
908 void f2fs_destroy_recovery_cache(void)
910 kmem_cache_destroy(fsync_entry_slab);