Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for SEEK_DATA and SEEK_HOLE #1384

Closed
ryao opened this issue Apr 2, 2013 · 1 comment
Closed

Add support for SEEK_DATA and SEEK_HOLE #1384

ryao opened this issue Apr 2, 2013 · 1 comment
Labels
Type: Feature Feature request or new feature
Milestone

Comments

@ryao
Copy link
Contributor

ryao commented Apr 2, 2013

Linux 3.1 added support for SEEK_DATA and SEEK_HOLE. It appears that ext4, btrfs, ocfs2, xfs and tmpfs have added support:

http://lkml.indiana.edu/hypermail/linux/kernel/1211.3/02551.html

These operations were invented in ZFS, but the ZFSOnLinux ZPL does not support them. It should be fairly easy to cherry-pick the code needed for this from Illumos. In particular, we want zfs_holey:

https://github.com/illumos/illumos-gate/blob/master/usr/src/uts/common/fs/zfs/zfs_vnops.c

There are some other things that I want to do, but I will try to make some time later this month to take care of this. I am opening this issue as a reminder to myself.

@behlendorf
Copy link
Contributor

Neat, I didn't know about that. This looks straight forward enough to port given the links above if someone wants to jump in and do it.

ryao added a commit to ryao/zfs that referenced this issue Jun 13, 2013
This adds SEEK_DATA/SEEK_HOLE to fseek()/lseek()/llseek().

This is a heavily revised version of the patch proposed in
openzfs#1516. The original message by Li Dongyang was:

```
Add SEEK_DATA/SEEK_HOLE by creating our own zpl_file_llseek().
Tested with xfstests 285 and 286. test0[7-9] of 285 will try to reserve
the blocks first via fallocate(2), we will fail there as currently we
don't support that.
```

My revisions address some issues that I spotted and also some things
that were spotted upon review by Richard Laager. The behavior on errors
has been altered to match the Solaris version, which is where this
extension was invented. It should still pass the XFS tests, but I am not
setup to verify that. The zfs_holey() function from Open Solaris was
moved to its own commit for attribution purposes.

Note that the filp->f_lock spinlock did not exist prior to Linux 2.6.30,
but we avoid the need for autotools check by virtue of the fact that
SEEK_DATA/SEEK_HOLE support was not added until Linux 3.1.

Closes openzfs#1384

Original-patch-by: Li Dongyang <[email protected]>
Signed-off-by: Richard Yao <[email protected]>
Reviewed-by: Richard Laager <[email protected]>
ryao added a commit to ryao/zfs that referenced this issue Jun 14, 2013
This adds SEEK_DATA/SEEK_HOLE to fseek()/lseek()/llseek().

This is a heavily revised version of the patch proposed in
openzfs#1516. The original message by Li Dongyang was:

```
Add SEEK_DATA/SEEK_HOLE by creating our own zpl_file_llseek().
Tested with xfstests 285 and 286. test0[7-9] of 285 will try to reserve
the blocks first via fallocate(2), we will fail there as currently we
don't support that.
```

My revisions address some issues that I spotted and also some things
that were spotted upon review by Richard Laager. The behavior on errors
has been altered to match the Solaris version, which is where this
extension was invented. It should still pass the XFS tests, but I am not
setup to verify that. The zfs_holey() function from Open Solaris was
moved to its own commit for attribution purposes.

Note that the filp->f_lock spinlock did not exist prior to Linux 2.6.30,
but we avoid the need for autotools check by virtue of the fact that
SEEK_DATA/SEEK_HOLE support was not added until Linux 3.1.

Closes openzfs#1384

Original-patch-by: Li Dongyang <[email protected]>
Signed-off-by: Richard Yao <[email protected]>
Reviewed-by: Richard Laager <[email protected]>
ryao added a commit to ryao/zfs that referenced this issue Jun 14, 2013
This adds SEEK_DATA/SEEK_HOLE to fseek()/lseek()/llseek().

This is a heavily revised version of the patch proposed in
openzfs#1516. The original message by Li Dongyang was:

```
Add SEEK_DATA/SEEK_HOLE by creating our own zpl_file_llseek().
Tested with xfstests 285 and 286. test0[7-9] of 285 will try to reserve
the blocks first via fallocate(2), we will fail there as currently we
don't support that.
```

My revisions address some issues that I spotted and also some things
that were spotted upon review by Richard Laager. The behavior on errors
has been altered to match the Solaris version, which is where this
extension was invented. It should still pass the XFS tests, but I am not
setup to verify that. The zfs_holey() function from Open Solaris was
moved to its own commit for attribution purposes.

Note that the filp->f_lock spinlock did not exist prior to Linux 2.6.30,
but we avoid the need for autotools check by virtue of the fact that
SEEK_DATA/SEEK_HOLE support was not added until Linux 3.1.

Closes openzfs#1384

Original-patch-by: Li Dongyang <[email protected]>
Signed-off-by: Richard Yao <[email protected]>
Reviewed-by: Richard Laager <[email protected]>
ryao added a commit to ryao/zfs that referenced this issue Jun 14, 2013
This adds SEEK_DATA/SEEK_HOLE to lseek()/llseek().

This is a heavily revised version of the patch proposed in
openzfs#1516. The original message by Li Dongyang was:

```
Add SEEK_DATA/SEEK_HOLE by creating our own zpl_file_llseek().
Tested with xfstests 285 and 286. test0[7-9] of 285 will try to reserve
the blocks first via fallocate(2), we will fail there as currently we
don't support that.
```

My revisions address some issues that I spotted and also some things
that were spotted upon review by Richard Laager. The behavior on errors
has been altered to match the Solaris version, which is where this
extension was invented. It should still pass the XFS tests, but I am not
setup to verify that. The zfs_holey() function from Open Solaris was
moved to its own commit for attribution purposes.

Note that the filp->f_lock spinlock did not exist prior to Linux 2.6.30,
but we avoid the need for autotools check by virtue of the fact that
SEEK_DATA/SEEK_HOLE support was not added until Linux 3.1.

Closes openzfs#1384

Original-patch-by: Li Dongyang <[email protected]>
Signed-off-by: Richard Yao <[email protected]>
Reviewed-by: Richard Laager <[email protected]>
ryao added a commit to ryao/zfs that referenced this issue Jun 14, 2013
This adds SEEK_DATA/SEEK_HOLE to lseek()/llseek().

This is a heavily revised version of the patch proposed in
openzfs#1516. The original message by Li Dongyang was:

```
Add SEEK_DATA/SEEK_HOLE by creating our own zpl_file_llseek().
Tested with xfstests 285 and 286. test0[7-9] of 285 will try to reserve
the blocks first via fallocate(2), we will fail there as currently we
don't support that.
```

My revisions address some issues that I spotted and also some things
that were spotted upon review by Richard Laager. The behavior on errors
has been altered to match the Solaris version, which is where this
extension was invented. It should still pass the XFS tests, but I am not
setup to verify that. The zfs_holey() function from Open Solaris was
moved to its own commit for attribution purposes.

Note that the filp->f_lock spinlock did not exist prior to Linux 2.6.30,
but we avoid the need for autotools check by virtue of the fact that
SEEK_DATA/SEEK_HOLE support was not added until Linux 3.1.

Closes openzfs#1384

Original-patch-by: Li Dongyang <[email protected]>
Signed-off-by: Richard Yao <[email protected]>
Reviewed-by: Richard Laager <[email protected]>
ryao added a commit to ryao/zfs that referenced this issue Jun 21, 2013
This adds SEEK_DATA/SEEK_HOLE to lseek()/llseek().

This is a heavily revised version of the patch proposed in
openzfs#1516. The original message by Li Dongyang was:

```
Add SEEK_DATA/SEEK_HOLE by creating our own zpl_file_llseek().
Tested with xfstests 285 and 286. test0[7-9] of 285 will try to reserve
the blocks first via fallocate(2), we will fail there as currently we
don't support that.
```

My revisions address some issues that I spotted and also some things
that were spotted upon review by Richard Laager. The behavior on errors
has been altered to match the Solaris version, which is where this
extension was invented. It should still pass the XFS tests, but I am not
setup to verify that. The zfs_holey() function from Open Solaris was
moved to its own commit for attribution purposes.

Note that the filp->f_lock spinlock did not exist prior to Linux 2.6.30,
but we avoid the need for autotools check by virtue of the fact that
SEEK_DATA/SEEK_HOLE support was not added until Linux 3.1.

Closes openzfs#1384

Original-patch-by: Li Dongyang <[email protected]>
Signed-off-by: Richard Yao <[email protected]>
Reviewed-by: Richard Laager <[email protected]>
behlendorf pushed a commit to behlendorf/zfs that referenced this issue Jun 28, 2013
This patch restores the zfs_holey() function from OpenSolaris.
This was removed by commit 3558fd7 because it wasn't clear we
had a use for it in ZoL.  However, this functionality is a
prerequisite for adding SEEK_DATA/SEEK_HOLE support to the ZPL.

The approach taken was the rework zfs_holey() as little as
possible and then just wrap the code as needed to ensure
correct locking and error handling.

Tested with xfstests 285 and 286.  All tests pass except for
7-9 of 285 which try to reserve blocks first via fallocate(2)
and fail because fallocate(2) is not yet supported.

Note that the filp->f_lock spinlock did not exist prior to
Linux 2.6.30, but we avoid the need for autotools check by
virtue of the fact that SEEK_DATA/SEEK_HOLE support was not
added until Linux 3.1.

Reviewed-by: Richard Laager <[email protected]>
Signed-off-by: Richard Yao <[email protected]>
Signed-off-by: Brian Behlendorf <[email protected]>
Closes openzfs#1384
ryao added a commit to ryao/zfs that referenced this issue Jul 1, 2013
This adds SEEK_DATA/SEEK_HOLE to lseek()/llseek().

This is a heavily revised version of the patch proposed in
openzfs#1516. The original message by Li Dongyang was:

```
Add SEEK_DATA/SEEK_HOLE by creating our own zpl_file_llseek().
Tested with xfstests 285 and 286. test0[7-9] of 285 will try to reserve
the blocks first via fallocate(2), we will fail there as currently we
don't support that.
```

My revisions address some issues that I spotted and also some things
that were spotted upon review by Richard Laager. The behavior on errors
has been altered to match the Solaris version, which is where this
extension was invented. It should still pass the XFS tests, but I am not
setup to verify that. The zfs_holey() function from Open Solaris was
moved to its own commit for attribution purposes.

Note that the filp->f_lock spinlock did not exist prior to Linux 2.6.30,
but we avoid the need for autotools check by virtue of the fact that
SEEK_DATA/SEEK_HOLE support was not added until Linux 3.1.

Closes openzfs#1384

Original-patch-by: Li Dongyang <[email protected]>
Signed-off-by: Richard Yao <[email protected]>
Reviewed-by: Richard Laager <[email protected]>
behlendorf pushed a commit to behlendorf/zfs that referenced this issue Jul 1, 2013
The approach taken was the rework zfs_holey() as little as
possible and then just wrap the code as needed to ensure
correct locking and error handling.

Tested with xfstests 285 and 286.  All tests pass except for
7-9 of 285 which try to reserve blocks first via fallocate(2)
and fail because fallocate(2) is not yet supported.

Note that the filp->f_lock spinlock did not exist prior to
Linux 2.6.30, but we avoid the need for autotools check by
virtue of the fact that SEEK_DATA/SEEK_HOLE support was not
added until Linux 3.1.

An autoconf check was added for lseek_execute() which is
currently a private function but the expection is that it
will be exported perhaps as early as Linux 3.11.

Reviewed-by: Richard Laager <[email protected]>
Signed-off-by: Richard Yao <[email protected]>
Signed-off-by: Brian Behlendorf <[email protected]>
Closes openzfs#1384
behlendorf pushed a commit that referenced this issue Jul 2, 2013
This patch restores the zfs_holey() function from OpenSolaris.
This was removed by commit 3558fd7 because it wasn't clear we
had a use for it in ZoL.  However, this functionality is a
prerequisite for adding SEEK_DATA/SEEK_HOLE support to the ZPL.

Signed-off-by: Brian Behlendorf <[email protected]>
Signed-off-by: Richard Yao <[email protected]>
Issue #1384
unya pushed a commit to unya/zfs that referenced this issue Dec 13, 2013
This patch restores the zfs_holey() function from OpenSolaris.
This was removed by commit 3558fd7 because it wasn't clear we
had a use for it in ZoL.  However, this functionality is a
prerequisite for adding SEEK_DATA/SEEK_HOLE support to the ZPL.

Signed-off-by: Brian Behlendorf <[email protected]>
Signed-off-by: Richard Yao <[email protected]>
Issue openzfs#1384
unya pushed a commit to unya/zfs that referenced this issue Dec 13, 2013
The approach taken was the rework zfs_holey() as little as
possible and then just wrap the code as needed to ensure
correct locking and error handling.

Tested with xfstests 285 and 286.  All tests pass except for
7-9 of 285 which try to reserve blocks first via fallocate(2)
and fail because fallocate(2) is not yet supported.

Note that the filp->f_lock spinlock did not exist prior to
Linux 2.6.30, but we avoid the need for autotools check by
virtue of the fact that SEEK_DATA/SEEK_HOLE support was not
added until Linux 3.1.

An autoconf check was added for lseek_execute() which is
currently a private function but the expectation is that it
will be exported perhaps as early as Linux 3.11.

Reviewed-by: Richard Laager <[email protected]>
Signed-off-by: Richard Yao <[email protected]>
Signed-off-by: Brian Behlendorf <[email protected]>
Closes openzfs#1384
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Feature Feature request or new feature
Projects
None yet
2 participants