aboutsummaryrefslogtreecommitdiff
path: root/sbin/fsck_ffs/main.c
diff options
context:
space:
mode:
authorKirk McKusick <mckusick@FreeBSD.org>2002-06-21 06:18:05 +0000
committerKirk McKusick <mckusick@FreeBSD.org>2002-06-21 06:18:05 +0000
commit1c85e6a35d93195e896b030d9a55f7ac4ccee2c3 (patch)
treef1364dbfb9835934a3879b5904f7ff9a1495744c /sbin/fsck_ffs/main.c
parent27168693db756b7c8dabe3830a804bf72def2a6d (diff)
downloadsrc-1c85e6a35d93195e896b030d9a55f7ac4ccee2c3.tar.gz
src-1c85e6a35d93195e896b030d9a55f7ac4ccee2c3.zip
This commit adds basic support for the UFS2 filesystem. The UFS2
filesystem expands the inode to 256 bytes to make space for 64-bit block pointers. It also adds a file-creation time field, an ability to use jumbo blocks per inode to allow extent like pointer density, and space for extended attributes (up to twice the filesystem block size worth of attributes, e.g., on a 16K filesystem, there is space for 32K of attributes). UFS2 fully supports and runs existing UFS1 filesystems. New filesystems built using newfs can be built in either UFS1 or UFS2 format using the -O option. In this commit UFS1 is the default format, so if you want to build UFS2 format filesystems, you must specify -O 2. This default will be changed to UFS2 when UFS2 proves itself to be stable. In this commit the boot code for reading UFS2 filesystems is not compiled (see /sys/boot/common/ufsread.c) as there is insufficient space in the boot block. Once the size of the boot block is increased, this code can be defined. Things to note: the definition of SBSIZE has changed to SBLOCKSIZE. The header file <ufs/ufs/dinode.h> must be included before <ufs/ffs/fs.h> so as to get the definitions of ufs2_daddr_t and ufs_lbn_t. Still TODO: Verify that the first level bootstraps work for all the architectures. Convert the utility ffsinfo to understand UFS2 and test growfs. Add support for the extended attribute storage. Update soft updates to ensure integrity of extended attribute storage. Switch the current extended attribute interfaces to use the extended attribute storage. Add the extent like functionality (framework is there, but is currently never used). Sponsored by: DARPA & NAI Labs. Reviewed by: Poul-Henning Kamp <phk@freebsd.org>
Notes
Notes: svn path=/head/; revision=98542
Diffstat (limited to 'sbin/fsck_ffs/main.c')
-rw-r--r--sbin/fsck_ffs/main.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/sbin/fsck_ffs/main.c b/sbin/fsck_ffs/main.c
index 73364a7f7fdd..c69e9d3441ea 100644
--- a/sbin/fsck_ffs/main.c
+++ b/sbin/fsck_ffs/main.c
@@ -53,6 +53,7 @@ __FBSDID("$FreeBSD$");
#include <sys/mount.h>
#include <sys/resource.h>
#include <sys/sysctl.h>
+#include <sys/disklabel.h>
#include <ufs/ufs/dinode.h>
#include <ufs/ufs/ufsmount.h>
@@ -95,6 +96,9 @@ main(int argc, char *argv[])
case 'c':
skipclean = 0;
cvtlevel = argtoi('c', "conversion level", optarg, 10);
+ if (cvtlevel < 3)
+ errx(EEXIT, "cannot do level %d conversion",
+ cvtlevel);
break;
case 'd':
@@ -180,14 +184,14 @@ argtoi(int flag, char *req, char *str, int base)
static int
checkfilesys(char *filesys)
{
- ufs_daddr_t n_ffree, n_bfree;
+ ufs2_daddr_t n_ffree, n_bfree;
struct ufs_args args;
struct dups *dp;
struct statfs *mntp;
struct zlncnt *zlnp;
- ufs_daddr_t blks;
- ufs_daddr_t files;
+ ufs2_daddr_t blks;
int cylno, size;
+ ino_t files;
cdevname = filesys;
if (debug && preen)
@@ -367,10 +371,9 @@ checkfilesys(char *filesys)
pwarn("Reclaimed: %ld directories, %ld files, %d fragments\n",
countdirs, (long)files - countdirs, blks);
}
- pwarn("%ld files, %ld used, %ld free ",
- (long)n_files, (long)n_blks, (long)(n_ffree +
- sblock.fs_frag * n_bfree));
- printf("(%d frags, %d blocks, %.1f%% fragmentation)\n",
+ pwarn("%ld files, %ld used, %qu free ",
+ (long)n_files, (long)n_blks, n_ffree + sblock.fs_frag * n_bfree);
+ printf("(%qu frags, %qu blocks, %.1f%% fragmentation)\n",
n_ffree, n_bfree, n_ffree * 100.0 / sblock.fs_dsize);
if (debug) {
if (files < 0)
@@ -404,7 +407,8 @@ checkfilesys(char *filesys)
*/
for (cylno = 0; cylno < sblock.fs_ncg; cylno++)
bwrite(fswritefd, (char *)&sblock,
- fsbtodb(&sblock, cgsblock(&sblock, cylno)), SBSIZE);
+ fsbtodb(&sblock, cgsblock(&sblock, cylno)),
+ SBLOCKSIZE);
}
if (rerun)
resolved = 0;