Source-Changes-HG archive

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

[src/uebayasi-xip]: src/sys/ufs/ffs Fragment size doesn't need to be page-ali...



details:   https://anonhg.NetBSD.org/src/rev/07d2d697171b
branches:  uebayasi-xip
changeset: 751817:07d2d697171b
user:      uebayasi <uebayasi%NetBSD.org@localhost>
date:      Mon Oct 25 08:07:22 2010 +0000

description:
Fragment size doesn't need to be page-aligned.

Return EINVAL if read-only mount option is not set, other failures
reported as ENXIO.

diffstat:

 sys/ufs/ffs/ffs_vfsops.c |  28 +++++++++++++++++-----------
 1 files changed, 17 insertions(+), 11 deletions(-)

diffs (57 lines):

diff -r 3c2696031d58 -r 07d2d697171b sys/ufs/ffs/ffs_vfsops.c
--- a/sys/ufs/ffs/ffs_vfsops.c  Sat Oct 23 02:34:17 2010 +0000
+++ b/sys/ufs/ffs/ffs_vfsops.c  Mon Oct 25 08:07:22 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ffs_vfsops.c,v 1.257.2.12 2010/10/21 17:45:21 uebayasi Exp $   */
+/*     $NetBSD: ffs_vfsops.c,v 1.257.2.13 2010/10/25 08:07:22 uebayasi Exp $   */
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -61,7 +61,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ffs_vfsops.c,v 1.257.2.12 2010/10/21 17:45:21 uebayasi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ffs_vfsops.c,v 1.257.2.13 2010/10/25 08:07:22 uebayasi Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_ffs.h"
@@ -1183,23 +1183,29 @@
        mp->mnt_iflag |= IMNT_MPSAFE;
 #ifdef XIP
 #define        FS_IS_PAGE_ALIGNED_P(fs) \
-       (((fs)->fs_bsize & PAGE_MASK) == 0 && \
-        ((fs)->fs_fsize & PAGE_MASK) == 0)
+       (((fs)->fs_bsize & PAGE_MASK) == 0)
 
        void *seg = NULL;
 
        if ((mp->mnt_flag & MNT_XIP) != 0) {
-               if ((mp->mnt_flag & MNT_RDONLY) != 0 &&
-                   VOP_IOCTL(devvp, DIOCGPHYSSEG, &seg, FREAD, cred) == 0 &&
-                   seg != NULL &&
-                   FS_IS_PAGE_ALIGNED_P(fs)) {
-                       mp->mnt_flag |= MNT_XIP;
-                       devvp->v_physseg = seg;
-               } else {
+               if ((mp->mnt_flag & MNT_RDONLY) == 0) {
+                       error = EINVAL;
+                       goto xip_check_done;
+               }
+               if (VOP_IOCTL(devvp, DIOCGPHYSSEG, &seg, FREAD, cred) != 0 ||
+                   seg == NULL ||
+                   !FS_IS_PAGE_ALIGNED_P(fs)) {
                        error = ENXIO;
+                       goto xip_check_done;
+               }
+
+xip_check_done:
+               if (error != 0) {
                        free(fs->fs_csp, M_UFSMNT);
                        goto out;
                }
+               mp->mnt_flag |= MNT_XIP;
+               devvp->v_physseg = seg;
        }
 #endif
 #ifdef FFS_EI



Home | Main Index | Thread Index | Old Index