recovery.c (1d1df41c5a33359a00e919d54eaebfb789711fdc) recovery.c (5298d4bfe80f6ae6ae2777bcd1357b0022d98573)
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * fs/f2fs/recovery.c
4 *
5 * Copyright (c) 2012 Samsung Electronics Co., Ltd.
6 * http://www.samsung.com/
7 */
8#include <asm/unaligned.h>

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

41 *
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).
45 */
46
47static struct kmem_cache *fsync_entry_slab;
48
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * fs/f2fs/recovery.c
4 *
5 * Copyright (c) 2012 Samsung Electronics Co., Ltd.
6 * http://www.samsung.com/
7 */
8#include <asm/unaligned.h>

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

41 *
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).
45 */
46
47static struct kmem_cache *fsync_entry_slab;
48
49#ifdef CONFIG_UNICODE
49#if IS_ENABLED(CONFIG_UNICODE)
50extern struct kmem_cache *f2fs_cf_name_slab;
51#endif
52
53bool f2fs_space_for_roll_forward(struct f2fs_sb_info *sbi)
54{
55 s64 nalloc = percpu_counter_sum_positive(&sbi->alloc_valid_block_count);
56
57 if (sbi->last_valid_block_count + nalloc > sbi->user_block_count)

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

144 return -EINVAL;
145 fname->hash = get_unaligned((f2fs_hash_t *)
146 &raw_inode->i_name[fname->disk_name.len]);
147 } else if (IS_CASEFOLDED(dir)) {
148 err = f2fs_init_casefolded_name(dir, fname);
149 if (err)
150 return err;
151 f2fs_hash_filename(dir, fname);
50extern struct kmem_cache *f2fs_cf_name_slab;
51#endif
52
53bool f2fs_space_for_roll_forward(struct f2fs_sb_info *sbi)
54{
55 s64 nalloc = percpu_counter_sum_positive(&sbi->alloc_valid_block_count);
56
57 if (sbi->last_valid_block_count + nalloc > sbi->user_block_count)

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

144 return -EINVAL;
145 fname->hash = get_unaligned((f2fs_hash_t *)
146 &raw_inode->i_name[fname->disk_name.len]);
147 } else if (IS_CASEFOLDED(dir)) {
148 err = f2fs_init_casefolded_name(dir, fname);
149 if (err)
150 return err;
151 f2fs_hash_filename(dir, fname);
152#ifdef CONFIG_UNICODE
152#if IS_ENABLED(CONFIG_UNICODE)
153 /* Case-sensitive match is fine for recovery */
154 kmem_cache_free(f2fs_cf_name_slab, fname->cf_name.name);
155 fname->cf_name.name = NULL;
156#endif
157 } else {
158 f2fs_hash_filename(dir, fname);
159 }
160 return 0;

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

591 memalloc_retry_wait(GFP_NOFS);
592 goto retry_dn;
593 }
594 goto out;
595 }
596
597 f2fs_wait_on_page_writeback(dn.node_page, NODE, true, true);
598
153 /* Case-sensitive match is fine for recovery */
154 kmem_cache_free(f2fs_cf_name_slab, fname->cf_name.name);
155 fname->cf_name.name = NULL;
156#endif
157 } else {
158 f2fs_hash_filename(dir, fname);
159 }
160 return 0;

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

591 memalloc_retry_wait(GFP_NOFS);
592 goto retry_dn;
593 }
594 goto out;
595 }
596
597 f2fs_wait_on_page_writeback(dn.node_page, NODE, true, true);
598
599 err = f2fs_get_node_info(sbi, dn.nid, &ni, false);
599 err = f2fs_get_node_info(sbi, dn.nid, &ni);
600 if (err)
601 goto err;
602
603 f2fs_bug_on(sbi, ni.ino != ino_of_node(page));
604
605 if (ofs_of_node(dn.node_page) != ofs_of_node(page)) {
606 f2fs_warn(sbi, "Inconsistent ofs_of_node, ino:%lu, ofs:%u, %u",
607 inode->i_ino, ofs_of_node(dn.node_page),

--- 279 unchanged lines hidden ---
600 if (err)
601 goto err;
602
603 f2fs_bug_on(sbi, ni.ino != ino_of_node(page));
604
605 if (ofs_of_node(dn.node_page) != ofs_of_node(page)) {
606 f2fs_warn(sbi, "Inconsistent ofs_of_node, ino:%lu, ofs:%u, %u",
607 inode->i_ino, ofs_of_node(dn.node_page),

--- 279 unchanged lines hidden ---