diff mbox

[3/3] btrfs: set FS_SUPPORTS_SEEK_HOLE flag.

Message ID 20150420052752.26554.13596.stgit@notabene.brown (mailing list archive)
State New, archived
Headers show

Commit Message

NeilBrown April 20, 2015, 5:27 a.m. UTC
This allows fscache to cachefiles in a btrfs filesystem.

Signed-off-by: NeilBrown <neilb@suse.de>
---
 fs/btrfs/super.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)



--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

David Howells April 20, 2015, 8:47 a.m. UTC | #1
NeilBrown <neilb@suse.de> wrote:

> +	.fs_flags	= FS_REQUIRES_DEV | FS_BINARY_MOUNTDATA |
> +			  FS_SUPPORTS_SEEK_HOLE,

I must be missing something:

	warthog>git merge linus/master
	Already up-to-date.
	warthog>stg id
	09d51602cf84a1264946711dd4ea0dddbac599a1
	warthog>grep -r FS_SUPPORTS_SEEK_HOLE include/
	warthog1>git grep FS_SUPPORTS_SEEK_HOLE
	warthog1>

David
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
NeilBrown April 20, 2015, 9:33 a.m. UTC | #2
On Mon, 20 Apr 2015 09:47:42 +0100 David Howells <dhowells@redhat.com> wrote:

> NeilBrown <neilb@suse.de> wrote:
> 
> > +	.fs_flags	= FS_REQUIRES_DEV | FS_BINARY_MOUNTDATA |
> > +			  FS_SUPPORTS_SEEK_HOLE,
> 
> I must be missing something:
> 
> 	warthog>git merge linus/master
> 	Already up-to-date.
> 	warthog>stg id
> 	09d51602cf84a1264946711dd4ea0dddbac599a1
> 	warthog>grep -r FS_SUPPORTS_SEEK_HOLE include/
> 	warthog1>git grep FS_SUPPORTS_SEEK_HOLE
> 	warthog1>
> 

Missing patch 2 of the 3-patch series?

NeilBrown
David Howells April 20, 2015, 9:46 a.m. UTC | #3
NeilBrown <neilb@suse.de> wrote:

> Missing patch 2 of the 3-patch series?

Yes. :-)

Do ext4 and xfs support this, do you know?

David
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Christoph Hellwig April 20, 2015, 9:48 a.m. UTC | #4
On Mon, Apr 20, 2015 at 10:46:49AM +0100, David Howells wrote:
> NeilBrown <neilb@suse.de> wrote:
> 
> > Missing patch 2 of the 3-patch series?
> 
> Yes. :-)
> 
> Do ext4 and xfs support this, do you know?

Yes.  As do f2fs, ocfs2, gfs2, ceph and NFSv4.2

> 
> David
---end quoted text---
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Al Viro April 20, 2015, 12:58 p.m. UTC | #5
On Mon, Apr 20, 2015 at 02:48:55AM -0700, Christoph Hellwig wrote:
> On Mon, Apr 20, 2015 at 10:46:49AM +0100, David Howells wrote:
> > NeilBrown <neilb@suse.de> wrote:
> > 
> > > Missing patch 2 of the 3-patch series?
> > 
> > Yes. :-)
> > 
> > Do ext4 and xfs support this, do you know?
> 
> Yes.  As do f2fs, ocfs2, gfs2, ceph and NFSv4.2

Er...  Nominally, gfs2 supports it.  By treating all files as "there's a
hole starting at EOF".  Same as ext2 or even minix...
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Chris Mason April 20, 2015, 7:48 p.m. UTC | #6
On 04/20/2015 01:27 AM, NeilBrown wrote:
> This allows fscache to cachefiles in a btrfs filesystem.

Thanks for working on this Neil.

Signed-off-by: Chris Mason <clm@fb.com>

-chris

> 
> Signed-off-by: NeilBrown <neilb@suse.de>
> ---
>  fs/btrfs/super.c |    3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
> index 05fef198ff94..d3c5d2b40f8e 100644
> --- a/fs/btrfs/super.c
> +++ b/fs/btrfs/super.c
> @@ -1904,7 +1904,8 @@ static struct file_system_type btrfs_fs_type = {
>  	.name		= "btrfs",
>  	.mount		= btrfs_mount,
>  	.kill_sb	= btrfs_kill_super,
> -	.fs_flags	= FS_REQUIRES_DEV | FS_BINARY_MOUNTDATA,
> +	.fs_flags	= FS_REQUIRES_DEV | FS_BINARY_MOUNTDATA |
> +			  FS_SUPPORTS_SEEK_HOLE,
>  };
>  MODULE_ALIAS_FS("btrfs");
>  
> 
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Christoph Hellwig April 21, 2015, 8:43 a.m. UTC | #7
On Mon, Apr 20, 2015 at 01:58:35PM +0100, Al Viro wrote:
> > > Do ext4 and xfs support this, do you know?
> > 
> > Yes.  As do f2fs, ocfs2, gfs2, ceph and NFSv4.2
> 
> Er...  Nominally, gfs2 supports it.  By treating all files as "there's a
> hole starting at EOF".  Same as ext2 or even minix...

Yeah remove gfs2 from the list.
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Hugh Dickins April 21, 2015, 10:23 a.m. UTC | #8
On Tue, 21 Apr 2015, Christoph Hellwig wrote:
> On Mon, Apr 20, 2015 at 01:58:35PM +0100, Al Viro wrote:
> > > > Do ext4 and xfs support this, do you know?
> > > 
> > > Yes.  As do f2fs, ocfs2, gfs2, ceph and NFSv4.2
> > 
> > Er...  Nominally, gfs2 supports it.  By treating all files as "there's a
> > hole starting at EOF".  Same as ext2 or even minix...
> 
> Yeah remove gfs2 from the list.

But please add tmpfs to the list -
though I doubt you're interested in caching its files.

Hugh
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
NeilBrown April 27, 2015, 5:41 a.m. UTC | #9
On Mon, 20 Apr 2015 02:48:55 -0700 Christoph Hellwig <hch@infradead.org>
wrote:

> On Mon, Apr 20, 2015 at 10:46:49AM +0100, David Howells wrote:
> > NeilBrown <neilb@suse.de> wrote:
> > 
> > > Missing patch 2 of the 3-patch series?
> > 
> > Yes. :-)
> > 
> > Do ext4 and xfs support this, do you know?
> 
> Yes.  As do f2fs, ocfs2, gfs2, ceph and NFSv4.2

Are you sure about NFSv4.2?

I see that it *can* report holes, but is there any guarantee that if you
create a new file and write only the 5th block, then READ_PLUS will reliably
report that the first 4 block are holes??

Because if it doesn't guarantee that, then NFSv4.2 doesn't fit the with the
others where SEEK_HOLE reliable reports holes.
On the other hand if NFSv4.2 *does* guarantee that then the current READ_PLUS
server patches are broken because they just use vfs_llseek and assume that
trust what it says.

It would be really nice if SEEK_{DATA,HOLE} either reported holes reliably or
returned ENXIO, but I guess there was a goo reason not to do that.

Thanks,
NeilBrown
Christoph Hellwig April 27, 2015, 1:43 p.m. UTC | #10
On Mon, Apr 27, 2015 at 03:41:33PM +1000, NeilBrown wrote:
> Are you sure about NFSv4.2?
> 
> I see that it *can* report holes, but is there any guarantee that if you
> create a new file and write only the 5th block, then READ_PLUS will reliably
> report that the first 4 block are holes??

FYI, I'm talking about SEEK here, not READ_PLUS but the issue is the
same.

> Because if it doesn't guarantee that, then NFSv4.2 doesn't fit the with the
> others where SEEK_HOLE reliable reports holes.
> On the other hand if NFSv4.2 *does* guarantee that then the current READ_PLUS
> server patches are broken because they just use vfs_llseek and assume that
> trust what it says.

There is no quality of implementation guarantee in NFS, just like there
isn't any in Linux.  It's very hard to have any hard guarantees without
leaking specific implementation details like a block size.

> It would be really nice if SEEK_{DATA,HOLE} either reported holes reliably or
> returned ENXIO, but I guess there was a goo reason not to do that.

It would hav been useful, but we went with the Solaris way of reporting
a giant hole.  Solaris at least has a pathconf value telling you if
real SEEK_{DATA,HOLE} are supported, but with Linus' hatred of that
syscall we only have a bad emulation in glibc that isn't of much help
here.
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
index 05fef198ff94..d3c5d2b40f8e 100644
--- a/fs/btrfs/super.c
+++ b/fs/btrfs/super.c
@@ -1904,7 +1904,8 @@  static struct file_system_type btrfs_fs_type = {
 	.name		= "btrfs",
 	.mount		= btrfs_mount,
 	.kill_sb	= btrfs_kill_super,
-	.fs_flags	= FS_REQUIRES_DEV | FS_BINARY_MOUNTDATA,
+	.fs_flags	= FS_REQUIRES_DEV | FS_BINARY_MOUNTDATA |
+			  FS_SUPPORTS_SEEK_HOLE,
 };
 MODULE_ALIAS_FS("btrfs");