xref: /spdk/module/bdev/split/vbdev_split.h (revision 488570ebd418ba07c9e69e65106dcc964f3bb41b)
1  /*   SPDX-License-Identifier: BSD-3-Clause
2   *   Copyright (c) Intel Corporation.
3   *   All rights reserved.
4   */
5  
6  #ifndef SPDK_VBDEV_SPLIT_H
7  #define SPDK_VBDEV_SPLIT_H
8  
9  #include "spdk/bdev_module.h"
10  
11  /**
12   * Add given disk name to split config. If bdev with \c base_bdev_name name
13   * exist the split bdevs will be created right away, if not the split bdevs will
14   * be created when base bdev became be available (during examination process).
15   *
16   * \param base_bdev_name Base bdev name
17   * \param split_count number of splits to be created.
18   * \param split_size_mb size of each bdev. If 0 use base bdev size / split_count
19   * \return value >= 0 - number of splits create. Negative errno code on error.
20   */
21  int create_vbdev_split(const char *base_bdev_name, unsigned split_count, uint64_t split_size_mb);
22  
23  /**
24   * Remove all created split bdevs and split config.
25   *
26   * \param base_bdev_name base bdev name
27   * \return 0 on success or negative errno value.
28   */
29  int vbdev_split_destruct(const char *base_bdev_name);
30  
31  /**
32   * Get the spdk_bdev_part_base associated with the given split base_bdev.
33   *
34   * \param base_bdev Bdev to get the part_base from
35   * \return pointer to the associated spdk_bdev_part_base
36   * \return NULL if the base_bdev is not being split by the split module
37   */
38  struct spdk_bdev_part_base *vbdev_split_get_part_base(struct spdk_bdev *base_bdev);
39  
40  #endif /* SPDK_VBDEV_SPLIT_H */
41