[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH RFC v3 for-6.8/block 09/17] btrfs: use bdev apis
- To: Yu Kuai <yukuai1@xxxxxxxxxxxxxxx>
- From: Matthew Wilcox <willy@xxxxxxxxxxxxx>
- Date: Sat, 23 Dec 2023 17:31:55 +0000
- Cc: axboe@xxxxxxxxx, roger.pau@xxxxxxxxxx, colyli@xxxxxxx, kent.overstreet@xxxxxxxxx, joern@xxxxxxxxxxxxxxx, miquel.raynal@xxxxxxxxxxx, richard@xxxxxx, vigneshr@xxxxxx, sth@xxxxxxxxxxxxx, hoeppner@xxxxxxxxxxxxx, hca@xxxxxxxxxxxxx, gor@xxxxxxxxxxxxx, agordeev@xxxxxxxxxxxxx, jejb@xxxxxxxxxxxxx, martin.petersen@xxxxxxxxxx, clm@xxxxxx, josef@xxxxxxxxxxxxxx, dsterba@xxxxxxxx, viro@xxxxxxxxxxxxxxxxxx, brauner@xxxxxxxxxx, nico@xxxxxxxxxxx, xiang@xxxxxxxxxx, chao@xxxxxxxxxx, tytso@xxxxxxx, adilger.kernel@xxxxxxxxx, jack@xxxxxxxx, konishi.ryusuke@xxxxxxxxx, akpm@xxxxxxxxxxxxxxxxxxxx, hare@xxxxxxx, p.raghav@xxxxxxxxxxx, linux-block@xxxxxxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx, xen-devel@xxxxxxxxxxxxxxxxxxxx, linux-bcache@xxxxxxxxxxxxxxx, linux-mtd@xxxxxxxxxxxxxxxxxxx, linux-s390@xxxxxxxxxxxxxxx, linux-scsi@xxxxxxxxxxxxxxx, linux-bcachefs@xxxxxxxxxxxxxxx, linux-btrfs@xxxxxxxxxxxxxxx, linux-fsdevel@xxxxxxxxxxxxxxx, linux-erofs@xxxxxxxxxxxxxxxx, linux-ext4@xxxxxxxxxxxxxxx, linux-nilfs@xxxxxxxxxxxxxxx, yukuai3@xxxxxxxxxx, yi.zhang@xxxxxxxxxx, yangerkun@xxxxxxxxxx
- Delivery-date: Sat, 23 Dec 2023 17:33:41 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
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.
|