23#ifndef STORAGE_BCACHE_H
24#define STORAGE_BCACHE_H
27#include "storage/Devices/Partitionable.h"
28#include "storage/Devices/Device.h"
29#include "storage/Devicegraph.h"
30#include "storage/Utils/Swig.h"
59 WRITETHROUGH, WRITEBACK, WRITEAROUND, NONE
78 class Bcache :
public Partitionable
93 static Bcache* load(
Devicegraph* devicegraph,
const xmlNode* node);
249 const Impl& get_impl() const;
251 virtual Bcache* clone() const override;
A bcache cache set.
Definition BcacheCset.h:42
A bcache device.
Definition Bcache.h:79
const BcacheCset * get_bcache_cset() const
Get the caching set associated with this bcache device.
CacheMode get_cache_mode() const
Returns cache mode attribute.
unsigned get_writeback_percent() const
Returns percent of writeback dirty pages.
static std::vector< Bcache * > get_all(Devicegraph *devicegraph)
Get all bcaches.
static Bcache * create(Devicegraph *devicegraph, const std::string &name, BcacheType type)
Create a device of type Bcache.
static Bcache * create(Devicegraph *devicegraph, const std::string &name)
Create a device of type Bcache.
void set_cache_mode(CacheMode mode)
Sets cache mode attribute.
unsigned int get_number() const
Get the number of the bcache.
void remove_bcache_cset() ST_DEPRECATED
Removes association with a caching set.
static std::string find_free_name(const Devicegraph *devicegraph)
Find a free name for a bcache, e.g.
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 bca...
void attach_bcache_cset(BcacheCset *bcache_cset)
Associates a caching set to the bcache.
static Bcache * find_by_name(Devicegraph *devicegraph, const std::string &name)
Find a bcache by its name.
static bool compare_by_number(const Bcache *lhs, const Bcache *rhs)
Compare (less than) two bcaches by number.
unsigned long long get_sequential_cutoff() const
Returns size of sequential_cutoff attribute.
void add_bcache_cset(BcacheCset *bcache_cset) ST_DEPRECATED
Associates a caching set to the bcache.
void detach_bcache_cset()
Removes association with a caching set.
BcacheType get_type() const
Get the bcache type.
const BlkDevice * get_backing_device() const
Get the BlkDevice used as backing device.
const BlkDevice * get_blk_device() const ST_DEPRECATED
Get the BlkDevice used as backing device.
bool has_bcache_cset() const
Returns true if a caching set is attached.
An abstract Block Device.
Definition BlkDevice.h:49
An abstract base class for storage devices.
Definition Device.h:82
The main container of the libstorage-ng.
Definition Devicegraph.h:170
The storage namespace.
Definition Actiongraph.h:40
bool is_bcache(const Device *device)
Checks whether device points to a Bcache.
std::string get_bcache_type_name(BcacheType bcache_type)
Convert the BcacheType bcache_type to a string.
CacheMode
The Cache mode attribute.
Definition Bcache.h:58
BcacheType
Bcache types.
Definition Bcache.h:42
Bcache * to_bcache(Device *device)
Converts pointer to Device to pointer to Bcache.
std::string get_cache_mode_name(CacheMode cache_mode)
Convert the CacheMode cache_mode to a string.