From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 52B09C678D4 for ; Fri, 3 Mar 2023 14:28:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231208AbjCCO2D (ORCPT ); Fri, 3 Mar 2023 09:28:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39906 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231200AbjCCO1y (ORCPT ); Fri, 3 Mar 2023 09:27:54 -0500 Received: from verein.lst.de (verein.lst.de [213.95.11.211]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C322211B for ; Fri, 3 Mar 2023 06:27:51 -0800 (PST) Received: by verein.lst.de (Postfix, from userid 2407) id D995468C4E; Fri, 3 Mar 2023 15:27:46 +0100 (CET) Date: Fri, 3 Mar 2023 15:27:46 +0100 From: Christoph Hellwig To: Qu Wenruo Cc: Christoph Hellwig , Chris Mason , Josef Bacik , David Sterba , linux-btrfs@vger.kernel.org Subject: Re: improve type safety by passing struct btrfs_bio around Message-ID: <20230303142746.GC32738@lst.de> References: <20230301134244.1378533-1-hch@lst.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.17 (2007-11-01) Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org On Fri, Mar 03, 2023 at 07:34:08AM +0800, Qu Wenruo wrote: > But I'm still a little concerned about possible rogue non-btrfs bios. > Is it possible to add one magic number member for btrfs_bio, and do extra > magic number check in btrfs_bio() macro? A magic number adds runtime overhead. The container_of on the bio frontpad is very common all over the kernel, and we don't do that anywhere else. After this series the btrfs_bio() only really happens on allocation and the end_io handler which is fairly easy to keep straight.