patch-2.4.10 linux/fs/reiserfs/bitmap.c

Next file: linux/fs/reiserfs/buffer2.c
Previous file: linux/fs/qnx4/inode.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.4.9/linux/fs/reiserfs/bitmap.c linux/fs/reiserfs/bitmap.c
@@ -1,7 +1,6 @@
 /*
  * Copyright 2000 by Hans Reiser, licensing governed by reiserfs/README
  */
-#ifdef __KERNEL__
 
 #include <linux/config.h>
 #include <linux/sched.h>
@@ -10,13 +9,6 @@
 #include <asm/bitops.h>
 #include <linux/list.h>
 
-#else
-
-#include "nokernel.h"
-
-#endif
-
-
 #ifdef CONFIG_REISERFS_CHECK
 
 /* this is a safety check to make sure
@@ -499,6 +491,7 @@
   unsigned long border = 0;
   unsigned long bstart = 0;
   unsigned long hash_in, hash_out;
+  unsigned long saved_search_start=search_start;
   int allocated[PREALLOCATION_SIZE];
   int blks;
 
@@ -604,7 +597,15 @@
   ** and should probably be removed
   */
   if ( search_start < border ) search_start=border; 
-  
+
+  /* If the disk free space is already below 10% we should 
+  ** start looking for the free blocks from the beginning 
+  ** of the partition, before the border line.
+  */
+  if ( SB_FREE_BLOCKS(th->t_super) <= (SB_BLOCK_COUNT(th->t_super) / 10) ) {
+    search_start=saved_search_start;
+  }
+
   *free_blocknrs = 0;
   blks = PREALLOCATION_SIZE-1;
   for (blks_gotten=0; blks_gotten<PREALLOCATION_SIZE; blks_gotten++) {

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)