master - lvmdbusd: Add FlightRecorderDump
by Tony Asleson
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=470a1f1c5031590823f...
Commit: 470a1f1c5031590823f8a58e641873da76dc1f46
Parent: f2d7a48418df7ce6071e4276a4a2cf0dd47570d4
Author: Tony Asleson <tasleson(a)redhat.com>
AuthorDate: Wed Mar 8 13:32:20 2017 -0600
Committer: Tony Asleson <tasleson(a)redhat.com>
CommitterDate: Thu Mar 9 16:39:47 2017 -0600
lvmdbusd: Add FlightRecorderDump
Diagnostic method for dumping flight recorder to syslog.
---
daemons/lvmdbusd/manager.py | 7 +++++++
1 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/daemons/lvmdbusd/manager.py b/daemons/lvmdbusd/manager.py
index 41bb22a..5575e39 100644
--- a/daemons/lvmdbusd/manager.py
+++ b/daemons/lvmdbusd/manager.py
@@ -133,6 +133,13 @@ class Manager(AutomatedProperties):
cfg.worker_q.put(r)
@dbus.service.method(
+ dbus_interface=MANAGER_INTERFACE)
+ def FlightRecorderDump(self):
+ """
+ Dump the flight recorder to syslog
+ """
+ cfg.blackbox.dump()
+ @dbus.service.method(
dbus_interface=MANAGER_INTERFACE,
in_signature='s',
out_signature='o')
6 years, 6 months
master - lvconvert: add raid1 <-> raid4 conversion
by Heinz Mauelshagen
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=f2d7a48418df7ce6071...
Commit: f2d7a48418df7ce6071e4276a4a2cf0dd47570d4
Parent: d2aae8cff476034539c3cfe577204b53187fb166
Author: Heinz Mauelshagen <heinzm(a)redhat.com>
AuthorDate: Thu Mar 9 23:17:13 2017 +0100
Committer: Heinz Mauelshagen <heinzm(a)redhat.com>
CommitterDate: Thu Mar 9 23:18:13 2017 +0100
lvconvert: add raid1 <-> raid4 conversion
In addition to the already supported conversion between 2-legged
raid1 and raid5, raid1 and raid4 can be also converted into each
other with 2 legs (raid4/5 are limited to map a 2-legged raid1).
This patch supports the missing raid4 conversion in the sequence
linear -> 2-legged raid1 -> raid4/5, then restripe to more than one
data stripes for performance and resilience reasons and optionally
convert to striped/raid0.
The other conversion sequence is also possible by converting N-way
striped/raid0 to raid4/5, then restripe to 2 legs followed by a
conversion to raid1 and optionally to linear (loosing all resilience).
---
lib/metadata/raid_manip.c | 7 ++++---
1 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/lib/metadata/raid_manip.c b/lib/metadata/raid_manip.c
index 0906916..a8c2e19 100644
--- a/lib/metadata/raid_manip.c
+++ b/lib/metadata/raid_manip.c
@@ -4344,12 +4344,12 @@ static struct possible_takeover_reshape_type _possible_takeover_reshape_types[]
/* raid1 -> raid5* with 2 legs */
{ .current_types = SEG_RAID1,
- .possible_types = SEG_RAID5_LS|SEG_RAID5_RS|SEG_RAID5_RA|SEG_RAID5_LA|SEG_RAID5_N,
+ .possible_types = SEG_RAID4|SEG_RAID5_LS|SEG_RAID5_RS|SEG_RAID5_RA|SEG_RAID5_LA|SEG_RAID5_N,
.current_areas = 2U,
.options = ALLOW_REGION_SIZE|ALLOW_STRIPE_SIZE },
/* raid5* -> raid1 with 2 legs */
- { .current_types = SEG_RAID5_LS|SEG_RAID5_RS|SEG_RAID5_RA|SEG_RAID5_LA|SEG_RAID5_N,
+ { .current_types = SEG_RAID4|SEG_RAID5_LS|SEG_RAID5_RS|SEG_RAID5_RA|SEG_RAID5_LA|SEG_RAID5_N,
.possible_types = SEG_RAID1,
.current_areas = 2U,
.options = ALLOW_REGION_SIZE },
@@ -5099,7 +5099,7 @@ static int _takeover_upconvert_wrapper(TAKEOVER_FN_ARGS)
lvseg_name(seg), display_lvname(lv), new_segtype->name);
return 0;
}
- if (!segtype_is_any_raid5(new_segtype)) {
+ if (!segtype_is_raid4(new_segtype) && !segtype_is_any_raid5(new_segtype)) {
log_error("Can't convert %s LV %s to %s.",
lvseg_name(seg), display_lvname(lv), new_segtype->name);
return 0;
@@ -5176,6 +5176,7 @@ static int _takeover_upconvert_wrapper(TAKEOVER_FN_ARGS)
seg->data_copies = new_data_copies;
if (segtype_is_raid4(new_segtype) &&
+ seg->area_count != 2 &&
(!_shift_parity_dev(seg) ||
!_rename_area_lvs(lv, "_"))) {
log_error("Can't convert %s to %s.", display_lvname(lv), new_segtype->name);
6 years, 6 months
master - man: add more examples to lvmraid(7)
by Heinz Mauelshagen
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=d2aae8cff476034539c...
Commit: d2aae8cff476034539c3cfe577204b53187fb166
Parent: 1ba11aa7eebb8367e4e0073683db06d53e8fe6e6
Author: Heinz Mauelshagen <heinzm(a)redhat.com>
AuthorDate: Thu Mar 9 22:26:22 2017 +0100
Committer: Heinz Mauelshagen <heinzm(a)redhat.com>
CommitterDate: Thu Mar 9 23:18:13 2017 +0100
man: add more examples to lvmraid(7)
Add examples for reshaping number of stripes
and converting from raid6 to striped to raid10.
Remove trailing spaces.
Related: rhbz834579
Related: rhbz1191935
Related: rhbz1191978
---
man/lvmraid.7.in | 250 ++++++++++++++++++++++++++++++++++++++++++++++++++++--
1 files changed, 241 insertions(+), 9 deletions(-)
diff --git a/man/lvmraid.7.in b/man/lvmraid.7.in
index 704c24a..79e6fe0 100644
--- a/man/lvmraid.7.in
+++ b/man/lvmraid.7.in
@@ -351,7 +351,7 @@ Also, if mismatches were found, the lvs attr field will display the letter
.nf
# lvs -o name,vgname,segtype,attr vg/lvol0
LV VG Type Attr
- lvol0 vg raid1 Rwi-a-r-m-
+ lvol0 vg raid1 Rwi-a-r-m-
.fi
@@ -475,12 +475,12 @@ lvs -a -o name,segtype,devices
lvr5 raid5 lvr5_rimage_0(0),\\
lvr5_rimage_1(0),\\
lvr5_rimage_2(0)
- [lvr5_rimage_0] linear /dev/sda(...)
- [lvr5_rimage_1] linear /dev/sdb(...)
- [lvr5_rimage_2] linear /dev/sdc(...)
- [lvr5_rmeta_0] linear /dev/sda(...)
- [lvr5_rmeta_1] linear /dev/sdb(...)
- [lvr5_rmeta_2] linear /dev/sdc(...)
+ [lvr5_rimage_0] linear /dev/sda(...)
+ [lvr5_rimage_1] linear /dev/sdb(...)
+ [lvr5_rimage_2] linear /dev/sdc(...)
+ [lvr5_rmeta_0] linear /dev/sda(...)
+ [lvr5_rmeta_1] linear /dev/sdb(...)
+ [lvr5_rmeta_2] linear /dev/sdc(...)
.fi
.B raid6
@@ -1031,7 +1031,7 @@ for out-of-place reshaping. The result is:
.nf
# lvs -a -o lv_name,segtype,seg_pe_ranges,dataoffset
- LV Type PE Ranges Doff
+ LV Type PE Ranges DOff
lv raid6_nr lv_rimage_0:0-32 \\
lv_rimage_1:0-32 \\
lv_rimage_2:0-32 \\
@@ -1051,6 +1051,238 @@ for out-of-place reshaping. The result is:
All segments with PE ranges '33-33' provide the out-of-place reshape space.
The dataoffset column shows that the data was moved from initial offset 0 to
2048 sectors on each component DataLV.
+
+If the RaidLV should be restriped for performance reasons,
+convert the 3-way striped raid6_nr LV to 5-way-striped.
+
+.nf
+# lvconvert --stripes 5 -y tb/lv
+ Using default stripesize 64.00 KiB.
+ WARNING: Adding stripes to active logical volume tb/lv will grow it from 99 to 165 extents!
+ Run "lvresize -l99 tb/lv" to shrink it or use the additional capacity.
+ Logical volume tb/lv successfully converted.
+
+# lvs
+ LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
+ root fedora -wi-ao---- 15.00g
+ swap fedora -wi-ao---- 3.99g
+ lv tb rwi-a-r-s- 652.00m 52.94
+
+# lvs -a -o lv_name,attr,segtype,seg_pe_ranges,dataoffset tb
+ LV Attr Type PE Ranges DOff
+ lv rwi-a-r--- raid6_nr lv_rimage_0:0-33 lv_rimage_1:0-33 lv_rimage_2:0-33 lv_rimage_3:0-33 lv_rimage_4:0-33 lv_rimage_5:0-33 lv_rimage_6:0-33 0
+ [lv_rimage_0] iwi-aor--- linear /dev/sda:0-32 0
+ [lv_rimage_0] iwi-aor--- linear /dev/sda:34-34
+ [lv_rimage_1] iwi-aor--- linear /dev/sdaa:0-32 0
+ [lv_rimage_1] iwi-aor--- linear /dev/sdaa:34-34
+ [lv_rimage_2] iwi-aor--- linear /dev/sdab:0-32 0
+ [lv_rimage_2] iwi-aor--- linear /dev/sdab:34-34
+ [lv_rimage_3] iwi-aor--- linear /dev/sdac:1-34 0
+ [lv_rimage_4] iwi-aor--- linear /dev/sdad:1-34 0
+ [lv_rimage_5] iwi-aor--- linear /dev/sdae:1-34 0
+ [lv_rimage_6] iwi-aor--- linear /dev/sdaf:1-34 0
+ [lv_rmeta_0] ewi-aor--- linear /dev/sda:33-33
+ [lv_rmeta_1] ewi-aor--- linear /dev/sdaa:33-33
+ [lv_rmeta_2] ewi-aor--- linear /dev/sdab:33-33
+ [lv_rmeta_3] ewi-aor--- linear /dev/sdac:0-0
+ [lv_rmeta_4] ewi-aor--- linear /dev/sdad:0-0
+ [lv_rmeta_5] ewi-aor--- linear /dev/sdae:0-0
+ [lv_rmeta_6] ewi-aor--- linear /dev/sdaf:0-0
+.fi
+
+Convert the 5-way striped raid6_nr LV to 4-way-striped.
+The force option needs to be used, because removing stripes
+(i.e. image SubLVs) from a RaidLV will shrink its size.
+
+.nf
+# lvconvert --stripes 4 --force -y tb/lv
+ Using default stripesize 64.00 KiB.
+ WARNING: Removing stripes from active logical volume tb/lv will shrink it from 660.00 MiB to 528.00 MiB!
+ THIS MAY DESTROY (PARTS OF) YOUR DATA!
+ If that leaves the logical volume larger than 206 extents due to stripe rounding,
+ you may want to grow the content afterwards (filesystem etc.)
+ WARNING: too remove freed stripes after the conversion has finished, you have to run "lvconvert --stripes 4 tb/lv"
+ Logical volume tb/lv successfully converted.
+
+# lvs -a -o lv_name,attr,segtype,seg_pe_ranges,dataoffset tb
+ LV Attr Type PE Ranges DOff
+ lv rwi-a-r-s- raid6_nr lv_rimage_0:0-33 lv_rimage_1:0-33 lv_rimage_2:0-33 lv_rimage_3:0-33 lv_rimage_4:0-33 lv_rimage_5:0-33 lv_rimage_6:0-33 0
+ [lv_rimage_0] Iwi-aor--- linear /dev/sda:0-32 0
+ [lv_rimage_0] Iwi-aor--- linear /dev/sda:34-34
+ [lv_rimage_1] Iwi-aor--- linear /dev/sdaa:0-32 0
+ [lv_rimage_1] Iwi-aor--- linear /dev/sdaa:34-34
+ [lv_rimage_2] Iwi-aor--- linear /dev/sdab:0-32 0
+ [lv_rimage_2] Iwi-aor--- linear /dev/sdab:34-34
+ [lv_rimage_3] Iwi-aor--- linear /dev/sdac:1-34 0
+ [lv_rimage_4] Iwi-aor--- linear /dev/sdad:1-34 0
+ [lv_rimage_5] Iwi-aor--- linear /dev/sdae:1-34 0
+ [lv_rimage_6] Iwi-aor-R- linear /dev/sdaf:1-34 0
+ [lv_rmeta_0] ewi-aor--- linear /dev/sda:33-33
+ [lv_rmeta_1] ewi-aor--- linear /dev/sdaa:33-33
+ [lv_rmeta_2] ewi-aor--- linear /dev/sdab:33-33
+ [lv_rmeta_3] ewi-aor--- linear /dev/sdac:0-0
+ [lv_rmeta_4] ewi-aor--- linear /dev/sdad:0-0
+ [lv_rmeta_5] ewi-aor--- linear /dev/sdae:0-0
+ [lv_rmeta_6] ewi-aor-R- linear /dev/sdaf:0-0
+.fi
+
+The 's' in column 9 of the attribute field shows the RaidLV is still reshaping.
+The 'R' in the same column of the attribute field shows the freed image Sub LVs which will need removing once the reshaping finished.
+
+.nf
+# lvs -o lv_name,attr,segtype,seg_pe_ranges,dataoffset tb
+ LV Attr Type PE Ranges DOff
+ lv rwi-a-r-R- raid6_nr lv_rimage_0:0-33 lv_rimage_1:0-33 lv_rimage_2:0-33 lv_rimage_3:0-33 lv_rimage_4:0-33 lv_rimage_5:0-33 lv_rimage_6:0-33 8192
+.fi
+
+Now that the reshape is finished the 'R' atribute on the RaidLV shows images can be removed.
+
+.nf
+# lvs -o lv_name,attr,segtype,seg_pe_ranges,dataoffset tb
+ LV Attr Type PE Ranges DOff
+ lv rwi-a-r-R- raid6_nr lv_rimage_0:0-33 lv_rimage_1:0-33 lv_rimage_2:0-33 lv_rimage_3:0-33 lv_rimage_4:0-33 lv_rimage_5:0-33 lv_rimage_6:0-33 8192
+.fi
+
+This is achieved by repeating the command ("lvconvert --stripes 4 tb/lv" would be sufficient).
+
+.nf
+# lvconvert --stripes 4 --force -y tb/lv
+ Using default stripesize 64.00 KiB.
+ Logical volume tb/lv successfully converted.
+
+# lvs -a -o lv_name,attr,segtype,seg_pe_ranges,dataoffset tb
+ LV Attr Type PE Ranges DOff
+ lv rwi-a-r--- raid6_nr lv_rimage_0:0-33 lv_rimage_1:0-33 lv_rimage_2:0-33 lv_rimage_3:0-33 lv_rimage_4:0-33 lv_rimage_5:0-33 8192
+ [lv_rimage_0] iwi-aor--- linear /dev/sda:0-32 8192
+ [lv_rimage_0] iwi-aor--- linear /dev/sda:34-34
+ [lv_rimage_1] iwi-aor--- linear /dev/sdaa:0-32 8192
+ [lv_rimage_1] iwi-aor--- linear /dev/sdaa:34-34
+ [lv_rimage_2] iwi-aor--- linear /dev/sdab:0-32 8192
+ [lv_rimage_2] iwi-aor--- linear /dev/sdab:34-34
+ [lv_rimage_3] iwi-aor--- linear /dev/sdac:1-34 8192
+ [lv_rimage_4] iwi-aor--- linear /dev/sdad:1-34 8192
+ [lv_rimage_5] iwi-aor--- linear /dev/sdae:1-34 8192
+ [lv_rmeta_0] ewi-aor--- linear /dev/sda:33-33
+ [lv_rmeta_1] ewi-aor--- linear /dev/sdaa:33-33
+ [lv_rmeta_2] ewi-aor--- linear /dev/sdab:33-33
+ [lv_rmeta_3] ewi-aor--- linear /dev/sdac:0-0
+ [lv_rmeta_4] ewi-aor--- linear /dev/sdad:0-0
+ [lv_rmeta_5] ewi-aor--- linear /dev/sdae:0-0
+
+# lvs -a -o lv_name,attr,segtype,reshapelen tb
+ LV Attr Type RSize
+ lv rwi-a-r--- raid6_nr 24.00m
+ [lv_rimage_0] iwi-aor--- linear 4.00m
+ [lv_rimage_0] iwi-aor--- linear
+ [lv_rimage_1] iwi-aor--- linear 4.00m
+ [lv_rimage_1] iwi-aor--- linear
+ [lv_rimage_2] iwi-aor--- linear 4.00m
+ [lv_rimage_2] iwi-aor--- linear
+ [lv_rimage_3] iwi-aor--- linear 4.00m
+ [lv_rimage_4] iwi-aor--- linear 4.00m
+ [lv_rimage_5] iwi-aor--- linear 4.00m
+ [lv_rmeta_0] ewi-aor--- linear
+ [lv_rmeta_1] ewi-aor--- linear
+ [lv_rmeta_2] ewi-aor--- linear
+ [lv_rmeta_3] ewi-aor--- linear
+ [lv_rmeta_4] ewi-aor--- linear
+ [lv_rmeta_5] ewi-aor--- linear
+.fi
+
+If the reshape space shall be removed any lvconvert command not changing the layout can be used:
+
+.nf
+# lvconvert --stripes 4 tb/lv
+ Using default stripesize 64.00 KiB.
+ No change in RAID LV tb/lv layout, freeing reshape space.
+ Logical volume tb/lv successfully converted.
+
+# lvs -a -o lv_name,attr,segtype,reshapelen tb
+ LV Attr Type RSize
+ lv rwi-a-r--- raid6_nr 0
+ [lv_rimage_0] iwi-aor--- linear 0
+ [lv_rimage_0] iwi-aor--- linear
+ [lv_rimage_1] iwi-aor--- linear 0
+ [lv_rimage_1] iwi-aor--- linear
+ [lv_rimage_2] iwi-aor--- linear 0
+ [lv_rimage_2] iwi-aor--- linear
+ [lv_rimage_3] iwi-aor--- linear 0
+ [lv_rimage_4] iwi-aor--- linear 0
+ [lv_rimage_5] iwi-aor--- linear 0
+ [lv_rmeta_0] ewi-aor--- linear
+ [lv_rmeta_1] ewi-aor--- linear
+ [lv_rmeta_2] ewi-aor--- linear
+ [lv_rmeta_3] ewi-aor--- linear
+ [lv_rmeta_4] ewi-aor--- linear
+ [lv_rmeta_5] ewi-aor--- linear
+.fi
+
+In case the RaidLV should be converted to striped:
+
+.nf
+# lvconvert --type striped tb/lv
+ Unable to convert LV tb/lv from raid6_nr to striped.
+ Converting tb/lv from raid6_nr is directly possible to the following layouts:
+ raid6_nc
+ raid6_zr
+ raid6_la_6
+ raid6_ls_6
+ raid6_ra_6
+ raid6_rs_6
+ raid6_n_6
+
+# lvconvert --type raid6_n_6
+ Using default stripesize 64.00 KiB.
+ Converting raid6_nr LV tb/lv to raid6_n_6.
+Are you sure you want to convert raid6_nr LV tb/lv? [y/n]: y
+ Logical volume tb/lv successfully converted.
+
+# lvconvert -y --type striped tb/lv
+ Logical volume tb/lv successfully converted.
+
+[root@vm46 ~]# lvs -o lv_name,attr,segtype,seg_pe_ranges,dataoffset tb
+ LV Attr Type PE Ranges DOff
+ lv -wi-a----- striped /dev/sda:2-32 /dev/sdaa:2-32 /dev/sdab:2-32 /dev/sdac:3-33
+ lv -wi-a----- striped /dev/sda:34-35 /dev/sdaa:34-35 /dev/sdab:34-35 /dev/sdac:34-35
+.fi
+
+From striped we can convert to raid10
+
+.nf
+# lvconvert -y --type raid10 tb/lv
+ Using default stripesize 64.00 KiB.
+ Logical volume tb/lv successfully converted.
+
+# lvs -o lv_name,attr,segtype,seg_pe_ranges,dataoffset tb
+ LV Attr Type PE Ranges DOff
+ lv rwi-a-r--- raid10 lv_rimage_0:0-32 lv_rimage_4:0-32 lv_rimage_1:0-32 lv_rimage_5:0-32 lv_rimage_2:0-32 lv_rimage_6:0-32 lv_rimage_3:0-32 lv_rimage_7:0-32 0
+
+# lvs -a -o lv_name,attr,segtype,seg_pe_ranges,dataoffset tb
+ WARNING: Cannot find matching striped segment for tb/lv_rimage_3.
+ LV Attr Type PE Ranges DOff
+ lv rwi-a-r--- raid10 lv_rimage_0:0-32 lv_rimage_4:0-32 lv_rimage_1:0-32 lv_rimage_5:0-32 lv_rimage_2:0-32 lv_rimage_6:0-32 lv_rimage_3:0-32 lv_rimage_7:0-32 0
+ [lv_rimage_0] iwi-aor--- linear /dev/sda:2-32 0
+ [lv_rimage_0] iwi-aor--- linear /dev/sda:34-35
+ [lv_rimage_1] iwi-aor--- linear /dev/sdaa:2-32 0
+ [lv_rimage_1] iwi-aor--- linear /dev/sdaa:34-35
+ [lv_rimage_2] iwi-aor--- linear /dev/sdab:2-32 0
+ [lv_rimage_2] iwi-aor--- linear /dev/sdab:34-35
+ [lv_rimage_3] iwi-XXr--- linear /dev/sdac:3-35 0
+ [lv_rimage_4] iwi-aor--- linear /dev/sdad:1-33 0
+ [lv_rimage_5] iwi-aor--- linear /dev/sdae:1-33 0
+ [lv_rimage_6] iwi-aor--- linear /dev/sdaf:1-33 0
+ [lv_rimage_7] iwi-aor--- linear /dev/sdag:1-33 0
+ [lv_rmeta_0] ewi-aor--- linear /dev/sda:0-0
+ [lv_rmeta_1] ewi-aor--- linear /dev/sdaa:0-0
+ [lv_rmeta_2] ewi-aor--- linear /dev/sdab:0-0
+ [lv_rmeta_3] ewi-aor--- linear /dev/sdac:0-0
+ [lv_rmeta_4] ewi-aor--- linear /dev/sdad:0-0
+ [lv_rmeta_5] ewi-aor--- linear /dev/sdae:0-0
+ [lv_rmeta_6] ewi-aor--- linear /dev/sdaf:0-0
+ [lv_rmeta_7] ewi-aor--- linear /dev/sdag:0-0
+.fi
+
+raid10 allows to add stripes but can't remove them.
..
.SH RAID5 Variants
@@ -1243,7 +1475,7 @@ The command to start duplication is:
.B \-\-duplicate
.br
Specifies that the LV conversion should be done out\-of\-place, copying
-LV data to new devices while converting.
+LV data to new devices while converting.
.HP
.BR \-\-type , \-\-stripes , \-\-stripesize
6 years, 6 months
master - dmfilemapd: always set the program_id after listing regions
by Bryn Reeves
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=1ba11aa7eebb8367e4e...
Commit: 1ba11aa7eebb8367e4e0073683db06d53e8fe6e6
Parent: 0104fd6c660d69b6e00bd906a2aed503bdb1ba5e
Author: Bryn M. Reeves <bmr(a)redhat.com>
AuthorDate: Thu Mar 9 21:14:50 2017 +0000
Committer: Bryn M. Reeves <bmr(a)redhat.com>
CommitterDate: Thu Mar 9 21:20:27 2017 +0000
dmfilemapd: always set the program_id after listing regions
The filemap daemon takes its program_id from the regions it is
managing: use DM_STATS_ALL_PROGRAMS when retrieving an initial
listing and then obtain the correct program_id from the group
leader.
---
daemons/dmfilemapd/dmfilemapd.c | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/daemons/dmfilemapd/dmfilemapd.c b/daemons/dmfilemapd/dmfilemapd.c
index edf66fc..67f86d3 100644
--- a/daemons/dmfilemapd/dmfilemapd.c
+++ b/daemons/dmfilemapd/dmfilemapd.c
@@ -514,7 +514,7 @@ static void _filemap_monitor_destroy(struct filemap_monitor *fm)
_filemap_monitor_end_notify(fm);
_filemap_monitor_close_fd(fm);
}
- dm_free(fm->program_id);
+ dm_free((void *) fm->program_id);
}
static int _filemap_monitor_check_same_file(int fd1, int fd2)
@@ -690,7 +690,7 @@ static int _dmfilemapd(struct filemap_monitor *fm)
if (!_filemap_monitor_set_notify(fm))
goto bad;
- if (!dm_stats_list(dms, NULL)) {
+ if (!dm_stats_list(dms, DM_STATS_ALL_PROGRAMS)) {
log_error("Failed to list stats handle.");
goto bad;
}
@@ -705,6 +705,7 @@ static int _dmfilemapd(struct filemap_monitor *fm)
fm->program_id = dm_strdup(program_id);
else
fm->program_id = NULL;
+ dm_stats_set_program_id(dms, 1, program_id);
do {
if (!dm_stats_group_present(dms, fm->group_id)) {
6 years, 6 months
master - libdm: don't nest FIEMAP and DMFILEMAPD ifdefs
by Bryn Reeves
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=0104fd6c660d69b6e00...
Commit: 0104fd6c660d69b6e00bd906a2aed503bdb1ba5e
Parent: af7a11bc57b2a3bb103cde47812a876b8d7a2d71
Author: Bryn M. Reeves <bmr(a)redhat.com>
AuthorDate: Thu Mar 9 21:13:51 2017 +0000
Committer: Bryn M. Reeves <bmr(a)redhat.com>
CommitterDate: Thu Mar 9 21:20:27 2017 +0000
libdm: don't nest FIEMAP and DMFILEMAPD ifdefs
---
libdm/libdm-stats.c | 43 +++++++++++++++++--------------------------
1 files changed, 17 insertions(+), 26 deletions(-)
diff --git a/libdm/libdm-stats.c b/libdm/libdm-stats.c
index 7552ac6..616c6bb 100644
--- a/libdm/libdm-stats.c
+++ b/libdm/libdm-stats.c
@@ -4877,6 +4877,23 @@ out:
dm_free((char *) alias);
return NULL;
}
+#else /* !HAVE_LINUX_FIEMAP */
+uint64_t *dm_stats_create_regions_from_fd(struct dm_stats *dms, int fd,
+ int group, int precise,
+ struct dm_histogram *bounds,
+ const char *alias)
+{
+ log_error("File mapping requires FIEMAP ioctl support.");
+ return 0;
+}
+
+uint64_t *dm_stats_update_regions_from_fd(struct dm_stats *dms, int fd,
+ uint64_t group_id)
+{
+ log_error("File mapping requires FIEMAP ioctl support.");
+ return 0;
+}
+#endif /* HAVE_LINUX_FIEMAP */
#ifdef DMFILEMAPD
static const char *_filemapd_mode_names[] = {
@@ -5026,32 +5043,6 @@ int dm_stats_start_filemapd(int fd, uint64_t group_id, const char *path,
}
#endif /* DMFILEMAPD */
-#else /* HAVE_LINUX_FIEMAP */
-
-uint64_t *dm_stats_create_regions_from_fd(struct dm_stats *dms, int fd,
- int group, int precise,
- struct dm_histogram *bounds,
- const char *alias)
-{
- log_error("File mapping requires FIEMAP ioctl support.");
- return 0;
-}
-
-uint64_t *dm_stats_update_regions_from_fd(struct dm_stats *dms, int fd,
- uint64_t group_id)
-{
- log_error("File mapping requires FIEMAP ioctl support.");
- return 0;
-}
-
-int dm_stats_start_filemapd(struct dm_stats *dms, int fd, uint64_t group_id,
- const char *path)
-{
- log_error("File mapping requires FIEMAP ioctl support.");
- return 0;
-}
-#endif /* HAVE_LINUX_FIEMAP */
-
/*
* Backward compatible dm_stats_create_region() implementations.
*
6 years, 6 months
master - configure: make --enable-dmfilemapd require fiemap.h
by Bryn Reeves
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=af7a11bc57b2a3bb103...
Commit: af7a11bc57b2a3bb103cde47812a876b8d7a2d71
Parent: 66fff1d7748f8251c8781830fa984f34d1492310
Author: Bryn M. Reeves <bmr(a)redhat.com>
AuthorDate: Thu Mar 9 21:12:53 2017 +0000
Committer: Bryn M. Reeves <bmr(a)redhat.com>
CommitterDate: Thu Mar 9 21:20:27 2017 +0000
configure: make --enable-dmfilemapd require fiemap.h
---
configure | 12 +++++++++++-
configure.in | 5 +++++
2 files changed, 16 insertions(+), 1 deletions(-)
diff --git a/configure b/configure
index f522c98..4798d5e 100755
--- a/configure
+++ b/configure
@@ -12093,6 +12093,17 @@ BUILD_DMFILEMAPD=$DMFILEMAPD
$as_echo "#define DMFILEMAPD 1" >>confdefs.h
+if test "$DMFILEMAPD" = yes; then
+ ac_fn_c_check_header_mongrel "$LINENO" "linux/fiemap.h" "ac_cv_header_linux_fiemap_h" "$ac_includes_default"
+if test "x$ac_cv_header_linux_fiemap_h" = xyes; then :
+
+else
+ as_fn_error $? "--enable-dmfilemapd requires fiemap.h" "$LINENO" 5
+fi
+
+
+fi
+
################################################################################
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build notifydbus" >&5
$as_echo_n "checking whether to build notifydbus... " >&6; }
@@ -15159,7 +15170,6 @@ done
fi
-
################################################################################
if test -n "$ac_tool_prefix"; then
# Extract the first word of "${ac_tool_prefix}modprobe", so it can be a program name with args.
diff --git a/configure.in b/configure.in
index bf7ad97..9dfb836 100644
--- a/configure.in
+++ b/configure.in
@@ -1281,6 +1281,11 @@ AC_MSG_RESULT($DMFILEMAPD)
BUILD_DMFILEMAPD=$DMFILEMAPD
AC_DEFINE([DMFILEMAPD], 1, [Define to 1 to enable the device-mapper filemap daemon.])
+dnl -- dmfilemapd requires FIEMAP
+if test "$DMFILEMAPD" = yes; then
+ AC_CHECK_HEADER([linux/fiemap.h], , [AC_MSG_ERROR(--enable-dmfilemapd requires fiemap.h)])
+fi
+
################################################################################
dnl -- Build notifydbus
AC_MSG_CHECKING(whether to build notifydbus)
6 years, 6 months
master - raid: add missing lv_merge_segments() call
by Heinz Mauelshagen
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=66fff1d7748f8251c87...
Commit: 66fff1d7748f8251c8781830fa984f34d1492310
Parent: 76f6951c3e8f0933df9730a42e9c46f273d1da24
Author: Heinz Mauelshagen <heinzm(a)redhat.com>
AuthorDate: Thu Mar 9 22:18:34 2017 +0100
Committer: Heinz Mauelshagen <heinzm(a)redhat.com>
CommitterDate: Thu Mar 9 22:18:34 2017 +0100
raid: add missing lv_merge_segments() call
On conversion from striped to raid0, data LVs are created
and all segments and their respective areas of the striped
LV are moved across to new segments allocated for the raid0
image LVs. This can cause non-canonical segments to be added
to the image LVs.
Add a call to lv_merge_segments() once all segments have been
added to an image LV to compensate for that. This avoids
unsafe table loads on activation.
Fix comments.
---
lib/metadata/raid_manip.c | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/lib/metadata/raid_manip.c b/lib/metadata/raid_manip.c
index 515e4b8..0906916 100644
--- a/lib/metadata/raid_manip.c
+++ b/lib/metadata/raid_manip.c
@@ -3986,6 +3986,10 @@ static int _striped_to_raid0_move_segs_to_raid0_lvs(struct logical_volume *lv,
dlv->le_count = le;
dlv->size = (uint64_t) le * lv->vg->extent_size;
s++;
+
+ /* Try merging raid0 rimage sub LV segments */
+ if (!lv_merge_segments(dlv))
+ return_0;
}
/* Remove the empty segments from the striped LV */
@@ -5122,7 +5126,7 @@ static int _takeover_upconvert_wrapper(TAKEOVER_FN_ARGS)
if (!_lv_free_reshape_space(lv))
return_0;
- /* This helper can be used to convert from striped/raid0* -> raid10 too */
+ /* This helper can be used to convert from striped/raid0* -> raid10_near too */
if (seg_is_striped_target(seg)) {
log_debug_metadata("Converting LV %s from %s to %s.",
display_lvname(lv), SEG_TYPE_NAME_STRIPED, SEG_TYPE_NAME_RAID0);
@@ -5179,7 +5183,7 @@ static int _takeover_upconvert_wrapper(TAKEOVER_FN_ARGS)
} else if (segtype_is_raid10_near(new_segtype)) {
uint32_t s;
- log_debug_metadata("Reordering areas for raid0 -> raid10 takeover.");
+ log_debug_metadata("Reordering areas for raid0 -> raid10_near takeover.");
if (!_reorder_raid10_near_seg_areas(seg, reorder_to_raid10_near))
return 0;
/* Set rebuild flags accordingly */
6 years, 6 months
master - dmeventd: (workaround) fix mirror DSO to work with lvmetad
by Heinz Mauelshagen
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=76f6951c3e8f0933df9...
Commit: 76f6951c3e8f0933df9730a42e9c46f273d1da24
Parent: 67ddc0c29289c454fbe6203473790bbcd12e3619
Author: Heinz Mauelshagen <heinzm(a)redhat.com>
AuthorDate: Thu Mar 9 20:41:07 2017 +0100
Committer: Heinz Mauelshagen <heinzm(a)redhat.com>
CommitterDate: Thu Mar 9 20:41:07 2017 +0100
dmeventd: (workaround) fix mirror DSO to work with lvmetad
Automatic dmeventd repair of mirrors with active lvmetad configured
(mirror_image_fault_policy = "allocate") fails because the lvscan
run before the repair in the mirror DSO does not update the
lvmetad cache properly thus "lvconvert --repair ..." fails.
Need to scan the mirror LV before and after the repair
to have proper cache content after the repair finished.
The cache can't be relied on or the repair will fail.
Resolves: rhbz1380521
---
daemons/dmeventd/plugins/mirror/dmeventd_mirror.c | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/daemons/dmeventd/plugins/mirror/dmeventd_mirror.c b/daemons/dmeventd/plugins/mirror/dmeventd_mirror.c
index 4ec348f..181b839 100644
--- a/daemons/dmeventd/plugins/mirror/dmeventd_mirror.c
+++ b/daemons/dmeventd/plugins/mirror/dmeventd_mirror.c
@@ -111,6 +111,9 @@ static int _remove_failed_devices(const char *cmd_lvscan, const char *cmd_lvconv
return 0;
}
+ if (!dmeventd_lvm2_run_with_lock(cmd_lvscan))
+ log_warn("WARNING: Re-scan of mirrored device %s failed.", device);
+
log_info("Repair of mirrored device %s finished successfully.", device);
return 1;
@@ -188,7 +191,7 @@ int register_device(const char *device,
goto_bad;
if (!dmeventd_lvm2_command(state->mem, state->cmd_lvconvert, sizeof(state->cmd_lvconvert),
- "lvconvert --repair --use-policies", device))
+ "lvconvert --config global{use_lvmetad = 0}' --repair --use-policies", device))
goto_bad;
*user = state;
6 years, 6 months
master - man: add FILE MAPPING section to dmstats.8.in
by Bryn Reeves
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=67ddc0c29289c454fbe...
Commit: 67ddc0c29289c454fbe6203473790bbcd12e3619
Parent: b5c8accdf2d503102cd701c2e2104ef67ce0f6db
Author: Bryn M. Reeves <bmr(a)redhat.com>
AuthorDate: Sun Dec 18 18:14:04 2016 +0000
Committer: Bryn M. Reeves <bmr(a)redhat.com>
CommitterDate: Thu Mar 9 18:50:15 2017 +0000
man: add FILE MAPPING section to dmstats.8.in
Add a section to explain file mapping, outside of the individual
command descriptions, and to describe the limitations of the
current update strategy.
---
man/dmstats.8.in | 87 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 87 insertions(+), 0 deletions(-)
diff --git a/man/dmstats.8.in b/man/dmstats.8.in
index b9bc781..682f01d 100644
--- a/man/dmstats.8.in
+++ b/man/dmstats.8.in
@@ -825,6 +825,93 @@ containing device.
The \fBgroup_id\fP should be treated as an opaque identifier used to
reference the group.
.
+.SH FILE MAPPING
+.
+Using \fB\-\-filemap\fP, it is possible to create regions that
+correspond to the extents of a file in the file system. This allows
+IO statistics to be monitored on a per-file basis, for example to
+observe large database files, virtual machine images, or other files
+of interest.
+
+To be able to use file mapping, the file must be backed by a
+device-mapper device, and in a file system that supports the FIEMAP
+ioctl (and which returns data describing the physical location of
+extents). This currently includes \fBxfs(5)\fP and \fBext4(5)\fP.
+
+By default the regions making up a file are placed together in a
+group, and the group alias is set to the \fBbasename(3)\fP of the
+file. This allows statistics to be reported for the file as a whole,
+aggregating values for the regions making up the group. To see only
+the whole file (group) when using the \fBlist\fP and \fBreport\fP
+commands, use \fB\-\-group\fP.
+
+Since it is possible for the file to change after the initial
+group of regions is created, the \fBupdate_filemap\fP command, and
+\fBdmfilemapd\fP daemon are provided to update file mapped groups
+either manually or automatically.
+.
+.P
+.B File follow modes
+.P
+The file map monitoring daemon can monitor files in two distinct ways:
+follow-inode mode, and follow-path mode.
+
+The mode affects the behaviour of the daemon when a file under
+monitoring is renamed or unlinked, and the conditions which cause the
+daemon to terminate.
+
+If follow-inode mode is used, the daemon will hold the file open, and
+continue to update regions from the same file descriptor. This means
+that the mapping will follow rename, move (within the same file
+system), and unlink operations. This mode is useful if the file is
+expected to be moved, renamed, or unlinked while it is being
+monitored.
+
+In follow-inode mode, the daemon will exit once it detects that the
+file has been unlinked and it is the last holder of a reference to it.
+
+If follow-path is used, the daemon will re-open the provided path on
+each monitoring iteration. This means that the group will be updated
+to reflect a new file being moved to the same path as the original
+file. This mode is useful for files that are expected to be updated
+via unlink and rename.
+
+In follow-path mode, the daemon will exit if the file is removed and
+not replaced within a brief tolerance interval (one second).
+
+To stop the daemon, delete the group containing the mapped regions:
+the daemon will automatically shut down.
+
+The daemon can also be safely killed at any time and the group kept:
+if the file is still being allocated the mapping will become
+progressively out-of-date as extents are added and removed (in this
+case the daemon can be re-started or the group updated manually with
+the \fBupdate_filemap\fP command).
+
+See the \fBcreate\fP command and \fB\-\-filemap\fP, \fB\-\-follow\fP,
+and \fB\-\-nomonitor\fP options for further information.
+.
+.P
+.B Limitations
+.P
+The daemon attempts to maintain good synchronisation between the file
+extents and the regions contained in the group, however, since it can
+only react to new allocations once they have been written, there are
+inevitably some IO events that cannot be counted when a file is
+growing, particularly if the file is being extended by a single thread
+writing beyond end-of-file (for example, the \fBdd\fP program).
+
+There is a further loss of events in that there is currently no way
+to atomically resize a \fBdmstats\fP region and preserve its current
+counter values. This affects files when they grow by extending the
+final extent, rather than allocating a new extent: any events that
+had accumulated in the region between any prior operation and the
+resize are lost.
+
+File mapping is currently most effective in cases where the majority
+of IO does not trigger extent allocation. Future updates may address
+these limitations when kernel support is available.
+.
.SH REPORT FIELDS
.
The dmstats report provides several types of field that may be added to
6 years, 6 months
master - man: add dmfilemapd options to dmstats.8.in
by Bryn Reeves
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=b5c8accdf2d503102cd...
Commit: b5c8accdf2d503102cd701c2e2104ef67ce0f6db
Parent: baa8a9be4adb3e1d57b4b135178e7f77d8580902
Author: Bryn M. Reeves <bmr(a)redhat.com>
AuthorDate: Sat Dec 17 16:41:00 2016 +0000
Committer: Bryn M. Reeves <bmr(a)redhat.com>
CommitterDate: Thu Mar 9 18:50:15 2017 +0000
man: add dmfilemapd options to dmstats.8.in
Add descriptions of --follow and --nomonitor, and the behaviour
of create and update_filemap when starting dmfilemapd.
---
man/dmstats.8.in | 85 ++++++++++++++++++++++++++++++++++++++++++++++++++---
1 files changed, 80 insertions(+), 5 deletions(-)
diff --git a/man/dmstats.8.in b/man/dmstats.8.in
index ba828dc..b9bc781 100644
--- a/man/dmstats.8.in
+++ b/man/dmstats.8.in
@@ -14,6 +14,9 @@
. RB [ \-\-region ]
. RB [ \-\-group ]
..
+.de OPT_FOREGROUND
+. RB [ \-\-foreground ]
+..
.
.\" Print units suffix, use with arg to print human
.\" man2html can't handle too many changes per command
@@ -89,6 +92,10 @@ dmstats \(em device-mapper statistics management
. RB [ \-\-bounds
. IR \%histogram_boundaries ]
. RB [ \-\-filemap ]
+. RB [ \-\-follow
+. IR follow_mode ]
+. OPT_FOREGROUND
+. RB [ \-\-nomonitor ]
. RB [ \-\-nogroup ]
. RB [ \-\-precise ]
. RB [ \-\-start
@@ -215,6 +222,9 @@ dmstats \(em device-mapper statistics management
. IR file_path
. RB [ \-\-groupid
. IR id ]
+. RB [ \-\-follow
+. IR follow_mode ]
+. OPT_FOREGROUND
. ad b
..
.CMD_UPDATE_FILEMAP
@@ -314,6 +324,60 @@ create regions corresponding to the locations of the on-disk extents
allocated to the file(s).
.
.HP
+.BR \-\-nomonitor
+.br
+Disable the \fBdmfilemapd\fP daemon when creating new file mapped
+groups. Normally the device-mapper filemap monitoring daemon,
+\fBdmfilemapd\fP, is started for each file mapped group to update the
+set of regions as the file changes on-disk: use of this option
+disables this behaviour.
+
+Regions in the group may still be updated with the
+\fBupdate_filemap\fP command, or by starting the daemon manually.
+.
+.HP
+.BR \-\-follow
+.IR follow_mode
+.br
+Specify the \fBdmfilemapd\fP file following mode. The file map
+monitoring daemon can monitor files in two distinct ways: the mode
+affects the behaviour of the daemon when a file under monitoring is
+renamed or unlinked, and the conditions which cause the daemon to
+terminate.
+
+The \fBfollow_mode\fP argument is either "inode", for follow-inode
+mode, or "path", for follow-path.
+
+If follow-inode mode is used, the daemon will hold the file open, and
+continue to update regions from the same file descriptor. This means
+that the mapping will follow rename, move (within the same file
+system), and unlink operations. This mode is useful if the file is
+expected to be moved, renamed, or unlinked while it is being
+monitored.
+
+In follow-inode mode, the daemon will exit once it detects that the
+file has been unlinked and it is the last holder of a reference to it.
+
+If follow-path is used, the daemon will re-open the provided path on
+each monitoring iteration. This means that the group will be updated
+to reflect a new file being moved to the same path as the original
+file. This mode is useful for files that are expected to be updated
+via unlink and rename.
+
+In follow-path mode, the daemon will exit if the file is removed and
+not replaced within a brief tolerance interval.
+
+In either mode, the daemon exits automatically if the monitored group
+is removed.
+.
+.HP
+.BR \-\-foreground
+.br
+Specify that the \fBdmfilemapd\fP daemon should run in the foreground.
+The daemon will not fork into the background, and will replace the
+\fBdmstats\fP command that started it.
+.
+.HP
.BR \-\-groupid
.IR id
.br
@@ -568,6 +632,11 @@ By default regions that map a file are placed into a group and the
group alias is set to the basename of the file. This behaviour can be
overridden with the \fB\-\-alias\fP and \fB\-\-nogroup\fP options.
+Creating a group that maps a file automatically starts a daemon,
+\fBdmfilemapd\fP to monitor the file and update the mapping as the
+extents allocated to the file change. This behaviour can be disabled
+using the \fB\-\-nomonitor\fP option.
+
Use the \fB\-\-group\fP option to only display information for groups
when listing and reporting.
.
@@ -678,17 +747,23 @@ The group to be removed is specified using \fB\-\-groupid\fP.
.CMD_UPDATE_FILEMAP
.br
Update a group of \fBdmstats\fP regions specified by \fBgroup_id\fP,
-that were previously created with \fB\-\-filemap\fP. This will add
-and remove regions to reflect changes in the allocated extents of
-the file on-disk, since the time that it was crated or last updated.
+that were previously created with \fB\-\-filemap\fP, either directly,
+or by starting the monitoring daemon, \fBdmfilemapd\fP.
+
+This will add and remove regions to reflect changes in the allocated
+extents of the file on-disk, since the time that it was crated or last
+updated.
Use of this command is not normally needed since the \fBdmfilemapd\fP
daemon will automatically monitor filemap groups and perform these
updates when required.
-If a filemapped group was created with \fB\-\-nominitor\fP, or the
+If a filemapped group was created with \fB\-\-nomonitor\fP, or the
daemon has been killed, the \fBupdate_filemap\fP can be used to
-manually force an update.
+manually force an update or start a new daemon.
+
+Use \fB\-\-nomonitor\fP to force a direct update and disable starting
+the monitoring daemon.
.
.SH REGIONS, AREAS, AND GROUPS
.
6 years, 6 months