Page MenuHomeFreeBSD

ufs_need_inactive.
ClosedPublic

Authored by kib on Dec 1 2019, 12:22 AM.
Tags
None
Referenced Files
Unknown Object (File)
Feb 11 2024, 1:56 PM
Unknown Object (File)
Dec 13 2023, 8:30 AM
Unknown Object (File)
Aug 26 2023, 9:04 PM
Unknown Object (File)
Aug 3 2023, 1:19 AM
Unknown Object (File)
Jul 29 2023, 12:44 PM
Unknown Object (File)
Jul 5 2023, 12:09 PM
Unknown Object (File)
Jan 3 2023, 7:49 AM
Unknown Object (File)
Dec 10 2022, 1:40 AM
Subscribers

Details

Summary

The checks literally repeat conditions that make ufs_inactive() to take some actions.
The doubt point is that most of the conditions are only stable under the vnode lock.

Diff Detail

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

Event Timeline

This misses the explicit vrecycle(). I don't know how often that matters.

I wonder whether we would be better served by a 'NEEDS INACTIVE' flag that is conditionally set by compliant filesystems and always set for non-compliant ones. It would save us the VOP call on every vput(). It is easy to identify where these conditions change in ufs. It is only inode updates and truncate and unlink. The inode updates are already managed in a common place.

In D22616#495270, @jeff wrote:

This misses the explicit vrecycle(). I don't know how often that matters.

Sorry, I do not understand this note. Isn't VOP_NEED_INACTIVE() should only indicate whether inactivation has anything to do ? We do not own the vnode lock in NEED_INACTIVE, which is the point of the NEED_INACTIVE(): to avoid taking the lock if inactivation is not useful.

I wonder whether we would be better served by a 'NEEDS INACTIVE' flag that is conditionally set by compliant filesystems and always set for non-compliant ones. It would save us the VOP call on every vput(). It is easy to identify where these conditions change in ufs. It is only inode updates and truncate and unlink. The inode updates are already managed in a common place.

You mean, set OWEINACT when fs changes the vnode in a way that would require subsequent inactivation ? This is good idea, but a lot of very delicate work, and easily causing data corruption.

In D22616#495270, @jeff wrote:

This misses the explicit vrecycle(). I don't know how often that matters.

I wonder whether we would be better served by a 'NEEDS INACTIVE' flag that is conditionally set by compliant filesystems and always set for non-compliant ones. It would save us the VOP call on every vput(). It is easy to identify where these conditions change in ufs. It is only inode updates and truncate and unlink. The inode updates are already managed in a common place.

I think we would be best served with VOP_VPUTX instead. Filesystems could do whatever they see fit and the current code could be chopped up into helper functions. Default routine would do what vputx is doing now. In my original patch for the entire thing I had filesystems check what they want and resort to calling vop_stdvputx if necessary which could provide an intermediate step. Or in general, VFS going forward needs to do less hand holding for filesystems as the current approach is prone to doing additional work which dirties cache lines and is often unnecessary.

I consider the current approach to not be flexible enough. For instance I'm looking at (temporarily) caching vnodes on the active list to reduce constant movement and requeing. As it is filesystems don't have a way to indicate whether the vnode is up for being cached (e.g., it was not unlinked). In the current scheme I would have to use need_inactive to refrain from caching (and in fact un-cache) even if it the vnode was not unlinked and only needed some processing.

That said, I think for the time being we should just sort out the need_inactive routine for ufs and interface changes (if any) are a separate and a lengthy conversation. Doing things the simple way now makes them eligible for getting merged to stable/12.

I understand my one objection now.

This revision is now accepted and ready to land.Dec 4 2019, 1:52 AM
This revision was automatically updated to reflect the committed changes.