diff options
Diffstat (limited to 'fs/f2fs/inode.c')
-rw-r--r-- | fs/f2fs/inode.c | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/fs/f2fs/inode.c b/fs/f2fs/inode.c index 959df2249875..91ceee0ed4c4 100644 --- a/fs/f2fs/inode.c +++ b/fs/f2fs/inode.c | |||
@@ -1,12 +1,9 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * fs/f2fs/inode.c | 3 | * fs/f2fs/inode.c |
3 | * | 4 | * |
4 | * Copyright (c) 2012 Samsung Electronics Co., Ltd. | 5 | * Copyright (c) 2012 Samsung Electronics Co., Ltd. |
5 | * http://www.samsung.com/ | 6 | * 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 | ||
9 | * published by the Free Software Foundation. | ||
10 | */ | 7 | */ |
11 | #include <linux/fs.h> | 8 | #include <linux/fs.h> |
12 | #include <linux/f2fs_fs.h> | 9 | #include <linux/f2fs_fs.h> |
@@ -368,6 +365,12 @@ static int do_read_inode(struct inode *inode) | |||
368 | if (f2fs_has_inline_data(inode) && !f2fs_exist_data(inode)) | 365 | if (f2fs_has_inline_data(inode) && !f2fs_exist_data(inode)) |
369 | __recover_inline_status(inode, node_page); | 366 | __recover_inline_status(inode, node_page); |
370 | 367 | ||
368 | /* try to recover cold bit for non-dir inode */ | ||
369 | if (!S_ISDIR(inode->i_mode) && !is_cold_node(node_page)) { | ||
370 | set_cold_node(node_page, false); | ||
371 | set_page_dirty(node_page); | ||
372 | } | ||
373 | |||
371 | /* get rdev by using inline_info */ | 374 | /* get rdev by using inline_info */ |
372 | __get_inode_rdev(inode, ri); | 375 | __get_inode_rdev(inode, ri); |
373 | 376 | ||
@@ -610,6 +613,9 @@ int f2fs_write_inode(struct inode *inode, struct writeback_control *wbc) | |||
610 | if (!is_inode_flag_set(inode, FI_DIRTY_INODE)) | 613 | if (!is_inode_flag_set(inode, FI_DIRTY_INODE)) |
611 | return 0; | 614 | return 0; |
612 | 615 | ||
616 | if (f2fs_is_checkpoint_ready(sbi)) | ||
617 | return -ENOSPC; | ||
618 | |||
613 | /* | 619 | /* |
614 | * We need to balance fs here to prevent from producing dirty node pages | 620 | * We need to balance fs here to prevent from producing dirty node pages |
615 | * during the urgent cleaning time when runing out of free sections. | 621 | * during the urgent cleaning time when runing out of free sections. |
@@ -648,7 +654,11 @@ void f2fs_evict_inode(struct inode *inode) | |||
648 | if (inode->i_nlink || is_bad_inode(inode)) | 654 | if (inode->i_nlink || is_bad_inode(inode)) |
649 | goto no_delete; | 655 | goto no_delete; |
650 | 656 | ||
651 | dquot_initialize(inode); | 657 | err = dquot_initialize(inode); |
658 | if (err) { | ||
659 | err = 0; | ||
660 | set_sbi_flag(sbi, SBI_QUOTA_NEED_REPAIR); | ||
661 | } | ||
652 | 662 | ||
653 | f2fs_remove_ino_entry(sbi, inode->i_ino, APPEND_INO); | 663 | f2fs_remove_ino_entry(sbi, inode->i_ino, APPEND_INO); |
654 | f2fs_remove_ino_entry(sbi, inode->i_ino, UPDATE_INO); | 664 | f2fs_remove_ino_entry(sbi, inode->i_ino, UPDATE_INO); |
@@ -680,9 +690,10 @@ retry: | |||
680 | goto retry; | 690 | goto retry; |
681 | } | 691 | } |
682 | 692 | ||
683 | if (err) | 693 | if (err) { |
684 | f2fs_update_inode_page(inode); | 694 | f2fs_update_inode_page(inode); |
685 | dquot_free_inode(inode); | 695 | set_sbi_flag(sbi, SBI_QUOTA_NEED_REPAIR); |
696 | } | ||
686 | sb_end_intwrite(inode->i_sb); | 697 | sb_end_intwrite(inode->i_sb); |
687 | no_delete: | 698 | no_delete: |
688 | dquot_drop(inode); | 699 | dquot_drop(inode); |
@@ -691,7 +702,8 @@ no_delete: | |||
691 | stat_dec_inline_dir(inode); | 702 | stat_dec_inline_dir(inode); |
692 | stat_dec_inline_inode(inode); | 703 | stat_dec_inline_inode(inode); |
693 | 704 | ||
694 | if (likely(!is_set_ckpt_flags(sbi, CP_ERROR_FLAG))) | 705 | if (likely(!is_set_ckpt_flags(sbi, CP_ERROR_FLAG) && |
706 | !is_sbi_flag_set(sbi, SBI_CP_DISABLED))) | ||
695 | f2fs_bug_on(sbi, is_inode_flag_set(inode, FI_DIRTY_INODE)); | 707 | f2fs_bug_on(sbi, is_inode_flag_set(inode, FI_DIRTY_INODE)); |
696 | else | 708 | else |
697 | f2fs_inode_synced(inode); | 709 | f2fs_inode_synced(inode); |