Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/ufs/ufs unifdef -ULFS_READWRITE ufs_readwrite.c
details: https://anonhg.NetBSD.org/src/rev/0ee98b133a13
branches: trunk
changeset: 999827:0ee98b133a13
user: christos <christos%NetBSD.org@localhost>
date: Thu Jun 20 00:52:05 2019 +0000
description:
unifdef -ULFS_READWRITE ufs_readwrite.c
diffstat:
sys/ufs/ufs/ufs_readwrite.c | 77 +-------------------------------------------
1 files changed, 2 insertions(+), 75 deletions(-)
diffs (193 lines):
diff -r 7091f16676e3 -r 0ee98b133a13 sys/ufs/ufs/ufs_readwrite.c
--- a/sys/ufs/ufs/ufs_readwrite.c Thu Jun 20 00:49:11 2019 +0000
+++ b/sys/ufs/ufs/ufs_readwrite.c Thu Jun 20 00:52:05 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ufs_readwrite.c,v 1.123 2018/12/10 20:48:34 jdolecek Exp $ */
+/* $NetBSD: ufs_readwrite.c,v 1.124 2019/06/20 00:52:05 christos Exp $ */
/*-
* Copyright (c) 1993
@@ -32,28 +32,8 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(1, "$NetBSD: ufs_readwrite.c,v 1.123 2018/12/10 20:48:34 jdolecek Exp $");
+__KERNEL_RCSID(1, "$NetBSD: ufs_readwrite.c,v 1.124 2019/06/20 00:52:05 christos Exp $");
-#ifdef LFS_READWRITE
-#define FS struct lfs
-#define I_FS i_lfs
-#define READ lfs_read
-#define READ_S "lfs_read"
-#define WRITE lfs_write
-#define WRITE_S "lfs_write"
-#define BUFRD lfs_bufrd
-#define BUFWR lfs_bufwr
-#define fs_bsize lfs_bsize
-#define fs_bmask lfs_bmask
-#define UFS_WAPBL_BEGIN(mp) 0
-#define UFS_WAPBL_END(mp) do { } while (0)
-#define UFS_WAPBL_UPDATE(vp, access, modify, flags) do { } while (0)
-#define ufs_blkoff lfs_blkoff
-#define ufs_blksize lfs_blksize
-#define ufs_lblkno lfs_lblkno
-#define ufs_lblktosize lfs_lblktosize
-#define ufs_blkroundup lfs_blkroundup
-#else
#define FS struct fs
#define I_FS i_fs
#define READ ffs_read
@@ -67,7 +47,6 @@
#define ufs_lblkno ffs_lblkno
#define ufs_lblktosize ffs_lblktosize
#define ufs_blkroundup ffs_blkroundup
-#endif
static int ufs_post_read_update(struct vnode *, int, int);
static int ufs_post_write_update(struct vnode *, struct uio *, int,
@@ -106,20 +85,13 @@
/* XXX Eliminate me by refusing directory reads from userland. */
if (vp->v_type == VDIR)
return BUFRD(vp, uio, ioflag, ap->a_cred);
-#ifdef LFS_READWRITE
- /* XXX Eliminate me by using ufs_bufio in lfs. */
- if (vp->v_type == VREG && ip->i_number == LFS_IFILE_INUM)
- return BUFRD(vp, uio, ioflag, ap->a_cred);
-#endif
if ((u_int64_t)uio->uio_offset > ump->um_maxfilesize)
return (EFBIG);
if (uio->uio_resid == 0)
return (0);
-#ifndef LFS_READWRITE
if ((ip->i_flags & (SF_SNAPSHOT | SF_SNAPINVAL)) == SF_SNAPSHOT)
return ffs_snapshot_read(vp, uio, ioflag);
-#endif /* !LFS_READWRITE */
if (uio->uio_offset >= ip->i_size)
goto out;
@@ -177,9 +149,7 @@
if (uio->uio_resid == 0)
return 0;
-#ifndef LFS_READWRITE
KASSERT(!ISSET(ip->i_flags, (SF_SNAPSHOT | SF_SNAPINVAL)));
-#endif
if (uio->uio_offset >= ip->i_size)
goto out;
@@ -302,12 +272,6 @@
if (uio->uio_offset < 0 ||
(u_int64_t)uio->uio_offset + uio->uio_resid > ump->um_maxfilesize)
return (EFBIG);
-#ifdef LFS_READWRITE
- /* Disallow writes to the Ifile, even if noschg flag is removed */
- /* XXX can this go away when the Ifile is no longer in the namespace? */
- if (vp == fs->lfs_ivnode)
- return (EPERM);
-#endif
if (uio->uio_resid == 0)
return (0);
@@ -352,11 +316,6 @@
return error;
}
-#ifdef LFS_READWRITE
- async = true;
- lfs_availwait(fs, btofsb(fs, uio->uio_resid));
- lfs_check(vp, LFS_UNUSED_LBN, 0);
-#endif /* !LFS_READWRITE */
preallocoff = round_page(ufs_blkroundup(fs, MAX(osize, uio->uio_offset)));
aflag = ioflag & IO_SYNC ? B_SYNC : 0;
@@ -471,7 +430,6 @@
* XXXUBC simplistic async flushing.
*/
-#ifndef LFS_READWRITE
if (!async && oldoff >> 16 != uio->uio_offset >> 16) {
mutex_enter(vp->v_interlock);
error = VOP_PUTPAGES(vp, (oldoff >> 16) << 16,
@@ -480,7 +438,6 @@
if (error)
break;
}
-#endif
}
if (error == 0 && ioflag & IO_SYNC) {
mutex_enter(vp->v_interlock);
@@ -513,9 +470,6 @@
daddr_t lbn;
int extended=0;
int error;
-#ifdef LFS_READWRITE
- bool need_unreserve = false;
-#endif
KASSERT(ISSET(ioflag, IO_NODELOCKED));
KASSERT(VOP_ISLOCKED(vp) == LK_EXCLUSIVE);
@@ -535,9 +489,6 @@
uio->uio_resid > ump->um_maxfilesize ||
uio->uio_offset > (ump->um_maxfilesize - uio->uio_resid))
return EFBIG;
-#ifdef LFS_READWRITE
- KASSERT(vp != fs->lfs_ivnode);
-#endif
if (uio->uio_resid == 0)
return 0;
@@ -548,10 +499,6 @@
KASSERT(vp->v_type != VREG);
-#ifdef LFS_READWRITE
- lfs_availwait(fs, btofsb(fs, uio->uio_resid));
- lfs_check(vp, LFS_UNUSED_LBN, 0);
-#endif /* !LFS_READWRITE */
/* XXX Should never have pages cached here. */
KASSERT(vp->v_uobj.uo_npages == 0);
@@ -564,13 +511,6 @@
else
flags &= ~B_CLRBUF;
-#ifdef LFS_READWRITE
- error = lfs_reserve(fs, vp, NULL,
- btofsb(fs, (UFS_NIADDR + 1) << fs->lfs_bshift));
- if (error)
- break;
- need_unreserve = true;
-#endif
error = UFS_BALLOC(vp, uio->uio_offset, xfersize, cred, flags,
&bp);
@@ -597,28 +537,15 @@
brelse(bp, BC_INVAL);
break;
}
-#ifdef LFS_READWRITE
- (void)VOP_BWRITE(bp->b_vp, bp);
- lfs_reserve(fs, vp, NULL,
- -btofsb(fs, (UFS_NIADDR + 1) << fs->lfs_bshift));
- need_unreserve = false;
-#else
if (ioflag & IO_SYNC)
(void)bwrite(bp);
else if (xfersize + blkoffset == fs->fs_bsize)
bawrite(bp);
else
bdwrite(bp);
-#endif
if (error || xfersize == 0)
break;
}
-#ifdef LFS_READWRITE
- if (need_unreserve) {
- lfs_reserve(fs, vp, NULL,
- -btofsb(fs, (UFS_NIADDR + 1) << fs->lfs_bshift));
- }
-#endif
error = ufs_post_write_update(vp, uio, ioflag, cred, osize, resid,
extended, error);
Home |
Main Index |
Thread Index |
Old Index