diff options
author | Niall O'Higgins <niallo@cvs.openbsd.org> | 2005-04-30 13:56:17 +0000 |
---|---|---|
committer | Niall O'Higgins <niallo@cvs.openbsd.org> | 2005-04-30 13:56:17 +0000 |
commit | e723898372517d7a195b4eb18912751f9316ae2e (patch) | |
tree | 4a6149adbaa52b0539597497fd19f2cfd9cf066e /sbin/fsck_ext2fs/dir.c | |
parent | 8153e99f0a02eb7725ff3061033d08113ee83991 (diff) |
Support checking filesystems which have or once had large files (>4 GB)
on them.
From NetBSD
Diffstat (limited to 'sbin/fsck_ext2fs/dir.c')
-rw-r--r-- | sbin/fsck_ext2fs/dir.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/sbin/fsck_ext2fs/dir.c b/sbin/fsck_ext2fs/dir.c index b67261ba0ec..d6790e5dfdf 100644 --- a/sbin/fsck_ext2fs/dir.c +++ b/sbin/fsck_ext2fs/dir.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dir.c,v 1.12 2003/07/29 18:38:35 deraadt Exp $ */ +/* $OpenBSD: dir.c,v 1.13 2005/04/30 13:56:15 niallo Exp $ */ /* $NetBSD: dir.c,v 1.5 2000/01/28 16:01:46 bouyer Exp $ */ /* @@ -363,7 +363,7 @@ linkup(ino_t orphan, ino_t parentdir) lostdir = (fs2h16(dp->e2di_mode) & IFMT) == IFDIR; pwarn("UNREF %s ", lostdir ? "DIR" : "FILE"); pinode(orphan); - if (preen && fs2h32(dp->e2di_size) == 0) + if (preen && inosize(dp) == 0) return (0); if (preen) printf(" (RECONNECTED)\n"); @@ -491,9 +491,8 @@ makeentry(ino_t parent, ino_t ino, char *name) idesc.id_fix = DONTKNOW; idesc.id_name = name; dp = ginode(parent); - if (fs2h32(dp->e2di_size) % sblock.e2fs_bsize) { - dp->e2di_size = - h2fs32(roundup(fs2h32(dp->e2di_size), sblock.e2fs_bsize)); + if (inosize(dp) % sblock.e2fs_bsize) { + inossize(dp, roundup(inosize(dp), sblock.e2fs_bsize)); inodirty(); } if ((ckinode(dp, &idesc) & ALTERED) != 0) @@ -520,15 +519,15 @@ expanddir(struct ext2fs_dinode *dp, char *name) exit(8); } - lastbn = lblkno(&sblock, fs2h32(dp->e2di_size)); + lastbn = lblkno(&sblock, inosize(dp)); if (lastbn >= NDADDR - 1 || fs2h32(dp->e2di_blocks[lastbn]) == 0 || - fs2h32(dp->e2di_size) == 0) + inosize(dp) == 0) return (0); if ((newblk = allocblk()) == 0) return (0); dp->e2di_blocks[lastbn + 1] = dp->e2di_blocks[lastbn]; dp->e2di_blocks[lastbn] = h2fs32(newblk); - dp->e2di_size = h2fs32(fs2h32(dp->e2di_size) + sblock.e2fs_bsize); + inossize(dp, inosize(dp) + sblock.e2fs_bsize); dp->e2di_nblock = h2fs32(fs2h32(dp->e2di_nblock) + 1); bp = getdirblk(fs2h32(dp->e2di_blocks[lastbn + 1]), sblock.e2fs_bsize); @@ -558,6 +557,7 @@ bad: dp->e2di_blocks[lastbn] = dp->e2di_blocks[lastbn + 1]; dp->e2di_blocks[lastbn + 1] = 0; dp->e2di_size = h2fs32(fs2h32(dp->e2di_size) - sblock.e2fs_bsize); + inossize(dp, inosize(dp) - sblock.e2fs_bsize); dp->e2di_nblock = h2fs32(fs2h32(dp->e2di_nblock) - 1); freeblk(newblk); return (0); |