Source-Changes-HG archive

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

[src/trunk]: src Add flag to enforce file I/O even when bmap/strategy would b...



details:   https://anonhg.NetBSD.org/src/rev/9f8005720505
branches:  trunk
changeset: 433839:9f8005720505
user:      mlelstv <mlelstv%NetBSD.org@localhost>
date:      Sun Oct 07 11:51:26 2018 +0000

description:
Add flag to enforce file I/O even when bmap/strategy would be possible.
This makes it easier to compare both modes, it also allows coherent
operation between vnd device and image file.

diffstat:

 sys/dev/vnd.c                |   8 +++++---
 sys/dev/vndvar.h             |   4 +++-
 usr.sbin/vnconfig/vnconfig.8 |   7 +++++--
 usr.sbin/vnconfig/vnconfig.c |  13 ++++++++++---
 4 files changed, 23 insertions(+), 9 deletions(-)

diffs (137 lines):

diff -r 574dc8a36593 -r 9f8005720505 sys/dev/vnd.c
--- a/sys/dev/vnd.c     Sun Oct 07 11:25:55 2018 +0000
+++ b/sys/dev/vnd.c     Sun Oct 07 11:51:26 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vnd.c,v 1.266 2018/10/05 09:51:55 hannken Exp $        */
+/*     $NetBSD: vnd.c,v 1.267 2018/10/07 11:51:26 mlelstv Exp $        */
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2008 The NetBSD Foundation, Inc.
@@ -91,7 +91,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vnd.c,v 1.266 2018/10/05 09:51:55 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vnd.c,v 1.267 2018/10/07 11:51:26 mlelstv Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_vnd.h"
@@ -1243,6 +1243,8 @@
                fflags = FREAD;
                if ((vio->vnd_flags & VNDIOF_READONLY) == 0)
                        fflags |= FWRITE;
+               if ((vio->vnd_flags & VNDIOF_FILEIO) != 0)
+                       vnd->sc_flags |= VNF_USE_VN_RDWR;
                error = pathbuf_copyin(vio->vnd_file, &pb);
                if (error) {
                        goto unlock_and_exit;
@@ -1266,7 +1268,7 @@
 
                /* If using a compressed file, initialize its info */
                /* (or abort with an error if kernel has no compression) */
-               if (vio->vnd_flags & VNF_COMP) {
+               if (vio->vnd_flags & VNDIOF_COMP) {
 #ifdef VND_COMPRESSION
                        struct vnd_comp_header *ch;
                        int i;
diff -r 574dc8a36593 -r 9f8005720505 sys/dev/vndvar.h
--- a/sys/dev/vndvar.h  Sun Oct 07 11:25:55 2018 +0000
+++ b/sys/dev/vndvar.h  Sun Oct 07 11:51:26 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vndvar.h,v 1.37 2018/09/20 07:18:38 mlelstv Exp $      */
+/*     $NetBSD: vndvar.h,v 1.38 2018/10/07 11:51:26 mlelstv Exp $      */
 
 /*-
  * Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
@@ -98,6 +98,8 @@
 #define        VNDIOF_HASGEOM  0x01            /* use specified geometry */
 #define        VNDIOF_READONLY 0x02            /* as read-only device */
 #define        VNDIOF_FORCE    0x04            /* force close */
+#define        VNDIOF_FILEIO   0x08            /* have to use read/write */
+#define        VNDIOF_COMP     0x0400          /* must stay the same as VNF_COMP */
 
 #ifdef _KERNEL
 
diff -r 574dc8a36593 -r 9f8005720505 usr.sbin/vnconfig/vnconfig.8
--- a/usr.sbin/vnconfig/vnconfig.8      Sun Oct 07 11:25:55 2018 +0000
+++ b/usr.sbin/vnconfig/vnconfig.8      Sun Oct 07 11:51:26 2018 +0000
@@ -1,4 +1,4 @@
-.\"    $NetBSD: vnconfig.8,v 1.43 2018/05/01 09:03:49 uwe Exp $
+.\"    $NetBSD: vnconfig.8,v 1.44 2018/10/07 11:51:26 mlelstv Exp $
 .\"
 .\" Copyright (c) 1997 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -70,7 +70,7 @@
 .Sh SYNOPSIS
 .Nm
 .\" Fcf:lm:rt:uvz
-.Op Fl crvz
+.Op Fl crivz
 .Op Fl f Ar disktab
 .Op Fl t Ar typename
 .Ar vnode_disk
@@ -168,6 +168,9 @@
 then only vnd devices currently in use will be shown.
 .It Fl r
 Configure the device as read-only.
+.It Fl i
+Configure the device to use regular file I/O even when direct I/O using
+bmap/strategy would be possible.
 .It Fl t Ar typename
 If configuring the device, look up
 .Ar typename
diff -r 574dc8a36593 -r 9f8005720505 usr.sbin/vnconfig/vnconfig.c
--- a/usr.sbin/vnconfig/vnconfig.c      Sun Oct 07 11:25:55 2018 +0000
+++ b/usr.sbin/vnconfig/vnconfig.c      Sun Oct 07 11:51:26 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vnconfig.c,v 1.46 2018/03/12 01:15:00 christos Exp $   */
+/*     $NetBSD: vnconfig.c,v 1.47 2018/10/07 11:51:26 mlelstv Exp $    */
 
 /*-
  * Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -98,6 +98,7 @@
 
 static int     verbose = 0;
 static int     readonly = 0;
+static int     fileio = 0;
 static int     force = 0;
 static int     compressed = 0;
 static int     minimum = DUMMY_FREE;
@@ -116,7 +117,7 @@
        char *end;
        unsigned long cnt;
 
-       while ((ch = getopt(argc, argv, "Fcf:lm:rt:uvz")) != -1) {
+       while ((ch = getopt(argc, argv, "Fcf:lm:rit:uvz")) != -1) {
                switch (ch) {
                case 'F':
                        force = 1;
@@ -140,6 +141,9 @@
                case 'r':
                        readonly = 1;
                        break;
+               case 'i':
+                       fileio = 1;
+                       break;
                case 't':
                        tabname = optarg;
                        break;
@@ -321,6 +325,9 @@
        if (compressed)
                vndio.vnd_flags |= VNF_COMP;
 
+       if (fileio)
+               vndio.vnd_flags |= VNDIOF_FILEIO;
+
        /*
         * Clear (un-configure) the device
         */
@@ -425,7 +432,7 @@
 {
        const char *p = getprogname();
        (void)fprintf(stderr, 
-           "Usage: %s [-crvz] [-f dsktab] [-t type] vnode_disk"
+           "Usage: %s [-crivz] [-f dsktab] [-t type] vnode_disk"
                " reg-file [geomspec]\n"
            "       %s -u [-Fv] vnode_disk\n"
            "       %s -l [-m num | vnode_disk...]\n", p, p, p);



Home | Main Index | Thread Index | Old Index