示例#1
0
struct fio_file *lookup_file_hash(const char *name)
{
	struct fio_file *f;

	fio_mutex_down(hash_lock);
	f = __lookup_file_hash(name);
	fio_mutex_up(hash_lock);
	return f;
}
示例#2
0
struct fio_file *add_file_hash(struct fio_file *f)
{
	struct fio_file *alias;

	if (f->flags & FIO_FILE_HASHED)
		return NULL;

	INIT_FLIST_HEAD(&f->hash_list);

	fio_mutex_down(hash_lock);

	alias = __lookup_file_hash(f->file_name);
	if (!alias) {
		f->flags |= FIO_FILE_HASHED;
		flist_add_tail(&f->hash_list, &file_hash[hash(f->file_name)]);
	}

	fio_mutex_up(hash_lock);
	return alias;
}
示例#3
0
文件: filehash.c 项目: radii/fio
struct fio_file *add_file_hash(struct fio_file *f)
{
    struct fio_file *alias;

    if (fio_file_hashed(f))
        return NULL;

    INIT_FLIST_HEAD(&f->hash_list);

    fio_mutex_down(hash_lock);

    alias = __lookup_file_hash(f->file_name);
    if (!alias) {
        fio_file_set_hashed(f);
        flist_add_tail(&f->hash_list, &file_hash[hash(f->file_name)]);
    }

    fio_mutex_up(hash_lock);
    return alias;
}