Received: by 2002:a05:7208:3003:b0:81:def:69cd with SMTP id f3csp4206440rba; Tue, 2 Apr 2024 10:08:49 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUJC684BqBBChcBdL8YYtZ3IixtB02TF3rqM5yN/P9NaHZGk8djh0BkUgqbC8Qi3zP+dPjKYG9ssXjwb57HQ54MgJbPGDSN1BVr+1H20A== X-Google-Smtp-Source: AGHT+IGoIPdItFU//J8WQl6TGt9x6rOFrX/Gi17qm0eVFJIMNODopOEgTz5hApaTTvjKfckkldb3 X-Received: by 2002:a17:906:fa92:b0:a46:4e73:9c67 with SMTP id lt18-20020a170906fa9200b00a464e739c67mr9062474ejb.68.1712077729410; Tue, 02 Apr 2024 10:08:49 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712077729; cv=pass; d=google.com; s=arc-20160816; b=S+qqPuaKKWOtGiyn6OOwURcoZ9hiF51Tw9H1x76DaK/3ktUnyWNoRCP2tXAiwLsk4h B6y9OUM14lusTf49CF0uwT0zCo7dhepdQaOVIlodAAZKN2Vc882j1T5JL60pTHe3DlCk f6e4/GuCBlZxyaePvS9jtVqd71bDr/IJtIKnMRZhHmfhoZB7OkoTsL1HrBnjxDJXg0yY lUT2SThgkvlBb/nOvqw2L8A6LaexZomzk6zVIqHbk6TLu6ATPlq7k79SzMVyiIX89GTz bBOohoF0tTj7Kjew/aPDfzfj5D0nHpDj4F4b8jihYXzOdoNdSbKGu9yvt12xPaJB5Jt9 rQbg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:feedback-id:dkim-signature:dkim-signature; bh=TURyX1gw0Lrfp1rYT1WtTcynEOJb+n9CGGHRW+UIORY=; fh=PdeVeeQCcqzw0MtZH/XC7JkpKqLkKCKs8gyd3oQFu/E=; b=fcUsDD0XTMQ0hS8549oB3EJE4UwzhiD7+HdYQMNRA4lwcXgJCfrm1zrQrQemNXetVk VKrEQCjDSTVkL5/2mYNei/jrUmNwHn/o2PlNptvbxmgJxZKA42VhxpF9M8dyWZ1bYDbw iafntcfQ8XS3OtL/DC2dRS79gZd3dH5NHnNORSHiNswR4BGdkZueng6Ayg/SJmfExDrr cDdZ70NWia1YatbUiJOg8u58c3hrZVPKZeU83YVU+dkjn1bXDJUGLUJmOusKpq95eP5S FWtAOGKgEpDlObslkO68DgFF6CTm/ljIk+FD7gO7+W9xDLSTEINTVmaMIzZhEF0UxsfG MQFw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@bur.io header.s=fm3 header.b=BAk6HSlR; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b="lXQLr2/S"; arc=pass (i=1 spf=pass spfdomain=bur.io dkim=pass dkdomain=bur.io dkim=pass dkdomain=messagingengine.com); spf=pass (google.com: domain of linux-kernel+bounces-128405-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-128405-linux.lists.archive=gmail.com@vger.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 bv13-20020a170906b1cd00b00a4e24e03d22si5522095ejb.284.2024.04.02.10.08.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Apr 2024 10:08:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-128405-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=@bur.io header.s=fm3 header.b=BAk6HSlR; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b="lXQLr2/S"; arc=pass (i=1 spf=pass spfdomain=bur.io dkim=pass dkdomain=bur.io dkim=pass dkdomain=messagingengine.com); spf=pass (google.com: domain of linux-kernel+bounces-128405-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-128405-linux.lists.archive=gmail.com@vger.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 E18FD1F2189B for ; Tue, 2 Apr 2024 17:08:48 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5E41315A4AF; Tue, 2 Apr 2024 17:08:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bur.io header.i=@bur.io header.b="BAk6HSlR"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="lXQLr2/S" Received: from out5-smtp.messagingengine.com (out5-smtp.messagingengine.com [66.111.4.29]) (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 80D9B15990A; Tue, 2 Apr 2024 17:08:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=66.111.4.29 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712077686; cv=none; b=Pbjw+qHcHhE6nP82kQfiIeFD3YqXJ7fAsTri2kkia92kCWK3efqgxewlULLoQIeKHjxxSrhr6S1pBdoKqoOWzUGIE5OfBY2uoV+JEL4gDQJNgUSpq4mD5NtqLhbA8TbzNgX9QTAO0Zawwn/P5kDH4nmVo4nlX98W3Y2bSnEsy60= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712077686; c=relaxed/simple; bh=NPKBSPd4OtXtJxfl6EHCaRvOP+p8vmUs8gwRYnZmPIA=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=aeL9iUlS3PdSHAAA0Dl2PcmFGqPWEB0Aw0X3YuF/dh1PZ7raHVb3MoJIOqNJ+5eFdLWapdbEAJUBihh0j0wVxWS8mXxsx4/U+l/HEV2G38hh+ijPCyL3ZEugAsGzbITyg3xken0Pdbf53FZXBI+1bwMahy19ZqhyPBZ7XxnNC4k= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=bur.io; spf=pass smtp.mailfrom=bur.io; dkim=pass (2048-bit key) header.d=bur.io header.i=@bur.io header.b=BAk6HSlR; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=lXQLr2/S; arc=none smtp.client-ip=66.111.4.29 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=bur.io Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bur.io Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 7CB155C0060; Tue, 2 Apr 2024 13:08:03 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Tue, 02 Apr 2024 13:08:03 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bur.io; h=cc:cc :content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm3; t=1712077683; x=1712164083; bh=TURyX1gw0L rfp1rYT1WtTcynEOJb+n9CGGHRW+UIORY=; b=BAk6HSlRUeftYgizsoPsLW1a1X Vdddm2EPll/xZ9JDRCMJ6g5LmCAn7g2LW8jiEdexhH1iOtIF1ZLSQi5zdpQfPCa1 nJBA4wB6jANR3Nn5o6wg0DCTZn7eqp3Um+yG21g2fLT9t+JLGtxTa3Uez7ApSUXm r2fxQ+lG3HIRnsJJxrNnwgRtFkz7iMzXFa1GF4i6aFTDX1iUdIsT9XfDklymtFe0 5X3EesHKzP3EqeIn8+M9PpyzQiWzRRb2jPx9uZi79Kc/unqUeqjrxhN/SzJwAswI uwO9HYDlU9nLOXcmXgT5mMQ/tRIWTHLj38asq620M8nYyVKF1VozheScDxrQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; t=1712077683; x=1712164083; bh=TURyX1gw0Lrfp1rYT1WtTcynEOJb +n9CGGHRW+UIORY=; b=lXQLr2/SY0ZDTlx7+P8fCtO3feoukrEm6np6gJjWZzM1 ewlaoCt1kpgstdi8IcjxAOAutVU2oc/rRcUWst+o77+qTOqSoNH3RSFoU6mWqHtL mnQ1Qi3KMu+GB2PJJ2uc/r4lq3qudhYIfvh2iotHtyGO3cJ7StJ7ODcAfvtejmPc Pj92TmTR6lvH0nQL2sZ7Nmaguh61CD9XfY49nsWhIrj1oZO+A1XZn5JTut7npGyM gV8S7jYVoY0ueq4Ony2PIOp9G2O1XCVr+ice0evHdRHog5YgAshqfZFWmqMFPs8u d0TP6U8B6FwlsgXn6wSbKS1kP7NUbVae2pjfxqcQnQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrudefvddguddtlecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpeffhffvvefukfhfgggtuggjsehttdertddttddvnecuhfhrohhmpeeuohhr ihhsuceuuhhrkhhovhcuoegsohhrihhssegsuhhrrdhioheqnecuggftrfgrthhtvghrnh epkedvkeffjeellefhveehvdejudfhjedthfdvveeiieeiudfguefgtdejgfefleejnecu vehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepsghorhhish essghurhdrihho X-ME-Proxy: Feedback-ID: i083147f8:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 2 Apr 2024 13:08:02 -0400 (EDT) Date: Tue, 2 Apr 2024 10:09:59 -0700 From: Boris Burkov To: Johannes Thumshirn Cc: Chris Mason , Josef Bacik , David Sterba , linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org, Hans Holmberg , Naohiro Aota , hch@lst.de, Damien LeMoal , Johannes Thumshirn Subject: Re: [PATCH RFC PATCH 3/3] btrfs: zoned: kick cleaner kthread if low on space Message-ID: <20240402170959.GB3175858@zen.localdomain> References: <20240328-hans-v1-0-4cd558959407@kernel.org> <20240328-hans-v1-3-4cd558959407@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240328-hans-v1-3-4cd558959407@kernel.org> On Thu, Mar 28, 2024 at 02:56:33PM +0100, 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. I'm really excited about this and think it probably makes sense on not-zoned as well. Have you found that this is a fast enough to help real allocations that are in trouble? I'd be worried that it's a lot faster than waiting 30 seconds but still not urgent enough to save the day for someone trying to allocate right now. Not a blocking request for this patch, which I think is a definite improvement, but we could do something like add a pass to find_free_extent (before allocating a fresh BG?!?) that blocks on reclaim running if we have kicked it (or errors out in a way that signals to the outer loop that we can wait for reclaim, if needed for locking or whatever) > > 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); > + } > + > while (pos < hole_end) { > begin = pos >> shift; > end = begin + nzones; > > -- > 2.35.3 >