diff options
author | Kirk McKusick <mckusick@FreeBSD.org> | 2017-10-10 16:17:03 +0000 |
---|---|---|
committer | Kirk McKusick <mckusick@FreeBSD.org> | 2017-10-10 16:17:03 +0000 |
commit | 3abf5d76f2edee77981540feac63b2c0edfdbed7 (patch) | |
tree | 02bca67241e3410e2c7bbf6c8ae32f7d4c0d69b7 /sbin | |
parent | 838c6d51d5bae35918fc3d6bf1b185c596bc2ed1 (diff) | |
download | src-test2-3abf5d76f2edee77981540feac63b2c0edfdbed7.tar.gz src-test2-3abf5d76f2edee77981540feac63b2c0edfdbed7.zip |
Notes
Diffstat (limited to 'sbin')
-rw-r--r-- | sbin/growfs/Makefile | 2 | ||||
-rw-r--r-- | sbin/growfs/growfs.c | 18 |
2 files changed, 19 insertions, 1 deletions
diff --git a/sbin/growfs/Makefile b/sbin/growfs/Makefile index 01a209849789..8aeb9d77509e 100644 --- a/sbin/growfs/Makefile +++ b/sbin/growfs/Makefile @@ -20,7 +20,7 @@ CFLAGS+= -DFS_DEBUG NO_WCAST_ALIGN= yes .endif -LIBADD= util +LIBADD= ufs util HAS_TESTS= SUBDIR.${MK_TESTS}+= tests diff --git a/sbin/growfs/growfs.c b/sbin/growfs/growfs.c index 0aa4d4586e6f..44fb39ba0948 100644 --- a/sbin/growfs/growfs.c +++ b/sbin/growfs/growfs.c @@ -78,6 +78,7 @@ __FBSDID("$FreeBSD$"); #include <ufs/ufs/dinode.h> #include <ufs/ffs/fs.h> #include <libutil.h> +#include <libufs.h> #include "debug.h" @@ -121,6 +122,7 @@ static void updcsloc(time_t, int, int, unsigned int); static void frag_adjust(ufs2_daddr_t, int); static void updclst(int); static void mount_reload(const struct statfs *stfs); +static void cgckhash(struct cg *); /* * Here we actually start growing the file system. We basically read the @@ -480,6 +482,7 @@ initcg(int cylno, time_t modtime, int fso, unsigned int Nflag) sblock.fs_cstotal.cs_nifree += acg.cg_cs.cs_nifree; *cs = acg.cg_cs; + cgckhash(&acg); memcpy(iobuf, &acg, sblock.fs_cgsize); memset(iobuf + sblock.fs_cgsize, '\0', sblock.fs_bsize * 3 - sblock.fs_cgsize); @@ -771,6 +774,7 @@ updjcg(int cylno, time_t modtime, int fsi, int fso, unsigned int Nflag) /* * Write the updated "joining" cylinder group back to disk. */ + cgckhash(&acg); wtfs(fsbtodb(&sblock, cgtod(&sblock, cylno)), (size_t)sblock.fs_cgsize, (void *)&acg, fso, Nflag); DBG_PRINT0("jcg written\n"); @@ -1739,3 +1743,17 @@ mount_reload(const struct statfs *stfs) *errmsg != '\0' ? ": " : "", errmsg); } } + +/* + * Calculate the check-hash of the cylinder group. + */ +static void +cgckhash(cgp) + struct cg *cgp; +{ + + if ((sblock.fs_metackhash & CK_CYLGRP) == 0) + return; + cgp->cg_ckhash = 0; + cgp->cg_ckhash = calculate_crc32c(~0L, (void *)cgp, sblock.fs_cgsize); +} |