Received: by 2002:a05:7412:b130:b0:e2:908c:2ebd with SMTP id az48csp2126797rdb; Mon, 20 Nov 2023 02:48:41 -0800 (PST) X-Google-Smtp-Source: AGHT+IFbKVojwCycsz2hV9mweR9DJ0amC3o2vrTGp7NmWIdLU/QEfqYNNiYLTdDjw31vSl0el42z X-Received: by 2002:a05:6a20:72ab:b0:162:ee29:d3c0 with SMTP id o43-20020a056a2072ab00b00162ee29d3c0mr9009882pzk.42.1700477320837; Mon, 20 Nov 2023 02:48:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700477320; cv=none; d=google.com; s=arc-20160816; b=Wvp0N1RcRU2cCqcz0x7BkhsGxJ3DPGS22DkQgyXiKTexxBnoCcaD19D4nPrfYmd66S 3QX7ASkywhCWqHlfS1dunfM7Bx9ZDG3OCXbOS3OsMs7V0T0b/bZw670SUYhaYdZcjrsE F1zLbRa8kTSxczoqdb7tbEq5lBJPJfpZbpsswXIJzNfFk5K5UDRBpJ445O3uSho3NZnz k8pPsg1DjRHs2BTOfPKDS0Vy0dbLsODXBHqxdT7Qd2QDkWjEemlCm7WQKP4y8IChT9W3 WPD5m3fwzWhv0gKT/kl8DdL8icPvwVJTFLfG0dwv1haTRj7vMP+p9/lCza80Gk6GlWb4 NVwg== 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:autocrypt :from:content-language:references:cc:to:subject:user-agent :mime-version:date:message-id:dkim-signature:dkim-signature; bh=TZOjEP6t4zXFrEXqFznh4zfDrR0FVYyRbvUTAVYWx30=; fh=DUwqZTqu+XEOkjk/tVEAPjPfEF+DydEl2n8J1EWhH1E=; b=krOcEQJPWDU+07L44Te2I9iQ0ZyPw68jBC1I5RohUQ5zDNR7IfAvfBnVUmdDdkSF8W XnSx7gc+kYymN0D+A/iQS1GA0rLmpf8NqF+y8hEF0yOwsxFj3Joff6jT9LlmNz6qfEfq vE+Ou6q4iMGQCU/F0954ZceUDDDOm/EWyN6QZVyFJC0BazN3WDx9nuQ005Yfg26GLldN NGYms6fLhsgIO4BvoGn7pVkhW1QYkhJuBikzmUhrq2pV/5fPmY9xWifhuJUreE/vs9+P Znt/9RXRFYaKxgkDDb/hiXqSktGxcmv139PcJBq+vK8bUfNwtSmqtHYPUlC6xyJ1yAHT +T8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=R27o59xo; dkim=neutral (no key) header.i=@suse.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id c16-20020a170903235000b001b3fb1742e4si7895304plh.547.2023.11.20.02.48.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Nov 2023 02:48:40 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=R27o59xo; dkim=neutral (no key) header.i=@suse.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 872508077544; Mon, 20 Nov 2023 02:46:12 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232582AbjKTKp6 (ORCPT + 99 others); Mon, 20 Nov 2023 05:45:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37814 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232738AbjKTKpm (ORCPT ); Mon, 20 Nov 2023 05:45:42 -0500 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6E48AED; Mon, 20 Nov 2023 02:45:17 -0800 (PST) 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-out1.suse.de (Postfix) with ESMTPS id D60A2218E3; Mon, 20 Nov 2023 10:45:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1700477115; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:autocrypt:autocrypt; bh=TZOjEP6t4zXFrEXqFznh4zfDrR0FVYyRbvUTAVYWx30=; b=R27o59xoRrhH1rqWE86NsSfjvliVY66Nd0nlzxhHaygJJhgGBI8BuDQAYtDLAkZ2YcS7U0 OkSmbdb7Djbwfpxf/eh0tKClyRAHd6iPJ2wwYcqb3Sie+bLh7sIIe5HBa+1bkdGaOLV9ri 5SU54kwhxY+XmvANmsrG6b926FUfvfY= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1700477115; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:autocrypt:autocrypt; bh=TZOjEP6t4zXFrEXqFznh4zfDrR0FVYyRbvUTAVYWx30=; b=BIm2QExYI7Z8lQE8RqZyCmK76Oy05lv8Y0saDbKiDgT6QwqVSWrS0/nE3f4QWU00hFiX+q Q1zCTF/d2wuX+bBA== 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 96099134AD; Mon, 20 Nov 2023 10:45:15 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id xDfMIbs4W2VyHgAAMHmgww (envelope-from ); Mon, 20 Nov 2023 10:45:15 +0000 Message-ID: Date: Mon, 20 Nov 2023 11:45:14 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 1/2] block: introduce new field flags in block_device To: Yu Kuai , axboe@kernel.dk Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, yukuai3@huawei.com, yi.zhang@huawei.com, yangerkun@huawei.com References: <20231120093847.2228127-1-yukuai1@huaweicloud.com> <20231120093847.2228127-2-yukuai1@huaweicloud.com> Content-Language: en-US From: Hannes Reinecke Autocrypt: addr=hare@suse.de; keydata= xsFNBE6KyREBEACwRN6XKClPtxPiABx5GW+Yr1snfhjzExxkTYaINHsWHlsLg13kiemsS6o7 qrc+XP8FmhcnCOts9e2jxZxtmpB652lxRB9jZE40mcSLvYLM7S6aH0WXKn8bOqpqOGJiY2bc 6qz6rJuqkOx3YNuUgiAxjuoYauEl8dg4bzex3KGkGRuxzRlC8APjHlwmsr+ETxOLBfUoRNuE b4nUtaseMPkNDwM4L9+n9cxpGbdwX0XwKFhlQMbG3rWA3YqQYWj1erKIPpgpfM64hwsdk9zZ QO1krgfULH4poPQFpl2+yVeEMXtsSou915jn/51rBelXeLq+cjuK5+B/JZUXPnNDoxOG3j3V VSZxkxLJ8RO1YamqZZbVP6jhDQ/bLcAI3EfjVbxh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QbC5m1S58N9KXwOFR7333jsA+sqa6L2hEth i/7hcTuKi0U1MDC5WsASFbhbe+yOjPvquHYCcQrFOO+tLvuXSCNCumFcpvDiteNSZUUTD/QB 0Y/U167yjgktS/hZuuCbrUb+E4TG7EL5+IQGRcAJtQduE2jrCSlN547einmB4vQi4G3ToEk/ wr5DwYiNEZyO0pJsh85VNLlgnYpzDi3WC5cqePMueogFZDEjMvUeTzwSTM8+scTw6YAcwoHw h/Zc/Zqi7mdqcWnNg8WfMcKutB6CaFtJhzShfib+D90F/+r3KGzZdLp1QqLYkfXD3to7XCnR QuSHPtufr0nWz7vC3IackvoFHNjQ92ZbHhFbOqLYFHvqaBu8N2PE0YhPh0y0/sjmHM9DHUQh jbCcdMlwO54T4hHLBbuR/lU6locuDn9SsF5lFeoPtfnztU0+GtqTw+cRSo0g2ARonLsydcQ0 YwtooKEemPj2lg== In-Reply-To: <20231120093847.2228127-2-yukuai1@huaweicloud.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Authentication-Results: smtp-out1.suse.de; none X-Spam-Score: 4.19 X-Spamd-Result: default: False [4.19 / 50.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; XM_UA_NO_VERSION(0.01)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; REPLY(-4.00)[]; BAYES_SPAM(5.10)[100.00%]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-0.20)[-1.000]; NEURAL_SPAM_LONG(3.38)[0.965]; RCPT_COUNT_SEVEN(0.00)[7]; FUZZY_BLOCKED(0.00)[rspamd.com]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; MID_RHS_MATCH_FROM(0.00)[] X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, 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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Mon, 20 Nov 2023 02:46:12 -0800 (PST) On 11/20/23 10:38, Yu Kuai wrote: > From: Yu Kuai > > There are multiple switches in struct block_device, use seperate bool > fields for them is not gracefully. Add a new field flags and replace > swithes to a bit, there are no functional changes, and preapre to add > a new switch in the next patch. > > Signed-off-by: Yu Kuai > --- > block/bdev.c | 15 ++++++++------- > block/blk-core.c | 7 ++++--- > block/genhd.c | 8 +++++--- > block/ioctl.c | 2 +- > include/linux/blk_types.h | 12 ++++++------ > include/linux/blkdev.h | 5 +++-- > 6 files changed, 27 insertions(+), 22 deletions(-) > > diff --git a/block/bdev.c b/block/bdev.c > index fc8d28d77495..cb849bcf61ae 100644 > --- a/block/bdev.c > +++ b/block/bdev.c > @@ -408,10 +408,10 @@ struct block_device *bdev_alloc(struct gendisk *disk, u8 partno) > bdev->bd_partno = partno; > bdev->bd_inode = inode; > bdev->bd_queue = disk->queue; > - if (partno) > - bdev->bd_has_submit_bio = disk->part0->bd_has_submit_bio; > + if (partno && test_bit(BD_FLAG_HAS_SUBMIT_BIO, &disk->part0->flags)) > + set_bit(BD_FLAG_HAS_SUBMIT_BIO, &bdev->flags); > else > - bdev->bd_has_submit_bio = false; > + clear_bit(BD_FLAG_HAS_SUBMIT_BIO, &bdev->flags); > bdev->bd_stats = alloc_percpu(struct disk_stats); > if (!bdev->bd_stats) { > iput(inode); Couldn't you achieve the very same result by using 'READ_ONCE()/WRITE_ONCE()' and keep the structure as-is? Cheers, Hannes-- Dr. Hannes Reinecke Kernel Storage Architect hare@suse.de +49 911 74053 688 SUSE Software Solutions Germany GmbH, Frankenstr. 146, 90461 Nürnberg Managing Directors: I. Totev, A. McDonald, W. Knoblich (HRB 36809, AG Nürnberg)