mirror of
https://github.com/freebsd/freebsd-src
synced 2024-09-06 17:18:32 +00:00
fspacectl(2): Changes on rmsr.r_offset's minimum value returned
rmsr.r_offset now is set to rqsr.r_offset plus the number of bytes zeroed before hitting the end-of-file. After this change rmsr.r_offset no longer contains the EOF when the requested operation range is completely beyond the end-of-file. Instead in such case rmsr.r_offset is equal to rqsr.r_offset. Callers can obtain the number of bytes zeroed by subtracting rqsr.r_offset from rmsr.r_offset. Sponsored by: The FreeBSD Foundation Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D31677
This commit is contained in:
parent
dc6ab77d66
commit
9e202d036d
|
@ -27,7 +27,7 @@
|
|||
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
.\" SUCH DAMAGE.
|
||||
.\"
|
||||
.Dd August 18, 2021
|
||||
.Dd August 25, 2021
|
||||
.Dt FSPACECTL 2
|
||||
.Os
|
||||
.Sh NAME
|
||||
|
@ -73,10 +73,9 @@ operation range,
|
|||
.Fa "rmsr->r_len"
|
||||
is updated to be the value 0, and
|
||||
.Fa "rmsr->r_offset"
|
||||
is updated to be the smallest of
|
||||
.Fa "rqsr->r_offset" +
|
||||
.Fa "rqsr->r_len" ;
|
||||
and the end-of-file offset.
|
||||
is updated to be
|
||||
.Fa "rqsr->r_offset"
|
||||
plus the number of bytes zeroed before the end-of-file.
|
||||
The file descriptor's file offset is not used or modified by the system call.
|
||||
Both
|
||||
.Fa rqsr
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
.\" SUCH DAMAGE.
|
||||
.\"
|
||||
.Dd August 11, 2021
|
||||
.Dd August 25, 2021
|
||||
.Dt VOP_DEALLOCATE 9
|
||||
.Os
|
||||
.Sh NAME
|
||||
|
@ -74,14 +74,11 @@ and
|
|||
are updated to reflect the portion of the range that
|
||||
still needs to be zeroed/deallocated on return.
|
||||
Partial result is considered a successful operation.
|
||||
For a successful completion without an unprocessed portion of the range,
|
||||
For a non-partial successful completion,
|
||||
.Fa *len
|
||||
is updated to be the value 0, and
|
||||
.Fa *offset
|
||||
is updated to be the smallest of
|
||||
.Fa *offset +
|
||||
.Fa *len
|
||||
passed to the call and the end-of-file offset.
|
||||
is incremented by the number of bytes zeroed before the end-of-file.
|
||||
.Sh LOCKS
|
||||
The vnode should be locked on entry and will still be locked on exit.
|
||||
.Sh RETURN VALUES
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
.\" SUCH DAMAGE.
|
||||
.\"
|
||||
.Dd August 11, 2021
|
||||
.Dd August 25, 2021
|
||||
.Dt VN_DEALLOCATE 9
|
||||
.Os
|
||||
.Sh NAME
|
||||
|
@ -99,10 +99,7 @@ For a successful completion,
|
|||
.Fa *length
|
||||
is updated to be the value 0, and
|
||||
.Fa *offset
|
||||
is updated to be the smallest of
|
||||
.Fa *offset +
|
||||
.Fa *length
|
||||
passed to the call and the end-of-file offset.
|
||||
is incremented by the number of bytes zeroed before the end-of-file.
|
||||
.Sh RETURN VALUES
|
||||
Upon successful completion, the value 0 is returned; otherwise the
|
||||
appropriate error is returned.
|
||||
|
|
|
@ -1917,7 +1917,6 @@ shm_deallocate(struct shmfd *shmfd, off_t *offset, off_t *length, int flags)
|
|||
|
||||
/* Handle the case when offset is on or beyond shm size. */
|
||||
if ((off_t)len <= 0) {
|
||||
*offset = shmfd->shm_size;
|
||||
*length = 0;
|
||||
return (0);
|
||||
}
|
||||
|
|
|
@ -1156,6 +1156,7 @@ vop_stddeallocate(struct vop_deallocate_args *ap)
|
|||
/*
|
||||
* No more data region to be filled
|
||||
*/
|
||||
offset += len;
|
||||
len = 0;
|
||||
error = 0;
|
||||
break;
|
||||
|
@ -1185,10 +1186,8 @@ vop_stddeallocate(struct vop_deallocate_args *ap)
|
|||
break;
|
||||
}
|
||||
/* Handle the case when offset is beyond EOF */
|
||||
if (len < 0) {
|
||||
offset += len;
|
||||
if (len < 0)
|
||||
len = 0;
|
||||
}
|
||||
out:
|
||||
*ap->a_offset = offset;
|
||||
*ap->a_len = len;
|
||||
|
|
Loading…
Reference in a new issue