Skip to contentSkip to conversation

linux-next: manual merge of the vfs-brauner tree with the btrfs tree

DISCUSSION Stephen Rothwell 1 participant 1 message Apr 30, 2024 Linux-next tree

lore
Share & tools
lore
#0 lore raw

Hi all,

Today's linux-next merge of the vfs-brauner tree got a conflict in:

fs/btrfs/disk-io.c

between commit:

5c855642bbb9 ("btrfs: Use a folio in wait_dev_supers()")

from the btrfs tree and commit:

db3102368e1b ("use ->bd_mapping instead of ->bd_inode->i_mapping")

from the vfs-brauner tree.

I fixed it up (see below) and can carry the fix as necessary. This is now fixed as far as linux-next is concerned, but any non trivial conflicts should be mentioned to your upstream maintainer when your tree is submitted for merging. You may also want to consider cooperating with the maintainer of the conflicting tree to minimise any particularly complex conflicts.

Signature · 59 lines
Cheers,
Stephen Rothwell

diff --cc fs/btrfs/disk-io.c
index 6b3720b13939,f10e894b0bf5..000000000000
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@@ -3739,9 -3738,10 +3739,9 @@@ static int write_dev_supers(struct btrf
  			    struct btrfs_super_block *sb, int max_mirrors)
  {
  	struct btrfs_fs_info *fs_info = device->fs_info;
- 	struct address_space *mapping = device->bdev->bd_inode->i_mapping;
+ 	struct address_space *mapping = device->bdev->bd_mapping;
  	SHASH_DESC_ON_STACK(shash, fs_info->csum_shash);
  	int i;
 -	int errors = 0;
  	int ret;
  	u64 bytenr, bytenr_orig;
  
@@@ -3855,19 -3855,29 +3855,19 @@@ static int wait_dev_supers(struct btrfs
  		    device->commit_total_bytes)
  			break;
  
- 		folio = filemap_get_folio(device->bdev->bd_inode->i_mapping,
 -		page = find_get_page(device->bdev->bd_mapping,
++		folio = filemap_get_folio(device->bdev->bd_mapping,
  				     bytenr >> PAGE_SHIFT);
 -		if (!page) {
 -			errors++;
 -			if (i == 0)
 -				primary_failed = true;
 +		/* If the folio has been removed, then we know it completed */
 +		if (IS_ERR(folio))
  			continue;
 -		}
 -		/* Page is submitted locked and unlocked once the IO completes */
 -		wait_on_page_locked(page);
 -		if (PageError(page)) {
 -			errors++;
 -			if (i == 0)
 -				primary_failed = true;
 -		}
 -
 -		/* Drop our reference */
 -		put_page(page);
 -
 -		/* Drop the reference from the writing run */
 -		put_page(page);
 +		/* Folio is unlocked once the IO completes */
 +		folio_wait_locked(folio);
 +		folio_put(folio);
  	}
  
 +	errors += atomic_read(&device->sb_wb_errors);
 +	if (errors >= BTRFS_DEV_PRIMARY_ERROR)
 +		primary_failed = true;
  	/* log error, force error return */
  	if (primary_failed) {
  		btrfs_err(device->fs_info, "error writing primary super block to device %llu",