File tree Expand file tree Collapse file tree 3 files changed +9
-10
lines changed Expand file tree Collapse file tree 3 files changed +9
-10
lines changed Original file line number Diff line number Diff line change 5
5
#include "flist.h"
6
6
#include "hash.h"
7
7
#include "filehash.h"
8
+ #include "smalloc.h"
8
9
#include "lib/bloom.h"
9
10
10
11
#define HASH_BUCKETS 512
11
12
#define HASH_MASK (HASH_BUCKETS - 1)
12
13
13
14
#define BLOOM_SIZE 16*1024*1024
14
15
15
- unsigned int file_hash_size = HASH_BUCKETS * sizeof (struct flist_head );
16
+ static unsigned int file_hash_size = HASH_BUCKETS * sizeof (struct flist_head );
16
17
17
18
static struct flist_head * file_hash ;
18
19
static struct fio_mutex * hash_lock ;
@@ -116,18 +117,20 @@ void file_hash_exit(void)
116
117
if (has_entries )
117
118
log_err ("fio: file hash not empty on exit\n" );
118
119
120
+ sfree (file_hash );
119
121
file_hash = NULL ;
120
122
fio_mutex_remove (hash_lock );
121
123
hash_lock = NULL ;
122
124
bloom_free (file_bloom );
123
125
file_bloom = NULL ;
124
126
}
125
127
126
- void file_hash_init (void * ptr )
128
+ void file_hash_init (void )
127
129
{
128
130
unsigned int i ;
129
131
130
- file_hash = ptr ;
132
+ file_hash = smalloc (file_hash_size );
133
+
131
134
for (i = 0 ; i < HASH_BUCKETS ; i ++ )
132
135
INIT_FLIST_HEAD (& file_hash [i ]);
133
136
Original file line number Diff line number Diff line change 3
3
4
4
#include "lib/types.h"
5
5
6
- extern unsigned int file_hash_size ;
7
-
8
- extern void file_hash_init (void * );
6
+ extern void file_hash_init (void );
9
7
extern void file_hash_exit (void );
10
8
extern struct fio_file * lookup_file_hash (const char * );
11
9
extern struct fio_file * add_file_hash (struct fio_file * );
Original file line number Diff line number Diff line change @@ -334,7 +334,6 @@ static int setup_thread_area(void)
334
334
do {
335
335
size_t size = max_jobs * sizeof (struct thread_data );
336
336
337
- size += file_hash_size ;
338
337
size += sizeof (unsigned int );
339
338
340
339
#ifndef CONFIG_NO_SHM
@@ -366,11 +365,10 @@ static int setup_thread_area(void)
366
365
#endif
367
366
368
367
memset (threads , 0 , max_jobs * sizeof (struct thread_data ));
369
- hash = (void * ) threads + max_jobs * sizeof (struct thread_data );
370
- fio_debug_jobp = (void * ) hash + file_hash_size ;
368
+ fio_debug_jobp = (void * ) threads + max_jobs * sizeof (struct thread_data );
371
369
* fio_debug_jobp = -1 ;
372
- file_hash_init (hash );
373
370
371
+ file_hash_init ();
374
372
flow_init ();
375
373
376
374
return 0 ;
You can’t perform that action at this time.
0 commit comments