From: Wang Sheng-Hui <shhuiw@gmail.com>
To: sensille@gmx.net, Chris Mason <chris.mason@oracle.com>,
linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] btrfs/ulist: replace the magic number 128 with macro definition ULIST_SIZE_INCREMENT
Date: Thu, 08 Mar 2012 12:38:17 +0800 [thread overview]
Message-ID: <4F5837B9.6000006@gmail.com> (raw)
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
next reply other threads:[~2012-03-08 4:38 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-08 4:38 Wang Sheng-Hui [this message]
2012-03-15 15:01 ` [PATCH] btrfs/ulist: replace the magic number 128 with macro definition ULIST_SIZE_INCREMENT Andrea Gelmini
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4F5837B9.6000006@gmail.com \
--to=shhuiw@gmail.com \
--cc=chris.mason@oracle.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=sensille@gmx.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).