Module Name: src
Committed By: riastradh
Date: Sun Feb 23 08:49:34 UTC 2020
Modified Files:
src/sys/ufs/lfs: lfs.h lfs_alloc.c
Log Message:
Teach LFS_ORPHAN_NEXTFREE about lfs64.
To generate a diff of this commit:
cvs rdiff -u -r1.204 -r1.205 src/sys/ufs/lfs/lfs.h
cvs rdiff -u -r1.139 -r1.140 src/sys/ufs/lfs/lfs_alloc.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/ufs/lfs/lfs.h
diff -u src/sys/ufs/lfs/lfs.h:1.204 src/sys/ufs/lfs/lfs.h:1.205
--- src/sys/ufs/lfs/lfs.h:1.204 Thu Jan 10 06:31:04 2019
+++ src/sys/ufs/lfs/lfs.h Sun Feb 23 08:49:34 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: lfs.h,v 1.204 2019/01/10 06:31:04 martin Exp $ */
+/* $NetBSD: lfs.h,v 1.205 2020/02/23 08:49:34 riastradh Exp $ */
/* from NetBSD: dinode.h,v 1.25 2016/01/22 23:06:10 dholland Exp */
/* from NetBSD: dir.h,v 1.25 2015/09/01 06:16:03 dholland Exp */
@@ -596,8 +596,9 @@ typedef union iinfo {
/* magic value for daddrs */
#define LFS_UNUSED_DADDR 0 /* out-of-band daddr */
-/* magic value for if_nextfree */
-#define LFS_ORPHAN_NEXTFREE (~(uint32_t)0) /* indicate orphaned file */
+/* magic value for if_nextfree -- indicate orphaned file */
+#define LFS_ORPHAN_NEXTFREE(fs) \
+ ((fs)->lfs_is64 ? ~(uint64_t)0 : ~(uint32_t)0)
typedef struct ifile64 IFILE64;
struct ifile64 {
Index: src/sys/ufs/lfs/lfs_alloc.c
diff -u src/sys/ufs/lfs/lfs_alloc.c:1.139 src/sys/ufs/lfs/lfs_alloc.c:1.140
--- src/sys/ufs/lfs/lfs_alloc.c:1.139 Sat Feb 22 00:32:08 2020
+++ src/sys/ufs/lfs/lfs_alloc.c Sun Feb 23 08:49:34 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: lfs_alloc.c,v 1.139 2020/02/22 00:32:08 kamil Exp $ */
+/* $NetBSD: lfs_alloc.c,v 1.140 2020/02/23 08:49:34 riastradh 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.139 2020/02/22 00:32:08 kamil Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lfs_alloc.c,v 1.140 2020/02/23 08:49:34 riastradh Exp $");
#if defined(_KERNEL_OPT)
#include "opt_quota.h"
@@ -757,7 +757,7 @@ lfs_order_freelist(struct lfs *fs)
* but presumably it doesn't work... not sure what
* happens to such files currently. -- dholland 20160806
*/
- if (lfs_if_getnextfree(fs, ifp) == LFS_ORPHAN_NEXTFREE &&
+ if (lfs_if_getnextfree(fs, ifp) == LFS_ORPHAN_NEXTFREE(fs) &&
VFS_VGET(fs->lfs_ivnode->v_mount, ino, LK_EXCLUSIVE, &vp)
== 0) {
unsigned segno;
@@ -852,6 +852,6 @@ lfs_orphan(struct lfs *fs, ino_t ino)
struct buf *bp;
LFS_IENTRY(ifp, fs, ino, bp);
- lfs_if_setnextfree(fs, ifp, LFS_ORPHAN_NEXTFREE);
+ lfs_if_setnextfree(fs, ifp, LFS_ORPHAN_NEXTFREE(fs));
LFS_BWRITE_LOG(bp);
}