From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.3 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6C5B0C43332 for ; Tue, 12 Jan 2021 19:44:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4F8912310E for ; Tue, 12 Jan 2021 19:44:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2405457AbhALTob (ORCPT ); Tue, 12 Jan 2021 14:44:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48726 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2406862AbhALToa (ORCPT ); Tue, 12 Jan 2021 14:44:30 -0500 Received: from mail-qt1-x82a.google.com (mail-qt1-x82a.google.com [IPv6:2607:f8b0:4864:20::82a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DE33AC06179F for ; Tue, 12 Jan 2021 11:43:49 -0800 (PST) Received: by mail-qt1-x82a.google.com with SMTP id c14so2444932qtn.0 for ; Tue, 12 Jan 2021 11:43:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=toxicpanda-com.20150623.gappssmtp.com; s=20150623; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=0Q62QXC5y0HE8nzu56q5hevoJqXwOwpIeAtXw+tv8sQ=; b=sRvVQkDSCVAKt6BuRKri3i7+E7fsdMx/bx4KDU4N4qV13+lZ7Qd6GTSVI1VBQ4Eq/f UZ0o9ROCUluwNFmN0pHuYBKGCANsfprgRJ7Vhjo679UGaiNoyk8YlPELBQuur6YbadZU g/oQpr3bIyy1S6GAEFfKbgeoARw/uDAMvC7pnpXs2bOY/CqUs9AYPXLlnuAJfn374+Fz 8BQjDRh33CUtQHLUOzcfrazTnq9ENVcEMVw9qRHqeViZ+mtLuMs5VZbjYWpgMudOPgSy XvAQ5qJ5reqo5CEIs+b9xJ6+YM/Bwe5c7aJEiRgUF5hM8rCCpCxzV/M+xR6wv2Rr8Kyu 2vpA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=0Q62QXC5y0HE8nzu56q5hevoJqXwOwpIeAtXw+tv8sQ=; b=nClU3Xyoh/g2r+E+pN1uTvjPtEm2NsZAPmP3USpM9afHaoSGDbC1hPj4VkMw0d/YS6 hAhYtAzAcC5/ZmCzXrTcfKqX48OAfGPzXiYbeNdfpW6DGULqsKe5I4wufOqEbJwwMkfa rlbmJChgFhMD2IY5k8Q4oUdnAkXIwk7LwuJl/OBM9gV9dYnu+oeieLpEbfGPVLRzOLNr HUOh3fdq82f0PI2CUNmbow5bfLCDAMdGpIRXC3WaJvZ3OIuOQmuWVFJlQAT2nA+gSU2l KQGx2jeTvs/uGVV4Lxl5Bhl0R18PerZkZSru2H4mrrgx1iHIXenFXqcvz1utLCScjWO0 SX7Q== X-Gm-Message-State: AOAM5316PWDjqbcgheqzYFFXsqE3SUGFg5YT/Dh2PRn56vOkVnoqNevK eW2vyzWzUW+ZCrrgRvLUgsz/dA== X-Google-Smtp-Source: ABdhPJyiWnKE8RUIu+9PVFiFmiHPrAduaqpL0KVN88/T1oUfj2iVfZk94RheacLr15C5RTzFwBoL/Q== X-Received: by 2002:aed:3b75:: with SMTP id q50mr635372qte.185.1610480629048; Tue, 12 Jan 2021 11:43:49 -0800 (PST) Received: from [192.168.1.45] (cpe-174-109-172-136.nc.res.rr.com. [174.109.172.136]) by smtp.gmail.com with ESMTPSA id q70sm1903502qka.107.2021.01.12.11.43.47 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 12 Jan 2021 11:43:48 -0800 (PST) Subject: Re: [PATCH v11 35/40] btrfs: enable relocation in ZONED mode To: Naohiro Aota , linux-btrfs@vger.kernel.org, dsterba@suse.com Cc: hare@suse.com, linux-fsdevel@vger.kernel.org, Jens Axboe , Christoph Hellwig , "Darrick J. Wong" References: <06add214bc16ef08214de1594ecdfcc4cdcdbd78.1608608848.git.naohiro.aota@wdc.com> From: Josef Bacik Message-ID: Date: Tue, 12 Jan 2021 14:43:47 -0500 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.6.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org On 12/21/20 10:49 PM, Naohiro Aota wrote: > To serialize allocation and submit_bio, we introduced mutex around them. As > a result, preallocation must be completely disabled to avoid a deadlock. > > Since current relocation process relies on preallocation to move file data > extents, it must be handled in another way. In ZONED mode, we just truncate > the inode to the size that we wanted to pre-allocate. Then, we flush dirty > pages on the file before finishing relocation process. > run_delalloc_zoned() will handle all the allocation and submit IOs to the > underlying layers. > > Signed-off-by: Naohiro Aota > --- > fs/btrfs/relocation.c | 35 +++++++++++++++++++++++++++++++++-- > 1 file changed, 33 insertions(+), 2 deletions(-) > > diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c > index 30a80669647f..94c72bea6a43 100644 > --- a/fs/btrfs/relocation.c > +++ b/fs/btrfs/relocation.c > @@ -2553,6 +2553,32 @@ static noinline_for_stack int prealloc_file_extent_cluster( > if (ret) > return ret; > > + /* > + * In ZONED mode, we cannot preallocate the file region. Instead, we > + * dirty and fiemap_write the region. > + */ > + nit: extra newline. otherwise you can add Reviewed-by: Josef Bacik Thanks, Josef