2017-03-17 06:18:50 +00:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0 */
|
|
|
|
#ifndef _BCACHEFS_STR_HASH_H
|
|
|
|
#define _BCACHEFS_STR_HASH_H
|
|
|
|
|
|
|
|
#include "btree_iter.h"
|
|
|
|
#include "btree_update.h"
|
|
|
|
#include "checksum.h"
|
|
|
|
#include "error.h"
|
|
|
|
#include "inode.h"
|
|
|
|
#include "siphash.h"
|
2021-03-16 04:28:17 +00:00
|
|
|
#include "subvolume.h"
|
2017-03-17 06:18:50 +00:00
|
|
|
#include "super.h"
|
|
|
|
|
|
|
|
#include <linux/crc32c.h>
|
|
|
|
#include <crypto/hash.h>
|
|
|
|
#include <crypto/sha2.h>
|
|
|
|
|
2019-10-04 19:58:43 +00:00
|
|
|
static inline enum bch_str_hash_type
|
|
|
|
bch2_str_hash_opt_to_type(struct bch_fs *c, enum bch_str_hash_opts opt)
|
|
|
|
{
|
|
|
|
switch (opt) {
|
2021-02-21 00:47:58 +00:00
|
|
|
case BCH_STR_HASH_OPT_crc32c:
|
2021-11-11 17:11:33 +00:00
|
|
|
return BCH_STR_HASH_crc32c;
|
2021-02-21 00:47:58 +00:00
|
|
|
case BCH_STR_HASH_OPT_crc64:
|
2021-11-11 17:11:33 +00:00
|
|
|
return BCH_STR_HASH_crc64;
|
2021-02-21 00:47:58 +00:00
|
|
|
case BCH_STR_HASH_OPT_siphash:
|
2019-12-29 01:17:06 +00:00
|
|
|
return c->sb.features & (1ULL << BCH_FEATURE_new_siphash)
|
2021-11-11 17:11:33 +00:00
|
|
|
? BCH_STR_HASH_siphash
|
|
|
|
: BCH_STR_HASH_siphash_old;
|
2019-10-04 19:58:43 +00:00
|
|
|
default:
|
|
|
|
BUG();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-03-17 06:18:50 +00:00
|
|
|
struct bch_hash_info {
|
|
|
|
u8 type;
|
2021-05-15 00:02:44 +00:00
|
|
|
/*
|
|
|
|
* For crc32 or crc64 string hashes the first key value of
|
|
|
|
* the siphash_key (k0) is used as the key.
|
|
|
|
*/
|
|
|
|
SIPHASH_KEY siphash_key;
|
2017-03-17 06:18:50 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static inline struct bch_hash_info
|
2019-10-04 19:58:43 +00:00
|
|
|
bch2_hash_info_init(struct bch_fs *c, const struct bch_inode_unpacked *bi)
|
2017-03-17 06:18:50 +00:00
|
|
|
{
|
|
|
|
/* XXX ick */
|
|
|
|
struct bch_hash_info info = {
|
|
|
|
.type = (bi->bi_flags >> INODE_STR_HASH_OFFSET) &
|
2019-10-04 19:58:43 +00:00
|
|
|
~(~0U << INODE_STR_HASH_BITS),
|
2021-05-15 00:02:44 +00:00
|
|
|
.siphash_key = { .k0 = bi->bi_hash_seed }
|
2017-03-17 06:18:50 +00:00
|
|
|
};
|
|
|
|
|
2021-11-11 17:11:33 +00:00
|
|
|
if (unlikely(info.type == BCH_STR_HASH_siphash_old)) {
|
2017-03-17 06:18:50 +00:00
|
|
|
SHASH_DESC_ON_STACK(desc, c->sha256);
|
|
|
|
u8 digest[SHA256_DIGEST_SIZE];
|
|
|
|
|
|
|
|
desc->tfm = c->sha256;
|
|
|
|
|
|
|
|
crypto_shash_digest(desc, (void *) &bi->bi_hash_seed,
|
|
|
|
sizeof(bi->bi_hash_seed), digest);
|
|
|
|
memcpy(&info.siphash_key, digest, sizeof(info.siphash_key));
|
|
|
|
}
|
|
|
|
|
|
|
|
return info;
|
|
|
|
}
|
|
|
|
|
|
|
|
struct bch_str_hash_ctx {
|
|
|
|
union {
|
|
|
|
u32 crc32c;
|
|
|
|
u64 crc64;
|
|
|
|
SIPHASH_CTX siphash;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
static inline void bch2_str_hash_init(struct bch_str_hash_ctx *ctx,
|
|
|
|
const struct bch_hash_info *info)
|
|
|
|
{
|
|
|
|
switch (info->type) {
|
2021-11-11 17:11:33 +00:00
|
|
|
case BCH_STR_HASH_crc32c:
|
2021-05-15 00:02:44 +00:00
|
|
|
ctx->crc32c = crc32c(~0, &info->siphash_key.k0,
|
|
|
|
sizeof(info->siphash_key.k0));
|
2017-03-17 06:18:50 +00:00
|
|
|
break;
|
2021-11-11 17:11:33 +00:00
|
|
|
case BCH_STR_HASH_crc64:
|
2021-05-15 00:02:44 +00:00
|
|
|
ctx->crc64 = crc64_be(~0, &info->siphash_key.k0,
|
|
|
|
sizeof(info->siphash_key.k0));
|
2017-03-17 06:18:50 +00:00
|
|
|
break;
|
2021-11-11 17:11:33 +00:00
|
|
|
case BCH_STR_HASH_siphash_old:
|
|
|
|
case BCH_STR_HASH_siphash:
|
2017-03-17 06:18:50 +00:00
|
|
|
SipHash24_Init(&ctx->siphash, &info->siphash_key);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
BUG();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void bch2_str_hash_update(struct bch_str_hash_ctx *ctx,
|
|
|
|
const struct bch_hash_info *info,
|
|
|
|
const void *data, size_t len)
|
|
|
|
{
|
|
|
|
switch (info->type) {
|
2021-11-11 17:11:33 +00:00
|
|
|
case BCH_STR_HASH_crc32c:
|
2017-03-17 06:18:50 +00:00
|
|
|
ctx->crc32c = crc32c(ctx->crc32c, data, len);
|
|
|
|
break;
|
2021-11-11 17:11:33 +00:00
|
|
|
case BCH_STR_HASH_crc64:
|
2019-07-03 23:36:39 +00:00
|
|
|
ctx->crc64 = crc64_be(ctx->crc64, data, len);
|
2017-03-17 06:18:50 +00:00
|
|
|
break;
|
2021-11-11 17:11:33 +00:00
|
|
|
case BCH_STR_HASH_siphash_old:
|
|
|
|
case BCH_STR_HASH_siphash:
|
2017-03-17 06:18:50 +00:00
|
|
|
SipHash24_Update(&ctx->siphash, data, len);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
BUG();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline u64 bch2_str_hash_end(struct bch_str_hash_ctx *ctx,
|
|
|
|
const struct bch_hash_info *info)
|
|
|
|
{
|
|
|
|
switch (info->type) {
|
2021-11-11 17:11:33 +00:00
|
|
|
case BCH_STR_HASH_crc32c:
|
2017-03-17 06:18:50 +00:00
|
|
|
return ctx->crc32c;
|
2021-11-11 17:11:33 +00:00
|
|
|
case BCH_STR_HASH_crc64:
|
2017-03-17 06:18:50 +00:00
|
|
|
return ctx->crc64 >> 1;
|
2021-11-11 17:11:33 +00:00
|
|
|
case BCH_STR_HASH_siphash_old:
|
|
|
|
case BCH_STR_HASH_siphash:
|
2017-03-17 06:18:50 +00:00
|
|
|
return SipHash24_End(&ctx->siphash) >> 1;
|
|
|
|
default:
|
|
|
|
BUG();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
struct bch_hash_desc {
|
|
|
|
enum btree_id btree_id;
|
|
|
|
u8 key_type;
|
|
|
|
|
|
|
|
u64 (*hash_key)(const struct bch_hash_info *, const void *);
|
|
|
|
u64 (*hash_bkey)(const struct bch_hash_info *, struct bkey_s_c);
|
|
|
|
bool (*cmp_key)(struct bkey_s_c, const void *);
|
|
|
|
bool (*cmp_bkey)(struct bkey_s_c, struct bkey_s_c);
|
2021-10-12 16:06:02 +00:00
|
|
|
bool (*is_visible)(subvol_inum inum, struct bkey_s_c);
|
2017-03-17 06:18:50 +00:00
|
|
|
};
|
|
|
|
|
2021-10-12 16:06:02 +00:00
|
|
|
static inline bool is_visible_key(struct bch_hash_desc desc, subvol_inum inum, struct bkey_s_c k)
|
|
|
|
{
|
|
|
|
return k.k->type == desc.key_type &&
|
2022-09-04 18:10:12 +00:00
|
|
|
(!desc.is_visible ||
|
|
|
|
!inum.inum ||
|
|
|
|
desc.is_visible(inum, k));
|
2021-10-12 16:06:02 +00:00
|
|
|
}
|
|
|
|
|
2021-08-30 19:18:31 +00:00
|
|
|
static __always_inline int
|
2017-03-17 06:18:50 +00:00
|
|
|
bch2_hash_lookup(struct btree_trans *trans,
|
2021-08-30 19:18:31 +00:00
|
|
|
struct btree_iter *iter,
|
2017-03-17 06:18:50 +00:00
|
|
|
const struct bch_hash_desc desc,
|
|
|
|
const struct bch_hash_info *info,
|
2021-03-16 04:28:17 +00:00
|
|
|
subvol_inum inum, const void *key,
|
2017-03-17 06:18:50 +00:00
|
|
|
unsigned flags)
|
|
|
|
{
|
|
|
|
struct bkey_s_c k;
|
2021-03-16 04:28:17 +00:00
|
|
|
u32 snapshot;
|
2019-04-17 19:49:28 +00:00
|
|
|
int ret;
|
2017-03-17 06:18:50 +00:00
|
|
|
|
2021-03-16 04:28:17 +00:00
|
|
|
ret = bch2_subvolume_get_snapshot(trans, inum.subvol, &snapshot);
|
|
|
|
if (ret)
|
|
|
|
return ret;
|
|
|
|
|
2022-03-11 17:31:52 +00:00
|
|
|
for_each_btree_key_upto_norestart(trans, *iter, desc.btree_id,
|
2021-03-16 04:28:17 +00:00
|
|
|
SPOS(inum.inum, desc.hash_key(info, key), snapshot),
|
2022-03-11 17:31:52 +00:00
|
|
|
POS(inum.inum, U64_MAX),
|
2019-04-17 19:49:28 +00:00
|
|
|
BTREE_ITER_SLOTS|flags, k, ret) {
|
2021-10-12 16:06:02 +00:00
|
|
|
if (is_visible_key(desc, inum, k)) {
|
2017-03-17 06:18:50 +00:00
|
|
|
if (!desc.cmp_key(k, key))
|
2021-08-30 19:18:31 +00:00
|
|
|
return 0;
|
2021-02-21 00:09:53 +00:00
|
|
|
} else if (k.k->type == KEY_TYPE_hash_whiteout) {
|
2017-03-17 06:18:50 +00:00
|
|
|
;
|
|
|
|
} else {
|
|
|
|
/* hole, not found */
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2021-08-30 19:18:31 +00:00
|
|
|
bch2_trans_iter_exit(trans, iter);
|
2017-03-17 06:18:50 +00:00
|
|
|
|
2023-05-27 23:59:59 +00:00
|
|
|
return ret ?: -BCH_ERR_ENOENT_str_hash_lookup;
|
2017-03-17 06:18:50 +00:00
|
|
|
}
|
|
|
|
|
2021-08-30 19:18:31 +00:00
|
|
|
static __always_inline int
|
2017-03-17 06:18:50 +00:00
|
|
|
bch2_hash_hole(struct btree_trans *trans,
|
2021-08-30 19:18:31 +00:00
|
|
|
struct btree_iter *iter,
|
2017-03-17 06:18:50 +00:00
|
|
|
const struct bch_hash_desc desc,
|
|
|
|
const struct bch_hash_info *info,
|
2021-03-16 04:28:17 +00:00
|
|
|
subvol_inum inum, const void *key)
|
2017-03-17 06:18:50 +00:00
|
|
|
{
|
|
|
|
struct bkey_s_c k;
|
2021-03-16 04:28:17 +00:00
|
|
|
u32 snapshot;
|
2019-04-17 19:49:28 +00:00
|
|
|
int ret;
|
2017-03-17 06:18:50 +00:00
|
|
|
|
2021-03-16 04:28:17 +00:00
|
|
|
ret = bch2_subvolume_get_snapshot(trans, inum.subvol, &snapshot);
|
|
|
|
if (ret)
|
|
|
|
return ret;
|
|
|
|
|
2022-03-11 17:31:52 +00:00
|
|
|
for_each_btree_key_upto_norestart(trans, *iter, desc.btree_id,
|
2021-03-16 04:28:17 +00:00
|
|
|
SPOS(inum.inum, desc.hash_key(info, key), snapshot),
|
2022-03-11 17:31:52 +00:00
|
|
|
POS(inum.inum, U64_MAX),
|
|
|
|
BTREE_ITER_SLOTS|BTREE_ITER_INTENT, k, ret)
|
2021-10-12 16:06:02 +00:00
|
|
|
if (!is_visible_key(desc, inum, k))
|
2021-08-30 19:18:31 +00:00
|
|
|
return 0;
|
|
|
|
bch2_trans_iter_exit(trans, iter);
|
2017-03-17 06:18:50 +00:00
|
|
|
|
2022-09-18 21:10:33 +00:00
|
|
|
return ret ?: -BCH_ERR_ENOSPC_str_hash_create;
|
2017-03-17 06:18:50 +00:00
|
|
|
}
|
|
|
|
|
2019-02-20 19:18:44 +00:00
|
|
|
static __always_inline
|
|
|
|
int bch2_hash_needs_whiteout(struct btree_trans *trans,
|
|
|
|
const struct bch_hash_desc desc,
|
|
|
|
const struct bch_hash_info *info,
|
|
|
|
struct btree_iter *start)
|
2017-03-17 06:18:50 +00:00
|
|
|
{
|
2021-08-30 19:18:31 +00:00
|
|
|
struct btree_iter iter;
|
2017-03-17 06:18:50 +00:00
|
|
|
struct bkey_s_c k;
|
2019-09-25 19:57:56 +00:00
|
|
|
int ret;
|
2017-03-17 06:18:50 +00:00
|
|
|
|
2021-08-30 19:18:31 +00:00
|
|
|
bch2_trans_copy_iter(&iter, start);
|
2017-03-17 06:18:50 +00:00
|
|
|
|
2021-08-30 19:18:31 +00:00
|
|
|
bch2_btree_iter_advance(&iter);
|
2017-03-17 06:18:50 +00:00
|
|
|
|
2021-10-21 16:05:21 +00:00
|
|
|
for_each_btree_key_continue_norestart(iter, BTREE_ITER_SLOTS, k, ret) {
|
2017-03-17 06:18:50 +00:00
|
|
|
if (k.k->type != desc.key_type &&
|
2021-02-21 00:09:53 +00:00
|
|
|
k.k->type != KEY_TYPE_hash_whiteout)
|
2019-03-25 19:10:15 +00:00
|
|
|
break;
|
2017-03-17 06:18:50 +00:00
|
|
|
|
|
|
|
if (k.k->type == desc.key_type &&
|
2019-03-25 19:10:15 +00:00
|
|
|
desc.hash_bkey(info, k) <= start->pos.offset) {
|
2019-09-27 02:21:39 +00:00
|
|
|
ret = 1;
|
|
|
|
break;
|
2019-03-25 19:10:15 +00:00
|
|
|
}
|
2017-03-17 06:18:50 +00:00
|
|
|
}
|
2019-03-25 19:10:15 +00:00
|
|
|
|
2021-08-30 19:18:31 +00:00
|
|
|
bch2_trans_iter_exit(trans, &iter);
|
2019-09-25 19:57:56 +00:00
|
|
|
return ret;
|
2017-03-17 06:18:50 +00:00
|
|
|
}
|
|
|
|
|
2019-02-20 19:18:44 +00:00
|
|
|
static __always_inline
|
2022-09-04 18:10:12 +00:00
|
|
|
int bch2_hash_set_snapshot(struct btree_trans *trans,
|
|
|
|
const struct bch_hash_desc desc,
|
|
|
|
const struct bch_hash_info *info,
|
|
|
|
subvol_inum inum, u32 snapshot,
|
|
|
|
struct bkey_i *insert,
|
|
|
|
int flags,
|
|
|
|
int update_flags)
|
2017-03-17 06:18:50 +00:00
|
|
|
{
|
2021-08-30 19:18:31 +00:00
|
|
|
struct btree_iter iter, slot = { NULL };
|
2017-03-17 06:18:50 +00:00
|
|
|
struct bkey_s_c k;
|
2019-03-25 19:10:15 +00:00
|
|
|
bool found = false;
|
2019-04-17 19:49:28 +00:00
|
|
|
int ret;
|
2017-03-17 06:18:50 +00:00
|
|
|
|
2022-03-11 17:31:52 +00:00
|
|
|
for_each_btree_key_upto_norestart(trans, iter, desc.btree_id,
|
2022-09-04 18:10:12 +00:00
|
|
|
SPOS(insert->k.p.inode,
|
2021-03-16 04:28:17 +00:00
|
|
|
desc.hash_bkey(info, bkey_i_to_s_c(insert)),
|
|
|
|
snapshot),
|
2022-09-04 18:10:12 +00:00
|
|
|
POS(insert->k.p.inode, U64_MAX),
|
2019-04-17 19:49:28 +00:00
|
|
|
BTREE_ITER_SLOTS|BTREE_ITER_INTENT, k, ret) {
|
2021-10-12 16:06:02 +00:00
|
|
|
if (is_visible_key(desc, inum, k)) {
|
2017-03-17 06:18:50 +00:00
|
|
|
if (!desc.cmp_bkey(k, bkey_i_to_s_c(insert)))
|
|
|
|
goto found;
|
|
|
|
|
|
|
|
/* hash collision: */
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2021-08-30 19:18:31 +00:00
|
|
|
if (!slot.path &&
|
2020-12-02 04:11:53 +00:00
|
|
|
!(flags & BCH_HASH_SET_MUST_REPLACE))
|
2021-08-30 19:18:31 +00:00
|
|
|
bch2_trans_copy_iter(&slot, &iter);
|
2017-03-17 06:18:50 +00:00
|
|
|
|
2021-02-21 00:09:53 +00:00
|
|
|
if (k.k->type != KEY_TYPE_hash_whiteout)
|
2017-03-17 06:18:50 +00:00
|
|
|
goto not_found;
|
|
|
|
}
|
|
|
|
|
2019-09-27 02:21:39 +00:00
|
|
|
if (!ret)
|
2022-09-18 21:10:33 +00:00
|
|
|
ret = -BCH_ERR_ENOSPC_str_hash_create;
|
2019-09-27 02:21:39 +00:00
|
|
|
out:
|
2021-08-30 19:18:31 +00:00
|
|
|
bch2_trans_iter_exit(trans, &slot);
|
|
|
|
bch2_trans_iter_exit(trans, &iter);
|
2017-03-17 06:18:50 +00:00
|
|
|
|
2019-09-27 02:21:39 +00:00
|
|
|
return ret;
|
2017-03-17 06:18:50 +00:00
|
|
|
found:
|
2019-03-25 19:10:15 +00:00
|
|
|
found = true;
|
|
|
|
not_found:
|
|
|
|
|
|
|
|
if (!found && (flags & BCH_HASH_SET_MUST_REPLACE)) {
|
2023-05-27 23:59:59 +00:00
|
|
|
ret = -BCH_ERR_ENOENT_str_hash_set_must_replace;
|
2019-03-25 19:10:15 +00:00
|
|
|
} else if (found && (flags & BCH_HASH_SET_MUST_CREATE)) {
|
|
|
|
ret = -EEXIST;
|
|
|
|
} else {
|
2021-08-30 19:18:31 +00:00
|
|
|
if (!found && slot.path)
|
2019-09-27 02:21:39 +00:00
|
|
|
swap(iter, slot);
|
2019-03-25 19:10:15 +00:00
|
|
|
|
2021-08-30 19:18:31 +00:00
|
|
|
insert->k.p = iter.pos;
|
|
|
|
ret = bch2_trans_update(trans, &iter, insert, 0);
|
2019-03-25 19:10:15 +00:00
|
|
|
}
|
2017-03-17 06:18:50 +00:00
|
|
|
|
2019-09-27 02:21:39 +00:00
|
|
|
goto out;
|
2017-03-17 06:18:50 +00:00
|
|
|
}
|
|
|
|
|
2022-09-04 18:10:12 +00:00
|
|
|
static __always_inline
|
|
|
|
int bch2_hash_set(struct btree_trans *trans,
|
|
|
|
const struct bch_hash_desc desc,
|
|
|
|
const struct bch_hash_info *info,
|
|
|
|
subvol_inum inum,
|
|
|
|
struct bkey_i *insert, int flags)
|
|
|
|
{
|
|
|
|
u32 snapshot;
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
ret = bch2_subvolume_get_snapshot(trans, inum.subvol, &snapshot);
|
|
|
|
if (ret)
|
|
|
|
return ret;
|
|
|
|
|
|
|
|
insert->k.p.inode = inum.inum;
|
|
|
|
|
|
|
|
return bch2_hash_set_snapshot(trans, desc, info, inum,
|
|
|
|
snapshot, insert, flags, 0);
|
|
|
|
}
|
|
|
|
|
2019-02-20 19:18:44 +00:00
|
|
|
static __always_inline
|
|
|
|
int bch2_hash_delete_at(struct btree_trans *trans,
|
|
|
|
const struct bch_hash_desc desc,
|
|
|
|
const struct bch_hash_info *info,
|
2021-03-17 03:28:43 +00:00
|
|
|
struct btree_iter *iter,
|
|
|
|
unsigned update_flags)
|
2017-03-17 06:18:50 +00:00
|
|
|
{
|
|
|
|
struct bkey_i *delete;
|
|
|
|
int ret;
|
|
|
|
|
2021-06-02 04:15:07 +00:00
|
|
|
delete = bch2_trans_kmalloc(trans, sizeof(*delete));
|
|
|
|
ret = PTR_ERR_OR_ZERO(delete);
|
|
|
|
if (ret)
|
|
|
|
return ret;
|
|
|
|
|
2017-03-17 06:18:50 +00:00
|
|
|
ret = bch2_hash_needs_whiteout(trans, desc, info, iter);
|
|
|
|
if (ret < 0)
|
|
|
|
return ret;
|
|
|
|
|
|
|
|
bkey_init(&delete->k);
|
|
|
|
delete->k.p = iter->pos;
|
2021-02-21 00:09:53 +00:00
|
|
|
delete->k.type = ret ? KEY_TYPE_hash_whiteout : KEY_TYPE_deleted;
|
2017-03-17 06:18:50 +00:00
|
|
|
|
2021-03-17 03:28:43 +00:00
|
|
|
return bch2_trans_update(trans, iter, delete, update_flags);
|
2017-03-17 06:18:50 +00:00
|
|
|
}
|
|
|
|
|
2019-02-20 19:18:44 +00:00
|
|
|
static __always_inline
|
|
|
|
int bch2_hash_delete(struct btree_trans *trans,
|
|
|
|
const struct bch_hash_desc desc,
|
|
|
|
const struct bch_hash_info *info,
|
2021-03-16 04:28:17 +00:00
|
|
|
subvol_inum inum, const void *key)
|
2017-03-17 06:18:50 +00:00
|
|
|
{
|
2021-08-30 19:18:31 +00:00
|
|
|
struct btree_iter iter;
|
2020-01-27 22:47:07 +00:00
|
|
|
int ret;
|
2017-03-17 06:18:50 +00:00
|
|
|
|
2021-03-16 04:28:17 +00:00
|
|
|
ret = bch2_hash_lookup(trans, &iter, desc, info, inum, key,
|
2017-03-17 06:18:50 +00:00
|
|
|
BTREE_ITER_INTENT);
|
2021-08-30 19:18:31 +00:00
|
|
|
if (ret)
|
|
|
|
return ret;
|
2017-03-17 06:18:50 +00:00
|
|
|
|
2021-03-17 03:28:43 +00:00
|
|
|
ret = bch2_hash_delete_at(trans, desc, info, &iter, 0);
|
2021-08-30 19:18:31 +00:00
|
|
|
bch2_trans_iter_exit(trans, &iter);
|
2020-01-27 22:47:07 +00:00
|
|
|
return ret;
|
2017-03-17 06:18:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* _BCACHEFS_STR_HASH_H */
|