Skip to content

Commit cf2e36d

Browse files
committed
dmu_buf_will_clone: change assertion to fix 32-bit compiler warning
Building `module/zfs/dbuf.c` for 32-bit targets can result in a warning: In file included from /workspace/src/sys/contrib/openzfs/include/sys/zfs_context.h:97, from /workspace/src/sys/contrib/openzfs/module/zfs/dbuf.c:32: /workspace/src/sys/contrib/openzfs/module/zfs/dbuf.c: In function 'dmu_buf_will_clone': /workspace/src/sys/contrib/openzfs/lib/libspl/include/assert.h:116:33: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast] 116 | const uint64_t __left = (uint64_t)(LEFT); \ | ^ /workspace/src/sys/contrib/openzfs/lib/libspl/include/assert.h:148:25: note: in expansion of macro 'VERIFY0' 148 | #define ASSERT0 VERIFY0 | ^~~~~~~ /workspace/src/sys/contrib/openzfs/module/zfs/dbuf.c:2704:9: note: in expansion of macro 'ASSERT0' 2704 | ASSERT0(dbuf_find_dirty_eq(db, tx->tx_txg)); | ^~~~~~~ This is because `dbuf_find_dirty_eq()` returns a pointer, which if pointers are 32-bit results in a warning about the cast to `uint64_t`. Instead, use the `ASSERT3P()` macro, with `==` and `NULL` as second and third arguments, which should work regardless of the target's bitness. Signed-off-by: Dimitry Andric <[email protected]>
1 parent cad00d5 commit cf2e36d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

module/zfs/dbuf.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2701,7 +2701,7 @@ dmu_buf_will_clone(dmu_buf_t *db_fake, dmu_tx_t *tx)
27012701
*/
27022702
mutex_enter(&db->db_mtx);
27032703
VERIFY(!dbuf_undirty(db, tx));
2704-
ASSERT0(dbuf_find_dirty_eq(db, tx->tx_txg));
2704+
ASSERT3P(dbuf_find_dirty_eq(db, tx->tx_txg), ==, NULL);
27052705
if (db->db_buf != NULL) {
27062706
arc_buf_destroy(db->db_buf, db);
27072707
db->db_buf = NULL;

0 commit comments

Comments
 (0)