From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11058 invoked by alias); 3 Oct 2006 17:55:22 -0000 Received: (qmail 11044 invoked by uid 9447); 3 Oct 2006 17:55:21 -0000 Date: Tue, 03 Oct 2006 17:55:00 -0000 Message-ID: <20061003175521.11042.qmail@sourceware.org> From: agk@sourceware.org To: lvm2-cvs@sourceware.org Subject: LVM2 ./WHATS_NEW lib/activate/activate.c lib/a ... Mailing-List: contact lvm2-cvs-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Post: List-Help: , Sender: lvm2-cvs-owner@sourceware.org X-SW-Source: 2006-10/txt/msg00002.txt.bz2 List-Id: CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: agk@sourceware.org 2006-10-03 17:55:20 Modified files: . : WHATS_NEW lib/activate : activate.c activate.h lib/error : errseg.c lib/metadata : segtype.h lib/mirror : mirrored.c lib/report : columns.h report.c lib/snapshot : snapshot.c lib/striped : striped.c lib/zero : zero.c Log message: Add LV column to reports listing kernel modules needed for activation. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.447&r2=1.448 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/activate/activate.c.diff?cvsroot=lvm2&r1=1.113&r2=1.114 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/activate/activate.h.diff?cvsroot=lvm2&r1=1.51&r2=1.52 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/error/errseg.c.diff?cvsroot=lvm2&r1=1.10&r2=1.11 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/segtype.h.diff?cvsroot=lvm2&r1=1.12&r2=1.13 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/mirror/mirrored.c.diff?cvsroot=lvm2&r1=1.35&r2=1.36 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/report/columns.h.diff?cvsroot=lvm2&r1=1.16&r2=1.17 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/report/report.c.diff?cvsroot=lvm2&r1=1.48&r2=1.49 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/snapshot/snapshot.c.diff?cvsroot=lvm2&r1=1.17&r2=1.18 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/striped/striped.c.diff?cvsroot=lvm2&r1=1.17&r2=1.18 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/zero/zero.c.diff?cvsroot=lvm2&r1=1.9&r2=1.10 --- LVM2/WHATS_NEW 2006/10/02 16:46:27 1.447 +++ LVM2/WHATS_NEW 2006/10/03 17:55:19 1.448 @@ -1,5 +1,6 @@ Version 2.02.11 - ===================================== + Add LV column to reports listing kernel modules needed for activation. Show available fields if report given invalid field. (e.g. lvs -o list) Add timestamp functions with --disable-realtime configure option. Add %VG, %LV and %FREE suffices to lvcreate/lvresize --extents arg. --- LVM2/lib/activate/activate.c 2006/08/21 12:54:51 1.113 +++ LVM2/lib/activate/activate.c 2006/10/03 17:55:19 1.114 @@ -51,6 +51,66 @@ return 0; } +int list_segment_modules(struct dm_pool *mem, const struct lv_segment *seg, + struct list *modules) +{ + unsigned int s; + struct lv_segment *seg2, *snap_seg; + struct list *snh; + + if (seg->segtype->ops->modules_needed && + !seg->segtype->ops->modules_needed(mem, seg, modules)) { + log_error("module string allocation failed"); + return 0; + } + + if (lv_is_origin(seg->lv)) + list_iterate(snh, &seg->lv->snapshot_segs) + if (!list_lv_modules(mem, + list_struct_base(snh, + struct lv_segment, + origin_list)->cow, + modules)) + return_0; + + if (lv_is_cow(seg->lv)) { + snap_seg = find_cow(seg->lv); + if (snap_seg->segtype->ops->modules_needed && + !snap_seg->segtype->ops->modules_needed(mem, snap_seg, + modules)) { + log_error("snap_seg module string allocation failed"); + return 0; + } + } + + for (s = 0; s < seg->area_count; s++) { + switch (seg_type(seg, s)) { + case AREA_LV: + seg2 = find_seg_by_le(seg_lv(seg, s), seg_le(seg, s)); + if (seg2 && !list_segment_modules(mem, seg2, modules)) + return_0; + break; + case AREA_PV: + case AREA_UNASSIGNED: + ; + } + } + + return 1; +} + +int list_lv_modules(struct dm_pool *mem, const struct logical_volume *lv, + struct list *modules) +{ + struct lv_segment *seg; + + list_iterate_items(seg, &lv->segments) + if (!list_segment_modules(mem, seg, modules)) + return_0; + + return 1; +} + #ifndef DEVMAPPER_SUPPORT void set_activation(int act) { --- LVM2/lib/activate/activate.h 2006/05/16 16:48:30 1.51 +++ LVM2/lib/activate/activate.h 2006/10/03 17:55:19 1.52 @@ -39,6 +39,10 @@ int target_present(const char *target_name, int use_modprobe); int target_version(const char *target_name, uint32_t *maj, uint32_t *min, uint32_t *patchlevel); +int list_segment_modules(struct dm_pool *mem, const struct lv_segment *seg, + struct list *modules); +int list_lv_modules(struct dm_pool *mem, const struct logical_volume *lv, + struct list *modules); void activation_release(void); void activation_exit(void); --- LVM2/lib/error/errseg.c 2006/05/16 16:48:30 1.10 +++ LVM2/lib/error/errseg.c 2006/10/03 17:55:19 1.11 @@ -23,6 +23,7 @@ #include "targets.h" #include "lvm-string.h" #include "activate.h" +#include "str_list.h" static const char *_errseg_name(const struct lv_segment *seg) { @@ -64,6 +65,18 @@ } #endif +static int _errseg_modules_needed(struct dm_pool *mem, + const struct lv_segment *seg, + struct list *modules) +{ + if (!str_list_add(mem, modules, "error")) { + log_error("error module string list allocation failed"); + return 0; + } + + return 1; +} + static void _errseg_destroy(const struct segment_type *segtype) { dm_free((void *)segtype); @@ -76,6 +89,7 @@ .add_target_line = _errseg_add_target_line, .target_present = _errseg_target_present, #endif + .modules_needed = _errseg_modules_needed, .destroy = _errseg_destroy, }; --- LVM2/lib/metadata/segtype.h 2006/05/25 13:32:26 1.12 +++ LVM2/lib/metadata/segtype.h 2006/10/03 17:55:19 1.13 @@ -77,6 +77,9 @@ uint64_t *total_numerator, uint64_t *total_denominator, float *percent); int (*target_present) (void); + int (*modules_needed) (struct dm_pool *mem, + const struct lv_segment *seg, + struct list *modules); void (*destroy) (const struct segment_type * segtype); int (*target_register_events) (struct lv_segment *seg, int events); int (*target_unregister_events) (struct lv_segment *seg, int events); --- LVM2/lib/mirror/mirrored.c 2006/05/25 13:32:26 1.35 +++ LVM2/lib/mirror/mirrored.c 2006/10/03 17:55:19 1.36 @@ -26,6 +26,7 @@ #include "targets.h" #include "activate.h" #include "sharedlib.h" +#include "str_list.h" #ifdef DMEVENTD # include @@ -447,6 +448,28 @@ #endif /* DMEVENTD */ #endif /* DEVMAPPER_SUPPORT */ +static int _mirrored_modules_needed(struct dm_pool *mem, + const struct lv_segment *seg, + struct list *modules) +{ + if (seg->log_lv && + !list_segment_modules(mem, first_seg(seg->log_lv), modules)) + return_0; + + if ((seg->lv->vg->status & CLUSTERED) && + !str_list_add(mem, modules, "clog")) { + log_error("cluster log string list allocation failed"); + return 0; + } + + if (!str_list_add(mem, modules, "mirror")) { + log_error("mirror string list allocation failed"); + return 0; + } + + return 1; +} + static void _mirrored_destroy(const struct segment_type *segtype) { dm_free((void *) segtype); @@ -467,6 +490,7 @@ .target_unregister_events = _target_unregister_events, #endif #endif + .modules_needed = _mirrored_modules_needed, .destroy = _mirrored_destroy, }; --- LVM2/lib/report/columns.h 2005/10/20 22:24:46 1.16 +++ LVM2/lib/report/columns.h 2006/10/03 17:55:20 1.17 @@ -33,6 +33,7 @@ FIELD(LVS, lv, STR, "Move", lvid, 4, movepv, "move_pv") FIELD(LVS, lv, STR, "LV Tags", tags, 7, tags, "lv_tags") FIELD(LVS, lv, STR, "Log", lvid, 3, loglv, "mirror_log") +FIELD(LVS, lv, STR, "Modules", lvid, 7, modules, "modules") FIELD(PVS, pv, STR, "Fmt", id, 3, pvfmt, "pv_fmt") FIELD(PVS, pv, STR, "PV UUID", id, 38, uuid, "pv_uuid") --- LVM2/lib/report/report.c 2006/10/02 16:46:27 1.48 +++ LVM2/lib/report/report.c 2006/10/03 17:55:20 1.49 @@ -21,6 +21,7 @@ #include "display.h" #include "activate.h" #include "segtype.h" +#include "str_list.h" /* * For macro use @@ -200,6 +201,7 @@ return 1; } + static int _tags_disp(struct report_handle *rh, struct field *field, const void *data) { @@ -230,6 +232,23 @@ return 1; } +static int _modules_disp(struct report_handle *rh, struct field *field, + const void *data) +{ + const struct logical_volume *lv = (const struct logical_volume *) data; + struct list *modules; + + if (!(modules = str_list_create(rh->mem))) { + log_error("modules str_list allocation failed"); + return 0; + } + + if (!list_lv_modules(rh->mem, lv, modules)) + return_0; + + return _tags_disp(rh, field, modules); +} + static int _vgfmt_disp(struct report_handle *rh, struct field *field, const void *data) { --- LVM2/lib/snapshot/snapshot.c 2006/05/16 20:53:13 1.17 +++ LVM2/lib/snapshot/snapshot.c 2006/10/03 17:55:20 1.18 @@ -20,6 +20,7 @@ #include "text_export.h" #include "config.h" #include "activate.h" +#include "str_list.h" static const char *_snap_name(const struct lv_segment *seg) { @@ -126,6 +127,18 @@ } #endif +static int _snap_modules_needed(struct dm_pool *mem, + const struct lv_segment *seg, + struct list *modules) +{ + if (!str_list_add(mem, modules, "snapshot")) { + log_error("snapshot string list allocation failed"); + return 0; + } + + return 1; +} + static void _snap_destroy(const struct segment_type *segtype) { dm_free((void *)segtype); @@ -139,6 +152,7 @@ .target_percent = _snap_target_percent, .target_present = _snap_target_present, #endif + .modules_needed = _snap_modules_needed, .destroy = _snap_destroy, }; --- LVM2/lib/striped/striped.c 2006/05/16 16:48:31 1.17 +++ LVM2/lib/striped/striped.c 2006/10/03 17:55:20 1.18 @@ -189,6 +189,17 @@ } #endif +static int _striped_modules_needed(struct dm_pool *mem, + const struct lv_segment *seg, + struct list *modules) +{ + const char *module; + + module = (seg->area_count == 1) ? "linear" : "striped"; + + return str_list_add(mem, modules, module); +} + static void _striped_destroy(const struct segment_type *segtype) { dm_free((void *)segtype); @@ -205,6 +216,7 @@ .add_target_line = _striped_add_target_line, .target_present = _striped_target_present, #endif + .modules_needed = _striped_modules_needed, .destroy = _striped_destroy, }; --- LVM2/lib/zero/zero.c 2006/05/16 16:48:31 1.9 +++ LVM2/lib/zero/zero.c 2006/10/03 17:55:20 1.10 @@ -63,6 +63,18 @@ } #endif +static int _zero_modules_needed(struct dm_pool *mem, + const struct lv_segment *seg, + struct list *modules) +{ + if (!str_list_add(mem, modules, "zero")) { + log_error("zero module string list allocation failed"); + return 0; + } + + return 1; +} + static void _zero_destroy(const struct segment_type *segtype) { dm_free((void *) segtype); @@ -75,6 +87,7 @@ .add_target_line = _zero_add_target_line, .target_present = _zero_target_present, #endif + .modules_needed = _zero_modules_needed, .destroy = _zero_destroy, };