linux-next.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* linux-next: manual merge of the vfs tree with the xfs tree
@ 2010-07-05  0:02 Stephen Rothwell
  2010-07-07  1:48 ` Christoph Hellwig
  2010-08-04  1:54 ` Stephen Rothwell
  0 siblings, 2 replies; 20+ messages in thread
From: Stephen Rothwell @ 2010-07-05  0:02 UTC (permalink / raw)
  To: Al Viro
  Cc: linux-next, linux-kernel, Christoph Hellwig, David Chinner, xfs-masters

Hi Al,

Today's linux-next merge of the vfs tree got a conflict in
fs/xfs/linux-2.6/xfs_super.c between commit
04d2da9c682ce2687db29136c60d8679e37e3b35 ("xfs: split xfs_itrace_entry")
from the xfs tree and commit b43cb885cc49c782dd0734292d3cd95631200e5c
("convert remaining ->clear_inode() to ->evict_inode()") from the vfs
tree.

Just context changes.  I fixed it up (see below) and can carry the fix as
necessary.  I guess that the tracing code needs updating for the
xfs_fs_clear_inode -> xfs_fs_evict_inode name change as well.  And I am
wondering if the tracing wants to go ahead of the truncate_inode_pages()
call?

In anticipation, I have added this merge fix patch as well:

From: Stephen Rothwell <sfr@canb.auug.org.au>
Date: Mon, 5 Jul 2010 09:43:42 +1000
Subject: [PATCH] xfs: update tracing for clear_inode to evit_inode transition

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
---
 fs/xfs/linux-2.6/xfs_super.c |    4 ++--
 fs/xfs/linux-2.6/xfs_trace.h |    2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/fs/xfs/linux-2.6/xfs_super.c b/fs/xfs/linux-2.6/xfs_super.c
index 157aaed..3e5052c 100644
--- a/fs/xfs/linux-2.6/xfs_super.c
+++ b/fs/xfs/linux-2.6/xfs_super.c
@@ -1107,10 +1107,10 @@ xfs_fs_evict_inode(
 {
 	xfs_inode_t		*ip = XFS_I(inode);
 
+	trace_xfs_evict_inode(ip);
+
 	truncate_inode_pages(&inode->i_data, 0);
 	end_writeback(inode);
-	trace_xfs_clear_inode(ip);
-
 	XFS_STATS_INC(vn_rele);
 	XFS_STATS_INC(vn_remove);
 	XFS_STATS_DEC(vn_active);
diff --git a/fs/xfs/linux-2.6/xfs_trace.h b/fs/xfs/linux-2.6/xfs_trace.h
index d506753..76de133 100644
--- a/fs/xfs/linux-2.6/xfs_trace.h
+++ b/fs/xfs/linux-2.6/xfs_trace.h
@@ -576,7 +576,7 @@ DEFINE_INODE_EVENT(xfs_ioctl_setattr);
 DEFINE_INODE_EVENT(xfs_file_fsync);
 DEFINE_INODE_EVENT(xfs_destroy_inode);
 DEFINE_INODE_EVENT(xfs_write_inode);
-DEFINE_INODE_EVENT(xfs_clear_inode);
+DEFINE_INODE_EVENT(xfs_evict_inode);
 
 DEFINE_INODE_EVENT(xfs_dquot_dqalloc);
 DEFINE_INODE_EVENT(xfs_dquot_dqdetach);
-- 
1.7.1

-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au

diff --cc fs/xfs/linux-2.6/xfs_super.c
index e3de46c,1dc602f..0000000
--- a/fs/xfs/linux-2.6/xfs_super.c
+++ b/fs/xfs/linux-2.6/xfs_super.c
@@@ -1107,8 -1156,9 +1107,10 @@@ xfs_fs_evict_inode
  {
  	xfs_inode_t		*ip = XFS_I(inode);
  
+ 	truncate_inode_pages(&inode->i_data, 0);
+ 	end_writeback(inode);
 -	xfs_itrace_entry(ip);
 +	trace_xfs_clear_inode(ip);
 +
  	XFS_STATS_INC(vn_rele);
  	XFS_STATS_INC(vn_remove);
  	XFS_STATS_DEC(vn_active);

^ permalink raw reply related	[flat|nested] 20+ messages in thread
* linux-next: manual merge of the vfs tree with the xfs tree
@ 2010-07-26  1:51 Stephen Rothwell
  2010-07-26  3:59 ` Dave Chinner
  0 siblings, 1 reply; 20+ messages in thread
From: Stephen Rothwell @ 2010-07-26  1:51 UTC (permalink / raw)
  To: Al Viro
  Cc: linux-next, linux-kernel, Christoph Hellwig, David Chinner, xfs-masters

Hi Al,

[These became irrelevant when I reverted the xfs tree for a build error,
but will be done when the xfs tree is fixed.]

Today's linux-next merge of the vfs tree got a conflict in
fs/xfs/linux-2.6/xfs_aops.c between commit
7346e1197eb76e22199b6b4625f129331e0fd7ac ("xfs simplify and speed up
direct I/O completions") from the xfs tree and commit
b682ce06449c35a85dc5e63fcaab7dba2ba6df9b ("sort out blockdev_direct_IO
variants") from the vfs tree.

Also between commit 6f6b39eb706f5617750cf02952e4e6d7470c40bf ("xfs: use
GFP_NOFS for page cache allocation") from the xfs tree and commit
4478b21470275454f9eb6f590dfe7cc54d643978 ("get rid of
block_write_begin_newtrunc") from the vfs tree.

I fixed them up (I think - see below) and can carry the fix as necessary.
-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au

diff --cc fs/xfs/linux-2.6/xfs_aops.c
index d24e78f,77a9ecc..0000000
--- a/fs/xfs/linux-2.6/xfs_aops.c
+++ b/fs/xfs/linux-2.6/xfs_aops.c
@@@ -1471,26 -1655,22 +1471,26 @@@ xfs_vm_direct_IO
  	loff_t			offset,
  	unsigned long		nr_segs)
  {
 -	struct file	*file = iocb->ki_filp;
 -	struct inode	*inode = file->f_mapping->host;
 -	struct block_device *bdev;
 -	ssize_t		ret;
 -
 -	bdev = xfs_find_bdev_for_inode(inode);
 -
 -	iocb->private = xfs_alloc_ioend(inode, rw == WRITE ?
 -					IO_UNWRITTEN : IO_READ);
 -
 -	ret = __blockdev_direct_IO(rw, iocb, inode, bdev, iov, offset,
 -				   nr_segs, xfs_get_blocks_direct,
 -				   xfs_end_io_direct, NULL, 0);
 +	struct inode		*inode = iocb->ki_filp->f_mapping->host;
 +	struct block_device	*bdev = xfs_find_bdev_for_inode(inode);
 +	ssize_t			ret;
 +
 +	if (rw & WRITE) {
 +		iocb->private = xfs_alloc_ioend(inode, IO_NEW);
 +
- 		ret = blockdev_direct_IO_no_locking(rw, iocb, inode, bdev, iov,
- 						    offset, nr_segs,
- 						    xfs_get_blocks_direct,
- 						    xfs_end_io_direct_write);
++		ret = __blockdev_direct_IO(rw, iocb, inode, bdev, iov,
++					   offset, nr_segs,
++					   xfs_get_blocks_direct,
++					   xfs_end_io_direct_write, NULL, 0);
 +		if (ret != -EIOCBQUEUED && iocb->private)
 +			xfs_destroy_ioend(iocb->private);
 +	} else {
- 		ret = blockdev_direct_IO_no_locking(rw, iocb, inode, bdev, iov,
- 						    offset, nr_segs,
- 						    xfs_get_blocks_direct,
- 						    NULL);
++		ret = __blockdev_direct_IO(rw, iocb, inode, bdev, iov,
++					   offset, nr_segs,
++					   xfs_get_blocks_direct,
++					   NULL, NULL, 0);
 +	}
  
 -	if (unlikely(ret != -EIOCBQUEUED && iocb->private))
 -		xfs_destroy_ioend(iocb->private);
  	return ret;
  }
  
@@@ -1504,9 -1700,31 +1520,31 @@@ xfs_vm_write_begin
  	struct page		**pagep,
  	void			**fsdata)
  {
- 	*pagep = NULL;
- 	return block_write_begin(file, mapping, pos, len, flags | AOP_FLAG_NOFS,
- 				 pagep, fsdata, xfs_get_blocks);
+ 	int			ret;
+ 
 -	ret = block_write_begin(mapping, pos, len, flags, pagep,
++	ret = block_write_begin(mapping, pos, len, flags | AOP_FLAG_NOFS, pagep,
+ 				xfs_get_blocks);
+ 	if (unlikely(ret))
+ 		xfs_vm_write_failed(mapping, pos + len);
+ 	return ret;
+ }
+ 
+ STATIC int
+ xfs_vm_write_end(
+ 	struct file		*file,
+ 	struct address_space	*mapping,
+ 	loff_t			pos,
+ 	unsigned		len,
+ 	unsigned		copied,
+ 	struct page		*page,
+ 	void			*fsdata)
+ {
+ 	int			ret;
+ 
+ 	ret = generic_write_end(file, mapping, pos, len, copied, page, fsdata);
+ 	if (unlikely(ret < len))
+ 		xfs_vm_write_failed(mapping, pos + len);
+ 	return ret;
  }
  
  STATIC sector_t

^ permalink raw reply	[flat|nested] 20+ messages in thread
* linux-next: manual merge of the vfs tree with the xfs tree
@ 2011-07-18  3:36 Stephen Rothwell
  2011-07-19  1:29 ` Dave Chinner
  0 siblings, 1 reply; 20+ messages in thread
From: Stephen Rothwell @ 2011-07-18  3:36 UTC (permalink / raw)
  To: Al Viro; +Cc: linux-next, linux-kernel, Dave Chinner, Christoph Hellwig

Hi Al,

Today's linux-next merge of the vfs tree got a conflict in
fs/xfs/linux-2.6/xfs_super.c between commit 2bcf6e970f5a ("xfs: start
periodic workers later") from the xfs tree and commit d86b98f73104 ("xfs:
make use of new shrinker callout for the inode cache") from the vfs tree.

I fixed it up (I think, see below) and can carry the fix as necessary.
-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au

diff --cc fs/xfs/linux-2.6/xfs_super.c
index 25fd2cd,a9c6ccf..0000000
--- a/fs/xfs/linux-2.6/xfs_super.c
+++ b/fs/xfs/linux-2.6/xfs_super.c
@@@ -1411,9 -1407,7 +1406,7 @@@ xfs_fs_fill_super
  	sb->s_time_gran = 1;
  	set_posix_acl_flag(sb);
  
- 	xfs_inode_shrinker_register(mp);
- 
 -	error = xfs_syncd_init(mp);
 +	error = xfs_mountfs(mp);
  	if (error)
  		goto out_filestream_unmount;
  
@@@ -1438,8 -1432,9 +1431,7 @@@
  
  	return 0;
  
 - out_syncd_stop:
 -	xfs_syncd_stop(mp);
   out_filestream_unmount:
- 	xfs_inode_shrinker_unregister(mp);
  	xfs_filestream_unmount(mp);
   out_free_sb:
  	xfs_freesb(mp);
@@@ -1453,12 -1448,16 +1445,11 @@@
   out:
  	return -error;
  
 - fail_vnrele:
 -	if (sb->s_root) {
 -		dput(sb->s_root);
 -		sb->s_root = NULL;
 -	} else {
 -		iput(root);
 -	}
 -
 - fail_unmount:
 + out_iput:
 +	iput(root);
 + out_syncd_stop:
  	xfs_syncd_stop(mp);
 + out_unmount:
- 	xfs_inode_shrinker_unregister(mp);
  
  	/*
  	 * Blow away any referenced inode in the filestreams cache.

^ permalink raw reply	[flat|nested] 20+ messages in thread
* linux-next: manual merge of the vfs tree with the xfs tree
@ 2015-04-13  1:57 Stephen Rothwell
  2015-04-13  2:12 ` Dave Chinner
  0 siblings, 1 reply; 20+ messages in thread
From: Stephen Rothwell @ 2015-04-13  1:57 UTC (permalink / raw)
  To: Al Viro, Ben Myers, David Chinner, xfs
  Cc: linux-next, linux-kernel, David Howells

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

Hi Al,

Today's linux-next merge of the vfs tree got a conflict in
fs/xfs/xfs_iops.c between commit e8e9ad42c1f1 ("xfs: take i_mmap_lock
on extent manipulation operations") from the xfs tree and commit
5dd3dc06371a ("VFS: normal filesystems (and lustre): d_inode()
annotations") from the vfs tree.

I fixed it up (see below) and can carry the fix as necessary (no action
is required).

-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au

diff --cc fs/xfs/xfs_iops.c
index 015d6a366b16,54b95232d946..000000000000
--- a/fs/xfs/xfs_iops.c
+++ b/fs/xfs/xfs_iops.c
@@@ -953,13 -975,9 +953,13 @@@ xfs_vn_setattr
  		uint		iolock = XFS_IOLOCK_EXCL;
  
  		xfs_ilock(ip, iolock);
- 		error = xfs_break_layouts(dentry->d_inode, &iolock);
+ 		error = xfs_break_layouts(d_inode(dentry), &iolock);
 -		if (!error)
 +		if (!error) {
 +			xfs_ilock(ip, XFS_MMAPLOCK_EXCL);
 +			iolock |= XFS_MMAPLOCK_EXCL;
 +
  			error = xfs_setattr_size(ip, iattr);
 +		}
  		xfs_iunlock(ip, iolock);
  	} else {
  		error = xfs_setattr_nonsize(ip, iattr, 0);

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

^ permalink raw reply	[flat|nested] 20+ messages in thread
* linux-next: manual merge of the vfs tree with the xfs tree
@ 2015-04-14  1:34 Stephen Rothwell
  0 siblings, 0 replies; 20+ messages in thread
From: Stephen Rothwell @ 2015-04-14  1:34 UTC (permalink / raw)
  To: Al Viro, Ben Myers, David Chinner, xfs
  Cc: linux-next, linux-kernel, Christoph Hellwig, David Howells

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

Hi Al,

Today's linux-next merge of the vfs tree got a conflict in
fs/xfs/xfs_iops.c between commit 21c3ea18819b ("xfs: unlock i_mutex in
xfs_break_layouts") from the xfs tree and commit 5dd3dc06371a ("VFS:
normal filesystems (and lustre): d_inode() annotations") from the vfs
tree.

I fixed it up (see below) and can carry the fix as necessary (no action
is required).

-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au

diff --cc fs/xfs/xfs_iops.c
index 2f1839e4dd1b,54b95232d946..000000000000
--- a/fs/xfs/xfs_iops.c
+++ b/fs/xfs/xfs_iops.c
@@@ -953,13 -975,9 +953,13 @@@ xfs_vn_setattr
  		uint		iolock = XFS_IOLOCK_EXCL;
  
  		xfs_ilock(ip, iolock);
- 		error = xfs_break_layouts(dentry->d_inode, &iolock, true);
 -		error = xfs_break_layouts(d_inode(dentry), &iolock);
 -		if (!error)
++		error = xfs_break_layouts(d_inode(dentry), &iolock, true);
 +		if (!error) {
 +			xfs_ilock(ip, XFS_MMAPLOCK_EXCL);
 +			iolock |= XFS_MMAPLOCK_EXCL;
 +
  			error = xfs_setattr_size(ip, iattr);
 +		}
  		xfs_iunlock(ip, iolock);
  	} else {
  		error = xfs_setattr_nonsize(ip, iattr, 0);

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

^ permalink raw reply	[flat|nested] 20+ messages in thread
* linux-next: manual merge of the vfs tree with the xfs tree
@ 2015-11-10 23:21 Stephen Rothwell
  0 siblings, 0 replies; 20+ messages in thread
From: Stephen Rothwell @ 2015-11-10 23:21 UTC (permalink / raw)
  To: Al Viro, Ben Myers, David Chinner, xfs
  Cc: Brian Foster, linux-next, linux-kernel, Andreas Gruenbacher

Hi Al,

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

  fs/xfs/xfs_xattr.c

between commit:

  67d8e04e345e ("xfs: invalidate cached acl if set directly via xattr")

from the xfs tree and commit:

  64669c648bc0 ("xattr handlers: Pass handler to operations instead of flags")

from the vfs tree.

I fixed it up (see below) and can carry the fix as necessary (no action
is required).

-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au

diff --cc fs/xfs/xfs_xattr.c
index 8294f86441bf,b1850e1489ef..000000000000
--- a/fs/xfs/xfs_xattr.c
+++ b/fs/xfs/xfs_xattr.c
@@@ -53,34 -54,12 +54,35 @@@ xfs_xattr_get(const struct xattr_handle
  	return asize;
  }
  
 +void
 +xfs_forget_acl(
 +	struct inode		*inode,
 +	const char		*name,
 +	int			xflags)
 +{
 +	/*
 +	 * Invalidate any cached ACLs if the user has bypassed the ACL
 +	 * interface. We don't validate the content whatsoever so it is caller
 +	 * responsibility to provide data in valid format and ensure i_mode is
 +	 * consistent.
 +	 */
 +	if (xflags & ATTR_ROOT) {
 +#ifdef CONFIG_XFS_POSIX_ACL
 +		if (!strcmp(name, SGI_ACL_FILE))
 +			forget_cached_acl(inode, ACL_TYPE_ACCESS);
 +		else if (!strcmp(name, SGI_ACL_DEFAULT))
 +			forget_cached_acl(inode, ACL_TYPE_DEFAULT);
 +#endif
 +	}
 +}
 +
  static int
- xfs_xattr_set(struct dentry *dentry, const char *name, const void *value,
- 		size_t size, int flags, int xflags)
+ xfs_xattr_set(const struct xattr_handler *handler, struct dentry *dentry,
+ 		const char *name, const void *value, size_t size, int flags)
  {
 -	int xflags = handler->flags;
 -	struct xfs_inode *ip = XFS_I(d_inode(dentry));
 +	struct xfs_inode	*ip = XFS_I(d_inode(dentry));
 +	int			error;
++	int			xflags = handler->flags;
  
  	if (strcmp(name, "") == 0)
  		return -EINVAL;

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 20+ messages in thread
* linux-next: manual merge of the vfs tree with the xfs tree
@ 2016-12-11 23:19 Stephen Rothwell
  0 siblings, 0 replies; 20+ messages in thread
From: Stephen Rothwell @ 2016-12-11 23:19 UTC (permalink / raw)
  To: Al Viro, David Chinner, linux-xfs
  Cc: linux-next, linux-kernel, Darrick J. Wong

Hi Al,

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

  fs/xfs/xfs_reflink.c

between commit:

  fba3e594ef0a ("xfs: always succeed when deduping zero bytes")

from the xfs tree and commit:

  876bec6f9bbf ("vfs: refactor clone/dedupe_file_range common functions")

from the vfs tree.

I fixed it up (the latter removed some code updated by the former and
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/xfs/xfs_reflink.c
index 88fd03c66e99,95d6828967f0..000000000000
--- a/fs/xfs/xfs_reflink.c
+++ b/fs/xfs/xfs_reflink.c
@@@ -1251,32 -1194,16 +1143,14 @@@ xfs_reflink_remap_range
  		return -EIO;
  
  	/* Lock both files against IO */
 -	if (same_inode) {
 -		xfs_ilock(src, XFS_IOLOCK_EXCL);
 +	lock_two_nondirectories(inode_in, inode_out);
 +	if (same_inode)
  		xfs_ilock(src, XFS_MMAPLOCK_EXCL);
 -	} else {
 -		xfs_lock_two_inodes(src, dest, XFS_IOLOCK_EXCL);
 +	else
  		xfs_lock_two_inodes(src, dest, XFS_MMAPLOCK_EXCL);
 -	}
  
- 	/* Don't touch certain kinds of inodes */
- 	ret = -EPERM;
- 	if (IS_IMMUTABLE(inode_out))
- 		goto out_unlock;
- 
- 	ret = -ETXTBSY;
- 	if (IS_SWAPFILE(inode_in) || IS_SWAPFILE(inode_out))
- 		goto out_unlock;
- 
- 
- 	/* Don't reflink dirs, pipes, sockets... */
- 	ret = -EISDIR;
- 	if (S_ISDIR(inode_in->i_mode) || S_ISDIR(inode_out->i_mode))
- 		goto out_unlock;
+ 	/* Check file eligibility and prepare for block sharing. */
  	ret = -EINVAL;
- 	if (S_ISFIFO(inode_in->i_mode) || S_ISFIFO(inode_out->i_mode))
- 		goto out_unlock;
- 	if (!S_ISREG(inode_in->i_mode) || !S_ISREG(inode_out->i_mode))
- 		goto out_unlock;
- 
  	/* Don't reflink realtime inodes */
  	if (XFS_IS_REALTIME_INODE(src) || XFS_IS_REALTIME_INODE(dest))
  		goto out_unlock;

^ permalink raw reply	[flat|nested] 20+ messages in thread
* linux-next: manual merge of the vfs tree with the xfs tree
@ 2018-10-31  0:52 Stephen Rothwell
  2018-10-31  1:12 ` Dave Chinner
  0 siblings, 1 reply; 20+ messages in thread
From: Stephen Rothwell @ 2018-10-31  0:52 UTC (permalink / raw)
  To: Al Viro, Darrick J. Wong, David Chinner, linux-xfs
  Cc: Linux-Next Mailing List, Linux Kernel Mailing List, Mark Fasheh

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

Hi all,

[I don't understand why all this new work turned up in the xfs tree
during the merge window ...]

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

  fs/read_write.c

between commits:

  42ec3d4c0218 ("vfs: make remap_file_range functions take and return bytes completed")
  eca3654e3cc7 ("vfs: enable remap callers that can handle short operations")

from the xfs tree and commit:

  5de4480ae7f8 ("vfs: allow dedupe of user owned read-only files")

from the vfs 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/read_write.c
index 50680b900b52,10f9bed985f4..000000000000
--- a/fs/read_write.c
+++ b/fs/read_write.c
@@@ -2014,14 -1880,120 +2013,28 @@@ loff_t vfs_clone_file_range(struct fil
  }
  EXPORT_SYMBOL(vfs_clone_file_range);
  
 -/*
 - * Read a page's worth of file data into the page cache.  Return the page
 - * locked.
 - */
 -static struct page *vfs_dedupe_get_page(struct inode *inode, loff_t offset)
 -{
 -	struct address_space *mapping;
 -	struct page *page;
 -	pgoff_t n;
 -
 -	n = offset >> PAGE_SHIFT;
 -	mapping = inode->i_mapping;
 -	page = read_mapping_page(mapping, n, NULL);
 -	if (IS_ERR(page))
 -		return page;
 -	if (!PageUptodate(page)) {
 -		put_page(page);
 -		return ERR_PTR(-EIO);
 -	}
 -	lock_page(page);
 -	return page;
 -}
 -
 -/*
 - * Compare extents of two files to see if they are the same.
 - * Caller must have locked both inodes to prevent write races.
 - */
 -int vfs_dedupe_file_range_compare(struct inode *src, loff_t srcoff,
 -				  struct inode *dest, loff_t destoff,
 -				  loff_t len, bool *is_same)
 -{
 -	loff_t src_poff;
 -	loff_t dest_poff;
 -	void *src_addr;
 -	void *dest_addr;
 -	struct page *src_page;
 -	struct page *dest_page;
 -	loff_t cmp_len;
 -	bool same;
 -	int error;
 -
 -	error = -EINVAL;
 -	same = true;
 -	while (len) {
 -		src_poff = srcoff & (PAGE_SIZE - 1);
 -		dest_poff = destoff & (PAGE_SIZE - 1);
 -		cmp_len = min(PAGE_SIZE - src_poff,
 -			      PAGE_SIZE - dest_poff);
 -		cmp_len = min(cmp_len, len);
 -		if (cmp_len <= 0)
 -			goto out_error;
 -
 -		src_page = vfs_dedupe_get_page(src, srcoff);
 -		if (IS_ERR(src_page)) {
 -			error = PTR_ERR(src_page);
 -			goto out_error;
 -		}
 -		dest_page = vfs_dedupe_get_page(dest, destoff);
 -		if (IS_ERR(dest_page)) {
 -			error = PTR_ERR(dest_page);
 -			unlock_page(src_page);
 -			put_page(src_page);
 -			goto out_error;
 -		}
 -		src_addr = kmap_atomic(src_page);
 -		dest_addr = kmap_atomic(dest_page);
 -
 -		flush_dcache_page(src_page);
 -		flush_dcache_page(dest_page);
 -
 -		if (memcmp(src_addr + src_poff, dest_addr + dest_poff, cmp_len))
 -			same = false;
 -
 -		kunmap_atomic(dest_addr);
 -		kunmap_atomic(src_addr);
 -		unlock_page(dest_page);
 -		unlock_page(src_page);
 -		put_page(dest_page);
 -		put_page(src_page);
 -
 -		if (!same)
 -			break;
 -
 -		srcoff += cmp_len;
 -		destoff += cmp_len;
 -		len -= cmp_len;
 -	}
 -
 -	*is_same = same;
 -	return 0;
 -
 -out_error:
 -	return error;
 -}
 -EXPORT_SYMBOL(vfs_dedupe_file_range_compare);
 -
+ /* Check whether we are allowed to dedupe the destination file */
+ static bool allow_file_dedupe(struct file *file)
+ {
+ 	if (capable(CAP_SYS_ADMIN))
+ 		return true;
+ 	if (file->f_mode & FMODE_WRITE)
+ 		return true;
+ 	if (uid_eq(current_fsuid(), file_inode(file)->i_uid))
+ 		return true;
+ 	if (!inode_permission(file_inode(file), MAY_WRITE))
+ 		return true;
+ 	return false;
+ }
+ 
 -int vfs_dedupe_file_range_one(struct file *src_file, loff_t src_pos,
 -			      struct file *dst_file, loff_t dst_pos, u64 len)
 +loff_t vfs_dedupe_file_range_one(struct file *src_file, loff_t src_pos,
 +				 struct file *dst_file, loff_t dst_pos,
 +				 loff_t len, unsigned int remap_flags)
  {
 -	s64 ret;
 +	loff_t ret;
 +
 +	WARN_ON_ONCE(remap_flags & ~(REMAP_FILE_DEDUP |
 +				     REMAP_FILE_CAN_SHORTEN));
  
  	ret = mnt_want_write_file(dst_file);
  	if (ret)

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

^ permalink raw reply	[flat|nested] 20+ messages in thread
* linux-next: manual merge of the vfs tree with the xfs tree
@ 2021-04-12  2:22 Stephen Rothwell
  2021-04-13 15:20 ` Darrick J. Wong
  0 siblings, 1 reply; 20+ messages in thread
From: Stephen Rothwell @ 2021-04-12  2:22 UTC (permalink / raw)
  To: Al Viro, Darrick J. Wong, David Chinner, linux-xfs
  Cc: Christoph Hellwig, Linux Kernel Mailing List,
	Linux Next Mailing List, Miklos Szeredi

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

Hi all,

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

  fs/xfs/xfs_ioctl.c

between commits:

  ceaf603c7024 ("xfs: move the di_projid field to struct xfs_inode")
  031474c28a3a ("xfs: move the di_extsize field to struct xfs_inode")
  b33ce57d3e61 ("xfs: move the di_cowextsize field to struct xfs_inode")
  4800887b4574 ("xfs: cleanup xfs_fill_fsxattr")
  ee7b83fd365e ("xfs: use a union for i_cowextsize and i_flushiter")
  db07349da2f5 ("xfs: move the di_flags field to struct xfs_inode")
  3e09ab8fdc4d ("xfs: move the di_flags2 field to struct xfs_inode")

from the xfs tree and commit:

  280cad4ac884 ("xfs: convert to fileattr")

from the vfs tree.

I fixed it up (I think - 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/xfs/xfs_ioctl.c
index 708b77341a70,bbda105a2ce5..000000000000
--- a/fs/xfs/xfs_ioctl.c
+++ b/fs/xfs/xfs_ioctl.c
@@@ -1056,76 -1057,16 +1057,18 @@@ xfs_ioc_ag_geometry
  static void
  xfs_fill_fsxattr(
  	struct xfs_inode	*ip,
- 	bool			attr,
- 	struct fsxattr		*fa)
+ 	int			whichfork,
+ 	struct fileattr		*fa)
  {
 +	struct xfs_mount	*mp = ip->i_mount;
- 	struct xfs_ifork	*ifp = attr ? ip->i_afp : &ip->i_df;
+ 	struct xfs_ifork	*ifp = XFS_IFORK_PTR(ip, whichfork);
  
- 	simple_fill_fsxattr(fa, xfs_ip2xflags(ip));
+ 	fileattr_fill_xflags(fa, xfs_ip2xflags(ip));
 -	fa->fsx_extsize = ip->i_d.di_extsize << ip->i_mount->m_sb.sb_blocklog;
 -	fa->fsx_cowextsize = ip->i_d.di_cowextsize <<
 -			ip->i_mount->m_sb.sb_blocklog;
 -	fa->fsx_projid = ip->i_d.di_projid;
 +
 +	fa->fsx_extsize = XFS_FSB_TO_B(mp, ip->i_extsize);
 +	if (ip->i_diflags2 & XFS_DIFLAG2_COWEXTSIZE)
 +		fa->fsx_cowextsize = XFS_FSB_TO_B(mp, ip->i_cowextsize);
 +	fa->fsx_projid = ip->i_projid;
  	if (ifp && (ifp->if_flags & XFS_IFEXTENTS))
  		fa->fsx_nextents = xfs_iext_count(ifp);
  	else
@@@ -1212,10 -1167,10 +1169,10 @@@ static in
  xfs_ioctl_setattr_xflags(
  	struct xfs_trans	*tp,
  	struct xfs_inode	*ip,
- 	struct fsxattr		*fa)
+ 	struct fileattr		*fa)
  {
  	struct xfs_mount	*mp = ip->i_mount;
 -	uint64_t		di_flags2;
 +	uint64_t		i_flags2;
  
  	/* Can't change realtime flag if any extents are allocated. */
  	if ((ip->i_df.if_nextents || ip->i_delayed_blks) &&
@@@ -1348,8 -1289,11 +1291,11 @@@ xfs_ioctl_setattr_check_extsize
  	xfs_extlen_t		size;
  	xfs_fsblock_t		extsize_fsb;
  
+ 	if (!fa->fsx_valid)
+ 		return 0;
+ 
  	if (S_ISREG(VFS_I(ip)->i_mode) && ip->i_df.if_nextents &&
 -	    ((ip->i_d.di_extsize << mp->m_sb.sb_blocklog) != fa->fsx_extsize))
 +	    ((ip->i_extsize << mp->m_sb.sb_blocklog) != fa->fsx_extsize))
  		return -EINVAL;
  
  	if (fa->fsx_extsize == 0)
@@@ -1520,18 -1476,18 +1478,19 @@@ xfs_fileattr_set
  	 * extent size hint should be set on the inode. If no extent size flags
  	 * are set on the inode then unconditionally clear the extent size hint.
  	 */
 -	if (ip->i_d.di_flags & (XFS_DIFLAG_EXTSIZE | XFS_DIFLAG_EXTSZINHERIT))
 -		ip->i_d.di_extsize = fa->fsx_extsize >> mp->m_sb.sb_blocklog;
 -	else
 -		ip->i_d.di_extsize = 0;
 -	if (xfs_sb_version_has_v3inode(&mp->m_sb) &&
 -	    (ip->i_d.di_flags2 & XFS_DIFLAG2_COWEXTSIZE))
 -		ip->i_d.di_cowextsize = fa->fsx_cowextsize >>
 -				mp->m_sb.sb_blocklog;
 +	if (ip->i_diflags & (XFS_DIFLAG_EXTSIZE | XFS_DIFLAG_EXTSZINHERIT))
 +		ip->i_extsize = XFS_B_TO_FSB(mp, fa->fsx_extsize);
  	else
 -		ip->i_d.di_cowextsize = 0;
 +		ip->i_extsize = 0;
 +
 +	if (xfs_sb_version_has_v3inode(&mp->m_sb)) {
 +		if (ip->i_diflags2 & XFS_DIFLAG2_COWEXTSIZE)
 +			ip->i_cowextsize = XFS_B_TO_FSB(mp, fa->fsx_cowextsize);
 +		else
 +			ip->i_cowextsize = 0;
 +	}
  
+ skip_xattr:
  	error = xfs_trans_commit(tp);
  
  	/*

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

^ permalink raw reply	[flat|nested] 20+ messages in thread
* linux-next: manual merge of the vfs tree with the xfs tree
@ 2021-04-19  0:49 Stephen Rothwell
  2021-04-20 16:40 ` Darrick J. Wong
  0 siblings, 1 reply; 20+ messages in thread
From: Stephen Rothwell @ 2021-04-19  0:49 UTC (permalink / raw)
  To: Al Viro, Darrick J. Wong, David Chinner, linux-xfs
  Cc: Christoph Hellwig, Linux Kernel Mailing List,
	Linux Next Mailing List, Miklos Szeredi

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

Hi all,

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

  fs/xfs/xfs_ioctl.c

between commit:

  b2197a36c0ef ("xfs: remove XFS_IFEXTENTS")

from the xfs tree and commit:

  9fefd5db08ce ("xfs: convert to fileattr")

from the vfs 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/xfs/xfs_ioctl.c
index bf490bfae6cb,bbda105a2ce5..000000000000
--- a/fs/xfs/xfs_ioctl.c
+++ b/fs/xfs/xfs_ioctl.c
@@@ -1056,77 -1057,17 +1057,19 @@@ xfs_ioc_ag_geometry
  static void
  xfs_fill_fsxattr(
  	struct xfs_inode	*ip,
- 	bool			attr,
- 	struct fsxattr		*fa)
+ 	int			whichfork,
+ 	struct fileattr		*fa)
  {
 +	struct xfs_mount	*mp = ip->i_mount;
- 	struct xfs_ifork	*ifp = attr ? ip->i_afp : &ip->i_df;
+ 	struct xfs_ifork	*ifp = XFS_IFORK_PTR(ip, whichfork);
  
- 	simple_fill_fsxattr(fa, xfs_ip2xflags(ip));
+ 	fileattr_fill_xflags(fa, xfs_ip2xflags(ip));
 -	fa->fsx_extsize = ip->i_d.di_extsize << ip->i_mount->m_sb.sb_blocklog;
 -	fa->fsx_cowextsize = ip->i_d.di_cowextsize <<
 -			ip->i_mount->m_sb.sb_blocklog;
 -	fa->fsx_projid = ip->i_d.di_projid;
 -	if (ifp && (ifp->if_flags & XFS_IFEXTENTS))
 +
 +	fa->fsx_extsize = XFS_FSB_TO_B(mp, ip->i_extsize);
 +	if (ip->i_diflags2 & XFS_DIFLAG2_COWEXTSIZE)
 +		fa->fsx_cowextsize = XFS_FSB_TO_B(mp, ip->i_cowextsize);
 +	fa->fsx_projid = ip->i_projid;
 +	if (ifp && !xfs_need_iread_extents(ifp))
  		fa->fsx_nextents = xfs_iext_count(ifp);
  	else
  		fa->fsx_nextents = xfs_ifork_nextents(ifp);
@@@ -1212,10 -1167,10 +1169,10 @@@ static in
  xfs_ioctl_setattr_xflags(
  	struct xfs_trans	*tp,
  	struct xfs_inode	*ip,
- 	struct fsxattr		*fa)
+ 	struct fileattr		*fa)
  {
  	struct xfs_mount	*mp = ip->i_mount;
 -	uint64_t		di_flags2;
 +	uint64_t		i_flags2;
  
  	/* Can't change realtime flag if any extents are allocated. */
  	if ((ip->i_df.if_nextents || ip->i_delayed_blks) &&
@@@ -1348,8 -1289,11 +1291,11 @@@ xfs_ioctl_setattr_check_extsize
  	xfs_extlen_t		size;
  	xfs_fsblock_t		extsize_fsb;
  
+ 	if (!fa->fsx_valid)
+ 		return 0;
+ 
  	if (S_ISREG(VFS_I(ip)->i_mode) && ip->i_df.if_nextents &&
 -	    ((ip->i_d.di_extsize << mp->m_sb.sb_blocklog) != fa->fsx_extsize))
 +	    ((ip->i_extsize << mp->m_sb.sb_blocklog) != fa->fsx_extsize))
  		return -EINVAL;
  
  	if (fa->fsx_extsize == 0)
@@@ -1520,18 -1476,18 +1478,19 @@@ xfs_fileattr_set
  	 * extent size hint should be set on the inode. If no extent size flags
  	 * are set on the inode then unconditionally clear the extent size hint.
  	 */
 -	if (ip->i_d.di_flags & (XFS_DIFLAG_EXTSIZE | XFS_DIFLAG_EXTSZINHERIT))
 -		ip->i_d.di_extsize = fa->fsx_extsize >> mp->m_sb.sb_blocklog;
 -	else
 -		ip->i_d.di_extsize = 0;
 -	if (xfs_sb_version_has_v3inode(&mp->m_sb) &&
 -	    (ip->i_d.di_flags2 & XFS_DIFLAG2_COWEXTSIZE))
 -		ip->i_d.di_cowextsize = fa->fsx_cowextsize >>
 -				mp->m_sb.sb_blocklog;
 +	if (ip->i_diflags & (XFS_DIFLAG_EXTSIZE | XFS_DIFLAG_EXTSZINHERIT))
 +		ip->i_extsize = XFS_B_TO_FSB(mp, fa->fsx_extsize);
  	else
 -		ip->i_d.di_cowextsize = 0;
 +		ip->i_extsize = 0;
 +
 +	if (xfs_sb_version_has_v3inode(&mp->m_sb)) {
 +		if (ip->i_diflags2 & XFS_DIFLAG2_COWEXTSIZE)
 +			ip->i_cowextsize = XFS_B_TO_FSB(mp, fa->fsx_cowextsize);
 +		else
 +			ip->i_cowextsize = 0;
 +	}
  
+ skip_xattr:
  	error = xfs_trans_commit(tp);
  
  	/*

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

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

end of thread, other threads:[~2021-04-20 16:40 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-07-05  0:02 linux-next: manual merge of the vfs tree with the xfs tree Stephen Rothwell
2010-07-07  1:48 ` Christoph Hellwig
2010-07-07  3:50   ` Stephen Rothwell
2010-08-04  1:54 ` Stephen Rothwell
2010-07-26  1:51 Stephen Rothwell
2010-07-26  3:59 ` Dave Chinner
2010-07-26  4:05   ` Stephen Rothwell
2011-07-18  3:36 Stephen Rothwell
2011-07-19  1:29 ` Dave Chinner
2015-04-13  1:57 Stephen Rothwell
2015-04-13  2:12 ` Dave Chinner
2015-04-14  1:34 Stephen Rothwell
2015-11-10 23:21 Stephen Rothwell
2016-12-11 23:19 Stephen Rothwell
2018-10-31  0:52 Stephen Rothwell
2018-10-31  1:12 ` Dave Chinner
2021-04-12  2:22 Stephen Rothwell
2021-04-13 15:20 ` Darrick J. Wong
2021-04-19  0:49 Stephen Rothwell
2021-04-20 16:40 ` Darrick J. Wong

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).