Subject: Re: linux-next: manual merge of the vfs-brauner tree with the f2fs tree

From: Stephen Rothwell <[email-masked]>
Date: Thu, 5 Sep 2024 10:18:45 +1000

Hi all,

On Mon, 2 Sep 2024 09:24:05 +1000 Stephen Rothwell <[email-masked]> wrote:
>
> Today's linux-next merge of the vfs-brauner tree got a conflict in:
> 
>   fs/f2fs/data.c
> 
> between commits:
> 
>   f13c7184e62e ("f2fs: convert f2fs_write_begin() to use folio")
>   357dd8479f8b ("f2fs: convert f2fs_write_end() to use folio")
> (and maybe others)
> 
> from the f2fs tree and commits:
> 
>   a0f858d450ce ("f2fs: Convert f2fs_write_end() to use a folio")
>   dfd2e81d37e1 ("f2fs: Convert f2fs_write_begin() to use a folio")
>   a225800f322a ("fs: Convert aops->write_end to take a folio")
>   1da86618bdce ("fs: Convert aops->write_begin to take a folio")
> 
> from the vfs-brauner tree.
> 
> This was too much for me to fix up, so I just used the f2fs tree from
> next-20240830 for today.  Please discuss this and fix things up.

I took another shot at this and *I think* I figured it out - see below
and I have also attached the final version of this file.  Please check
and advise.

-- 
Cheers,
Stephen Rothwell

diff --cc fs/f2fs/data.c
index c6d688208f8b,5dfa0207ad8f..000000000000
--- a/fs/f2fs/data.c
+++ b/fs/f2fs/data.c
@@@ -3626,17 -3617,16 +3627,16 @@@ repeat
  
  	/* TODO: cluster can be compressed due to race with .writepage */
  
- 	*pagep = page;
- 	folio = page_folio(page);
+ 	*foliop = folio;
  
  	if (f2fs_is_atomic_file(inode))
 -		err = prepare_atomic_write_begin(sbi, &folio->page, pos, len,
 +		err = prepare_atomic_write_begin(sbi, folio, pos, len,
  					&blkaddr, &need_balance, &use_cow);
  	else
 -		err = prepare_write_begin(sbi, &folio->page, pos, len,
 +		err = prepare_write_begin(sbi, folio, pos, len,
  					&blkaddr, &need_balance);
  	if (err)
- 		goto fail;
+ 		goto put_folio;
  
  	if (need_balance && !IS_NOQUOTA(inode) &&
  			has_not_enough_free_secs(sbi, 0, 0)) {
@@@ -3668,13 -3659,13 +3669,13 @@@
  		if (!f2fs_is_valid_blkaddr(sbi, blkaddr,
  				DATA_GENERIC_ENHANCE_READ)) {
  			err = -EFSCORRUPTED;
- 			goto fail;
+ 			goto put_folio;
  		}
  		err = f2fs_submit_page_read(use_cow ?
 -				F2FS_I(inode)->cow_inode : inode, &folio->page,
 -				blkaddr, 0, true);
 +				F2FS_I(inode)->cow_inode : inode,
 +				folio, blkaddr, 0, true);
  		if (err)
- 			goto fail;
+ 			goto put_folio;
  
  		folio_lock(folio);
  		if (unlikely(folio->mapping != mapping)) {