mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
liblvm: add lv_rename_update
Support lv_rename without directly updating metatata. It can save some metadata commits in some cases, i.e. when LVs are offline.
This commit is contained in:
parent
739092e64a
commit
21c401006c
@ -1,5 +1,6 @@
|
||||
Version 2.02.98 -
|
||||
=================================
|
||||
Add internal lv_rename_update() to rename LV without updating mda.
|
||||
Ensure descriptors 0,1,2 are always available.
|
||||
Use /proc/self/fd for closing openned descriptors.
|
||||
Add missing pkg init with --enable-testing in configure.in (2.02.71).
|
||||
|
@ -2938,8 +2938,8 @@ int for_each_sub_lv(struct cmd_context *cmd, struct logical_volume *lv,
|
||||
* Core of LV renaming routine.
|
||||
* VG must be locked by caller.
|
||||
*/
|
||||
int lv_rename(struct cmd_context *cmd, struct logical_volume *lv,
|
||||
const char *new_name)
|
||||
int lv_rename_update(struct cmd_context *cmd, struct logical_volume *lv,
|
||||
const char *new_name, int update_mda)
|
||||
{
|
||||
struct volume_group *vg = lv->vg;
|
||||
struct lv_names lv_names;
|
||||
@ -2964,7 +2964,7 @@ int lv_rename(struct cmd_context *cmd, struct logical_volume *lv,
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!archive(vg))
|
||||
if (update_mda && !archive(vg))
|
||||
return 0;
|
||||
|
||||
/* rename sub LVs */
|
||||
@ -2986,6 +2986,9 @@ int lv_rename(struct cmd_context *cmd, struct logical_volume *lv,
|
||||
if (lv_is_cow(lv) && lv_is_virtual_origin(lvl2.lv = origin_from_cow(lv)))
|
||||
dm_list_add_h(&lvs_changed, &lvl2.list);
|
||||
|
||||
if (!update_mda)
|
||||
return 1;
|
||||
|
||||
log_verbose("Writing out updated volume group");
|
||||
if (!vg_write(vg))
|
||||
return 0;
|
||||
@ -3009,6 +3012,16 @@ out:
|
||||
return r;
|
||||
}
|
||||
|
||||
/*
|
||||
* Core of LV renaming routine.
|
||||
* VG must be locked by caller.
|
||||
*/
|
||||
int lv_rename(struct cmd_context *cmd, struct logical_volume *lv,
|
||||
const char *new_name)
|
||||
{
|
||||
return lv_rename_update(cmd, lv, new_name, 1);
|
||||
}
|
||||
|
||||
char *generate_lv_name(struct volume_group *vg, const char *format,
|
||||
char *buffer, size_t len)
|
||||
{
|
||||
|
@ -560,6 +560,8 @@ int lv_remove_with_dependencies(struct cmd_context *cmd, struct logical_volume *
|
||||
|
||||
int lv_rename(struct cmd_context *cmd, struct logical_volume *lv,
|
||||
const char *new_name);
|
||||
int lv_rename_update(struct cmd_context *cmd, struct logical_volume *lv,
|
||||
const char *new_name, int update_mda);
|
||||
|
||||
uint64_t extents_from_size(struct cmd_context *cmd, uint64_t size,
|
||||
uint32_t extent_size);
|
||||
|
Loading…
Reference in New Issue
Block a user