Received: by 2002:ac0:aa62:0:0:0:0:0 with SMTP id w31-v6csp307802ima; Wed, 24 Oct 2018 01:23:33 -0700 (PDT) X-Google-Smtp-Source: AJdET5c4t87bUuL4CSFAJvAy/GjTlKJBtvoulHQuuY9NWDz5hiGyMi8wjOpcURWSccHVXlxvNpz5 X-Received: by 2002:a63:3e05:: with SMTP id l5mr1564278pga.96.1540369413475; Wed, 24 Oct 2018 01:23:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540369413; cv=none; d=google.com; s=arc-20160816; b=qOIuLf51Dr2keTwjFO0kMqC6lx/IIu4izcYpSmLb1A7cDbflYRcSIwoYf5mcumVqX0 4+T0LwNdseiEuWPkucy3K7AmI1OVLJkYaOMONOMZfaxZj6rYPzS161cq5lPpxC6j0Tlr qqV1Iyps+MC7SJmifSLoZx9dwZ4PVM52c13m0Pif6gaHlVbSxlZhAQPy7Gwi8lReWMtI p+xc9SjWo+4dKVs28sTK6wIZX07EqvXt+Gvf2UkTeqtze1HryZdx2KntpBg611JKqqKL i5U85blEEEC46OQ2OgtHVc1KwCTqbD037As3MZ2hvxeHb1eHGfTCWOVxgwjcO5h2uWFB HwOg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:cc :to:from; bh=10sMQhx822V/bWQ6XWWDUNNF0KnD5cmsXBQYkVnywp4=; b=Wiy9Z6NVPyQo2NcEX1xAgH6f4YiXTDG9N5wKxTZPr7e7LyPKdcirtpErs/8jvNfzGw PQLus8rp7M6mT4eDk0kI5ncFxAswKx9tamHu1Jwy0MsXXEmKtrPHst7g/inRm7AHizfW /mhV/UF2HnYYyNr2DemGykwW3XYG2mQUL9ywBg8WYEn3vAQtQY7Kudgyn3rGb2i7FWlV 8+zwEz2Hl6PactSNKOlKnM4GZfWGF9u0JAozYFeGEDKH6n53ebvI3szXrpKqTuYGecpl 2a09mliSJwoQW79RKK3w0QGnzVxjKkrC618WQu8FZxxon8+5qeBINRNHfQI5it+qDGwL Rblw== 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 w15-v6si4034133pgg.529.2018.10.24.01.23.18; Wed, 24 Oct 2018 01:23:33 -0700 (PDT) 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 S1727534AbeJXQiO (ORCPT + 99 others); Wed, 24 Oct 2018 12:38:14 -0400 Received: from szxga07-in.huawei.com ([45.249.212.35]:57416 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726797AbeJXQiO (ORCPT ); Wed, 24 Oct 2018 12:38:14 -0400 Received: from DGGEMS408-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 65607F211CB7D; Wed, 24 Oct 2018 16:11:07 +0800 (CST) Received: from huawei.com (10.113.189.234) by DGGEMS408-HUB.china.huawei.com (10.3.19.208) with Microsoft SMTP Server id 14.3.408.0; Wed, 24 Oct 2018 16:10:57 +0800 From: Yunlong Song To: , , , , CC: , , , , , Subject: [PATCH] f2fs: only flush the single temp bio cache which owns the target page Date: Wed, 24 Oct 2018 16:10:51 +0800 Message-ID: <1540368651-14353-1-git-send-email-yunlong.song@huawei.com> X-Mailer: git-send-email 1.8.5.2 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 | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c index 106f116..04ebbad 100644 --- a/fs/f2fs/data.c +++ b/fs/f2fs/data.c @@ -374,7 +374,7 @@ static bool __has_merged_page(struct f2fs_bio_info *io, struct inode *inode, 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 type, enum temp_type *owner) { enum page_type btype = PAGE_TYPE_OF_BIO(type); enum temp_type temp; @@ -392,6 +392,10 @@ static bool has_merged_page(struct f2fs_sb_info *sbi, struct inode *inode, if (ret || btype == META) break; } + if (!ret || (!inode && !page && !ino)) + *owner = NR_TEMP_TYPE; + else + *owner = temp; return ret; } @@ -421,9 +425,14 @@ static void __submit_merged_write_cond(struct f2fs_sb_info *sbi, { enum temp_type temp; - if (!force && !has_merged_page(sbi, inode, page, ino, type)) + if (!force && !has_merged_page(sbi, inode, page, ino, type, &temp)) return; + if (!force && temp != NR_TEMP_TYPE) { + __f2fs_submit_merged_write(sbi, type, temp); + return; + } + for (temp = HOT; temp < NR_TEMP_TYPE; temp++) { __f2fs_submit_merged_write(sbi, type, temp); -- 1.8.5.2