Changeset View
Standalone View
sys/sys/vnode.h
Show First 20 Lines • Show All 231 Lines • ▼ Show 20 Lines | |||||
#define VN_KNOTE_LOCKED(vp, b) VN_KNOTE(vp, b, KNF_LISTLOCKED) | #define VN_KNOTE_LOCKED(vp, b) VN_KNOTE(vp, b, KNF_LISTLOCKED) | ||||
#define VN_KNOTE_UNLOCKED(vp, b) VN_KNOTE(vp, b, 0) | #define VN_KNOTE_UNLOCKED(vp, b) VN_KNOTE(vp, b, 0) | ||||
/* | /* | ||||
* Vnode flags. | * Vnode flags. | ||||
* VI flags are protected by interlock and live in v_iflag | * VI flags are protected by interlock and live in v_iflag | ||||
* VV flags are protected by the vnode lock and live in v_vflag | * VV flags are protected by the vnode lock and live in v_vflag | ||||
* | * | ||||
* VIRF_DOOMED is doubly protected by the interlock and vnode lock. Both | * VIRF_DOOMED is doubly protected by the interlock and vnode lock. Both | ||||
cem: Is this semantic expected for all VIRF flags? Should it be documented like above for VI/VV? | |||||
mjgAuthorUnsubmitted Done Inline ActionsThe only requiremed for chaning v_irflag is the interlock. So happens VIRF_DOOMED will only show up when the vnode is also held. mjg: The only requiremed for chaning v_irflag is the interlock. So happens VIRF_DOOMED will only… | |||||
cemUnsubmitted Not Done Inline ActionsCan we add a basically identical line to existing VI flags for VIRF then? (Actually why do we have VIRF at all if lifetime is the same as VI?) cem: Can we add a basically identical line to existing VI flags for VIRF then? (Actually why do we… | |||||
mjgAuthorUnsubmitted Done Inline Actionsv_irflag resides in an (almost) read-only area mjg: v_irflag resides in an (almost) read-only area | |||||
kibUnsubmitted Not Done Inline ActionsBy design of VFS, vnode can become doomed only under the vnode lock. VI_DOOMED required both vnode lock and vnode interlock, safely checked under either of them. Same is true for VIRF_DOOMED, and this is a fundamental part of safe reclaim. VIRF_PGREAD and apparently VIRF_ISDISK are set and then guaranteed to be never cleared. VIRG_PGREAD have to wait for VOP_OPEN() unfortunately, to be set. VIRF_ISDISK should be set before the vnode becomes visible to any consumer. kib: By design of VFS, vnode can become doomed only under the vnode lock. VI_DOOMED required both… | |||||
* are required for writing but the status may be checked with either. | * are required for writing but the status may be checked with either. | ||||
*/ | */ | ||||
#define VHOLD_NO_SMR (1<<29) /* Disable vhold_smr */ | #define VHOLD_NO_SMR (1<<29) /* Disable vhold_smr */ | ||||
#define VHOLD_ALL_FLAGS (VHOLD_NO_SMR) | #define VHOLD_ALL_FLAGS (VHOLD_NO_SMR) | ||||
#define VIRF_DOOMED 0x0001 /* This vnode is being recycled */ | #define VIRF_DOOMED 0x0001 /* This vnode is being recycled */ | ||||
#define VIRF_PGREAD 0x0002 /* Direct reads from the page cache are permitted, | #define VIRF_PGREAD 0x0002 /* Direct reads from the page cache are permitted, | ||||
never cleared once set */ | never cleared once set */ | ||||
#define VIRF_ISDISK 0x0004 /* This vnode is a disk device */ | |||||
#define VI_TEXT_REF 0x0001 /* Text ref grabbed use ref */ | #define VI_TEXT_REF 0x0001 /* Text ref grabbed use ref */ | ||||
#define VI_MOUNT 0x0002 /* Mount in progress */ | #define VI_MOUNT 0x0002 /* Mount in progress */ | ||||
#define VI_DOINGINACT 0x0004 /* VOP_INACTIVE is in progress */ | #define VI_DOINGINACT 0x0004 /* VOP_INACTIVE is in progress */ | ||||
#define VI_OWEINACT 0x0008 /* Need to call inactive */ | #define VI_OWEINACT 0x0008 /* Need to call inactive */ | ||||
#define VI_DEFINACT 0x0010 /* deferred inactive */ | #define VI_DEFINACT 0x0010 /* deferred inactive */ | ||||
#define VV_ROOT 0x0001 /* root of its filesystem */ | #define VV_ROOT 0x0001 /* root of its filesystem */ | ||||
▲ Show 20 Lines • Show All 457 Lines • ▼ Show 20 Lines | |||||
void vn_finished_secondary_write(struct mount *mp); | void vn_finished_secondary_write(struct mount *mp); | ||||
int vn_fsync_buf(struct vnode *vp, int waitfor); | int vn_fsync_buf(struct vnode *vp, int waitfor); | ||||
int vn_generic_copy_file_range(struct vnode *invp, off_t *inoffp, | int vn_generic_copy_file_range(struct vnode *invp, off_t *inoffp, | ||||
struct vnode *outvp, off_t *outoffp, size_t *lenp, | struct vnode *outvp, off_t *outoffp, size_t *lenp, | ||||
unsigned int flags, struct ucred *incred, struct ucred *outcred, | unsigned int flags, struct ucred *incred, struct ucred *outcred, | ||||
struct thread *fsize_td); | struct thread *fsize_td); | ||||
int vn_need_pageq_flush(struct vnode *vp); | int vn_need_pageq_flush(struct vnode *vp); | ||||
bool vn_isdisk_error(struct vnode *vp, int *errp); | bool vn_isdisk_error(struct vnode *vp, int *errp); | ||||
bool vn_isdisk(struct vnode *vp); | static inline bool | ||||
vn_isdisk(struct vnode *vp) | |||||
{ | |||||
cemUnsubmitted Not Done Inline ActionsThanks, inline seems right for this. Should we add a lock assert? cem: Thanks, inline seems right for this. Should we add a lock assert? | |||||
mjgAuthorUnsubmitted Done Inline Actionswhat lock? we only need the vnode pointer to be valid mjg: what lock? we only need the vnode pointer to be valid | |||||
cemUnsubmitted Not Done Inline ActionsIs it valid if doomed? I guess we may have checked doomed under lock and grabbed a ref/hold and this would be safe without lock. Nevermind. cem: Is it valid if doomed? I guess we may have checked doomed under lock and grabbed a ref/hold and… | |||||
return ((vp->v_irflag & VIRF_ISDISK) != 0); | |||||
} | |||||
int _vn_lock(struct vnode *vp, int flags, const char *file, int line); | int _vn_lock(struct vnode *vp, int flags, const char *file, int line); | ||||
#define vn_lock(vp, flags) _vn_lock(vp, flags, __FILE__, __LINE__) | #define vn_lock(vp, flags) _vn_lock(vp, flags, __FILE__, __LINE__) | ||||
int vn_open(struct nameidata *ndp, int *flagp, int cmode, struct file *fp); | int vn_open(struct nameidata *ndp, int *flagp, int cmode, struct file *fp); | ||||
int vn_open_cred(struct nameidata *ndp, int *flagp, int cmode, | int vn_open_cred(struct nameidata *ndp, int *flagp, int cmode, | ||||
u_int vn_open_flags, struct ucred *cred, struct file *fp); | u_int vn_open_flags, struct ucred *cred, struct file *fp); | ||||
int vn_open_vnode(struct vnode *vp, int fmode, struct ucred *cred, | int vn_open_vnode(struct vnode *vp, int fmode, struct ucred *cred, | ||||
struct thread *td, struct file *fp); | struct thread *td, struct file *fp); | ||||
void vn_pages_remove(struct vnode *vp, vm_pindex_t start, vm_pindex_t end); | void vn_pages_remove(struct vnode *vp, vm_pindex_t start, vm_pindex_t end); | ||||
▲ Show 20 Lines • Show All 347 Lines • Show Last 20 Lines |
Is this semantic expected for all VIRF flags? Should it be documented like above for VI/VV?