Received: by 2002:a05:6358:489b:b0:bb:da1:e618 with SMTP id x27csp8363892rwn; Wed, 14 Sep 2022 13:11:51 -0700 (PDT) X-Google-Smtp-Source: AA6agR5+6XRLYzlSV+FfeptMZp+4PRerRYrH2rmCo/qNx2X64PCxybrTQSFNZD1Iq2UfJ5YlEABe X-Received: by 2002:a65:5b4c:0:b0:439:b3a:e8e6 with SMTP id y12-20020a655b4c000000b004390b3ae8e6mr13481456pgr.330.1663186311452; Wed, 14 Sep 2022 13:11:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663186311; cv=none; d=google.com; s=arc-20160816; b=tp4mAEGXZwab5ugrLb7ccGL3hSbmVquqVnxnjYXJYP0ByJQx4CnQQ19G9IKpQy98Z1 kLzolimBULVYpK8kHq4U7L9DDxClk24/154sVKfMyqkdjgj4HDevYtU02LX5JO3RVSun GVcc2sNXa+Pmbwb9ePW5pNJOepiUOP7YUml84pZ3NMs6XzGG9r06pBqr3VDU7XHWetCf VSx4l85Ka5XaTYGzOM6hAjzAHWdsB4jCcPElwQ7i/qtPCrPNZbFCkMtCZ8YhzPt4QwoP fPbGTSRdDpIi1ozaiAHwDpOpTqp0fQZTsy1+6reOV0BSUrnzArQsRY5aZ2L8A6s5GUqM j78w== 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 :in-reply-to:from:cc:to:content-language:subject:user-agent :mime-version:date:message-id:dkim-signature:dkim-filter; bh=ybgLp9AM+jxatL7OJOF20wcIYaSKEdwWOvPMbm2oBTU=; b=ZrIgxjyFUruWmwfW4HcSRSZjoiOkE3jUJF+6UyKxy0+WFXIVXQToHAyfOCFASsyHN9 tEtFq65JsepG2uJz0UOyGdni3z452qR6NN849pljWJI7UpZP8QtgVZ/Q0JNOZEIDoP3l LxXhz9Mz/6K8j+Rl4+Gj3QMMj44aYqS3vATTjisRg3qiBdS4q8jVon9T87BGAcONZiX6 LZlEEOGYqaHNeW+v9qMe/2rRT+AaQGzMngyxG4YQZeHtmvefwoK3MYxJy2ANULe3pinM 8OhGc35q32IvJBDiGCXlgVG2RymsXbGQeHUWum7RxGJUxJ1weaGIISr7AjttqVFnaoQv 8HKA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=d004FnXN; 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 nu10-20020a17090b1b0a00b002000867929fsi19909263pjb.183.2022.09.14.13.11.08; Wed, 14 Sep 2022 13:11:51 -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=d004FnXN; 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 S229565AbiINTQr (ORCPT + 99 others); Wed, 14 Sep 2022 15:16:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60080 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229457AbiINTQq (ORCPT ); Wed, 14 Sep 2022 15:16:46 -0400 Received: from mailout2.w1.samsung.com (mailout2.w1.samsung.com [210.118.77.12]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CB93D8287C for ; Wed, 14 Sep 2022 12:16:39 -0700 (PDT) Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20220914191634euoutp0263d4a2ee028d446d73d16b44817630df~U0B88vZC40310003100euoutp02h for ; Wed, 14 Sep 2022 19:16:34 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20220914191634euoutp0263d4a2ee028d446d73d16b44817630df~U0B88vZC40310003100euoutp02h DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1663182995; bh=ybgLp9AM+jxatL7OJOF20wcIYaSKEdwWOvPMbm2oBTU=; h=Date:Subject:To:CC:From:In-Reply-To:References:From; b=d004FnXNA0bakbll66O+fyaleJdcZ2xmZSDGBh3bLK8zddaWSylqQpKwpGxTp6hRQ +zhDhzjUFz6OI2sYlLqNX8g8dQOHVMxoetqJ6XrBX3VZkcG1v9vJju0r9549YCRV5+ HlYQY4RbRaqEljEtjK69PPsZsUtyddSvoq9GR2Ik= Received: from eusmges2new.samsung.com (unknown [203.254.199.244]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20220914191634eucas1p1cf5b4ecb952a15dfc537688c908269a7~U0B8hWI_J1511815118eucas1p1r; Wed, 14 Sep 2022 19:16:34 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges2new.samsung.com (EUCPMTA) with SMTP id 35.A8.07817.29822236; Wed, 14 Sep 2022 20:16:34 +0100 (BST) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p2.samsung.com (KnoxPortal) with ESMTPA id 20220914191634eucas1p2a45bbf2def4de9892a2be10ac1dbf9f0~U0B8LBDtD2516825168eucas1p2K; Wed, 14 Sep 2022 19:16:34 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20220914191634eusmtrp186e492d3798a7679a64cd166315ebf94~U0B8HD3T12885828858eusmtrp15; Wed, 14 Sep 2022 19:16:34 +0000 (GMT) X-AuditID: cbfec7f4-893ff70000011e89-29-632228926819 Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 35.5A.10862.19822236; Wed, 14 Sep 2022 20:16:33 +0100 (BST) Received: from CAMSVWEXC01.scsc.local (unknown [106.1.227.71]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20220914191633eusmtip2e0cc3b377eff18a4ddbfd661eb461652~U0B76ya3t2784627846eusmtip2Y; Wed, 14 Sep 2022 19:16:33 +0000 (GMT) Received: from [192.168.8.130] (106.210.248.192) by CAMSVWEXC01.scsc.local (2002:6a01:e347::6a01:e347) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 14 Sep 2022 20:16:31 +0100 Message-ID: Date: Wed, 14 Sep 2022 21:16:30 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0 Subject: Re: [PATCH v13 13/13] dm: add power-of-2 target for zoned devices with non power-of-2 zone sizes Content-Language: en-US To: Mike Snitzer CC: , , , , , , , , , , , , , , , , Damien Le Moal From: Pankaj Raghav In-Reply-To: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Originating-IP: [106.210.248.192] X-ClientProxiedBy: CAMSVWEXC01.scsc.local (2002:6a01:e347::6a01:e347) To CAMSVWEXC01.scsc.local (2002:6a01:e347::6a01:e347) X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrBKsWRmVeSWpSXmKPExsWy7djPc7qTNJSSDZZNkbZYf+oYs8Xqu/1s FtM+/GS2+H32PLNFa/s3Jou972azWuxZNInJYuXqo0wWT9bPYrb423UPKHFL2+LyrjlsFvOX PWW3mND2ldlizc2nLBYnbklbtG38yugg6HH5irfHzll32T0uny312LSqk81j85J6j903G9g8 drbeZ/V4v+8qUOh0tcfnTXIe7Qe6mQK4o7hsUlJzMstSi/TtErgyJq9/zF4wT6Ri1cm1LA2M 3QJdjJwcEg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ac1dbf9f0 X-Msg-Generator: CA X-RootMTR: 20220912082220eucas1p24605fdcf22aedc4c40d5303da8f17ad5 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20220912082220eucas1p24605fdcf22aedc4c40d5303da8f17ad5 References: <20220912082204.51189-1-p.raghav@samsung.com> <20220912082204.51189-14-p.raghav@samsung.com> X-Spam-Status: No, score=-8.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, 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 >> + >> + if (is_power_of_2(zone_size)) >> + DMWARN("%pg: underlying device has a power-of-2 number of sectors per zone", >> + dmh->dev->bdev); >> + >> + dmh->zone_size = zone_size; >> + dmh->zone_size_po2 = 1 << get_count_order_long(zone_size); >> + dmh->zone_size_po2_shift = ilog2(dmh->zone_size_po2); >> + dmh->zone_size_diff = dmh->zone_size_po2 - dmh->zone_size; >> + ti->private = dmh; >> + ti->max_io_len = dmh->zone_size_po2; >> + dmh->nr_zones = npo2_zone_no(dmh, ti->len); >> + ti->len = dmh->zone_size_po2 * dmh->nr_zones; >> + >> + return 0; >> +} > > The above error paths need to unwind the references or any other > resources acquired before failing. Please see other targets for how > they handle sequencing of the needed operations (e.g. dm_put_device) > in the error path by using gotos, etc. > Ok. That makes sense, and it should be pretty straight forward to do that. >> + >> +static void dm_po2z_io_hints(struct dm_target *ti, struct queue_limits *limits) >> +{ >> + struct dm_po2z_target *dmh = ti->private; >> + >> + limits->chunk_sectors = dmh->zone_size_po2; >> +} > > Are you certain you shouldn't at least be exposing a different > logical_block_size to upper layers? > To be honest, I tested my patches in QEMU with 4k Logical block size and on a device with 4k LBA size. I did a quick test with 512B LBA size in QEMU, and I didn't see any failures when I ran my normal test suite. Do you see any problem with exposing the same LBA as the underlying device? >> + >> +static void dm_po2z_status(struct dm_target *ti, status_type_t type, >> + unsigned int status_flags, char *result, >> + unsigned int maxlen) >> +{ >> + struct dm_po2z_target *dmh = ti->private; >> + size_t sz = 0; >> + >> + switch (type) { >> + case STATUSTYPE_INFO: >> + DMEMIT("%s %lld", dmh->dev->name, >> + (unsigned long long)dmh->zone_size_po2); >> + break; > > Wouldn't it be worthwhile to expose the zone sectors (native npo2 vs > simulated po2?) You merely roundup but never expose what you're using > (unless I'm missing something about generic "zoned" device > capabilities). > BLKREPORTZONE ioctl is typically used to get the zone information from a zoned block device, which should expose the npo2 zone sectors(zone capacity) in this case. But I do see the value of exposing the dmh->zone_size instead of dmh->zone_size_po2 as the latter can be easily calculated from the former or it can be retrieved by reading the chunk_sectors. I will fix that up. > Mike >