Skip to content

Commit

Permalink
Remove extra newline from spa_set_allocator().
Browse files Browse the repository at this point in the history
zfs_dbgmsg() does not need newline at the end of the message.

While there, slightly update/sync FreeBSD __dprintf().

Reviewed by: Brian Behlendorf <[email protected]>
Signed-off-by:	Alexander Motin <[email protected]>
Sponsored by:	iXsystems, Inc.
Closes openzfs#16536
  • Loading branch information
amotin authored Sep 17, 2024
1 parent bca9b64 commit ac04407
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
15 changes: 11 additions & 4 deletions module/os/freebsd/zfs/zfs_debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -218,12 +218,19 @@ __dprintf(boolean_t dprint, const char *file, const char *func,
}

/*
* Get rid of trailing newline.
* Get rid of trailing newline for dprintf logs.
*/
nl = strrchr(buf, '\n');
if (nl != NULL)
*nl = '\0';
if (dprint && buf[0] != '\0') {
nl = &buf[strlen(buf) - 1];
if (*nl == '\n')
*nl = '\0';
}

/*
* To get this data:
*
* $ sysctl -n kstat.zfs.misc.dbgmsg
*/
__zfs_dbgmsg(buf);

kmem_free(buf, size);
Expand Down
2 changes: 1 addition & 1 deletion module/zfs/metaslab.c
Original file line number Diff line number Diff line change
Expand Up @@ -1679,7 +1679,7 @@ spa_set_allocator(spa_t *spa, const char *allocator)
int a = spa_find_allocator_byname(allocator);
if (a < 0) a = 0;
spa->spa_active_allocator = a;
zfs_dbgmsg("spa allocator: %s\n", metaslab_allocators[a].msop_name);
zfs_dbgmsg("spa allocator: %s", metaslab_allocators[a].msop_name);
}

int
Expand Down

0 comments on commit ac04407

Please sign in to comment.