From: Darrick J. Wong <hidden> Date: 2016-08-25 23:30:48
Hi all,
This is the eighth revision of a patchset that adds to XFS kernel
support for mapping multiple file logical blocks to the same physical
block (reflink/deduplication), implements the beginnings of online
metadata scrubbing and preening, and implements reverse mapping for
the realtime device. There shouldn't be any incompatible on-disk
format changes, pending a thorough review of the patches within.
The patches in this series implement generic changes that will be
necessary for XFS' implementation of reflink and dedupe. There are
some small fixes for the new VFS hoists of the dedupe ioctl, as well
as a patch adding the reflink and CoW extent size hints to the file
attr ioctl that ext4 and XFS now share.
The second half of the series are amendments to the iomap
infrastructure that Christoph Hellwig refactored in 4.8. These
changes make it easier to implement CoW and to pass along various
flags through struct iomap.
If you're going to start using this mess, you probably ought to just
pull from my github trees for kernel[1], xfsprogs[2], xfstests[3],
xfs-docs[4], and man-pages[5]. The kernel patches in the git trees
should apply to 4.8-rc3; xfsprogs patches to for-next; and xfstest to
master.
The patches have been xfstested with x64, ppc64, and armhf; all tests
in the clone and rmap groups pass. AFAICT they don't cause any new
failures for the 'auto' group.
This is an extraordinary way to eat your data. Enjoy!
Comments and questions are, as always, welcome.
--D
[1] https://github.com/djwong/linux/tree/djwong-devel
[2] https://github.com/djwong/xfsprogs/tree/djwong-devel
[3] https://github.com/djwong/xfstests/tree/djwong-devel
[4] https://github.com/djwong/xfs-documentation/tree/djwong-devel
[5] https://github.com/djwong/man-pages/tree/djwong-devel
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
From: Darrick J. Wong <hidden> Date: 2016-08-25 23:30:57
All the VFS functions in the dedupe ioctl path return int status, so
the ioctl handler ought to as well.
Found by Coverity, CID 1350952.
Signed-off-by: Darrick J. Wong <redacted>
---
fs/ioctl.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
From: Darrick J. Wong <hidden> Date: 2016-08-25 23:31:03
Kirill A. Shutemov reports that the kernel doesn't try to cap dest_count
in any way, and uses the number to allocate kernel memory. This causes
high order allocation warnings in the kernel log if someone passes in a
big enough value. We should clamp the allocation at PAGE_SIZE to avoid
stressing the VM.
The two existing users of the dedupe ioctl never send more than 120
requests, so we can safely clamp dest_range at PAGE_SIZE, because with
4k pages we can handle up to 127 dedupe candidates. Given the max
extent length of 16MB, we can end up doing 2GB of IO which is plenty.
Reported-by: "Kirill A. Shutemov" <redacted>
Signed-off-by: Darrick J. Wong <redacted>
---
fs/ioctl.c | 4 ++++
1 file changed, 4 insertions(+)
From: Darrick J. Wong <hidden> Date: 2016-08-25 23:31:08
Introduce XFLAGs for the new XFS reflink inode flag and the CoW extent
size hint, and actually plumb the CoW extent size hint into the fsxattr
structure.
Signed-off-by: Darrick J. Wong <redacted>
---
include/uapi/linux/fs.h | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
@@ -157,7 +157,8 @@ struct fsxattr {__u32fsx_extsize;/* extsize field value (get/set)*/__u32fsx_nextents;/* nextents field value (get) */__u32fsx_projid;/* project identifier (get/set) */-unsignedcharfsx_pad[12];+__u32fsx_cowextsize;/* CoW extsize field value (get/set)*/+unsignedcharfsx_pad[8];};/*
@@ -178,6 +179,8 @@ struct fsxattr {#define FS_XFLAG_NODEFRAG 0x00002000 /* do not defragment */#define FS_XFLAG_FILESTREAM 0x00004000 /* use filestream allocator */#define FS_XFLAG_DAX 0x00008000 /* use DAX for IO */+#define FS_XFLAG_REFLINK 0x00010000 /* file is reflinked */+#define FS_XFLAG_COWEXTSIZE 0x00020000 /* CoW extent size allocator hint */#define FS_XFLAG_HASATTR 0x80000000 /* no DIFLAG for this *//* the read-only stuff doesn't really belong here, but any other place is
From: Christoph Hellwig <hch@lst.de> Date: 2016-08-25 23:31:14
Originally-from: Christoph Hellwig [off-list ref]
This function uses the iomap infrastructure to re-write all pages
in a given range. This is useful for doing a copy-up of COW ranges,
and might be useful for scrubbing in the future.
XXX: might want a bigger name, and possible a better implementation
that doesn't require two lookups in the radix tree.
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
fs/iomap.c | 82 +++++++++++++++++++++++++++++++++++++++++++++++++
include/linux/iomap.h | 2 +
2 files changed, 84 insertions(+)
From: Darrick J. Wong <hidden> Date: 2016-08-25 23:31:27
From: Christoph Hellwig <hch@lst.de>
Filesystems like XFS that use extents should not set the
FIEMAP_EXTENT_MERGED flag in the fiemap extent structures. To allow
for both behaviors for the upcoming gfs2 usage split the iomap
type field into type and flags, and only set FIEMAP_EXTENT_MERGED if
the IOMAP_F_MERGED flag is set. The flags field will also come in
handy for future features such as shared extents on reflink-enabled
file systems.
Reported-by: Andreas Gruenbacher <agruenba@redhat.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
fs/iomap.c | 5 ++++-
include/linux/iomap.h | 8 +++++++-
2 files changed, 11 insertions(+), 2 deletions(-)
@@ -19,6 +19,11 @@ struct vm_fault;#define IOMAP_UNWRITTEN 0x04 /* blocks allocated @blkno in unwritten state *//*+*Flagsforiomapmappings:+*/+#define IOMAP_F_MERGED 0x01 /* contains multiple blocks/extents */++/**Magicvalueforblkno:*/#define IOMAP_NULL_BLOCK -1LL /* blkno is not valid */
@@ -27,7 +32,8 @@ struct iomap {sector_tblkno;/* 1st sector of mapping, 512b units */loff_toffset;/* file offset of mapping, bytes */u64length;/* length of mapping, bytes */-inttype;/* type of mapping */+u16type;/* type of mapping */+u16flags;/* flags for mapping */structblock_device*bdev;/* block device for I/O */};
From: Christoph Hellwig <hch@infradead.org> Date: 2016-09-05 14:55:53
This really should go into 4.8 (and the previous patch probably as
well), and I've said that a couple of times, and you tried a few times
to send it to Al at least.
Al, do you want to pick it up or should Darrick send it straight to
Linus?
On Thu, Aug 25, 2016 at 04:30:54PM -0700, Darrick J. Wong wrote:
quoted hunk
Kirill A. Shutemov reports that the kernel doesn't try to cap dest_count
in any way, and uses the number to allocate kernel memory. This causes
high order allocation warnings in the kernel log if someone passes in a
big enough value. We should clamp the allocation at PAGE_SIZE to avoid
stressing the VM.
The two existing users of the dedupe ioctl never send more than 120
requests, so we can safely clamp dest_range at PAGE_SIZE, because with
4k pages we can handle up to 127 dedupe candidates. Given the max
extent length of 16MB, we can end up doing 2GB of IO which is plenty.
Reported-by: "Kirill A. Shutemov" <redacted>
Signed-off-by: Darrick J. Wong <redacted>
---
fs/ioctl.c | 4 ++++
1 file changed, 4 insertions(+)
From: Christoph Hellwig <hch@infradead.org> Date: 2016-09-05 14:56:25
On Thu, Aug 25, 2016 at 04:31:00PM -0700, Darrick J. Wong wrote:
Introduce XFLAGs for the new XFS reflink inode flag and the CoW extent
size hint, and actually plumb the CoW extent size hint into the fsxattr
structure.
Just curious, but why would we even bother to expose the reflink flag
to userspace?
From: Christoph Hellwig <hch@infradead.org> Date: 2016-09-05 14:58:27
On Thu, Aug 25, 2016 at 04:31:07PM -0700, Christoph Hellwig wrote:
Originally-from: Christoph Hellwig [off-list ref]
This should be a
From: Christoph Hellwig <hch@lst.de>
so that git picks up authorship information correctly.
XXX: might want a bigger name, and possible a better implementation
that doesn't require two lookups in the radix tree.
And these need to be looked into. I can take a stab at it, but I need
to get a few other things off my plate first.
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
From: Darrick J. Wong <hidden> Date: 2016-09-06 17:35:14
On Mon, Sep 05, 2016 at 07:57:51AM -0700, Christoph Hellwig wrote:
On Thu, Aug 25, 2016 at 04:31:07PM -0700, Christoph Hellwig wrote:
quoted
Originally-from: Christoph Hellwig [off-list ref]
This should be a
From: Christoph Hellwig <hch@lst.de>
so that git picks up authorship information correctly.
quoted
XXX: might want a bigger name, and possible a better implementation
that doesn't require two lookups in the radix tree.
And these need to be looked into. I can take a stab at it, but I need
to get a few other things off my plate first.
Yeah. It works well enough for unsharing blocks, if inefficiently.
Not sure what "a bigger name" means, though. I tried feeding the
function prototype through figlet but gcc didn't like that. ;)
--D
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
From: Darrick J. Wong <hidden> Date: 2016-09-06 19:15:47
On Mon, Sep 05, 2016 at 07:56:22AM -0700, Christoph Hellwig wrote:
On Thu, Aug 25, 2016 at 04:31:00PM -0700, Darrick J. Wong wrote:
quoted
Introduce XFLAGs for the new XFS reflink inode flag and the CoW extent
size hint, and actually plumb the CoW extent size hint into the fsxattr
structure.
Just curious, but why would we even bother to expose the reflink flag
to userspace?
So far I've put the reflink flag to use in xfs_scrub to look for
obvious signs of brokenness such as extents that overlap or have the
shared flag set but the inode flag is off; and to skip various kinds
of checks that don't have to happen when blocks don't overlap.
I doubt there's much of a use for the flag outside of the XFS utilities.
For a while I pondered only exposing the fsxattr flag if the caller had
CAP_SYS_ADMIN (the level of priviledge required to run scrub) but
decided that I wouldn't change the existing interface like that unless
I had a really good reason.
--D
From: Christoph Hellwig <hch@infradead.org> Date: 2016-09-11 12:58:11
On Tue, Sep 06, 2016 at 12:15:15PM -0700, Darrick J. Wong wrote:
So far I've put the reflink flag to use in xfs_scrub to look for
obvious signs of brokenness such as extents that overlap or have the
shared flag set but the inode flag is off; and to skip various kinds
of checks that don't have to happen when blocks don't overlap.
I doubt there's much of a use for the flag outside of the XFS utilities.
For a while I pondered only exposing the fsxattr flag if the caller had
CAP_SYS_ADMIN (the level of priviledge required to run scrub) but
decided that I wouldn't change the existing interface like that unless
I had a really good reason.
I don't think CAP_SYS_ADMIN is nessecarily the right thing, but it's
still an XFS implementation detail which I don't think we should
pollute a flags API for normal user space applications with.
From: Christoph Hellwig <hch@infradead.org> Date: 2016-09-11 12:58:36
On Tue, Sep 06, 2016 at 10:34:28AM -0700, Darrick J. Wong wrote:
quoted
quoted
XXX: might want a bigger name, and possible a better implementation
that doesn't require two lookups in the radix tree.
And these need to be looked into. I can take a stab at it, but I need
to get a few other things off my plate first.
Yeah. It works well enough for unsharing blocks, if inefficiently.
Not sure what "a bigger name" means, though. I tried feeding the
function prototype through figlet but gcc didn't like that. ;)
From: Darrick J. Wong <hidden> Date: 2016-09-12 19:13:22
On Sun, Sep 11, 2016 at 05:58:08AM -0700, Christoph Hellwig wrote:
On Tue, Sep 06, 2016 at 12:15:15PM -0700, Darrick J. Wong wrote:
quoted
So far I've put the reflink flag to use in xfs_scrub to look for
obvious signs of brokenness such as extents that overlap or have the
shared flag set but the inode flag is off; and to skip various kinds
of checks that don't have to happen when blocks don't overlap.
I doubt there's much of a use for the flag outside of the XFS utilities.
For a while I pondered only exposing the fsxattr flag if the caller had
CAP_SYS_ADMIN (the level of priviledge required to run scrub) but
decided that I wouldn't change the existing interface like that unless
I had a really good reason.
I don't think CAP_SYS_ADMIN is nessecarily the right thing, but it's
still an XFS implementation detail which I don't think we should
pollute a flags API for normal user space applications with.
I can work around it in xfs_scrub, so I'll give back the xflag bit for
reflink.
--D
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
From: Darrick J. Wong <hidden> Date: 2016-09-13 01:16:52
On Mon, Sep 05, 2016 at 07:55:49AM -0700, Christoph Hellwig wrote:
This really should go into 4.8 (and the previous patch probably as
well), and I've said that a couple of times, and you tried a few times
to send it to Al at least.
Al, do you want to pick it up or should Darrick send it straight to
Linus?
Ping? Anyone?
--D
On Thu, Aug 25, 2016 at 04:30:54PM -0700, Darrick J. Wong wrote:
quoted
Kirill A. Shutemov reports that the kernel doesn't try to cap dest_count
in any way, and uses the number to allocate kernel memory. This causes
high order allocation warnings in the kernel log if someone passes in a
big enough value. We should clamp the allocation at PAGE_SIZE to avoid
stressing the VM.
The two existing users of the dedupe ioctl never send more than 120
requests, so we can safely clamp dest_range at PAGE_SIZE, because with
4k pages we can handle up to 127 dedupe candidates. Given the max
extent length of 16MB, we can end up doing 2GB of IO which is plenty.
Reported-by: "Kirill A. Shutemov" <redacted>
Signed-off-by: Darrick J. Wong <redacted>
---
fs/ioctl.c | 4 ++++
1 file changed, 4 insertions(+)
From: Dave Chinner <david@fromorbit.com> Date: 2016-09-19 00:11:48
On Mon, Sep 05, 2016 at 07:57:51AM -0700, Christoph Hellwig wrote:
On Thu, Aug 25, 2016 at 04:31:07PM -0700, Christoph Hellwig wrote:
quoted
Originally-from: Christoph Hellwig [off-list ref]
This should be a
From: Christoph Hellwig <redacted>
so that git picks up authorship information correctly.
quoted
XXX: might want a bigger name, and possible a better implementation
that doesn't require two lookups in the radix tree.
And these need to be looked into. I can take a stab at it, but I need
to get a few other things off my plate first.
Seeing as it works and isn't too ugly to live, I think I'm going to
merge this as is. When a better implementation comes along we
can replace it with that...
Cheers,
Dave.
--
Dave Chinner
david-FqsqvQoI3Ljby3iVrkZq2A@public.gmane.org