Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp1094039iob; Wed, 4 May 2022 14:34:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyTuiI/MCHChAulvmIrC9nrYC4fSBgllAkVevHxLoxHVqqTT2TBsXwFLRI6jWLHPz0ArIq/ X-Received: by 2002:a17:906:9b8f:b0:6f4:e5e8:9984 with SMTP id dd15-20020a1709069b8f00b006f4e5e89984mr1218079ejc.327.1651700098798; Wed, 04 May 2022 14:34:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651700098; cv=none; d=google.com; s=arc-20160816; b=E7DgzqG5KN6mOuQj+NAnwLO4DBgFnrl0wRr0XqNGKd1Q0e40zVBBSayDv9g9zAQrhQ umupcoAr+jZLyuBdgHuAgJGSPAfdNt4kBEywANoSx6Mt4nW/JMFDPAI47C8h6/PhNSiy KvDjr2XoX3LnLMEI6Vt6/V7s59fzBCpImcmSg/dyJ9F9sL3yummA9jPM5LkvIF0116Tr vi3GNiPXvqfqDuqEavRnnIaDzCwmThAr9VrXPy8K+NYtHgAlrQNR8LCGnhx23VnDRNOj eRDXgcaVhUoRwsFxFw8uE8abXL1+0C1Z5aNylg71JdZL7+Zkyw21L6rMsTnLApXXfLqj eecA== 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:to:from :references:content-language:subject:user-agent:mime-version:date :message-id:dkim-signature:dkim-signature; bh=N6EMoP13+uuDakjMHpvxy4PBHA2cakQS2VfsX4a/x94=; b=bwqBsXI5n/Jp9ou0XpGRno61o7XpZ3Mjg+Tf2Uy3YbGt45BL6oTNRTxbGkWJWQlt7r lL5fXW17f/hhT7cH7O1tas0KLcrv6LrpIZrUPN50BeeKbOjQ709DFOdxIsh13lLEEdDw kpN3ThYyf+g2goeWaxBdApvmjrQRDfyNiNi+F0iLec57g4pGc5snOQM/aNpxdxE83qIR 0oM0ALWujHdLotSCZJJdHga4n1tKAvD5+fGCsqSDBSXvm3FAOL2fqr7CSGRTMZJ2i3kz GwLUYDnmZQjt3IyZkd5GBEsLBtKEo95dtBDNoQ0P8PJU8WiaGip0SgW8Lj/BKPOGeCRm sqvg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@suse.de header.s=susede2_rsa header.b=DJBXlAYy; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519 header.b=5hv3tExq; 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=suse.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id au13-20020a170907092d00b006e89ac43dcfsi17858924ejc.899.2022.05.04.14.34.35; Wed, 04 May 2022 14:34:58 -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=fail header.i=@suse.de header.s=susede2_rsa header.b=DJBXlAYy; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519 header.b=5hv3tExq; 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=suse.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1357366AbiEDR4s (ORCPT + 99 others); Wed, 4 May 2022 13:56:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42944 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1359125AbiEDRvd (ORCPT ); Wed, 4 May 2022 13:51:33 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D15484C439; Wed, 4 May 2022 10:11:30 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 8BD9B1F38D; Wed, 4 May 2022 17:11:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1651684289; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=N6EMoP13+uuDakjMHpvxy4PBHA2cakQS2VfsX4a/x94=; b=DJBXlAYyuYbusnoUszCA+AfMUUtGYehcgNX/lQ0qb1pMGVJ8Y/wB2k+YBRDIZuhTeQqd7b tHvLMy5QORZQYIpA9gIeZd+FIbx6yExh/jX0dTQhrTHcfqHSr/rMyA45YxKum1K9WKH687 TFFcsHo0sSle3EgUEzEdaFr8d2K/Tio= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1651684289; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=N6EMoP13+uuDakjMHpvxy4PBHA2cakQS2VfsX4a/x94=; b=5hv3tExqNVDL20PvtwaVNk13uh5hLvjqypg4NlyuP/W5i/E/1fSmlov7z3Q727EOdt2Ymq Cgfxb1jhrkiVgADw== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 272C0131BD; Wed, 4 May 2022 17:11:23 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id eGrpOruzcmIsWwAAMHmgww (envelope-from ); Wed, 04 May 2022 17:11:23 +0000 Message-ID: <2586cd78-cd54-97ed-86b0-8f78a444387a@suse.de> Date: Wed, 4 May 2022 10:11:22 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.4.0 Subject: Re: [PATCH 16/16] dm-zoned: ensure only power of 2 zone sizes are allowed Content-Language: en-US References: <20220427160255.300418-1-p.raghav@samsung.com> <20220427160255.300418-17-p.raghav@samsung.com> From: Hannes Reinecke To: undisclosed-recipients:; In-Reply-To: <20220427160255.300418-17-p.raghav@samsung.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,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 On 4/27/22 09:02, Pankaj Raghav wrote: > From: Luis Chamberlain > > Today dm-zoned relies on the assumption that you have a zone size > with a power of 2. Even though the block layer today enforces this > requirement, these devices do exist and so provide a stop-gap measure > to ensure these devices cannot be used by mistake > > Signed-off-by: Luis Chamberlain > Signed-off-by: Pankaj Raghav > --- > drivers/md/dm-zone.c | 12 ++++++++++++ > 1 file changed, 12 insertions(+) > > diff --git a/drivers/md/dm-zone.c b/drivers/md/dm-zone.c > index 57daa86c19cf..221e0aa0f1a7 100644 > --- a/drivers/md/dm-zone.c > +++ b/drivers/md/dm-zone.c > @@ -231,6 +231,18 @@ static int dm_revalidate_zones(struct mapped_device *md, struct dm_table *t) > struct request_queue *q = md->queue; > unsigned int noio_flag; > int ret; > + struct block_device *bdev = md->disk->part0; > + sector_t zone_sectors; > + char bname[BDEVNAME_SIZE]; > + > + zone_sectors = bdev_zone_sectors(bdev); > + > + if (!is_power_of_2(zone_sectors)) { > + DMWARN("%s: %s only power of two zone size supported\n", > + dm_device_name(md), > + bdevname(bdev, bname)); > + return 1; > + } > > /* > * Check if something changed. If yes, cleanup the current resources Reviewed-by: Hannes Reinecke Cheers, Hannes -- Dr. Hannes Reinecke Kernel Storage Architect hare@suse.de +49 911 74053 688 SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg HRB 36809 (AG Nürnberg), Geschäftsführer: Felix Imendörffer