Re: fsck_ffs diff needs testing

2011-04-11 Thread Otto Moerbeek
Please remove this diff from your tree for the moment.

I have found a bug.

More to follow soon.

-Otto



fsck_ffs diff needs testing

2011-04-07 Thread Otto Moerbeek
Hi,

I got little feedeback on this diff posed in a rather long thread, so
I am posting it again.

Please test this, it makes fsck_ffs much faster (especially with -p)
and less memory hungry in a lot of cases.

Note that to force a check with -p you need to unmount the filesystem,
mosty practical is  do it in single user mode:

# shutdown now
..
# umount -a
# fsck -pf

(Don't forget the unmount!)

Other way: pull the plug on a machine and let it reboot. That is a
more realistic check and it is safe because you already backup up all
your data, right? 

-Otto

Index: dir.c
===
RCS file: /cvs/src/sbin/fsck_ffs/dir.c,v
retrieving revision 1.24
diff -u -p -r1.24 dir.c
--- dir.c   27 Oct 2009 23:59:32 -  1.24
+++ dir.c   4 Apr 2011 09:15:49 -
@@ -443,8 +443,8 @@ linkup(ino_t orphan, ino_t parentdir)
idesc.id_type = ADDR;
idesc.id_func = pass4check;
idesc.id_number = oldlfdir;
-   adjust(idesc, lncntp[oldlfdir] + 1);
-   lncntp[oldlfdir] = 0;
+   adjust(idesc, ILNCOUNT(oldlfdir) + 1);
+   ILNCOUNT(oldlfdir) = 0;
dp = ginode(lfdir);
}
if (GET_ISTATE(lfdir) != DFOUND) {
@@ -457,7 +457,7 @@ linkup(ino_t orphan, ino_t parentdir)
printf(\n\n);
return (0);
}
-   lncntp[orphan]--;
+   ILNCOUNT(orphan)--;
if (lostdir) {
if ((changeino(orphan, .., lfdir)  ALTERED) == 0 
parentdir != (ino_t)-1)
@@ -465,7 +465,7 @@ linkup(ino_t orphan, ino_t parentdir)
dp = ginode(lfdir);
DIP_SET(dp, di_nlink, DIP(dp, di_nlink) + 1);
inodirty();
-   lncntp[lfdir]++;
+   ILNCOUNT(lfdir)++;
pwarn(DIR I=%u CONNECTED. , orphan);
if (parentdir != (ino_t)-1) {
printf(PARENT WAS I=%u\n, parentdir);
@@ -476,7 +476,7 @@ linkup(ino_t orphan, ino_t parentdir)
 * fixes the parent link count so that fsck does
 * not need to be rerun.
 */
-   lncntp[parentdir]++;
+   ILNCOUNT(parentdir)++;
}
if (preen == 0)
printf(\n);
@@ -636,7 +636,7 @@ allocdir(ino_t parent, ino_t request, in
DIP_SET(dp, di_nlink, 2);
inodirty();
if (ino == ROOTINO) {
-   lncntp[ino] = DIP(dp, di_nlink);
+   ILNCOUNT(ino) = DIP(dp, di_nlink);
cacheino(dp, ino);
return(ino);
}
@@ -650,8 +650,8 @@ allocdir(ino_t parent, ino_t request, in
inp-i_dotdot = parent;
SET_ISTATE(ino, GET_ISTATE(parent));
if (GET_ISTATE(ino) == DSTATE) {
-   lncntp[ino] = DIP(dp, di_nlink);
-   lncntp[parent]++;
+   ILNCOUNT(ino) = DIP(dp, di_nlink);
+   ILNCOUNT(parent)++;
}
dp = ginode(parent);
DIP_SET(dp, di_nlink, DIP(dp, di_nlink) + 1);
Index: extern.h
===
RCS file: /cvs/src/sbin/fsck_ffs/extern.h,v
retrieving revision 1.10
diff -u -p -r1.10 extern.h
--- extern.h25 Jun 2007 19:59:55 -  1.10
+++ extern.h4 Apr 2011 09:15:49 -
@@ -54,6 +54,7 @@ int   ftypeok(union dinode *);
 void   getpathname(char *, size_t, ino_t, ino_t);
 void   inocleanup(void);
 void   inodirty(void);
+struct inostat *inoinfo(ino_t);
 intlinkup(ino_t, ino_t);
 intmakeentry(ino_t, ino_t, char *);
 void   pass1(void);
Index: fsck.h
===
RCS file: /cvs/src/sbin/fsck_ffs/fsck.h,v
retrieving revision 1.23
diff -u -p -r1.23 fsck.h
--- fsck.h  10 Jun 2008 23:10:29 -  1.23
+++ fsck.h  4 Apr 2011 09:15:49 -
@@ -66,6 +66,19 @@ union dinode {
 #define BUFSIZ 1024
 #endif
 
+/*
+ * Each inode on the file system is described by the following structure.
+ * The linkcnt is initially set to the value in the inode. Each time it
+ * is found during the descent in passes 2, 3, and 4 the count is
+ * decremented. Any inodes whose count is non-zero after pass 4 needs to
+ * have its link count adjusted by the value remaining in ino_linkcnt.
+ */
+struct inostat {
+   charino_state;  /* state of inode, see below */
+   charino_type;   /* type of inode */
+   short   ino_linkcnt;/* number of links not found */
+};
+
 #defineUSTATE  01  /* inode not allocated */
 #defineFSTATE  02  /* inode is file */
 #defineDSTATE  03  /* inode is directory */
@@ -73,12 +86,20 @@ union dinode {
 #defineDCLEAR  05  /* directory is to be cleared */
 #defineFCLEAR  06  /* file is to be 

Re: fsck_ffs diff needs testing

2011-04-07 Thread Kenneth R Westerback
On Thu, Apr 07, 2011 at 11:08:05AM +0200, Otto Moerbeek wrote:
 Hi,
 
 I got little feedeback on this diff posed in a rather long thread, so
 I am posting it again.
 
 Please test this, it makes fsck_ffs much faster (especially with -p)
 and less memory hungry in a lot of cases.
 
 Note that to force a check with -p you need to unmount the filesystem,
 mosty practical is  do it in single user mode:
 
 # shutdown now
 ..
 # umount -a
 # fsck -pf
 
 (Don't forget the unmount!)
 
 Other way: pull the plug on a machine and let it reboot. That is a
 more realistic check and it is safe because you already backup up all
 your data, right? 

I went the unplug route on the i386 box and amd64 box I have here, and
the diff seems to work. Reads ok. I say go for it.

 Ken

 
   -Otto
   
 Index: dir.c
 ===
 RCS file: /cvs/src/sbin/fsck_ffs/dir.c,v
 retrieving revision 1.24
 diff -u -p -r1.24 dir.c
 --- dir.c 27 Oct 2009 23:59:32 -  1.24
 +++ dir.c 4 Apr 2011 09:15:49 -
 @@ -443,8 +443,8 @@ linkup(ino_t orphan, ino_t parentdir)
   idesc.id_type = ADDR;
   idesc.id_func = pass4check;
   idesc.id_number = oldlfdir;
 - adjust(idesc, lncntp[oldlfdir] + 1);
 - lncntp[oldlfdir] = 0;
 + adjust(idesc, ILNCOUNT(oldlfdir) + 1);
 + ILNCOUNT(oldlfdir) = 0;
   dp = ginode(lfdir);
   }
   if (GET_ISTATE(lfdir) != DFOUND) {
 @@ -457,7 +457,7 @@ linkup(ino_t orphan, ino_t parentdir)
   printf(\n\n);
   return (0);
   }
 - lncntp[orphan]--;
 + ILNCOUNT(orphan)--;
   if (lostdir) {
   if ((changeino(orphan, .., lfdir)  ALTERED) == 0 
   parentdir != (ino_t)-1)
 @@ -465,7 +465,7 @@ linkup(ino_t orphan, ino_t parentdir)
   dp = ginode(lfdir);
   DIP_SET(dp, di_nlink, DIP(dp, di_nlink) + 1);
   inodirty();
 - lncntp[lfdir]++;
 + ILNCOUNT(lfdir)++;
   pwarn(DIR I=%u CONNECTED. , orphan);
   if (parentdir != (ino_t)-1) {
   printf(PARENT WAS I=%u\n, parentdir);
 @@ -476,7 +476,7 @@ linkup(ino_t orphan, ino_t parentdir)
* fixes the parent link count so that fsck does
* not need to be rerun.
*/
 - lncntp[parentdir]++;
 + ILNCOUNT(parentdir)++;
   }
   if (preen == 0)
   printf(\n);
 @@ -636,7 +636,7 @@ allocdir(ino_t parent, ino_t request, in
   DIP_SET(dp, di_nlink, 2);
   inodirty();
   if (ino == ROOTINO) {
 - lncntp[ino] = DIP(dp, di_nlink);
 + ILNCOUNT(ino) = DIP(dp, di_nlink);
   cacheino(dp, ino);
   return(ino);
   }
 @@ -650,8 +650,8 @@ allocdir(ino_t parent, ino_t request, in
   inp-i_dotdot = parent;
   SET_ISTATE(ino, GET_ISTATE(parent));
   if (GET_ISTATE(ino) == DSTATE) {
 - lncntp[ino] = DIP(dp, di_nlink);
 - lncntp[parent]++;
 + ILNCOUNT(ino) = DIP(dp, di_nlink);
 + ILNCOUNT(parent)++;
   }
   dp = ginode(parent);
   DIP_SET(dp, di_nlink, DIP(dp, di_nlink) + 1);
 Index: extern.h
 ===
 RCS file: /cvs/src/sbin/fsck_ffs/extern.h,v
 retrieving revision 1.10
 diff -u -p -r1.10 extern.h
 --- extern.h  25 Jun 2007 19:59:55 -  1.10
 +++ extern.h  4 Apr 2011 09:15:49 -
 @@ -54,6 +54,7 @@ int ftypeok(union dinode *);
  void getpathname(char *, size_t, ino_t, ino_t);
  void inocleanup(void);
  void inodirty(void);
 +struct inostat *inoinfo(ino_t);
  int  linkup(ino_t, ino_t);
  int  makeentry(ino_t, ino_t, char *);
  void pass1(void);
 Index: fsck.h
 ===
 RCS file: /cvs/src/sbin/fsck_ffs/fsck.h,v
 retrieving revision 1.23
 diff -u -p -r1.23 fsck.h
 --- fsck.h10 Jun 2008 23:10:29 -  1.23
 +++ fsck.h4 Apr 2011 09:15:49 -
 @@ -66,6 +66,19 @@ union dinode {
  #define BUFSIZ 1024
  #endif
  
 +/*
 + * Each inode on the file system is described by the following structure.
 + * The linkcnt is initially set to the value in the inode. Each time it
 + * is found during the descent in passes 2, 3, and 4 the count is
 + * decremented. Any inodes whose count is non-zero after pass 4 needs to
 + * have its link count adjusted by the value remaining in ino_linkcnt.
 + */
 +struct inostat {
 + charino_state;  /* state of inode, see below */
 + charino_type;   /* type of inode */
 + short   ino_linkcnt;/* number of links not found */
 +};
 +
  #define  USTATE  01  /* inode not allocated */
  #define  FSTATE  02  /* inode is file */
  #define  DSTATE  03  /* inode is 

Re: fsck_ffs diff needs testing

2011-04-07 Thread Benny Lofgren
On 2011-04-07 11.08, Otto Moerbeek wrote:
 Hi,
 
 I got little feedeback on this diff posed in a rather long thread, so
 I am posting it again.
 
 Please test this, it makes fsck_ffs much faster (especially with -p)
 and less memory hungry in a lot of cases.

I've run it on a variety of file systems now and first of all, it seems
to work without regressions. It also looks like it has about 2/3 of its
previous memory footprint. However, I see very little increase in speed:

Unpatched, run with time /sbin/fsck_ffs -pf /dev/rraid0[adefghi]:

/dev/rraid0a: 2874 files, 82005 used, 46810 free (866 frags, 5743
blocks, 0.7% fragmentation)
/dev/rraid0d: 1477 files, 144486 used, 886745 free (553 frags, 110774
blocks, 0.1% fragmentation)
/dev/rraid0e: 224749 files, 1624996 used, 438155 free (48771 frags,
48673 blocks, 2.4% fragmentation)
/dev/rraid0f: 9437 files, 103157 used, 4024794 free (3370 frags, 502678
blocks, 0.1% fragmentation)
/dev/rraid0g: 498655 files, 6190187 used, 4128604 free (17188 frags,
513927 blocks, 0.2% fragmentation)
/dev/rraid0h: 90459 files, 445770 used, 2649301 free (20357 frags,
328618 blocks, 0.7% fragmentation)
/dev/rraid0i: 35896 files, 666529 used, 1266782 free (9006 frags, 157222
blocks, 0.5% fragmentation)

1m20.35s real 0m2.57s user 0m4.29s system

Patched, run with time /root/fsck_ffs -pf /dev/rraid0[adefghi]:

/dev/rraid0a: 2874 files, 82005 used, 46810 free (866 frags, 5743
blocks, 0.7% fragmentation)
/dev/rraid0d: 1477 files, 144486 used, 886745 free (553 frags, 110774
blocks, 0.1% fragmentation)
/dev/rraid0e: 224749 files, 1624996 used, 438155 free (48771 frags,
48673 blocks, 2.4% fragmentation)
/dev/rraid0f: 9437 files, 103157 used, 4024794 free (3370 frags, 502678
blocks, 0.1% fragmentation)
/dev/rraid0g: 498655 files, 6190187 used, 4128604 free (17188 frags,
513927 blocks, 0.2% fragmentation)
/dev/rraid0h: 90459 files, 445770 used, 2649301 free (20357 frags,
328618 blocks, 0.7% fragmentation)
/dev/rraid0i: 35896 files, 666529 used, 1266782 free (9006 frags, 157222
blocks, 0.5% fragmentation)

1m18.52s real 0m1.32s user 0m3.85s system

The file systems are organized like this:

skynet:~/fsck_ffs_patch# dumpfs -m /dev/rraid0a
# newfs command for /dev/rraid0a
newfs -O 1 -b 16384 -e 4096 -f 2048 -g 16384 -h 64 -m 5 -o time -s
525856 /dev/rraid0a
skynet:~/fsck_ffs_patch# dumpfs -m /dev/rraid0d
# newfs command for /dev/rraid0d
newfs -O 1 -b 16384 -e 4096 -f 2048 -g 16384 -h 64 -m 5 -o time -s
4197120 /dev/rraid0d
skynet:~/fsck_ffs_patch# dumpfs -m /dev/rraid0e
# newfs command for /dev/rraid0e
newfs -O 1 -b 16384 -e 4096 -f 2048 -g 16384 -h 64 -m 5 -o time -s
8390400 /dev/rraid0e
skynet:~/fsck_ffs_patch# dumpfs -m /dev/rraid0f
# newfs command for /dev/rraid0f
newfs -O 1 -b 16384 -e 4096 -f 2048 -g 16384 -h 64 -m 5 -o time -s
16780800 /dev/rraid0f
skynet:~/fsck_ffs_patch# dumpfs -m /dev/rraid0g
# newfs command for /dev/rraid0g
newfs -O 1 -b 16384 -e 4096 -f 2048 -g 16384 -h 64 -m 5 -o time -s
41944320 /dev/rraid0g
skynet:~/fsck_ffs_patch# dumpfs -m /dev/rraid0h
# newfs command for /dev/rraid0h
newfs -O 1 -b 16384 -e 4096 -f 2048 -g 16384 -h 64 -m 5 -o time -s
12583680 /dev/rraid0h
skynet:~/fsck_ffs_patch# dumpfs -m /dev/rraid0i
# newfs command for /dev/rraid0i
newfs -O 1 -b 16384 -e 4096 -f 2048 -g 16384 -h 64 -m 5 -o time -s
7857920 /dev/rraid0i
skynet:~/fsck_ffs_patch#

Btw, I noticed a small change in this diff compared to the one you posted
in the previous discussion thread. I assume this is the correct one to use?

skynet:~# diff fsck_ffs.patch fsck_ffs_2.patch
158c158
 +++ inode.c   31 Mar 2011 16:34:27 -
---
 +++ inode.c   4 Apr 2011 09:16:36 -
203c203
 + info[i].ino_state = USTATE;
---
 + SET_ISTATE(i, USTATE);


Regards,

/Benny

 Note that to force a check with -p you need to unmount the filesystem,
 mosty practical is  do it in single user mode:
 
 # shutdown now
 ..
 # umount -a
 # fsck -pf
 
 (Don't forget the unmount!)
 
 Other way: pull the plug on a machine and let it reboot. That is a
 more realistic check and it is safe because you already backup up all
 your data, right? 
 
   -Otto
   
 Index: dir.c
 ===
 RCS file: /cvs/src/sbin/fsck_ffs/dir.c,v
 retrieving revision 1.24
 diff -u -p -r1.24 dir.c
 --- dir.c 27 Oct 2009 23:59:32 -  1.24
 +++ dir.c 4 Apr 2011 09:15:49 -
 @@ -443,8 +443,8 @@ linkup(ino_t orphan, ino_t parentdir)
   idesc.id_type = ADDR;
   idesc.id_func = pass4check;
   idesc.id_number = oldlfdir;
 - adjust(idesc, lncntp[oldlfdir] + 1);
 - lncntp[oldlfdir] = 0;
 + adjust(idesc, ILNCOUNT(oldlfdir) + 1);
 + ILNCOUNT(oldlfdir) = 0;
   dp = ginode(lfdir);
   }
   if (GET_ISTATE(lfdir) != DFOUND) {
 @@ -457,7 +457,7 @@ linkup(ino_t orphan, ino_t parentdir)
   printf(\n\n);
   

Re: fsck_ffs diff needs testing

2011-04-07 Thread Otto Moerbeek
On Thu, Apr 07, 2011 at 04:28:25PM +0200, Benny Lofgren wrote:

 On 2011-04-07 15.06, Otto Moerbeek wrote:
  On Thu, Apr 07, 2011 at 02:34:27PM +0200, Benny Lofgren wrote:
  
  On 2011-04-07 11.08, Otto Moerbeek wrote:
  Hi,
 
  I got little feedeback on this diff posed in a rather long thread, so
  I am posting it again.
 
  Please test this, it makes fsck_ffs much faster (especially with -p)
  and less memory hungry in a lot of cases.
 
  I've run it on a variety of file systems now and first of all, it seems
  to work without regressions. It also looks like it has about 2/3 of its
  previous memory footprint. However, I see very little increase in speed:
  
  Were your filesystems mounted with softdep? Also, the most gain is
  realized with ffs1 filesystems.
 
 Apart from the / file system they had been mounted with softdep, yes.
 However they were of course unmounted when I ran fsck_ffs.
 
 Does softdep actually alter the physical file system structure on disk? I
 have always been under the impression that softdep affects stuff like how
 things are buffered and the order of which things are written to disk rather
 than *what* is written, am I mistaken?

softdep does not change the layout. But only filesystems which were
mounted with softdep get this optimization. There's a flag in teh
superblock to signal that. Filesystem mounted with softdep have better
guarantees about the cylinder group headers being consistent. 

-Otto


 And yes, they were all ffs1 filesystems. I have a 13 TB ffs2 file system on
 that machine as well, didn't try that now because I wanted to fire off a
 quick reply to your request for testing, and also you mentioned that ffs2
 is less (if at all) affected by this patch. I'll be glad to run a test
 against
 that volume as well, if you think there's an interest. Expect about 50
 minutes
 a run for one pass with the old and one pass with the new code though. :-)
 
 
 Regards,
 /Benny
 
 
  Unpatched, run with time /sbin/fsck_ffs -pf /dev/rraid0[adefghi]:
  [snip]
  1m20.35s real 0m2.57s user 0m4.29s system
 
  Patched, run with time /root/fsck_ffs -pf /dev/rraid0[adefghi]:
 
  [snip]
  1m18.52s real 0m1.32s user 0m3.85s system
 
  The file systems are organized like this:
 
  skynet:~/fsck_ffs_patch# dumpfs -m /dev/rraid0a
  # newfs command for /dev/rraid0a
  newfs -O 1 -b 16384 -e 4096 -f 2048 -g 16384 -h 64 -m 5 -o time -s
  525856 /dev/rraid0a
  skynet:~/fsck_ffs_patch# dumpfs -m /dev/rraid0d
  # newfs command for /dev/rraid0d
  newfs -O 1 -b 16384 -e 4096 -f 2048 -g 16384 -h 64 -m 5 -o time -s
  4197120 /dev/rraid0d
  skynet:~/fsck_ffs_patch# dumpfs -m /dev/rraid0e
  # newfs command for /dev/rraid0e
  newfs -O 1 -b 16384 -e 4096 -f 2048 -g 16384 -h 64 -m 5 -o time -s
  8390400 /dev/rraid0e
  skynet:~/fsck_ffs_patch# dumpfs -m /dev/rraid0f
  # newfs command for /dev/rraid0f
  newfs -O 1 -b 16384 -e 4096 -f 2048 -g 16384 -h 64 -m 5 -o time -s
  16780800 /dev/rraid0f
  skynet:~/fsck_ffs_patch# dumpfs -m /dev/rraid0g
  # newfs command for /dev/rraid0g
  newfs -O 1 -b 16384 -e 4096 -f 2048 -g 16384 -h 64 -m 5 -o time -s
  41944320 /dev/rraid0g
  skynet:~/fsck_ffs_patch# dumpfs -m /dev/rraid0h
  # newfs command for /dev/rraid0h
  newfs -O 1 -b 16384 -e 4096 -f 2048 -g 16384 -h 64 -m 5 -o time -s
  12583680 /dev/rraid0h
  skynet:~/fsck_ffs_patch# dumpfs -m /dev/rraid0i
  # newfs command for /dev/rraid0i
  newfs -O 1 -b 16384 -e 4096 -f 2048 -g 16384 -h 64 -m 5 -o time -s
  7857920 /dev/rraid0i
  skynet:~/fsck_ffs_patch#
  Btw, I noticed a small change in this diff compared to the one you posted
  in the previous discussion thread. I assume this is the correct one to use?
  
  Yes, though that's the most recent version.
  
  -Otto
 
  skynet:~# diff fsck_ffs.patch fsck_ffs_2.patch
  158c158
   +++ inode.c   31 Mar 2011 16:34:27 -
  ---
  +++ inode.c   4 Apr 2011 09:16:36 -
  203c203
   + info[i].ino_state = USTATE;
  ---
  + SET_ISTATE(i, USTATE);
 
 
  Regards,
 
  /Benny
  
 
 -- 
 internetlabbet.se / work:   +46 8 551 124 80  / Words must
 Benny L?fgren/  mobile: +46 70 718 11 90 /   be weighed,
 /   fax:+46 8 551 124 89/not counted.
/email:  benny -at- internetlabbet.se



Re: fsck_ffs diff needs testing

2011-04-07 Thread Otto Moerbeek
On Thu, Apr 07, 2011 at 11:05:42AM -0500, Amit Kulkarni wrote:

  Also, depending on the usage patterns, you might have a fs where high
  numbered inodes are used, while the fs itself is pretty empty. Filling
  up a fs with lots of files and them removing a lot of them is an
  example that could lead to such a situation. This diff does not speed
  things up in such cases.
 
  ...might have an impact in my case, since I often do things like rebuilding
  the system including tons of packages on this machine, and that use case of
  course perfectly matches what you say above. I think I'll remake these file
  systems and run the test again just to satisfy my curiosity. But that'll
  have to wait until after dinner. :-)
 
  Anyway, I see improvements both in memory usage and in speed, and I see no
  obvoius malfunctions, so I'd say it's a go.
 
 
 Hi Otto,
 
 Comparing your diff with FreeBSD svn (not cvs, they dropped cvs! my
 bad on the initial comment) after Benny pointed this out.
 
 http://svn.freebsd.org/viewvc/base/head/sbin/fsck_ffs/pass1.c?revision=201708view=markup
 
 Look at this comment inside the file
 
 /*
* This optimization speeds up future runs of fsck
* by trimming down the number of inodes in cylinder
* groups that formerly had many inodes but now have
* fewer in use.
*/
 
 and the commit entry by McKusick for rev 188110
 
 Update the actions previously attempted by the -D option to make them
 robust. With these changes fsck is now able to detect and reliably
 rebuild corrupted cylinder group maps. The -D option is no longer
 necessary as it has been replaced by a prompt asking whether the
 corrupted cylinder group should be rebuilt and doing so when requested.
 These actions are only offered and taken when running fsck in manual
 mode. Corrupted cylinder groups found during preen mode cause the fsck
 to fail.
 
 Add the -r option to free up excess unused inodes. Decreasing the
 number of preallocated inodes reduces the running time of future
 runs of fsck and frees up space that can allocated to files. The -r
 option is ignored when running in preen mode.
 --
 
 Will you please please please integrate that part of the code too!!!
 This is absolutely useful to have and is a fairly common situation. It
 will make fsck better and be a good way to partially defrag your fs.
 
 Or did you plan to keep that for later after more testing on this diff?
 
 Thanks,
 amit

Yes, I go step by step.

-Otto



Re: fsck_ffs diff needs testing

2011-04-07 Thread Amit Kulkarni
 Also, depending on the usage patterns, you might have a fs where high
 numbered inodes are used, while the fs itself is pretty empty. Filling
 up a fs with lots of files and them removing a lot of them is an
 example that could lead to such a situation. This diff does not speed
 things up in such cases.

 ...might have an impact in my case, since I often do things like rebuilding
 the system including tons of packages on this machine, and that use case of
 course perfectly matches what you say above. I think I'll remake these file
 systems and run the test again just to satisfy my curiosity. But that'll
 have to wait until after dinner. :-)

 Anyway, I see improvements both in memory usage and in speed, and I see no
 obvoius malfunctions, so I'd say it's a go.


Hi Otto,

Comparing your diff with FreeBSD svn (not cvs, they dropped cvs! my
bad on the initial comment) after Benny pointed this out.

http://svn.freebsd.org/viewvc/base/head/sbin/fsck_ffs/pass1.c?revision=201708view=markup

Look at this comment inside the file

/*
 * This optimization speeds up future runs of fsck
 * by trimming down the number of inodes in cylinder
 * groups that formerly had many inodes but now have
 * fewer in use.
 */

and the commit entry by McKusick for rev 188110

Update the actions previously attempted by the -D option to make them
robust. With these changes fsck is now able to detect and reliably
rebuild corrupted cylinder group maps. The -D option is no longer
necessary as it has been replaced by a prompt asking whether the
corrupted cylinder group should be rebuilt and doing so when requested.
These actions are only offered and taken when running fsck in manual
mode. Corrupted cylinder groups found during preen mode cause the fsck
to fail.

Add the -r option to free up excess unused inodes. Decreasing the
number of preallocated inodes reduces the running time of future
runs of fsck and frees up space that can allocated to files. The -r
option is ignored when running in preen mode.
--

Will you please please please integrate that part of the code too!!!
This is absolutely useful to have and is a fairly common situation. It
will make fsck better and be a good way to partially defrag your fs.

Or did you plan to keep that for later after more testing on this diff?

Thanks,
amit



Re: fsck_ffs diff needs testing

2011-04-07 Thread Amit Kulkarni
Thanks! I understand.

On Thu, Apr 7, 2011 at 11:09 AM, Otto Moerbeek o...@drijf.net wrote:
 On Thu, Apr 07, 2011 at 11:05:42AM -0500, Amit Kulkarni wrote:

  Also, depending on the usage patterns, you might have a fs where high
  numbered inodes are used, while the fs itself is pretty empty. Filling
  up a fs with lots of files and them removing a lot of them is an
  example that could lead to such a situation. This diff does not speed
  things up in such cases.
 
  ...might have an impact in my case, since I often do things like
rebuilding
  the system including tons of packages on this machine, and that use case
of
  course perfectly matches what you say above. I think I'll remake these
file
  systems and run the test again just to satisfy my curiosity. But that'll
  have to wait until after dinner. :-)
 
  Anyway, I see improvements both in memory usage and in speed, and I see
no
  obvoius malfunctions, so I'd say it's a go.


 Hi Otto,

 Comparing your diff with FreeBSD svn (not cvs, they dropped cvs! my
 bad on the initial comment) after Benny pointed this out.


http://svn.freebsd.org/viewvc/base/head/sbin/fsck_ffs/pass1.c?revision=201708
view=markup

 Look at this comment inside the file

 /*
* This optimization speeds up future runs of fsck
* by trimming down the number of inodes in cylinder
* groups that formerly had many inodes but now have
* fewer in use.
*/

 and the commit entry by McKusick for rev 188110

 Update the actions previously attempted by the -D option to make them
 robust. With these changes fsck is now able to detect and reliably
 rebuild corrupted cylinder group maps. The -D option is no longer
 necessary as it has been replaced by a prompt asking whether the
 corrupted cylinder group should be rebuilt and doing so when requested.
 These actions are only offered and taken when running fsck in manual
 mode. Corrupted cylinder groups found during preen mode cause the fsck
 to fail.

 Add the -r option to free up excess unused inodes. Decreasing the
 number of preallocated inodes reduces the running time of future
 runs of fsck and frees up space that can allocated to files. The -r
 option is ignored when running in preen mode.
 --

 Will you please please please integrate that part of the code too!!!
 This is absolutely useful to have and is a fairly common situation. It
 will make fsck better and be a good way to partially defrag your fs.

 Or did you plan to keep that for later after more testing on this diff?

 Thanks,
 amit

 Yes, I go step by step.

-Otto