Received: by 2002:ab2:b82:0:b0:1f3:401:3cfb with SMTP id 2csp762117lqh; Thu, 28 Mar 2024 16:06:45 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWpvHeJy3LRCfTJ/xLk0H7JNCpT1X7ShY6fYf3k35hrTaciEvLYWwly6Z88QQ40BocJumo0aeb2qC9OMOARG2VCCmkZ9STgX+P4vaOMSg== X-Google-Smtp-Source: AGHT+IHc9a2I+3AhEJBw60sSNezHIKvzhIOx+1NG4SQ7g+HKOO/updB9xo64pARu4ngXPM05DEi1 X-Received: by 2002:a05:651c:484:b0:2d6:ec1b:ee06 with SMTP id s4-20020a05651c048400b002d6ec1bee06mr278208ljc.11.1711667204873; Thu, 28 Mar 2024 16:06:44 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711667204; cv=pass; d=google.com; s=arc-20160816; b=iXqkwk+eKympBByS3ZogE7aW/Xhisp7eGuJjTRRrPpTBHIH/Sc3xe+rq4cU4kayZu7 F0O6aPYgomxvU0EXh/HCW2i35WIEIgoFb5fxbGjVD2EHd8S2WLN8hTfss1Z3ZUSUWVeC EXO+RIplnCX/hb2aUdBsCgq66MONZPTqZsl6TCQukT5tOr/nT7QRu1qjCo/69MIeLYLE H1G7LdaBhq4hCwjX8wDioAscFDdMuWz/RqiorMScM5hvKRR+kma72UET4qjuCRF/t5Kz jLOx+GhnsdqEe+vnX1TFgEGh9oLYf10OnAf9jg+rNMxp2yUgq1F5JZ8HvVgmfHXYqbY8 x6Xw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:organization:content-language :from:references:cc:to:subject:user-agent:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:date:message-id :dkim-signature; bh=xaLHa9FSj73vqQdXV5dvbVOET3JnFGKw67KgHx3F10I=; fh=58LfGf/Wy9kovFg3M7EljVvVUK9uTbGAcOWMXXQywzI=; b=CyJSLZN12qwl/yx/cHhol7KEn9Sv+srcuIM/nelSM9iVv96dbEu2XiIt0zLbADVEMz 3PwrbKk5rA3kVOqYi2BEbNkPQoY/+s3/lgyyCR4Zqh4mbcx91ZjKBRGlvfiRISOtA5ks +MUaJQEM5zkd7+Svvetug+n0BW7rE68zsPS8TgwbIE+SN0+brYP2wNs+NnE7HHNCzxtq 4cB8VN7gvoipWZKUb/qqRZ/EEmAwabDonfoTAg76ClwLxF5d1IXUs257Vdag2I25MGWa qMFq90I+9BNb9g8owbe7ErPsvYntgGxlzLnDl+HrybvH9UCF4pGb7gbCsRWDE51z+Bm6 9oFw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=PLztQ9+a; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-123797-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-123797-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id s14-20020a50ab0e000000b00568a61c6d0asi1210810edc.37.2024.03.28.16.06.44 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Mar 2024 16:06:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-123797-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=PLztQ9+a; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-123797-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-123797-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 933131F243A7 for ; Thu, 28 Mar 2024 23:06:44 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B85445A78D; Thu, 28 Mar 2024 23:06:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="PLztQ9+a" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D5B784F894; Thu, 28 Mar 2024 23:06:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711667194; cv=none; b=Zj52Kf4TpRyplos8aw7anOBoGoVb3jx4RL+2VdQEut87kF6ROsy9QOD1HTvqmARmo7IK6gVIFrPDUcmQEKo9ice0mP6A/WsZHr2IIkhjbnED6SidcIT+wSUOw9C6LSEjhc1LzaZi3RaFGDLIfzFk/OBwvc3c60uad42iy1vVcXM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711667194; c=relaxed/simple; bh=nd5x1ybpixe+3ggSR5AVPu2UVKBuDSJyT9R7JTnPC5A=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=GWVk6DnjjLZ52oKX1qeu6YilGic/1YUM72RAexb8JwT/V8TA9eTcq3oEjAn58P4NUR8dTKZBnvhodbQfcHvZUx3sttB1ExJHP4PoCysuwOEXTeJs/v+++56hSggJ5DXpNjJtV7GtVwDwuBtXcAZoJ2DOrBrkfOes1tYMRVoZQ1Y= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=PLztQ9+a; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id D5A08C433C7; Thu, 28 Mar 2024 23:06:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711667194; bh=nd5x1ybpixe+3ggSR5AVPu2UVKBuDSJyT9R7JTnPC5A=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=PLztQ9+aVXZ5alE/iE5HTzU/Y9ICIozNm/mAZBO0V/+Qlk1+kmASBMxUDZdDLRiue fIZv9ohF1u1bPAt2DP5+XaZoxu3+faFidqTHs9UAHKHgoCI60+1QE+e4nbReC3UXmY Si6f0wrzOluvM6AYGqACTxnACH7ugUbac839EvfOcBWwRu9uGMdDmWOjJP0WiHVqP4 KKHnOd8N0nQaeHgPpFeQUA7rSI+hAfzQq007jy/uuEIdALo6jpDc7KNEzP+P8ftJ+s 2VbCH/UhM7HaNfxk6su5d8UmGtT00X4XCooOv9Tjldb9Y8cnW+6fZtCE3hK0TApbiU 7HxKeczIDrSSg== Message-ID: <032b0938-88fe-4129-8e49-6d4634ea1844@kernel.org> Date: Fri, 29 Mar 2024 08:06:31 +0900 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH RFC PATCH 3/3] btrfs: zoned: kick cleaner kthread if low on space To: Johannes Thumshirn , Chris Mason , Josef Bacik , David Sterba Cc: linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org, Hans Holmberg , Naohiro Aota , hch@lst.de, Boris Burkov , Johannes Thumshirn References: <20240328-hans-v1-0-4cd558959407@kernel.org> <20240328-hans-v1-3-4cd558959407@kernel.org> From: Damien Le Moal Content-Language: en-US Organization: Western Digital Research In-Reply-To: <20240328-hans-v1-3-4cd558959407@kernel.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 3/28/24 22:56, Johannes Thumshirn wrote: > From: Johannes Thumshirn > > Kick the cleaner kthread on chunk allocation if we're slowly running out > of usable space on a zoned filesystem. > > Signed-off-by: Johannes Thumshirn > --- > fs/btrfs/zoned.c | 6 ++++++ > 1 file changed, 6 insertions(+) > > diff --git a/fs/btrfs/zoned.c b/fs/btrfs/zoned.c > index fb8707f4cab5..25c1a17873db 100644 > --- a/fs/btrfs/zoned.c > +++ b/fs/btrfs/zoned.c > @@ -1040,6 +1040,7 @@ int btrfs_reset_sb_log_zones(struct block_device *bdev, int mirror) > u64 btrfs_find_allocatable_zones(struct btrfs_device *device, u64 hole_start, > u64 hole_end, u64 num_bytes) > { > + struct btrfs_fs_info *fs_info = device->fs_info; > struct btrfs_zoned_device_info *zinfo = device->zone_info; > const u8 shift = zinfo->zone_size_shift; > u64 nzones = num_bytes >> shift; > @@ -1051,6 +1052,11 @@ u64 btrfs_find_allocatable_zones(struct btrfs_device *device, u64 hole_start, > ASSERT(IS_ALIGNED(hole_start, zinfo->zone_size)); > ASSERT(IS_ALIGNED(num_bytes, zinfo->zone_size)); > > + if (!test_bit(BTRFS_FS_CLEANER_RUNNING, &fs_info->flags) && > + btrfs_zoned_should_reclaim(fs_info)) { > + wake_up_process(fs_info->cleaner_kthread); > + } Nit: no need for the curly brackets. > + > while (pos < hole_end) { > begin = pos >> shift; > end = begin + nzones; > -- Damien Le Moal Western Digital Research