Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp3632534rwb; Tue, 16 Aug 2022 06:29:10 -0700 (PDT) X-Google-Smtp-Source: AA6agR5oRm1S8vcJQ02g1nTzR/5s0HUwgPBYITzwS7ZOvrBPuwOb95z0ztSwK+jvhQa7DhsvCR1R X-Received: by 2002:a17:907:9707:b0:731:5ddc:30f3 with SMTP id jg7-20020a170907970700b007315ddc30f3mr13364282ejc.338.1660656550710; Tue, 16 Aug 2022 06:29:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660656550; cv=none; d=google.com; s=arc-20160816; b=qTUG31RKDT9+czXAwi5fFvlGKht7zCbTToaOLzNhUvqkF9NsyLClrUUrs8MHbXBpSb PEx15mrCyMtOF7mn16lCOnmiWFVFAATN9c1uAuaKyWkR7PGrbMCHN8LJnsV9Be4Alesg 7IQbCOuhlwIUZbrHwqkevuu9vJWv+in2RFUczbZ2gB9oKcjauvh4uJi7Bd0feTfH/gN+ /t2sqJoHjUHoLi3Lm+CMwV0fEtohyWEP5yJtAWAJuYH17/bh4TV0j9dq/g8aJyQ12z4D ZI4eZXoyFLfFCSs2LPaXlr3HJW0JvD3j5XKS3k0+06DyLUSzc7XPLGJ530YGRjw2XDph zSyA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:cms-type:content-transfer-encoding :mime-version:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:dkim-filter; bh=2l9t4o2MFdGXGYEr9szOD+OY2x6nysmCjdo7iJiFJ2A=; b=onkhdNjBtwDQUXw1e9HJ0nrGC6XzzvRYqOKTmdKKEqa1DlkfWC4DzmFFPAWz+SXRZe MPuUcY5oH3olkmQxSv0pF5rDzk8Z5hPykg/bJK62vAiZANSCoH1A7Fw15QBKvxmnIraR mYr/+u0/6Aa48hI+YWYHTQhiZSMQSSWuPS97WCvLef6CUhArbigGw+wcsG24zev4GdKD bMFKMdUSD3jXeoln/WIB0tfqdNWA+T8lfJeyYJf14xApM4xETxvUvz4MkzWHoXtIvRm0 CY9qAiotp5uyaEkb00IkL3RqvFh21eYukd9q7X94MF/K0fSN3sZpddypQhM0ED/C+Qgg eqDA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=MgMRZtU2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f19-20020a056402329300b00441ec11be8esi9446026eda.111.2022.08.16.06.28.45; Tue, 16 Aug 2022 06:29:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=MgMRZtU2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235683AbiHPNQ2 (ORCPT + 99 others); Tue, 16 Aug 2022 09:16:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45860 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235193AbiHPNPu (ORCPT ); Tue, 16 Aug 2022 09:15:50 -0400 Received: from mailout2.w1.samsung.com (mailout2.w1.samsung.com [210.118.77.12]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BA1CF61734 for ; Tue, 16 Aug 2022 06:15:48 -0700 (PDT) Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20220816131547euoutp02cd8b98753a02dae2caf92eab74196c31~L1ZqZHwO32682526825euoutp02N for ; Tue, 16 Aug 2022 13:15:47 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20220816131547euoutp02cd8b98753a02dae2caf92eab74196c31~L1ZqZHwO32682526825euoutp02N DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1660655747; bh=2l9t4o2MFdGXGYEr9szOD+OY2x6nysmCjdo7iJiFJ2A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MgMRZtU2DkkDs7kBjuB0y+SrD21UrBtYAk5nAqcR/n7xykNigtyUpt9by5vYXNNEO aB4ipyR+zNUmXGr7TxN3kO+5t/U4b63zUdt2AUVUejCt/vIjQGOp1r0xh2LgTXMgNn DEcOWLIQ4x23tFXebZAOA+t96iLU2aVqLL5fUAMg= Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20220816131545eucas1p28cf18191fdc6dd8930e5677125a18d3b~L1ZotJ89I1908319083eucas1p2h; Tue, 16 Aug 2022 13:15:45 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges3new.samsung.com (EUCPMTA) with SMTP id 8F.65.09580.1889BF26; Tue, 16 Aug 2022 14:15:45 +0100 (BST) Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by eucas1p2.samsung.com (KnoxPortal) with ESMTPA id 20220816131545eucas1p2cc7e6aad76abbe106a695f7396d38344~L1ZoHANYT3098130981eucas1p2D; Tue, 16 Aug 2022 13:15:45 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp2.samsung.com (KnoxPortal) with ESMTP id 20220816131545eusmtrp2e20876f331f41415549ea0fe23d6a07a~L1ZoGO_zg0621306213eusmtrp2M; Tue, 16 Aug 2022 13:15:45 +0000 (GMT) X-AuditID: cbfec7f5-9c3ff7000000256c-e6-62fb98813cd2 Received: from eusmtip1.samsung.com ( [203.254.199.221]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id A0.31.09038.0889BF26; Tue, 16 Aug 2022 14:15:44 +0100 (BST) Received: from localhost (unknown [106.210.248.74]) by eusmtip1.samsung.com (KnoxPortal) with ESMTPA id 20220816131544eusmtip1d1134ed1ce5b864a51b18f04079f7d8b~L1ZnuzEBj2502525025eusmtip15; Tue, 16 Aug 2022 13:15:44 +0000 (GMT) From: Pankaj Raghav To: damien.lemoal@opensource.wdc.com, axboe@kernel.dk, snitzer@kernel.org, hch@lst.de, agk@redhat.com Cc: pankydev8@gmail.com, gost.dev@samsung.com, matias.bjorling@wdc.com, hare@suse.de, bvanassche@acm.org, linux-kernel@vger.kernel.org, dm-devel@redhat.com, linux-nvme@lists.infradead.org, jaegeuk@kernel.org, Johannes.Thumshirn@wdc.com, linux-block@vger.kernel.org, Pankaj Raghav , Luis Chamberlain Subject: [PATCH v11 07/13] zonefs: allow non power of 2 zoned devices Date: Tue, 16 Aug 2022 15:15:30 +0200 Message-Id: <20220816131536.189406-8-p.raghav@samsung.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220816131536.189406-1-p.raghav@samsung.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrAKsWRmVeSWpSXmKPExsWy7djP87qNM34nGRxdr26x/tQxZovVd/vZ LKZ9+Mls8fvseWaLve9ms1rcPLCTyWLPoklMFitXH2WyeLJ+FrPF3657TBZ7b2lbXN41h81i /rKn7BYT2r4yW9yY8JTR4vPSFnaLNTefslicuCXtIORx+Yq3x85Zd9k9Lp8t9di0qpPNY/OS eo/dNxvYPHa23mf1eL/vKptH35ZVjB6bT1d7fN4k59F+oJspgCeKyyYlNSezLLVI3y6BK+PB hMSCFsGKFX+qGxgn8XUxcnJICJhInL57gKWLkYtDSGAFo8TB8+dZQBJC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charset="utf-8" X-RootMTR: 20220816131545eucas1p2cc7e6aad76abbe106a695f7396d38344 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20220816131545eucas1p2cc7e6aad76abbe106a695f7396d38344 References: <20220816131536.189406-1-p.raghav@samsung.com> X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The zone size shift variable is useful only if the zone sizes are known to be power of 2. Remove that variable and use generic helpers from block layer to calculate zone index in zonefs. Acked-by: Damien Le Moal Reviewed-by: Luis Chamberlain Signed-off-by: Pankaj Raghav --- fs/zonefs/super.c | 6 ++---- fs/zonefs/zonefs.h | 1 - 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/fs/zonefs/super.c b/fs/zonefs/super.c index 860f0b1032c6..e549ef16738c 100644 --- a/fs/zonefs/super.c +++ b/fs/zonefs/super.c @@ -476,10 +476,9 @@ static void __zonefs_io_error(struct inode *inode, bool write) { struct zonefs_inode_info *zi = ZONEFS_I(inode); struct super_block *sb = inode->i_sb; - struct zonefs_sb_info *sbi = ZONEFS_SB(sb); unsigned int noio_flag; unsigned int nr_zones = - zi->i_zone_size >> (sbi->s_zone_sectors_shift + SECTOR_SHIFT); + bdev_zone_no(sb->s_bdev, zi->i_zone_size >> SECTOR_SHIFT); struct zonefs_ioerr_data err = { .inode = inode, .write = write, @@ -1401,7 +1400,7 @@ static int zonefs_init_file_inode(struct inode *inode, struct blk_zone *zone, struct zonefs_inode_info *zi = ZONEFS_I(inode); int ret = 0; - inode->i_ino = zone->start >> sbi->s_zone_sectors_shift; + inode->i_ino = bdev_zone_no(sb->s_bdev, zone->start); inode->i_mode = S_IFREG | sbi->s_perm; zi->i_ztype = type; @@ -1776,7 +1775,6 @@ static int zonefs_fill_super(struct super_block *sb, void *data, int silent) * interface constraints. */ sb_set_blocksize(sb, bdev_zone_write_granularity(sb->s_bdev)); - sbi->s_zone_sectors_shift = ilog2(bdev_zone_sectors(sb->s_bdev)); sbi->s_uid = GLOBAL_ROOT_UID; sbi->s_gid = GLOBAL_ROOT_GID; sbi->s_perm = 0640; diff --git a/fs/zonefs/zonefs.h b/fs/zonefs/zonefs.h index 4b3de66c3233..39895195cda6 100644 --- a/fs/zonefs/zonefs.h +++ b/fs/zonefs/zonefs.h @@ -177,7 +177,6 @@ struct zonefs_sb_info { kgid_t s_gid; umode_t s_perm; uuid_t s_uuid; - unsigned int s_zone_sectors_shift; unsigned int s_nr_files[ZONEFS_ZTYPE_MAX]; -- 2.25.1