From patchwork Thu Feb 22 06:47:29 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Qu Wenruo X-Patchwork-Id: 10234731 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id BDAAA605CE for ; Thu, 22 Feb 2018 06:48:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A5F0C285DB for ; Thu, 22 Feb 2018 06:48:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9A8DF285FD; Thu, 22 Feb 2018 06:48:08 +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=-6.9 required=2.0 tests=BAYES_00,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 2F910285DB for ; Thu, 22 Feb 2018 06:48:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752538AbeBVGru (ORCPT ); Thu, 22 Feb 2018 01:47:50 -0500 Received: from prv3-mh.provo.novell.com ([137.65.250.26]:49021 "EHLO prv3-mh.provo.novell.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752516AbeBVGrp (ORCPT ); Thu, 22 Feb 2018 01:47:45 -0500 Received: from adam-pc.lan (prv-ext-foundry1int.gns.novell.com [137.65.251.240]) by prv3-mh.provo.novell.com with ESMTP (NOT encrypted); Wed, 21 Feb 2018 23:47:42 -0700 From: Qu Wenruo To: linux-btrfs@vger.kernel.org, dsterba@suse.cz Subject: [PATCH v3 5/9] btrfs-progs: volumes: Allow find_free_dev_extent() to return maximum hole size Date: Thu, 22 Feb 2018 14:47:29 +0800 Message-Id: <20180222064733.12126-6-wqu@suse.com> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180222064733.12126-1-wqu@suse.com> References: <20180222064733.12126-1-wqu@suse.com> 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 Just as kernel find_free_dev_extent(), allow it to return maximum hole size for us to build device list for later chunk allocator rework. Signed-off-by: Qu Wenruo --- volumes.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/volumes.c b/volumes.c index b47ff1f392b5..f4009ffa7c9e 100644 --- a/volumes.c +++ b/volumes.c @@ -516,10 +516,10 @@ out: } static int find_free_dev_extent(struct btrfs_device *device, u64 num_bytes, - u64 *start) + u64 *start, u64 *len) { /* FIXME use last free of some kind */ - return find_free_dev_extent_start(device, num_bytes, 0, start, NULL); + return find_free_dev_extent_start(device, num_bytes, 0, start, len); } static int btrfs_alloc_dev_extent(struct btrfs_trans_handle *trans, @@ -543,7 +543,7 @@ static int btrfs_alloc_dev_extent(struct btrfs_trans_handle *trans, * is responsible to make sure it's free. */ if (!convert) { - ret = find_free_dev_extent(device, num_bytes, start); + ret = find_free_dev_extent(device, num_bytes, start, NULL); if (ret) goto err; }