[PATCH]: reiserfs: G-blockalloc-for-disk-90%full.patch

Nikita Danilov (Nikita@Namesys.COM)
Thu, 30 Aug 2001 18:29:47 +0400


Hello, Linus,

This patch improves behavior of reiserfs block allocator when free
space is low. By default reiserfs uses so called "border algorithm"
that reserves first 10% of disk for "formatted nodes" that is,
nodes of reiserfs tree. With this patch this distinction is dropped
when free space goes below 10% of total disk space. This has been
found to improve performance.

This patch is against 2.4.10-pre2.
Please apply.

Nikita.
diff -rup linux/fs/reiserfs/bitmap.c linux.patched/fs/reiserfs/bitmap.c
--- linux/fs/reiserfs/bitmap.c Wed May 2 14:04:15 2001
+++ linux.patched/fs/reiserfs/bitmap.c Thu Aug 30 17:19:09 2001
@@ -499,6 +499,7 @@ int reiserfs_new_unf_blocknrs2 (struct r
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 +605,15 @@ int reiserfs_new_unf_blocknrs2 (struct r
** 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++) {
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/