Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ZFS_IOC_COUNT_FILLED does unnecessary txg_wait_synced() #13368

Merged
merged 2 commits into from
Mar 14, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 16 additions & 5 deletions module/zfs/dnode.c
Original file line number Diff line number Diff line change
Expand Up @@ -1764,20 +1764,29 @@ dnode_try_claim(objset_t *os, uint64_t object, int slots)
}

/*
* Checks if the dnode contains any uncommitted dirty records.
* Checks if the dnode might contain any uncommitted changes to data blocks.
* Dirty metadata (e.g. bonus buffer) does not count.
behlendorf marked this conversation as resolved.
Show resolved Hide resolved
*/
boolean_t
dnode_is_dirty(dnode_t *dn)
{
mutex_enter(&dn->dn_mtx);

for (int i = 0; i < TXG_SIZE; i++) {
if (multilist_link_active(&dn->dn_dirty_link[i])) {
list_t *list = &dn->dn_dirty_records[i];
for (dbuf_dirty_record_t *dr = list_head(list);
dr != NULL; dr = list_next(list, dr)) {
if (dr->dr_dbuf == NULL ||
(dr->dr_dbuf->db_blkid != DMU_BONUS_BLKID &&
dr->dr_dbuf->db_blkid != DMU_SPILL_BLKID)) {
mutex_exit(&dn->dn_mtx);
return (B_TRUE);
}
}
if (dn->dn_free_ranges[i] != NULL) {
mutex_exit(&dn->dn_mtx);
return (B_TRUE);
}
}

mutex_exit(&dn->dn_mtx);

return (B_FALSE);
Expand Down Expand Up @@ -2640,7 +2649,9 @@ dnode_next_offset(dnode_t *dn, int flags, uint64_t *offset,
rw_enter(&dn->dn_struct_rwlock, RW_READER);

if (dn->dn_phys->dn_nlevels == 0) {
error = SET_ERROR(ESRCH);
if (!(flags & DNODE_FIND_HOLE)) {
error = SET_ERROR(ESRCH);
}
goto out;
}

Expand Down