Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp3792166ybi; Tue, 18 Jun 2019 06:38:14 -0700 (PDT) X-Google-Smtp-Source: APXvYqxNb3Q7GDE8X76wbEr4JUI4Eogg0RJq+3uWJFOC8+g/EkjWKOeqvqkxW5uL5V6khsWL3z8O X-Received: by 2002:a63:6f47:: with SMTP id k68mr2720654pgc.327.1560865094378; Tue, 18 Jun 2019 06:38:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560865094; cv=none; d=google.com; s=arc-20160816; b=TcCany47p7E6263j4aGUdMc32v2FGHuc/Ko6Ns5HtaSGQ4i9w/037zhDpoKUY58xfM RuttDiZ/Y/f5stPKNH2R8pwERzA2rnhhd4iOqyoRLhPd+ISU2uzfaqSWpQ6M5e3W4axI f6V45cSX8EcXTZ+IDIJN9vr2rlN0fE3jPfTYXuOcyzkP8VExyalmB6l4QzraswlZWLmT pNJx5X2gm4NQ5Nvzr/x4d1+AxU1fDdeFrv0fCYvWvA5T85Kc7igUmUbNd6VwBrQT0K7f 2ImPDjak/Q6kAkIa1ze1aNPpDbaq1h3C+ZOqdgVZPsU4UEPv2ofhO+gXK6jZpBE/Lbl1 9TIA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=dKOAWFz5cXu8yUBPgcqckTt7kzukUrCB+Jl5SHrTW/k=; b=x7R2dQ6k5aiy+3qYDXbvlj7Ksi/yhhR2BNXV2fsWeLLtbkPNl24kLhC9+fnT1nkABD Sl4jNqoTc37NFHO6zO+3KOWR9AgUBsuMnKrnKCG3MULzwd6tLMAIhPdSDsJBFRicxTF/ 39U2Nt8C7rrzxSMU9TEXk90dC0WYZe+ED+uiJRa05bsQX3Xr+0YI168DBKeLo++QKcYw KAXgSMkrJE5N9sFK7ymvzaAFofYEb03s7KrcO/McnhdCGgmx9L5AZ27/PKza2gMDQF59 6LMUhEiVWLziEU6Mldv4UTro4WexrkX/zP5+tqCuxChndJBI0LMKYC07iNtGQxWivygA oVOA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@toxicpanda-com.20150623.gappssmtp.com header.s=20150623 header.b="00lZ/ldt"; 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 cl7si14012391plb.267.2019.06.18.06.37.58; Tue, 18 Jun 2019 06:38:14 -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; dkim=pass header.i=@toxicpanda-com.20150623.gappssmtp.com header.s=20150623 header.b="00lZ/ldt"; 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 S1728575AbfFRNhq (ORCPT + 99 others); Tue, 18 Jun 2019 09:37:46 -0400 Received: from mail-qk1-f194.google.com ([209.85.222.194]:38282 "EHLO mail-qk1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726248AbfFRNhq (ORCPT ); Tue, 18 Jun 2019 09:37:46 -0400 Received: by mail-qk1-f194.google.com with SMTP id a27so8538984qkk.5 for ; Tue, 18 Jun 2019 06:37:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=toxicpanda-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=dKOAWFz5cXu8yUBPgcqckTt7kzukUrCB+Jl5SHrTW/k=; b=00lZ/ldtQ7gltLCIq7U75Iv73vSu301v/xHpCBaT5vvpKcPv2SDXSgfLlBGOPRRWub qJrBYqT6uhnkX0PRQo81O6pR/V0eFDI/IHKYxz2rotg3mt/d+njmBWV+EdfR2Bcdf2rF Y0WSjknSo1RvsX503Pjc3Op3vtZ8qaUpcxEBZ2ngQBMvfF1OjXKxCfLjDT7UL6lslNI1 rlWTY2BePS7vkN7kok7590f0815mpJnT+5ETdG8yQrqWpA2QdBfz4qdZXzIBvvUPZBSc FpYf+0ETtM5FPRq2ywZskhpUCmljarKMhBq3No5fGFNGoOC4BdeT/ZTebKNnKg9OFPF5 MQKQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=dKOAWFz5cXu8yUBPgcqckTt7kzukUrCB+Jl5SHrTW/k=; b=Xf+QmyJi0ujoIj/GYBV0ys9Gl8BWw37uRN2utQHw7blC0imo5tZV4EDUWRnCdOHggC yk3ZA5xlvYRnREnFlEMe5/rm/Qe8pJMylhvUEQsxktei3YIl5Be7ZlQ6d+qyqZN69lzf a3NG0EpgKGproDqDHEX744Dj0IqoWQZ9/9brgyczfBruIZTZTjEe17gsoNZMiIUhmglg Qa34ofjtSCm34A800u2AnVV6tDlUBntPDBaQKcxQ7OswW/3FtCxHZxtWgDGYCCjQHpLZ 3K3fAYGdCEqKhRt6Py40gMl3mZ/tV7VqxFni7NdFRMTGS4IWoPdOZ9OBBhuNI3t/dJVE RbZg== X-Gm-Message-State: APjAAAUy28G8WCLjyx8VseKUSx5gWAw1kMoI7UgavybfG2wbR2NKJZQA /twhA63srOJMSAfukeTe+hNO4A== X-Received: by 2002:a37:b3c2:: with SMTP id c185mr94722667qkf.44.1560865065211; Tue, 18 Jun 2019 06:37:45 -0700 (PDT) Received: from localhost ([2620:10d:c091:480::a0ec]) by smtp.gmail.com with ESMTPSA id m5sm8188809qke.25.2019.06.18.06.37.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 18 Jun 2019 06:37:44 -0700 (PDT) Date: Tue, 18 Jun 2019 09:37:43 -0400 From: Josef Bacik To: Naohiro Aota Cc: Josef Bacik , "linux-btrfs@vger.kernel.org" , David Sterba , Chris Mason , Qu Wenruo , Nikolay Borisov , "linux-kernel@vger.kernel.org" , Hannes Reinecke , "linux-fsdevel@vger.kernel.org" , Damien Le Moal , Matias =?utf-8?B?QmrDuHJsaW5n?= , Johannes Thumshirn , Bart Van Assche Subject: Re: [PATCH 07/19] btrfs: do sequential extent allocation in HMZONED mode Message-ID: <20190618133741.62tcifdq5hth4xuj@MacBook-Pro-91.local> References: <20190607131025.31996-1-naohiro.aota@wdc.com> <20190607131025.31996-8-naohiro.aota@wdc.com> <20190613140722.lt6mvxnddnjg5lvx@MacBook-Pro-91.local> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20180716 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jun 18, 2019 at 08:28:07AM +0000, Naohiro Aota wrote: > On 2019/06/13 23:07, Josef Bacik wrote: > > On Fri, Jun 07, 2019 at 10:10:13PM +0900, Naohiro Aota wrote: > >> @@ -9616,7 +9701,8 @@ static int inc_block_group_ro(struct btrfs_block_group_cache *cache, int force) > >> } > >> > >> num_bytes = cache->key.offset - cache->reserved - cache->pinned - > >> - cache->bytes_super - btrfs_block_group_used(&cache->item); > >> + cache->bytes_super - cache->unusable - > >> + btrfs_block_group_used(&cache->item); > >> sinfo_used = btrfs_space_info_used(sinfo, true); > >> > >> if (sinfo_used + num_bytes + min_allocable_bytes <= > >> @@ -9766,6 +9852,7 @@ void btrfs_dec_block_group_ro(struct btrfs_block_group_cache *cache) > >> if (!--cache->ro) { > >> num_bytes = cache->key.offset - cache->reserved - > >> cache->pinned - cache->bytes_super - > >> + cache->unusable - > >> btrfs_block_group_used(&cache->item); > > > > You've done this in a few places, but not all the places, most notably > > btrfs_space_info_used() which is used in the space reservation code a lot. > > I added "unsable" to struct btrfs_block_group_cache, but added > nothing to struct btrfs_space_info. Once extent is allocated and > freed in an ALLOC_SEQ Block Group, such extent is never resued > until we remove the BG. I'm accounting the size of such region > in "cache->unusable" and in "space_info->bytes_readonly". So, > btrfs_space_info_used() does not need the modify. > > I admit it's confusing here. I can add "bytes_zone_unusable" to > struct btrfs_space_info, if it's better. > Ah you're right, sorry I just read it as space_info. Yes please add bytes_zone_unusable, I'd like to be as verbose as possible about where our space actually is. I know if I go to debug something and see a huge amount in read_only I'll be confused. Thanks, Josef