Skip to content

Commit 5ed939d

Browse files
committed
Remove few pointer dereferences in dbuf_read().
Signed-off-by: Alexander Motin <[email protected]>
1 parent c3b6fd3 commit 5ed939d

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

module/zfs/dbuf.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1503,8 +1503,8 @@ dbuf_read_verify_dnode_crypt(dmu_buf_impl_t *db, uint32_t flags)
15031503

15041504
ASSERT(MUTEX_HELD(&db->db_mtx));
15051505

1506-
if (!os->os_encrypted || os->os_raw_receive ||
1507-
(flags & DB_RF_NO_DECRYPT) != 0)
1506+
if ((flags & DB_RF_NO_DECRYPT) != 0 ||
1507+
!os->os_encrypted || os->os_raw_receive)
15081508
return (0);
15091509

15101510
DB_DNODE_ENTER(db);
@@ -1738,8 +1738,6 @@ dbuf_read(dmu_buf_impl_t *db, zio_t *zio, uint32_t flags)
17381738

17391739
mutex_enter(&db->db_mtx);
17401740
if (db->db_state == DB_CACHED) {
1741-
spa_t *spa = dn->dn_objset->os_spa;
1742-
17431741
/*
17441742
* Ensure that this block's dnode has been decrypted if
17451743
* the caller has requested decrypted data.
@@ -1758,6 +1756,7 @@ dbuf_read(dmu_buf_impl_t *db, zio_t *zio, uint32_t flags)
17581756
(arc_is_encrypted(db->db_buf) ||
17591757
arc_is_unauthenticated(db->db_buf) ||
17601758
arc_get_compression(db->db_buf) != ZIO_COMPRESS_OFF)) {
1759+
spa_t *spa = dn->dn_objset->os_spa;
17611760
zbookmark_phys_t zb;
17621761

17631762
SET_BOOKMARK(&zb, dmu_objset_id(db->db_objset),
@@ -1774,13 +1773,13 @@ dbuf_read(dmu_buf_impl_t *db, zio_t *zio, uint32_t flags)
17741773
DB_DNODE_EXIT(db);
17751774
DBUF_STAT_BUMP(hash_hits);
17761775
} else if (db->db_state == DB_UNCACHED) {
1777-
spa_t *spa = dn->dn_objset->os_spa;
17781776
boolean_t need_wait = B_FALSE;
17791777

17801778
db_lock_type_t dblt = dmu_buf_lock_parent(db, RW_READER, FTAG);
17811779

17821780
if (zio == NULL &&
17831781
db->db_blkptr != NULL && !BP_IS_HOLE(db->db_blkptr)) {
1782+
spa_t *spa = dn->dn_objset->os_spa;
17841783
zio = zio_root(spa, NULL, NULL, ZIO_FLAG_CANFAIL);
17851784
need_wait = B_TRUE;
17861785
}

0 commit comments

Comments
 (0)