Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp1516310rdb; Sat, 23 Dec 2023 09:33:34 -0800 (PST) X-Google-Smtp-Source: AGHT+IGXtP/riD0v4ESmjd/f8roR7Vgyb1YdO+n8zsvpmDJ10i0jxhqf3M7zp1SQePmqna8gW/ZP X-Received: by 2002:a17:906:f747:b0:a26:e00f:dce0 with SMTP id jp7-20020a170906f74700b00a26e00fdce0mr100184ejb.115.1703352813973; Sat, 23 Dec 2023 09:33:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703352813; cv=none; d=google.com; s=arc-20160816; b=YmhgkpsJvxYBBVCeZdMz4FKQbtF6wFfdjytLrj1qjyiMSDCG57mABYOAt3wWjd6KJa W3cDnO+3pLVDtWFAp/JEb0kq6aD4OWUHIPQwEh+ZsJO9P1VCxMSnEnSuTV92DahK1pWG l2kfV8Nxu71IakubFDuH1w9gQogJHwnayh2oe6XLd847ZVc1NBLRebvRuEVLIK3DkpLi 3c++xEqpms31ZDNm3Tw9H55E02crGF1FZSWQibn0sUuX3wuZSYhnT8YwK+u7pp6Ma4Oy Dx/0jwv3I1BUkWW920dyWpNY7rjDZ2so1Ep4WcZJuO6SfGk3QQsQ8wtvdsppC0WSufWV akBQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=Cxs7b1r/Fe+mA08T4R0mNQ1fxv7+YhK2lTuot6SaQik=; fh=KDZCFuhttnM0bXov95IJEg/apN9MtXrCV8tk4c3xpcs=; b=QnQKZ1gDp9mRvLPJlo4WdBDsdawJGlnRNuP9zLqfqKcEc2AqjmFVhu2uuWtImbCqqb Pd9kriWyY2RtdLlyFwo8kEx3grbNBTc8prbG5h7Q1b5hNvsVrAJ7O0mZWYSEpDsDCN0G kA6QSK+ztuF3JN0z0p+AAL7Tye9pl7VEsjN8WZr6gMpy7qjxeU4P6Z+wCzKYwAcelYAm NnypithZtVclpT2Pp4aL1aN1pvNCSsDNCC35JAK1M3g8bDTU6X3ExSr4KbG+amFb/TWL WHci6aKL+sSodCkDdt6sKE6Lo+uwNkzzl8/DniMWDffkENQCAXNbg1uINTYPC0jMaT1M XPGg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=n5ecZBTz; spf=pass (google.com: domain of linux-ext4+bounces-561-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-ext4+bounces-561-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id h24-20020a170906261800b00a268f348709si3041149ejc.407.2023.12.23.09.33.33 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 23 Dec 2023 09:33:33 -0800 (PST) Received-SPF: pass (google.com: domain of linux-ext4+bounces-561-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=n5ecZBTz; spf=pass (google.com: domain of linux-ext4+bounces-561-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-ext4+bounces-561-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id B51CC1F21AAF for ; Sat, 23 Dec 2023 17:33:33 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A1BCD12E61; Sat, 23 Dec 2023 17:33:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="n5ecZBTz" X-Original-To: linux-ext4@vger.kernel.org Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C65C512E4C; Sat, 23 Dec 2023 17:33:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; 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=Cxs7b1r/Fe+mA08T4R0mNQ1fxv7+YhK2lTuot6SaQik=; b=n5ecZBTziYZYMztlj2287d4czK ml7cm9aw1T+0iVgkbnWKxaTTXKBcb46wrTtLR2cpZ6JzPt87e/ZOk+YN+BcmHpGceFYQwbG6TCmUn 2/VVFTmvky5olmxAfDG+0qZ8z+LPPpf8u70Ai7d5Slq1K484QQZDKCm7dBvsESdFibfIkn0wHOZFA dZJMlBYBjYa9hkvZpbAVrPS56AMkvhhCeNeu4AfGdy+6akR7Z9BIJQ6lfh3OOUC9V+pNhgGo/mfiK S401NuO0YUaMlRsvZHgjfMbObBG2ZmuSJGS1ljZCYKmYCBguSKNIaneuWlwbS7egy1SGKjDV3fGW4 digukkoQ==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1rH5qt-00BIro-7V; Sat, 23 Dec 2023 17:31:55 +0000 Date: Sat, 23 Dec 2023 17:31:55 +0000 From: Matthew Wilcox To: Yu Kuai Cc: axboe@kernel.dk, roger.pau@citrix.com, colyli@suse.de, kent.overstreet@gmail.com, joern@lazybastard.org, miquel.raynal@bootlin.com, richard@nod.at, vigneshr@ti.com, sth@linux.ibm.com, hoeppner@linux.ibm.com, hca@linux.ibm.com, gor@linux.ibm.com, agordeev@linux.ibm.com, jejb@linux.ibm.com, martin.petersen@oracle.com, clm@fb.com, josef@toxicpanda.com, dsterba@suse.com, viro@zeniv.linux.org.uk, brauner@kernel.org, nico@fluxnic.net, xiang@kernel.org, chao@kernel.org, tytso@mit.edu, adilger.kernel@dilger.ca, jack@suse.com, konishi.ryusuke@gmail.com, akpm@linux-foundation.org, hare@suse.de, p.raghav@samsung.com, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, xen-devel@lists.xenproject.org, linux-bcache@vger.kernel.org, linux-mtd@lists.infradead.org, linux-s390@vger.kernel.org, linux-scsi@vger.kernel.org, linux-bcachefs@vger.kernel.org, linux-btrfs@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-erofs@lists.ozlabs.org, linux-ext4@vger.kernel.org, linux-nilfs@vger.kernel.org, yukuai3@huawei.com, yi.zhang@huawei.com, yangerkun@huawei.com Subject: Re: [PATCH RFC v3 for-6.8/block 09/17] btrfs: use bdev apis Message-ID: References: <20231221085712.1766333-1-yukuai1@huaweicloud.com> <20231221085712.1766333-10-yukuai1@huaweicloud.com> Precedence: bulk X-Mailing-List: linux-ext4@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231221085712.1766333-10-yukuai1@huaweicloud.com> On Thu, Dec 21, 2023 at 04:57:04PM +0800, Yu Kuai wrote: > @@ -3674,16 +3670,17 @@ struct btrfs_super_block *btrfs_read_dev_one_super(struct block_device *bdev, > * Drop the page of the primary superblock, so later read will > * always read from the device. > */ > - invalidate_inode_pages2_range(mapping, > - bytenr >> PAGE_SHIFT, > + invalidate_bdev_range(bdev, bytenr >> PAGE_SHIFT, > (bytenr + BTRFS_SUPER_INFO_SIZE) >> PAGE_SHIFT); > } > > - page = read_cache_page_gfp(mapping, bytenr >> PAGE_SHIFT, GFP_NOFS); > - if (IS_ERR(page)) > - return ERR_CAST(page); > + nofs_flag = memalloc_nofs_save(); > + folio = bdev_read_folio(bdev, bytenr); > + memalloc_nofs_restore(nofs_flag); This is the wrong way to use memalloc_nofs_save/restore. They should be used at the point that the filesystem takes/releases whatever lock is also used during reclaim. I don't know btrfs well enough to suggest what lock is missing these annotations.