2022-06-03 19:15:11 +00:00
|
|
|
/* SPDX-License-Identifier: BSD-3-Clause
|
2022-11-01 20:26:26 +00:00
|
|
|
* Copyright (C) 2017 Intel Corporation.
|
2017-09-14 14:53:36 +00:00
|
|
|
* All rights reserved.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef SPDK_INTERNAL_LVOLSTORE_H
|
|
|
|
#define SPDK_INTERNAL_LVOLSTORE_H
|
|
|
|
|
2017-11-30 18:34:00 +00:00
|
|
|
#include "spdk/blob.h"
|
2017-09-14 14:53:36 +00:00
|
|
|
#include "spdk/lvol.h"
|
2021-05-03 20:35:59 +00:00
|
|
|
#include "spdk/queue.h"
|
2018-03-02 00:59:50 +00:00
|
|
|
#include "spdk/uuid.h"
|
2017-09-14 14:53:36 +00:00
|
|
|
|
2017-09-29 07:46:50 +00:00
|
|
|
/* Default size of blobstore cluster */
|
2018-01-31 14:43:12 +00:00
|
|
|
#define SPDK_LVS_OPTS_CLUSTER_SZ (4 * 1024 * 1024)
|
2017-09-29 07:46:50 +00:00
|
|
|
|
2019-01-18 10:47:46 +00:00
|
|
|
/* UUID + '_' + blobid (20 characters for uint64_t).
|
|
|
|
* Null terminator is already included in SPDK_UUID_STRING_LEN. */
|
|
|
|
#define SPDK_LVOL_UNIQUE_ID_MAX (SPDK_UUID_STRING_LEN + 1 + 20)
|
|
|
|
|
2017-09-19 14:09:43 +00:00
|
|
|
struct spdk_lvs_req {
|
|
|
|
spdk_lvs_op_complete cb_fn;
|
|
|
|
void *cb_arg;
|
2018-01-10 10:03:39 +00:00
|
|
|
struct spdk_lvol_store *lvol_store;
|
|
|
|
int lvserrno;
|
2017-09-19 14:09:43 +00:00
|
|
|
};
|
2017-09-14 14:53:36 +00:00
|
|
|
|
2021-10-05 03:28:38 +00:00
|
|
|
struct spdk_lvs_grow_req {
|
2023-02-23 12:12:48 +00:00
|
|
|
struct spdk_lvs_req base;
|
2021-10-05 03:28:38 +00:00
|
|
|
spdk_lvs_op_complete cb_fn;
|
|
|
|
void *cb_arg;
|
|
|
|
struct lvol_store_bdev *lvs_bdev;
|
|
|
|
int lvol_cnt;
|
|
|
|
};
|
|
|
|
|
2017-09-19 14:09:43 +00:00
|
|
|
struct spdk_lvol_req {
|
2018-01-10 10:02:27 +00:00
|
|
|
spdk_lvol_op_complete cb_fn;
|
2017-09-19 14:09:43 +00:00
|
|
|
void *cb_arg;
|
2017-10-20 09:43:07 +00:00
|
|
|
struct spdk_lvol *lvol;
|
2018-03-19 21:05:44 +00:00
|
|
|
size_t sz;
|
2018-04-23 12:30:16 +00:00
|
|
|
struct spdk_io_channel *channel;
|
2018-01-10 10:02:27 +00:00
|
|
|
char name[SPDK_LVOL_NAME_MAX];
|
2017-09-19 14:09:43 +00:00
|
|
|
};
|
2017-09-14 14:53:36 +00:00
|
|
|
|
2017-09-19 14:09:43 +00:00
|
|
|
struct spdk_lvs_with_handle_req {
|
|
|
|
spdk_lvs_op_with_handle_complete cb_fn;
|
|
|
|
void *cb_arg;
|
|
|
|
struct spdk_lvol_store *lvol_store;
|
|
|
|
struct spdk_bs_dev *bs_dev;
|
|
|
|
struct spdk_bdev *base_bdev;
|
2017-10-27 13:47:34 +00:00
|
|
|
int lvserrno;
|
2017-09-19 14:09:43 +00:00
|
|
|
};
|
2017-09-14 14:53:36 +00:00
|
|
|
|
2017-10-20 22:22:11 +00:00
|
|
|
struct spdk_lvs_destroy_req {
|
|
|
|
spdk_lvs_op_complete cb_fn;
|
|
|
|
void *cb_arg;
|
|
|
|
struct spdk_lvol_store *lvs;
|
|
|
|
};
|
|
|
|
|
2017-09-19 14:09:43 +00:00
|
|
|
struct spdk_lvol_with_handle_req {
|
|
|
|
spdk_lvol_op_with_handle_complete cb_fn;
|
|
|
|
void *cb_arg;
|
|
|
|
struct spdk_lvol *lvol;
|
2017-09-14 14:53:36 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct spdk_lvol_store {
|
|
|
|
struct spdk_bs_dev *bs_dev;
|
|
|
|
struct spdk_blob_store *blobstore;
|
2017-09-22 12:13:56 +00:00
|
|
|
struct spdk_blob *super_blob;
|
|
|
|
spdk_blob_id super_blob_id;
|
2018-03-02 00:59:50 +00:00
|
|
|
struct spdk_uuid uuid;
|
2017-10-19 15:30:32 +00:00
|
|
|
int lvol_count;
|
|
|
|
int lvols_opened;
|
2017-09-14 14:53:36 +00:00
|
|
|
TAILQ_HEAD(, spdk_lvol) lvols;
|
2018-04-12 08:10:49 +00:00
|
|
|
TAILQ_HEAD(, spdk_lvol) pending_lvols;
|
2023-02-21 15:30:17 +00:00
|
|
|
TAILQ_HEAD(, spdk_lvol) retry_open_lvols;
|
2017-10-18 18:05:41 +00:00
|
|
|
bool on_list;
|
|
|
|
TAILQ_ENTRY(spdk_lvol_store) link;
|
2017-08-29 17:37:41 +00:00
|
|
|
char name[SPDK_LVS_NAME_MAX];
|
2018-01-10 10:03:39 +00:00
|
|
|
char new_name[SPDK_LVS_NAME_MAX];
|
2017-09-14 14:53:36 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct spdk_lvol {
|
|
|
|
struct spdk_lvol_store *lvol_store;
|
|
|
|
struct spdk_blob *blob;
|
|
|
|
spdk_blob_id blob_id;
|
2019-01-18 10:47:46 +00:00
|
|
|
char unique_id[SPDK_LVOL_UNIQUE_ID_MAX];
|
2017-10-24 02:51:49 +00:00
|
|
|
char name[SPDK_LVOL_NAME_MAX];
|
2018-03-06 23:54:38 +00:00
|
|
|
struct spdk_uuid uuid;
|
|
|
|
char uuid_str[SPDK_UUID_STRING_LEN];
|
2018-01-31 16:55:54 +00:00
|
|
|
bool thin_provision;
|
2017-09-14 14:53:36 +00:00
|
|
|
struct spdk_bdev *bdev;
|
2017-10-20 08:34:22 +00:00
|
|
|
int ref_count;
|
2017-10-25 08:15:02 +00:00
|
|
|
bool action_in_progress;
|
2019-01-22 08:47:24 +00:00
|
|
|
enum blob_clear_method clear_method;
|
2017-09-14 14:53:36 +00:00
|
|
|
TAILQ_ENTRY(spdk_lvol) link;
|
|
|
|
};
|
|
|
|
|
2017-09-18 08:49:22 +00:00
|
|
|
struct lvol_store_bdev *vbdev_lvol_store_first(void);
|
|
|
|
struct lvol_store_bdev *vbdev_lvol_store_next(struct lvol_store_bdev *prev);
|
|
|
|
|
2018-03-19 21:05:44 +00:00
|
|
|
void spdk_lvol_resize(struct spdk_lvol *lvol, uint64_t sz, spdk_lvol_op_complete cb_fn,
|
|
|
|
void *cb_arg);
|
2017-10-02 08:17:13 +00:00
|
|
|
|
2019-01-15 15:31:05 +00:00
|
|
|
void spdk_lvol_set_read_only(struct spdk_lvol *lvol, spdk_lvol_op_complete cb_fn,
|
|
|
|
void *cb_arg);
|
|
|
|
|
2017-09-14 14:53:36 +00:00
|
|
|
#endif /* SPDK_INTERNAL_LVOLSTORE_H */
|