All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Rothwell <sfr@canb.auug.org.au>
To: Al Viro <viro@ZenIV.linux.org.uk>, "Theodore Ts'o" <tytso@mit.edu>
Cc: linux-next@vger.kernel.org, linux-kernel@vger.kernel.org,
	Christoph Hellwig <hch@lst.de>, Jan Kara <jack@suse.cz>
Subject: linux-next: manual merge of the vfs tree with the ext4 tree
Date: Tue, 17 May 2016 10:23:55 +1000	[thread overview]
Message-ID: <20160517102355.4be4af45@canb.auug.org.au> (raw)

Hi all,

Today's linux-next merge of the vfs tree got conflicts in:

  fs/ext4/ext4.h
  fs/ext4/indirect.c
  fs/ext4/inode.c

between commit:

  914f82a32d02 ("ext4: refactor direct IO code")

from the ext4 tree and commit:

  c8b8e32d700f ("direct-io: eliminate the offset argument to ->direct_IO")

from the vfs tree.

I fixed it up (hopefully - 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/ext4/ext4.h
index b84aa1ca480a,72f4c9e00e97..000000000000
--- a/fs/ext4/ext4.h
+++ b/fs/ext4/ext4.h
diff --cc fs/ext4/indirect.c
index bc15c2c17633,627b7e8f9ef3..000000000000
--- a/fs/ext4/indirect.c
+++ b/fs/ext4/indirect.c
diff --cc fs/ext4/inode.c
index f9ab1e8cc416,79b298d397b4..000000000000
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@@ -3327,13 -3334,12 +3327,13 @@@ static int ext4_end_io_dio(struct kioc
   * if the machine crashes during the write.
   *
   */
- static ssize_t ext4_direct_IO_write(struct kiocb *iocb, struct iov_iter *iter,
- 				    loff_t offset)
 -static ssize_t ext4_ext_direct_IO(struct kiocb *iocb, struct iov_iter *iter)
++static ssize_t ext4_direct_IO_write(struct kiocb *iocb, struct iov_iter *iter)
  {
  	struct file *file = iocb->ki_filp;
  	struct inode *inode = file->f_mapping->host;
 +	struct ext4_inode_info *ei = EXT4_I(inode);
  	ssize_t ret;
+ 	loff_t offset = iocb->ki_pos;
  	size_t count = iov_iter_count(iter);
  	int overwrite = 0;
  	get_block_t *get_block_func = NULL;
@@@ -3423,12 -3399,12 +3423,12 @@@
  #ifdef CONFIG_EXT4_FS_ENCRYPTION
  	BUG_ON(ext4_encrypted_inode(inode) && S_ISREG(inode->i_mode));
  #endif
 -	if (IS_DAX(inode))
 +	if (IS_DAX(inode)) {
- 		ret = dax_do_io(iocb, inode, iter, offset, get_block_func,
+ 		ret = dax_do_io(iocb, inode, iter, get_block_func,
  				ext4_end_io_dio, dio_flags);
 -	else
 +	} else
  		ret = __blockdev_direct_IO(iocb, inode,
- 					   inode->i_sb->s_bdev, iter, offset,
+ 					   inode->i_sb->s_bdev, iter,
  					   get_block_func,
  					   ext4_end_io_dio, NULL, dio_flags);
  
@@@ -3451,82 -3428,6 +3451,82 @@@
  	if (overwrite)
  		inode_lock(inode);
  
 +	if (ret < 0 && final_size > inode->i_size)
 +		ext4_truncate_failed_write(inode);
 +
 +	/* Handle extending of i_size after direct IO write */
 +	if (orphan) {
 +		int err;
 +
 +		/* Credits for sb + inode write */
 +		handle = ext4_journal_start(inode, EXT4_HT_INODE, 2);
 +		if (IS_ERR(handle)) {
 +			/* This is really bad luck. We've written the data
 +			 * but cannot extend i_size. Bail out and pretend
 +			 * the write failed... */
 +			ret = PTR_ERR(handle);
 +			if (inode->i_nlink)
 +				ext4_orphan_del(NULL, inode);
 +
 +			goto out;
 +		}
 +		if (inode->i_nlink)
 +			ext4_orphan_del(handle, inode);
 +		if (ret > 0) {
 +			loff_t end = offset + ret;
 +			if (end > inode->i_size) {
 +				ei->i_disksize = end;
 +				i_size_write(inode, end);
 +				/*
 +				 * We're going to return a positive `ret'
 +				 * here due to non-zero-length I/O, so there's
 +				 * no way of reporting error returns from
 +				 * ext4_mark_inode_dirty() to userspace.  So
 +				 * ignore it.
 +				 */
 +				ext4_mark_inode_dirty(handle, inode);
 +			}
 +		}
 +		err = ext4_journal_stop(handle);
 +		if (ret == 0)
 +			ret = err;
 +	}
 +out:
 +	return ret;
 +}
 +
- static ssize_t ext4_direct_IO_read(struct kiocb *iocb, struct iov_iter *iter,
- 				   loff_t offset)
++static ssize_t ext4_direct_IO_read(struct kiocb *iocb, struct iov_iter *iter)
 +{
 +	int unlocked = 0;
 +	struct inode *inode = iocb->ki_filp->f_mapping->host;
++	loff_t offset = iocb->ki_pos;
 +	ssize_t ret;
 +
 +	if (ext4_should_dioread_nolock(inode)) {
 +		/*
 +		 * Nolock dioread optimization may be dynamically disabled
 +		 * via ext4_inode_block_unlocked_dio(). Check inode's state
 +		 * while holding extra i_dio_count ref.
 +		 */
 +		inode_dio_begin(inode);
 +		smp_mb();
 +		if (unlikely(ext4_test_inode_state(inode,
 +						    EXT4_STATE_DIOREAD_LOCK)))
 +			inode_dio_end(inode);
 +		else
 +			unlocked = 1;
 +	}
 +	if (IS_DAX(inode)) {
- 		ret = dax_do_io(iocb, inode, iter, offset, ext4_dio_get_block,
++		ret = dax_do_io(iocb, inode, iter, ext4_dio_get_block,
 +				NULL, unlocked ? 0 : DIO_LOCKING);
 +	} else {
 +		ret = __blockdev_direct_IO(iocb, inode, inode->i_sb->s_bdev,
- 					   iter, offset, ext4_dio_get_block,
++					   iter, ext4_dio_get_block,
 +					   NULL, NULL,
 +					   unlocked ? 0 : DIO_LOCKING);
 +	}
 +	if (unlocked)
 +		inode_dio_end(inode);
  	return ret;
  }
  
@@@ -3554,10 -3455,10 +3554,10 @@@ static ssize_t ext4_direct_IO(struct ki
  		return 0;
  
  	trace_ext4_direct_IO_enter(inode, offset, count, iov_iter_rw(iter));
 -	if (ext4_test_inode_flag(inode, EXT4_INODE_EXTENTS))
 -		ret = ext4_ext_direct_IO(iocb, iter);
 +	if (iov_iter_rw(iter) == READ)
- 		ret = ext4_direct_IO_read(iocb, iter, offset);
++		ret = ext4_direct_IO_read(iocb, iter);
  	else
- 		ret = ext4_direct_IO_write(iocb, iter, offset);
 -		ret = ext4_ind_direct_IO(iocb, iter);
++		ret = ext4_direct_IO_write(iocb, iter);
  	trace_ext4_direct_IO_exit(inode, offset, count, iov_iter_rw(iter), ret);
  	return ret;
  }

             reply	other threads:[~2016-05-17  0:24 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-17  0:23 Stephen Rothwell [this message]
2016-05-17  3:16 ` linux-next: manual merge of the vfs tree with the ext4 tree Theodore Ts'o
2016-05-18 14:25 ` Arnd Bergmann
2016-05-19  1:26   ` Stephen Rothwell
  -- strict thread matches above, loose matches on Subject: below --
2020-01-27 22:51 Stephen Rothwell
2015-06-09  2:47 Stephen Rothwell
2015-05-11  0:49 Stephen Rothwell
2015-04-15  1:35 Stephen Rothwell
2015-04-14  1:30 Stephen Rothwell
2015-04-14  1:48 ` Al Viro
2015-04-14 17:00   ` Theodore Ts'o
2015-04-14 17:17     ` Al Viro
2015-04-14 21:02       ` Theodore Ts'o
2015-04-14 21:14         ` Al Viro
2015-04-13  1:48 Stephen Rothwell
2015-04-13  1:43 Stephen Rothwell
2015-04-07  4:00 Stephen Rothwell
2015-04-07  7:02 ` Christoph Hellwig
2015-04-07  7:36   ` Stephen Rothwell
2015-04-08  3:26   ` Theodore Ts'o
2015-04-14 16:18     ` Christoph Hellwig
2015-04-14 20:43       ` Theodore Ts'o
2014-05-27  2:07 Stephen Rothwell
2014-04-22  1:13 Stephen Rothwell
2012-01-06  2:54 Stephen Rothwell
2012-01-06 20:46 ` Djalal Harouni
2011-12-21  0:18 Stephen Rothwell
2011-12-21  0:43 ` Stephen Rothwell
2011-07-18  3:36 Stephen Rothwell
2011-07-25  2:38 ` Stephen Rothwell
2009-05-19  4:23 Stephen Rothwell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160517102355.4be4af45@canb.auug.org.au \
    --to=sfr@canb.auug.org.au \
    --cc=hch@lst.de \
    --cc=jack@suse.cz \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-next@vger.kernel.org \
    --cc=tytso@mit.edu \
    --cc=viro@ZenIV.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.