From patchwork Wed Jan 30 07:39:58 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Qu Wenruo X-Patchwork-Id: 10787805 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 13A6714E1 for ; Wed, 30 Jan 2019 07:40:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 036CB2DEB0 for ; Wed, 30 Jan 2019 07:40:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EBACE2DEB9; Wed, 30 Jan 2019 07:40:06 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9E07E2DEC1 for ; Wed, 30 Jan 2019 07:40:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730107AbfA3HkF (ORCPT ); Wed, 30 Jan 2019 02:40:05 -0500 Received: from mx2.suse.de ([195.135.220.15]:44152 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725819AbfA3HkF (ORCPT ); Wed, 30 Jan 2019 02:40:05 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id F410BB013 for ; Wed, 30 Jan 2019 07:40:03 +0000 (UTC) From: Qu Wenruo To: linux-btrfs@vger.kernel.org Subject: [PATCH 0/2] btrfs: Speedup chunk allocation for large fs Date: Wed, 30 Jan 2019 15:39:58 +0800 Message-Id: <20190130074000.16638-1-wqu@suse.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patchset can be fetched from github: https://github.com/adam900710/linux/tree/falloc_speedup Which is based on v5.0-rc1 tag, with another enospc debug patch. Btrfs falloc can be slower and slower when there are more and more block groups. One cause of this problem is find_free_dev_extent(), as it always search from device offset 0, and if there are thousands existing dev extents btrfs will search leaf by leaf until it reaches a free slot. This is super slow and inefficient. This patchset will introduce a new member, btrfs_device::hint_free_dev_extent to give some hint for find_free_dev_extent(). The full cause analyse and benchmark can be found in the 2nd patch. Qu Wenruo (2): btrfs: Don't search devid for every verify_one_dev_extent() call btrfs: Introduce free dev extent hint to speed up chunk allocation fs/btrfs/volumes.c | 49 ++++++++++++++++++++++++++++----------- fs/btrfs/volumes.h | 58 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 94 insertions(+), 13 deletions(-)