Received: by 2002:a05:7412:40d:b0:e2:908c:2ebd with SMTP id 13csp932009rdf; Wed, 22 Nov 2023 00:20:11 -0800 (PST) X-Google-Smtp-Source: AGHT+IGTM1P1/nG16YaJ8M3wW3FCqwEJQ2RD24W+T6vCnNiPvjyaxkE9FLS0r8tKQak1Y1ZAKOu+ X-Received: by 2002:a05:6830:1e67:b0:6ca:c677:4568 with SMTP id m7-20020a0568301e6700b006cac6774568mr1848527otr.10.1700641211471; Wed, 22 Nov 2023 00:20:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700641211; cv=none; d=google.com; s=arc-20160816; b=SMXQ9Cao1xnBhkfxJyBCkzabueCu0Id2eMAsHDZkABsKJDnmKD529hP/g06NqGyvn8 iTyxHzS5x0iJHRm9QlzRk5TK2/sOSsY+S77juFK8F0980a3/bMziULFwF4yjUwP70fPY msPsYkxyEi1RJS8QAjKYqBlVMVYH5y89UJaTZHZpToJp7U69WiM36Ge/H2Vcv4HXiiJJ ccmY7dmaDAq+40pAxNc6FF8i0U7RaBuB7fAmNM4/hRMPs4WBEJwjYLP8UV23wyIkUF76 /dZ3rqVtWtS/0R57VQaGNuF05lkWD8o9A5qoq70ASPzxlOcILsqsWbK8j7PAgmdKoUr9 4jkA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=NIoITgQxtiObzPXLhbMbQ4g44rH9YUmiKgRrHrYsxWk=; fh=2+37wnsYfbqDmMaw6l0SemXKjfRlbprXZEyTyAU6X3k=; b=kw/LT8xPTRRL/LseCmavGIznW8f7t1weJr3mVXzqIzLu8FggM+95eV0YiHsfJvNsKP Jv9WVe+yCPO+ehEZTi5TEWAB6ITM5x9Y1ZFplr/+smzantDTSX6+2y79prYEJDdLCwSO jQUhRoZenWLIXN0iMMeJ/Oe9xYDGbaXi5S3W+lA2vIj3KeHQEAW+q/r7ft+YiqdxPXO/ fWW58nMqX5tinjbxgzHtcQKBJF+TZRpggNUrMv9gjdGicNknnBEkV7xOYiItsRyCRsJ1 C0Gcz2BLsF/fQ+wlUtxRHQ1I2FC5NZfwzt8fesPdO0AZQYKt5VvCXSd8/scfWYSQRgPT wB3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=FFuy4uKp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id a16-20020a656410000000b005c202446846si11159525pgv.510.2023.11.22.00.20.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Nov 2023 00:20:11 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=FFuy4uKp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id E1BC9811546C; Wed, 22 Nov 2023 00:20:08 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234984AbjKVIUC (ORCPT + 99 others); Wed, 22 Nov 2023 03:20:02 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58180 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234757AbjKVIUB (ORCPT ); Wed, 22 Nov 2023 03:20:01 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A006E198 for ; Wed, 22 Nov 2023 00:19:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1700641196; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=NIoITgQxtiObzPXLhbMbQ4g44rH9YUmiKgRrHrYsxWk=; b=FFuy4uKp92dGR4THblPwM/BRZYSLHNl3NCQTUT4gz9QLg8v6gkXOxTFtU+kxFwSxIs56lg Hzb87qEUqJUOAKooRRi983hKxsrwXHjVDX2VqRaCbevrl/2lYiZDHA1rb/kmKO+VKroY3m DqHra0PNbVn04y4H/ugMDALVwvCqvn4= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-542-Y8eM_pUwMYakn0zSjgAXzg-1; Wed, 22 Nov 2023 03:19:50 -0500 X-MC-Unique: Y8eM_pUwMYakn0zSjgAXzg-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 1B1A93C10146; Wed, 22 Nov 2023 08:19:50 +0000 (UTC) Received: from fedora (unknown [10.72.120.3]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7BBCBC1596F; Wed, 22 Nov 2023 08:19:45 +0000 (UTC) Date: Wed, 22 Nov 2023 16:19:40 +0800 From: Ming Lei To: Christoph Hellwig Cc: Yu Kuai , axboe@kernel.dk, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, yukuai3@huawei.com, yi.zhang@huawei.com, yangerkun@huawei.com Subject: Re: [PATCH v3 2/3] block: introduce new field bd_flags in block_device Message-ID: References: <20231122103103.1104589-1-yukuai1@huaweicloud.com> <20231122103103.1104589-3-yukuai1@huaweicloud.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.8 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,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 agentk.vger.email 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 (agentk.vger.email [0.0.0.0]); Wed, 22 Nov 2023 00:20:09 -0800 (PST) On Tue, Nov 21, 2023 at 11:53:17PM -0800, Christoph Hellwig wrote: > On Wed, Nov 22, 2023 at 03:45:24PM +0800, Ming Lei wrote: > > All the existed 'bool' flags are not atomic RW, so I think it isn't > > necessary to define 'bd_flags' as 'unsigned long' for replacing them. > > So because the old code wasn't correct we'll never bother? The new > flag and the new placement certainly make this more critical as well. Can you explain why the old code was wrong? 1) ->bd_read_only and ->bd_make_it_fail - set from userspace interface(ioctl or sysfs) - check in IO code path so changing it into atomic bit doesn't make difference from user viewpoint. 2) ->bd_write_holder disk->open_mutex is held for read & write this flag 3) ->bd_has_submit_bio This flag is setup as oneshot before adding disk, and check in FS io code path. Of course, defining it as 'unsigned long' can extend its future usage, but it depends on the atomic requirement of each flag itself. Thanks, Ming