linux-next: manual merge of the folio tree with the f2fs tree

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

 



Hi all,

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

  fs/f2fs/data.c

between commit:

  3d7ad9c30607 ("f2fs: change the current atomic write way")

from the f2fs tree and commit:

  bd5533ee6fb4 ("f2fs: Convert to release_folio")

from the folio 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.

-- 
Cheers,
Stephen Rothwell

diff --cc fs/f2fs/data.c
index 54a7a8ad994d,8f38c26bb16c..000000000000
--- a/fs/f2fs/data.c
+++ b/fs/f2fs/data.c
@@@ -3313,103 -3314,8 +3314,102 @@@ unlock_out
  	return err;
  }
  
 +static int __find_data_block(struct inode *inode, pgoff_t index,
 +				block_t *blk_addr)
 +{
 +	struct dnode_of_data dn;
 +	struct page *ipage;
 +	struct extent_info ei = {0, };
 +	int err = 0;
 +
 +	ipage = f2fs_get_node_page(F2FS_I_SB(inode), inode->i_ino);
 +	if (IS_ERR(ipage))
 +		return PTR_ERR(ipage);
 +
 +	set_new_dnode(&dn, inode, ipage, ipage, 0);
 +
 +	if (f2fs_lookup_extent_cache(inode, index, &ei)) {
 +		dn.data_blkaddr = ei.blk + index - ei.fofs;
 +	} else {
 +		/* hole case */
 +		err = f2fs_get_dnode_of_data(&dn, index, LOOKUP_NODE);
 +		if (err) {
 +			dn.data_blkaddr = NULL_ADDR;
 +			err = 0;
 +		}
 +	}
 +	*blk_addr = dn.data_blkaddr;
 +	f2fs_put_dnode(&dn);
 +	return err;
 +}
 +
 +static int __reserve_data_block(struct inode *inode, pgoff_t index,
 +				block_t *blk_addr, bool *node_changed)
 +{
 +	struct f2fs_sb_info *sbi = F2FS_I_SB(inode);
 +	struct dnode_of_data dn;
 +	struct page *ipage;
 +	int err = 0;
 +
 +	f2fs_do_map_lock(sbi, F2FS_GET_BLOCK_PRE_AIO, true);
 +
 +	ipage = f2fs_get_node_page(sbi, inode->i_ino);
 +	if (IS_ERR(ipage)) {
 +		err = PTR_ERR(ipage);
 +		goto unlock_out;
 +	}
 +	set_new_dnode(&dn, inode, ipage, ipage, 0);
 +
 +	err = f2fs_get_block(&dn, index);
 +
 +	*blk_addr = dn.data_blkaddr;
 +	*node_changed = dn.node_changed;
 +	f2fs_put_dnode(&dn);
 +
 +unlock_out:
 +	f2fs_do_map_lock(sbi, F2FS_GET_BLOCK_PRE_AIO, false);
 +	return err;
 +}
 +
 +static int prepare_atomic_write_begin(struct f2fs_sb_info *sbi,
 +			struct page *page, loff_t pos, unsigned int len,
 +			block_t *blk_addr, bool *node_changed)
 +{
 +	struct inode *inode = page->mapping->host;
 +	struct inode *cow_inode = F2FS_I(inode)->cow_inode;
 +	pgoff_t index = page->index;
 +	int err = 0;
 +	block_t ori_blk_addr;
 +
 +	/* If pos is beyond the end of file, reserve a new block in COW inode */
 +	if ((pos & PAGE_MASK) >= i_size_read(inode))
 +		return __reserve_data_block(cow_inode, index, blk_addr,
 +					node_changed);
 +
 +	/* Look for the block in COW inode first */
 +	err = __find_data_block(cow_inode, index, blk_addr);
 +	if (err)
 +		return err;
 +	else if (*blk_addr != NULL_ADDR)
 +		return 0;
 +
 +	/* Look for the block in the original inode */
 +	err = __find_data_block(inode, index, &ori_blk_addr);
 +	if (err)
 +		return err;
 +
 +	/* Finally, we should reserve a new block in COW inode for the update */
 +	err = __reserve_data_block(cow_inode, index, blk_addr, node_changed);
 +	if (err)
 +		return err;
 +
 +	if (ori_blk_addr != NULL_ADDR)
 +		*blk_addr = ori_blk_addr;
 +	return 0;
 +}
 +
  static int f2fs_write_begin(struct file *file, struct address_space *mapping,
- 		loff_t pos, unsigned len, unsigned flags,
- 		struct page **pagep, void **fsdata)
+ 		loff_t pos, unsigned len, struct page **pagep, void **fsdata)
  {
  	struct inode *inode = mapping->host;
  	struct f2fs_sb_info *sbi = F2FS_I_SB(inode);
@@@ -3617,24 -3525,33 +3617,26 @@@ void f2fs_invalidate_folio(struct foli
  	folio_detach_private(folio);
  }
  
- int f2fs_release_page(struct page *page, gfp_t wait)
+ bool f2fs_release_folio(struct folio *folio, gfp_t wait)
  {
- 	/* If this is dirty page, keep PagePrivate */
- 	if (PageDirty(page))
- 		return 0;
+ 	struct f2fs_sb_info *sbi;
+ 
+ 	/* If this is dirty folio, keep private data */
+ 	if (folio_test_dirty(folio))
+ 		return false;
  
- 	if (test_opt(F2FS_P_SB(page), COMPRESS_CACHE)) {
- 		struct inode *inode = page->mapping->host;
 -	/* This is atomic written page, keep Private */
 -	if (page_private_atomic(&folio->page))
 -		return false;
 -
+ 	sbi = F2FS_M_SB(folio->mapping);
+ 	if (test_opt(sbi, COMPRESS_CACHE)) {
+ 		struct inode *inode = folio->mapping->host;
  
- 		if (inode->i_ino == F2FS_COMPRESS_INO(F2FS_I_SB(inode)))
- 			clear_page_private_data(page);
+ 		if (inode->i_ino == F2FS_COMPRESS_INO(sbi))
+ 			clear_page_private_data(&folio->page);
  	}
  
- 	clear_page_private_gcing(page);
+ 	clear_page_private_gcing(&folio->page);
  
- 	detach_page_private(page);
- 	set_page_private(page, 0);
- 	return 1;
+ 	folio_detach_private(folio);
+ 	return true;
  }
  
  static bool f2fs_dirty_data_folio(struct address_space *mapping,

Attachment: pgpzP0YfREBHD.pgp
Description: OpenPGP digital signature


[Index of Archives]     [Linux Kernel]     [Linux USB Development]     [Yosemite News]     [Linux SCSI]

  Powered by Linux