Re: [PATCH 1/3] btrfs: Convert test_find_delalloc() to use a folio

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Jun 13, 2025 at 08:07:00PM +0100, Matthew Wilcox (Oracle) wrote:
> @@ -201,17 +200,16 @@ static int test_find_delalloc(u32 sectorsize, u32 nodesize)
>  	 *           |--- search ---|
>  	 */
>  	test_start = SZ_64M;
> -	locked_page = find_lock_page(inode->i_mapping,
> +	locked_folio = filemap_lock_folio(inode->i_mapping,
>  				     test_start >> PAGE_SHIFT);
> -	if (!locked_page) {
> -		test_err("couldn't find the locked page");
> +	if (!locked_folio) {
> +		test_err("couldn't find the locked folio");
>  		goto out_bits;
>  	}
>  	btrfs_set_extent_bit(tmp, sectorsize, max_bytes - 1, EXTENT_DELALLOC, NULL);
>  	start = test_start;
>  	end = start + PAGE_SIZE - 1;
> -	found = find_lock_delalloc_range(inode, page_folio(locked_page), &start,
> -					 &end);
> +	found = find_lock_delalloc_range(inode, locked_folio, &start, &end);
>  	if (!found) {
>  		test_err("couldn't find delalloc in our range");
>  		goto out_bits;

Hm.  How much do you test the failure paths here?  It seems to me that
the 'locked_folio' is still locked at this point ...

> @@ -328,8 +323,8 @@ static int test_find_delalloc(u32 sectorsize, u32 nodesize)
>  		dump_extent_io_tree(tmp);
>  	btrfs_clear_extent_bits(tmp, 0, total_dirty - 1, (unsigned)-1);
>  out:
> -	if (locked_page)
> -		put_page(locked_page);
> +	if (locked_folio)
> +		folio_put(locked_folio);

And here we put it without unlocking it, which should cause the page
allocator to squawk at you.





[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux