The branch main has been updated by markj:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=b5a2bf512dbe5bc8535e28e9f584a08444965426

commit b5a2bf512dbe5bc8535e28e9f584a08444965426
Author:     Mark Johnston <ma...@freebsd.org>
AuthorDate: 2023-09-27 15:47:26 +0000
Commit:     Mark Johnston <ma...@freebsd.org>
CommitDate: 2023-09-27 16:00:00 +0000

    makefs/zfs: Use unsigned integers for indirect block level counts
    
    No functional change intended.
    
    MFC after:      1 week
    Sponsored by:   The FreeBSD Foundation
---
 usr.sbin/makefs/zfs.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/usr.sbin/makefs/zfs.c b/usr.sbin/makefs/zfs.c
index 4d45926fb33f..db302fe1e760 100644
--- a/usr.sbin/makefs/zfs.c
+++ b/usr.sbin/makefs/zfs.c
@@ -673,7 +673,7 @@ dnode_cursor_init(zfs_opt_t *zfs, zfs_objset_t *os, 
dnode_phys_t *dnode,
 }
 
 static void
-_dnode_cursor_flush(zfs_opt_t *zfs, struct dnode_cursor *c, int levels)
+_dnode_cursor_flush(zfs_opt_t *zfs, struct dnode_cursor *c, unsigned int 
levels)
 {
        blkptr_t *bp, *pbp;
        void *buf;
@@ -685,7 +685,7 @@ _dnode_cursor_flush(zfs_opt_t *zfs, struct dnode_cursor *c, 
int levels)
 
        blksz = MAXBLOCKSIZE;
        blkid = (c->dataoff / c->datablksz) / BLKPTR_PER_INDIR;
-       for (int level = 1; level <= levels; level++) {
+       for (unsigned int level = 1; level <= levels; level++) {
                buf = c->inddir[level - 1];
 
                if (level == c->dnode->dn_nlevels - 1) {
@@ -724,7 +724,7 @@ blkptr_t *
 dnode_cursor_next(zfs_opt_t *zfs, struct dnode_cursor *c, off_t off)
 {
        off_t blkid, l1id;
-       int levels;
+       unsigned int levels;
 
        if (c->dnode->dn_nlevels == 1) {
                assert(off < MAXBLOCKSIZE);
@@ -753,8 +753,9 @@ dnode_cursor_next(zfs_opt_t *zfs, struct dnode_cursor *c, 
off_t off)
 void
 dnode_cursor_finish(zfs_opt_t *zfs, struct dnode_cursor *c)
 {
-       int levels;
+       unsigned int levels;
 
+       assert(c->dnode->dn_nlevels > 0);
        levels = c->dnode->dn_nlevels - 1;
        if (levels > 0)
                _dnode_cursor_flush(zfs, c, levels);

Reply via email to