birthtime initialization

Jaakko Heinonen jh at saunalahti.fi
Fri Jul 25 07:23:19 UTC 2008


On 2008-07-24, Bruce Evans wrote:
> First, the fields shouldn't be initialized using VATTR_NULL() in
> VOP_GETATTR().

> Second,  VNOVAL is an extremly bogus default value.

Except for va_fsid because there's this check in vn_stat():

	if (vap->va_fsid != VNOVAL)
		sb->st_dev = vap->va_fsid;
	else
		sb->st_dev = vp->v_mount->mnt_stat.f_fsid.val[0];

What do you think that is a proper default value for va_rdev? Some file
systems set it to 0 and some to VNOVAL.

> After deleting the bogus initializations, we're left with va_filerev,
> va_birthtime and va_flags.  Most file systems don't support these, so
> they could usefully all be handled by defaulting them as in the proposed
> changes for va_birthtime.

Unfortunately moving initializations to vn_stat() breaks things. For
example vm_mmap_vnode() uses VOP_GETATTR() to determine which file flags
are set. Thus moving va_flags initialization to vn_stat() breaks
mmap.

In theory this could be a potential problem for birthtime too.

> > 3) Initialize vattr with VATTR_NULL() but not birthtime explicitly. Thus
> >   tv_sec and tv_nsec are set to -1 (VNOVAL). (devfs, xfs, portalfs,
> >   pseudofs)
> 
> I don't want the case (3).  Otherwise good.

Thank you for your valuable comments. I will try to update the patch.

-- 
Jaakko


More information about the freebsd-fs mailing list