Received: by 2002:a25:f815:0:0:0:0:0 with SMTP id u21csp2187329ybd; Thu, 27 Jun 2019 08:10:54 -0700 (PDT) X-Google-Smtp-Source: APXvYqxaFJbc40EdHa/ZJpk8bie8rMPaZD23EaFufONbhWRgwPbrws3Asmr7Iv2fL5/FQwUuCrpw X-Received: by 2002:a63:1864:: with SMTP id 36mr2815563pgy.272.1561648254203; Thu, 27 Jun 2019 08:10:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561648254; cv=none; d=google.com; s=arc-20160816; b=kQBrUuGCQTSf4nnvXFMuqhl0i+YO/j4MdmVVkomFpDJS59tvMKPyCSzbrjoDB/34PI VcNoQEbbbgPynOYhsLlD+GTQqNYJV2oYWrNWQHUYeww6YZKPKP4w00FIwZLDNfuuuIVz mfQS6rklL2x2XcjS9Pv74abvb+R97K3FMbv8nTmI/mNen3gFN0WEEaTdei5qVShZkbw7 qVlYxUexsbZNsMhozYquNxTdo6OrzyprNCJnk+YPluuIi0BZJDgWcdqofzsJ381ZPTFH CPa2H7X899NiIZhZe4031wTZcK7ce/ThhfJz0We6HE4iIntXW+b/rhpy1velry9aM37r GPbg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:mail-followup-to :reply-to:message-id:subject:cc:to:from:date; bh=lPMiuPGRpNjx1w7C6vtHkh+M3HqLLTi27gtUovaH9ws=; b=CdePRsSbjUBz/jFLjTWc1e6qarb5XCy4zOjW5Rgm0i6h3ndKXDWhdkkodaskqRKnwT YdTYs3vMKjTKbuqD22FdJFX38YBR3FyAeWDFZVEygZc14Fj2+a96jzwh6tXd6vDaNzXc wn3A9/n4NxyiDsm4W671aCrGQn6t7TkzSneGZxtleBecKyB5PiUC44MqyRW3dFdcfD/s LVzm+PTy4rtfaWPTbWNWJhW9/LFzkVf3wbMTDdHboftlJZLbSSr/cJWu6/ggJXdDiS8/ aSJU78HX6bKgTzW9aDze60qxN3pO706bdtk6PUh/j4sbnzUtN6s9PrUYRHbz9F3yDbyc TMoA== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h16si5454074pjt.12.2019.06.27.08.10.37; Thu, 27 Jun 2019 08:10:54 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726846AbfF0PKS (ORCPT + 99 others); Thu, 27 Jun 2019 11:10:18 -0400 Received: from mx2.suse.de ([195.135.220.15]:41226 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726431AbfF0PKS (ORCPT ); Thu, 27 Jun 2019 11:10:18 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id E8A79AC37; Thu, 27 Jun 2019 15:10:16 +0000 (UTC) Received: by ds.suse.cz (Postfix, from userid 10065) id 32C2ADA811; Thu, 27 Jun 2019 17:11:00 +0200 (CEST) Date: Thu, 27 Jun 2019 17:11:00 +0200 From: David Sterba To: Naohiro Aota Cc: "dsterba@suse.cz" , "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 =?iso-8859-1?Q?Bj=F8rling?= , Johannes Thumshirn , Bart Van Assche Subject: Re: [PATCH 02/19] btrfs: Get zone information of zoned block devices Message-ID: <20190627151100.GB20977@twin.jikos.cz> Reply-To: dsterba@suse.cz Mail-Followup-To: dsterba@suse.cz, Naohiro Aota , "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 =?iso-8859-1?Q?Bj=F8rling?= , Johannes Thumshirn , Bart Van Assche References: <20190607131025.31996-1-naohiro.aota@wdc.com> <20190607131025.31996-3-naohiro.aota@wdc.com> <20190617185708.GH19057@twin.jikos.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23.1 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jun 18, 2019 at 06:42:09AM +0000, Naohiro Aota wrote: > >> + device->seq_zones = kcalloc(BITS_TO_LONGS(device->nr_zones), > >> + sizeof(*device->seq_zones), GFP_KERNEL); > > > > What's the expected range for the allocation size? There's one bit per > > zone, so one 4KiB page can hold up to 32768 zones, with 1GiB it's 32TiB > > of space on the drive. Ok that seems safe for now. > > Typically, zone size is 256MB (as default value in tcmu-runner). On such device, > we need one 4KB page per 8TB disk space. Still it's quite safe. Ok, and for drives up to 16T the allocation is 8kb that the allocator usually is able to find. > >> + u8 zone_size_shift; > > > > So the zone_size is always power of two? I may be missing something, but > > I wonder if the calculations based on shifts are safe. > > The kernel ZBD support have a restriction that > "The zone size must also be equal to a power of 2 number of logical blocks." > http://zonedstorage.io/introduction/linux-support/#zbd-support-restrictions > > So, the zone_size is guaranteed to be power of two. Ok. I don't remember if there are assertions, but would like to see them in the filesystem code indpendently anyway as the mount-time sanity checks.