Skip to content

Commit d10ddf3

Browse files
committed
Respond to @amotin's latest comments
1 parent 935c307 commit d10ddf3

File tree

2 files changed

+6
-10
lines changed

2 files changed

+6
-10
lines changed

include/sys/dbuf.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,9 @@ typedef struct dmu_buf_impl {
274274
*/
275275
uint8_t db_pending_evict;
276276

277+
/* Number of TXGs in which this buffer is dirty. */
278+
uint8_t db_dirtycnt;
279+
277280
/* The buffer was partially read. More reads may follow. */
278281
uint8_t db_partial_read;
279282

@@ -293,12 +296,9 @@ typedef struct dmu_buf_impl {
293296
/* buffer holding our data */
294297
arc_buf_t *db_buf;
295298

296-
/* db_mtx protects the members below */
299+
/* db_mtx protects the members below, plus db_dirtycnt */
297300
kmutex_t db_mtx;
298301

299-
/* Number of TXGs in which this buffer is dirty. */
300-
uint8_t db_dirtycnt;
301-
302302
/*
303303
* Current state of the buffer
304304
*/

module/zfs/dnode.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1539,7 +1539,6 @@ dnode_hold_impl(objset_t *os, uint64_t object, int flag, int slots,
15391539
dnh = &dnc->dnc_children[0];
15401540

15411541
/* Initialize dnode slot status from dnode_phys_t */
1542-
rw_enter(&db->db_rwlock, RW_READER);
15431542
for (int i = 0; i < epb; i++) {
15441543
zrl_init(&dnh[i].dnh_zrlock);
15451544

@@ -1560,7 +1559,6 @@ dnode_hold_impl(objset_t *os, uint64_t object, int flag, int slots,
15601559
skip = 0;
15611560
}
15621561
}
1563-
rw_exit(&db->db_rwlock);
15641562

15651563
dmu_buf_init_user(&dnc->dnc_dbu, NULL,
15661564
dnode_buf_evict_async, NULL);
@@ -2206,11 +2204,9 @@ dnode_dirty_l1range(dnode_t *dn, uint64_t start_blkid, uint64_t end_blkid,
22062204
if (db == NULL)
22072205
db = avl_nearest(&dn->dn_dbufs, where, AVL_AFTER);
22082206
for (; db != NULL; db = AVL_NEXT(&dn->dn_dbufs, db)) {
2209-
mutex_enter(&db->db_mtx);
2210-
if (db->db_level != 1 || db->db_blkid >= end_blkid) {
2211-
mutex_exit(&db->db_mtx);
2207+
if (db->db_level != 1 || db->db_blkid >= end_blkid)
22122208
break;
2213-
}
2209+
mutex_enter(&db->db_mtx);
22142210
if (db->db_state != DB_EVICTING)
22152211
ASSERT(db->db_dirtycnt > 0);
22162212
mutex_exit(&db->db_mtx);

0 commit comments

Comments
 (0)