Skip to content

Commit ac04407

Browse files
authored
Remove extra newline from spa_set_allocator().
zfs_dbgmsg() does not need newline at the end of the message. While there, slightly update/sync FreeBSD __dprintf(). Reviewed by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Alexander Motin <mav@FreeBSD.org> Sponsored by: iXsystems, Inc. Closes openzfs#16536
1 parent bca9b64 commit ac04407

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

module/os/freebsd/zfs/zfs_debug.c

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -218,12 +218,19 @@ __dprintf(boolean_t dprint, const char *file, const char *func,
218218
}
219219

220220
/*
221-
* Get rid of trailing newline.
221+
* Get rid of trailing newline for dprintf logs.
222222
*/
223-
nl = strrchr(buf, '\n');
224-
if (nl != NULL)
225-
*nl = '\0';
223+
if (dprint && buf[0] != '\0') {
224+
nl = &buf[strlen(buf) - 1];
225+
if (*nl == '\n')
226+
*nl = '\0';
227+
}
226228

229+
/*
230+
* To get this data:
231+
*
232+
* $ sysctl -n kstat.zfs.misc.dbgmsg
233+
*/
227234
__zfs_dbgmsg(buf);
228235

229236
kmem_free(buf, size);

module/zfs/metaslab.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1679,7 +1679,7 @@ spa_set_allocator(spa_t *spa, const char *allocator)
16791679
int a = spa_find_allocator_byname(allocator);
16801680
if (a < 0) a = 0;
16811681
spa->spa_active_allocator = a;
1682-
zfs_dbgmsg("spa allocator: %s\n", metaslab_allocators[a].msop_name);
1682+
zfs_dbgmsg("spa allocator: %s", metaslab_allocators[a].msop_name);
16831683
}
16841684

16851685
int

0 commit comments

Comments
 (0)