Received: by 2002:ac0:aa62:0:0:0:0:0 with SMTP id w31-v6csp484086ima; Wed, 24 Oct 2018 04:36:47 -0700 (PDT) X-Google-Smtp-Source: AJdET5cw1fLOJxmSyCRELtavqLnZgpQfV/4HuqApr48z6o723L8Cg305ycMpLnMUyc0/T77tBN/M X-Received: by 2002:a17:902:854c:: with SMTP id d12-v6mr2171738plo.313.1540381007378; Wed, 24 Oct 2018 04:36:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540381007; cv=none; d=google.com; s=arc-20160816; b=hFQGo7iFaAQ8a4A9MuUActmRRFfqmEA94Twy8XaGs+T5t/IijrbamyMsKJiYQgRLiy KTd9rsh4qdGRHW6buhT1cVblYmfi3H9FzY8juBfWLl6l1APzHcMnK6XJfOanHjZztKtY YW+ajQnrv0y5xjpQM3ixN7jwRrmp3ED265rXtZqOadx99ImPu/DylngiyW1Zq/zVLyeu 6ns8L9/xRdurgVmJKwnBbGIMycVYmh02T4Pk8RSqwvEiBjvkWq2WX3+xTh/Gr2oiDP8e KzXxCRFpsvYqLq0WomS8HywPVjQAr9SLMWKB5HW+PMlrg3n+m7t0IBojIUDBSj/XgRCH FgLw== 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=cuBrHq5ReygBU79hUtN3HyW18/wq7sp8q28DEV2tvkg=; b=O7QAZ1u0RS26dapWzGY1YakXXr5ipASzhmgQ3QNf/OXFCl5O80Xl98UL0F0VpgwK7J P4+Die18gCYuFNFpkmFjf8zojnEHX1EmDZVsurXdJN81UcsXmr3fFJ/zYLVqRc5jAU1k Gk22Pb4XW1oTV2hBpAoaUhcmP9uGb818LKXFLnC8b9ZUm0oB2B8HfiOV47TKjsd+sGdb +1C4rMl8L9RZDmY8SerHBfCbwcT4Dxnewo1qx4G8GrtSxiJTJg5l/6SQPK0RQcZ8VXRS 6+TK7TMDcivmqW5V5RO8wwojAxt22rlMwn2AzHZjQwv0teg/Gz9Hn9CsLgj7thnMZUNh jFvQ== 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 20-v6si4540241pgk.190.2018.10.24.04.36.31; Wed, 24 Oct 2018 04:36:47 -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 S1727231AbeJXUDr (ORCPT + 99 others); Wed, 24 Oct 2018 16:03:47 -0400 Received: from szxga06-in.huawei.com ([45.249.212.32]:37370 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726428AbeJXUDr (ORCPT ); Wed, 24 Oct 2018 16:03:47 -0400 Received: from DGGEMS401-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id 3E2A253E32EE2; Wed, 24 Oct 2018 19:35:58 +0800 (CST) Received: from huawei.com (10.113.189.234) by DGGEMS401-HUB.china.huawei.com (10.3.19.201) with Microsoft SMTP Server id 14.3.408.0; Wed, 24 Oct 2018 19:35:50 +0800 From: Yunlong Song To: , , , , CC: , , , , , Subject: [PATCH v2] f2fs: only flush the single temp bio cache which owns the target page Date: Wed, 24 Oct 2018 19:35:45 +0800 Message-ID: <1540380945-18114-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 | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c index 106f116..882e217 100644 --- a/fs/f2fs/data.c +++ b/fs/f2fs/data.c @@ -396,13 +396,17 @@ static bool has_merged_page(struct f2fs_sb_info *sbi, struct inode *inode, } static void __f2fs_submit_merged_write(struct f2fs_sb_info *sbi, - enum page_type type, enum temp_type temp) + struct inode *inode, struct page *page, nid_t ino, + enum page_type type, enum temp_type temp, bool force) { enum page_type btype = PAGE_TYPE_OF_BIO(type); struct f2fs_bio_info *io = sbi->write_io[btype] + temp; down_write(&io->io_rwsem); + if (!force && !__has_merged_page(io, inode, page, ino)) + goto out; + /* change META to META_FLUSH in the checkpoint procedure */ if (type >= META_FLUSH) { io->fio.type = META_FLUSH; @@ -412,6 +416,7 @@ static void __f2fs_submit_merged_write(struct f2fs_sb_info *sbi, io->fio.op_flags |= REQ_PREFLUSH | REQ_FUA; } __submit_merged_bio(io); +out: up_write(&io->io_rwsem); } @@ -426,7 +431,7 @@ static void __submit_merged_write_cond(struct f2fs_sb_info *sbi, for (temp = HOT; temp < NR_TEMP_TYPE; temp++) { - __f2fs_submit_merged_write(sbi, type, temp); + __f2fs_submit_merged_write(sbi, inode, page, ino, type, temp, force); /* TODO: use HOT temp only for meta pages now. */ if (type >= META) -- 1.8.5.2