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 73B54C74A5B for ; Wed, 29 Mar 2023 23:47:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230129AbjC2Xr6 (ORCPT ); Wed, 29 Mar 2023 19:47:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49676 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229462AbjC2Xrz (ORCPT ); Wed, 29 Mar 2023 19:47:55 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D4BB559EA for ; Wed, 29 Mar 2023 16:47:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=yGKzLjOhCsTc4RJ6kPAIDwvNzZeCKzRZ6dWC1Bdm9Fg=; b=qHPNpBjoIeIzVvL0PBTwa0kVve TaMHpGPorPFEOnK1ZOb2+lOFIer6ZdMc/qyx5Of/C5cyg2Tj9aAb57QUvZf8jcCizRGkvudVzp27j E2n2pi3086ztjmKxE9L/uU31J31wyUsBsNc+3CtlaA93N1DyG0g9nGQEkERi3sd2vx5c8GYDRWTtA Z4bbEqRmPHqob+V0Vfk0YyhyKSwKjb+3Z4xlofQZyPBs8Z7wmUPCKcd/u9IGJDwtihyOhaitKcLZz TkOW09nbMK0l4TNVw9vMo9HTTXEbfzAYdJ+t5LRhDXIKplEmjRLBtoT1fraklvL934kJWCisPPyk3 jFpY6Dtw==; Received: from hch by bombadil.infradead.org with local (Exim 4.96 #2 (Red Hat Linux)) id 1phfWB-0025wS-1W; Wed, 29 Mar 2023 23:47:51 +0000 Date: Wed, 29 Mar 2023 16:47:51 -0700 From: Christoph Hellwig To: Qu Wenruo Cc: Christoph Hellwig , Qu Wenruo , linux-btrfs@vger.kernel.org Subject: Re: [PATCH v7 02/13] btrfs: introduce a new allocator for scrub specific btrfs_bio Message-ID: References: <3289eba8-8492-3c14-6e3c-f6ef7df7cbb1@gmx.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <3289eba8-8492-3c14-6e3c-f6ef7df7cbb1@gmx.com> X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org On Thu, Mar 30, 2023 at 07:39:43AM +0800, Qu Wenruo wrote: > But as my usual tendency, it would still be better to have some ASSERT()s to > make sure we're properly populating @inode for needed call sites. Well, where would you place them? The only place where we could do it would be in btrfs_submit_chunk, but without having the inode there is no way to know if we would have needed one. > Or we can easily pass some bbio, which should go through csum verification, > without a valid @inode pointer, and to be treated as NODATACSUM. > Such problem can be very hard to detect. That's what we have tests or that check that csums were there and used to detect and fix problems. In the new world order I'd rather see bbio->inode != NULL as flag to run the checksumming and repair infrastructure. Especially as with a bit more work I'll be able to never set bbio->inode for all metadata I/O either, and possibly get rid of the btree inode entirely.