linux/drivers/md/dm-vdo/index-layout.h
Matthew Sakai b46d79bdb8 dm vdo: add deduplication index storage interface
This patch adds infrastructure for managing reads and writes to the
underlying storage layer for the deduplication index. The deduplication
index uses dm-bufio for all of its reads and writes, so part of this
infrastructure is managing the various dm-bufio clients required. It also
adds the buffered reader and buffered writer abstractions, which simplify
reading and writing metadata structures that span several blocks.

This patch also includes structures and utilities for encoding and decoding
all of the deduplication index metadata, collectively called the index
layout.

Co-developed-by: J. corwin Coburn <corwin@hurlbutnet.net>
Signed-off-by: J. corwin Coburn <corwin@hurlbutnet.net>
Co-developed-by: Michael Sclafani <dm-devel@lists.linux.dev>
Signed-off-by: Michael Sclafani <dm-devel@lists.linux.dev>
Co-developed-by: Thomas Jaskiewicz <tom@jaskiewicz.us>
Signed-off-by: Thomas Jaskiewicz <tom@jaskiewicz.us>
Co-developed-by: John Wiele <jwiele@redhat.com>
Signed-off-by: John Wiele <jwiele@redhat.com>
Signed-off-by: Matthew Sakai <msakai@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@kernel.org>
2024-02-20 13:43:14 -05:00

44 lines
1.3 KiB
C

/* SPDX-License-Identifier: GPL-2.0-only */
/*
* Copyright 2023 Red Hat
*/
#ifndef UDS_INDEX_LAYOUT_H
#define UDS_INDEX_LAYOUT_H
#include "config.h"
#include "io-factory.h"
#include "uds.h"
/*
* The index layout describes the format of the index on the underlying storage, and is responsible
* for creating those structures when the index is first created. It also validates the index data
* when loading a saved index, and updates it when saving the index.
*/
struct index_layout;
int __must_check uds_make_index_layout(struct configuration *config, bool new_layout,
struct index_layout **layout_ptr);
void uds_free_index_layout(struct index_layout *layout);
int __must_check uds_replace_index_layout_storage(struct index_layout *layout,
struct block_device *bdev);
int __must_check uds_load_index_state(struct index_layout *layout,
struct uds_index *index);
int __must_check uds_save_index_state(struct index_layout *layout,
struct uds_index *index);
int __must_check uds_discard_open_chapter(struct index_layout *layout);
u64 __must_check uds_get_volume_nonce(struct index_layout *layout);
int __must_check uds_open_volume_bufio(struct index_layout *layout, size_t block_size,
unsigned int reserved_buffers,
struct dm_bufio_client **client_ptr);
#endif /* UDS_INDEX_LAYOUT_H */