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=-5.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=no 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 EDA44C8300C for ; Wed, 25 Nov 2020 22:09:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id AC5F52075A for ; Wed, 25 Nov 2020 22:09:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733120AbgKYWJZ (ORCPT ); Wed, 25 Nov 2020 17:09:25 -0500 Received: from mx2.suse.de ([195.135.220.15]:38378 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732292AbgKYWJV (ORCPT ); Wed, 25 Nov 2020 17:09:21 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id A1627AC2D; Wed, 25 Nov 2020 22:09:19 +0000 (UTC) Received: by ds.suse.cz (Postfix, from userid 10065) id 54545DA7B4; Wed, 25 Nov 2020 23:07:50 +0100 (CET) Date: Wed, 25 Nov 2020 23:07:50 +0100 From: David Sterba To: dsterba@suse.cz, Naohiro Aota , linux-btrfs@vger.kernel.org, dsterba@suse.com, hare@suse.com, linux-fsdevel@vger.kernel.org, Jens Axboe , Christoph Hellwig , "Darrick J. Wong" , Damien Le Moal , Josef Bacik Subject: Re: [PATCH v10 04/41] btrfs: get zone information of zoned block devices Message-ID: <20201125220750.GQ6430@twin.jikos.cz> Reply-To: dsterba@suse.cz Mail-Followup-To: dsterba@suse.cz, Naohiro Aota , linux-btrfs@vger.kernel.org, dsterba@suse.com, hare@suse.com, linux-fsdevel@vger.kernel.org, Jens Axboe , Christoph Hellwig , "Darrick J. Wong" , Damien Le Moal , Josef Bacik References: <20201125214753.GP6430@twin.jikos.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201125214753.GP6430@twin.jikos.cz> User-Agent: Mutt/1.5.23.1-rc1 (2014-03-12) Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org On Wed, Nov 25, 2020 at 10:47:53PM +0100, David Sterba wrote: > On Tue, Nov 10, 2020 at 08:26:07PM +0900, Naohiro Aota wrote: > > +int btrfs_get_dev_zone_info(struct btrfs_device *device) > > +{ > > + struct btrfs_zoned_device_info *zone_info = NULL; > > + struct block_device *bdev = device->bdev; > > + sector_t nr_sectors = bdev->bd_part->nr_sects; > > + sector_t sector = 0; > > I'd rather replace the sector_t types with u64. The type is unsigned > long and does not have the same width on 32/64 bit. The typecasts must > be used and if not, bugs happen (and happened). Like in the same function a few lines below 95 /* Get zones type */ 96 while (sector < nr_sectors) { 97 nr_zones = BTRFS_REPORT_NR_ZONES; 98 ret = btrfs_get_dev_zones(device, sector << SECTOR_SHIFT, zones, 99 &nr_zones); sector without a type cast to u64