mirror of
git://sourceware.org/git/lvm2.git
synced 2025-01-03 05:18:29 +03:00
vdo: introduce function for estimation of virtual size
This commit is contained in:
parent
022ebb0cfe
commit
ab031d673d
@ -1299,6 +1299,7 @@ const char *get_vdo_compression_state_name(enum dm_vdo_compression_state state);
|
||||
const char *get_vdo_index_state_name(enum dm_vdo_index_state state);
|
||||
const char *get_vdo_operating_mode_name(enum dm_vdo_operating_mode mode);
|
||||
uint64_t get_vdo_pool_virtual_size(const struct lv_segment *vdo_pool_seg);
|
||||
int update_vdo_pool_virtual_size(struct lv_segment *vdo_pool_seg);
|
||||
int parse_vdo_pool_status(struct dm_pool *mem, const struct logical_volume *vdo_pool_lv,
|
||||
const char *params, struct lv_status_vdo *status);
|
||||
struct logical_volume *convert_vdo_pool_lv(struct logical_volume *data_lv,
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2018 Red Hat, Inc. All rights reserved.
|
||||
* Copyright (C) 2018-2019 Red Hat, Inc. All rights reserved.
|
||||
*
|
||||
* This file is part of LVM2.
|
||||
*
|
||||
@ -91,6 +91,23 @@ uint64_t get_vdo_pool_virtual_size(const struct lv_segment *vdo_pool_seg)
|
||||
vdo_pool_seg->vdo_pool_header_size);
|
||||
}
|
||||
|
||||
int update_vdo_pool_virtual_size(struct lv_segment *vdo_pool_seg)
|
||||
{
|
||||
struct seg_list *sl;
|
||||
uint32_t extents = 0;
|
||||
|
||||
/* FIXME: as long as we have only SINGLE VDO with vdo-pool this works */
|
||||
/* after adding support for multiple VDO LVs - this needs heavy rework */
|
||||
dm_list_iterate_items(sl, &vdo_pool_seg->lv->segs_using_this_lv)
|
||||
extents += sl->seg->len;
|
||||
|
||||
/* Only growing virtual/logical VDO size */
|
||||
if (extents > vdo_pool_seg->vdo_pool_virtual_extents)
|
||||
vdo_pool_seg->vdo_pool_virtual_extents = extents;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int _sysfs_get_kvdo_value(const char *dm_name, const char *vdo_param, uint64_t *value)
|
||||
{
|
||||
char path[PATH_MAX];
|
||||
|
Loading…
Reference in New Issue
Block a user