Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/ufs/lfs Move stuff from struct ulfsmount to struct lfs.
details: https://anonhg.NetBSD.org/src/rev/37ad12794be6
branches: trunk
changeset: 341026:37ad12794be6
user: dholland <dholland%NetBSD.org@localhost>
date: Thu Oct 15 06:15:48 2015 +0000
description:
Move stuff from struct ulfsmount to struct lfs.
diffstat:
sys/ufs/lfs/lfs.h | 13 ++++++++++-
sys/ufs/lfs/lfs_syscalls.c | 22 ++++++++++--------
sys/ufs/lfs/lfs_vfsops.c | 54 +++++++++++++++++++++++++++------------------
sys/ufs/lfs/ulfsmount.h | 11 +--------
4 files changed, 57 insertions(+), 43 deletions(-)
diffs (279 lines):
diff -r 9fb9b73a8557 -r 37ad12794be6 sys/ufs/lfs/lfs.h
--- a/sys/ufs/lfs/lfs.h Thu Oct 15 06:15:22 2015 +0000
+++ b/sys/ufs/lfs/lfs.h Thu Oct 15 06:15:48 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: lfs.h,v 1.194 2015/10/03 08:29:34 dholland Exp $ */
+/* $NetBSD: lfs.h,v 1.195 2015/10/15 06:15:48 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 */
@@ -1028,6 +1028,10 @@
LIST_HEAD(, segdelta) lfs_segdhd; /* List of pending trunc accounting events */
#ifdef _KERNEL
+ /* The block device we're mounted on. */
+ dev_t lfs_dev;
+ struct vnode *lfs_devvp;
+
/* ULFS-level information */
u_int32_t um_flags; /* ULFS flags (below) */
u_long um_nindir; /* indirect ptrs per block */
@@ -1049,6 +1053,13 @@
int lfs_availsleep;
/* This one replaces &lfs_nextseg... all ditto */
int lfs_nextsegsleep;
+
+ /* Cleaner lwp, set on first bmapv syscall. */
+ struct lwp *lfs_cleaner_thread;
+
+ /* Hint from cleaner, only valid if curlwp == um_cleaner_thread. */
+ /* XXX change this to BLOCK_INFO after resorting this file */
+ struct block_info *lfs_cleaner_hint;
#endif
};
diff -r 9fb9b73a8557 -r 37ad12794be6 sys/ufs/lfs/lfs_syscalls.c
--- a/sys/ufs/lfs/lfs_syscalls.c Thu Oct 15 06:15:22 2015 +0000
+++ b/sys/ufs/lfs/lfs_syscalls.c Thu Oct 15 06:15:48 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: lfs_syscalls.c,v 1.171 2015/10/10 22:34:33 dholland Exp $ */
+/* $NetBSD: lfs_syscalls.c,v 1.172 2015/10/15 06:15:48 dholland Exp $ */
/*-
* Copyright (c) 1999, 2000, 2001, 2002, 2003, 2007, 2007, 2008
@@ -61,7 +61,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: lfs_syscalls.c,v 1.171 2015/10/10 22:34:33 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lfs_syscalls.c,v 1.172 2015/10/15 06:15:48 dholland Exp $");
#ifndef LFS
# define LFS /* for prototypes in syscallargs.h */
@@ -657,18 +657,18 @@
if ((mntp = vfs_getvfs(fsidp)) == NULL)
return (ENOENT);
- ump = VFSTOULFS(mntp);
if ((error = vfs_busy(mntp, NULL)) != 0)
return (error);
- if (ump->um_cleaner_thread == NULL)
- ump->um_cleaner_thread = curlwp;
- KASSERT(ump->um_cleaner_thread == curlwp);
+ ump = VFSTOULFS(mntp);
+ fs = ump->um_lfs;
+
+ if (fs->lfs_cleaner_thread == NULL)
+ fs->lfs_cleaner_thread = curlwp;
+ KASSERT(fs->lfs_cleaner_thread == curlwp);
cnt = blkcnt;
- fs = VFSTOULFS(mntp)->um_lfs;
-
error = 0;
/* these were inside the initialization for the for loop */
@@ -976,12 +976,14 @@
struct vnode **vpp)
{
struct ulfsmount *ump;
+ struct lfs *fs;
int error;
ump = VFSTOULFS(mp);
- ump->um_cleaner_hint = blkp;
+ fs = ump->um_lfs;
+ fs->lfs_cleaner_hint = blkp;
error = vcache_get(mp, &ino, sizeof(ino), vpp);
- ump->um_cleaner_hint = NULL;
+ fs->lfs_cleaner_hint = NULL;
if (error)
return error;
error = vn_lock(*vpp, lk_flags);
diff -r 9fb9b73a8557 -r 37ad12794be6 sys/ufs/lfs/lfs_vfsops.c
--- a/sys/ufs/lfs/lfs_vfsops.c Thu Oct 15 06:15:22 2015 +0000
+++ b/sys/ufs/lfs/lfs_vfsops.c Thu Oct 15 06:15:48 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: lfs_vfsops.c,v 1.346 2015/10/10 22:33:57 dholland Exp $ */
+/* $NetBSD: lfs_vfsops.c,v 1.347 2015/10/15 06:15:48 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.346 2015/10/10 22:33:57 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lfs_vfsops.c,v 1.347 2015/10/15 06:15:48 dholland Exp $");
#if defined(_KERNEL_OPT)
#include "opt_lfs.h"
@@ -672,14 +672,21 @@
/*
* Be sure we're still naming the same device
* used for our initial mount
+ *
+ * XXX dholland 20151010: if namei gives us a
+ * different vnode for the same device,
+ * wouldn't it be better to use it going
+ * forward rather than ignore it in favor of
+ * the old one?
*/
ump = VFSTOULFS(mp);
- if (devvp != ump->um_devvp) {
- if (devvp->v_rdev != ump->um_devvp->v_rdev)
+ fs = ump->um_lfs;
+ if (devvp != fs->lfs_devvp) {
+ if (devvp->v_rdev != fs->lfs_devvp->v_rdev)
error = EINVAL;
else {
vrele(devvp);
- devvp = ump->um_devvp;
+ devvp = fs->lfs_devvp;
vref(devvp);
}
}
@@ -691,7 +698,8 @@
} else {
/* Use the extant mount */
ump = VFSTOULFS(mp);
- devvp = ump->um_devvp;
+ fs = ump->um_lfs;
+ devvp = fs->lfs_devvp;
vref(devvp);
}
}
@@ -1036,6 +1044,11 @@
if (ronly == 0)
fs->lfs_fmod = 1;
+ /* Device we're using */
+ dev = devvp->v_rdev;
+ fs->lfs_dev = dev;
+ fs->lfs_devvp = devvp;
+
/* ulfs-level information */
fs->um_flags = 0;
fs->um_bptrtodb = lfs_sb_getffshift(fs) - DEV_BSHIFT;
@@ -1055,7 +1068,6 @@
fs->lfs_quotaino[1] = 0;
/* Initialize the mount structure. */
- dev = devvp->v_rdev;
mp->mnt_data = ump;
mp->mnt_stat.f_fsidx.__fsid_val[0] = (long)dev;
mp->mnt_stat.f_fsidx.__fsid_val[1] = makefstype(MOUNT_LFS);
@@ -1070,8 +1082,6 @@
fs->lfs_hasolddirfmt = true;
ump->um_mountp = mp;
- ump->um_dev = dev;
- ump->um_devvp = devvp;
for (i = 0; i < ULFS_MAXQUOTAS; i++)
ump->um_quotas[i] = NULLVP;
spec_node_setmountedfs(devvp, mp);
@@ -1328,12 +1338,12 @@
vgone(fs->lfs_ivnode);
ronly = !fs->lfs_ronly;
- if (ump->um_devvp->v_type != VBAD)
- spec_node_setmountedfs(ump->um_devvp, NULL);
- vn_lock(ump->um_devvp, LK_EXCLUSIVE | LK_RETRY);
- error = VOP_CLOSE(ump->um_devvp,
+ if (fs->lfs_devvp->v_type != VBAD)
+ spec_node_setmountedfs(fs->lfs_devvp, NULL);
+ vn_lock(fs->lfs_devvp, LK_EXCLUSIVE | LK_RETRY);
+ error = VOP_CLOSE(fs->lfs_devvp,
ronly ? FREAD : FREAD|FWRITE, NOCRED);
- vput(ump->um_devvp);
+ vput(fs->lfs_devvp);
/* Complain about page leakage */
if (fs->lfs_pages > 0)
@@ -1486,7 +1496,7 @@
struct inode *ip;
union lfs_dinode *dp;
- ASSERT_NO_SEGLOCK(ump->um_lfs);
+ ASSERT_NO_SEGLOCK(fs);
/* Initialize the inode. */
ip = pool_get(&lfs_inode_pool, PR_WAITOK);
@@ -1498,10 +1508,10 @@
ip->i_din = dp;
ip->i_ump = ump;
ip->i_vnode = vp;
- ip->i_dev = ump->um_dev;
+ ip->i_dev = fs->lfs_dev;
lfs_dino_setinumber(fs, dp, ino);
ip->i_number = ino;
- ip->i_lfs = ump->um_lfs;
+ ip->i_lfs = fs;
ip->i_lfs_effnblks = 0;
SPLAY_INIT(&ip->i_lfs_lbtree);
ip->i_lfs_nbtree = 0;
@@ -1585,9 +1595,9 @@
ip = VTOI(vp);
/* If the cleaner supplied the inode, use it. */
- if (curlwp == ump->um_cleaner_thread && ump->um_cleaner_hint != NULL &&
- ump->um_cleaner_hint->bi_lbn == LFS_UNUSED_LBN) {
- dip = ump->um_cleaner_hint->bi_bp;
+ if (curlwp == fs->lfs_cleaner_thread && fs->lfs_cleaner_hint != NULL &&
+ fs->lfs_cleaner_hint->bi_lbn == LFS_UNUSED_LBN) {
+ dip = fs->lfs_cleaner_hint->bi_bp;
if (fs->lfs_is64) {
error = copyin(dip, &ip->i_din->u_64,
sizeof(struct lfs64_dinode));
@@ -1606,7 +1616,7 @@
/* Read in the disk contents for the inode, copy into the inode. */
retries = 0;
again:
- error = bread(ump->um_devvp, LFS_FSBTODB(fs, daddr),
+ error = bread(fs->lfs_devvp, LFS_FSBTODB(fs, daddr),
(lfs_sb_getversion(fs) == 1 ? lfs_sb_getbsize(fs) : lfs_sb_getibsize(fs)),
0, &bp);
if (error) {
@@ -2266,7 +2276,7 @@
* Finish inode initialization now that aliasing has been resolved.
*/
- ip->i_devvp = ump->um_devvp;
+ ip->i_devvp = fs->lfs_devvp;
vref(ip->i_devvp);
#if defined(LFS_QUOTA) || defined(LFS_QUOTA2)
ulfsquota_init(ip);
diff -r 9fb9b73a8557 -r 37ad12794be6 sys/ufs/lfs/ulfsmount.h
--- a/sys/ufs/lfs/ulfsmount.h Thu Oct 15 06:15:22 2015 +0000
+++ b/sys/ufs/lfs/ulfsmount.h Thu Oct 15 06:15:48 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ulfsmount.h,v 1.13 2015/05/31 15:48:03 hannken Exp $ */
+/* $NetBSD: ulfsmount.h,v 1.14 2015/10/15 06:15:48 dholland Exp $ */
/* from NetBSD: ufsmount.h,v 1.39 2012/10/19 17:09:08 drochner Exp */
/*
@@ -60,10 +60,6 @@
/* Abstract vfs-level filesystem structure. */
struct mount *um_mountp;
- /* The block device we're mounted on. */
- dev_t um_dev;
- struct vnode *um_devvp;
-
/* type of fs; currently always ULFS1, theoretically also ULFS2 */
u_long um_fstype;
@@ -73,11 +69,6 @@
/* Extended attribute information. */
struct ulfs_extattr_per_mount um_extattr;
- /* Cleaner lwp, set on first bmapv syscall. */
- struct lwp *um_cleaner_thread;
-
- /* Hint from cleaner, only valid if curlwp == um_cleaner_thread. */
- BLOCK_INFO *um_cleaner_hint;
/* Quota-related material. */
struct vnode *um_quotas[ULFS_MAXQUOTAS]; /* quota files */
kauth_cred_t um_cred[ULFS_MAXQUOTAS]; /* quota file access cred */
Home |
Main Index |
Thread Index |
Old Index