From patchwork Fri Jul 17 04:56:00 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tiezhu Yang X-Patchwork-Id: 6813031 Return-Path: X-Original-To: patchwork-linux-fsdevel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 6E899C05AC for ; Fri, 17 Jul 2015 05:29:16 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 02EAD2052A for ; Fri, 17 Jul 2015 05:29:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7DDFF20522 for ; Fri, 17 Jul 2015 05:29:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753532AbbGQF24 (ORCPT ); Fri, 17 Jul 2015 01:28:56 -0400 Received: from m15-15.126.com ([220.181.15.15]:53905 "EHLO m15-15.126.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751321AbbGQF24 (ORCPT ); Fri, 17 Jul 2015 01:28:56 -0400 X-Greylist: delayed 1899 seconds by postgrey-1.27 at vger.kernel.org; Fri, 17 Jul 2015 01:28:51 EDT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=126.com; s=s110527; h=Date:From:Subject:MIME-Version:Message-ID; bh=p1VkF h2YL23gd7jKbfvWc7DQhOZMunbQdnKpSDv7Tc8=; b=R7sPyJQSCE8+aWJ5uNBCc jgaJXP4QtGE/zs2So3pQwuujwZUJwT8EUAeybGeM60NnEz9Bij2p94qZcaBH4qnf YOC9xAHTK42HiZx94omUw/6CiZAo2Sk3wLO1lLVknoA1TG5QhyUKeyth1UJ+Af5E ukxlOly2IYbW6EcPgszj4o= Received: from kernelpatch$126.com ( [113.200.155.184] ) by ajax-webmail-wmsvr15 (Coremail) ; Fri, 17 Jul 2015 12:56:00 +0800 (CST) X-Originating-IP: [113.200.155.184] Date: Fri, 17 Jul 2015 12:56:00 +0800 (CST) From: "Tiezhu Yang" To: jaegeuk@kernel.org, cm224.lee@samsung.com, chao2.yu@samsung.com Cc: linux-f2fs-devel@lists.sourceforge.net, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH RESEND] f2fs: optimize f2fs_write_cache_pages X-Priority: 3 X-Mailer: Coremail Webmail Server Version SP_ntes V3.5 build 20150119(59087.7062) Copyright (c) 2002-2015 www.mailtech.cn 126com MIME-Version: 1.0 Message-ID: <2f135856.6709.14e9a5e7d5a.Coremail.kernelpatch@126.com> X-CM-TRANSID: D8qowACn3fHhiqhVxlECAA--.1148W X-CM-SenderInfo: xnhu0vxosd3ubk6rjloofrz/1tbiWwQ69VPM9rbkDgACsn X-Coremail-Antispam: 1U5529EdanIXcx71UUUUU7vcSsGvfC2KfnxnUU== Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Spam-Status: No, score=-8.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, FREEMAIL_FROM,RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The if statement "goto continue_unlock" is exactly the same when each if condition is true that is depended on the value of both "step" and "is_cold_data(page)" are 0 or 1. That means when the value of "step" equals to "is_cold_data(page)", the if condition is true and the if statement "goto continue_unlock" appears only once, so it can be optimized to reduce the duplicated code. Signed-off-by: Tiezhu Yang --- fs/f2fs/data.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c index b621c08..0219bd0 100644 --- a/fs/f2fs/data.c +++ b/fs/f2fs/data.c @@ -1214,9 +1214,7 @@ continue_unlock: goto continue_unlock; } - if (step == 0 && !is_cold_data(page)) - goto continue_unlock; - if (step == 1 && is_cold_data(page)) + if (step == is_cold_data(page)) goto continue_unlock; if (PageWriteback(page)) {