Author: mjg Date: Thu Jul 30 22:13:15 2020 New Revision: 363713 URL: https://svnweb.freebsd.org/changeset/base/363713
Log: fd: predict in fdrop Modified: head/sys/sys/file.h Modified: head/sys/sys/file.h ============================================================================== --- head/sys/sys/file.h Thu Jul 30 19:11:01 2020 (r363712) +++ head/sys/sys/file.h Thu Jul 30 22:13:15 2020 (r363713) @@ -279,21 +279,22 @@ int fgetvp_read(struct thread *td, int fd, cap_rights_ int fgetvp_write(struct thread *td, int fd, cap_rights_t *rightsp, struct vnode **vpp); -static __inline int -_fnoop(void) -{ - - return (0); -} - static __inline __result_use_check bool fhold(struct file *fp) { return (refcount_acquire_checked(&fp->f_count)); } -#define fdrop(fp, td) \ - (refcount_release(&(fp)->f_count) ? _fdrop((fp), (td)) : _fnoop()) +#define fdrop(fp, td) ({ \ + struct file *_fp; \ + int _error; \ + \ + _error = 0; \ + _fp = (fp); \ + if (__predict_false(refcount_release(&_fp->f_count))) \ + _error = _fdrop(_fp, td); \ + _error; \ +}) static __inline fo_rdwr_t fo_read; static __inline fo_rdwr_t fo_write; _______________________________________________ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"