1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

polldaemon: get get_copy_vg ready for refactoring

with refactored code we take some VG locks as read-only.
Make the poll_get_copy_vg ready for the change.
This commit is contained in:
Ondrej Kozina 2015-05-05 16:06:24 +02:00
parent 991d646354
commit 22ae43a11e
5 changed files with 16 additions and 9 deletions

View File

@ -3222,7 +3222,7 @@ static struct logical_volume *get_vg_lock_and_logical_volume(struct cmd_context
struct volume_group *vg;
struct logical_volume* lv = NULL;
vg = poll_get_copy_vg(cmd, vg_name, NULL);
vg = poll_get_copy_vg(cmd, vg_name, NULL, READ_FOR_UPDATE);
if (vg_read_error(vg)) {
release_vg(vg);
return_NULL;

View File

@ -51,15 +51,16 @@ progress_t poll_mirror_progress(struct cmd_context *cmd,
struct volume_group *poll_get_copy_vg(struct cmd_context *cmd,
const char *name,
const char *uuid __attribute__((unused)))
const char *uuid __attribute__((unused)),
uint32_t flags)
{
dev_close_all();
if (name && !strchr(name, '/'))
return vg_read_for_update(cmd, name, NULL, 0);
return vg_read(cmd, name, NULL, flags);
/* 'name' is the full LV name; must extract_vgname() */
return vg_read_for_update(cmd, extract_vgname(cmd, name), NULL, 0);
return vg_read(cmd, extract_vgname(cmd, name), NULL, flags);
}
struct logical_volume *poll_get_copy_lv(struct cmd_context *cmd __attribute__((unused)),
@ -155,7 +156,7 @@ static int _wait_for_single_lv(struct cmd_context *cmd, const char *name, const
_sleep_and_rescan_devices(parms);
/* Locks the (possibly renamed) VG again */
vg = parms->poll_fns->get_copy_vg(cmd, name, uuid);
vg = parms->poll_fns->get_copy_vg(cmd, name, uuid, READ_FOR_UPDATE);
if (vg_read_error(vg)) {
release_vg(vg);
log_error("ABORTING: Can't reread VG for %s", name);

View File

@ -31,7 +31,8 @@ struct poll_functions {
const char *(*get_copy_name_from_lv) (const struct logical_volume *lv);
struct volume_group *(*get_copy_vg) (struct cmd_context *cmd,
const char *name,
const char *uuid);
const char *uuid,
uint32_t flags);
struct logical_volume *(*get_copy_lv) (struct cmd_context *cmd,
struct volume_group *vg,
const char *name,
@ -73,7 +74,7 @@ progress_t poll_mirror_progress(struct cmd_context *cmd,
struct daemon_parms *parms);
struct volume_group *poll_get_copy_vg(struct cmd_context *cmd, const char *name,
const char *uuid);
const char *uuid, uint32_t flags);
struct logical_volume *poll_get_copy_lv(struct cmd_context *cmd,
struct volume_group *vg,

View File

@ -203,7 +203,8 @@ int pvmove_finish(struct cmd_context *cmd, struct volume_group *vg,
}
struct volume_group *pvmove_get_copy_vg(struct cmd_context *cmd, const char *name,
const char *uuid __attribute__((unused)))
const char *uuid __attribute__((unused)),
uint32_t flags __attribute__((unused)))
{
struct physical_volume *pv;
struct volume_group *vg;

View File

@ -15,6 +15,9 @@
#ifndef _LVM_PVMOVE_H
#define _LVM_PVMOVE_H
/* FIXME: remove it after refactoring completes */
#include <stdint.h>
struct cmd_context;
struct dm_list;
struct logical_volume;
@ -30,6 +33,7 @@ int pvmove_finish(struct cmd_context *cmd, struct volume_group *vg,
struct logical_volume *lv_mirr, struct dm_list *lvs_changed);
struct volume_group *pvmove_get_copy_vg(struct cmd_context *cmd,
const char *name, const char *uuid);
const char *name, const char *uuid,
uint32_t flags);
#endif /* _LVM_PVMOVE_H */