Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 201343
b: refs/heads/master
c: a6f80fb
h: refs/heads/master
i:
  201341: cbb76c4
  201339: 51ae47b
  201335: c26a527
  201327: 1ccd7d5
  201311: 6886f20
  201279: 3ecf220
  201215: c63d122
v: v3
  • Loading branch information
Andre Osterhues authored and Linus Torvalds committed Jul 29, 2010
1 parent e599dda commit da68871
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 6c50e1a49b4377b760ee46f824ed04b17be913e3
refs/heads/master: a6f80fb7b5986fda663d94079d3bba0937a6b6ff
17 changes: 9 additions & 8 deletions trunk/fs/ecryptfs/messaging.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ static struct mutex ecryptfs_msg_ctx_lists_mux;

static struct hlist_head *ecryptfs_daemon_hash;
struct mutex ecryptfs_daemon_hash_mux;
static int ecryptfs_hash_buckets;
static int ecryptfs_hash_bits;
#define ecryptfs_uid_hash(uid) \
hash_long((unsigned long)uid, ecryptfs_hash_buckets)
hash_long((unsigned long)uid, ecryptfs_hash_bits)

static u32 ecryptfs_msg_counter;
static struct ecryptfs_msg_ctx *ecryptfs_msg_ctx_arr;
Expand Down Expand Up @@ -486,18 +486,19 @@ int ecryptfs_init_messaging(void)
}
mutex_init(&ecryptfs_daemon_hash_mux);
mutex_lock(&ecryptfs_daemon_hash_mux);
ecryptfs_hash_buckets = 1;
while (ecryptfs_number_of_users >> ecryptfs_hash_buckets)
ecryptfs_hash_buckets++;
ecryptfs_hash_bits = 1;
while (ecryptfs_number_of_users >> ecryptfs_hash_bits)
ecryptfs_hash_bits++;
ecryptfs_daemon_hash = kmalloc((sizeof(struct hlist_head)
* ecryptfs_hash_buckets), GFP_KERNEL);
* (1 << ecryptfs_hash_bits)),
GFP_KERNEL);
if (!ecryptfs_daemon_hash) {
rc = -ENOMEM;
printk(KERN_ERR "%s: Failed to allocate memory\n", __func__);
mutex_unlock(&ecryptfs_daemon_hash_mux);
goto out;
}
for (i = 0; i < ecryptfs_hash_buckets; i++)
for (i = 0; i < (1 << ecryptfs_hash_bits); i++)
INIT_HLIST_HEAD(&ecryptfs_daemon_hash[i]);
mutex_unlock(&ecryptfs_daemon_hash_mux);
ecryptfs_msg_ctx_arr = kmalloc((sizeof(struct ecryptfs_msg_ctx)
Expand Down Expand Up @@ -554,7 +555,7 @@ void ecryptfs_release_messaging(void)
int i;

mutex_lock(&ecryptfs_daemon_hash_mux);
for (i = 0; i < ecryptfs_hash_buckets; i++) {
for (i = 0; i < (1 << ecryptfs_hash_bits); i++) {
int rc;

hlist_for_each_entry(daemon, elem,
Expand Down

0 comments on commit da68871

Please sign in to comment.