Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934667AbbGHKZX (ORCPT ); Wed, 8 Jul 2015 06:25:23 -0400 Received: from mailout4.samsung.com ([203.254.224.34]:36585 "EHLO mailout4.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933891AbbGHKZU (ORCPT ); Wed, 8 Jul 2015 06:25:20 -0400 X-AuditID: cbfee61a-f79516d000006302-65-559cfa8e429c From: Chao Yu To: Jaegeuk Kim Cc: linux-f2fs-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org Subject: [PATCH] f2fs: fix to update page flag Date: Wed, 08 Jul 2015 18:24:38 +0800 Message-id: <00bc01d0b968$63bcf690$2b36e3b0$@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: AdC5Z1NMe+Zz4i1xS2+qF47vmXDfAA== Content-language: zh-cn X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrGLMWRmVeSWpSXmKPExsVy+t9jAd2+X3NCDe7vULN4sn4Ws8WlRe4W l3fNYXNg9ti0qpPNY/eCz0wenzfJBTBHcdmkpOZklqUW6dslcGUcuHiSvWAnZ8XmE4+ZGxi3 s3cxcnJICJhIPN/2jBHCFpO4cG89WxcjF4eQwCJGifU337CAJIQEXjFK3LhhBmKzCahILO/4 zwRiiwDZhxZdBhvELOAh0djxnbWLkYNDWEBP4sg6NpAwi4CqxPoVP1lAwrwClhLfZwmAhHkF BCV+TL7HAtGpJbF+53EmCFteYvOat8wQ5yhI7Dj7mhFik57Ex+8fWSFqxCU2HrnFMoFRYBaS UbOQjJqFZNQsJC0LGFlWMYqmFiQXFCel5xrqFSfmFpfmpesl5+duYgSH7jOpHYwrGywOMQpw MCrx8H6MnBMqxJpYVlyZe4hRgoNZSYR31wWgEG9KYmVValF+fFFpTmrxIUZpDhYlcd6T+T6h QgLpiSWp2ampBalFMFkmDk6pBka+N/tO3lFXlvnYdm4jq7xe8vk+ddd8vgUbZ0ozOf2O358Y bPJUu73Tp3lWaNHjpD9fV73R3btK9FIvf9EhhttVS21XxbFOVvx1QftheUPhvXbfWLWQFI2S Dr/te998dvtwx1Jmgmsyi9xWPu+b67TP2hVP7GxVnm3+wmGhf0JnYenK9p7wE0osxRmJhlrM RcWJAMggyl5ZAgAA Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1401 Lines: 58 This patch fixes to update page flag (e.g. Uptodate/cold flag) in ->write_begin. Otherwise, page will be non-uptodate when we try to write entire page, and cold data flag in page will not be clean when gced page is being rewritten. Signed-off-by: Chao Yu --- fs/f2fs/data.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c index 056f4f9..a869d80 100644 --- a/fs/f2fs/data.c +++ b/fs/f2fs/data.c @@ -1249,8 +1249,10 @@ put_next: f2fs_put_dnode(&dn); f2fs_unlock_op(sbi); - if ((len == PAGE_CACHE_SIZE) || PageUptodate(page)) - return 0; + if (len == PAGE_CACHE_SIZE) + goto out_update; + if (PageUptodate(page)) + goto out_clear; f2fs_wait_on_page_writeback(page, DATA); @@ -1260,7 +1262,7 @@ put_next: /* Reading beyond i_size is simple: memset to zero */ zero_user_segments(page, 0, start, end, PAGE_CACHE_SIZE); - goto out; + goto out_update; } if (dn.data_blkaddr == NEW_ADDR) { @@ -1298,8 +1300,9 @@ put_next: } } } -out: +out_update: SetPageUptodate(page); +out_clear: clear_cold_data(page); return 0; -- 2.4.2 -- 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/