projects
/
fio.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
61a179a
)
Revert "Convert file hash lock to spinlocks"
author
Jens Axboe
<jens.axboe@oracle.com>
Fri, 13 Jun 2008 06:38:25 +0000
(08:38 +0200)
committer
Jens Axboe
<jens.axboe@oracle.com>
Fri, 13 Jun 2008 06:38:25 +0000
(08:38 +0200)
This reverts commit
0ec7b3c9a0926e6377bd145206bb9f6a70be610d
.
filehash.c
patch
|
blob
|
blame
|
history
diff --git
a/filehash.c
b/filehash.c
index 97c0b3c7633d0e28ab4f44231679301a8d344e6c..a00ac7885721c60b839f0b6c26144f6355b065a9 100644
(file)
--- a/
filehash.c
+++ b/
filehash.c
@@
-5,15
+5,13
@@
#include "flist.h"
#include "crc/crc16.h"
#include "flist.h"
#include "crc/crc16.h"
-#include "spinlock.h"
-
#define HASH_BUCKETS 512
#define HASH_MASK (HASH_BUCKETS - 1)
unsigned int file_hash_size = HASH_BUCKETS * sizeof(struct flist_head);
static struct flist_head *file_hash;
#define HASH_BUCKETS 512
#define HASH_MASK (HASH_BUCKETS - 1)
unsigned int file_hash_size = HASH_BUCKETS * sizeof(struct flist_head);
static struct flist_head *file_hash;
-static struct fio_
spinlock
*hash_lock;
+static struct fio_
mutex
*hash_lock;
static unsigned short hash(const char *name)
{
static unsigned short hash(const char *name)
{
@@
-22,7
+20,7
@@
static unsigned short hash(const char *name)
void remove_file_hash(struct fio_file *f)
{
void remove_file_hash(struct fio_file *f)
{
- fio_
spin_lock
(hash_lock);
+ fio_
mutex_down
(hash_lock);
if (f->flags & FIO_FILE_HASHED) {
assert(!flist_empty(&f->hash_list));
if (f->flags & FIO_FILE_HASHED) {
assert(!flist_empty(&f->hash_list));
@@
-30,7
+28,7
@@
void remove_file_hash(struct fio_file *f)
f->flags &= ~FIO_FILE_HASHED;
}
f->flags &= ~FIO_FILE_HASHED;
}
- fio_
spin_unlock
(hash_lock);
+ fio_
mutex_up
(hash_lock);
}
static struct fio_file *__lookup_file_hash(const char *name)
}
static struct fio_file *__lookup_file_hash(const char *name)
@@
-54,9
+52,9
@@
struct fio_file *lookup_file_hash(const char *name)
{
struct fio_file *f;
{
struct fio_file *f;
- fio_
spin_lock
(hash_lock);
+ fio_
mutex_down
(hash_lock);
f = __lookup_file_hash(name);
f = __lookup_file_hash(name);
- fio_
spin_unlock
(hash_lock);
+ fio_
mutex_up
(hash_lock);
return f;
}
return f;
}
@@
-69,7
+67,7
@@
struct fio_file *add_file_hash(struct fio_file *f)
INIT_FLIST_HEAD(&f->hash_list);
INIT_FLIST_HEAD(&f->hash_list);
- fio_
spin_lock
(hash_lock);
+ fio_
mutex_down
(hash_lock);
alias = __lookup_file_hash(f->file_name);
if (!alias) {
alias = __lookup_file_hash(f->file_name);
if (!alias) {
@@
-77,7
+75,7
@@
struct fio_file *add_file_hash(struct fio_file *f)
flist_add_tail(&f->hash_list, &file_hash[hash(f->file_name)]);
}
flist_add_tail(&f->hash_list, &file_hash[hash(f->file_name)]);
}
- fio_
spin_unlock
(hash_lock);
+ fio_
mutex_up
(hash_lock);
return alias;
}
return alias;
}
@@
-85,17
+83,16
@@
void file_hash_exit(void)
{
unsigned int i, has_entries = 0;
{
unsigned int i, has_entries = 0;
- fio_
spin_lock
(hash_lock);
+ fio_
mutex_down
(hash_lock);
for (i = 0; i < HASH_BUCKETS; i++)
has_entries += !flist_empty(&file_hash[i]);
for (i = 0; i < HASH_BUCKETS; i++)
has_entries += !flist_empty(&file_hash[i]);
-
- file_hash = NULL;
- fio_spin_unlock(hash_lock);
+ fio_mutex_up(hash_lock);
if (has_entries)
log_err("fio: file hash not empty on exit\n");
if (has_entries)
log_err("fio: file hash not empty on exit\n");
- fio_spinlock_remove(hash_lock);
+ file_hash = NULL;
+ fio_mutex_remove(hash_lock);
hash_lock = NULL;
}
hash_lock = NULL;
}
@@
-107,5
+104,5
@@
void file_hash_init(void *ptr)
for (i = 0; i < HASH_BUCKETS; i++)
INIT_FLIST_HEAD(&file_hash[i]);
for (i = 0; i < HASH_BUCKETS; i++)
INIT_FLIST_HEAD(&file_hash[i]);
- hash_lock = fio_
spinlock_init(
);
+ hash_lock = fio_
mutex_init(1
);
}
}