Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp3297044iob; Mon, 16 May 2022 18:31:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzvi9pr2TvShE8q2drGKYbu4oZS14+ayBIK2AM2R9P9p5yYSoZrO+mv7GljpX/zwgCtIS9F X-Received: by 2002:a17:906:a5b:b0:6f4:55f6:78af with SMTP id x27-20020a1709060a5b00b006f455f678afmr17764872ejf.238.1652751085871; Mon, 16 May 2022 18:31:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652751085; cv=none; d=google.com; s=arc-20160816; b=WntN5eralFzSt2lv75Eyl2SSxCANp55AQ0aQNwmTJkaOT1+psFZOi6GgiHtuBRAxt7 QoI9HtTHmbTp8ujyawoLg07CnmHh2KVdJYxnNg6WFtX7mCtIyPqeEbify8QDxyKPeY56 sQRgNk39LdbQQbznJJt71yhoI8Ws5YL3rxkpFe+OPpWJ3Lv3/0Ik5OZNCBA6vE1L/hsp OxHh+diY0YkAUqOojs/He1op7TJ2VzKmg92Cq/WLaB2v65fJdNENOaoXPl9fN/pmerox tGJ5IXBXF47uUMMZV6d8dJiDQLzEAThU7s2d4Ws/hRUVC/VZ2BRENrRVIykQfb6QqJED ZpHQ== 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=5TXl26FaMqHEmVpoCDcYHu+PuV1m41LmMinlDGGQ4l4=; b=NZN1XHCgObVf/IhQI4EZp1UtOsgnouy3MTGnmgSOXRYV3F5RwU2VQBfID9LIe4NrKt f6KcN4AYEU9ZOyWEKU+/LNDPrvM50n+FflgkK9sFdAQ0Y/ihkzy+OKLFAO/CJHd82mW4 w9tAsiYEXTv3hztGvtuWWOhrnazlq1L+R1RKWGWp7IA2syuNVXUABrOA3lOZHnPyJBSo IAcATxDnKDRA0lKlc3Y0C8npzX6bV1Q4gQhkmnN5+/v5pXJP42+gmv1ToIPwa+vs1FFV HmbyPRgHZEQzU9PrdRCjI/6CBY4kZ8l2ocgrNxc2bryQv1bhamTSZZtGI/8S2uZpg6Vv 1MJg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=amSXskJ0; 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 o4-20020a170906974400b006f39bdc4dfesi1132919ejy.545.2022.05.16.18.31.00; Mon, 16 May 2022 18:31:25 -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=amSXskJ0; 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 S240610AbiEPQzq (ORCPT + 99 others); Mon, 16 May 2022 12:55:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51304 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343961AbiEPQyh (ORCPT ); Mon, 16 May 2022 12:54:37 -0400 Received: from mailout1.w1.samsung.com (mailout1.w1.samsung.com [210.118.77.11]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A97943C4A7 for ; Mon, 16 May 2022 09:54:35 -0700 (PDT) Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20220516165434euoutp010f4d32f83a596a0f0b88a22210de6bcc~vpCa26Puu2835728357euoutp01R for ; Mon, 16 May 2022 16:54:34 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20220516165434euoutp010f4d32f83a596a0f0b88a22210de6bcc~vpCa26Puu2835728357euoutp01R DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1652720074; bh=5TXl26FaMqHEmVpoCDcYHu+PuV1m41LmMinlDGGQ4l4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=amSXskJ08T0po78lLobDG/9GeM4Mjy4BvuB11ClYKzVzKKDHCPu4tLSPbcwgZHKkd CCKvqp6EvOROkxy3gmSGlBqTN4nzMO9TM5uWbhEU1kRMkvN7rWWLQHFchW49jEvBW8 0fh3yBjpmaDL9qk5aycOQmr23bkW/cPHtmp7DsVU= Received: from eusmges2new.samsung.com (unknown [203.254.199.244]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20220516165432eucas1p28fa728357342aadebf5be26269ea5b40~vpCZc4W501887918879eucas1p2n; Mon, 16 May 2022 16:54:32 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges2new.samsung.com (EUCPMTA) with SMTP id A2.4A.09887.8C182826; Mon, 16 May 2022 17:54:32 +0100 (BST) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p2.samsung.com (KnoxPortal) with ESMTPA id 20220516165432eucas1p2e1ea74d44738e44745f49e37b6b9e503~vpCYwJZGZ0200602006eucas1p2R; Mon, 16 May 2022 16:54:32 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20220516165432eusmtrp1057bb593a1a030e8e478dd59b33a54e3~vpCYvYe2E2961829618eusmtrp1Q; Mon, 16 May 2022 16:54:32 +0000 (GMT) X-AuditID: cbfec7f4-45bff7000000269f-43-628281c8fad5 Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 02.99.09522.8C182826; Mon, 16 May 2022 17:54:32 +0100 (BST) Received: from localhost (unknown [106.210.248.7]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20220516165431eusmtip2bac363d67d5edcb5d23957c2ace71c86~vpCYcv3fi0272502725eusmtip2v; Mon, 16 May 2022 16:54:31 +0000 (GMT) From: Pankaj Raghav To: axboe@kernel.dk, damien.lemoal@opensource.wdc.com, pankydev8@gmail.com, dsterba@suse.com, hch@lst.de Cc: linux-nvme@lists.infradead.org, linux-fsdevel@vger.kernel.org, linux-btrfs@vger.kernel.org, jiangbo.365@bytedance.com, linux-block@vger.kernel.org, gost.dev@samsung.com, p.raghav@samsung.com, linux-kernel@vger.kernel.org, dm-devel@redhat.com, Luis Chamberlain Subject: [PATCH v4 10/13] zonefs: allow non power of 2 zoned devices Date: Mon, 16 May 2022 18:54:13 +0200 Message-Id: <20220516165416.171196-11-p.raghav@samsung.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220516165416.171196-1-p.raghav@samsung.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrAKsWRmVeSWpSXmKPExsWy7djP87onGpuSDNY+MbZYfbefzeL32fPM FnvfzWa1uPCjkcni5oGdTBYrVx9lsug58IHFYu8tbYtLj1ewW+zZe5LF4vKuOWwW85c9Zbe4 MeEpo8XnpS3sFmtuPmVx4Pf4d2INm8fOWXfZPS6fLfXYtKqTzWPzknqP3TcbgMKt91k93u+7 yubRt2UVo8f6LVdZPD5vkgvgjuKySUnNySxLLdK3S+DKOPvgCFPBdoGK6ZtOMDcwnuXtYuTk kBAwkbg2/QhbFyMXh5DACkaJNVP72SGcL4wSHR9nQTmfGSV+TtzMDtPS/fcgE0RiOaPE5m3L mEESQgLPGSV+vZToYuTgYBPQkmjsBKsXEciSmH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ovLUlVyMgvLrFVija0MNIztLTQMzKx1DM0No+1MjJV 0rezSUnNySxLLdK3S9DLOPvgCFPBdoGK6ZtOMDcwnuXtYuTkkBAwkej+e5Cpi5GLQ0hgKaNE 46XfrBAJCYnbC5sYIWxhiT/Xutggip4ySjz++Ji5i5GDg01AS6Kxkx2kRkSgQGJO/xYWkBpm gbVMEq9/vAdrFhZwkXix9SwbiM0ioCpx6OMiJpBeXgFriWfT7SDmy0vMvPSdHSTMCRRe3cUN EhYSsJL4+uQW2HheAUGJkzOfsIDYzEDlzVtnM09gFJiFJDULSWoBI9MqRpHU0uLc9NxiQ73i xNzi0rx0veT83E2MwLjcduzn5h2M81591DvEyMTBeIhRgoNZSYTXoKIhSYg3JbGyKrUoP76o NCe1+BCjKdDVE5mlRJPzgYkhryTe0MzA1NDEzNLA1NLMWEmc17OgI1FIID2xJDU7NbUgtQim j4mDU6qBSWyaspCrxJeaZzVzlFm6Fh7e6Puu9qWQTs+Hg/OqjH46mCpnut9I+HXC5H/apc// t+9RvtR6Iadwe/DxZl32YDmZm49OTBHayb52r+ihZTdu2e1KPqCtzmuo8v5CaOBehYTomA0P T3Qezz/lN/fi7dLVmysCUrL/GlYUTpc9saBwx4cD2xrq0ws+R3XNCPSqi/Mp0PY6G8Z3J6BU euoR51se3Wzxe9JE6qYVl+s0vbNrZBD0sjDRXfaPYZp6pnpYRdfD2gV15/8cVTbQ93p31mmr /umFHLNd/st+eXChVsnI/R9X762/h9sWH3X0VDvzOP+s+iHOmbckJJ6rmGqmZmf4uu9e5hO5 UO1dkESNEktxRqKhFnNRcSIAA7FWCVQDAAA= X-CMS-MailID: 20220516165432eucas1p2e1ea74d44738e44745f49e37b6b9e503 X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-RootMTR: 20220516165432eucas1p2e1ea74d44738e44745f49e37b6b9e503 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20220516165432eucas1p2e1ea74d44738e44745f49e37b6b9e503 References: <20220516165416.171196-1-p.raghav@samsung.com> X-Spam-Status: No, score=-7.4 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=unavailable 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. 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 57ca775f5..e302c889a 100644 --- a/fs/zonefs/super.c +++ b/fs/zonefs/super.c @@ -451,10 +451,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, @@ -1375,7 +1374,7 @@ static int zonefs_init_file_inode(struct inode *inode, struct blk_zone *zone, struct zonefs_inode_info *zi = ZONEFS_I(inode); int ret; - 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; @@ -1752,7 +1751,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 4b3de66c3..39895195c 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