Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752211AbbLPFO6 (ORCPT ); Wed, 16 Dec 2015 00:14:58 -0500 Received: from mailout2.samsung.com ([203.254.224.25]:55353 "EHLO mailout2.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751073AbbLPFO4 (ORCPT ); Wed, 16 Dec 2015 00:14:56 -0500 X-AuditID: cbfee61b-f793c6d00000236c-1a-5670f34f0f22 From: Chao Yu To: Jaegeuk Kim Cc: linux-f2fs-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org Subject: [PATCH v2 7/7] f2fs: support data flush in checkpoint Date: Wed, 16 Dec 2015 13:14:15 +0800 Message-id: <014301d137c0$b3b2c0e0$1b1842a0$@samsung.com> MIME-version: 1.0 Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7bit X-Mailer: Microsoft Outlook 14.0 Thread-index: AdE3wHzMhRzv6DN2Q4qRrzUIePij3w== Content-language: zh-cn X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrJLMWRmVeSWpSXmKPExsVy+t9jQV3/zwVhBidvyVk8WT+L2eLSIneL y7vmsDkwe2xa1cnmsXvBZyaPz5vkApijuGxSUnMyy1KL9O0SuDLu3/YvWM9d0X1/P3MD42LO LkYODgkBE4mjf327GDmBTDGJC/fWs3UxcnEICcxilJjZ+p8RwnnFKLFs+Tt2kCo2ARWJ5R3/ mUBsESD70KLLYHFmAQ+Jxo7vrCBDhQXsJCb9VwUJswioSly+cI4VxOYVsJS4tv82M4QtKPFj 8j0WiFYtifU7jzNB2PISm9e8ZYY4SEFix9nXjBCr9CRm7T3BClEjLrHxyC2WCYxAVyKMmoVk 1Cwko2YhaVnAyLKKUSK1ILmgOCk91ygvtVyvODG3uDQvXS85P3cTIziAn0nvYDy8y/0QowAH oxIPr0ZMQZgQa2JZcWXuIUYJDmYlEV6Dp0Ah3pTEyqrUovz4otKc1OJDjNIcLErivPsuRYYJ CaQnlqRmp6YWpBbBZJk4OKUaGE0v1YTHZRQGBPkqtL5aVWduqb1Rk79H6cWT5P8Hv5zVbtLm eJ/7uZ3h3ersC4ds3kySWxyydMOcvM0FHU5iWa+mV983PtOy19Ff2OlN9Vl5PfndrcFzDgbm FX5cIl85afez12qfA0QTutaXfxCXUKxcoT61s8vmbWGBsf5yxYNPDPfsbHn1S4mlOCPRUIu5 qDgRAKjoP9VcAgAA Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1657 Lines: 48 Previously, when finishing a checkpoint, we have persisted all fs meta info including meta inode, node inode, dentry page of directory inode, so, after a sudden power cut, f2fs can recover from last checkpoint with full directory structure. But during checkpoint, we didn't flush dirty pages of regular and symlink inode, so such dirty datas still in memory will be lost in that moment of power off. In order to reduce the chance of lost data, this patch enables f2fs_balance_fs_bg with the ability of data flushing. It will try to flush user data before starting a checkpoint. So user's data written after last checkpoint which may not be fsynced could be saved. Signed-off-by: Chao Yu --- v2: - trigger data flush in f2fs_balance_fs_bg. --- fs/f2fs/segment.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c index 5fa519f..c247450 100644 --- a/fs/f2fs/segment.c +++ b/fs/f2fs/segment.c @@ -291,8 +291,11 @@ void f2fs_balance_fs_bg(struct f2fs_sb_info *sbi) if (!available_free_memory(sbi, NAT_ENTRIES) || excess_prefree_segs(sbi) || !available_free_memory(sbi, INO_ENTRIES) || - jiffies > sbi->cp_expires) + jiffies > sbi->cp_expires) { + if (test_opt(sbi, DATA_FLUSH)) + sync_dirty_inodes(sbi, FILE_INODE); f2fs_sync_fs(sbi->sb, true); + } } static int issue_flush_thread(void *data) -- 2.6.3 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/