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=-8.7 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_NEOMUTT 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 398C6C31E45 for ; Thu, 13 Jun 2019 15:10:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0D8A921473 for ; Thu, 13 Jun 2019 15:10:10 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=toxicpanda-com.20150623.gappssmtp.com header.i=@toxicpanda-com.20150623.gappssmtp.com header.b="slju5Mk6" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733243AbfFMPJw (ORCPT ); Thu, 13 Jun 2019 11:09:52 -0400 Received: from mail-qk1-f195.google.com ([209.85.222.195]:45651 "EHLO mail-qk1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732350AbfFMN5O (ORCPT ); Thu, 13 Jun 2019 09:57:14 -0400 Received: by mail-qk1-f195.google.com with SMTP id s22so12766027qkj.12 for ; Thu, 13 Jun 2019 06:57:13 -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=f8oWkNqIH/DyMOHXpAxjAXd9mO+eys1GPI1tYBrhm3o=; b=slju5Mk6NV/PybHINi/s0pm6qI/7D6HmQM7KjmNLHuc4tFszrsyyy2yzDtVxHIyZXU D16qWNlslGJsEDu9eDPf3JwbhandiXXH++FTeppARL3Qd/NiqI5Pp2oCtFEZhIAwLyUv yeeTLdKcReDi3yCS+hpmrO9v6m1Cue5zcQwZ7NMqUeGI09kjehpUfvP/YAp+4+5/1aHs yJCLWDijzSXk/Vb0zuf0I0T+fN/Axvx4dP/JbBiWZxiHsw8xEqHo/XuCklQnd+DUeRQn bvbiuPQMt6+MjmCX57lD2xIeNihagvn8rpuGrrJSKJkTh66ndPXMZmwj2z7rOEgjWcLW UvbA== 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=f8oWkNqIH/DyMOHXpAxjAXd9mO+eys1GPI1tYBrhm3o=; b=QR9nP1WGsEmqFURmnqI9dQpym+KhX8L5jEWBYbX1EcxmF7fDV5KV3OYUyo5elhrOHt dVll1SHb71ow3ZVQYvdqrSB+8T0rGfNfKmwyxREekrKcux8bPmgMYJI3dFCnrAs29qmC CNWyYVzyOVyXZJPMnPbAApHQJfW0vTHMfPjEra+PTSJSKPgf74GJrL1i30dVGCdrneib EH8iuk+vfE8eNTC492/5WkXJbxopJ0fUJtxCOgbIzr/0rPGAOaiUDz8lWkn+7yon3al7 C9HMXVEZkHs6l8NsQ/nj0o1QXIhVdz8QZDFan4sY7/L2C56qSuc+3H+13Wg4LDvUf+bn G9gA== X-Gm-Message-State: APjAAAXJXrP7+g1CMind+nX0KoYhuypJM+xBP7kTyhfo/sLau6Set+LT nOtkjJ0g+10nZgirxuhFmkVFUQ== X-Google-Smtp-Source: APXvYqxGT1il2X6VOFbyz2RJsVGEMTFswkGE2VcTUWavs7aHJ61x1eQsmlCA1IQqdvrv4u7hG1Ld+w== X-Received: by 2002:ae9:f303:: with SMTP id p3mr5719058qkg.320.1560434233077; Thu, 13 Jun 2019 06:57:13 -0700 (PDT) Received: from localhost ([2620:10d:c091:480::9d6b]) by smtp.gmail.com with ESMTPSA id m44sm1846636qtm.54.2019.06.13.06.57.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 13 Jun 2019 06:57:12 -0700 (PDT) Date: Thu, 13 Jun 2019 09:57:11 -0400 From: Josef Bacik To: Naohiro Aota Cc: linux-btrfs@vger.kernel.org, David Sterba , Chris Mason , Josef Bacik , 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 03/19] btrfs: Check and enable HMZONED mode Message-ID: <20190613135710.nu5r5bpcwdm4we2w@MacBook-Pro-91.local> References: <20190607131025.31996-1-naohiro.aota@wdc.com> <20190607131025.31996-4-naohiro.aota@wdc.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190607131025.31996-4-naohiro.aota@wdc.com> User-Agent: NeoMutt/20180716 Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org On Fri, Jun 07, 2019 at 10:10:09PM +0900, Naohiro Aota wrote: > HMZONED mode cannot be used together with the RAID5/6 profile for now. > Introduce the function btrfs_check_hmzoned_mode() to check this. This > function will also check if HMZONED flag is enabled on the file system and > if the file system consists of zoned devices with equal zone size. > > Additionally, as updates to the space cache are in-place, the space cache > cannot be located over sequential zones and there is no guarantees that the > device will have enough conventional zones to store this cache. Resolve > this problem by disabling completely the space cache. This does not > introduces any problems with sequential block groups: all the free space is > located after the allocation pointer and no free space before the pointer. > There is no need to have such cache. > > Signed-off-by: Damien Le Moal > Signed-off-by: Naohiro Aota > --- > fs/btrfs/ctree.h | 3 ++ > fs/btrfs/dev-replace.c | 7 +++ > fs/btrfs/disk-io.c | 7 +++ > fs/btrfs/super.c | 12 ++--- > fs/btrfs/volumes.c | 99 ++++++++++++++++++++++++++++++++++++++++++ > fs/btrfs/volumes.h | 1 + > 6 files changed, 124 insertions(+), 5 deletions(-) > > diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h > index b81c331b28fa..6c00101407e4 100644 > --- a/fs/btrfs/ctree.h > +++ b/fs/btrfs/ctree.h > @@ -806,6 +806,9 @@ struct btrfs_fs_info { > struct btrfs_root *uuid_root; > struct btrfs_root *free_space_root; > > + /* Zone size when in HMZONED mode */ > + u64 zone_size; > + > /* the log root tree is a directory of all the other log roots */ > struct btrfs_root *log_root_tree; > > diff --git a/fs/btrfs/dev-replace.c b/fs/btrfs/dev-replace.c > index ee0989c7e3a9..fbe5ea2a04ed 100644 > --- a/fs/btrfs/dev-replace.c > +++ b/fs/btrfs/dev-replace.c > @@ -201,6 +201,13 @@ static int btrfs_init_dev_replace_tgtdev(struct btrfs_fs_info *fs_info, > return PTR_ERR(bdev); > } > > + if ((bdev_zoned_model(bdev) == BLK_ZONED_HM && > + !btrfs_fs_incompat(fs_info, HMZONED)) || > + (!bdev_is_zoned(bdev) && btrfs_fs_incompat(fs_info, HMZONED))) { You do this in a few places, turn this into a helper please. > + ret = -EINVAL; > + goto error; > + } > + > filemap_write_and_wait(bdev->bd_inode->i_mapping); > > devices = &fs_info->fs_devices->devices; > diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c > index 663efce22d98..7c1404c76768 100644 > --- a/fs/btrfs/disk-io.c > +++ b/fs/btrfs/disk-io.c > @@ -3086,6 +3086,13 @@ int open_ctree(struct super_block *sb, > > btrfs_free_extra_devids(fs_devices, 1); > > + ret = btrfs_check_hmzoned_mode(fs_info); > + if (ret) { > + btrfs_err(fs_info, "failed to init hmzoned mode: %d", > + ret); > + goto fail_block_groups; > + } > + > ret = btrfs_sysfs_add_fsid(fs_devices, NULL); > if (ret) { > btrfs_err(fs_info, "failed to init sysfs fsid interface: %d", > diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c > index 2c66d9ea6a3b..740a701f16c5 100644 > --- a/fs/btrfs/super.c > +++ b/fs/btrfs/super.c > @@ -435,11 +435,13 @@ int btrfs_parse_options(struct btrfs_fs_info *info, char *options, > bool saved_compress_force; > int no_compress = 0; > > - cache_gen = btrfs_super_cache_generation(info->super_copy); > - if (btrfs_fs_compat_ro(info, FREE_SPACE_TREE)) > - btrfs_set_opt(info->mount_opt, FREE_SPACE_TREE); > - else if (cache_gen) > - btrfs_set_opt(info->mount_opt, SPACE_CACHE); > + if (!btrfs_fs_incompat(info, HMZONED)) { > + cache_gen = btrfs_super_cache_generation(info->super_copy); > + if (btrfs_fs_compat_ro(info, FREE_SPACE_TREE)) > + btrfs_set_opt(info->mount_opt, FREE_SPACE_TREE); > + else if (cache_gen) > + btrfs_set_opt(info->mount_opt, SPACE_CACHE); > + } > This disables the free space tree as well as the cache, sounds like you only need to disable the free space cache? Thanks, Josef