Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp4886473imu; Mon, 12 Nov 2018 19:58:46 -0800 (PST) X-Google-Smtp-Source: AJdET5dYp1RT6PQCfOvc2fhPajJdUcXPyQFmCjb8QP6eqwle7D6CyvhvHo44waWrXdkS1WRZ+3Qu X-Received: by 2002:a63:193:: with SMTP id 141mr3312657pgb.136.1542081526909; Mon, 12 Nov 2018 19:58:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542081526; cv=none; d=google.com; s=arc-20160816; b=JFZJaoTgksm/Iz41NmkmPqzqGcGhN4LKjZjy+BwYuFpCWHTrQO7z7tQt/TfQZEypuv cdfWdOSgduJGOiVIgMDiIP8hQOOlX+R1R0NaouLybF5SoAJFI+qppdJkie1VQ0ixnTt/ Y5jqYC0M4z12aJYK4Hilj7KIu7lo6MEuml8fcfJyGtKjHO33EA3i6i6M1EoT3PM2zvKW VGW3oIJr1K7mh8/0c56LM4+KzFsz7vTjjwg+6mHovPpDStr//p/Kn1XNR7U2MT6E+jyc 1U6YMimgHiUOYMgFq4MKjtA4BXpxpQSaTBfy2VN4Bho/Wh7kZ6ojJIQdCvkcYz1BhPJs KRtw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=mRRHP731qXoyhZlzQCEIkVCw4/3AphYTgbcG/rKQZls=; b=YSZRKPOKA99SCd4XFaITfBUbbtyxOKcIivseCh3Y8MNs7OXogOrsdw25zctisAe9cS iGGbCayJrwKwKi6s1tQqlKkTAk954UYhKAjlRa+/JeTKdx7vhV1z8DTAUGywVAhAQ1kO b5/ahyEjhazJeovCUo9JecteLTVUxTTP7bwdBGoR0w/oL6Cb+RcqDl3tPePAD2jirUAx yA0JGXqgjCbcJtZkumMFRQ+mneN5Lm0c6L213te016QdDQcgCWI8cTbUtRW9CAdkrZ6l mA8d0FVgB1cBQuEFkKN5xYaMLrdeViMLLALH6EN7PSBC0NqUEn2Hh6mEpZVz9+eLlMm9 fgnQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 76-v6si23849934pfa.194.2018.11.12.19.58.16; Mon, 12 Nov 2018 19:58:46 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728378AbeKMNx7 (ORCPT + 99 others); Tue, 13 Nov 2018 08:53:59 -0500 Received: from szxga04-in.huawei.com ([45.249.212.190]:15091 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726103AbeKMNx7 (ORCPT ); Tue, 13 Nov 2018 08:53:59 -0500 Received: from DGGEMS407-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id C1D82A6DFD28C; Tue, 13 Nov 2018 11:57:44 +0800 (CST) Received: from huawei.com (10.113.189.234) by DGGEMS407-HUB.china.huawei.com (10.3.19.207) with Microsoft SMTP Server id 14.3.408.0; Tue, 13 Nov 2018 11:57:38 +0800 From: Yunlong Song To: , , , , CC: , , , , , Subject: [PATCH v3] f2fs: only flush the single temp bio cache which owns the target page Date: Tue, 13 Nov 2018 11:57:32 +0800 Message-ID: <1542081452-66059-1-git-send-email-yunlong.song@huawei.com> X-Mailer: git-send-email 1.8.5.2 In-Reply-To: <1540368651-14353-1-git-send-email-yunlong.song@huawei.com> References: <1540368651-14353-1-git-send-email-yunlong.song@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.113.189.234] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Previously, when f2fs finds which temp bio cache owns the target page, it will flush all the three temp bio caches, but we only need to flush one single bio cache indeed, which can help to keep bio merged. Signed-off-by: Yunlong Song --- fs/f2fs/data.c | 37 ++++++++++--------------------------- 1 file changed, 10 insertions(+), 27 deletions(-) diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c index 6e0ffb1..cd8f670 100644 --- a/fs/f2fs/data.c +++ b/fs/f2fs/data.c @@ -372,29 +372,6 @@ static bool __has_merged_page(struct f2fs_bio_info *io, struct inode *inode, return false; } -static bool has_merged_page(struct f2fs_sb_info *sbi, struct inode *inode, - struct page *page, nid_t ino, - enum page_type type) -{ - enum page_type btype = PAGE_TYPE_OF_BIO(type); - enum temp_type temp; - struct f2fs_bio_info *io; - bool ret = false; - - for (temp = HOT; temp < NR_TEMP_TYPE; temp++) { - io = sbi->write_io[btype] + temp; - - down_read(&io->io_rwsem); - ret = __has_merged_page(io, inode, page, ino); - up_read(&io->io_rwsem); - - /* TODO: use HOT temp only for meta pages now. */ - if (ret || btype == META) - break; - } - return ret; -} - static void __f2fs_submit_merged_write(struct f2fs_sb_info *sbi, enum page_type type, enum temp_type temp) { @@ -420,13 +397,19 @@ static void __submit_merged_write_cond(struct f2fs_sb_info *sbi, nid_t ino, enum page_type type, bool force) { enum temp_type temp; - - if (!force && !has_merged_page(sbi, inode, page, ino, type)) - return; + bool ret = true; for (temp = HOT; temp < NR_TEMP_TYPE; temp++) { + if (!force) { + enum page_type btype = PAGE_TYPE_OF_BIO(type); + struct f2fs_bio_info *io = sbi->write_io[btype] + temp; - __f2fs_submit_merged_write(sbi, type, temp); + down_read(&io->io_rwsem); + ret = __has_merged_page(io, inode, page, ino); + up_read(&io->io_rwsem); + } + if (ret) + __f2fs_submit_merged_write(sbi, type, temp); /* TODO: use HOT temp only for meta pages now. */ if (type >= META) -- 1.8.5.2