Received: by 2002:ac0:e34a:0:0:0:0:0 with SMTP id g10csp91837imn; Wed, 27 Jul 2022 16:19:09 -0700 (PDT) X-Google-Smtp-Source: AGRyM1s8OUpVfBSIvBMavfu9sDLetyZ7pzz87CAn06anygUp6tRHJnk8Z5xFBxHjeRb3CeAlV9Td X-Received: by 2002:a17:90b:3d85:b0:1f2:74f9:1742 with SMTP id pq5-20020a17090b3d8500b001f274f91742mr7005772pjb.41.1658963949745; Wed, 27 Jul 2022 16:19:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658963949; cv=none; d=google.com; s=arc-20160816; b=DvAcvfhV2RUVKHRV+AhxS0UIB8nAePazM90vGu4RAKLzT+zgHa0zmjiG7nrdJBI7Xm Bg7LBCJz+xgwQsjXZCd2HDXwi3VCLfM6F97Js1Dc268BjdAIf7PH79hJFQ6qGFSlFczJ hFs+W6b9DmLqj7RL5IoxU9oTXdy1Y5bYSECzkJFmjWEP/D5qmvXmsHMlmIOI+zyYqqt2 1H/IYromNtctZVb9oGzNjYyahssOvqIzJPJ0TijeH0Ccy1CnNf7D0ISIL0gGZyz9u1ax fsZwD+SRlWb2e93VlVWfS96XH4QHKTKUrY+eyUKUPPoweyFb9vNdBfjMrRX4BG6lh3ZA QbPA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=9RCSjgTld4jFxyRMFpo8i47HSyAGNN8HsW/U7jGMYJo=; b=ilVvj1qgkK80j7QZzg8kkXlU/yR1uB2GY4g79FPxuVhbnkxbMQ+Emsg/xqqp2azqR8 U6dscjnOdr5gZ8/I0CblQk7BqqUKQYKr9akg8OInWtihgBkmu14JT4vf5Au6GuJ61gP7 PHei1pHmJKgLYFt9kDV895L4BENEBFr2LJ261ng7rlBfbXbkG4LiHxbmHG44JvcA7X6h x26Wz9IiBI6nUGUxdBSG4qpAB+R52qw2O82a504W0CZFTjAWdSVb3WonmNLfp8ezAs+Y T2l60Hc29wZpI26esU5gaIcG9aO0YBUJoRW6A2Ojig71FyAqndKSn6EKCyQ7KFZwVO47 Juug== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=acm.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l185-20020a6391c2000000b00415e2dd6e8asi20843884pge.642.2022.07.27.16.18.29; Wed, 27 Jul 2022 16:19:09 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=acm.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230395AbiG0XQi (ORCPT + 99 others); Wed, 27 Jul 2022 19:16:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45306 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230113AbiG0XQg (ORCPT ); Wed, 27 Jul 2022 19:16:36 -0400 Received: from mail-pg1-f170.google.com (mail-pg1-f170.google.com [209.85.215.170]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9C25352DC9; Wed, 27 Jul 2022 16:16:35 -0700 (PDT) Received: by mail-pg1-f170.google.com with SMTP id s206so134801pgs.3; Wed, 27 Jul 2022 16:16:35 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=9RCSjgTld4jFxyRMFpo8i47HSyAGNN8HsW/U7jGMYJo=; b=QeGCaJI4fAnLKXeTObVUI4leA8+QZPaQB82gpcc9mmhHuR2cZUVzi9GJ9SQoYNFuRm lMBWZFOccJuEb/fZKzPvoFURFdnSI4ZDC0ke8zcSJbHyy0EiMT101uwHfdfmx3BLdfo+ uEghJOZuBOBKkRwyIaJTb9YPcIq0hXWOo2UCeRhsBzflybxz+o1ZzDrNx5/WVtpZHMHh HD3OcBFz/DHAtZcwCqwyxIRhY+0Nuj33kJR3benttgBMrHXVHzdDFah+aMxUnPRc2/z+ EVmASvkglVw0IdBhqlUUhVopZCSLkyX2Jsx+th/j0KJdlbwiqURlbPDfMGYU9mwU4itP cJJQ== X-Gm-Message-State: AJIora/KVEtxP+hlQeTiyyibq5/WzTTWcsZiAWzHzQJvFpoY68YmfaAT vgYwmKb6quqZjCQ9uXEEf3HWvke536RECg== X-Received: by 2002:a05:6a00:114f:b0:528:2c7a:634c with SMTP id b15-20020a056a00114f00b005282c7a634cmr23853833pfm.41.1658963794531; Wed, 27 Jul 2022 16:16:34 -0700 (PDT) Received: from ?IPV6:2620:15c:211:201:a84e:2ec1:1b57:b033? ([2620:15c:211:201:a84e:2ec1:1b57:b033]) by smtp.gmail.com with ESMTPSA id f25-20020a635559000000b0041983a8d8c2sm12585044pgm.39.2022.07.27.16.16.32 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 27 Jul 2022 16:16:33 -0700 (PDT) Message-ID: <7984b969-9025-6b31-2645-da08daeefafb@acm.org> Date: Wed, 27 Jul 2022 16:16:30 -0700 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 v8 02/11] block: allow blk-zoned devices to have non-power-of-2 zone size Content-Language: en-US To: Pankaj Raghav , damien.lemoal@opensource.wdc.com, hch@lst.de, axboe@kernel.dk, snitzer@kernel.org, Johannes.Thumshirn@wdc.com Cc: matias.bjorling@wdc.com, gost.dev@samsung.com, linux-kernel@vger.kernel.org, hare@suse.de, linux-block@vger.kernel.org, pankydev8@gmail.com, jaegeuk@kernel.org, dm-devel@redhat.com, linux-nvme@lists.infradead.org, Luis Chamberlain References: <20220727162245.209794-1-p.raghav@samsung.com> <20220727162245.209794-3-p.raghav@samsung.com> From: Bart Van Assche In-Reply-To: <20220727162245.209794-3-p.raghav@samsung.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-1.4 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, NICE_REPLY_A,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL, SPF_HELO_NONE,SPF_PASS autolearn=no 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 On 7/27/22 09:22, Pankaj Raghav wrote: > Checking if a given sector is aligned to a zone is a common > operation that is performed for zoned devices. Add > bdev_is_zone_start helper to check for this instead of opencoding it > everywhere. I can't find the bdev_is_zone_start() function in this patch? > To make this work bdev_get_queue(), bdev_zone_sectors() and > bdev_is_zoned() are moved earlier without modifications. Can that change perhaps be isolated into a separate patch? > diff --git a/block/blk-core.c b/block/blk-core.c > index 3d286a256d3d..1f7e9a90e198 100644 > --- a/block/blk-core.c > +++ b/block/blk-core.c > @@ -570,7 +570,7 @@ static inline blk_status_t blk_check_zone_append(struct request_queue *q, > return BLK_STS_NOTSUPP; > > /* The bio sector must point to the start of a sequential zone */ > - if (bio->bi_iter.bi_sector & (bdev_zone_sectors(bio->bi_bdev) - 1) || > + if (!bdev_is_zone_aligned(bio->bi_bdev, bio->bi_iter.bi_sector) || > !bio_zone_is_seq(bio)) > return BLK_STS_IOERR; The bdev_is_zone_start() name seems more clear to me than bdev_is_zone_aligned(). Has there already been a discussion about which name to use for this function? > + /* > + * Non power-of-2 zone size support was added to remove the > + * gap between zone capacity and zone size. Though it is technically > + * possible to have gaps in a non power-of-2 device, Linux requires > + * the zone size to be equal to zone capacity for non power-of-2 > + * zoned devices. > + */ > + if (!is_power_of_2(zone->len) && zone->capacity < zone->len) { > + pr_warn("%s: Invalid zone capacity for non power of 2 zone size", > + disk->disk_name); Given the severity of this error, shouldn't the zone capacity and length be reported in the error message? Thanks, Bart.