libstorage-ng
|
#include <Bcache.h>
Public Member Functions | |
BcacheType | get_type () const |
unsigned int | get_number () const |
const BlkDevice * | get_backing_device () const |
Get the BlkDevice used as backing device. More... | |
const BlkDevice * | get_blk_device () const ST_DEPRECATED |
Get the BlkDevice used as backing device. More... | |
bool | has_bcache_cset () const |
Returns true if a caching set is attached. More... | |
const BcacheCset * | get_bcache_cset () const |
Get the caching set associated with this bcache device. More... | |
void | add_bcache_cset (BcacheCset *bcache_cset) |
Associates a caching set to the bcache. More... | |
void | remove_bcache_cset () |
Removes association with a caching set. More... | |
CacheMode | get_cache_mode () const |
Returns cache mode attribute. More... | |
void | set_cache_mode (CacheMode mode) |
Sets cache mode attribute. More... | |
unsigned long long | get_sequential_cutoff () const |
Returns size of sequential_cutoff attribute. More... | |
unsigned | get_writeback_percent () const |
Returns percent of writeback dirty pages. More... | |
Impl & | get_impl () |
const Impl & | get_impl () const |
virtual Bcache * | clone () const override |
![]() | |
const Topology & | get_topology () const |
void | set_topology (const Topology &topology) |
unsigned int | get_range () const |
void | set_range (unsigned int range) |
bool | is_usable_as_partitionable () const |
Checks whether the partitionable is in general usable as a partitionable (can hold a partition table). More... | |
PtType | get_default_partition_table_type () const |
Get the default partition table type for the partitionable. More... | |
std::vector< PtType > | get_possible_partition_table_types () const |
Get possible partition table types for the disk. More... | |
PartitionTable * | create_partition_table (PtType pt_type) |
Create a partition table on the partitionable. More... | |
bool | has_partition_table () const |
PartitionTable * | get_partition_table () |
virtual std::string | partition_name (int number) const |
Return the name of the partition with the specified number. | |
const PartitionTable * | get_partition_table () const |
Impl & | get_impl () |
const Impl & | get_impl () const |
![]() | |
const std::string & | get_name () const |
void | set_name (const std::string &name) |
const Region & | get_region () const |
void | set_region (const Region ®ion) |
unsigned long long | get_size () const |
void | set_size (unsigned long long size) |
std::string | get_size_string () const |
Returns the size of the block device as a localised string. More... | |
const Topology & | get_topology () const |
Get the topology. | |
void | set_topology (const Topology &topology) |
Set the topology. More... | |
bool | is_active () const |
const std::string & | get_sysfs_name () const |
const std::string & | get_sysfs_path () const |
const std::vector< std::string > & | get_udev_paths () const |
const std::vector< std::string > & | get_udev_ids () const |
bool | is_usable_as_blk_device () const |
Checks whether the blk device is in general usable as a blk device. More... | |
const std::string & | get_dm_table_name () const |
Return device-mapper table name (dm-table-name for short). More... | |
void | set_dm_table_name (const std::string &dm_table_name) |
BlkFilesystem * | create_blk_filesystem (FsType fs_type) |
Creates a block filesystem on the block device. More... | |
bool | has_blk_filesystem () const |
BlkFilesystem * | get_blk_filesystem () |
const BlkFilesystem * | get_blk_filesystem () const |
BlkFilesystem * | create_filesystem (FsType fs_type) ST_DEPRECATED |
Creates a block filesystem on the block device. More... | |
bool | has_filesystem () const ST_DEPRECATED |
BlkFilesystem * | get_filesystem () ST_DEPRECATED |
const BlkFilesystem * | get_filesystem () const ST_DEPRECATED |
Encryption * | create_encryption (const std::string &dm_name) ST_DEPRECATED |
Creates an encryption device on the blk device. More... | |
Encryption * | create_encryption (const std::string &dm_name, EncryptionType type) |
Creates an encryption device on the blk device. More... | |
void | remove_encryption () |
Removes an encryption device on the blk device. More... | |
bool | has_encryption () const |
Encryption * | get_encryption () |
const Encryption * | get_encryption () const |
Bcache * | create_bcache (const std::string &name) |
Creates a Bcache on the blk device. More... | |
bool | has_bcache () const |
Bcache * | get_bcache () |
const Bcache * | get_bcache () const |
BcacheCset * | create_bcache_cset () |
Creates an BcacheCset on the blk device. More... | |
bool | has_bcache_cset () const |
BcacheCset * | get_bcache_cset () |
const BcacheCset * | get_bcache_cset () const |
std::vector< MountByType > | possible_mount_bys () const |
Returns the possible mount-by methods to reference the block device. | |
Impl & | get_impl () |
const Impl & | get_impl () const |
![]() | |
sid_t | get_sid () const |
bool | operator== (const Device &rhs) const |
bool | operator!= (const Device &rhs) const |
Device * | copy_to_devicegraph (Devicegraph *devicegraph) const |
Copies the device to the devicegraph. More... | |
bool | exists_in_devicegraph (const Devicegraph *devicegraph) const |
Checks if the device exists in the devicegraph. | |
bool | exists_in_probed () const |
Checks if the device exists in the probed devicegraph. | |
bool | exists_in_staging () const |
Checks if the device exists in the staging devicegraph. | |
bool | exists_in_system () const |
Checks if the device exists in the system devicegraph. | |
std::string | get_displayname () const |
ResizeInfo | detect_resize_info () const |
Detect the resize info of the device. More... | |
bool | has_children () const |
size_t | num_children () const |
bool | has_parents () const |
size_t | num_parents () const |
std::vector< Device * > | get_children () |
std::vector< const Device * > | get_children () const |
std::vector< Device * > | get_parents () |
std::vector< const Device * > | get_parents () const |
std::vector< Device * > | get_siblings (bool itself) |
std::vector< const Device * > | get_siblings (bool itself) const |
std::vector< Device * > | get_descendants (bool itself) |
std::vector< const Device * > | get_descendants (bool itself) const |
std::vector< Device * > | get_ancestors (bool itself) |
std::vector< const Device * > | get_ancestors (bool itself) const |
std::vector< Device * > | get_leaves (bool itself) |
std::vector< const Device * > | get_leaves (bool itself) const |
std::vector< Device * > | get_roots (bool itself) |
std::vector< const Device * > | get_roots (bool itself) const |
std::vector< Holder * > | get_in_holders () |
std::vector< const Holder * > | get_in_holders () const |
std::vector< Holder * > | get_out_holders () |
std::vector< const Holder * > | get_out_holders () const |
void | remove_descendants () |
const std::map< std::string, std::string > & | get_userdata () const |
void | set_userdata (const std::map< std::string, std::string > &userdata) |
std::string | get_name_sort_key () const |
Get a sort-key based on the device name. More... | |
Devicegraph * | get_devicegraph () |
const Devicegraph * | get_devicegraph () const |
Impl & | get_impl () |
const Impl & | get_impl () const |
void | save (xmlNode *node) const |
Static Public Member Functions | |
static Bcache * | create (Devicegraph *devicegraph, const std::string &dm_name) |
static Bcache * | create (Devicegraph *devicegraph, const std::string &dm_name, BcacheType type) |
static Bcache * | load (Devicegraph *devicegraph, const xmlNode *node) |
static std::vector< Bcache * > | get_all (Devicegraph *devicegraph) |
Get all bcaches. | |
static std::vector< const Bcache * > | get_all (const Devicegraph *devicegraph) |
Get all bcaches. More... | |
static void | reassign_numbers (Devicegraph *devicegraph) |
Fix the numeric ids of bcache devices so that there are no holes in the id sequence for in-memory bcache devices. More... | |
static Bcache * | find_by_name (Devicegraph *devicegraph, const std::string &name) |
Find a bcache by its name. More... | |
static const Bcache * | find_by_name (const Devicegraph *devicegraph, const std::string &name) |
Find a bcache by its name. More... | |
static std::string | find_free_name (const Devicegraph *devicegraph) |
Find a free name for a bcache. | |
static bool | compare_by_number (const Bcache *lhs, const Bcache *rhs) |
Compare (less than) two bcaches by number. | |
![]() | |
static std::vector< Partitionable * > | get_all (Devicegraph *devicegraph) |
Get all Partitionables. | |
static std::vector< const Partitionable * > | get_all (const Devicegraph *devicegraph) |
Get all Partitionables. More... | |
static Partitionable * | find_by_name (Devicegraph *devicegraph, const std::string &name) |
static const Partitionable * | find_by_name (const Devicegraph *devicegraph, const std::string &name) |
![]() | |
static std::vector< BlkDevice * > | get_all (Devicegraph *devicegraph) |
Get all BlkDevices. | |
static std::vector< const BlkDevice * > | get_all (const Devicegraph *devicegraph) |
Get all BlkDevices. More... | |
static BlkDevice * | find_by_name (Devicegraph *devicegraph, const std::string &name) |
Find a block device by its name. More... | |
static const BlkDevice * | find_by_name (const Devicegraph *devicegraph, const std::string &name) |
Find a block device by its name. More... | |
static BlkDevice * | find_by_any_name (Devicegraph *devicegraph, const std::string &name) |
Find a block device by any name including any symbolic links in /dev. More... | |
static const BlkDevice * | find_by_any_name (const Devicegraph *devicegraph, const std::string &name) |
Find a block device by any name including any symbolic links in /dev. More... | |
static bool | compare_by_dm_table_name (const BlkDevice *lhs, const BlkDevice *rhs) |
Compare (less than) two BlkDevices by DM table name. More... | |
![]() | |
static std::vector< Device * > | get_all (Devicegraph *devicegraph) |
static std::vector< const Device * > | get_all (const Devicegraph *devicegraph) |
static bool | compare_by_sid (const Device *lhs, const Device *rhs) |
Compare (less than) two Devices by sid. | |
static bool | compare_by_name (const Device *lhs, const Device *rhs) |
Compare (less than) two Devices by name. More... | |
Protected Member Functions | |
Bcache (Impl *impl) | |
![]() | |
Partitionable (Impl *impl) | |
![]() | |
BlkDevice (Impl *impl) | |
![]() | |
Device (Impl *impl) | |
void | create (Devicegraph *devicegraph) |
void | load (Devicegraph *devicegraph) |
A bcache device.
Bcache technology supports two kinds of bcache devices. Bcache devices with a backing device and also bcache devices directly created over a caching set (without backing device associated to it). This second type is known as Flash-only bcache.
void storage::Bcache::add_bcache_cset | ( | BcacheCset * | bcache_cset | ) |
Associates a caching set to the bcache.
This method does not make sense for Flash-only bcache devices.
LogicException,Exception |
|
static |
Find a bcache by its name.
DeviceNotFound,DeviceHasWrongType |
|
static |
Find a bcache by its name.
DeviceNotFound,DeviceHasWrongType |
|
static |
Get all bcaches.
const BlkDevice* storage::Bcache::get_backing_device | ( | ) | const |
Get the BlkDevice used as backing device.
This method does not make sense for Flash-only bcache devices.
DeviceNotFound |
const BcacheCset* storage::Bcache::get_bcache_cset | ( | ) | const |
Get the caching set associated with this bcache device.
Note that a bcache device can be created without a caching set associated to it. In case of a Flash-only bcache, there is always a caching set holding it.
const BlkDevice* storage::Bcache::get_blk_device | ( | ) | const |
Get the BlkDevice used as backing device.
This method does not make sense for Flash-only bcache devices.
DeviceNotFound |
CacheMode storage::Bcache::get_cache_mode | ( | ) | const |
Returns cache mode attribute.
This method does not make sense for Flash-only bcache devices.
unsigned long long storage::Bcache::get_sequential_cutoff | ( | ) | const |
Returns size of sequential_cutoff attribute.
This method does not make sense for Flash-only bcache devices.
unsigned storage::Bcache::get_writeback_percent | ( | ) | const |
Returns percent of writeback dirty pages.
This method does not make sense for Flash-only bcache devices.
bool storage::Bcache::has_bcache_cset | ( | ) | const |
Returns true if a caching set is attached.
Note that a Flash-only bcache is created over a caching set, so this method should always return true for Flash-only bcache devices.
|
static |
Fix the numeric ids of bcache devices so that there are no holes in the id sequence for in-memory bcache devices.
Called automatically when a device is deleted and a hole can appear.
Following rules apply to bcaches:
void storage::Bcache::remove_bcache_cset | ( | ) |
Removes association with a caching set.
This method does not make sense for Flash-only bcache devices.
LogicException,Exception |
void storage::Bcache::set_cache_mode | ( | CacheMode | mode | ) |
Sets cache mode attribute.
This method does not make sense for Flash-only bcache devices.
[in] | mode | target cache mode |