public inbox for lvm2-cvs@sourceware.org help / color / mirror / Atom feed
From: agk@sourceware.org To: lvm2-cvs@sourceware.org Subject: LVM2 ./WHATS_NEW lib/activate/activate.c lib/a ... Date: Tue, 03 Oct 2006 17:55:00 -0000 [thread overview] Message-ID: <20061003175521.11042.qmail@sourceware.org> (raw) 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 <libdevmapper-event.h> @@ -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, };
next reply other threads:[~2006-10-03 17:55 UTC|newest] Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top 2006-10-03 17:55 agk [this message] -- strict thread matches above, loose matches on Subject: below -- 2012-03-23 9:58 zkabelac 2012-02-23 22:42 zkabelac 2012-01-25 13:10 zkabelac 2012-01-25 8:48 zkabelac 2011-11-18 19:31 zkabelac 2011-10-06 14:55 jbrassow 2011-10-03 18:37 zkabelac 2011-09-22 17:33 prajnoha 2011-06-30 18:25 agk 2011-06-22 21:31 jbrassow 2011-06-17 14:22 zkabelac 2011-06-17 14:14 zkabelac 2011-02-04 19:14 zkabelac 2011-02-03 1:24 zkabelac 2010-08-17 1:16 agk 2010-02-24 20:01 mbroz 2010-02-24 20:00 mbroz 2009-10-01 0:35 agk 2009-06-01 12:43 mbroz 2009-05-20 11:09 mbroz 2009-05-20 9:52 mbroz 2009-02-28 0:54 agk 2008-12-19 14:22 prajnoha 2008-04-07 10:23 mbroz 2008-01-30 14:00 agk 2007-11-12 20:51 agk 2007-07-02 11:17 wysochanski 2007-03-08 21:08 agk 2006-08-21 12:55 agk 2006-08-08 21:20 agk 2005-12-19 21:01 agk 2005-10-25 19:08 agk 2005-10-19 13:59 agk 2005-06-01 16:51 agk 2005-01-12 22:58 agk
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20061003175521.11042.qmail@sourceware.org \ --to=agk@sourceware.org \ --cc=lvm2-cvs@sourceware.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).