LVM2 ./WHATS_NEW lib/activate/activate.c lib/a ...
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: zkabelac at sourceware.org 2011-06-17 14:14:21
Modified files:
. : WHATS_NEW
lib/activate : activate.c activate.h dev_manager.c
dev_manager.h
lib/error : errseg.c
lib/metadata : segtype.h
lib/mirror : mirrored.c
lib/replicator : replicator.c
lib/snapshot : snapshot.c
lib/striped : striped.c
lib/unknown : unknown.c
lib/zero : zero.c
Log message:
Add lv_activate_opts structure
To avoid modification of 'read-only' volume group structure add a new structure to pass local data around the code for LV activation.
As origin_only is one such flag - replace this parameter with new struct lv_activate_opts.
More parameters might eventually become part of lv_activate_opts.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.2016&r2=1.2017
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/activate/activate.c.diff?cvsroot=lvm2&r1=1.198&r2=1.199
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/activate/activate.h.diff?cvsroot=lvm2&r1=1.76&r2=1.77
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/activate/dev_manager.c.diff?cvsroot=lvm2&r1=1.217&r2=1.218
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/activate/dev_manager.h.diff?cvsroot=lvm2&r1=1.37&r2=1.38
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/error/errseg.c.diff?cvsroot=lvm2&r1=1.23&r2=1.24
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/segtype.h.diff?cvsroot=lvm2&r1=1.34&r2=1.35
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/mirror/mirrored.c.diff?cvsroot=lvm2&r1=1.87&r2=1.88
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/replicator/replicator.c.diff?cvsroot=lvm2&r1=1.6&r2=1.7
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/snapshot/snapshot.c.diff?cvsroot=lvm2&r1=1.55&r2=1.56
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/striped/striped.c.diff?cvsroot=lvm2&r1=1.36&r2=1.37
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/unknown/unknown.c.diff?cvsroot=lvm2&r1=1.5&r2=1.6
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/zero/zero.c.diff?cvsroot=lvm2&r1=1.24&r2=1.25
WHATS_NEW +1 -0
@@ -1,5 +1,6 @@ Version 2.02.86 - ================================= + Add lv_activate_opts structure for activation (replacing activation flags). Fix a problem with inconsistent pre-commit metadata on MISSING_PV devices. Add proper udev library context initialization and finalization to liblvm. Fix last snapshot removal to avoid table reload while a device is suspended.
lib/activate/activate.c +66 -45
327 lines not on this page · raw message
lib/activate/activate.h +8 -2
@@ -1,6 +1,6 @@/* * Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved. -* Copyright (C) 2004-2007 Red Hat, Inc. All rights reserved. +* Copyright (C) 2004-2011 Red Hat, Inc. All rights reserved. * * This file is part of LVM2. *
@@ -30,6 +30,12 @@uint32_t read_ahead; }; +struct lv_activate_opts { +int exclusive; +int origin_only; +int no_merging; +}; +/* target attribute flags */ #define MIRROR_LOG_CLUSTERED 0x00000001U
@@ -102,7 +108,7 @@ const char *layer, const char *target_type);int monitor_dev_for_events (struct cmd_context *cmd,struct logical_volume *lv, -unsigned origin_only,int do_reg); +const struct lv_activate_opts *laopts,int do_reg);#ifdef DMEVENTD # include "libdevmapper-event.h"
lib/activate/dev_manager.c +64 -48
315 lines not on this page · raw message
lib/activate/dev_manager.h +6 -4
@@ -1,6 +1,6 @@/* * Copyright (C) 2002-2004 Sistina Software, Inc. All rights reserved. -* Copyright (C) 2004-2006 Red Hat, Inc. All rights reserved. +* Copyright (C) 2004-2011 Red Hat, Inc. All rights reserved. * * This file is part of LVM2. *
@@ -19,6 +19,7 @@#include "metadata-exported.h" struct logical_volume ; +struct lv_activate_opts ;struct volume_group ;struct cmd_context ;struct dev_manager ;
@@ -52,10 +53,11 @@ const struct logical_volume *lv, int wait, percent_t *percent, uint32_t *event_nr);int dev_manager_suspend (struct dev_manager *dm,struct logical_volume *lv, -unsigned origin_only,int lockfs,int flush_required); -int dev_manager_activate (struct dev_manager *dm,struct logical_volume *lv,unsigned origin_only); +struct lv_activate_opts *laopts,int lockfs,int flush_required); +int dev_manager_activate (struct dev_manager *dm,struct logical_volume *lv, +struct lv_activate_opts *laopts);int dev_manager_preload (struct dev_manager *dm,struct logical_volume *lv, -unsigned origin_only,int *flush_required); +struct lv_activate_opts *laopts,int *flush_required);int dev_manager_deactivate (struct dev_manager *dm,struct logical_volume *lv);int dev_manager_transient (struct dev_manager *dm,struct logical_volume *lv) __attribute__((nonnull (1 ,2 )));
lib/error/errseg.c +1 -0
@@ -45,6 +45,7 @@ struct cmd_context *cmd __attribute__((unused)), void **target_state __attribute__((unused)), struct lv_segment *seg __attribute__((unused)), + const struct lv_activate_opts *laopts __attribute__((unused)), struct dm_tree_node *node, uint64_t len, uint32_t *pvmove_mirror_count __attribute__((unused))) {
lib/metadata/segtype.h +8 -5
@@ -22,6 +22,7 @@struct cmd_context ;struct config_tree ;struct lv_segment ; +struct lv_activate_opts ;struct formatter ;struct config_node ;struct dev_manager ;
@@ -66,7 +67,8 @@struct segtype_handler {const char *(*name) (const struct lv_segment * seg); -const char *(*target_name) (const struct lv_segment * seg); +const char *(*target_name) (const struct lv_segment *seg, +const struct lv_activate_opts *laopts);void (*display) (const struct lv_segment * seg);int (*text_export) (const struct lv_segment * seg,struct formatter * f);
@@ -78,10 +80,11 @@int (*merge_segments) (struct lv_segment * seg1,struct lv_segment * seg2);int (*add_target_line) (struct dev_manager *dm,struct dm_pool *mem, -struct cmd_context *cmd,void **target_state, -struct lv_segment *seg, -struct dm_tree_node *node,uint64_t len, -uint32_t *pvmove_mirror_count); +struct cmd_context *cmd,void **target_state, +struct lv_segment *seg, +const struct lv_activate_opts *laopts, +struct dm_tree_node *node,uint64_t len, +uint32_t *pvmove_mirror_count);int (*target_status_compatible) (const char *type);int (*check_transient_status) (struct lv_segment *seg,char *params); int (*target_percent) (void **target_state,
lib/mirror/mirrored.c +7 -5
@@ -349,6 +349,7 @@ }static int _add_log (struct dm_pool *mem,struct lv_segment *seg, +const struct lv_activate_opts *laopts,struct dm_tree_node *node,uint32_t area_count,uint32_t region_size) {unsigned clustered =0 ;
@@ -390,10 +391,11 @@ }static int _mirrored_add_target_line (struct dev_manager *dm,struct dm_pool *mem, -struct cmd_context *cmd,void **target_state, -struct lv_segment *seg, -struct dm_tree_node *node,uint64_t len, -uint32_t *pvmove_mirror_count) +struct cmd_context *cmd,void **target_state, +struct lv_segment *seg, +const struct lv_activate_opts *laopts, +struct dm_tree_node *node,uint64_t len, +uint32_t *pvmove_mirror_count) {struct mirror_state *mirr_state;uint32_t area_count = seg->area_count;
@@ -451,7 +453,7 @@if (!dm_tree_node_add_mirror_target (node, len)) return_0; -if ((r =_add_log (mem, seg, node, area_count, region_size)) <=0 ) { +if ((r =_add_log (mem, seg, laopts, node, area_count, region_size)) <=0 ) { stack;return r; }
lib/replicator/replicator.c +2 -0
@@ -327,6 +327,7 @@struct cmd_context *cmd, void **target_state, struct lv_segment *seg, + const struct lv_activate_opts *laopts, struct dm_tree_node *node, uint64_t len, uint32_t *pvmove_mirror_count)
@@ -609,6 +610,7 @@struct cmd_context *cmd, void **target_state, struct lv_segment *seg, + const struct lv_activate_opts *laopts, struct dm_tree_node *node, uint64_t len, uint32_t *pvmove_mirror_count)
lib/snapshot/snapshot.c +2 -1
@@ -28,7 +28,8 @@return seg->segtype->name; } -static const char *_snap_target_name (const struct lv_segment *seg) +static const char *_snap_target_name (const struct lv_segment *seg, +const struct lv_activate_opts *laopts) {if (seg->status &MERGING )return "snapshot-merge" ;
lib/striped/striped.c +1 -0
@@ -164,6 +164,7 @@ struct cmd_context *cmd __attribute__((unused)), void **target_state __attribute__((unused)),struct lv_segment *seg, + const struct lv_activate_opts *laopts __attribute__((unused)), struct dm_tree_node *node, uint64_t len, uint32_t *pvmove_mirror_count __attribute__((unused))) {
lib/unknown/unknown.c +1 -0
@@ -67,6 +67,7 @@ struct cmd_context *cmd __attribute__((unused)), void **target_state __attribute__((unused)), struct lv_segment *seg __attribute__((unused)), + const struct lv_activate_opts *laopts __attribute__((unused)), struct dm_tree_node *node, uint64_t len, uint32_t *pvmove_mirror_count __attribute__((unused))) {
lib/zero/zero.c +1 -0
@@ -44,6 +44,7 @@ struct cmd_context *cmd __attribute__((unused)), void **target_state __attribute__((unused)), struct lv_segment *seg __attribute__((unused)), + const struct lv_activate_opts *laopts __attribute__((unused)), struct dm_tree_node *node,uint64_t len, uint32_t *pvmove_mirror_count __attribute__((unused))) {
Quoted 8 lines · zkabelac at sourceware.org
+++
LVM2/lib/activate/dev_manager.c2011/06/17 14:14:19 1.218lib/activate/dev_manager.c +1
-1@@ -1758,19 +1768,24 @@/* origin_only may only be set if we are resuming (not activating) an origin LV */ int dev_manager_preload (struct dev_manager *dm,struct logical_volume *lv, -unsigned origin_only,int *flush_required) +struct lv_activate_opts *laopts,int *flush_required)
lib/activate/dev_manager.c line 1780
Quoted 10 lines
lib/activate/dev_manager.c +5
-1{ -if (!_tree_action (dm, lv, origin_only,PRELOAD )) +/* FIXME Update the pvmove implementation! */ +if ((lv->status &PVMOVE ) || (lv->status &LOCKED )) +return 1 ; + +if (!_tree_action (dm, lv, laopts,PRELOAD ))return 0 ; *flush_required = dm->flush_required;
Which reinstates the pvmove bug:)
Alasdair