master - polldaemon: get get_copy_vg ready for refactoring
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=22ae43a11ef9bea5ae3a9c6127bb1ed07f93d103 Commit: 22ae43a11ef9bea5ae3a9c6127bb1ed07f93d103 Parent: 991d646354a10e9953fdf0e75cb2a33a81f6ffef Author: Ondrej Kozina <[email protected]> AuthorDate: Tue May 5 16:06:24 2015 +0200 Committer: Ondrej Kozina <[email protected]> CommitterDate: Tue May 5 20:51:34 2015 +0200
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.
--- tools/lvconvert.c | 2 +- tools/polldaemon.c | 9 +++++---- tools/polldaemon.h | 5 +++-- tools/pvmove_poll.c | 3 ++- tools/pvmove_poll.h | 6 +++++- 5 files changed, 16 insertions(+), 9 deletions(-)
tools/lvconvert.c +1 -1
@@ -3222,7 +3222,7 @@ static struct logical_volume *get_vg_lock_and_logical_volume(struct cmd_contextstruct 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;
tools/polldaemon.c +5 -4
@@ -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);
tools/polldaemon.h +3 -2
@@ -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,
tools/pvmove_poll.c +2 -1
@@ -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;
tools/pvmove_poll.h +5 -1
@@ -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 */