Skip to content

Commit 8d81c8d

Browse files
committed
fixup to "Elide locking db_data and db_mtx where it seems safe"
On Linux, assert_db_data_contents_locked can't take the db pointer as a const pointer, because the rwsem_is_locked function requires mutable access .
1 parent 9772ffc commit 8d81c8d

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

include/sys/dbuf.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,11 @@ void assert_db_data_addr_locked(const dmu_buf_impl_t *db);
338338
* and by no other thread. Either it must be locked, or in a state where
339339
* locking is not required.
340340
*/
341-
void assert_db_data_contents_locked(const dmu_buf_impl_t *db, boolean_t writer);
341+
#ifdef __linux__
342+
void assert_db_data_contents_locked(dmu_buf_impl_t *db, boolean_t wr);
343+
#else
344+
void assert_db_data_contents_locked(const dmu_buf_impl_t *db, boolean_t wr);
345+
#endif
342346

343347
#define DBUF_HASH_MUTEX(h, idx) \
344348
(&(h)->hash_mutexes[(idx) & ((h)->hash_mutex_mask)])

module/zfs/dbuf.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,11 @@ assert_db_data_addr_locked(const dmu_buf_impl_t *db)
297297
}
298298

299299
void
300+
#ifdef __linux__
301+
assert_db_data_contents_locked(dmu_buf_impl_t *db, boolean_t writer)
302+
#else
300303
assert_db_data_contents_locked(const dmu_buf_impl_t *db, boolean_t writer)
304+
#endif
301305
{
302306
/*
303307
* db_rwlock protects indirect blocks and the data block of the meta

0 commit comments

Comments
 (0)