summaryrefslogtreecommitdiff
path: root/filehash.c
diff options
context:
space:
mode:
authorJens Axboe <axboe@fb.com>2014-04-01 12:28:47 -0600
committerJens Axboe <axboe@fb.com>2014-04-01 12:28:47 -0600
commit90426237af4f3c9c7628aebfd4421fbe43d68c2a (patch)
treea560ac7ba61db6d8ca89145c5ef2678c7a153e90 /filehash.c
parent4db205dc7c0195cacc949cfbc461350ca6ec74b0 (diff)
downloadfio-90426237af4f3c9c7628aebfd4421fbe43d68c2a.tar.gz
fio-90426237af4f3c9c7628aebfd4421fbe43d68c2a.tar.bz2
Properly protect already-allocated file list
We need proper locking around it for thread based setups. Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'filehash.c')
-rw-r--r--filehash.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/filehash.c b/filehash.c
index 392464e2..2d9659c5 100644
--- a/filehash.c
+++ b/filehash.c
@@ -18,6 +18,16 @@ static unsigned short hash(const char *name)
return jhash(name, strlen(name), 0) & HASH_MASK;
}
+void fio_file_hash_lock(void)
+{
+ fio_mutex_down(hash_lock);
+}
+
+void fio_file_hash_unlock(void)
+{
+ fio_mutex_up(hash_lock);
+}
+
void remove_file_hash(struct fio_file *f)
{
fio_mutex_down(hash_lock);