Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/ufs/lfs Migrate the miscellaneous ulfs-level info from s...
details: https://anonhg.NetBSD.org/src/rev/445d24570c52
branches: trunk
changeset: 788898:445d24570c52
user: dholland <dholland%NetBSD.org@localhost>
date: Sun Jul 28 01:10:49 2013 +0000
description:
Migrate the miscellaneous ulfs-level info from struct ulfsmount to
struct lfs.
Put them inside #ifdef _KERNEL there. They are not the only such
members, gross as that is. Unfortunately, moving struct lfs to
lfs_kernel.h does not work.
diffstat:
sys/ufs/lfs/lfs.h | 14 ++++++-
sys/ufs/lfs/lfs_balloc.c | 6 +-
sys/ufs/lfs/lfs_inode.c | 14 +++---
sys/ufs/lfs/lfs_rename.c | 21 +++++----
sys/ufs/lfs/lfs_vfsops.c | 36 +++++++++--------
sys/ufs/lfs/lfs_vnops.c | 9 ++-
sys/ufs/lfs/ulfs_bmap.c | 72 ++++++++++++++++++----------------
sys/ufs/lfs/ulfs_bswap.h | 6 +-
sys/ufs/lfs/ulfs_dirhash.c | 40 +++++++++---------
sys/ufs/lfs/ulfs_extern.h | 4 +-
sys/ufs/lfs/ulfs_lookup.c | 30 +++++++------
sys/ufs/lfs/ulfs_quota.c | 92 ++++++++++++++++++++++++++-----------------
sys/ufs/lfs/ulfs_quota1.c | 15 ++++--
sys/ufs/lfs/ulfs_quota2.c | 43 +++++++++++++-------
sys/ufs/lfs/ulfs_readwrite.c | 14 +++---
sys/ufs/lfs/ulfs_vnops.c | 50 ++++++++++++-----------
sys/ufs/lfs/ulfsmount.h | 19 ++------
17 files changed, 269 insertions(+), 216 deletions(-)
diffs (truncated from 1710 to 300 lines):
diff -r b02fdb28f3f4 -r 445d24570c52 sys/ufs/lfs/lfs.h
--- a/sys/ufs/lfs/lfs.h Sun Jul 28 01:05:52 2013 +0000
+++ b/sys/ufs/lfs/lfs.h Sun Jul 28 01:10:49 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: lfs.h,v 1.158 2013/07/28 01:05:52 dholland Exp $ */
+/* $NetBSD: lfs.h,v 1.159 2013/07/28 01:10:49 dholland Exp $ */
/* from NetBSD: dinode.h,v 1.22 2013/01/22 09:39:18 dholland Exp */
/* from NetBSD: dir.h,v 1.21 2009/07/22 04:49:19 dholland Exp */
@@ -995,6 +995,18 @@
int lfs_reclino; /* Inode being reclaimed */
int lfs_startseg; /* Segment we started writing at */
LIST_HEAD(, segdelta) lfs_segdhd; /* List of pending trunc accounting events */
+
+#ifdef _KERNEL
+ /* ULFS-level information */
+ u_int32_t um_flags; /* ULFS flags (below) */
+ u_long um_nindir; /* indirect ptrs per block */
+ u_long um_lognindir; /* log2 of um_nindir */
+ u_long um_bptrtodb; /* indir ptr to disk block */
+ u_long um_seqinc; /* inc between seq blocks */
+ int um_maxsymlinklen;
+ int um_dirblksiz;
+ u_int64_t um_maxfilesize;
+#endif
};
/* LFS_NINDIR is the number of indirects in a file system block. */
diff -r b02fdb28f3f4 -r 445d24570c52 sys/ufs/lfs/lfs_balloc.c
--- a/sys/ufs/lfs/lfs_balloc.c Sun Jul 28 01:05:52 2013 +0000
+++ b/sys/ufs/lfs/lfs_balloc.c Sun Jul 28 01:10:49 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: lfs_balloc.c,v 1.78 2013/07/28 01:05:52 dholland Exp $ */
+/* $NetBSD: lfs_balloc.c,v 1.79 2013/07/28 01:10:49 dholland Exp $ */
/*-
* Copyright (c) 1999, 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc.
@@ -60,7 +60,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: lfs_balloc.c,v 1.78 2013/07/28 01:05:52 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lfs_balloc.c,v 1.79 2013/07/28 01:10:49 dholland Exp $");
#if defined(_KERNEL_OPT)
#include "opt_quota.h"
@@ -225,7 +225,7 @@
* Do byte accounting all at once, so we can gracefully fail *before*
* we start assigning blocks.
*/
- frags = VFSTOULFS(vp->v_mount)->um_seqinc;
+ frags = fs->um_seqinc;
bcount = 0;
if (daddr == UNASSIGNED) {
bcount = frags;
diff -r b02fdb28f3f4 -r 445d24570c52 sys/ufs/lfs/lfs_inode.c
--- a/sys/ufs/lfs/lfs_inode.c Sun Jul 28 01:05:52 2013 +0000
+++ b/sys/ufs/lfs/lfs_inode.c Sun Jul 28 01:10:49 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: lfs_inode.c,v 1.133 2013/07/28 01:05:52 dholland Exp $ */
+/* $NetBSD: lfs_inode.c,v 1.134 2013/07/28 01:10:49 dholland Exp $ */
/*-
* Copyright (c) 1999, 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc.
@@ -60,7 +60,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: lfs_inode.c,v 1.133 2013/07/28 01:05:52 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lfs_inode.c,v 1.134 2013/07/28 01:10:49 dholland Exp $");
#if defined(_KERNEL_OPT)
#include "opt_quota.h"
@@ -213,7 +213,6 @@
size_t bc;
int obufsize, odb;
int usepc;
- struct ulfsmount *ump = oip->i_ump;
if (ovp->v_type == VCHR || ovp->v_type == VBLK ||
ovp->v_type == VFIFO || ovp->v_type == VSOCK) {
@@ -233,9 +232,11 @@
return (0);
}
+ fs = oip->i_lfs;
+
if (ovp->v_type == VLNK &&
- (oip->i_size < ump->um_maxsymlinklen ||
- (ump->um_maxsymlinklen == 0 &&
+ (oip->i_size < fs->um_maxsymlinklen ||
+ (fs->um_maxsymlinklen == 0 &&
oip->i_ffs1_blocks == 0))) {
#ifdef DIAGNOSTIC
if (length != 0)
@@ -250,7 +251,6 @@
oip->i_flag |= IN_CHANGE | IN_UPDATE;
return (lfs_update(ovp, NULL, NULL, 0));
}
- fs = oip->i_lfs;
lfs_imtime(fs);
osize = oip->i_size;
usepc = (ovp->v_type == VREG && ovp != fs->lfs_ivnode);
@@ -262,7 +262,7 @@
* value of osize is 0, length will be at least 1.
*/
if (osize < length) {
- if (length > ump->um_maxfilesize)
+ if (length > fs->um_maxfilesize)
return (EFBIG);
aflags = B_CLRBUF;
if (ioflag & IO_SYNC)
diff -r b02fdb28f3f4 -r 445d24570c52 sys/ufs/lfs/lfs_rename.c
--- a/sys/ufs/lfs/lfs_rename.c Sun Jul 28 01:05:52 2013 +0000
+++ b/sys/ufs/lfs/lfs_rename.c Sun Jul 28 01:10:49 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: lfs_rename.c,v 1.3 2013/07/28 00:37:07 dholland Exp $ */
+/* $NetBSD: lfs_rename.c,v 1.4 2013/07/28 01:10:49 dholland Exp $ */
/* from NetBSD: ufs_rename.c,v 1.6 2013/01/22 09:39:18 dholland Exp */
/*-
@@ -89,7 +89,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: lfs_rename.c,v 1.3 2013/07/28 00:37:07 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lfs_rename.c,v 1.4 2013/07/28 01:10:49 dholland Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -338,9 +338,9 @@
KASSERT(VTOI(vp)->i_ump != NULL);
#if (BYTE_ORDER == LITTLE_ENDIAN)
- swap = (ULFS_MPNEEDSWAP(VTOI(vp)->i_ump) == 0);
+ swap = (ULFS_IPNEEDSWAP(VTOI(vp)) == 0);
#else
- swap = (ULFS_MPNEEDSWAP(VTOI(vp)->i_ump) != 0);
+ swap = (ULFS_IPNEEDSWAP(VTOI(vp)) != 0);
#endif
return ((FSFMT(vp) && swap)? ep->d_type : ep->d_namlen);
@@ -357,6 +357,7 @@
const struct componentname *fcnp)
{
struct mount *mp;
+ struct lfs *fs;
struct ulfsmount *ump;
int needswap;
/* XXX int is a silly type for this; blame ulfsmount::um_dirblksiz. */
@@ -382,12 +383,14 @@
mp = dvp->v_mount;
ump = VFSTOULFS(mp);
+ fs = ump->um_lfs;
KASSERT(ump != NULL);
KASSERT(ump == VTOI(dvp)->i_ump);
+ KASSERT(fs == VTOI(dvp)->i_lfs);
- needswap = ULFS_MPNEEDSWAP(ump);
+ needswap = ULFS_MPNEEDSWAP(fs);
- dirblksiz = ump->um_dirblksiz;
+ dirblksiz = fs->um_dirblksiz;
KASSERT(0 < dirblksiz);
KASSERT((dirblksiz & (dirblksiz - 1)) == 0);
@@ -607,9 +610,9 @@
KASSERT(VTOI(vp)->i_ump != NULL);
#if (BYTE_ORDER == LITTLE_ENDIAN)
- swap = (ULFS_MPNEEDSWAP(VTOI(vp)->i_ump) == 0);
+ swap = (ULFS_IPNEEDSWAP(VTOI(vp)) == 0);
#else
- swap = (ULFS_MPNEEDSWAP(VTOI(vp)->i_ump) != 0);
+ swap = (ULFS_IPNEEDSWAP(VTOI(vp)) != 0);
#endif
return ((FSFMT(vp) && swap)?
@@ -642,7 +645,7 @@
return ENOTDIR;
*ino_ret = ulfs_rw32(dirbuf.dotdot_ino,
- ULFS_MPNEEDSWAP(VTOI(vp)->i_ump));
+ ULFS_IPNEEDSWAP(VTOI(vp)));
return 0;
}
diff -r b02fdb28f3f4 -r 445d24570c52 sys/ufs/lfs/lfs_vfsops.c
--- a/sys/ufs/lfs/lfs_vfsops.c Sun Jul 28 01:05:52 2013 +0000
+++ b/sys/ufs/lfs/lfs_vfsops.c Sun Jul 28 01:10:49 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: lfs_vfsops.c,v 1.309 2013/07/28 01:05:52 dholland Exp $ */
+/* $NetBSD: lfs_vfsops.c,v 1.310 2013/07/28 01:10:49 dholland Exp $ */
/*-
* Copyright (c) 1999, 2000, 2001, 2002, 2003, 2007, 2007
@@ -61,7 +61,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: lfs_vfsops.c,v 1.309 2013/07/28 01:05:52 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lfs_vfsops.c,v 1.310 2013/07/28 01:10:49 dholland Exp $");
#if defined(_KERNEL_OPT)
#include "opt_lfs.h"
@@ -118,9 +118,6 @@
MODULE(MODULE_CLASS_VFS, lfs, NULL);
static int lfs_gop_write(struct vnode *, struct vm_page **, int, int);
-static bool lfs_issequential_hole(const struct ulfsmount *,
- daddr_t, daddr_t);
-
static int lfs_mountfs(struct vnode *, struct mount *, struct lwp *);
static struct sysctllog *lfs_sysctl_log;
@@ -996,6 +993,16 @@
if (ronly == 0)
fs->lfs_fmod = 1;
+ /* ulfs-level information */
+ fs->um_flags = 0;
+ fs->um_bptrtodb = fs->lfs_ffshift - DEV_BSHIFT;
+ fs->um_seqinc = fs->lfs_frag;
+ fs->um_nindir = fs->lfs_nindir;
+ fs->um_lognindir = ffs(fs->lfs_nindir) - 1;
+ fs->um_maxsymlinklen = fs->lfs_maxsymlinklen;
+ fs->um_dirblksiz = LFS_DIRBLKSIZ;
+ fs->um_maxfilesize = fs->lfs_maxfilesize;
+
/* Initialize the mount structure. */
dev = devvp->v_rdev;
mp->mnt_data = ump;
@@ -1006,21 +1013,14 @@
mp->mnt_stat.f_iosize = fs->lfs_bsize;
mp->mnt_flag |= MNT_LOCAL;
mp->mnt_fs_bshift = fs->lfs_bshift;
- ump->um_flags = 0;
+ if (fs->um_maxsymlinklen > 0)
+ mp->mnt_iflag |= IMNT_DTYPE;
+
ump->um_mountp = mp;
ump->um_dev = dev;
ump->um_devvp = devvp;
- ump->um_bptrtodb = fs->lfs_ffshift - DEV_BSHIFT;
- ump->um_seqinc = fs->lfs_frag;
- ump->um_nindir = fs->lfs_nindir;
- ump->um_lognindir = ffs(fs->lfs_nindir) - 1;
for (i = 0; i < ULFS_MAXQUOTAS; i++)
ump->um_quotas[i] = NULLVP;
- ump->um_maxsymlinklen = fs->lfs_maxsymlinklen;
- ump->um_dirblksiz = LFS_DIRBLKSIZ;
- ump->um_maxfilesize = fs->lfs_maxfilesize;
- if (ump->um_maxsymlinklen > 0)
- mp->mnt_iflag |= IMNT_DTYPE;
devvp->v_specmountpoint = mp;
/* Set up reserved memory for pageout */
@@ -1574,9 +1574,11 @@
* we don't care about current daddr of them.
*/
static bool
-lfs_issequential_hole(const struct ulfsmount *ump,
+lfs_issequential_hole(const struct lfs *fs,
daddr_t daddr0, daddr_t daddr1)
{
+ (void)fs; /* not used */
+
daddr0 = (daddr_t)((int32_t)daddr0); /* XXX ondisk32 */
daddr1 = (daddr_t)((int32_t)daddr1); /* XXX ondisk32 */
@@ -1959,7 +1961,7 @@
ip = VTOI(vp);
memset(ip->i_lfs_fragsize, 0, ULFS_NDADDR * sizeof(*ip->i_lfs_fragsize));
- if (vp->v_type != VLNK || ip->i_size >= ip->i_ump->um_maxsymlinklen) {
+ if (vp->v_type != VLNK || ip->i_size >= ip->i_lfs->um_maxsymlinklen) {
#ifdef DEBUG
for (i = (ip->i_size + fs->lfs_bsize - 1) >> fs->lfs_bshift;
i < ULFS_NDADDR; i++) {
diff -r b02fdb28f3f4 -r 445d24570c52 sys/ufs/lfs/lfs_vnops.c
--- a/sys/ufs/lfs/lfs_vnops.c Sun Jul 28 01:05:52 2013 +0000
+++ b/sys/ufs/lfs/lfs_vnops.c Sun Jul 28 01:10:49 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: lfs_vnops.c,v 1.252 2013/07/28 01:05:52 dholland Exp $ */
+/* $NetBSD: lfs_vnops.c,v 1.253 2013/07/28 01:10:49 dholland Exp $ */
/*-
* Copyright (c) 1999, 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc.
@@ -60,7 +60,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: lfs_vnops.c,v 1.252 2013/07/28 01:05:52 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lfs_vnops.c,v 1.253 2013/07/28 01:10:49 dholland Exp $");
#ifdef _KERNEL_OPT
#include "opt_compat_netbsd.h"
@@ -595,16 +595,17 @@
ip->i_flag |= IN_ACCESS | IN_CHANGE | IN_UPDATE;
Home |
Main Index |
Thread Index |
Old Index