#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))
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
#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
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,