Received: by 2002:a25:f815:0:0:0:0:0 with SMTP id u21csp2825698ybd; Thu, 27 Jun 2019 20:56:42 -0700 (PDT) X-Google-Smtp-Source: APXvYqwBhtYSbtoH+0ddzoIQtkoZDNpQrwGMOdq+Ixk3KoTlh1cOad2PkN3eAc84meuHJG2AL+jZ X-Received: by 2002:a17:90a:db52:: with SMTP id u18mr10454467pjx.107.1561694202533; Thu, 27 Jun 2019 20:56:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561694202; cv=none; d=google.com; s=arc-20160816; b=BxYHNGZB7qISUtJBENqBXCGTp7KuNcMzPwQCsrnTF/t0oP2L3P1OE17/RBns0CYgXd AD6FFDhyhBCzyvEKoM69nvTlbVzWPrrGIsMJE8J+pRS6MoRf5iaR39NNMa9Kxi6yHMG0 JME8to0lA8VpGkBYr0xH6zie52AYyhVtfSXwRqXq9AmVoNCV6KZ08pgUIBOHvRe5APa1 Vvab9BTHzgfq32U7FmtLSQqO7c2PMnSDw/qxINbPy0f8mj/0YWyYp4GdJDhMQPcCQCJj 98fjQVJV/mXflmhH2KxKdXPAiOZAxfwt9ZOzQl/A2hI5kHMXJ1F/yZJXECJ9UaEioHj6 Omhw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=qoSzCPCCpXWHwOhkoHrIjqbxyk10xabogj8Yt3/QUS0=; b=CIBdaJUGy9gzqc2OFPNtgksCGWLluNjKJCYOW1SD+v6d+tB3LWfoIjVmc8232Zyydg 1ZhlBDzq7WGMpi3Bj5Rkhf3eVMizWYs8RILPgwz6H5+42WneGHMpZsVhJeq8XB9OyUts VJKrc/A7ozrkVe2KU3P8BqlcJxq2YvDvj0TnYv5a0p0EuiiGkpQrMvu3ryrQstaJAWDR 46PVI/Mf7abXC+YRXMB1rpqZPysiCQwIi1ckfE8QrQzXhO7yJf56fsBjAg8orXjYkoGS xnHLCPz8WfvYer55VHJRSB9pkIPMu61SVjRTWHP5heraQn3VxyMuxKMANkUSAjYmDphN 2XlA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2018-07-02 header.b=jfYXyDgO; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 18si1021072pgw.101.2019.06.27.20.56.25; Thu, 27 Jun 2019 20:56:42 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2018-07-02 header.b=jfYXyDgO; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727243AbfF1D4P (ORCPT + 99 others); Thu, 27 Jun 2019 23:56:15 -0400 Received: from userp2130.oracle.com ([156.151.31.86]:56060 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726817AbfF1D4P (ORCPT ); Thu, 27 Jun 2019 23:56:15 -0400 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x5S3ssRB017302; Fri, 28 Jun 2019 03:56:02 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=subject : to : cc : references : from : message-id : date : mime-version : in-reply-to : content-type : content-transfer-encoding; s=corp-2018-07-02; bh=qoSzCPCCpXWHwOhkoHrIjqbxyk10xabogj8Yt3/QUS0=; b=jfYXyDgO6mbJw+tTplAh4kIQep1m/UfLsztlmoIkTJs8ouObELdPPyMPt/7ML+Bp2Rql gFEf/eYP/0MoWa14+74N7sIMkvMtrfwxrbgG1wbD9iPNzOns6qd/93ekVybl6rhRAgh1 46jYE7tazyt9SAdsXSsq1Z1w18WpMOVNGm+XC9y2irWSQsaYF/1untylkGP8gqLHI4yk lvb9lpNQ2TzFW7RNV2PqmDdG57PVEpmOYoFuVi6wIUGFejqlnJRqmkLp5EGhj+hYDVPF ct5SjwYFAERb2/6zl2MHn7tFBuCQ3AVmzcNIb87dh6WLW8LMzqEUQ8WOz3fXJC33BiJN oQ== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by userp2130.oracle.com with ESMTP id 2t9brtke49-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 28 Jun 2019 03:56:02 +0000 Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x5S3txhF054313; Fri, 28 Jun 2019 03:56:01 GMT Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by userp3030.oracle.com with ESMTP id 2t99f5bwqv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 28 Jun 2019 03:56:01 +0000 Received: from abhmp0016.oracle.com (abhmp0016.oracle.com [141.146.116.22]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id x5S3tw8h021176; Fri, 28 Jun 2019 03:55:59 GMT Received: from [10.190.130.61] (/192.188.170.109) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 27 Jun 2019 20:55:58 -0700 Subject: Re: [PATCH 09/19] btrfs: limit super block locations in HMZONED mode To: Naohiro Aota , linux-btrfs@vger.kernel.org, David Sterba Cc: Chris Mason , Josef Bacik , Qu Wenruo , Nikolay Borisov , linux-kernel@vger.kernel.org, Hannes Reinecke , linux-fsdevel@vger.kernel.org, Damien Le Moal , =?UTF-8?Q?Matias_Bj=c3=b8rling?= , Johannes Thumshirn , Bart Van Assche References: <20190607131025.31996-1-naohiro.aota@wdc.com> <20190607131025.31996-10-naohiro.aota@wdc.com> From: Anand Jain Message-ID: <0ca3c475-fe10-4135-ddc9-7a82cc966d9a@oracle.com> Date: Fri, 28 Jun 2019 11:55:51 +0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <20190607131025.31996-10-naohiro.aota@wdc.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9301 signatures=668688 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1906280039 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9301 signatures=668688 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1011 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1906280039 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 7/6/19 9:10 PM, Naohiro Aota wrote: > When in HMZONED mode, make sure that device super blocks are located in > randomly writable zones of zoned block devices. That is, do not write super > blocks in sequential write required zones of host-managed zoned block > devices as update would not be possible. By design all copies of SB must be updated at each transaction, as they are redundant copies they must match at the end of each transaction. Instead of skipping the sb updates, why not alter number of copies at the time of mkfs.btrfs? Thanks, Anand > Signed-off-by: Damien Le Moal > Signed-off-by: Naohiro Aota > --- > fs/btrfs/disk-io.c | 11 +++++++++++ > fs/btrfs/disk-io.h | 1 + > fs/btrfs/extent-tree.c | 4 ++++ > fs/btrfs/scrub.c | 2 ++ > 4 files changed, 18 insertions(+) > > diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c > index 7c1404c76768..ddbb02906042 100644 > --- a/fs/btrfs/disk-io.c > +++ b/fs/btrfs/disk-io.c > @@ -3466,6 +3466,13 @@ struct buffer_head *btrfs_read_dev_super(struct block_device *bdev) > return latest; > } > > +int btrfs_check_super_location(struct btrfs_device *device, u64 pos) > +{ > + /* any address is good on a regular (zone_size == 0) device */ > + /* non-SEQUENTIAL WRITE REQUIRED zones are capable on a zoned device */ > + return device->zone_size == 0 || !btrfs_dev_is_sequential(device, pos); > +} > + > /* > * Write superblock @sb to the @device. Do not wait for completion, all the > * buffer heads we write are pinned. > @@ -3495,6 +3502,8 @@ static int write_dev_supers(struct btrfs_device *device, > if (bytenr + BTRFS_SUPER_INFO_SIZE >= > device->commit_total_bytes) > break; > + if (!btrfs_check_super_location(device, bytenr)) > + continue; > > btrfs_set_super_bytenr(sb, bytenr); > > @@ -3561,6 +3570,8 @@ static int wait_dev_supers(struct btrfs_device *device, int max_mirrors) > if (bytenr + BTRFS_SUPER_INFO_SIZE >= > device->commit_total_bytes) > break; > + if (!btrfs_check_super_location(device, bytenr)) > + continue; > > bh = __find_get_block(device->bdev, > bytenr / BTRFS_BDEV_BLOCKSIZE, > diff --git a/fs/btrfs/disk-io.h b/fs/btrfs/disk-io.h > index a0161aa1ea0b..70e97cd6fa76 100644 > --- a/fs/btrfs/disk-io.h > +++ b/fs/btrfs/disk-io.h > @@ -141,6 +141,7 @@ struct extent_map *btree_get_extent(struct btrfs_inode *inode, > struct page *page, size_t pg_offset, u64 start, u64 len, > int create); > int btrfs_get_num_tolerated_disk_barrier_failures(u64 flags); > +int btrfs_check_super_location(struct btrfs_device *device, u64 pos); > int __init btrfs_end_io_wq_init(void); > void __cold btrfs_end_io_wq_exit(void); > > diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c > index 3d41d840fe5c..ae2c895d08c4 100644 > --- a/fs/btrfs/extent-tree.c > +++ b/fs/btrfs/extent-tree.c > @@ -267,6 +267,10 @@ static int exclude_super_stripes(struct btrfs_block_group_cache *cache) > return ret; > } > > + /* we won't have super stripes in sequential zones */ > + if (cache->alloc_type == BTRFS_ALLOC_SEQ) > + return 0; > + > for (i = 0; i < BTRFS_SUPER_MIRROR_MAX; i++) { > bytenr = btrfs_sb_offset(i); > ret = btrfs_rmap_block(fs_info, cache->key.objectid, > diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c > index f7b29f9db5e2..36ad4fad7eaf 100644 > --- a/fs/btrfs/scrub.c > +++ b/fs/btrfs/scrub.c > @@ -3720,6 +3720,8 @@ static noinline_for_stack int scrub_supers(struct scrub_ctx *sctx, > if (bytenr + BTRFS_SUPER_INFO_SIZE > > scrub_dev->commit_total_bytes) > break; > + if (!btrfs_check_super_location(scrub_dev, bytenr)) > + continue; > > ret = scrub_pages(sctx, bytenr, BTRFS_SUPER_INFO_SIZE, bytenr, > scrub_dev, BTRFS_EXTENT_FLAG_SUPER, gen, i, >