* [PATCH] btrfs/ulist: replace the magic number 128 with macro definition ULIST_SIZE_INCREMENT
@ 2012-03-08 4:38 Wang Sheng-Hui
2012-03-15 15:01 ` Andrea Gelmini
0 siblings, 1 reply; 2+ messages in thread
From: Wang Sheng-Hui @ 2012-03-08 4:38 UTC (permalink / raw)
To: sensille, Chris Mason, linux-btrfs, linux-kernel
Remove the magic number 128 in btrfs/ulist.c.
Introduce the macro definition ULIST_SIZE_INCREMENT in btrfs/ulist.h.
Signed-off-by: Wang Sheng-Hui <shhuiw@gmail.com>
---
fs/btrfs/ulist.c | 2 +-
fs/btrfs/ulist.h | 5 +++++
2 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/fs/btrfs/ulist.c b/fs/btrfs/ulist.c
index 12f5147..b8a4506 100644
--- a/fs/btrfs/ulist.c
+++ b/fs/btrfs/ulist.c
@@ -154,7 +154,7 @@ int ulist_add(struct ulist *ulist, u64 val, unsigned long aux,
}
if (ulist->nnodes >= ulist->nodes_alloced) {
- u64 new_alloced = ulist->nodes_alloced + 128;
+ u64 new_alloced = ulist->nodes_alloced + ULIST_SIZE_INCREMENT;
struct ulist_node *new_nodes;
void *old = NULL;
diff --git a/fs/btrfs/ulist.h b/fs/btrfs/ulist.h
index 2e25dec..590e396 100644
--- a/fs/btrfs/ulist.h
+++ b/fs/btrfs/ulist.h
@@ -23,6 +23,11 @@
* number of elements statically allocated inside struct ulist
*/
#define ULIST_SIZE 16
+/*
+ * increment as dynamically allocated elements space grows
+ */
+#define ULIST_SIZE_INCREMENT 128
+
/*
* element of the list
--
1.7.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-03-15 15:01 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-08 4:38 [PATCH] btrfs/ulist: replace the magic number 128 with macro definition ULIST_SIZE_INCREMENT Wang Sheng-Hui
2012-03-15 15:01 ` Andrea Gelmini
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).