Page MenuHomeFreeBSD

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

Authored by fsu on Mon, Feb 10, 5:18 PM.

Details

Reviewers
pfg
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
Lint
Lint Skipped
Unit
Unit Tests Skipped

Event Timeline

fsu created this revision.Mon, Feb 10, 5:18 PM
pfg accepted this revision.Mon, Feb 10, 6:37 PM

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.Mon, Feb 10, 6:37 PM