Source-Changes-HG archive

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

[src/trunk]: src/sys/ufs/lfs Fix IFILE pointer calculation when scanning free...



details:   https://anonhg.NetBSD.org/src/rev/da9f4027fc2a
branches:  trunk
changeset: 340271:da9f4027fc2a
user:      mlelstv <mlelstv%NetBSD.org@localhost>
date:      Sat Aug 29 21:04:22 2015 +0000

description:
Fix IFILE pointer calculation when scanning freelist.

diffstat:

 sys/ufs/lfs/lfs_accessors.h |  11 ++++++++++-
 sys/ufs/lfs/lfs_alloc.c     |   6 +++---
 2 files changed, 13 insertions(+), 4 deletions(-)

diffs (52 lines):

diff -r 338bfb3e97f4 -r da9f4027fc2a sys/ufs/lfs/lfs_accessors.h
--- a/sys/ufs/lfs/lfs_accessors.h       Sat Aug 29 19:19:43 2015 +0000
+++ b/sys/ufs/lfs/lfs_accessors.h       Sat Aug 29 21:04:22 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: lfs_accessors.h,v 1.14 2015/08/19 20:33:29 dholland Exp $      */
+/*     $NetBSD: lfs_accessors.h,v 1.15 2015/08/29 21:04:22 mlelstv Exp $       */
 
 /*  from NetBSD: lfs.h,v 1.165 2015/07/24 06:59:32 dholland Exp  */
 /*  from NetBSD: dinode.h,v 1.22 2013/01/22 09:39:18 dholland Exp  */
@@ -494,6 +494,15 @@
        }                                                               \
        UNSHARE_IFLOCK(F);                                              \
 } while (0)
+#define LFS_IENTRY_NEXT(IP, F) do { \
+       if ((F)->lfs_is64) {                                            \
+               (IP) = (IFILE *)((IFILE64 *)(IP) + 1);                  \
+       } else if (lfs_sb_getversion(F) > 1) {                          \
+               (IP) = (IFILE *)((IFILE32 *)(IP) + 1);                  \
+       } else {                                                        \
+               (IP) = (IFILE *)((IFILE_V1 *)(IP) + 1);                 \
+       }                                                               \
+} while (0)
 
 #define LFS_DEF_IF_ACCESSOR(type, type32, field) \
        static __unused inline type                             \
diff -r 338bfb3e97f4 -r da9f4027fc2a sys/ufs/lfs/lfs_alloc.c
--- a/sys/ufs/lfs/lfs_alloc.c   Sat Aug 29 19:19:43 2015 +0000
+++ b/sys/ufs/lfs/lfs_alloc.c   Sat Aug 29 21:04:22 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: lfs_alloc.c,v 1.127 2015/08/12 18:28:01 dholland Exp $ */
+/*     $NetBSD: lfs_alloc.c,v 1.128 2015/08/29 21:04:22 mlelstv Exp $  */
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2002, 2003, 2007 The NetBSD Foundation, Inc.
@@ -60,7 +60,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: lfs_alloc.c,v 1.127 2015/08/12 18:28:01 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lfs_alloc.c,v 1.128 2015/08/29 21:04:22 mlelstv Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_quota.h"
@@ -586,7 +586,7 @@
                if (ino % lfs_sb_getifpb(fs) == 0)
                        LFS_IENTRY(ifp, fs, ino, bp);
                else
-                       ++ifp;
+                       LFS_IENTRY_NEXT(ifp, fs);
 
                /* Don't put zero or ifile on the free list */
                if (ino == LFS_UNUSED_INUM || ino == LFS_IFILE_INUM)



Home | Main Index | Thread Index | Old Index