From 50d65e6e8dfe7acfb233acf00aae3c86ad106694 Mon Sep 17 00:00:00 2001 From: delphij Date: Mon, 7 Mar 2005 08:42:49 +0000 Subject: Make background fsck based summary adjustments actually work by initializing the sysctl mibs data before actually using them. The original patchset (which is the actual version that is running on my testboxes) have checked whether all of these sysctls and refuses to do background fsck if we don't have them. Kirk has pointed out that refusing running fsck on old kernels is pointless, as old kernels will recompute the summary at mount time, so I have removed these checks. Unfortunatelly, as the checks will initialize the mib values of those sysctl's, and which are vital for the runtime summary adjustment to work, we can not simply remove the check, which will lead to problem when running background fsck over a dirty volume. Add these checks in a different way: give a warning rather than refusing to work, and complain if the functionality is not available when adjustments are necessary. Noticed by: A power failure at my lab Pointy hat: me MFC After: 3 days --- sbin/fsck_ffs/pass5.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'sbin/fsck_ffs/pass5.c') diff --git a/sbin/fsck_ffs/pass5.c b/sbin/fsck_ffs/pass5.c index 796b546..693831f 100644 --- a/sbin/fsck_ffs/pass5.c +++ b/sbin/fsck_ffs/pass5.c @@ -358,7 +358,7 @@ pass5(void) if (cmd.value != 0) { if (debug) printf("adjndir by %+" PRIi64 "\n", cmd.value); - if (sysctl(adjndir, MIBSIZE, 0, 0, + if (bkgrdsumadj == 0 || sysctl(adjndir, MIBSIZE, 0, 0, &cmd, sizeof cmd) == -1) rwerror("ADJUST NUMBER OF DIRECTORIES", cmd.value); } @@ -367,7 +367,7 @@ pass5(void) if (cmd.value != 0) { if (debug) printf("adjnbfree by %+" PRIi64 "\n", cmd.value); - if (sysctl(adjnbfree, MIBSIZE, 0, 0, + if (bkgrdsumadj == 0 || sysctl(adjnbfree, MIBSIZE, 0, 0, &cmd, sizeof cmd) == -1) rwerror("ADJUST NUMBER OF FREE BLOCKS", cmd.value); } @@ -376,7 +376,7 @@ pass5(void) if (cmd.value != 0) { if (debug) printf("adjnifree by %+" PRIi64 "\n", cmd.value); - if (sysctl(adjnifree, MIBSIZE, 0, 0, + if (bkgrdsumadj == 0 || sysctl(adjnifree, MIBSIZE, 0, 0, &cmd, sizeof cmd) == -1) rwerror("ADJUST NUMBER OF FREE INODES", cmd.value); } @@ -385,7 +385,7 @@ pass5(void) if (cmd.value != 0) { if (debug) printf("adjnffree by %+" PRIi64 "\n", cmd.value); - if (sysctl(adjnffree, MIBSIZE, 0, 0, + if (bkgrdsumadj == 0 || sysctl(adjnffree, MIBSIZE, 0, 0, &cmd, sizeof cmd) == -1) rwerror("ADJUST NUMBER OF FREE FRAGS", cmd.value); } @@ -394,7 +394,7 @@ pass5(void) if (cmd.value != 0) { if (debug) printf("adjnumclusters by %+" PRIi64 "\n", cmd.value); - if (sysctl(adjnumclusters, MIBSIZE, 0, 0, + if (bkgrdsumadj == 0 || sysctl(adjnumclusters, MIBSIZE, 0, 0, &cmd, sizeof cmd) == -1) rwerror("ADJUST NUMBER OF FREE CLUSTERS", cmd.value); } -- cgit v1.1