btrfsprogs/0154-Allow-extent_buffers-to-use-more-ram.patch
David Sterba 2c5c7c6753 - add btrfsck repair options for:
- rebuild extent records
  - fix block group accounting
  - reset csums for rescue nodatasum mount
  - prune corrupt extent allocation tree blocks
- device scanning fixes for dm and multipath
- initrd support: move btrfs device scan after block device setup
- documentation updates
- add csize for file commpressed size
- updated restore utility

OBS-URL: https://build.opensuse.org/package/show/filesystems/btrfsprogs?expand=0&rev=118
2012-03-05 15:09:24 +00:00

55 lines
1.5 KiB
Diff

From 769671c6aeef3359498100f0ef31975706d99fca Mon Sep 17 00:00:00 2001
From: Chris Mason <chris.mason@oracle.com>
Date: Mon, 6 Feb 2012 05:06:18 -0500
Subject: [PATCH 03/18] Allow extent_buffers to use more ram
This changes free_some_buffers (called each time we allocate an extent
buffer) to allow a higher hard limit on the number of extent buffers
in use.
Signed-off-by: Chris Mason <chris.mason@oracle.com>
---
extent_io.c | 10 ++++++----
1 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/extent_io.c b/extent_io.c
index 9990338..ebb35b2 100644
--- a/extent_io.c
+++ b/extent_io.c
@@ -28,7 +28,8 @@
#include "extent_io.h"
#include "list.h"
-u64 cache_max = 1024 * 1024 * 32;
+u64 cache_soft_max = 1024 * 1024 * 256;
+u64 cache_hard_max = 1 * 1024 * 1024 * 1024;
void extent_io_tree_init(struct extent_io_tree *tree)
{
@@ -540,18 +541,19 @@ static int free_some_buffers(struct extent_io_tree *tree)
struct extent_buffer *eb;
struct list_head *node, *next;
- if (tree->cache_size < cache_max)
+ if (tree->cache_size < cache_soft_max)
return 0;
+
list_for_each_safe(node, next, &tree->lru) {
eb = list_entry(node, struct extent_buffer, lru);
if (eb->refs == 1) {
free_extent_buffer(eb);
- if (tree->cache_size < cache_max)
+ if (tree->cache_size < cache_hard_max)
break;
} else {
list_move_tail(&eb->lru, &tree->lru);
}
- if (nrscan++ > 64)
+ if (nrscan++ > 64 && tree->cache_size < cache_hard_max)
break;
}
return 0;
--
1.7.6.233.gd79bc