zfs: add branch prediction to ZFS_ENTER and ZFS_VERIFY_ZP macros

They are expected to fail only in corner cases.
This commit is contained in:
Mateusz Guzik 2020-11-04 21:18:51 +00:00
parent 8ce21ae6ba
commit 4a0b7fd502
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=367343
2 changed files with 4 additions and 4 deletions

View File

@ -119,7 +119,7 @@ extern minor_t zfsdev_minor_alloc(void);
#define ZFS_ENTER(zfsvfs) \
{ \
rrm_enter_read(&(zfsvfs)->z_teardown_lock, FTAG); \
if ((zfsvfs)->z_unmounted) { \
if (__predict_false((zfsvfs)->z_unmounted)) { \
ZFS_EXIT(zfsvfs); \
return (EIO); \
} \
@ -130,7 +130,7 @@ extern minor_t zfsdev_minor_alloc(void);
/* Verifies the znode is valid */
#define ZFS_VERIFY_ZP(zp) \
if ((zp)->z_sa_hdl == NULL) { \
if (__predict_false((zp)->z_sa_hdl == NULL)) { \
ZFS_EXIT((zp)->z_zfsvfs); \
return (EIO); \
} \

View File

@ -76,7 +76,7 @@ extern "C" {
#define ZFS_ENTER_ERROR(zfsvfs, error) \
do { \
rrm_enter_read(&(zfsvfs)->z_teardown_lock, FTAG); \
if ((zfsvfs)->z_unmounted) { \
if (unlikely((zfsvfs)->z_unmounted)) { \
ZFS_EXIT(zfsvfs); \
return (error); \
} \
@ -95,7 +95,7 @@ do { \
/* Verifies the znode is valid. */
#define ZFS_VERIFY_ZP_ERROR(zp, error) \
do { \
if ((zp)->z_sa_hdl == NULL) { \
if (unlikely((zp)->z_sa_hdl == NULL)) { \
ZFS_EXIT(ZTOZSB(zp)); \
return (error); \
} \