Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp4588564iob; Sun, 8 May 2022 18:22:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwZDXP97TJUJE9y8M44fCaqwPMujnFmdZrcndaqUiPGOo8M5CsZ+cR3WQI64shEnL1Aza6h X-Received: by 2002:a05:6a00:b94:b0:50f:2255:ae03 with SMTP id g20-20020a056a000b9400b0050f2255ae03mr13949241pfj.74.1652059377388; Sun, 08 May 2022 18:22:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652059377; cv=none; d=google.com; s=arc-20160816; b=dV9whvIfVjXLFKUQNBlHmpk2KwG7HN+4gJUNwOAWSAFnH6bDyaAhZX9grESk0MXEW9 DThlc3hG6eWyAefKDktOT8x70JWQNgYId4CSskyfZ/KdEZPxzvrobBg9cCotEEB3Sem/ 1xm7HaC9uYtKR+cjMJngzybSP3SkCJgnBIiLJSH8LPEOk+WBXDvxpd3O5x2y/v2GDzEq z30UyBL9VC+V6BTORUS2T0vfJXlM61BnZBpQrtouY6/WykxI9RVx95wlRigVnhlp8vOu 56r/YneV41j1Z1OGORdnT7YjRvVOMrAyAMj/lStzW2OAdN0XCAdlTFLR2T9/5SJlycxL G7Cg== 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=I6AyG+zKNeMaILZF7R/I3A5VoGI+O7z0EZ5WLMlZFWk=; b=qNfLqnek5zU/BWESH5qAzX3DC6rQoatY84yZTIIEiCxcwQ4e0YSOOtCZ0tc6QhKqdT jFLPmxDDcVpoVCZLpty1rfZafEa4IZQAsqw09fJWRZnscz/PFXPGTMFtdSEYs4937Axj ir1gV7XzJJ9WWyHMT5qudQ5wrk1ToxlWYWhFyUj934mhUPnE7GfnGYPIAjdLVHRCbitd nPQ5x0pmf09oAPPTfPWJS0+UjCZU4oeHoOo4FQun2lnI51xAgvUO0V5KKUMHBkfocdFD TLDd/fiurRwIbwA5HkL2+EUhTOq7bc4LHwF8bbEpTnqJi6Ju5HCGBKaI8ObLO9+mPTWS i/pA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=sTTVlEid; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id w7-20020a170902e88700b00158cefcc031si11314708plg.216.2022.05.08.18.22.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 08 May 2022 18:22:57 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=sTTVlEid; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id E612311C24; Sun, 8 May 2022 18:22:48 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1389949AbiEFIPy (ORCPT + 99 others); Fri, 6 May 2022 04:15:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59578 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1389869AbiEFIPH (ORCPT ); Fri, 6 May 2022 04:15:07 -0400 Received: from mailout2.w1.samsung.com (mailout2.w1.samsung.com [210.118.77.12]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A1C2F68303 for ; Fri, 6 May 2022 01:11:19 -0700 (PDT) Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20220506081118euoutp02eff9a50659a9560b295da93100ebdd91~sdcsENRV-2349023490euoutp024 for ; Fri, 6 May 2022 08:11:18 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20220506081118euoutp02eff9a50659a9560b295da93100ebdd91~sdcsENRV-2349023490euoutp024 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1651824678; bh=I6AyG+zKNeMaILZF7R/I3A5VoGI+O7z0EZ5WLMlZFWk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sTTVlEidW0f3AlZRQvh1llqBy84jhU4rVKsIosds+oN2+s4YJS4eJmN9OFLCXRhy0 KR8J6IAMJ6y3bzwUi+Ujk8sxdGlcDKyznoSBpdAjZAkmMzm6To+enhf/iKIRcYCcpO 834ncQQFyJtakdpuJbSNdPHZzIj6Za3FmeXNjqgs= Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20220506081116eucas1p19eb3fac87a4cf0dada0eaf469eeb58b7~sdcqUrLha1756417564eucas1p19; Fri, 6 May 2022 08:11:16 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges3new.samsung.com (EUCPMTA) with SMTP id 24.4C.10260.428D4726; Fri, 6 May 2022 09:11:16 +0100 (BST) Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by eucas1p2.samsung.com (KnoxPortal) with ESMTPA id 20220506081115eucas1p2e7bed137c74be42a702732027581330e~sdcp30_v_0618806188eucas1p2m; Fri, 6 May 2022 08:11:15 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp2.samsung.com (KnoxPortal) with ESMTP id 20220506081115eusmtrp2bc23f57f1bf98bef55c841a5817639d5~sdcp18RxM2593625936eusmtrp2f; Fri, 6 May 2022 08:11:15 +0000 (GMT) X-AuditID: cbfec7f5-bddff70000002814-ef-6274d82460ce Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 1D.F2.09522.328D4726; Fri, 6 May 2022 09:11:15 +0100 (BST) Received: from localhost (unknown [106.210.248.174]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20220506081115eusmtip299ffc807d988a4202c28888f957b97ea~sdcpgytSF2136221362eusmtip2I; Fri, 6 May 2022 08:11:15 +0000 (GMT) From: Pankaj Raghav To: jaegeuk@kernel.org, hare@suse.de, dsterba@suse.com, axboe@kernel.dk, hch@lst.de, damien.lemoal@opensource.wdc.com, snitzer@kernel.org Cc: Chris Mason , Josef Bacik , bvanassche@acm.org, linux-fsdevel@vger.kernel.org, matias.bjorling@wdc.com, Jens Axboe , gost.dev@samsung.com, jonathan.derrick@linux.dev, jiangbo.365@bytedance.com, linux-nvme@lists.infradead.org, dm-devel@redhat.com, Naohiro Aota , linux-kernel@vger.kernel.org, Johannes Thumshirn , Sagi Grimberg , Alasdair Kergon , linux-block@vger.kernel.org, Chaitanya Kulkarni , Keith Busch , linux-btrfs@vger.kernel.org, Pankaj Raghav , Luis Chamberlain Subject: [PATCH v3 09/11] zonefs: allow non power of 2 zoned devices Date: Fri, 6 May 2022 10:11:03 +0200 Message-Id: <20220506081105.29134-10-p.raghav@samsung.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220506081105.29134-1-p.raghav@samsung.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Brightmail-Tracker: H4sIAAAAAAAAA01SbUxTVxjO6b29/djqLqXSM9xi1ukyMFDJWHami5ubk5vMH4S4LWPLXAt3 QGjRtBQ/WGZLC4x2K4ggtrIh0xVaYBXKh1VqGK5AUQY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U2dWlrDZy+7g3P68SW2SXtYSXyv33aFc kqmnZv0W4/i5SlKEq8uqY1rkzTc3vT682qLzXG2mTZ2d596nD35ND/zsIj3NsejVTo9dt/8U /XuqcWkSz6nfNXZLbkTvFqloSfymf/MuQ9puLvcjDw5FvzA2ruFpPtL/jJO5qsvvYIfKSnaf s2yL1xzUXqcutNWhLuDwV/uJ0ixzhOeZf+pLEbjdMWv6C6MSs9e1Hf43Gx+vzeHddTLUfLv4 B7byOV8iNEUPJe3j2fQnw5I75NSjrUuMMmfyvg3/WH5nb6Rjb9r6/xOETRdssZAyePFS31OJ pTgj0VCLuag4EQBvUJ6csgMAAA== X-CMS-MailID: 20220506081115eucas1p2e7bed137c74be42a702732027581330e X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-RootMTR: 20220506081115eucas1p2e7bed137c74be42a702732027581330e X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20220506081115eucas1p2e7bed137c74be42a702732027581330e References: <20220506081105.29134-1-p.raghav@samsung.com> X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,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 978a35c45..50a1e000c 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