mirror of
git://sourceware.org/git/lvm2.git
synced 2025-03-25 18:50:51 +03:00
thin: add reporting of discard for thin pool
New field "discard" is added for lvs reporting of lv segment. Reported as one character: (i)gnore (n)opassdown (p)assdown lvs -o+discard
This commit is contained in:
parent
ebbf7d8e68
commit
46b9cc1248
@ -1,5 +1,6 @@
|
||||
Version 2.02.97 -
|
||||
===============================
|
||||
Report used discard for thin pool and volume.
|
||||
Add support for controlling discard behavior of thin pool.
|
||||
Detect features for new 1.1 thin pool target.
|
||||
Count percentage of completeness upwards when merging a snapshot volume.
|
||||
|
@ -140,6 +140,7 @@ FIELD(SEGS, seg, NUM, "Region", region_size, 6, size32, region_size, "For mirror
|
||||
FIELD(SEGS, seg, NUM, "Chunk", list, 5, chunksize, chunksize, "For snapshots, the unit of data used when tracking changes.", 0)
|
||||
FIELD(SEGS, seg, NUM, "Chunk", list, 5, chunksize, chunk_size, "For snapshots, the unit of data used when tracking changes.", 0)
|
||||
FIELD(SEGS, seg, NUM, "#Thins", list, 4, thincount, thin_count, "For thin pools, the number of thin volumes in this pool.", 0)
|
||||
FIELD(SEGS, seg, NUM, "Dis", list, 3, discard, discard, "For thin pools, discard handling (i)ignore, (n)o_passdown, (p)assdown.", 0)
|
||||
FIELD(SEGS, seg, NUM, "Zero", list, 4, thinzero, zero, "For thin pools, if zeroing is enabled.", 0)
|
||||
FIELD(SEGS, seg, NUM, "TransId", list, 4, transactionid, transaction_id, "For thin pools, the transaction id.", 0)
|
||||
FIELD(SEGS, seg, NUM, "Start", list, 5, segstart, seg_start, "Offset within the LV to the start of the segment in current units.", 0)
|
||||
|
@ -277,6 +277,8 @@ GET_LVSEG_NUM_PROPERTY_FN(zero, lvseg->zero_new_blocks)
|
||||
#define _zero_set _not_implemented_set
|
||||
GET_LVSEG_NUM_PROPERTY_FN(transaction_id, lvseg->transaction_id)
|
||||
#define _transaction_id_set _not_implemented_set
|
||||
GET_LVSEG_NUM_PROPERTY_FN(discard, lvseg->discard)
|
||||
#define _discard_set _not_implemented_set
|
||||
GET_LVSEG_NUM_PROPERTY_FN(seg_start, lvseg_start(lvseg))
|
||||
#define _seg_start_set _not_implemented_set
|
||||
GET_LVSEG_NUM_PROPERTY_FN(seg_start_pe, lvseg->le)
|
||||
|
@ -564,6 +564,36 @@ static int _transactionid_disp(struct dm_report *rh, struct dm_pool *mem,
|
||||
return dm_report_field_uint64(rh, field, &seg->transaction_id);
|
||||
}
|
||||
|
||||
static int _discard_disp(struct dm_report *rh, struct dm_pool *mem,
|
||||
struct dm_report_field *field,
|
||||
const void *data, void *private)
|
||||
{
|
||||
static const struct {
|
||||
const char c[2];
|
||||
unsigned val;
|
||||
thin_discard_t discard;
|
||||
} const arr[] = {
|
||||
{ "p", 0, THIN_DISCARD_PASSDOWN },
|
||||
{ "n", 1, THIN_DISCARD_NO_PASSDOWN },
|
||||
{ "i", 2, THIN_DISCARD_IGNORE },
|
||||
{ "" }
|
||||
};
|
||||
const struct lv_segment *seg = (const struct lv_segment *) data;
|
||||
unsigned i = 0;
|
||||
|
||||
if (seg_is_thin_volume(seg))
|
||||
seg = first_seg(seg->pool_lv);
|
||||
|
||||
if (seg_is_thin_pool(seg)) {
|
||||
while (arr[i].c[0] && seg->discard != arr[i].discard)
|
||||
i++;
|
||||
|
||||
dm_report_field_set_value(field, arr[i].c, &arr[i].val);
|
||||
} else
|
||||
dm_report_field_set_value(field, "", NULL);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int _originsize_disp(struct dm_report *rh, struct dm_pool *mem,
|
||||
struct dm_report_field *field,
|
||||
|
@ -80,6 +80,7 @@ convert_lv,
|
||||
copy_percent,
|
||||
data_lv,
|
||||
devices,
|
||||
discard,
|
||||
lv_attr,
|
||||
lv_host,
|
||||
lv_kernel_major,
|
||||
|
Loading…
x
Reference in New Issue
Block a user