diff options
author | Kirk McKusick <mckusick@FreeBSD.org> | 2019-05-28 16:32:04 +0000 |
---|---|---|
committer | Kirk McKusick <mckusick@FreeBSD.org> | 2019-05-28 16:32:04 +0000 |
commit | af6aeacb3e4cfd024dfdcea95f2421946d93c662 (patch) | |
tree | 51f7150ca2ffe1110dea1cf7e4e38cf8690fc0a5 /sys/ufs/ffs/ffs_snapshot.c | |
parent | 515fa27bb05ac17907b15965e9e380ad16a34f83 (diff) | |
download | src-af6aeacb3e4cfd024dfdcea95f2421946d93c662.tar.gz src-af6aeacb3e4cfd024dfdcea95f2421946d93c662.zip |
Convert use of UFS-specific #ifdef DEBUG to DIAGNOSTIC or INVARIANTS
as appropriate. No functional change intended.
Suggested-by: markj
Notes
Notes:
svn path=/head/; revision=348329
Diffstat (limited to 'sys/ufs/ffs/ffs_snapshot.c')
-rw-r--r-- | sys/ufs/ffs/ffs_snapshot.c | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/sys/ufs/ffs/ffs_snapshot.c b/sys/ufs/ffs/ffs_snapshot.c index 26185a28e4d8..36449e9cb2cf 100644 --- a/sys/ufs/ffs/ffs_snapshot.c +++ b/sys/ufs/ffs/ffs_snapshot.c @@ -70,7 +70,6 @@ __FBSDID("$FreeBSD$"); #include <ufs/ffs/ffs_extern.h> #define KERNCRED thread0.td_ucred -#define DEBUG 1 #include "opt_ffs.h" @@ -185,7 +184,7 @@ static int ffs_bp_snapblk(struct vnode *, struct buf *); */ int dopersistence = 0; -#ifdef DEBUG +#ifdef DIAGNOSTIC #include <sys/sysctl.h> SYSCTL_INT(_debug, OID_AUTO, dopersistence, CTLFLAG_RW, &dopersistence, 0, ""); static int snapdebug = 0; @@ -193,7 +192,7 @@ SYSCTL_INT(_debug, OID_AUTO, snapdebug, CTLFLAG_RW, &snapdebug, 0, ""); int collectsnapstats = 0; SYSCTL_INT(_debug, OID_AUTO, collectsnapstats, CTLFLAG_RW, &collectsnapstats, 0, ""); -#endif /* DEBUG */ +#endif /* DIAGNOSTIC */ /* * Create a snapshot file and initialize it for the filesystem. @@ -208,7 +207,6 @@ ffs_snapshot(mp, snapfile) int i, size, len, loc; ufs2_daddr_t blockno; uint64_t flag; - struct timespec starttime = {0, 0}, endtime; char saved_nice = 0; long redo = 0, snaplistsize = 0; int32_t *lp; @@ -225,6 +223,9 @@ ffs_snapshot(mp, snapfile) struct iovec aiov; struct snapdata *sn; struct ufsmount *ump; +#ifdef DIAGNOSTIC + struct timespec starttime = {0, 0}, endtime; +#endif ump = VFSTOUFS(mp); fs = ump->um_fs; @@ -441,8 +442,10 @@ restart: error = ENOENT; /* Snapshot file unlinked */ goto out1; } +#ifdef DIAGNOSTIC if (collectsnapstats) nanotime(&starttime); +#endif /* The last block might have changed. Copy it again to be sure. */ error = UFS_BALLOC(vp, lblktosize(fs, (off_t)(numblks - 1)), @@ -560,8 +563,10 @@ loop: continue; } VI_UNLOCK(xvp); +#ifdef DIAGNOSTIC if (snapdebug) vn_printf(xvp, "ffs_snapshot: busy vnode "); +#endif if (VOP_GETATTR(xvp, &vat, td->td_ucred) == 0 && vat.va_nlink > 0) { VOP_UNLOCK(xvp, 0); @@ -693,6 +698,7 @@ out1: * Resume operation on filesystem. */ vfs_write_resume(vp->v_mount, VR_START_WRITE | VR_NO_SUSPCLR); +#ifdef DIAGNOSTIC if (collectsnapstats && starttime.tv_sec > 0) { nanotime(&endtime); timespecsub(&endtime, &starttime, &endtime); @@ -700,6 +706,7 @@ out1: vp->v_mount->mnt_stat.f_mntonname, (long)endtime.tv_sec, endtime.tv_nsec / 1000000, redo, fs->fs_ncg); } +#endif if (copy_fs == NULL) goto out; /* @@ -1583,9 +1590,11 @@ ffs_snapgone(ip) break; if (xp != NULL) vrele(ITOV(ip)); +#ifdef DIAGNOSTIC else if (snapdebug) printf("ffs_snapgone: lost snapshot vnode %ju\n", (uintmax_t)ip->i_number); +#endif /* * Delete snapshot inode from superblock. Keep list dense. */ @@ -1849,7 +1858,7 @@ retry: * claim this block. */ if (size == fs->fs_bsize) { -#ifdef DEBUG +#ifdef DIAGNOSTIC if (snapdebug) printf("%s %ju lbn %jd from inum %ju\n", "Grabonremove: snapino", @@ -1894,7 +1903,7 @@ retry: td->td_pflags &= ~TDP_COWINPROGRESS; if (error) break; -#ifdef DEBUG +#ifdef DIAGNOSTIC if (snapdebug) printf("%s%ju lbn %jd %s %ju size %ld to blkno %jd\n", "Copyonremove: snapino ", (uintmax_t)ip->i_number, @@ -2384,7 +2393,7 @@ ffs_copyonwrite(devvp, bp) td->td_pflags &= ~TDP_COWINPROGRESS; if (error) break; -#ifdef DEBUG +#ifdef DIAGNOSTIC if (snapdebug) { printf("Copyonwrite: snapino %ju lbn %jd for ", (uintmax_t)ip->i_number, (intmax_t)lbn); |