Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/ufs/lfs unifdef -DLFS_READWRITE ulfs_readwrite.c



details:   https://anonhg.NetBSD.org/src/rev/ab6b5fdfc36f
branches:  trunk
changeset: 457330:ab6b5fdfc36f
user:      christos <christos%NetBSD.org@localhost>
date:      Thu Jun 20 00:49:11 2019 +0000

description:
unifdef -DLFS_READWRITE ulfs_readwrite.c

diffstat:

 sys/ufs/lfs/lfs_vnops.c      |   6 +--
 sys/ufs/lfs/ulfs_readwrite.c |  59 +------------------------------------------
 2 files changed, 4 insertions(+), 61 deletions(-)

diffs (215 lines):

diff -r 9e9e05b4eee2 -r ab6b5fdfc36f sys/ufs/lfs/lfs_vnops.c
--- a/sys/ufs/lfs/lfs_vnops.c   Thu Jun 20 00:45:18 2019 +0000
+++ b/sys/ufs/lfs/lfs_vnops.c   Thu Jun 20 00:49:11 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: lfs_vnops.c,v 1.323 2019/01/01 10:06:55 hannken Exp $  */
+/*     $NetBSD: lfs_vnops.c,v 1.324 2019/06/20 00:49:11 christos Exp $ */
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc.
@@ -125,7 +125,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: lfs_vnops.c,v 1.323 2019/01/01 10:06:55 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lfs_vnops.c,v 1.324 2019/06/20 00:49:11 christos Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -350,9 +350,7 @@
 const struct vnodeopv_desc lfs_fifoop_opv_desc =
        { &lfs_fifoop_p, lfs_fifoop_entries };
 
-#define        LFS_READWRITE
 #include <ufs/lfs/ulfs_readwrite.c>
-#undef LFS_READWRITE
 
 /*
  * Allocate a new inode.
diff -r 9e9e05b4eee2 -r ab6b5fdfc36f sys/ufs/lfs/ulfs_readwrite.c
--- a/sys/ufs/lfs/ulfs_readwrite.c      Thu Jun 20 00:45:18 2019 +0000
+++ b/sys/ufs/lfs/ulfs_readwrite.c      Thu Jun 20 00:49:11 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ulfs_readwrite.c,v 1.24 2017/06/10 05:29:36 maya Exp $ */
+/*     $NetBSD: ulfs_readwrite.c,v 1.25 2019/06/20 00:49:11 christos Exp $     */
 /*  from NetBSD: ufs_readwrite.c,v 1.120 2015/04/12 22:48:38 riastradh Exp  */
 
 /*-
@@ -33,9 +33,8 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(1, "$NetBSD: ulfs_readwrite.c,v 1.24 2017/06/10 05:29:36 maya Exp $");
+__KERNEL_RCSID(1, "$NetBSD: ulfs_readwrite.c,v 1.25 2019/06/20 00:49:11 christos Exp $");
 
-#ifdef LFS_READWRITE
 #define        FS                      struct lfs
 #define        I_FS                    i_lfs
 #define        READ                    lfs_read
@@ -46,17 +45,6 @@
 #define        BUFWR                   lfs_bufwr
 #define        fs_sb_getbsize(fs)      lfs_sb_getbsize(fs)
 #define        fs_bmask                lfs_bmask
-#else
-#define        FS                      struct fs
-#define        I_FS                    i_fs
-#define        READ                    ffs_read
-#define        READ_S                  "ffs_read"
-#define        WRITE                   ffs_write
-#define        WRITE_S                 "ffs_write"
-#define        BUFRD                   ffs_bufrd
-#define        BUFWR                   ffs_bufwr
-#define fs_sb_getbsize(fs)     (fs)->fs_bsize
-#endif
 
 static int     ulfs_post_read_update(struct vnode *, int, int);
 static int     ulfs_post_write_update(struct vnode *, struct uio *, int,
@@ -95,20 +83,14 @@
        /* 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 > fs->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;
@@ -167,9 +149,6 @@
        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;
@@ -283,12 +262,10 @@
        if (uio->uio_offset < 0 ||
            (u_int64_t)uio->uio_offset + uio->uio_resid > fs->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);
 
@@ -301,11 +278,9 @@
 
        KASSERT(vp->v_type == VREG);
 
-#ifdef LFS_READWRITE
        async = true;
        lfs_availwait(fs, lfs_btofsb(fs, uio->uio_resid));
        lfs_check(vp, LFS_UNUSED_LBN, 0);
-#endif /* !LFS_READWRITE */
 
        preallocoff = round_page(lfs_blkroundup(fs, MAX(osize, uio->uio_offset)));
        aflag = ioflag & IO_SYNC ? B_SYNC : 0;
@@ -420,18 +395,7 @@
                 * 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,
-                           (uio->uio_offset >> 16) << 16,
-                           PGO_CLEANIT | PGO_LAZY);
-                       if (error)
-                               break;
-               }
-#else
                __USE(async);
-#endif
        }
        if (error == 0 && ioflag & IO_SYNC) {
                mutex_enter(vp->v_interlock);
@@ -462,9 +426,7 @@
        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);
@@ -481,9 +443,7 @@
            uio->uio_resid > fs->um_maxfilesize ||
            uio->uio_offset > (fs->um_maxfilesize - uio->uio_resid))
                return EFBIG;
-#ifdef LFS_READWRITE
        KASSERT(vp != fs->lfs_ivnode);
-#endif
        if (uio->uio_resid == 0)
                return 0;
 
@@ -494,10 +454,8 @@
 
        KASSERT(vp->v_type != VREG);
 
-#ifdef LFS_READWRITE
        lfs_availwait(fs, lfs_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);
@@ -510,13 +468,11 @@
                else
                        flags &= ~B_CLRBUF;
 
-#ifdef LFS_READWRITE
                error = lfs_reserve(fs, vp, NULL,
                    lfs_btofsb(fs, (ULFS_NIADDR + 1) << lfs_sb_getbshift(fs)));
                if (error)
                        break;
                need_unreserve = true;
-#endif
                error = lfs_balloc(vp, uio->uio_offset, xfersize, cred, flags,
                    &bp);
 
@@ -543,28 +499,17 @@
                        brelse(bp, BC_INVAL);
                        break;
                }
-#ifdef LFS_READWRITE
                (void)VOP_BWRITE(bp->b_vp, bp);
                lfs_reserve(fs, vp, NULL,
                    -lfs_btofsb(fs, (ULFS_NIADDR + 1) << lfs_sb_getbshift(fs)));
                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,
                    -lfs_btofsb(fs, (ULFS_NIADDR + 1) << lfs_sb_getbshift(fs)));
        }
-#endif
 
        error = ulfs_post_write_update(vp, uio, ioflag, cred, osize, resid,
            extended, error);



Home | Main Index | Thread Index | Old Index