Create unwind log in global variable instead of automatic variable.
memory leak spotted by njoly's valgrind run
This commit is contained in:
parent
1fb57ddbb5
commit
8454e30192
@ -1,4 +1,4 @@
|
|||||||
/* $NetBSD: lfs_vfsops.c,v 1.279 2009/10/29 18:20:11 eeh Exp $ */
|
/* $NetBSD: lfs_vfsops.c,v 1.280 2009/11/17 17:08:57 pooka Exp $ */
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
* Copyright (c) 1999, 2000, 2001, 2002, 2003, 2007, 2007
|
* Copyright (c) 1999, 2000, 2001, 2002, 2003, 2007, 2007
|
||||||
@ -61,7 +61,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
__KERNEL_RCSID(0, "$NetBSD: lfs_vfsops.c,v 1.279 2009/10/29 18:20:11 eeh Exp $");
|
__KERNEL_RCSID(0, "$NetBSD: lfs_vfsops.c,v 1.280 2009/11/17 17:08:57 pooka Exp $");
|
||||||
|
|
||||||
#if defined(_KERNEL_OPT)
|
#if defined(_KERNEL_OPT)
|
||||||
#include "opt_lfs.h"
|
#include "opt_lfs.h"
|
||||||
@ -119,7 +119,6 @@ static bool lfs_issequential_hole(const struct ufsmount *,
|
|||||||
|
|
||||||
static int lfs_mountfs(struct vnode *, struct mount *, struct lwp *);
|
static int lfs_mountfs(struct vnode *, struct mount *, struct lwp *);
|
||||||
|
|
||||||
void lfs_sysctl_setup(struct sysctllog *);
|
|
||||||
static struct sysctllog *lfs_sysctl_log;
|
static struct sysctllog *lfs_sysctl_log;
|
||||||
|
|
||||||
extern const struct vnodeopv_desc lfs_vnodeop_opv_desc;
|
extern const struct vnodeopv_desc lfs_vnodeop_opv_desc;
|
||||||
@ -206,8 +205,8 @@ sysctl_lfs_dostats(SYSCTLFN_ARGS)
|
|||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
lfs_sysctl_setup(struct sysctllog *clog)
|
lfs_sysctl_setup(struct sysctllog **clog)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
extern int lfs_writeindir, lfs_dostats, lfs_clean_vnhead,
|
extern int lfs_writeindir, lfs_dostats, lfs_clean_vnhead,
|
||||||
@ -253,12 +252,12 @@ lfs_sysctl_setup(struct sysctllog *clog)
|
|||||||
{ "segs_reclaimed", "Number of segments reclaimed" },
|
{ "segs_reclaimed", "Number of segments reclaimed" },
|
||||||
};
|
};
|
||||||
|
|
||||||
sysctl_createv(&clog, 0, NULL, NULL,
|
sysctl_createv(clog, 0, NULL, NULL,
|
||||||
CTLFLAG_PERMANENT,
|
CTLFLAG_PERMANENT,
|
||||||
CTLTYPE_NODE, "vfs", NULL,
|
CTLTYPE_NODE, "vfs", NULL,
|
||||||
NULL, 0, NULL, 0,
|
NULL, 0, NULL, 0,
|
||||||
CTL_VFS, CTL_EOL);
|
CTL_VFS, CTL_EOL);
|
||||||
sysctl_createv(&clog, 0, NULL, NULL,
|
sysctl_createv(clog, 0, NULL, NULL,
|
||||||
CTLFLAG_PERMANENT,
|
CTLFLAG_PERMANENT,
|
||||||
CTLTYPE_NODE, "lfs",
|
CTLTYPE_NODE, "lfs",
|
||||||
SYSCTL_DESCR("Log-structured file system"),
|
SYSCTL_DESCR("Log-structured file system"),
|
||||||
@ -270,37 +269,37 @@ lfs_sysctl_setup(struct sysctllog *clog)
|
|||||||
* "5" is the order as taken from sys/mount.h
|
* "5" is the order as taken from sys/mount.h
|
||||||
*/
|
*/
|
||||||
|
|
||||||
sysctl_createv(&clog, 0, NULL, NULL,
|
sysctl_createv(clog, 0, NULL, NULL,
|
||||||
CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
|
CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
|
||||||
CTLTYPE_INT, "flushindir", NULL,
|
CTLTYPE_INT, "flushindir", NULL,
|
||||||
NULL, 0, &lfs_writeindir, 0,
|
NULL, 0, &lfs_writeindir, 0,
|
||||||
CTL_VFS, 5, LFS_WRITEINDIR, CTL_EOL);
|
CTL_VFS, 5, LFS_WRITEINDIR, CTL_EOL);
|
||||||
sysctl_createv(&clog, 0, NULL, NULL,
|
sysctl_createv(clog, 0, NULL, NULL,
|
||||||
CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
|
CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
|
||||||
CTLTYPE_INT, "clean_vnhead", NULL,
|
CTLTYPE_INT, "clean_vnhead", NULL,
|
||||||
NULL, 0, &lfs_clean_vnhead, 0,
|
NULL, 0, &lfs_clean_vnhead, 0,
|
||||||
CTL_VFS, 5, LFS_CLEAN_VNHEAD, CTL_EOL);
|
CTL_VFS, 5, LFS_CLEAN_VNHEAD, CTL_EOL);
|
||||||
sysctl_createv(&clog, 0, NULL, NULL,
|
sysctl_createv(clog, 0, NULL, NULL,
|
||||||
CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
|
CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
|
||||||
CTLTYPE_INT, "dostats",
|
CTLTYPE_INT, "dostats",
|
||||||
SYSCTL_DESCR("Maintain statistics on LFS operations"),
|
SYSCTL_DESCR("Maintain statistics on LFS operations"),
|
||||||
sysctl_lfs_dostats, 0, &lfs_dostats, 0,
|
sysctl_lfs_dostats, 0, &lfs_dostats, 0,
|
||||||
CTL_VFS, 5, LFS_DOSTATS, CTL_EOL);
|
CTL_VFS, 5, LFS_DOSTATS, CTL_EOL);
|
||||||
sysctl_createv(&clog, 0, NULL, NULL,
|
sysctl_createv(clog, 0, NULL, NULL,
|
||||||
CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
|
CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
|
||||||
CTLTYPE_INT, "pagetrip",
|
CTLTYPE_INT, "pagetrip",
|
||||||
SYSCTL_DESCR("How many dirty pages in fs triggers"
|
SYSCTL_DESCR("How many dirty pages in fs triggers"
|
||||||
" a flush"),
|
" a flush"),
|
||||||
NULL, 0, &lfs_fs_pagetrip, 0,
|
NULL, 0, &lfs_fs_pagetrip, 0,
|
||||||
CTL_VFS, 5, LFS_FS_PAGETRIP, CTL_EOL);
|
CTL_VFS, 5, LFS_FS_PAGETRIP, CTL_EOL);
|
||||||
sysctl_createv(&clog, 0, NULL, NULL,
|
sysctl_createv(clog, 0, NULL, NULL,
|
||||||
CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
|
CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
|
||||||
CTLTYPE_INT, "ignore_lazy_sync",
|
CTLTYPE_INT, "ignore_lazy_sync",
|
||||||
SYSCTL_DESCR("Lazy Sync is ignored entirely"),
|
SYSCTL_DESCR("Lazy Sync is ignored entirely"),
|
||||||
NULL, 0, &lfs_ignore_lazy_sync, 0,
|
NULL, 0, &lfs_ignore_lazy_sync, 0,
|
||||||
CTL_VFS, 5, LFS_IGNORE_LAZY_SYNC, CTL_EOL);
|
CTL_VFS, 5, LFS_IGNORE_LAZY_SYNC, CTL_EOL);
|
||||||
#ifdef LFS_KERNEL_RFW
|
#ifdef LFS_KERNEL_RFW
|
||||||
sysctl_createv(&clog, 0, NULL, NULL,
|
sysctl_createv(clog, 0, NULL, NULL,
|
||||||
CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
|
CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
|
||||||
CTLTYPE_INT, "rfw",
|
CTLTYPE_INT, "rfw",
|
||||||
SYSCTL_DESCR("Use in-kernel roll-forward on mount"),
|
SYSCTL_DESCR("Use in-kernel roll-forward on mount"),
|
||||||
@ -308,14 +307,14 @@ lfs_sysctl_setup(struct sysctllog *clog)
|
|||||||
CTL_VFS, 5, LFS_DO_RFW, CTL_EOL);
|
CTL_VFS, 5, LFS_DO_RFW, CTL_EOL);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
sysctl_createv(&clog, 0, NULL, NULL,
|
sysctl_createv(clog, 0, NULL, NULL,
|
||||||
CTLFLAG_PERMANENT,
|
CTLFLAG_PERMANENT,
|
||||||
CTLTYPE_NODE, "stats",
|
CTLTYPE_NODE, "stats",
|
||||||
SYSCTL_DESCR("Debugging options"),
|
SYSCTL_DESCR("Debugging options"),
|
||||||
NULL, 0, NULL, 0,
|
NULL, 0, NULL, 0,
|
||||||
CTL_VFS, 5, LFS_STATS, CTL_EOL);
|
CTL_VFS, 5, LFS_STATS, CTL_EOL);
|
||||||
for (i = 0; i < sizeof(struct lfs_stats) / sizeof(u_int); i++) {
|
for (i = 0; i < sizeof(struct lfs_stats) / sizeof(u_int); i++) {
|
||||||
sysctl_createv(&clog, 0, NULL, NULL,
|
sysctl_createv(clog, 0, NULL, NULL,
|
||||||
CTLFLAG_PERMANENT|CTLFLAG_READONLY,
|
CTLFLAG_PERMANENT|CTLFLAG_READONLY,
|
||||||
CTLTYPE_INT, stat_names[i].sname,
|
CTLTYPE_INT, stat_names[i].sname,
|
||||||
SYSCTL_DESCR(stat_names[i].lname),
|
SYSCTL_DESCR(stat_names[i].lname),
|
||||||
@ -324,14 +323,14 @@ lfs_sysctl_setup(struct sysctllog *clog)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
sysctl_createv(&clog, 0, NULL, NULL,
|
sysctl_createv(clog, 0, NULL, NULL,
|
||||||
CTLFLAG_PERMANENT,
|
CTLFLAG_PERMANENT,
|
||||||
CTLTYPE_NODE, "debug",
|
CTLTYPE_NODE, "debug",
|
||||||
SYSCTL_DESCR("Debugging options"),
|
SYSCTL_DESCR("Debugging options"),
|
||||||
NULL, 0, NULL, 0,
|
NULL, 0, NULL, 0,
|
||||||
CTL_VFS, 5, LFS_DEBUGLOG, CTL_EOL);
|
CTL_VFS, 5, LFS_DEBUGLOG, CTL_EOL);
|
||||||
for (i = 0; i < DLOG_MAX; i++) {
|
for (i = 0; i < DLOG_MAX; i++) {
|
||||||
sysctl_createv(&clog, 0, NULL, NULL,
|
sysctl_createv(clog, 0, NULL, NULL,
|
||||||
CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
|
CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
|
||||||
CTLTYPE_INT, dlog_names[i].sname,
|
CTLTYPE_INT, dlog_names[i].sname,
|
||||||
SYSCTL_DESCR(dlog_names[i].lname),
|
SYSCTL_DESCR(dlog_names[i].lname),
|
||||||
@ -351,7 +350,7 @@ lfs_modcmd(modcmd_t cmd, void *arg)
|
|||||||
error = vfs_attach(&lfs_vfsops);
|
error = vfs_attach(&lfs_vfsops);
|
||||||
if (error != 0)
|
if (error != 0)
|
||||||
break;
|
break;
|
||||||
lfs_sysctl_setup(lfs_sysctl_log);
|
lfs_sysctl_setup(&lfs_sysctl_log);
|
||||||
break;
|
break;
|
||||||
case MODULE_CMD_FINI:
|
case MODULE_CMD_FINI:
|
||||||
error = vfs_detach(&lfs_vfsops);
|
error = vfs_detach(&lfs_vfsops);
|
||||||
|
Loading…
Reference in New Issue
Block a user