Page MenuHomeFreeBSD

Add a EXT2FS-specific implementation for lseek(SEEK_DATA).
ClosedPublic

Authored by fsu on Feb 10 2020, 5:18 PM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Apr 19, 3:06 AM
Unknown Object (File)
Fri, Apr 12, 4:17 PM
Unknown Object (File)
Wed, Mar 27, 7:50 PM
Unknown Object (File)
Jan 26 2024, 7:26 PM
Unknown Object (File)
Jan 13 2024, 11:20 AM
Unknown Object (File)
Dec 29 2023, 6:41 AM
Unknown Object (File)
Dec 20 2023, 3:58 AM
Unknown Object (File)
Dec 12 2023, 11:49 PM
Subscribers

Details

Summary

The proposed changes are based on https://reviews.freebsd.org/D19599.
Because of ext2fs code base compatibility with ufs, it was not difficult to just move the changes from ufs side.

The same optimization for extents could be added later.

Test Plan

The changes were tested using test programs mentioned in the https://reviews.freebsd.org/D19599:
https://gist.github.com/5319d0d7d52e0f9199ddf2b5a75a6438
and
https://gist.github.com/a4f9c80a7699151e7f2e5ba051740aa7

Also, the additional verification code was used:
static int
ext2_bmap_seekdata_with_check(struct vnode* vp, u_long cmd, off_t *offp,

struct ucred *cred)

{
int error_ref, error;
off_t off_ref = *offp;
off_t off = *offp;

error_ref = vn_bmap_seekhole(vp, cmd, &off_ref, cred);
error = vn_lock(vp, LK_SHARED);
if (error == 0) {

		error = ext2_bmap_seekdata(vp, &off);
		VOP_UNLOCK(vp);

} else

		error = EBADF;

if (error != error_ref) {

		printf("==== TEST ERROR er_ref=%d, er=%d\n",
		    error_ref, error);
		*offp = off_ref;
		return (error_ref);

}

if (error)

		return (error);

if (off_ref != off) {

		printf("==== TEST ERROR off_ref=%ld, off=%ld\n",
		    off_ref, off);
		*offp = off_ref;
		return (error_ref);

}

*offp = off;

return (0);
}

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

Good, indeed r252956, which was the predecesor of this, was built on an UFS patch.
Well done, thanks!

This revision is now accepted and ready to land.Feb 10 2020, 6:37 PM