2002-05-15 00:03:53 +04:00
|
|
|
/* $NetBSD: lfs_debug.c,v 1.16 2002/05/14 20:03:53 perseant Exp $ */
|
1994-06-29 10:39:25 +04:00
|
|
|
|
1999-03-10 03:20:00 +03:00
|
|
|
/*-
|
Various bug-fixes to LFS, to wit:
Kernel:
* Add runtime quantity lfs_ravail, the number of disk-blocks reserved
for writing. Writes to the filesystem first reserve a maximum amount
of blocks before their write is allowed to proceed; after the blocks
are allocated the reserved total is reduced by a corresponding amount.
If the lfs_reserve function cannot immediately reserve the requested
number of blocks, the inode is unlocked, and the thread sleeps until
the cleaner has made enough space available for the blocks to be
reserved. In this way large files can be written to the filesystem
(or, smaller files can be written to a nearly-full but thoroughly
clean filesystem) and the cleaner can still function properly.
* Remove explicit switching on dlfs_minfreeseg from the kernel code; it
is now merely a fs-creation parameter used to compute dlfs_avail and
dlfs_bfree (and used by fsck_lfs(8) to check their accuracy). Its
former role is better assumed by a properly computed dlfs_avail.
* Bounds-check inode numbers submitted through lfs_bmapv and lfs_markv.
This prevents a panic, but, if the cleaner is feeding the filesystem
the wrong data, you are still in a world of hurt.
* Cleanup: remove explicit references of DEV_BSIZE in favor of
btodb()/dbtob().
lfs_cleanerd:
* Make -n mean "send N segments' blocks through a single call to
lfs_markv". Previously it had meant "clean N segments though N calls
to lfs_markv, before looking again to see if more need to be cleaned".
The new behavior gives better packing of direct data on disk with as
little metadata as possible, largely alleviating the problem that the
cleaner can consume more disk through inefficient use of metadata than
it frees by moving dirty data away from clean "holes" to produce
entirely clean segments.
* Make -b mean "read as many segments as necessary to write N segments
of dirty data back to disk", rather than its former meaning of "read
as many segments as necessary to free N segments worth of space". The
new meaning, combined with the new -n behavior described above,
further aids in cleaning storage efficiency as entire segments can be
written at once, using as few blocks as possible for segment summaries
and inode blocks.
* Make the cleaner take note of segments which could not be cleaned due
to error, and not attempt to clean them until they are entirely free
of dirty blocks. This prevents the case in which a cleanerd running
with -n 1 and without -b (formerly the default) would spin trying
repeatedly to clean a corrupt segment, while the remaining space
filled and deadlocked the filesystem.
* Update the lfs_cleanerd manual page to describe all the options,
including the changes mentioned here (in particular, the -b and -n
flags were previously undocumented).
fsck_lfs:
* Check, and optionally fix, lfs_avail (to an exact figure) and
lfs_bfree (within a margin of error) in pass 5.
newfs_lfs:
* Reduce the default dlfs_minfreeseg to 1/20 of the total segments.
* Add a warning if the sgs disklabel field is 16 (the default for FFS'
cpg, but not usually desirable for LFS' sgs: 5--8 is a better range).
* Change the calculation of lfs_avail and lfs_bfree, corresponding to
the kernel changes mentioned above.
mount_lfs:
* Add -N and -b options to pass corresponding -n and -b options to
lfs_cleanerd.
* Default to calling lfs_cleanerd with "-b -n 4".
[All of these changes were largely tested in the 1.5 branch, with the
idea that they (along with previous un-pulled-up work) could be applied
to the branch while it was still in ALPHA2; however my test system has
experienced corruption on another filesystem (/dev/console has gone
missing :^), and, while I believe this unrelated to the LFS changes, I
cannot with good conscience request that the changes be pulled up.]
2000-09-09 08:49:54 +04:00
|
|
|
* Copyright (c) 1999, 2000 The NetBSD Foundation, Inc.
|
1999-03-10 03:20:00 +03:00
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* This code is derived from software contributed to The NetBSD Foundation
|
|
|
|
* by Konrad E. Schroder <perseant@hhhh.org>.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
* 3. All advertising materials mentioning features or use of this software
|
|
|
|
* must display the following acknowledgement:
|
|
|
|
* This product includes software developed by the NetBSD
|
|
|
|
* Foundation, Inc. and its contributors.
|
|
|
|
* 4. Neither the name of The NetBSD Foundation nor the names of its
|
|
|
|
* contributors may be used to endorse or promote products derived
|
|
|
|
* from this software without specific prior written permission.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
|
|
|
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
|
|
|
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
|
|
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
|
|
|
|
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
|
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
|
|
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
|
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
|
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
|
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
|
|
* POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
*/
|
1994-06-08 15:41:58 +04:00
|
|
|
/*
|
|
|
|
* Copyright (c) 1991, 1993
|
|
|
|
* The Regents of the University of California. All rights reserved.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
* 3. All advertising materials mentioning features or use of this software
|
|
|
|
* must display the following acknowledgement:
|
|
|
|
* This product includes software developed by the University of
|
|
|
|
* California, Berkeley and its contributors.
|
|
|
|
* 4. Neither the name of the University nor the names of its contributors
|
|
|
|
* may be used to endorse or promote products derived from this software
|
|
|
|
* without specific prior written permission.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
|
|
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
|
|
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
* SUCH DAMAGE.
|
|
|
|
*
|
1994-06-29 10:39:25 +04:00
|
|
|
* @(#)lfs_debug.c 8.1 (Berkeley) 6/11/93
|
1994-06-08 15:41:58 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifdef DEBUG
|
2001-11-08 05:39:06 +03:00
|
|
|
|
|
|
|
#include <sys/cdefs.h>
|
2002-05-15 00:03:53 +04:00
|
|
|
__KERNEL_RCSID(0, "$NetBSD: lfs_debug.c,v 1.16 2002/05/14 20:03:53 perseant Exp $");
|
1994-06-08 15:41:58 +04:00
|
|
|
#include <sys/param.h>
|
1996-02-13 01:08:47 +03:00
|
|
|
#include <sys/systm.h>
|
1994-06-08 15:41:58 +04:00
|
|
|
#include <sys/namei.h>
|
|
|
|
#include <sys/vnode.h>
|
|
|
|
#include <sys/mount.h>
|
2002-05-15 00:03:53 +04:00
|
|
|
#include <sys/buf.h>
|
1994-06-08 15:41:58 +04:00
|
|
|
|
|
|
|
#include <ufs/ufs/inode.h>
|
|
|
|
#include <ufs/lfs/lfs.h>
|
|
|
|
#include <ufs/lfs/lfs_extern.h>
|
|
|
|
|
2002-05-15 00:03:53 +04:00
|
|
|
int lfs_lognum;
|
|
|
|
struct lfs_log_entry lfs_log[LFS_LOGLENGTH];
|
|
|
|
|
|
|
|
int lfs_bwrite_log(struct buf *bp, char *file, int line)
|
|
|
|
{
|
|
|
|
struct vop_bwrite_args a;
|
|
|
|
a.a_desc = VDESC(vop_bwrite);
|
|
|
|
a.a_bp = bp;
|
|
|
|
|
|
|
|
if (!(bp->b_flags & (B_DELWRI | B_GATHERED)))
|
|
|
|
LFS_ENTER_LOG("write", file, line, bp->b_lblkno, bp->b_flags);
|
|
|
|
return (VCALL(bp->b_vp, VOFFSET(vop_bwrite), &a));
|
|
|
|
}
|
|
|
|
|
|
|
|
void lfs_dumplog(void)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
for (i = lfs_lognum; i != (lfs_lognum - 1) % LFS_LOGLENGTH; i = (i + 1) % LFS_LOGLENGTH)
|
|
|
|
if (lfs_log[i].file) {
|
|
|
|
printf("lbn %d %s %lx %d %s\n",
|
|
|
|
lfs_log[i].block,
|
|
|
|
lfs_log[i].op,
|
|
|
|
lfs_log[i].flags,
|
|
|
|
lfs_log[i].line,
|
|
|
|
lfs_log[i].file + 56);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1994-06-08 15:41:58 +04:00
|
|
|
void
|
Merge the short-lived perseant-lfsv2 branch into the trunk.
Kernels and tools understand both v1 and v2 filesystems; newfs_lfs
generates v2 by default. Changes for the v2 layout include:
- Segments of non-PO2 size and arbitrary block offset, so these can be
matched to convenient physical characteristics of the partition (e.g.,
stripe or track size and offset).
- Address by fragment instead of by disk sector, paving the way for
non-512-byte-sector devices. In theory fragments can be as large
as you like, though in reality they must be smaller than MAXBSIZE in size.
- Use serial number and filesystem identifier to ensure that roll-forward
doesn't get old data and think it's new. Roll-forward is enabled for
v2 filesystems, though not for v1 filesystems by default.
- The inode free list is now a tailq, paving the way for undelete (undelete
is not yet implemented, but can be without further non-backwards-compatible
changes to disk structures).
- Inode atime information is kept in the Ifile, instead of on the inode;
that is, the inode is never written *just* because atime was changed.
Because of this the inodes remain near the file data on the disk, rather
than wandering all over as the disk is read repeatedly. This speeds up
repeated reads by a small but noticeable amount.
Other changes of note include:
- The ifile written by newfs_lfs can now be of arbitrary length, it is no
longer restricted to a single indirect block.
- Fixed an old bug where ctime was changed every time a vnode was created.
I need to look more closely to make sure that the times are only updated
during write(2) and friends, not after-the-fact during a segment write,
and certainly not by the cleaner.
2001-07-14 00:30:18 +04:00
|
|
|
lfs_dump_super(struct lfs *lfsp)
|
1994-06-08 15:41:58 +04:00
|
|
|
{
|
|
|
|
int i;
|
1999-03-10 03:20:00 +03:00
|
|
|
|
1996-10-13 01:58:44 +04:00
|
|
|
printf("%s%x\t%s%x\t%s%d\t%s%d\n",
|
1999-03-10 03:20:00 +03:00
|
|
|
"magic ", lfsp->lfs_magic,
|
|
|
|
"version ", lfsp->lfs_version,
|
|
|
|
"size ", lfsp->lfs_size,
|
|
|
|
"ssize ", lfsp->lfs_ssize);
|
1996-10-13 01:58:44 +04:00
|
|
|
printf("%s%d\t%s%d\t%s%d\t%s%d\n",
|
1999-03-10 03:20:00 +03:00
|
|
|
"dsize ", lfsp->lfs_dsize,
|
|
|
|
"bsize ", lfsp->lfs_bsize,
|
|
|
|
"fsize ", lfsp->lfs_fsize,
|
|
|
|
"frag ", lfsp->lfs_frag);
|
|
|
|
|
1996-10-13 01:58:44 +04:00
|
|
|
printf("%s%d\t%s%d\t%s%d\t%s%d\n",
|
1999-03-10 03:20:00 +03:00
|
|
|
"minfree ", lfsp->lfs_minfree,
|
|
|
|
"inopb ", lfsp->lfs_inopb,
|
|
|
|
"ifpb ", lfsp->lfs_ifpb,
|
|
|
|
"nindir ", lfsp->lfs_nindir);
|
|
|
|
|
1996-10-13 01:58:44 +04:00
|
|
|
printf("%s%d\t%s%d\t%s%d\t%s%d\n",
|
1999-03-10 03:20:00 +03:00
|
|
|
"nseg ", lfsp->lfs_nseg,
|
|
|
|
"nspf ", lfsp->lfs_nspf,
|
|
|
|
"cleansz ", lfsp->lfs_cleansz,
|
|
|
|
"segtabsz ", lfsp->lfs_segtabsz);
|
|
|
|
|
1998-03-01 05:20:01 +03:00
|
|
|
printf("%s%x\t%s%d\t%s%lx\t%s%d\n",
|
1999-03-10 03:20:00 +03:00
|
|
|
"segmask ", lfsp->lfs_segmask,
|
|
|
|
"segshift ", lfsp->lfs_segshift,
|
|
|
|
"bmask ", (unsigned long)lfsp->lfs_bmask,
|
|
|
|
"bshift ", lfsp->lfs_bshift);
|
|
|
|
|
1998-03-01 05:20:01 +03:00
|
|
|
printf("%s%lu\t%s%d\t%s%lx\t%s%u\n",
|
1999-03-10 03:20:00 +03:00
|
|
|
"ffmask ", (unsigned long)lfsp->lfs_ffmask,
|
|
|
|
"ffshift ", lfsp->lfs_ffshift,
|
|
|
|
"fbmask ", (unsigned long)lfsp->lfs_fbmask,
|
|
|
|
"fbshift ", lfsp->lfs_fbshift);
|
|
|
|
|
1996-10-13 01:58:44 +04:00
|
|
|
printf("%s%d\t%s%d\t%s%x\t%s%qx\n",
|
1999-03-10 03:20:00 +03:00
|
|
|
"sushift ", lfsp->lfs_sushift,
|
|
|
|
"fsbtodb ", lfsp->lfs_fsbtodb,
|
|
|
|
"cksum ", lfsp->lfs_cksum,
|
|
|
|
"maxfilesize ", (long long)lfsp->lfs_maxfilesize);
|
|
|
|
|
1996-10-13 01:58:44 +04:00
|
|
|
printf("Superblock disk addresses:");
|
1994-06-08 15:41:58 +04:00
|
|
|
for (i = 0; i < LFS_MAXNUMSB; i++)
|
1996-10-13 01:58:44 +04:00
|
|
|
printf(" %x", lfsp->lfs_sboffs[i]);
|
|
|
|
printf("\n");
|
1999-03-10 03:20:00 +03:00
|
|
|
|
1996-10-13 01:58:44 +04:00
|
|
|
printf("Checkpoint Info\n");
|
|
|
|
printf("%s%d\t%s%x\t%s%d\n",
|
1999-03-10 03:20:00 +03:00
|
|
|
"free ", lfsp->lfs_free,
|
|
|
|
"idaddr ", lfsp->lfs_idaddr,
|
|
|
|
"ifile ", lfsp->lfs_ifile);
|
1996-10-13 01:58:44 +04:00
|
|
|
printf("%s%x\t%s%d\t%s%x\t%s%x\t%s%x\t%s%x\n",
|
1999-03-10 03:20:00 +03:00
|
|
|
"bfree ", lfsp->lfs_bfree,
|
|
|
|
"nfiles ", lfsp->lfs_nfiles,
|
|
|
|
"lastseg ", lfsp->lfs_lastseg,
|
|
|
|
"nextseg ", lfsp->lfs_nextseg,
|
|
|
|
"curseg ", lfsp->lfs_curseg,
|
|
|
|
"offset ", lfsp->lfs_offset);
|
Merge the short-lived perseant-lfsv2 branch into the trunk.
Kernels and tools understand both v1 and v2 filesystems; newfs_lfs
generates v2 by default. Changes for the v2 layout include:
- Segments of non-PO2 size and arbitrary block offset, so these can be
matched to convenient physical characteristics of the partition (e.g.,
stripe or track size and offset).
- Address by fragment instead of by disk sector, paving the way for
non-512-byte-sector devices. In theory fragments can be as large
as you like, though in reality they must be smaller than MAXBSIZE in size.
- Use serial number and filesystem identifier to ensure that roll-forward
doesn't get old data and think it's new. Roll-forward is enabled for
v2 filesystems, though not for v1 filesystems by default.
- The inode free list is now a tailq, paving the way for undelete (undelete
is not yet implemented, but can be without further non-backwards-compatible
changes to disk structures).
- Inode atime information is kept in the Ifile, instead of on the inode;
that is, the inode is never written *just* because atime was changed.
Because of this the inodes remain near the file data on the disk, rather
than wandering all over as the disk is read repeatedly. This speeds up
repeated reads by a small but noticeable amount.
Other changes of note include:
- The ifile written by newfs_lfs can now be of arbitrary length, it is no
longer restricted to a single indirect block.
- Fixed an old bug where ctime was changed every time a vnode was created.
I need to look more closely to make sure that the times are only updated
during write(2) and friends, not after-the-fact during a segment write,
and certainly not by the cleaner.
2001-07-14 00:30:18 +04:00
|
|
|
printf("tstamp %llx\n", (long long)lfsp->lfs_tstamp);
|
1994-06-08 15:41:58 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
Merge the short-lived perseant-lfsv2 branch into the trunk.
Kernels and tools understand both v1 and v2 filesystems; newfs_lfs
generates v2 by default. Changes for the v2 layout include:
- Segments of non-PO2 size and arbitrary block offset, so these can be
matched to convenient physical characteristics of the partition (e.g.,
stripe or track size and offset).
- Address by fragment instead of by disk sector, paving the way for
non-512-byte-sector devices. In theory fragments can be as large
as you like, though in reality they must be smaller than MAXBSIZE in size.
- Use serial number and filesystem identifier to ensure that roll-forward
doesn't get old data and think it's new. Roll-forward is enabled for
v2 filesystems, though not for v1 filesystems by default.
- The inode free list is now a tailq, paving the way for undelete (undelete
is not yet implemented, but can be without further non-backwards-compatible
changes to disk structures).
- Inode atime information is kept in the Ifile, instead of on the inode;
that is, the inode is never written *just* because atime was changed.
Because of this the inodes remain near the file data on the disk, rather
than wandering all over as the disk is read repeatedly. This speeds up
repeated reads by a small but noticeable amount.
Other changes of note include:
- The ifile written by newfs_lfs can now be of arbitrary length, it is no
longer restricted to a single indirect block.
- Fixed an old bug where ctime was changed every time a vnode was created.
I need to look more closely to make sure that the times are only updated
during write(2) and friends, not after-the-fact during a segment write,
and certainly not by the cleaner.
2001-07-14 00:30:18 +04:00
|
|
|
lfs_dump_dinode(struct dinode *dip)
|
1994-06-08 15:41:58 +04:00
|
|
|
{
|
|
|
|
int i;
|
1999-03-10 03:20:00 +03:00
|
|
|
|
2000-04-24 01:10:26 +04:00
|
|
|
printf("%s%u\t%s%d\t%s%u\t%s%u\t%s%qu\t%s%d\n",
|
|
|
|
"mode ", dip->di_mode,
|
|
|
|
"nlink ", dip->di_nlink,
|
|
|
|
"uid ", dip->di_uid,
|
|
|
|
"gid ", dip->di_gid,
|
|
|
|
"size ", (long long)dip->di_size,
|
|
|
|
"blocks ", dip->di_blocks);
|
1996-10-13 01:58:44 +04:00
|
|
|
printf("inum %d\n", dip->di_inumber);
|
|
|
|
printf("Direct Addresses\n");
|
1994-06-08 15:41:58 +04:00
|
|
|
for (i = 0; i < NDADDR; i++) {
|
1996-10-13 01:58:44 +04:00
|
|
|
printf("\t%x", dip->di_db[i]);
|
1994-06-08 15:41:58 +04:00
|
|
|
if ((i % 6) == 5)
|
1996-10-13 01:58:44 +04:00
|
|
|
printf("\n");
|
1994-06-08 15:41:58 +04:00
|
|
|
}
|
|
|
|
for (i = 0; i < NIADDR; i++)
|
1996-10-13 01:58:44 +04:00
|
|
|
printf("\t%x", dip->di_ib[i]);
|
|
|
|
printf("\n");
|
1994-06-08 15:41:58 +04:00
|
|
|
}
|
1999-03-10 03:20:00 +03:00
|
|
|
|
|
|
|
void
|
|
|
|
lfs_check_segsum(struct lfs *fs, struct segment *sp, char *file, int line)
|
|
|
|
{
|
|
|
|
int actual, i;
|
|
|
|
#if 0
|
|
|
|
static int offset;
|
|
|
|
#endif
|
|
|
|
|
2001-11-24 00:44:25 +03:00
|
|
|
if ((actual = i = 1) == 1)
|
1999-03-10 03:20:00 +03:00
|
|
|
return; /* XXXX not checking this anymore, really */
|
|
|
|
|
2001-11-24 00:44:25 +03:00
|
|
|
if (sp->sum_bytes_left >= sizeof(FINFO) - sizeof(ufs_daddr_t)
|
1999-03-10 03:20:00 +03:00
|
|
|
&& sp->fip->fi_nblocks > 512) {
|
|
|
|
printf("%s:%d: fi_nblocks = %d\n",file,line,sp->fip->fi_nblocks);
|
|
|
|
#ifdef DDB
|
|
|
|
Debugger();
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2001-11-24 00:44:25 +03:00
|
|
|
if (sp->sum_bytes_left > 484) {
|
1999-03-10 03:20:00 +03:00
|
|
|
printf("%s:%d: bad value (%d = -%d) for sum_bytes_left\n",
|
Merge the short-lived perseant-lfsv2 branch into the trunk.
Kernels and tools understand both v1 and v2 filesystems; newfs_lfs
generates v2 by default. Changes for the v2 layout include:
- Segments of non-PO2 size and arbitrary block offset, so these can be
matched to convenient physical characteristics of the partition (e.g.,
stripe or track size and offset).
- Address by fragment instead of by disk sector, paving the way for
non-512-byte-sector devices. In theory fragments can be as large
as you like, though in reality they must be smaller than MAXBSIZE in size.
- Use serial number and filesystem identifier to ensure that roll-forward
doesn't get old data and think it's new. Roll-forward is enabled for
v2 filesystems, though not for v1 filesystems by default.
- The inode free list is now a tailq, paving the way for undelete (undelete
is not yet implemented, but can be without further non-backwards-compatible
changes to disk structures).
- Inode atime information is kept in the Ifile, instead of on the inode;
that is, the inode is never written *just* because atime was changed.
Because of this the inodes remain near the file data on the disk, rather
than wandering all over as the disk is read repeatedly. This speeds up
repeated reads by a small but noticeable amount.
Other changes of note include:
- The ifile written by newfs_lfs can now be of arbitrary length, it is no
longer restricted to a single indirect block.
- Fixed an old bug where ctime was changed every time a vnode was created.
I need to look more closely to make sure that the times are only updated
during write(2) and friends, not after-the-fact during a segment write,
and certainly not by the cleaner.
2001-07-14 00:30:18 +04:00
|
|
|
file, line, sp->sum_bytes_left, fs->lfs_sumsize-sp->sum_bytes_left);
|
1999-03-10 03:20:00 +03:00
|
|
|
panic("too many bytes");
|
|
|
|
}
|
|
|
|
|
Merge the short-lived perseant-lfsv2 branch into the trunk.
Kernels and tools understand both v1 and v2 filesystems; newfs_lfs
generates v2 by default. Changes for the v2 layout include:
- Segments of non-PO2 size and arbitrary block offset, so these can be
matched to convenient physical characteristics of the partition (e.g.,
stripe or track size and offset).
- Address by fragment instead of by disk sector, paving the way for
non-512-byte-sector devices. In theory fragments can be as large
as you like, though in reality they must be smaller than MAXBSIZE in size.
- Use serial number and filesystem identifier to ensure that roll-forward
doesn't get old data and think it's new. Roll-forward is enabled for
v2 filesystems, though not for v1 filesystems by default.
- The inode free list is now a tailq, paving the way for undelete (undelete
is not yet implemented, but can be without further non-backwards-compatible
changes to disk structures).
- Inode atime information is kept in the Ifile, instead of on the inode;
that is, the inode is never written *just* because atime was changed.
Because of this the inodes remain near the file data on the disk, rather
than wandering all over as the disk is read repeatedly. This speeds up
repeated reads by a small but noticeable amount.
Other changes of note include:
- The ifile written by newfs_lfs can now be of arbitrary length, it is no
longer restricted to a single indirect block.
- Fixed an old bug where ctime was changed every time a vnode was created.
I need to look more closely to make sure that the times are only updated
during write(2) and friends, not after-the-fact during a segment write,
and certainly not by the cleaner.
2001-07-14 00:30:18 +04:00
|
|
|
actual = fs->lfs_sumsize
|
1999-03-10 03:20:00 +03:00
|
|
|
/* amount taken up by FINFOs */
|
|
|
|
- ((char *)&(sp->fip->fi_blocks[sp->fip->fi_nblocks]) - (char *)(sp->segsum))
|
|
|
|
/* amount taken up by inode blocks */
|
|
|
|
- sizeof(ufs_daddr_t)*((sp->ninodes+INOPB(fs)-1) / INOPB(fs));
|
|
|
|
#if 0
|
2001-11-24 00:44:25 +03:00
|
|
|
if (actual - sp->sum_bytes_left < offset)
|
1999-03-10 03:20:00 +03:00
|
|
|
{
|
|
|
|
printf("%s:%d: offset changed %d -> %d\n", file, line,
|
|
|
|
offset, actual-sp->sum_bytes_left);
|
|
|
|
offset = actual - sp->sum_bytes_left;
|
|
|
|
/* panic("byte mismatch"); */
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
#if 0
|
2001-11-24 00:44:25 +03:00
|
|
|
if (actual != sp->sum_bytes_left)
|
1999-03-10 03:20:00 +03:00
|
|
|
printf("%s:%d: warning: segsum miscalc at %d (-%d => %d)\n",
|
|
|
|
file, line, sp->sum_bytes_left,
|
Merge the short-lived perseant-lfsv2 branch into the trunk.
Kernels and tools understand both v1 and v2 filesystems; newfs_lfs
generates v2 by default. Changes for the v2 layout include:
- Segments of non-PO2 size and arbitrary block offset, so these can be
matched to convenient physical characteristics of the partition (e.g.,
stripe or track size and offset).
- Address by fragment instead of by disk sector, paving the way for
non-512-byte-sector devices. In theory fragments can be as large
as you like, though in reality they must be smaller than MAXBSIZE in size.
- Use serial number and filesystem identifier to ensure that roll-forward
doesn't get old data and think it's new. Roll-forward is enabled for
v2 filesystems, though not for v1 filesystems by default.
- The inode free list is now a tailq, paving the way for undelete (undelete
is not yet implemented, but can be without further non-backwards-compatible
changes to disk structures).
- Inode atime information is kept in the Ifile, instead of on the inode;
that is, the inode is never written *just* because atime was changed.
Because of this the inodes remain near the file data on the disk, rather
than wandering all over as the disk is read repeatedly. This speeds up
repeated reads by a small but noticeable amount.
Other changes of note include:
- The ifile written by newfs_lfs can now be of arbitrary length, it is no
longer restricted to a single indirect block.
- Fixed an old bug where ctime was changed every time a vnode was created.
I need to look more closely to make sure that the times are only updated
during write(2) and friends, not after-the-fact during a segment write,
and certainly not by the cleaner.
2001-07-14 00:30:18 +04:00
|
|
|
fs->lfs_sumsize-sp->sum_bytes_left,
|
1999-03-10 03:20:00 +03:00
|
|
|
actual);
|
|
|
|
#endif
|
2001-11-24 00:44:25 +03:00
|
|
|
if (sp->sum_bytes_left > 0
|
Merge the short-lived perseant-lfsv2 branch into the trunk.
Kernels and tools understand both v1 and v2 filesystems; newfs_lfs
generates v2 by default. Changes for the v2 layout include:
- Segments of non-PO2 size and arbitrary block offset, so these can be
matched to convenient physical characteristics of the partition (e.g.,
stripe or track size and offset).
- Address by fragment instead of by disk sector, paving the way for
non-512-byte-sector devices. In theory fragments can be as large
as you like, though in reality they must be smaller than MAXBSIZE in size.
- Use serial number and filesystem identifier to ensure that roll-forward
doesn't get old data and think it's new. Roll-forward is enabled for
v2 filesystems, though not for v1 filesystems by default.
- The inode free list is now a tailq, paving the way for undelete (undelete
is not yet implemented, but can be without further non-backwards-compatible
changes to disk structures).
- Inode atime information is kept in the Ifile, instead of on the inode;
that is, the inode is never written *just* because atime was changed.
Because of this the inodes remain near the file data on the disk, rather
than wandering all over as the disk is read repeatedly. This speeds up
repeated reads by a small but noticeable amount.
Other changes of note include:
- The ifile written by newfs_lfs can now be of arbitrary length, it is no
longer restricted to a single indirect block.
- Fixed an old bug where ctime was changed every time a vnode was created.
I need to look more closely to make sure that the times are only updated
during write(2) and friends, not after-the-fact during a segment write,
and certainly not by the cleaner.
2001-07-14 00:30:18 +04:00
|
|
|
&& ((char *)(sp->segsum))[fs->lfs_sumsize
|
1999-03-10 03:20:00 +03:00
|
|
|
- sizeof(ufs_daddr_t) * ((sp->ninodes+INOPB(fs)-1) / INOPB(fs))
|
|
|
|
- sp->sum_bytes_left] != '\0') {
|
|
|
|
printf("%s:%d: warning: segsum overwrite at %d (-%d => %d)\n",
|
|
|
|
file, line, sp->sum_bytes_left,
|
Merge the short-lived perseant-lfsv2 branch into the trunk.
Kernels and tools understand both v1 and v2 filesystems; newfs_lfs
generates v2 by default. Changes for the v2 layout include:
- Segments of non-PO2 size and arbitrary block offset, so these can be
matched to convenient physical characteristics of the partition (e.g.,
stripe or track size and offset).
- Address by fragment instead of by disk sector, paving the way for
non-512-byte-sector devices. In theory fragments can be as large
as you like, though in reality they must be smaller than MAXBSIZE in size.
- Use serial number and filesystem identifier to ensure that roll-forward
doesn't get old data and think it's new. Roll-forward is enabled for
v2 filesystems, though not for v1 filesystems by default.
- The inode free list is now a tailq, paving the way for undelete (undelete
is not yet implemented, but can be without further non-backwards-compatible
changes to disk structures).
- Inode atime information is kept in the Ifile, instead of on the inode;
that is, the inode is never written *just* because atime was changed.
Because of this the inodes remain near the file data on the disk, rather
than wandering all over as the disk is read repeatedly. This speeds up
repeated reads by a small but noticeable amount.
Other changes of note include:
- The ifile written by newfs_lfs can now be of arbitrary length, it is no
longer restricted to a single indirect block.
- Fixed an old bug where ctime was changed every time a vnode was created.
I need to look more closely to make sure that the times are only updated
during write(2) and friends, not after-the-fact during a segment write,
and certainly not by the cleaner.
2001-07-14 00:30:18 +04:00
|
|
|
fs->lfs_sumsize-sp->sum_bytes_left,
|
1999-03-10 03:20:00 +03:00
|
|
|
actual);
|
|
|
|
#ifdef DDB
|
|
|
|
Debugger();
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
Merge the short-lived perseant-lfsv2 branch into the trunk.
Kernels and tools understand both v1 and v2 filesystems; newfs_lfs
generates v2 by default. Changes for the v2 layout include:
- Segments of non-PO2 size and arbitrary block offset, so these can be
matched to convenient physical characteristics of the partition (e.g.,
stripe or track size and offset).
- Address by fragment instead of by disk sector, paving the way for
non-512-byte-sector devices. In theory fragments can be as large
as you like, though in reality they must be smaller than MAXBSIZE in size.
- Use serial number and filesystem identifier to ensure that roll-forward
doesn't get old data and think it's new. Roll-forward is enabled for
v2 filesystems, though not for v1 filesystems by default.
- The inode free list is now a tailq, paving the way for undelete (undelete
is not yet implemented, but can be without further non-backwards-compatible
changes to disk structures).
- Inode atime information is kept in the Ifile, instead of on the inode;
that is, the inode is never written *just* because atime was changed.
Because of this the inodes remain near the file data on the disk, rather
than wandering all over as the disk is read repeatedly. This speeds up
repeated reads by a small but noticeable amount.
Other changes of note include:
- The ifile written by newfs_lfs can now be of arbitrary length, it is no
longer restricted to a single indirect block.
- Fixed an old bug where ctime was changed every time a vnode was created.
I need to look more closely to make sure that the times are only updated
during write(2) and friends, not after-the-fact during a segment write,
and certainly not by the cleaner.
2001-07-14 00:30:18 +04:00
|
|
|
lfs_check_bpp(struct lfs *fs, struct segment *sp, char *file, int line)
|
1999-03-10 03:20:00 +03:00
|
|
|
{
|
|
|
|
daddr_t blkno;
|
|
|
|
struct buf **bpp;
|
|
|
|
struct vnode *devvp;
|
|
|
|
|
|
|
|
devvp = VTOI(fs->lfs_ivnode)->i_devvp;
|
|
|
|
blkno = (*(sp->bpp))->b_blkno;
|
2001-11-24 00:44:25 +03:00
|
|
|
for (bpp = sp->bpp; bpp < sp->cbpp; bpp++) {
|
|
|
|
if ((*bpp)->b_blkno != blkno) {
|
|
|
|
if ((*bpp)->b_vp == devvp) {
|
1999-03-10 03:20:00 +03:00
|
|
|
printf("Oops, would misplace raw block 0x%x at "
|
|
|
|
"0x%x\n",
|
|
|
|
(*bpp)->b_blkno,
|
|
|
|
blkno);
|
|
|
|
} else {
|
|
|
|
printf("%s:%d: misplace ino %d lbn %d at "
|
|
|
|
"0x%x instead of 0x%x\n",
|
|
|
|
file, line,
|
|
|
|
VTOI((*bpp)->b_vp)->i_number, (*bpp)->b_lblkno,
|
|
|
|
blkno,
|
|
|
|
(*bpp)->b_blkno);
|
|
|
|
}
|
|
|
|
}
|
Merge the short-lived perseant-lfsv2 branch into the trunk.
Kernels and tools understand both v1 and v2 filesystems; newfs_lfs
generates v2 by default. Changes for the v2 layout include:
- Segments of non-PO2 size and arbitrary block offset, so these can be
matched to convenient physical characteristics of the partition (e.g.,
stripe or track size and offset).
- Address by fragment instead of by disk sector, paving the way for
non-512-byte-sector devices. In theory fragments can be as large
as you like, though in reality they must be smaller than MAXBSIZE in size.
- Use serial number and filesystem identifier to ensure that roll-forward
doesn't get old data and think it's new. Roll-forward is enabled for
v2 filesystems, though not for v1 filesystems by default.
- The inode free list is now a tailq, paving the way for undelete (undelete
is not yet implemented, but can be without further non-backwards-compatible
changes to disk structures).
- Inode atime information is kept in the Ifile, instead of on the inode;
that is, the inode is never written *just* because atime was changed.
Because of this the inodes remain near the file data on the disk, rather
than wandering all over as the disk is read repeatedly. This speeds up
repeated reads by a small but noticeable amount.
Other changes of note include:
- The ifile written by newfs_lfs can now be of arbitrary length, it is no
longer restricted to a single indirect block.
- Fixed an old bug where ctime was changed every time a vnode was created.
I need to look more closely to make sure that the times are only updated
during write(2) and friends, not after-the-fact during a segment write,
and certainly not by the cleaner.
2001-07-14 00:30:18 +04:00
|
|
|
blkno += fsbtodb(fs, btofsb(fs, (*bpp)->b_bcount));
|
1999-03-10 03:20:00 +03:00
|
|
|
}
|
|
|
|
}
|
1994-06-08 15:41:58 +04:00
|
|
|
#endif /* DEBUG */
|