LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* linux-next: manual merge of the f2fs tree with the ext3 tree
@ 2021-08-24 23:51 Stephen Rothwell
  0 siblings, 0 replies; 2+ messages in thread
From: Stephen Rothwell @ 2021-08-24 23:51 UTC (permalink / raw)
  To: Jaegeuk Kim, Jan Kara
  Cc: Chao Yu, Linux Kernel Mailing List, Linux Next Mailing List

[-- Attachment #1: Type: text/plain, Size: 1535 bytes --]

Hi all,

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

  fs/f2fs/file.c

between commit:

  edc6d01bad73 ("f2fs: Convert to using invalidate_lock")

from the ext3 tree and commit:

  4817758c80ad ("f2fs: adjust unlock order for cleanup")

from the f2fs 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/file.c
index 1ff333755721,3330efb41f22..000000000000
--- a/fs/f2fs/file.c
+++ b/fs/f2fs/file.c
@@@ -3473,8 -3496,8 +3494,8 @@@ static int f2fs_release_compress_blocks
  		released_blocks += ret;
  	}
  
- 	up_write(&F2FS_I(inode)->i_gc_rwsem[WRITE]);
 -	up_write(&F2FS_I(inode)->i_mmap_sem);
 +	filemap_invalidate_unlock(inode->i_mapping);
+ 	up_write(&F2FS_I(inode)->i_gc_rwsem[WRITE]);
  out:
  	inode_unlock(inode);
  
@@@ -3626,8 -3649,8 +3647,8 @@@ static int f2fs_reserve_compress_blocks
  		reserved_blocks += ret;
  	}
  
- 	up_write(&F2FS_I(inode)->i_gc_rwsem[WRITE]);
 -	up_write(&F2FS_I(inode)->i_mmap_sem);
 +	filemap_invalidate_unlock(inode->i_mapping);
+ 	up_write(&F2FS_I(inode)->i_gc_rwsem[WRITE]);
  
  	if (ret >= 0) {
  		clear_inode_flag(inode, FI_COMPRESS_RELEASED);

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* linux-next: manual merge of the f2fs tree with the ext3 tree
@ 2021-07-23  0:21 Stephen Rothwell
  0 siblings, 0 replies; 2+ messages in thread
From: Stephen Rothwell @ 2021-07-23  0:21 UTC (permalink / raw)
  To: Jaegeuk Kim, Jan Kara
  Cc: Eric Biggers, Linux Kernel Mailing List, Linux Next Mailing List

[-- Attachment #1: Type: text/plain, Size: 4690 bytes --]

Hi all,

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

  fs/f2fs/file.c

between commit:

  edc6d01bad73 ("f2fs: Convert to using invalidate_lock")

from the ext3 tree and commit:

  5f2632fa1471 ("f2fs: reduce indentation in f2fs_file_write_iter()")

from the f2fs 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/file.c
index 1ff333755721,279252c7f7bc..000000000000
--- a/fs/f2fs/file.c
+++ b/fs/f2fs/file.c
@@@ -4252,79 -4318,54 +4316,54 @@@ static ssize_t f2fs_file_write_iter(str
  	}
  
  	ret = generic_write_checks(iocb, from);
- 	if (ret > 0) {
- 		bool preallocated = false;
- 		size_t target_size = 0;
- 		int err;
- 
- 		if (iov_iter_fault_in_readable(from, iov_iter_count(from)))
- 			set_inode_flag(inode, FI_NO_PREALLOC);
- 
- 		if ((iocb->ki_flags & IOCB_NOWAIT)) {
- 			if (!f2fs_overwrite_io(inode, iocb->ki_pos,
- 						iov_iter_count(from)) ||
- 				f2fs_has_inline_data(inode) ||
- 				f2fs_force_buffered_io(inode, iocb, from)) {
- 				clear_inode_flag(inode, FI_NO_PREALLOC);
- 				inode_unlock(inode);
- 				ret = -EAGAIN;
- 				goto out;
- 			}
- 			goto write;
- 		}
- 
- 		if (is_inode_flag_set(inode, FI_NO_PREALLOC))
- 			goto write;
+ 	if (ret <= 0)
+ 		goto out_unlock;
  
- 		if (iocb->ki_flags & IOCB_DIRECT) {
- 			/*
- 			 * Convert inline data for Direct I/O before entering
- 			 * f2fs_direct_IO().
- 			 */
- 			err = f2fs_convert_inline_inode(inode);
- 			if (err)
- 				goto out_err;
- 			/*
- 			 * If force_buffere_io() is true, we have to allocate
- 			 * blocks all the time, since f2fs_direct_IO will fall
- 			 * back to buffered IO.
- 			 */
- 			if (!f2fs_force_buffered_io(inode, iocb, from) &&
- 					allow_outplace_dio(inode, iocb, from))
- 				goto write;
+ 	if (iocb->ki_flags & IOCB_NOWAIT) {
+ 		if (!f2fs_overwrite_io(inode, iocb->ki_pos,
+ 				       iov_iter_count(from)) ||
+ 		    f2fs_has_inline_data(inode) ||
+ 		    f2fs_force_buffered_io(inode, iocb, from)) {
+ 			ret = -EAGAIN;
+ 			goto out_unlock;
  		}
- 		preallocated = true;
- 		target_size = iocb->ki_pos + iov_iter_count(from);
+ 	}
+ 	if (iocb->ki_flags & IOCB_DIRECT) {
+ 		/*
+ 		 * Convert inline data for Direct I/O before entering
+ 		 * f2fs_direct_IO().
+ 		 */
+ 		ret = f2fs_convert_inline_inode(inode);
+ 		if (ret)
+ 			goto out_unlock;
+ 	}
  
- 		err = f2fs_preallocate_blocks(iocb, from);
- 		if (err) {
- out_err:
- 			clear_inode_flag(inode, FI_NO_PREALLOC);
- 			inode_unlock(inode);
- 			ret = err;
- 			goto out;
- 		}
- write:
- 		ret = __generic_file_write_iter(iocb, from);
- 		clear_inode_flag(inode, FI_NO_PREALLOC);
+ 	/* Possibly preallocate the blocks for the write. */
+ 	target_size = iocb->ki_pos + iov_iter_count(from);
+ 	preallocated = f2fs_preallocate_blocks(iocb, from);
+ 	if (preallocated < 0) {
+ 		ret = preallocated;
+ 		goto out_unlock;
+ 	}
  
- 		/* if we couldn't write data, we should deallocate blocks. */
- 		if (preallocated && i_size_read(inode) < target_size) {
- 			down_write(&F2FS_I(inode)->i_gc_rwsem[WRITE]);
- 			filemap_invalidate_lock(inode->i_mapping);
- 			f2fs_truncate(inode);
- 			filemap_invalidate_unlock(inode->i_mapping);
- 			up_write(&F2FS_I(inode)->i_gc_rwsem[WRITE]);
- 		}
+ 	ret = __generic_file_write_iter(iocb, from);
  
- 		if (ret > 0)
- 			f2fs_update_iostat(F2FS_I_SB(inode), APP_WRITE_IO, ret);
+ 	/* Don't leave any preallocated blocks around past i_size. */
+ 	if (preallocated > 0 && inode->i_size < target_size) {
+ 		down_write(&F2FS_I(inode)->i_gc_rwsem[WRITE]);
 -		down_write(&F2FS_I(inode)->i_mmap_sem);
++		filemap_invalidate_lock(inode->i_mapping);
+ 		f2fs_truncate(inode);
 -		up_write(&F2FS_I(inode)->i_mmap_sem);
++		filemap_invalidate_unlock(inode->i_mapping);
+ 		up_write(&F2FS_I(inode)->i_gc_rwsem[WRITE]);
  	}
- unlock:
+ 	clear_inode_flag(inode, FI_PREALLOCATED_ALL);
+ 
+ 	if (ret > 0)
+ 		f2fs_update_iostat(F2FS_I_SB(inode), APP_WRITE_IO, ret);
+ out_unlock:
  	inode_unlock(inode);
  out:
- 	trace_f2fs_file_write_iter(inode, iocb->ki_pos,
- 					iov_iter_count(from), ret);
+ 	trace_f2fs_file_write_iter(inode, orig_pos, orig_count, ret);
  	if (ret > 0)
  		ret = generic_write_sync(iocb, ret);
  	return ret;

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-08-24 23:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-24 23:51 linux-next: manual merge of the f2fs tree with the ext3 tree Stephen Rothwell
  -- strict thread matches above, loose matches on Subject: below --
2021-07-23  0:21 Stephen Rothwell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).