mirror of
git://sourceware.org/git/lvm2.git
synced 2025-01-03 05:18:29 +03:00
Add lv_read_ahead and lv_kernel_read_ahead 'get' functions.
This commit is contained in:
parent
f1fc310730
commit
d53d92f2e1
@ -20,6 +20,15 @@
|
||||
#include "segtype.h"
|
||||
#include "str_list.h"
|
||||
|
||||
uint32_t lv_kernel_read_ahead(const struct logical_volume *lv)
|
||||
{
|
||||
struct lvinfo info;
|
||||
|
||||
if (!lv_info(lv->vg->cmd, lv, 0, &info, 0, 1) || !info.exists)
|
||||
return UINT32_MAX;
|
||||
return info.read_ahead;
|
||||
}
|
||||
|
||||
char *lv_origin_dup(struct dm_pool *mem, const struct logical_volume *lv)
|
||||
{
|
||||
if (lv_is_cow(lv))
|
||||
|
@ -62,5 +62,6 @@ char *lv_mirror_log_dup(struct dm_pool *mem, const struct logical_volume *lv);
|
||||
char *lv_modules_dup(struct dm_pool *mem, const struct logical_volume *lv);
|
||||
char *lv_name_dup(struct dm_pool *mem, const struct logical_volume *lv);
|
||||
char *lv_origin_dup(struct dm_pool *mem, const struct logical_volume *lv);
|
||||
uint32_t lv_kernel_read_ahead(const struct logical_volume *lv);
|
||||
|
||||
#endif
|
||||
|
@ -109,13 +109,13 @@ GET_LV_NUM_PROPERTY_FN(lv_major, lv->major)
|
||||
#define _lv_major_set _not_implemented_set
|
||||
GET_LV_NUM_PROPERTY_FN(lv_minor, lv->minor)
|
||||
#define _lv_minor_set _not_implemented_set
|
||||
#define _lv_read_ahead_get _not_implemented_get
|
||||
GET_LV_NUM_PROPERTY_FN(lv_read_ahead, lv->read_ahead * SECTOR_SIZE)
|
||||
#define _lv_read_ahead_set _not_implemented_set
|
||||
GET_LV_NUM_PROPERTY_FN(lv_kernel_major, lv_kernel_major(lv))
|
||||
#define _lv_kernel_major_set _not_implemented_set
|
||||
GET_LV_NUM_PROPERTY_FN(lv_kernel_minor, lv_kernel_minor(lv))
|
||||
#define _lv_kernel_minor_set _not_implemented_set
|
||||
#define _lv_kernel_read_ahead_get _not_implemented_get
|
||||
GET_LV_NUM_PROPERTY_FN(lv_kernel_read_ahead, lv_kernel_read_ahead(lv) * SECTOR_SIZE)
|
||||
#define _lv_kernel_read_ahead_set _not_implemented_set
|
||||
GET_LV_NUM_PROPERTY_FN(lv_size, lv->size * SECTOR_SIZE)
|
||||
#define _lv_size_set _not_implemented_set
|
||||
|
@ -469,12 +469,12 @@ static int _lvkreadahead_disp(struct dm_report *rh, struct dm_pool *mem,
|
||||
void *private)
|
||||
{
|
||||
const struct logical_volume *lv = (const struct logical_volume *) data;
|
||||
struct lvinfo info;
|
||||
uint32_t read_ahead;
|
||||
|
||||
if (!lv_info(lv->vg->cmd, lv, 0, &info, 0, 1) || !info.exists)
|
||||
if ((read_ahead = lv_kernel_read_ahead(lv)) == UINT32_MAX)
|
||||
return dm_report_field_int32(rh, field, &_minusone32);
|
||||
|
||||
return _size32_disp(rh, mem, field, &info.read_ahead, private);
|
||||
return _size32_disp(rh, mem, field, &read_ahead, private);
|
||||
}
|
||||
|
||||
static int _vgsize_disp(struct dm_report *rh, struct dm_pool *mem,
|
||||
|
Loading…
Reference in New Issue
Block a user