Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 27 Sep 2023 16:00:50 GMT
From:      Mark Johnston <markj@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: b5a2bf512dbe - main - makefs/zfs: Use unsigned integers for indirect block level counts
Message-ID:  <202309271600.38RG0oDF036394@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by markj:

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

commit b5a2bf512dbe5bc8535e28e9f584a08444965426
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2023-09-27 15:47:26 +0000
Commit:     Mark Johnston <markj@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);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202309271600.38RG0oDF036394>