~ubuntu-branches/ubuntu/saucy/lvm2/saucy

« back to all changes in this revision

Viewing changes to lib/metadata/metadata.h

  • Committer: Package Import Robot
  • Author(s): Dmitrijs Ledkovs
  • Date: 2012-08-14 14:35:57 UTC
  • mfrom: (3.1.25 sid)
  • Revision ID: package-import@ubuntu.com-20120814143557-93aill2tp3kf3o30
Tags: 2.02.95-4ubuntu1
* Merge from Debian unstable, remaining changes:
  - debian/patches/avoid-dev-block.patch: Prefer any other device name over
    names in /dev/block/ since lvm.conf won't handle this.
  - debian/rules:
    - copy .po file to .pot file for Rosetta (Ubuntu specific).
  - debian/{dmsetup,lvm2}-udeb.install:
    - install initramfs and udev hooks in udebs (Debian bug 504341).
  - auto-start VGs as their PVs are discovered (Ubuntu specific):
    - add debian/tree/lvm2/lib/udev/rules.d/85-lvm2.rules: use watershed plus
      the sledgehammer of vgscan/vgchange to turn on VGs as they come online.
    - debian/tree/lvm2/usr/share/initramfs-tools/scripts/hooks/lvm2:
      - add 85-lvm2.rules to the list of udev rules to copy.
      - depend on udev.
    - debian/control:
      - add versioned Depend on watershed in lvm2 for udev rules.
      - add Depends on watershed-udeb in lvm2-udeb for udev rules.
      - add versioned Depend/Breaks on udev in dmsetup for udev rules.
      - add Depend on initramfs-tools in dmsetup so system is not potentially
        rendered unbootable by out-of-order dpkg configuration.
    - debian/rules:
      - do not install local-top scripts since Ubuntu mounts root using udev.
      - do not install init scripts for lvm2, since udev starts LVM.
    - debian/lvm2.postinst: handle missing lvm2 init script.
    - debian/tree/dmsetup/lib/udev/rules.d/60-persistent-storage-dm.rules:
      watch dm devices for changes with inotify
  - add mountroot failure hooks to help fix bad boots (Debian bug 468115):
    - debian/tree/lvm2/usr/share/initramfs-tools/scripts/init-premount/lvm2
  - remaining changes to upstream event manager packages (Debian bug 514706):
    - debian/rules:
      - enable dmeventd during configure.
    - debian/dmeventd.{8,manpages}: install dmeventd files.
  - rename debian/clvm.defaults to debian/clvm.default so it is installed
    correctly.
  - debian/control: add dmsetup-udeb to libdevmapper1.02.1-udeb recommends.
  - debian/rules: make sure dmsetup and lvm2 initramfs-tools scripts are
    executable.  When the Ubuntu-specific ones are added with a patch,
    they may lose their executable bit.
  - Add and install clvmd resource agent
  - Add dependency on libudev-dev to libdevmapper-dev so that the .pc file
    works.
  - debian/{clvmd.ra,clvm.init}:
    - create /run/lvm if it doesn't exist.
  - debian/clvm.init:
    - exit 3 if not running on status action.
  - Call dh_installman so that our dmeventd manpage actually gets installed
  - Install the missing fsadm manpage.

 * libdevmapper-dev:
  - move .so symlinks and pkgconfig files to multiarched locations.
  - mark libdevmapper-dev M-A: same

 * libdevmapper-event1.02.1:
  - Add Breaks: dmeventd (<< 2.02.95-4ubuntu1) due to debian symbol rename

 * debian/lvm2.{preinst,postinst,postrm}:
  - Implement removal of obsolete /etc/init.d/lvm2 conffile, which
    should not have been re-introduced in Quantal.

 * Dropped Changes, included in Debian:
  - Mostly included packages for upstream event manager (Debian bug 514706).
  - debian/patches/rules-subdir.patch: removed as reordering will cause
    build failure with dmeventd.
  - debian/patches/libdm-event-static.patch: removed as other static libs
    aren't being built anymore either.
  - Update symbols for libdevmapper-event.
  - Update libdevmapper-event, dmeventd descriptions to match Debian
    boilerplate.

 * Disappeared Changes:
  - Don't install documentation in udebs. No diff found, but no docs are
    installed into udebs either.

 * Resurected Changes:
  - corrected dropping the wrong init script. Now clvm.init is shipped
    and lvm2.init is dropped in favor of udev rules as per original
    intention (LP: #1037033).

Show diffs side-by-side

added added

removed removed

Lines of Context:
49
49
 
50
50
 
51
51
/* Various flags */
 
52
/* See metadata-exported.h for the complete list. */
52
53
/* Note that the bits no longer necessarily correspond to LVM1 disk format */
53
54
 
54
 
//#define PARTIAL_VG            0x00000001U     /* VG */
55
 
//#define EXPORTED_VG           0x00000002U     /* VG PV */
56
 
//#define RESIZEABLE_VG         0x00000004U     /* VG */
57
 
 
58
55
/* May any free extents on this PV be used or must they be left free? */
59
 
//#define ALLOCATABLE_PV                0x00000008U     /* PV */
60
 
 
61
 
#define SPINDOWN_LV             0x00000010U     /* LV */
62
 
#define BADBLOCK_ON             0x00000020U     /* LV */
63
 
//#define VISIBLE_LV            0x00000040U     /* LV */
64
 
//#define FIXED_MINOR           0x00000080U     /* LV */
65
 
/* FIXME Remove when metadata restructuring is completed */
66
 
//#define SNAPSHOT              0x00001000U     /* LV - internal use only */
67
 
//#define PVMOVE                        0x00002000U     /* VG LV SEG */
68
 
//#define LOCKED                        0x00004000U     /* LV */
69
 
//#define MIRRORED              0x00008000U     /* LV - internal use only */
70
 
#define VIRTUAL                 0x00010000U     /* LV - internal use only */
71
 
//#define MIRROR_LOG            0x00020000U     /* LV */
72
 
//#define MIRROR_IMAGE          0x00040000U     /* LV */
73
 
//#define MIRROR_NOTSYNCED      0x00080000U     /* LV */
74
 
#define PRECOMMITTED            0x00200000U     /* VG - internal use only */
75
 
//#define CONVERTING            0x00400000U     /* LV */
76
 
 
77
 
//#define MISSING_PV            0x00800000U     /* PV */
78
 
//#define PARTIAL_LV            0x01000000U     /* LV - derived flag, not
79
 
//                                                 written out in metadata*/
80
 
 
81
 
#define POSTORDER_FLAG          0x02000000U /* Not real flags, reserved for  */
82
 
#define POSTORDER_OPEN_FLAG     0x04000000U /* temporary use inside vg_read_internal. */
83
 
#define VIRTUAL_ORIGIN          0x08000000U     /* LV - internal use only */
84
 
 
85
 
//#define LVM_READ                      0x00000100U     /* LV VG */
86
 
//#define LVM_WRITE                     0x00000200U     /* LV VG */
87
 
//#define CLUSTERED             0x00000400U     /* VG */
88
 
#define SHARED                  0x00000800U     /* VG */
 
56
 
 
57
#define SPINDOWN_LV             UINT64_C(0x00000010)    /* LV */
 
58
#define BADBLOCK_ON             UINT64_C(0x00000020)    /* LV */
 
59
#define VIRTUAL                 UINT64_C(0x00010000)    /* LV - internal use only */
 
60
#define PRECOMMITTED            UINT64_C(0x00200000)    /* VG - internal use only */
 
61
#define POSTORDER_FLAG          UINT64_C(0x02000000) /* Not real flags, reserved for  */
 
62
#define POSTORDER_OPEN_FLAG     UINT64_C(0x04000000) /* temporary use inside vg_read_internal. */
 
63
#define VIRTUAL_ORIGIN          UINT64_C(0x08000000)    /* LV - internal use only */
 
64
 
 
65
#define SHARED                  UINT64_C(0x00000800)    /* VG */
89
66
 
90
67
/* Format features flags */
91
 
//#define FMT_SEGMENTS          0x00000001U     /* Arbitrary segment params? */
92
 
//#define FMT_MDAS              0x00000002U     /* Proper metadata areas? */
93
 
//#define FMT_TAGS              0x00000004U     /* Tagging? */
94
 
//#define FMT_UNLIMITED_VOLS    0x00000008U     /* Unlimited PVs/LVs? */
95
 
//#define FMT_RESTRICTED_LVIDS  0x00000010U     /* LVID <= 255 */
96
 
//#define FMT_ORPHAN_ALLOCATABLE        0x00000020U     /* Orphan PV allocatable? */
97
68
#define FMT_PRECOMMIT           0x00000040U     /* Supports pre-commit? */
98
 
//#define FMT_RESIZE_PV         0x00000080U     /* Supports pvresize? */
99
 
//#define FMT_UNLIMITED_STRIPESIZE 0x00000100U  /* Unlimited stripe size? */
100
69
 
101
 
struct config_tree;
 
70
struct dm_config_tree;
102
71
struct metadata_area;
 
72
struct alloc_handle;
 
73
struct lvmcache_info;
103
74
 
104
75
/* Per-format per-metadata area operations */
105
76
struct metadata_area_ops {
 
77
        struct dm_list list;
106
78
        struct volume_group *(*vg_read) (struct format_instance * fi,
107
79
                                         const char *vg_name,
108
 
                                         struct metadata_area * mda);
 
80
                                         struct metadata_area * mda,
 
81
                                         int single_device);
109
82
        struct volume_group *(*vg_read_precommit) (struct format_instance * fi,
110
83
                                         const char *vg_name,
111
84
                                         struct metadata_area * mda);
175
148
                                    struct metadata_area *mda2);
176
149
 
177
150
        struct device *(*mda_get_device)(struct metadata_area *mda);
 
151
        char *(*mda_export_text)(struct metadata_area *mda);
 
152
        int (*mda_import_text)(struct lvmcache_info *info, const struct dm_config_node *cn);
178
153
};
179
154
 
180
155
#define MDA_IGNORED      0x00000001
402
377
/* Find LV segment containing given LE */
403
378
struct lv_segment *find_seg_by_le(const struct logical_volume *lv, uint32_t le);
404
379
 
 
380
/* Find pool LV segment given a thin pool data or metadata segment. */
 
381
struct lv_segment *find_pool_seg(const struct lv_segment *seg);
 
382
 
 
383
/* Find some unused device_id for thin pool LV segment. */
 
384
uint32_t get_free_pool_device_id(struct lv_segment *thin_pool_seg);
 
385
 
405
386
/*
406
387
 * Remove a dev_dir if present.
407
388
 */
445
426
                    int (*fn)(struct cmd_context *cmd,
446
427
                              struct logical_volume *lv, void *data),
447
428
                    void *data);
 
429
int move_lv_segments(struct logical_volume *lv_to,
 
430
                     struct logical_volume *lv_from,
 
431
                     uint64_t set_status, uint64_t reset_status);
448
432
 
449
433
/*
450
434
 * Calculate readahead from underlying PV devices
454
438
/*
455
439
 * For internal metadata caching.
456
440
 */
457
 
int export_vg_to_buffer(struct volume_group *vg, char **buf);
 
441
size_t export_vg_to_buffer(struct volume_group *vg, char **buf);
 
442
int export_vg_to_config_tree(struct volume_group *vg, struct dm_config_tree **cft);
458
443
struct volume_group *import_vg_from_buffer(const char *buf,
459
444
                                           struct format_instance *fid);
460
 
struct volume_group *import_vg_from_config_tree(const struct config_tree *cft,
 
445
struct volume_group *import_vg_from_config_tree(const struct dm_config_tree *cft,
461
446
                                                struct format_instance *fid);
462
447
 
463
448
/*
470
455
int fixup_imported_mirrors(struct volume_group *vg);
471
456
 
472
457
/*
 
458
 * From thin_manip.c
 
459
 */
 
460
int attach_pool_metadata_lv(struct lv_segment *pool_seg,
 
461
                            struct logical_volume *pool_metadata_lv);
 
462
int attach_pool_data_lv(struct lv_segment *pool_seg,
 
463
                        struct logical_volume *pool_data_lv);
 
464
int attach_pool_lv(struct lv_segment *seg, struct logical_volume *pool_lv,
 
465
                   struct logical_volume *origin_lv);
 
466
int detach_pool_lv(struct lv_segment *seg);
 
467
int attach_pool_message(struct lv_segment *pool_seg, dm_thin_message_t type,
 
468
                        struct logical_volume *lv, uint32_t delete_id,
 
469
                        int auto_increment);
 
470
int pool_has_message(const struct lv_segment *seg,
 
471
                     const struct logical_volume *lv, uint32_t device_id);
 
472
int pool_below_threshold(const struct lv_segment *pool_seg);
 
473
int extend_pool(struct logical_volume *lv, const struct segment_type *segtype,
 
474
                struct alloc_handle *ah, uint32_t stripes, uint32_t stripe_size);
 
475
 
 
476
/*
473
477
 * Begin skeleton for external LVM library
474
478
 */
475
479
struct id pv_id(const struct physical_volume *pv);