Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/ufs/lfs Merge logic from ulfs_close(), ulfs_getattr(), a...
details: https://anonhg.NetBSD.org/src/rev/d8a8c3afaa51
branches: trunk
changeset: 788813:d8a8c3afaa51
user: dholland <dholland%NetBSD.org@localhost>
date: Sun Jul 21 00:01:22 2013 +0000
description:
Merge logic from ulfs_close(), ulfs_getattr(), and ulfs_strategy()
into the preexisting lfs_*() versions of these functions, and delete
the unused ulfs copies.
diffstat:
sys/ufs/lfs/lfs_vnops.c | 20 ++++-
sys/ufs/lfs/ulfs_vnops.c | 146 +----------------------------------------------
2 files changed, 17 insertions(+), 149 deletions(-)
diffs (260 lines):
diff -r 5b5ac9a449a2 -r d8a8c3afaa51 sys/ufs/lfs/lfs_vnops.c
--- a/sys/ufs/lfs/lfs_vnops.c Sat Jul 20 23:00:08 2013 +0000
+++ b/sys/ufs/lfs/lfs_vnops.c Sun Jul 21 00:01:22 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: lfs_vnops.c,v 1.250 2013/07/20 22:14:49 dholland Exp $ */
+/* $NetBSD: lfs_vnops.c,v 1.251 2013/07/21 00:01:22 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.250 2013/07/20 22:14:49 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lfs_vnops.c,v 1.251 2013/07/21 00:01:22 dholland Exp $");
#ifdef _KERNEL_OPT
#include "opt_compat_netbsd.h"
@@ -772,6 +772,8 @@
struct inode *ip = VTOI(vp);
struct vattr *vap = ap->a_vap;
struct lfs *fs = ip->i_lfs;
+
+ fstrans_start(vp->v_mount, FSTRANS_SHARED);
/*
* Copy from inode table
*/
@@ -801,6 +803,7 @@
vap->va_bytes = lfs_fsbtob(fs, (u_quad_t)ip->i_lfs_effnblks);
vap->va_type = vp->v_type;
vap->va_filerev = ip->i_modrev;
+ fstrans_done(vp->v_mount);
return (0);
}
@@ -854,7 +857,9 @@
}
/*
- * Close called
+ * Close called.
+ *
+ * Update the times on the inode.
*/
/* ARGSUSED */
int
@@ -881,9 +886,11 @@
vp->v_mount->mnt_iflag & IMNT_UNMOUNT)
return 0;
+ fstrans_start(vp->v_mount, FSTRANS_SHARED);
if (vp->v_usecount > 1 && vp != ip->i_lfs->lfs_ivnode) {
LFS_ITIMES(ip, NULL, NULL, NULL);
}
+ fstrans_done(vp->v_mount);
return (0);
}
@@ -994,6 +1001,10 @@
/*
* Read a block from a storage device.
+ *
+ * Calculate the logical to physical mapping if not done already,
+ * then call the device strategy routine.
+ *
* In order to avoid reading blocks that are in the process of being
* written by the cleaner---and hence are not mutexed by the normal
* buffer cache / page cache mechanisms---check for collisions before
@@ -1112,8 +1123,7 @@
mutex_exit(&lfs_lock);
vp = ip->i_devvp;
- VOP_STRATEGY(vp, bp);
- return (0);
+ return VOP_STRATEGY(vp, bp);
}
/*
diff -r 5b5ac9a449a2 -r d8a8c3afaa51 sys/ufs/lfs/ulfs_vnops.c
--- a/sys/ufs/lfs/ulfs_vnops.c Sat Jul 20 23:00:08 2013 +0000
+++ b/sys/ufs/lfs/ulfs_vnops.c Sun Jul 21 00:01:22 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ulfs_vnops.c,v 1.14 2013/07/20 22:16:02 dholland Exp $ */
+/* $NetBSD: ulfs_vnops.c,v 1.15 2013/07/21 00:01:22 dholland Exp $ */
/* from NetBSD: ufs_vnops.c,v 1.213 2013/06/08 05:47:02 kardel Exp */
/*-
@@ -67,7 +67,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ulfs_vnops.c,v 1.14 2013/07/20 22:16:02 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ulfs_vnops.c,v 1.15 2013/07/21 00:01:22 dholland Exp $");
#if defined(_KERNEL_OPT)
#include "opt_lfs.h"
@@ -178,32 +178,6 @@
return (0);
}
-/*
- * Close called.
- *
- * Update the times on the inode.
- */
-/* ARGSUSED */
-int
-ulfs_close(void *v)
-{
- struct vop_close_args /* {
- struct vnode *a_vp;
- int a_fflag;
- kauth_cred_t a_cred;
- } */ *ap = v;
- struct vnode *vp;
- struct inode *ip;
-
- vp = ap->a_vp;
- ip = VTOI(vp);
- fstrans_start(vp->v_mount, FSTRANS_SHARED);
- if (vp->v_usecount > 1)
- ULFS_ITIMES(vp, NULL, NULL, NULL);
- fstrans_done(vp->v_mount);
- return (0);
-}
-
static int
ulfs_check_possible(struct vnode *vp, struct inode *ip, mode_t mode,
kauth_cred_t cred)
@@ -289,76 +263,6 @@
return error;
}
-/* ARGSUSED */
-int
-ulfs_getattr(void *v)
-{
- struct vop_getattr_args /* {
- struct vnode *a_vp;
- struct vattr *a_vap;
- kauth_cred_t a_cred;
- } */ *ap = v;
- struct vnode *vp;
- struct inode *ip;
- struct vattr *vap;
-
- vp = ap->a_vp;
- ip = VTOI(vp);
- vap = ap->a_vap;
- fstrans_start(vp->v_mount, FSTRANS_SHARED);
- ULFS_ITIMES(vp, NULL, NULL, NULL);
-
- /*
- * Copy from inode table
- */
- vap->va_fsid = ip->i_dev;
- vap->va_fileid = ip->i_number;
- vap->va_mode = ip->i_mode & ALLPERMS;
- vap->va_nlink = ip->i_nlink;
- vap->va_uid = ip->i_uid;
- vap->va_gid = ip->i_gid;
- vap->va_size = vp->v_size;
- if (ip->i_ump->um_fstype == ULFS1) {
- vap->va_rdev = (dev_t)ulfs_rw32(ip->i_ffs1_rdev,
- ULFS_MPNEEDSWAP(ip->i_ump));
- vap->va_atime.tv_sec = ip->i_ffs1_atime;
- vap->va_atime.tv_nsec = ip->i_ffs1_atimensec;
- vap->va_mtime.tv_sec = ip->i_ffs1_mtime;
- vap->va_mtime.tv_nsec = ip->i_ffs1_mtimensec;
- vap->va_ctime.tv_sec = ip->i_ffs1_ctime;
- vap->va_ctime.tv_nsec = ip->i_ffs1_ctimensec;
- vap->va_birthtime.tv_sec = 0;
- vap->va_birthtime.tv_nsec = 0;
- vap->va_bytes = dbtob((u_quad_t)ip->i_ffs1_blocks);
- } else {
- vap->va_rdev = (dev_t)ulfs_rw64(ip->i_ffs2_rdev,
- ULFS_MPNEEDSWAP(ip->i_ump));
- vap->va_atime.tv_sec = ip->i_ffs2_atime;
- vap->va_atime.tv_nsec = ip->i_ffs2_atimensec;
- vap->va_mtime.tv_sec = ip->i_ffs2_mtime;
- vap->va_mtime.tv_nsec = ip->i_ffs2_mtimensec;
- vap->va_ctime.tv_sec = ip->i_ffs2_ctime;
- vap->va_ctime.tv_nsec = ip->i_ffs2_ctimensec;
- vap->va_birthtime.tv_sec = ip->i_ffs2_birthtime;
- vap->va_birthtime.tv_nsec = ip->i_ffs2_birthnsec;
- vap->va_bytes = dbtob(ip->i_ffs2_blocks);
- }
- vap->va_gen = ip->i_gen;
- vap->va_flags = ip->i_flags;
-
- /* this doesn't belong here */
- if (vp->v_type == VBLK)
- vap->va_blocksize = BLKDEV_IOSIZE;
- else if (vp->v_type == VCHR)
- vap->va_blocksize = MAXBSIZE;
- else
- vap->va_blocksize = vp->v_mount->mnt_stat.f_iosize;
- vap->va_type = vp->v_type;
- vap->va_filerev = ip->i_modrev;
- fstrans_done(vp->v_mount);
- return (0);
-}
-
/*
* Set attribute vnode op. called from several syscalls
*/
@@ -1274,52 +1178,6 @@
}
/*
- * Calculate the logical to physical mapping if not done already,
- * then call the device strategy routine.
- */
-int
-ulfs_strategy(void *v)
-{
- struct vop_strategy_args /* {
- struct vnode *a_vp;
- struct buf *a_bp;
- } */ *ap = v;
- struct buf *bp;
- struct vnode *vp;
- struct inode *ip;
- int error;
-
- bp = ap->a_bp;
- vp = ap->a_vp;
- ip = VTOI(vp);
- if (vp->v_type == VBLK || vp->v_type == VCHR)
- panic("ulfs_strategy: spec");
- KASSERT(bp->b_bcount != 0);
- if (bp->b_blkno == bp->b_lblkno) {
- error = VOP_BMAP(vp, bp->b_lblkno, NULL, &bp->b_blkno,
- NULL);
- if (error) {
- bp->b_error = error;
- biodone(bp);
- return (error);
- }
- if (bp->b_blkno == -1) /* no valid data */
- clrbuf(bp);
- }
- if (bp->b_blkno < 0) { /* block is not on disk */
- biodone(bp);
- return (0);
- }
- vp = ip->i_devvp;
-
- error = VOP_STRATEGY(vp, bp);
- if (error)
- return error;
-
- return 0;
-}
-
-/*
* Print out the contents of an inode.
*/
int
Home |
Main Index |
Thread Index |
Old Index