NetBSD/libexec/lfs_cleanerd/print.c

287 lines
8.8 KiB
C
Raw Normal View History

/* $NetBSD: print.c,v 1.15 2003/08/07 09:46:44 agc Exp $ */
1997-10-07 17:39:56 +04:00
1994-06-08 22:42:09 +04:00
/*-
* Copyright (c) 1992, 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. Neither the name of the University nor the names of its contributors
1994-06-08 22:42:09 +04:00
* 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.
*/
1997-10-07 17:39:56 +04:00
#include <sys/cdefs.h>
1994-06-08 22:42:09 +04:00
#ifndef lint
1997-10-07 17:39:56 +04:00
#if 0
static char sccsid[] = "from: @(#)print.c 8.1 (Berkeley) 6/4/93";
#else
__RCSID("$NetBSD: print.c,v 1.15 2003/08/07 09:46:44 agc Exp $");
1997-10-07 17:39:56 +04:00
#endif
1994-06-08 22:42:09 +04:00
#endif /* not lint */
#include <sys/param.h>
#include <sys/ucred.h>
#include <sys/mount.h>
#include <sys/time.h>
#include <ufs/ufs/dinode.h>
#include <ufs/lfs/lfs.h>
#include <stdlib.h>
#include <stdio.h>
1998-04-01 18:39:56 +04:00
#include <time.h>
#include <syslog.h>
1994-06-08 22:42:09 +04:00
#include "clean.h"
extern int debug;
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
extern u_long cksum(void *, size_t); /* XXX */
1997-10-07 17:39:56 +04:00
1994-06-08 22:42:09 +04:00
/*
* Print out a summary block; return number of blocks in segment; 0
* for empty segment or corrupt segment.
* Returns a pointer to the array of inode addresses.
*/
/* XXX ondisk32 */
1994-06-08 22:42:09 +04:00
int
dump_summary(struct lfs *lfsp, SEGSUM *sp, u_long flags, int32_t **iaddrp, daddr_t addr)
1994-06-08 22:42:09 +04:00
{
int i, j, blk, numblocks, accino=0;
/* XXX ondisk32 */
int32_t *dp, ddp, *idp;
u_int32_t *datap;
int size;
1994-06-08 22:42:09 +04:00
FINFO *fp;
u_int32_t ck;
blk=0;
datap = (u_int32_t *)malloc(segtod(lfsp, 1) * sizeof(u_int32_t));
if(datap==NULL) {
syslog(LOG_WARNING, "cannot allocate %d in dump_summary",
(int)(segtod(lfsp, 1) * sizeof(u_int32_t)));
2000-01-18 11:02:30 +03:00
return(-1);
}
1994-06-08 22:42:09 +04:00
if (sp->ss_sumsum != (ck = cksum(&sp->ss_datasum,
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
lfsp->lfs_sumsize - sizeof(sp->ss_sumsum)))) {
syslog(LOG_WARNING, "sumsum checksum mismatch: should be %d, found %d\n",
(int) sp->ss_sumsum, (int) ck);
2000-01-18 11:02:30 +03:00
free(datap);
1994-06-08 22:42:09 +04:00
return(-1);
2000-01-18 11:02:30 +03:00
}
1994-06-08 22:42:09 +04:00
if (flags & DUMP_SUM_HEADER) {
syslog(LOG_DEBUG, " %s0x%X\t%s%d\t%s%d\n %s0x%X\t%s0x%X",
1994-06-08 22:42:09 +04:00
"next ", sp->ss_next,
"nfinfo ", sp->ss_nfinfo,
"ninos ", sp->ss_ninos,
"sumsum ", sp->ss_sumsum,
1997-10-07 17:39:56 +04:00
"datasum ", sp->ss_datasum );
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
syslog(LOG_DEBUG, "\tcreate %s", ctime(
(lfsp->lfs_version == 1 ? (time_t *)&sp->ss_ident :
(time_t *)&sp->ss_create)));
1994-06-08 22:42:09 +04:00
}
1997-10-07 17:39:56 +04:00
numblocks = (sp->ss_ninos + INOPB(lfsp) - 1) / INOPB(lfsp);
1994-06-08 22:42:09 +04:00
/* Dump out inode disk addresses */
if (flags & DUMP_INODE_ADDRS)
syslog(LOG_DEBUG, " Inode addresses:");
1994-06-08 22:42:09 +04:00
/* XXX ondisk32 */
idp = dp = (int32_t *)((caddr_t)sp + lfsp->lfs_sumsize);
--idp;
for (--dp, i = 0; i < howmany(sp->ss_ninos,INOPB(lfsp)); --dp) {
if (flags & DUMP_INODE_ADDRS)
syslog(LOG_DEBUG, "\t0x%lx", (u_long)*dp);
++i;
}
if (iaddrp) {
*iaddrp = dp;
}
1994-06-08 22:42:09 +04:00
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
ddp = addr + btofsb(lfsp, lfsp->lfs_sumsize);
if (lfsp->lfs_version == 1)
fp = (FINFO *)(((char *)sp) + sizeof(SEGSUM_V1));
else
fp = (FINFO *)(sp + 1);
for (i = 0; i < sp->ss_nfinfo; ++i) {
/* Add any intervening Inode blocks to our checksum array */
/* printf("finfo %d: ddp=%lx, *idp=%lx\n",i,ddp,*idp); */
while(ddp == *idp) {
/* printf(" [ino %lx]",ddp); */
datap[blk++] = *(u_int32_t*)((caddr_t)sp + fsbtob(lfsp, ddp-addr));
--idp;
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
ddp += btofsb(lfsp, lfsp->lfs_ibsize);
accino++;
}
for(j=0;j<fp->fi_nblocks;j++) {
if(j==fp->fi_nblocks-1) {
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
size = btofsb(lfsp, fp->fi_lastlength);
/* printf(" %lx:%d",ddp,size); */
} else {
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
size = btofsb(lfsp, lfsp->lfs_bsize);
/* printf(" %lx/%d",ddp,size); */
}
datap[blk++] = *(u_int32_t*)((caddr_t)sp + fsbtob(lfsp, ddp-addr));
ddp += size;
}
1994-06-08 22:42:09 +04:00
numblocks += fp->fi_nblocks;
if (flags & DUMP_FINFOS) {
syslog(LOG_DEBUG, " %s%d version %d nblocks %d\n",
1994-06-08 22:42:09 +04:00
"FINFO for inode: ", fp->fi_ino,
fp->fi_version, fp->fi_nblocks);
dp = &(fp->fi_blocks[0]);
for (j = 0; j < fp->fi_nblocks; j++, dp++) {
syslog(LOG_DEBUG, "\t%d", *dp);
1994-06-08 22:42:09 +04:00
}
} else
dp = &fp->fi_blocks[fp->fi_nblocks];
fp = (FINFO *)dp;
/* printf("\n"); */
}
/* Add lagging inode blocks too */
/* printf("end: ddp=%lx, *idp=%lx\n",ddp,*idp); */
while(*idp >= ddp && accino < howmany(sp->ss_ninos,INOPB(lfsp))) {
ddp = *idp;
/* printf(" [ino %lx]",ddp); */
datap[blk++] = *(u_int32_t*)((caddr_t)sp + fsbtob(lfsp, ddp-addr));
--idp;
accino++;
}
/* printf("\n"); */
if(accino != howmany(sp->ss_ninos,lfsp->lfs_inopb)) {
syslog(LOG_DEBUG,"Oops, given %d inodes got %d\n", howmany(sp->ss_ninos,lfsp->lfs_inopb), accino);
1994-06-08 22:42:09 +04:00
}
if(blk!=numblocks) {
syslog(LOG_DEBUG,"Oops, blk=%d numblocks=%d\n",blk,numblocks);
}
/* check data/inode block(s) checksum too */
if ((ck=cksum ((void *)datap, numblocks * sizeof(u_int32_t))) != sp->ss_datasum) {
syslog(LOG_DEBUG, "Bad data checksum: given %lu, got %lu",
(unsigned long)sp->ss_datasum, (unsigned long)ck);
free(datap);
return 0;
}
free(datap);
1994-06-08 22:42:09 +04:00
return (numblocks);
}
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
dump_cleaner_info(void *ipage)
1994-06-08 22:42:09 +04:00
{
CLEANERINFO *cip;
if(debug <= 1)
return;
1994-06-08 22:42:09 +04:00
cip = (CLEANERINFO *)ipage;
syslog(LOG_DEBUG,"segments clean\t%d\tsegments dirty\t%d\n\n",
1994-06-08 22:42:09 +04:00
cip->clean, cip->dirty);
}
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
dump_super(struct lfs *lfsp)
1994-06-08 22:42:09 +04:00
{
int i;
if(debug < 2)
return;
syslog(LOG_DEBUG,"%s0x%X\t%s0x%X\t%s%d\t%s%d\n",
1994-06-08 22:42:09 +04:00
"magic ", lfsp->lfs_magic,
"version ", lfsp->lfs_version,
"size ", lfsp->lfs_size,
"ssize ", lfsp->lfs_ssize);
syslog(LOG_DEBUG, "%s%d\t\t%s%d\t%s%d\t%s%d\n",
1994-06-08 22:42:09 +04:00
"dsize ", lfsp->lfs_dsize,
"bsize ", lfsp->lfs_bsize,
"fsize ", lfsp->lfs_fsize,
"frag ", lfsp->lfs_frag);
syslog(LOG_DEBUG, "%s%d\t\t%s%d\t%s%d\t%s%d\n",
1994-06-08 22:42:09 +04:00
"minfree ", lfsp->lfs_minfree,
"inopb ", lfsp->lfs_inopb,
"ifpb ", lfsp->lfs_ifpb,
"nindir ", lfsp->lfs_nindir);
syslog(LOG_DEBUG, "%s%d\t\t%s%d\t%s%d\t%s%d\n",
1994-06-08 22:42:09 +04:00
"nseg ", lfsp->lfs_nseg,
"nspf ", lfsp->lfs_nspf,
"cleansz ", lfsp->lfs_cleansz,
"segtabsz ", lfsp->lfs_segtabsz);
syslog(LOG_DEBUG, "%s0x%X\t%s%d\t%s0x%llX\t%s%lu\n",
1994-06-08 22:42:09 +04:00
"segmask ", lfsp->lfs_segmask,
"segshift ", lfsp->lfs_segshift,
"bmask ", (long long)lfsp->lfs_bmask,
1998-09-12 01:21:29 +04:00
"bshift ", (u_long)lfsp->lfs_bshift);
syslog(LOG_DEBUG, "%s0x%llX\t\t%s%lu\t%s0x%llX\t%s%lu\n",
"ffmask ", (long long)lfsp->lfs_ffmask,
1998-09-12 01:21:29 +04:00
"ffshift ", (u_long)lfsp->lfs_ffshift,
"fbmask ", (long long)lfsp->lfs_fbmask,
1998-09-12 01:21:29 +04:00
"fbshift ", (u_long)lfsp->lfs_fbshift);
1994-06-08 22:42:09 +04:00
syslog(LOG_DEBUG, "%s%d\t\t%s0x%X\t%s0x%llx\n",
1994-06-08 22:42:09 +04:00
"fsbtodb ", lfsp->lfs_fsbtodb,
"cksum ", lfsp->lfs_cksum,
"maxfilesize ", (long long)lfsp->lfs_maxfilesize);
1994-06-08 22:42:09 +04:00
syslog(LOG_DEBUG, "Superblock disk addresses:\t");
1994-06-08 22:42:09 +04:00
for (i = 0; i < LFS_MAXNUMSB; i++) {
syslog(LOG_DEBUG, " 0x%X", lfsp->lfs_sboffs[i]);
1994-06-08 22:42:09 +04:00
}
syslog(LOG_DEBUG, "Checkpoint Info\n");
syslog(LOG_DEBUG, "%s%d\t%s0x%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,
1994-06-08 22:42:09 +04:00
"idaddr ", lfsp->lfs_idaddr,
"ifile ", lfsp->lfs_ifile);
syslog(LOG_DEBUG, "%s%d\t%s%d\t%s%d\n",
1994-06-08 22:42:09 +04:00
"bfree ", lfsp->lfs_bfree,
"avail ", lfsp->lfs_avail,
"uinodes ", lfsp->lfs_uinodes);
syslog(LOG_DEBUG, "%s%d\t%s0x%X\t%s0x%X\n%s0x%X\t%s0x%X\t",
1994-06-08 22:42:09 +04:00
"nfiles ", lfsp->lfs_nfiles,
"lastseg ", lfsp->lfs_lastseg,
"nextseg ", lfsp->lfs_nextseg,
"curseg ", lfsp->lfs_curseg,
"offset ", lfsp->lfs_offset);
syslog(LOG_DEBUG, "tstamp %s", ctime((time_t *)&lfsp->lfs_tstamp));
syslog(LOG_DEBUG, "\nIn-Memory Information\n");
syslog(LOG_DEBUG, "%s%d\t%s0x%X\t%s%d\t%s%d\t%s%d\n",
1994-06-08 22:42:09 +04:00
"seglock ", lfsp->lfs_seglock,
"iocount ", lfsp->lfs_iocount,
"writer ", lfsp->lfs_writer,
"dirops ", lfsp->lfs_dirops,
"doifile ", lfsp->lfs_doifile );
syslog(LOG_DEBUG, "%s%d\t%s%d\t%s0x%X\t%s%d\n",
1994-06-08 22:42:09 +04:00
"nactive ", lfsp->lfs_nactive,
"fmod ", lfsp->lfs_fmod,
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
"pflags ", lfsp->lfs_pflags,
1994-06-08 22:42:09 +04:00
"ronly ", lfsp->lfs_ronly);
}