Conversation
pj1031999
left a comment
There was a problem hiding this comment.
Please resolve conflicts.
(manually resolved conflicts introduced 4ce58f2 (cahirwpz#1104))
|
No idea on why the |
|
@mohrcore value of |
Splitted the vnode cleanup into two VOPs (VOP_INACTIVE, VOP_RECLAIM). VOP_RECLAIM should be used only for vcached filesystems. Renamed some vcache procedures. vfs_vcache_return (earlier vfs_vcache_put) distinguishes now between detached an attached vnodes.
|
@pj1031999 thank you for you comment. That was certainly causing some issues. I've fixed that now. |
|
Allow me to explain my reasoning behind adding a new VOP: A vnode use count as I get it represents the number of entities that need direct access to data held by a vnode. A use count greater than zero, therefore implies that the vnode is not recycleable at the moment (ie. can't be on vcache freelist). When the use count drops to zero, the vnode should be moved to a vcache freelist and thus become recycleable. This will be done through a The problem is that it was the last point at which a filesystem code could do anything in regards to a vnode, before it gets recycled. That meant that any inodes that were allocated by a filesystem needed to be freed in that moment, which in regards to filesystems present on block devices makes the vcache impractical. (I guess alternatively they could be cached internally by a filesystem) A filesystem would need to flush an inode to a block device every time the use count drops to zero and load it back the moment the vnode goes back into use. Thus Because it's still necessary to take action the moment vnode use count drops to zero, as described eariler (detaching filesystem data from invalid vnode), the old According to NetBSD manual: "VOP_INACTIVE() is called when the kernel is no longer using the vnode." @cahirwpz what are your thoughts on this? |
… two separate procedures to for better control over locks
|
|
|
Changing the My take is that the pool allocator is broken, or there's some limitation to its use that I'm not aware of. Or the |
| typedef int vnode_ioctl_t(vnode_t *v, u_long cmd, void *data, file_t *fp); | ||
| typedef int vnode_inactive(vnode_t *v); | ||
| typedef int vnode_reclaim_t(vnode_t *v); |
There was a problem hiding this comment.
Inconsistent naming schema.
| .v_inactive = tmpfs_vop_inactive, | ||
| .v_reclaim = tmpfs_vop_reclaim, | ||
| .v_readlink = tmpfs_vop_readlink, | ||
| .v_symlink = tmpfs_vop_symlink, | ||
| .v_link = tmpfs_vop_link}; |
There was a problem hiding this comment.
Please add , after last struct member - then shitty clang-format will be happy and it will produce human readable output :)
| mtx_lock(&v->tfn_timelock); | ||
| mtx_lock(&node->tfn_timelock); | ||
| if (atime->tv_sec != VNOVAL) | ||
| v->tfn_atime = *atime; | ||
| node->tfn_atime = *atime; | ||
| if (mtime->tv_sec != VNOVAL) | ||
| v->tfn_mtime = *mtime; | ||
| mtx_unlock(&v->tfn_timelock); | ||
| node->tfn_mtime = *mtime; | ||
| mtx_unlock(&node->tfn_timelock); |
| static vcache_t vcache_hash(mount_t *mp, ino_t ino) { | ||
| return (((vcache_t)mp->mnt_vnodecovered >> 3) + ino) % VCACHE_BUCKET_CNT; | ||
| } |
There was a problem hiding this comment.
Try to convince me that it's a good hash function
| vnode_t *vfs_vcache_reborrow(mount_t *mp, ino_t ino) { | ||
| SCOPED_MTX_LOCK(&vcache_giant_lock); | ||
|
|
||
| return vcache_hashget(mp, ino); | ||
| } |
There was a problem hiding this comment.
It's the only place that uses vcache_hashget in code. Why they are separated functions?
| error = vfs_vcache_detach(vn); | ||
| assert(error == 0); |
There was a problem hiding this comment.
What is a purpose of this assertion? Why you don't propagate error?
We need basic vcache functionality to support any external filesystem.