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=unavailable 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 81365C4332E 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 668062311A for ; Tue, 12 Jan 2021 19:44:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2406876AbhALToa (ORCPT ); Tue, 12 Jan 2021 14:44:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48724 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2405457AbhALToa (ORCPT ); Tue, 12 Jan 2021 14:44:30 -0500 Received: from mail-qt1-x832.google.com (mail-qt1-x832.google.com [IPv6:2607:f8b0:4864:20::832]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DC55FC061795 for ; Tue, 12 Jan 2021 11:43:49 -0800 (PST) Received: by mail-qt1-x832.google.com with SMTP id b9so2434610qtr.2 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=bg8Z1fsK4HQa+PlejnAF2rsXzSeXxunapot44Ar0buaPkg58XvyNQQKRWE5+Pv0MLf N/xBAzYQBDjFhJyRxCMm11Qe7EOKc1Mbm1A1UXTrmvy6jBlQklDlaGJWi+lJXirU6Ycn beUDrt9ugJFCNHk81cSM/CMW16JhAKmRxIVeHYS+FsDeytWcI+8OK136OtX/qxBDAp+N 2hal+1yBRG1Z2I5zMvTh1w43XGwv8umT/h5W8pJifvQhMM9ATavh3A9mkhEPukMQczdZ gEAaYjrfYXavHDWYrhFPh1zg1FIqtRyXFSDCojeDTLiKfjJjfguGjOY/S9+uAA31WGoh yuCQ== X-Gm-Message-State: AOAM533tI2gSWodfASHHrvNKWWR2CcEf2JDGUHTRtXXW7/LI7obyJlHn qbZqWBvjVW++FuSgc7G0WCbEjw== 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-fsdevel@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