Add branch prediction to ZFS_ENTER and ZFS_VERIFY_ZP macros
They are expected to fail only in corner cases. Reviewed-by: Ryan Moeller <ryan@iXsystems.com> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: Matt Macy <mmacy@FreeBSD.org> Signed-off-by: Mateusz Guzik <mjguzik@gmail.com> Closes #11153
This commit is contained in:
parent
455ea5bb1f
commit
bb21c0aa3b
|
@ -123,7 +123,7 @@ extern minor_t zfsdev_minor_alloc(void);
|
||||||
#define ZFS_ENTER(zfsvfs) \
|
#define ZFS_ENTER(zfsvfs) \
|
||||||
{ \
|
{ \
|
||||||
rrm_enter_read(&(zfsvfs)->z_teardown_lock, FTAG); \
|
rrm_enter_read(&(zfsvfs)->z_teardown_lock, FTAG); \
|
||||||
if ((zfsvfs)->z_unmounted) { \
|
if (__predict_false((zfsvfs)->z_unmounted)) { \
|
||||||
ZFS_EXIT(zfsvfs); \
|
ZFS_EXIT(zfsvfs); \
|
||||||
return (EIO); \
|
return (EIO); \
|
||||||
} \
|
} \
|
||||||
|
@ -134,7 +134,7 @@ extern minor_t zfsdev_minor_alloc(void);
|
||||||
|
|
||||||
/* Verifies the znode is valid */
|
/* Verifies the znode is valid */
|
||||||
#define ZFS_VERIFY_ZP(zp) \
|
#define ZFS_VERIFY_ZP(zp) \
|
||||||
if ((zp)->z_sa_hdl == NULL) { \
|
if (__predict_false((zp)->z_sa_hdl == NULL)) { \
|
||||||
ZFS_EXIT((zp)->z_zfsvfs); \
|
ZFS_EXIT((zp)->z_zfsvfs); \
|
||||||
return (EIO); \
|
return (EIO); \
|
||||||
} \
|
} \
|
||||||
|
|
|
@ -80,7 +80,7 @@ extern "C" {
|
||||||
#define ZFS_ENTER_ERROR(zfsvfs, error) \
|
#define ZFS_ENTER_ERROR(zfsvfs, error) \
|
||||||
do { \
|
do { \
|
||||||
rrm_enter_read(&(zfsvfs)->z_teardown_lock, FTAG); \
|
rrm_enter_read(&(zfsvfs)->z_teardown_lock, FTAG); \
|
||||||
if ((zfsvfs)->z_unmounted) { \
|
if (unlikely((zfsvfs)->z_unmounted)) { \
|
||||||
ZFS_EXIT(zfsvfs); \
|
ZFS_EXIT(zfsvfs); \
|
||||||
return (error); \
|
return (error); \
|
||||||
} \
|
} \
|
||||||
|
@ -103,7 +103,7 @@ do { \
|
||||||
/* Verifies the znode is valid. */
|
/* Verifies the znode is valid. */
|
||||||
#define ZFS_VERIFY_ZP_ERROR(zp, error) \
|
#define ZFS_VERIFY_ZP_ERROR(zp, error) \
|
||||||
do { \
|
do { \
|
||||||
if ((zp)->z_sa_hdl == NULL) { \
|
if (unlikely((zp)->z_sa_hdl == NULL)) { \
|
||||||
ZFS_EXIT(ZTOZSB(zp)); \
|
ZFS_EXIT(ZTOZSB(zp)); \
|
||||||
return (error); \
|
return (error); \
|
||||||
} \
|
} \
|
||||||
|
|
Loading…
Reference in New Issue