Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp1542673rdb; Sat, 23 Dec 2023 10:39:48 -0800 (PST) X-Google-Smtp-Source: AGHT+IHw7Hp22gN+df6/ArrmJwnJ1nbr3raSfqlSk4P6PicefJLcqvI04p+i9x+JPAFSyqr3X6VR X-Received: by 2002:a0c:fb4c:0:b0:67f:aeaf:b57a with SMTP id b12-20020a0cfb4c000000b0067faeafb57amr1729763qvq.104.1703356788162; Sat, 23 Dec 2023 10:39:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703356788; cv=none; d=google.com; s=arc-20160816; b=qu45/HzsvELcncsnYNWkJmEdluT2ilflO90cw/ML2Pxt6KhlRKYwhcHzx7+9mtL+1r jtGHYjo952r8YkAGktT126jYqSWeHsbKGe+VJunRWN4uhnw53fhGeHRJdIqgj8Vb0L5H Zgxy8sDJoIFen4TgYUKO/oePIDIFatVJBkbOyJJYxhKbvQ/+AiDMZ8y7Zcy+huxgTFsf S8N4QyFGZuw2hh9RyK6bO1+xm/0YsfruYQ6i4gd+rcXGHLu0rOk2G5WFhgc+gG4BTgL0 1iAq9vjv7tKVCMbTjCUE3TLmuObzE544Bbthx4lyzXBOP6sXsyvcQJAYzQcX211o4l/p RBjw== 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:dkim-signature:date; bh=nl8KqWKpD6wWjbvJJznLUba3EPd6rpJb9056eV80EZI=; fh=hdmhxUMxVhj5iF7Np6mqN5LS9kFw5JhFoBDd+ZgIdWk=; b=NMcVkAzd0dgsg6Dx9cKWFd1BbhCygrchcN1dnQxT4uWMze3K8ciqIRw6rSlJK/Ld3C ULoPEvgOLZs2GG4ks40Yt7Q1tAu1Rw4pLf22b4pKHJKkzRQZTVul6CVD5MGHz0kwW4Uf pVl310N+m/jZk4iC78CQFvLMDM2RSnugZLUoVWaomyQtCgJSkn9TpBYtKrL++YQTDuly pchDp+IfQtmQKWvr+2Z3JpLkKaW7LtUvxvPpzoBjB3DBibgFKGjaephd8TBXFktLFkKP l6JLeg2QyDkUKeJML0FtmRYLKcHjy0COkMAqR27zKSPDKzC544PAfDmlMXQapCDUQ6EB aWYg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=mLUUfEd7; spf=pass (google.com: domain of linux-ext4+bounces-562-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-ext4+bounces-562-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id d14-20020a0cf0ce000000b0067f0d1677e7si7365629qvl.517.2023.12.23.10.39.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 23 Dec 2023 10:39:48 -0800 (PST) Received-SPF: pass (google.com: domain of linux-ext4+bounces-562-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=mLUUfEd7; spf=pass (google.com: domain of linux-ext4+bounces-562-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-ext4+bounces-562-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev 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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 7C1481C2165F for ; Sat, 23 Dec 2023 18:39:43 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 94BA11401B; Sat, 23 Dec 2023 18:39:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="mLUUfEd7" X-Original-To: linux-ext4@vger.kernel.org Received: from out-185.mta1.migadu.com (out-185.mta1.migadu.com [95.215.58.185]) (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 6864412E63; Sat, 23 Dec 2023 18:39:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Date: Sat, 23 Dec 2023 13:39:24 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1703356772; 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=nl8KqWKpD6wWjbvJJznLUba3EPd6rpJb9056eV80EZI=; b=mLUUfEd7gfPYDe3oleQ9tbdyTO5xnWBH1tZ17cgI4qqbATl0NNgyxkk9s86/LqjribMhXF icSGv6krf/Bb8nP/Rk+sLamzbNdocnFQ0i9s/yQOF2bzXjM3YAZVaDOCpBwjSIvilLWEoR /klCC3TPr9UUNblk28yYvK2TJLs04lQ= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Kent Overstreet To: Matthew Wilcox Cc: Yu Kuai , 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: X-Migadu-Flow: FLOW_OUT On Sat, Dec 23, 2023 at 05:31:55PM +0000, Matthew Wilcox wrote: > 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. Yes, but considering this is a cross-filesystem cleanup I wouldn't want to address that in this patchset. And the easier, more incremental approach for the conversion would be to first convert every GFP_NOFS usage to memalloc_nofs_save() like this patch does, as small local changes, and then let the btrfs people combine them and move them to the approproate location in a separate patchstet.