Add code to UBCify LFS. This is still behind "#ifdef LFS_UBC" for now
(there are still some details to work out) but expect that to go
away soon. To support these basic changes (creation of lfs_putpages,
lfs_gop_write, mods to lfs_balloc) several other changes were made, to
wit:
* Create a writer daemon kernel thread whose purpose is to handle page
writes for the pagedaemon, but which also takes over some of the
functions of lfs_check(). This thread is started the first time an
LFS is mounted.
* Add a "flags" parameter to GOP_SIZE. Current values are
GOP_SIZE_READ, meaning that the call should return the size of the
in-core version of the file, and GOP_SIZE_WRITE, meaning that it
should return the on-disk size. One of GOP_SIZE_READ or
GOP_SIZE_WRITE must be specified.
* Instead of using malloc(...M_WAITOK) for everything, reserve enough
resources to get by and use malloc(...M_NOWAIT), using the reserves if
necessary. Use the pool subsystem for structures small enough that
this is feasible. This also obsoletes LFS_THROTTLE.
And a few that are not strictly necessary:
* Moves the LFS inode extensions off onto a separately allocated
structure; getting closer to LFS as an LKM. "Welcome to 1.6O."
* Unified GOP_ALLOC between FFS and LFS.
* Update LFS copyright headers to correct values.
* Actually cast to unsigned in lfs_shellsort, like the comment says.
* Keep track of which segments were empty before the previous
checkpoint; any segments that pass two checkpoints both dirty and
empty can be summarily cleaned. Do this. Right now lfs_segclean
still works, but this should be turned into an effectless
compatibility syscall.
2003-02-18 02:48:08 +03:00
|
|
|
/* $NetBSD: lfs_debug.c,v 1.20 2003/02/17 23:48:18 perseant Exp $ */
|
1994-06-29 10:39:25 +04:00
|
|
|
|
1999-03-10 03:20:00 +03:00
|
|
|
/*-
|
Add code to UBCify LFS. This is still behind "#ifdef LFS_UBC" for now
(there are still some details to work out) but expect that to go
away soon. To support these basic changes (creation of lfs_putpages,
lfs_gop_write, mods to lfs_balloc) several other changes were made, to
wit:
* Create a writer daemon kernel thread whose purpose is to handle page
writes for the pagedaemon, but which also takes over some of the
functions of lfs_check(). This thread is started the first time an
LFS is mounted.
* Add a "flags" parameter to GOP_SIZE. Current values are
GOP_SIZE_READ, meaning that the call should return the size of the
in-core version of the file, and GOP_SIZE_WRITE, meaning that it
should return the on-disk size. One of GOP_SIZE_READ or
GOP_SIZE_WRITE must be specified.
* Instead of using malloc(...M_WAITOK) for everything, reserve enough
resources to get by and use malloc(...M_NOWAIT), using the reserves if
necessary. Use the pool subsystem for structures small enough that
this is feasible. This also obsoletes LFS_THROTTLE.
And a few that are not strictly necessary:
* Moves the LFS inode extensions off onto a separately allocated
structure; getting closer to LFS as an LKM. "Welcome to 1.6O."
* Unified GOP_ALLOC between FFS and LFS.
* Update LFS copyright headers to correct values.
* Actually cast to unsigned in lfs_shellsort, like the comment says.
* Keep track of which segments were empty before the previous
checkpoint; any segments that pass two checkpoints both dirty and
empty can be summarily cleaned. Do this. Right now lfs_segclean
still works, but this should be turned into an effectless
compatibility syscall.
2003-02-18 02:48:08 +03:00
|
|
|
* Copyright (c) 1999, 2000, 2001, 2002, 2003 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>
|
Add code to UBCify LFS. This is still behind "#ifdef LFS_UBC" for now
(there are still some details to work out) but expect that to go
away soon. To support these basic changes (creation of lfs_putpages,
lfs_gop_write, mods to lfs_balloc) several other changes were made, to
wit:
* Create a writer daemon kernel thread whose purpose is to handle page
writes for the pagedaemon, but which also takes over some of the
functions of lfs_check(). This thread is started the first time an
LFS is mounted.
* Add a "flags" parameter to GOP_SIZE. Current values are
GOP_SIZE_READ, meaning that the call should return the size of the
in-core version of the file, and GOP_SIZE_WRITE, meaning that it
should return the on-disk size. One of GOP_SIZE_READ or
GOP_SIZE_WRITE must be specified.
* Instead of using malloc(...M_WAITOK) for everything, reserve enough
resources to get by and use malloc(...M_NOWAIT), using the reserves if
necessary. Use the pool subsystem for structures small enough that
this is feasible. This also obsoletes LFS_THROTTLE.
And a few that are not strictly necessary:
* Moves the LFS inode extensions off onto a separately allocated
structure; getting closer to LFS as an LKM. "Welcome to 1.6O."
* Unified GOP_ALLOC between FFS and LFS.
* Update LFS copyright headers to correct values.
* Actually cast to unsigned in lfs_shellsort, like the comment says.
* Keep track of which segments were empty before the previous
checkpoint; any segments that pass two checkpoints both dirty and
empty can be summarily cleaned. Do this. Right now lfs_segclean
still works, but this should be turned into an effectless
compatibility syscall.
2003-02-18 02:48:08 +03:00
|
|
|
__KERNEL_RCSID(0, "$NetBSD: lfs_debug.c,v 1.20 2003/02/17 23:48:18 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) {
|
2003-01-26 02:00:09 +03:00
|
|
|
printf("lbn %" PRId64 " %s %lx %d %s\n",
|
2002-05-15 00:03:53 +04:00
|
|
|
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",
|
Add code to UBCify LFS. This is still behind "#ifdef LFS_UBC" for now
(there are still some details to work out) but expect that to go
away soon. To support these basic changes (creation of lfs_putpages,
lfs_gop_write, mods to lfs_balloc) several other changes were made, to
wit:
* Create a writer daemon kernel thread whose purpose is to handle page
writes for the pagedaemon, but which also takes over some of the
functions of lfs_check(). This thread is started the first time an
LFS is mounted.
* Add a "flags" parameter to GOP_SIZE. Current values are
GOP_SIZE_READ, meaning that the call should return the size of the
in-core version of the file, and GOP_SIZE_WRITE, meaning that it
should return the on-disk size. One of GOP_SIZE_READ or
GOP_SIZE_WRITE must be specified.
* Instead of using malloc(...M_WAITOK) for everything, reserve enough
resources to get by and use malloc(...M_NOWAIT), using the reserves if
necessary. Use the pool subsystem for structures small enough that
this is feasible. This also obsoletes LFS_THROTTLE.
And a few that are not strictly necessary:
* Moves the LFS inode extensions off onto a separately allocated
structure; getting closer to LFS as an LKM. "Welcome to 1.6O."
* Unified GOP_ALLOC between FFS and LFS.
* Update LFS copyright headers to correct values.
* Actually cast to unsigned in lfs_shellsort, like the comment says.
* Keep track of which segments were empty before the previous
checkpoint; any segments that pass two checkpoints both dirty and
empty can be summarily cleaned. Do this. Right now lfs_segclean
still works, but this should be turned into an effectless
compatibility syscall.
2003-02-18 02:48:08 +03:00
|
|
|
"freehd ", lfsp->lfs_freehd,
|
1999-03-10 03:20:00 +03:00
|
|
|
"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 */
|
|
|
|
|
2003-01-29 16:14:33 +03:00
|
|
|
if (sp->sum_bytes_left >= FINFOSIZE
|
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 */
|
2003-01-29 16:14:33 +03:00
|
|
|
- sizeof(int32_t)*((sp->ninodes+INOPB(fs)-1) / INOPB(fs));
|
1999-03-10 03:20:00 +03:00
|
|
|
#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
|
2003-01-29 16:14:33 +03:00
|
|
|
- sizeof(int32_t) * ((sp->ninodes+INOPB(fs)-1) / INOPB(fs))
|
1999-03-10 03:20:00 +03:00
|
|
|
- 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) {
|
2003-01-26 02:00:09 +03:00
|
|
|
printf("Oops, would misplace raw block "
|
|
|
|
"0x%" PRIx64 " at 0x%" PRIx64 "\n",
|
1999-03-10 03:20:00 +03:00
|
|
|
(*bpp)->b_blkno,
|
|
|
|
blkno);
|
|
|
|
} else {
|
2003-01-26 02:00:09 +03:00
|
|
|
printf("%s:%d: misplace ino %d lbn %" PRId64
|
|
|
|
" at 0x%" PRIx64 " instead of "
|
|
|
|
"0x%" PRIx64 "\n",
|
1999-03-10 03:20:00 +03:00
|
|
|
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 */
|