Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src Use IINFO in lfs_writeinode().
details: https://anonhg.NetBSD.org/src/rev/4ce2a1c4f628
branches: trunk
changeset: 340812:4ce2a1c4f628
user: dholland <dholland%NetBSD.org@localhost>
date: Sat Oct 03 08:28:15 2015 +0000
description:
Use IINFO in lfs_writeinode().
(both the kernel and the userland copies)
diffstat:
sbin/fsck_lfs/segwrite.c | 13 +++++++------
sys/ufs/lfs/lfs_accessors.h | 5 ++++-
sys/ufs/lfs/lfs_segment.c | 15 ++++++++-------
sys/ufs/lfs/lfs_subr.c | 5 +++--
4 files changed, 22 insertions(+), 16 deletions(-)
diffs (122 lines):
diff -r 20f02d4055d2 -r 4ce2a1c4f628 sbin/fsck_lfs/segwrite.c
--- a/sbin/fsck_lfs/segwrite.c Sat Oct 03 08:27:55 2015 +0000
+++ b/sbin/fsck_lfs/segwrite.c Sat Oct 03 08:28:15 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: segwrite.c,v 1.44 2015/09/01 06:15:02 dholland Exp $ */
+/* $NetBSD: segwrite.c,v 1.45 2015/10/03 08:28:15 dholland Exp $ */
/*-
* Copyright (c) 2003 The NetBSD Foundation, Inc.
* All rights reserved.
@@ -254,7 +254,8 @@
SEGSUM *ssp;
daddr_t daddr;
ino_t ino;
- int i, ndx, fsb = 0;
+ IINFO *iip;
+ int i, fsb = 0;
int redo_ifile = 0;
struct timespec ts;
int gotblk = 0;
@@ -289,10 +290,10 @@
/* Set remaining space counters. */
sp->seg_bytes_left -= lfs_sb_getibsize(fs);
sp->sum_bytes_left -= LFS_BLKPTRSIZE(fs);
- ndx = lfs_sb_getsumsize(fs) / sizeof(uint32_t) -
- sp->ninodes / LFS_INOPB(fs) - 1;
- /* XXX ondisk32 */
- ((uint32_t *) (sp->segsum))[ndx] = daddr;
+
+ /* Store the address in the segment summary. */
+ iip = NTH_IINFO(fs, sp->segsum, sp->ninodes / LFS_INOPB(fs));
+ lfs_ii_setblock(fs, iip, daddr);
}
/* Update the inode times and copy the inode onto the inode page. */
ts.tv_nsec = 0;
diff -r 20f02d4055d2 -r 4ce2a1c4f628 sys/ufs/lfs/lfs_accessors.h
--- a/sys/ufs/lfs/lfs_accessors.h Sat Oct 03 08:27:55 2015 +0000
+++ b/sys/ufs/lfs/lfs_accessors.h Sat Oct 03 08:28:15 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: lfs_accessors.h,v 1.34 2015/10/03 08:27:38 dholland Exp $ */
+/* $NetBSD: lfs_accessors.h,v 1.35 2015/10/03 08:28:16 dholland 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 */
@@ -779,6 +779,9 @@
#define NEXTLOWER_IINFO(fs, iip) \
((IINFO *)((char *)(iip) - IINFOSIZE(fs)))
+#define NTH_IINFO(fs, buf, n) \
+ ((IINFO *)((char *)SEGSUM_IINFOSTART(fs, buf) - (n)*IINFOSIZE(fs)))
+
static __unused inline uint64_t
lfs_ii_getblock(STRUCT_LFS *fs, IINFO *iip)
{
diff -r 20f02d4055d2 -r 4ce2a1c4f628 sys/ufs/lfs/lfs_segment.c
--- a/sys/ufs/lfs/lfs_segment.c Sat Oct 03 08:27:55 2015 +0000
+++ b/sys/ufs/lfs/lfs_segment.c Sat Oct 03 08:28:15 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: lfs_segment.c,v 1.259 2015/09/01 06:08:37 dholland Exp $ */
+/* $NetBSD: lfs_segment.c,v 1.260 2015/10/03 08:28:16 dholland Exp $ */
/*-
* Copyright (c) 1999, 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc.
@@ -60,7 +60,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: lfs_segment.c,v 1.259 2015/09/01 06:08:37 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lfs_segment.c,v 1.260 2015/10/03 08:28:16 dholland Exp $");
#ifdef DEBUG
# define vndebug(vp, str) do { \
@@ -1032,7 +1032,8 @@
union lfs_dinode *cdp;
struct vnode *vp = ITOV(ip);
daddr_t daddr;
- int i, ndx;
+ IINFO *iip;
+ int i;
int redo_ifile = 0;
int gotblk = 0;
int count;
@@ -1116,10 +1117,10 @@
/* Set remaining space counters. */
sp->seg_bytes_left -= lfs_sb_getibsize(fs);
sp->sum_bytes_left -= sizeof(int32_t);
- ndx = lfs_sb_getsumsize(fs) / sizeof(int32_t) -
- sp->ninodes / LFS_INOPB(fs) - 1;
- /* XXX ondisk32 */
- ((int32_t *)(sp->segsum))[ndx] = daddr;
+
+ /* Store the address in the segment summary. */
+ iip = NTH_IINFO(fs, sp->segsum, sp->ninodes / LFS_INOPB(fs));
+ lfs_ii_setblock(fs, iip, daddr);
}
/* Check VU_DIROP in case there is a new file with no data blocks */
diff -r 20f02d4055d2 -r 4ce2a1c4f628 sys/ufs/lfs/lfs_subr.c
--- a/sys/ufs/lfs/lfs_subr.c Sat Oct 03 08:27:55 2015 +0000
+++ b/sys/ufs/lfs/lfs_subr.c Sat Oct 03 08:28:15 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: lfs_subr.c,v 1.85 2015/08/12 18:25:04 dholland Exp $ */
+/* $NetBSD: lfs_subr.c,v 1.86 2015/10/03 08:28:16 dholland Exp $ */
/*-
* Copyright (c) 1999, 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc.
@@ -60,7 +60,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: lfs_subr.c,v 1.85 2015/08/12 18:25:04 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lfs_subr.c,v 1.86 2015/10/03 08:28:16 dholland Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -145,6 +145,7 @@
"lfsclpl", &pool_allocator_nointr, IPL_NONE);
pool_init(&fs->lfs_segpool, sizeof(struct segment), 0, 0, 0,
"lfssegpool", &pool_allocator_nointr, IPL_NONE);
+ /* XXX: should this int32 be 32/64? */
maxbpp = ((lfs_sb_getsumsize(fs) - SEGSUM_SIZE(fs)) / sizeof(int32_t) + 2);
maxbpp = MIN(maxbpp, lfs_segsize(fs) / lfs_sb_getfsize(fs) + 2);
pool_init(&fs->lfs_bpppool, maxbpp * sizeof(struct buf *), 0, 0, 0,
Home |
Main Index |
Thread Index |
Old Index