Skip to content

Commit 459fbe7

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

File tree

2 files changed

+4
-13
lines changed

2 files changed

+4
-13
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
}

module/zfs/dnode.c

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2280,19 +2280,11 @@ dnode_spill_freed(dnode_t *dn)
22802280
uint64_t
22812281
dnode_block_freed(dnode_t *dn, uint64_t blkid)
22822282
{
2283-
void *dp = spa_get_dsl(dn->dn_objset->os_spa);
22842283
int i;
22852284

22862285
if (blkid == DMU_BONUS_BLKID)
22872286
return (FALSE);
22882287

2289-
/*
2290-
* If we're in the process of opening the pool, dp will not be
2291-
* set yet, but there shouldn't be anything dirty.
2292-
*/
2293-
if (dp == NULL)
2294-
return (FALSE);
2295-
22962288
if (dn->dn_free_txg)
22972289
return (TRUE);
22982290

0 commit comments

Comments
 (0)