Author: kib
Date: Sat Oct  4 18:28:27 2014
New Revision: 272534
URL: https://svnweb.freebsd.org/changeset/base/272534

Log:
  Add IO_RANGELOCKED flag for vn_rdwr(9), which specifies that vnode is
  not locked, but range is.
  
  Tested by:    pho
  Sponsored by: The FreeBSD Foundation
  MFC after:    2 weeks

Modified:
  head/sys/kern/vfs_vnops.c
  head/sys/sys/vnode.h

Modified: head/sys/kern/vfs_vnops.c
==============================================================================
--- head/sys/kern/vfs_vnops.c   Sat Oct  4 18:00:15 2014        (r272533)
+++ head/sys/kern/vfs_vnops.c   Sat Oct  4 18:28:27 2014        (r272534)
@@ -504,13 +504,16 @@ vn_rdwr(enum uio_rw rw, struct vnode *vp
        error = 0;
 
        if ((ioflg & IO_NODELOCKED) == 0) {
-               if (rw == UIO_READ) {
-                       rl_cookie = vn_rangelock_rlock(vp, offset,
-                           offset + len);
-               } else {
-                       rl_cookie = vn_rangelock_wlock(vp, offset,
-                           offset + len);
-               }
+               if ((ioflg & IO_RANGELOCKED) == 0) {
+                       if (rw == UIO_READ) {
+                               rl_cookie = vn_rangelock_rlock(vp, offset,
+                                   offset + len);
+                       } else {
+                               rl_cookie = vn_rangelock_wlock(vp, offset,
+                                   offset + len);
+                       }
+               } else
+                       rl_cookie = NULL;
                mp = NULL;
                if (rw == UIO_WRITE) { 
                        if (vp->v_type != VCHR &&

Modified: head/sys/sys/vnode.h
==============================================================================
--- head/sys/sys/vnode.h        Sat Oct  4 18:00:15 2014        (r272533)
+++ head/sys/sys/vnode.h        Sat Oct  4 18:28:27 2014        (r272534)
@@ -305,6 +305,7 @@ struct vattr {
 #define        IO_NORMAL       0x0800          /* operate on regular data */
 #define        IO_NOMACCHECK   0x1000          /* MAC checks unnecessary */
 #define        IO_BUFLOCKED    0x2000          /* ffs flag; indir buf is 
locked */
+#define        IO_RANGELOCKED  0x4000          /* range locked */
 
 #define IO_SEQMAX      0x7F            /* seq heuristic max value */
 #define IO_SEQSHIFT    16              /* seq heuristic in upper 16 bits */
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to