From 3fbdfc8af983f2304a5212b6a0986053864a7263 Mon Sep 17 00:00:00 2001 From: joerg Date: Mon, 10 Nov 2008 20:12:13 +0000 Subject: [PATCH] Reduce internals of WAPBL exposed to the rest of the system. --- sbin/fsck_ffs/wapbl.c | 5 +++-- sys/kern/vfs_wapbl.c | 20 ++++++++++++++++---- sys/sys/wapbl.h | 28 ++++++++++++++++------------ sys/ufs/ffs/ffs_vfsops.c | 7 +++---- sys/ufs/ffs/ffs_wapbl.c | 6 ++++-- 5 files changed, 42 insertions(+), 24 deletions(-) diff --git a/sbin/fsck_ffs/wapbl.c b/sbin/fsck_ffs/wapbl.c index 8e68b0750a87..1ee0b0b7a18a 100644 --- a/sbin/fsck_ffs/wapbl.c +++ b/sbin/fsck_ffs/wapbl.c @@ -1,4 +1,4 @@ -/* $NetBSD: wapbl.c,v 1.2 2008/07/31 05:38:04 simonb Exp $ */ +/* $NetBSD: wapbl.c,v 1.3 2008/11/10 20:12:13 joerg Exp $ */ /*- * Copyright (c) 2005,2008 The NetBSD Foundation, Inc. @@ -31,9 +31,10 @@ /* This file contains fsck support for wapbl */ +#define WAPBL_INTERNAL #include -__KERNEL_RCSID(0, "$NetBSD: wapbl.c,v 1.2 2008/07/31 05:38:04 simonb Exp $"); +__KERNEL_RCSID(0, "$NetBSD: wapbl.c,v 1.3 2008/11/10 20:12:13 joerg Exp $"); #include #include diff --git a/sys/kern/vfs_wapbl.c b/sys/kern/vfs_wapbl.c index 0e595f42cf48..15dcbbfbce29 100644 --- a/sys/kern/vfs_wapbl.c +++ b/sys/kern/vfs_wapbl.c @@ -1,4 +1,4 @@ -/* $NetBSD: vfs_wapbl.c,v 1.3 2008/08/11 02:45:27 yamt Exp $ */ +/* $NetBSD: vfs_wapbl.c,v 1.4 2008/11/10 20:12:13 joerg Exp $ */ /*- * Copyright (c) 2003,2008 The NetBSD Foundation, Inc. @@ -32,8 +32,11 @@ /* * This implements file system independent write ahead filesystem logging. */ + +#define WAPBL_INTERNAL + #include -__KERNEL_RCSID(0, "$NetBSD: vfs_wapbl.c,v 1.3 2008/08/11 02:45:27 yamt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vfs_wapbl.c,v 1.4 2008/11/10 20:12:13 joerg Exp $"); #include @@ -220,6 +223,12 @@ static struct wapbl_ino *wapbl_inodetrk_get(struct wapbl *wl, ino_t ino); static size_t wapbl_transaction_len(struct wapbl *wl); static __inline size_t wapbl_transaction_inodes_len(struct wapbl *wl); +#ifdef DEBUG +int wapbl_replay_verify(struct wapbl_replay *, struct vnode *); +#endif + +static int wapbl_replay_isopen1(struct wapbl_replay *); + /* * This is useful for debugging. If set, the log will * only be truncated when necessary. @@ -2358,9 +2367,10 @@ void wapbl_replay_stop(struct wapbl_replay *wr) { - WAPBL_PRINTF(WAPBL_PRINT_REPLAY, ("wapbl_replay_stop called\n")); + if (!wapbl_replay_isopen(wr)) + return; - KDASSERT(wapbl_replay_isopen(wr)); + WAPBL_PRINTF(WAPBL_PRINT_REPLAY, ("wapbl_replay_stop called\n")); wapbl_free(wr->wr_scratch); wr->wr_scratch = 0; @@ -2382,12 +2392,14 @@ wapbl_replay_free(struct wapbl_replay *wr) wapbl_free(wr); } +#ifdef _KERNEL int wapbl_replay_isopen1(struct wapbl_replay *wr) { return wapbl_replay_isopen(wr); } +#endif static int wapbl_replay_prescan(struct wapbl_replay *wr) diff --git a/sys/sys/wapbl.h b/sys/sys/wapbl.h index b985e906d83f..7435f7b955ea 100644 --- a/sys/sys/wapbl.h +++ b/sys/sys/wapbl.h @@ -1,4 +1,4 @@ -/* $NetBSD: wapbl.h,v 1.2 2008/07/31 05:38:06 simonb Exp $ */ +/* $NetBSD: wapbl.h,v 1.3 2008/11/10 20:12:13 joerg Exp $ */ /*- * Copyright (c) 2003,2008 The NetBSD Foundation, Inc. @@ -338,6 +338,7 @@ wapbl_vphaswapbl(struct vnode *vp) /****************************************************************/ /* Replay support */ +#ifdef WAPBL_INTERNAL struct wapbl_replay { struct vnode *wr_logvp; struct vnode *wr_devvp; @@ -361,21 +362,24 @@ struct wapbl_replay { #define wapbl_replay_isopen(wr) ((wr)->wr_scratch != 0) -int wapbl_replay_isopen1(struct wapbl_replay *); -int wapbl_replay_start(struct wapbl_replay **, struct vnode *, - daddr_t, size_t, size_t); -void wapbl_replay_stop(struct wapbl_replay *); -void wapbl_replay_free(struct wapbl_replay *); -int wapbl_replay_verify(struct wapbl_replay *, struct vnode *); -int wapbl_replay_write(struct wapbl_replay *, struct vnode *); -int wapbl_replay_read(struct wapbl_replay *, void *, daddr_t, long); - -/****************************************************************/ - /* Supply this to provide i/o support */ int wapbl_write(void *, size_t, struct vnode *, daddr_t); int wapbl_read(void *, size_t, struct vnode *, daddr_t); +/****************************************************************/ +#else +struct wapbl_replay; +#endif /* WAPBL_INTERNAL */ + +/****************************************************************/ + +int wapbl_replay_start(struct wapbl_replay **, struct vnode *, + daddr_t, size_t, size_t); +void wapbl_replay_stop(struct wapbl_replay *); +void wapbl_replay_free(struct wapbl_replay *); +int wapbl_replay_write(struct wapbl_replay *, struct vnode *); +int wapbl_replay_read(struct wapbl_replay *, void *, daddr_t, long); + /****************************************************************/ #endif /* !_SYS_WAPBL_H */ diff --git a/sys/ufs/ffs/ffs_vfsops.c b/sys/ufs/ffs/ffs_vfsops.c index 54bd52ccc0fb..ff8cb0f621a1 100644 --- a/sys/ufs/ffs/ffs_vfsops.c +++ b/sys/ufs/ffs/ffs_vfsops.c @@ -1,4 +1,4 @@ -/* $NetBSD: ffs_vfsops.c,v 1.239 2008/10/30 17:03:09 joerg Exp $ */ +/* $NetBSD: ffs_vfsops.c,v 1.240 2008/11/10 20:12:13 joerg Exp $ */ /*- * Copyright (c) 2008 The NetBSD Foundation, Inc. @@ -61,7 +61,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ffs_vfsops.c,v 1.239 2008/10/30 17:03:09 joerg Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ffs_vfsops.c,v 1.240 2008/11/10 20:12:13 joerg Exp $"); #if defined(_KERNEL_OPT) #include "opt_ffs.h" @@ -1325,8 +1325,7 @@ ffs_mountfs(struct vnode *devvp, struct mount *mp, struct lwp *l) out: #ifdef WAPBL if (mp->mnt_wapbl_replay) { - if (wapbl_replay_isopen(mp->mnt_wapbl_replay)) - wapbl_replay_stop(mp->mnt_wapbl_replay); + wapbl_replay_stop(mp->mnt_wapbl_replay); wapbl_replay_free(mp->mnt_wapbl_replay); mp->mnt_wapbl_replay = 0; } diff --git a/sys/ufs/ffs/ffs_wapbl.c b/sys/ufs/ffs/ffs_wapbl.c index 079326246b5b..a4509eaeaa25 100644 --- a/sys/ufs/ffs/ffs_wapbl.c +++ b/sys/ufs/ffs/ffs_wapbl.c @@ -1,4 +1,4 @@ -/* $NetBSD: ffs_wapbl.c,v 1.6 2008/09/08 03:16:43 joerg Exp $ */ +/* $NetBSD: ffs_wapbl.c,v 1.7 2008/11/10 20:12:13 joerg Exp $ */ /*- * Copyright (c) 2003,2006,2008 The NetBSD Foundation, Inc. @@ -30,7 +30,9 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ffs_wapbl.c,v 1.6 2008/09/08 03:16:43 joerg Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ffs_wapbl.c,v 1.7 2008/11/10 20:12:13 joerg Exp $"); + +#define WAPBL_INTERNAL #if defined(_KERNEL_OPT) #include "opt_ffs.h"