lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:	Thu, 08 Mar 2012 12:38:17 +0800
From:	Wang Sheng-Hui <shhuiw@...il.com>
To:	sensille@....net, Chris Mason <chris.mason@...cle.com>,
	linux-btrfs@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [PATCH] btrfs/ulist: replace the magic number 128 with macro definition
 ULIST_SIZE_INCREMENT

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@...il.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

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists