Module Name: src Committed By: he Date: Tue Feb 22 20:25:54 UTC 2011
Modified Files: src/sys/ufs/ffs: ffs_snapshot.c Log Message: Move blocks_in_journal() in under #ifndef FFS_NO_SNAPSHOT, all uses are under that ifdef anyway; this allows build with FFS_NO_SNAPSHOT defined. To generate a diff of this commit: cvs rdiff -u -r1.106 -r1.107 src/sys/ufs/ffs/ffs_snapshot.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/ufs/ffs/ffs_snapshot.c diff -u src/sys/ufs/ffs/ffs_snapshot.c:1.106 src/sys/ufs/ffs/ffs_snapshot.c:1.107 --- src/sys/ufs/ffs/ffs_snapshot.c:1.106 Mon Feb 21 09:29:21 2011 +++ src/sys/ufs/ffs/ffs_snapshot.c Tue Feb 22 20:25:54 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: ffs_snapshot.c,v 1.106 2011/02/21 09:29:21 hannken Exp $ */ +/* $NetBSD: ffs_snapshot.c,v 1.107 2011/02/22 20:25:54 he Exp $ */ /* * Copyright 2000 Marshall Kirk McKusick. All Rights Reserved. @@ -38,7 +38,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: ffs_snapshot.c,v 1.106 2011/02/21 09:29:21 hannken Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ffs_snapshot.c,v 1.107 2011/02/22 20:25:54 he Exp $"); #if defined(_KERNEL_OPT) #include "opt_ffs.h" @@ -115,7 +115,9 @@ static int rwfsblk(struct vnode *, int, void *, daddr_t); static int syncsnap(struct vnode *); static int wrsnapblk(struct vnode *, void *, daddr_t); +#if !defined(FFS_NO_SNAPSHOT) static int blocks_in_journal(struct fs *); +#endif static inline bool is_active_snapshot(struct snap_info *, struct inode *); static inline daddr_t db_get(struct inode *, int); @@ -1282,6 +1284,33 @@ UFS_WAPBL_END(mp); return (0); } + +/* + * Number of blocks that fit into the journal or zero if not logging. + */ +static int +blocks_in_journal(struct fs *fs) +{ + off_t bpj; + + if ((fs->fs_flags & FS_DOWAPBL) == 0) + return 0; + bpj = 1; + if (fs->fs_journal_version == UFS_WAPBL_VERSION) { + switch (fs->fs_journal_location) { + case UFS_WAPBL_JOURNALLOC_END_PARTITION: + bpj = (off_t)fs->fs_journallocs[UFS_WAPBL_EPART_BLKSZ]* + fs->fs_journallocs[UFS_WAPBL_EPART_COUNT]; + break; + case UFS_WAPBL_JOURNALLOC_IN_FILESYSTEM: + bpj = (off_t)fs->fs_journallocs[UFS_WAPBL_INFS_BLKSZ]* + fs->fs_journallocs[UFS_WAPBL_INFS_COUNT]; + break; + } + } + bpj /= fs->fs_bsize; + return (bpj > 0 ? bpj : 1); +} #endif /* defined(FFS_NO_SNAPSHOT) */ /* @@ -2172,33 +2201,6 @@ } /* - * Number of blocks that fit into the journal or zero if not logging. - */ -static int -blocks_in_journal(struct fs *fs) -{ - off_t bpj; - - if ((fs->fs_flags & FS_DOWAPBL) == 0) - return 0; - bpj = 1; - if (fs->fs_journal_version == UFS_WAPBL_VERSION) { - switch (fs->fs_journal_location) { - case UFS_WAPBL_JOURNALLOC_END_PARTITION: - bpj = (off_t)fs->fs_journallocs[UFS_WAPBL_EPART_BLKSZ]* - fs->fs_journallocs[UFS_WAPBL_EPART_COUNT]; - break; - case UFS_WAPBL_JOURNALLOC_IN_FILESYSTEM: - bpj = (off_t)fs->fs_journallocs[UFS_WAPBL_INFS_BLKSZ]* - fs->fs_journallocs[UFS_WAPBL_INFS_COUNT]; - break; - } - } - bpj /= fs->fs_bsize; - return (bpj > 0 ? bpj : 1); -} - -/* * Get/Put direct block from inode or buffer containing disk addresses. Take * care for fs type (UFS1/UFS2) and byte swapping. These functions should go * into a global include.