2004-05-04 21:25:57 +00:00
/*
* Copyright ( C ) 2001 - 2004 Sistina Software , Inc . All rights reserved .
2017-04-12 01:28:22 +02:00
* Copyright ( C ) 2004 - 2017 Red Hat , Inc . All rights reserved .
2004-05-04 21:25:57 +00:00
*
* This file is part of LVM2 .
*
* This copyrighted material is made available to anyone wishing to use ,
* modify , copy , or redistribute it subject to the terms and conditions
2007-08-20 20:55:30 +00:00
* of the GNU Lesser General Public License v .2 .1 .
2004-05-04 21:25:57 +00:00
*
2007-08-20 20:55:30 +00:00
* You should have received a copy of the GNU Lesser General Public License
2004-05-04 21:25:57 +00:00
* along with this program ; if not , write to the Free Software Foundation ,
2016-01-21 11:49:46 +01:00
* Inc . , 51 Franklin Street , Fifth Floor , Boston , MA 02110 - 1301 USA
2004-05-04 21:25:57 +00:00
*/
# ifndef _SEGTYPES_H
# define _SEGTYPES_H
2018-05-14 10:30:20 +01:00
# include "lib/metadata/metadata-exported.h"
2009-10-01 00:35:29 +00:00
2004-05-04 21:25:57 +00:00
struct segtype_handler ;
struct cmd_context ;
2011-08-30 14:55:15 +00:00
struct dm_config_tree ;
2004-05-04 21:25:57 +00:00
struct lv_segment ;
2011-06-17 14:14:19 +00:00
struct lv_activate_opts ;
2004-05-04 21:25:57 +00:00
struct formatter ;
2011-08-30 14:55:15 +00:00
struct dm_config_node ;
2004-05-04 21:25:57 +00:00
struct dev_manager ;
/* Feature flags */
2017-03-22 00:29:49 +01:00
# define SEG_CAN_SPLIT (1ULL << 0)
# define SEG_AREAS_STRIPED (1ULL << 1)
# define SEG_AREAS_MIRRORED (1ULL << 2)
# define SEG_SNAPSHOT (1ULL << 3)
2018-04-27 16:22:46 -05:00
/* #define SEG_FORMAT1_SUPPORT (1ULL << 4) */
2017-03-22 00:29:49 +01:00
# define SEG_VIRTUAL (1ULL << 5)
# define SEG_CANNOT_BE_ZEROED (1ULL << 6)
# define SEG_MONITORED (1ULL << 7)
# define SEG_RAID (1ULL << 10)
# define SEG_THIN_POOL (1ULL << 11)
# define SEG_THIN_VOLUME (1ULL << 12)
# define SEG_CACHE (1ULL << 13)
# define SEG_CACHE_POOL (1ULL << 14)
# define SEG_MIRROR (1ULL << 15)
# define SEG_ONLY_EXCLUSIVE (1ULL << 16) /* In cluster only exlusive activation */
# define SEG_CAN_ERROR_WHEN_FULL (1ULL << 17)
2015-09-24 20:17:57 +01:00
2017-03-22 00:29:49 +01:00
# define SEG_RAID0 (1ULL << 18)
# define SEG_RAID0_META (1ULL << 19)
# define SEG_RAID1 (1ULL << 20)
# define SEG_RAID10_NEAR (1ULL << 21)
2017-02-10 19:10:05 +01:00
# define SEG_RAID10 SEG_RAID10_NEAR
2017-03-22 00:29:49 +01:00
# define SEG_RAID4 (1ULL << 22)
# define SEG_RAID5_N (1ULL << 23)
# define SEG_RAID5_LA (1ULL << 24)
# define SEG_RAID5_LS (1ULL << 25)
# define SEG_RAID5_RA (1ULL << 26)
# define SEG_RAID5_RS (1ULL << 27)
2015-09-24 20:17:57 +01:00
# define SEG_RAID5 SEG_RAID5_LS
2017-03-22 00:29:49 +01:00
# define SEG_RAID6_NC (1ULL << 28)
# define SEG_RAID6_NR (1ULL << 29)
# define SEG_RAID6_ZR (1ULL << 30)
# define SEG_RAID6_LA_6 (1ULL << 31)
# define SEG_RAID6_LS_6 (1ULL << 32)
# define SEG_RAID6_RA_6 (1ULL << 33)
# define SEG_RAID6_RS_6 (1ULL << 34)
# define SEG_RAID6_N_6 (1ULL << 35)
2015-09-24 20:17:57 +01:00
# define SEG_RAID6 SEG_RAID6_ZR
2018-08-27 14:53:09 -05:00
# define SEG_WRITECACHE (1ULL << 36)
2019-11-20 16:07:27 -06:00
# define SEG_INTEGRITY (1ULL << 37)
2015-09-24 20:17:57 +01:00
2017-03-22 00:29:49 +01:00
# define SEG_STRIPED_TARGET (1ULL << 39)
2018-05-30 12:44:24 +02:00
# define SEG_LINEAR_TARGET (1ULL << 40)
2018-06-29 11:11:14 +02:00
# define SEG_VDO (1ULL << 41)
# define SEG_VDO_POOL (1ULL << 42)
2016-08-04 01:24:39 +01:00
2017-03-22 00:29:49 +01:00
# define SEG_UNKNOWN (1ULL << 63)
2015-09-22 18:03:33 +01:00
# define SEG_TYPE_NAME_LINEAR "linear"
# define SEG_TYPE_NAME_STRIPED "striped"
# define SEG_TYPE_NAME_MIRROR "mirror"
2015-09-22 19:04:12 +01:00
# define SEG_TYPE_NAME_SNAPSHOT "snapshot"
# define SEG_TYPE_NAME_THIN "thin"
# define SEG_TYPE_NAME_THIN_POOL "thin-pool"
# define SEG_TYPE_NAME_CACHE "cache"
# define SEG_TYPE_NAME_CACHE_POOL "cache-pool"
2018-08-27 14:53:09 -05:00
# define SEG_TYPE_NAME_WRITECACHE "writecache"
2019-11-20 16:07:27 -06:00
# define SEG_TYPE_NAME_INTEGRITY "integrity"
2015-09-22 19:04:12 +01:00
# define SEG_TYPE_NAME_ERROR "error"
# define SEG_TYPE_NAME_FREE "free"
# define SEG_TYPE_NAME_ZERO "zero"
2018-06-29 11:11:14 +02:00
# define SEG_TYPE_NAME_VDO "vdo"
# define SEG_TYPE_NAME_VDO_POOL "vdo-pool"
2015-09-22 19:04:12 +01:00
# define SEG_TYPE_NAME_RAID "raid"
2015-09-24 19:52:22 +01:00
# define SEG_TYPE_NAME_RAID0 "raid0"
2016-07-01 22:20:54 +01:00
# define SEG_TYPE_NAME_RAID0_META "raid0_meta"
2015-09-22 18:03:33 +01:00
# define SEG_TYPE_NAME_RAID1 "raid1"
# define SEG_TYPE_NAME_RAID10 "raid10"
2017-04-12 01:28:22 +02:00
# define SEG_TYPE_NAME_RAID10_NEAR "raid10_near"
2015-09-22 18:03:33 +01:00
# define SEG_TYPE_NAME_RAID4 "raid4"
# define SEG_TYPE_NAME_RAID5 "raid5"
2016-08-05 14:00:08 +01:00
# define SEG_TYPE_NAME_RAID5_N "raid5_n"
2015-09-22 18:03:33 +01:00
# define SEG_TYPE_NAME_RAID5_LA "raid5_la"
# define SEG_TYPE_NAME_RAID5_LS "raid5_ls"
# define SEG_TYPE_NAME_RAID5_RA "raid5_ra"
# define SEG_TYPE_NAME_RAID5_RS "raid5_rs"
# define SEG_TYPE_NAME_RAID6 "raid6"
# define SEG_TYPE_NAME_RAID6_NC "raid6_nc"
# define SEG_TYPE_NAME_RAID6_NR "raid6_nr"
# define SEG_TYPE_NAME_RAID6_ZR "raid6_zr"
2016-08-05 14:00:08 +01:00
# define SEG_TYPE_NAME_RAID6_LA_6 "raid6_la_6"
# define SEG_TYPE_NAME_RAID6_LS_6 "raid6_ls_6"
# define SEG_TYPE_NAME_RAID6_RA_6 "raid6_ra_6"
# define SEG_TYPE_NAME_RAID6_RS_6 "raid6_rs_6"
# define SEG_TYPE_NAME_RAID6_N_6 "raid6_n_6"
2015-09-22 18:03:33 +01:00
2018-05-30 12:44:24 +02:00
# define segtype_is_linear(segtype) (!strcmp((segtype)->name, SEG_TYPE_NAME_LINEAR))
2021-03-18 13:13:38 +01:00
# define segtype_is_error(segtype) (!strcmp((segtype)->name, SEG_TYPE_NAME_ERROR))
# define segtype_is_zero(segtype) (!strcmp((segtype)->name, SEG_TYPE_NAME_ZERO))
2016-08-04 01:24:39 +01:00
# define segtype_is_striped_target(segtype) ((segtype)->flags & SEG_STRIPED_TARGET ? 1 : 0)
2014-01-27 05:27:16 -06:00
# define segtype_is_cache(segtype) ((segtype)->flags & SEG_CACHE ? 1 : 0)
# define segtype_is_cache_pool(segtype) ((segtype)->flags & SEG_CACHE_POOL ? 1 : 0)
2018-08-27 14:53:09 -05:00
# define segtype_is_writecache(segtype) ((segtype)->flags & SEG_WRITECACHE ? 1 : 0)
2019-11-20 16:07:27 -06:00
# define segtype_is_integrity(segtype) ((segtype)->flags & SEG_INTEGRITY ? 1 : 0)
2013-12-10 10:45:21 +01:00
# define segtype_is_mirrored(segtype) ((segtype)->flags & SEG_AREAS_MIRRORED ? 1 : 0)
2014-09-16 00:13:46 +01:00
# define segtype_is_mirror(segtype) ((segtype)->flags & SEG_MIRROR ? 1 : 0)
2014-05-23 14:24:28 +02:00
# define segtype_is_pool(segtype) ((segtype)->flags & (SEG_CACHE_POOL | SEG_THIN_POOL) ? 1 : 0)
2016-05-23 16:46:38 +01:00
# define segtype_is_raid0(segtype) ((segtype)->flags & SEG_RAID0 ? 1 : 0)
2016-07-01 22:20:54 +01:00
# define segtype_is_raid0_meta(segtype) ((segtype)->flags & SEG_RAID0_META ? 1 : 0)
# define segtype_is_any_raid0(segtype) ((segtype)->flags & (SEG_RAID0 | SEG_RAID0_META) ? 1 : 0)
2013-12-10 10:45:21 +01:00
# define segtype_is_raid(segtype) ((segtype)->flags & SEG_RAID ? 1 : 0)
2015-09-24 20:26:33 +01:00
# define segtype_is_raid1(segtype) ((segtype)->flags & SEG_RAID1 ? 1 : 0)
# define segtype_is_raid4(segtype) ((segtype)->flags & SEG_RAID4 ? 1 : 0)
# define segtype_is_any_raid5(segtype) ((segtype)->flags & \
( SEG_RAID5_LS | SEG_RAID5_LA | SEG_RAID5_RS | SEG_RAID5_RA | SEG_RAID5_N ) ? 1 : 0 )
2016-08-05 14:00:08 +01:00
# define segtype_is_raid5_n(segtype) ((segtype)->flags & SEG_RAID5_N ? 1 : 0)
2015-09-24 20:26:33 +01:00
# define segtype_is_raid5_la(segtype) ((segtype)->flags & SEG_RAID5_LA ? 1 : 0)
# define segtype_is_raid5_ra(segtype) ((segtype)->flags & SEG_RAID5_RA ? 1 : 0)
# define segtype_is_raid5_ls(segtype) ((segtype)->flags & SEG_RAID5_LS ? 1 : 0)
# define segtype_is_raid5_rs(segtype) ((segtype)->flags & SEG_RAID5_RS ? 1 : 0)
# define segtype_is_any_raid6(segtype) ((segtype)->flags & \
( SEG_RAID6_ZR | SEG_RAID6_NC | SEG_RAID6_NR | \
SEG_RAID6_LA_6 | SEG_RAID6_LS_6 | SEG_RAID6_RA_6 | SEG_RAID6_RS_6 | SEG_RAID6_N_6 ) ? 1 : 0 )
# define segtype_is_raid6_nc(segtype) ((segtype)->flags & SEG_RAID6_NC ? 1 : 0)
# define segtype_is_raid6_nr(segtype) ((segtype)->flags & SEG_RAID6_NR ? 1 : 0)
2016-08-05 14:00:08 +01:00
# define segtype_is_raid6_n_6(segtype) ((segtype)->flags & SEG_RAID6_N_6 ? 1 : 0)
2015-09-24 20:26:33 +01:00
# define segtype_is_raid6_zr(segtype) ((segtype)->flags & SEG_RAID6_ZR ? 1 : 0)
lvconvert: add segtypes raid6_{ls,rs,la,ra}_6 and conversions to/from it
Add:
- support for segment types raid6_{ls,rs,la,ra}_6
(striped raid with dedicated last Q-Syndrome SubLVs)
- conversion support from raid5_{ls,rs,la,ra} to/from raid6_{ls,rs,la,ra}_6
- setting convenient segtypes on conversions from/to raid4/5/6
- related tests to lvconvert-raid-takeover.sh factoring
out _lvcreate,_lvconvert funxtions
Related: rhbz1366296
2017-02-05 00:53:36 +01:00
# define segtype_is_raid6_ls_6(segtype) ((segtype)->flags & SEG_RAID6_LS_6 ? 1 : 0)
# define segtype_is_raid6_rs_6(segtype) ((segtype)->flags & SEG_RAID6_RS_6 ? 1 : 0)
# define segtype_is_raid6_la_6(segtype) ((segtype)->flags & SEG_RAID6_LA_6 ? 1 : 0)
# define segtype_is_raid6_ra_6(segtype) ((segtype)->flags & SEG_RAID6_RA_6 ? 1 : 0)
2015-09-24 20:26:33 +01:00
# define segtype_is_raid10(segtype) ((segtype)->flags & SEG_RAID10 ? 1 : 0)
2017-04-12 01:28:22 +02:00
# define segtype_is_raid10_near(segtype) ((segtype)->flags & SEG_RAID10_NEAR ? 1 : 0)
/* FIXME: once raid10_{far,offset} supported */
# define segtype_is_raid10_far(segtype) 0 /* FIXME ((segtype)->flags & SEG_RAID10_FAR ? 1 : 0 */
2017-03-28 15:28:53 +01:00
# define segtype_is_raid10_offset(segtype) 0 /* FIXME ((segtype)->flags & SEG_RAID10_OFFSET ? 1 : 0 */
2017-04-12 01:28:22 +02:00
# define segtype_is_any_raid10(segtype) (segtype_is_raid10(segtype) || segtype_is_raid10_near(segtype) || segtype_is_raid10_far(segtype) || segtype_is_raid10_offset(segtype))
2016-05-23 22:55:13 +01:00
# define segtype_is_raid_with_meta(segtype) (segtype_is_raid(segtype) && !segtype_is_raid0(segtype))
2017-02-24 00:50:00 +01:00
# define segtype_is_striped_raid(segtype) (segtype_is_raid(segtype) && !segtype_is_raid1(segtype))
# define segtype_is_reshapable_raid(segtype) ((segtype_is_striped_raid(segtype) && !segtype_is_any_raid0(segtype)) || segtype_is_raid10_near(segtype) || segtype_is_raid10_offset(segtype))
2015-09-24 20:26:33 +01:00
# define segtype_is_snapshot(segtype) ((segtype)->flags & SEG_SNAPSHOT ? 1 : 0)
2013-12-10 10:45:21 +01:00
# define segtype_is_striped(segtype) ((segtype)->flags & SEG_AREAS_STRIPED ? 1 : 0)
# define segtype_is_thin(segtype) ((segtype)->flags & (SEG_THIN_POOL|SEG_THIN_VOLUME) ? 1 : 0)
# define segtype_is_thin_pool(segtype) ((segtype)->flags & SEG_THIN_POOL ? 1 : 0)
# define segtype_is_thin_volume(segtype) ((segtype)->flags & SEG_THIN_VOLUME ? 1 : 0)
2018-06-29 11:11:14 +02:00
# define segtype_is_vdo(segtype) ((segtype)->flags & SEG_VDO ? 1 : 0)
# define segtype_is_vdo_pool(segtype) ((segtype)->flags & SEG_VDO_POOL ? 1 : 0)
2013-12-10 10:45:21 +01:00
# define segtype_is_virtual(segtype) ((segtype)->flags & SEG_VIRTUAL ? 1 : 0)
2014-10-10 22:22:43 +02:00
# define segtype_is_unknown(segtype) ((segtype)->flags & SEG_UNKNOWN ? 1 : 0)
2013-12-10 10:45:21 +01:00
2016-12-24 23:24:37 +01:00
# define segtype_can_split(segtype) ((segtype)->flags & SEG_CAN_SPLIT ? 1 : 0)
# define segtype_cannot_be_zeroed(segtype) ((segtype)->flags & SEG_CANNOT_BE_ZEROED ? 1 : 0)
# define segtype_monitored(segtype) ((segtype)->flags & SEG_MONITORED ? 1 : 0)
# define segtype_only_exclusive(segtype) ((segtype)->flags & SEG_ONLY_EXCLUSIVE ? 1 : 0)
# define segtype_can_error_when_full(segtype) ((segtype)->flags & SEG_CAN_ERROR_WHEN_FULL ? 1 : 0)
2016-07-30 02:05:50 +01:00
# define segtype_supports_stripe_size(segtype) \
2016-07-30 03:52:49 +01:00
( ( segtype_is_striped ( segtype ) | | segtype_is_mirror ( segtype ) | | \
2016-07-30 04:12:58 +01:00
segtype_is_cache ( segtype ) | | segtype_is_cache_pool ( segtype ) | | \
segtype_is_thin ( segtype ) | | segtype_is_snapshot ( segtype ) | | \
2017-11-27 10:20:24 +01:00
( segtype_is_striped_raid ( segtype ) ) ) ? 1 : 0 )
2016-07-30 02:05:50 +01:00
2016-08-04 01:24:39 +01:00
# define seg_is_striped_target(seg) segtype_is_striped_target((seg)->segtype)
2014-01-27 05:27:16 -06:00
# define seg_is_cache(seg) segtype_is_cache((seg)->segtype)
# define seg_is_cache_pool(seg) segtype_is_cache_pool((seg)->segtype)
2018-08-27 14:53:09 -05:00
# define seg_is_writecache(seg) segtype_is_writecache((seg)->segtype)
2019-11-20 16:07:27 -06:00
# define seg_is_integrity(seg) segtype_is_integrity((seg)->segtype)
2016-09-09 14:24:49 +02:00
# define seg_is_used_cache_pool(seg) (seg_is_cache_pool(seg) && (!dm_list_empty(&(seg->lv)->segs_using_this_lv)))
2013-12-10 10:45:21 +01:00
# define seg_is_linear(seg) (seg_is_striped(seg) && ((seg)->area_count == 1))
2014-09-16 00:13:46 +01:00
# define seg_is_mirror(seg) segtype_is_mirror((seg)->segtype)
2013-12-10 10:45:21 +01:00
# define seg_is_mirrored(seg) segtype_is_mirrored((seg)->segtype)
2014-05-23 14:24:28 +02:00
# define seg_is_pool(seg) segtype_is_pool((seg)->segtype)
2016-05-23 16:46:38 +01:00
# define seg_is_raid0(seg) segtype_is_raid0((seg)->segtype)
2016-07-01 22:20:54 +01:00
# define seg_is_raid0_meta(seg) segtype_is_raid0_meta((seg)->segtype)
2016-05-23 16:46:38 +01:00
# define seg_is_any_raid0(seg) segtype_is_any_raid0((seg)->segtype)
2013-12-10 10:45:21 +01:00
# define seg_is_raid(seg) segtype_is_raid((seg)->segtype)
2015-09-24 14:59:07 +01:00
# define seg_is_raid1(seg) segtype_is_raid1((seg)->segtype)
# define seg_is_raid4(seg) segtype_is_raid4((seg)->segtype)
# define seg_is_any_raid5(seg) segtype_is_any_raid5((seg)->segtype)
2016-08-05 14:00:08 +01:00
# define seg_is_raid5_n(seg) segtype_is_raid5_n((seg)->segtype)
2015-09-24 14:59:07 +01:00
# define seg_is_raid5_la(seg) segtype_is_raid5_la((seg)->segtype)
# define seg_is_raid5_ra(seg) segtype_is_raid5_ra((seg)->segtype)
# define seg_is_raid5_ls(seg) segtype_is_raid5_ls((seg)->segtype)
# define seg_is_raid5_rs(seg) segtype_is_raid5_rs((seg)->segtype)
# define seg_is_any_raid6(seg) segtype_is_any_raid6((seg)->segtype)
# define seg_is_raid6_zr(seg) segtype_is_raid6_zr((seg)->segtype)
# define seg_is_raid6_nr(seg) segtype_is_raid6_nr((seg)->segtype)
# define seg_is_raid6_nc(seg) segtype_is_raid6_nc((seg)->segtype)
2016-08-05 14:00:08 +01:00
# define seg_is_raid6_n_6(seg) segtype_is_raid6_n_6((seg)->segtype)
# define seg_is_any_raid10(seg) segtype_is_any_raid10((seg)->segtype)
2015-09-24 14:59:07 +01:00
# define seg_is_raid10(seg) segtype_is_raid10((seg)->segtype)
2016-08-05 14:00:08 +01:00
# define seg_is_raid10_near(seg) segtype_is_raid10_near((seg)->segtype)
2016-05-23 22:55:13 +01:00
# define seg_is_raid_with_meta(seg) segtype_is_raid_with_meta((seg)->segtype)
2017-02-24 00:50:00 +01:00
# define seg_is_striped_raid(seg) segtype_is_striped_raid((seg)->segtype)
# define seg_is_reshapable_raid(seg) segtype_is_reshapable_raid((seg)->segtype)
2015-09-24 20:26:33 +01:00
# define seg_is_snapshot(seg) segtype_is_snapshot((seg)->segtype)
2013-12-10 10:45:21 +01:00
# define seg_is_striped(seg) segtype_is_striped((seg)->segtype)
# define seg_is_thin(seg) segtype_is_thin((seg)->segtype)
# define seg_is_thin_pool(seg) segtype_is_thin_pool((seg)->segtype)
# define seg_is_thin_volume(seg) segtype_is_thin_volume((seg)->segtype)
2018-06-29 11:11:14 +02:00
# define seg_is_vdo(seg) segtype_is_vdo((seg)->segtype)
# define seg_is_vdo_pool(seg) segtype_is_vdo_pool((seg)->segtype)
2013-12-10 10:45:21 +01:00
# define seg_is_virtual(seg) segtype_is_virtual((seg)->segtype)
2023-07-04 13:14:58 +02:00
# define seg_is_error(seg) segtype_is_error((seg)->segtype)
# define seg_is_zero(seg) segtype_is_zero((seg)->segtype)
2014-10-10 22:22:43 +02:00
# define seg_unknown(seg) segtype_is_unknown((seg)->segtype)
2016-12-24 23:24:37 +01:00
# define seg_can_split(seg) segtype_can_split((seg)->segtype)
# define seg_cannot_be_zeroed(seg) segtype_cannot_be_zeroed((seg)->segtype)
# define seg_monitored(seg) segtype_monitored((seg)->segtype)
# define seg_only_exclusive(seg) segtype_only_exclusive((seg)->segtype)
# define seg_can_error_when_full(seg) segtype_can_error_when_full((seg)->segtype)
2005-05-09 16:59:01 +00:00
2004-05-04 21:25:57 +00:00
struct segment_type {
2009-07-08 12:36:01 +00:00
struct dm_list list ; /* Internal */
2011-08-02 22:07:20 +00:00
2015-09-22 18:03:33 +01:00
uint64_t flags ;
2015-09-24 20:17:57 +01:00
uint32_t parity_devs ; /* Parity drives required by segtype */
2011-08-02 22:07:20 +00:00
2024-05-03 11:59:05 +02:00
const struct segtype_handler * ops ;
2004-05-04 21:25:57 +00:00
const char * name ;
2018-02-09 23:40:37 +01:00
const char * dso ;
2011-08-02 22:07:20 +00:00
2009-07-08 12:36:01 +00:00
void * library ; /* lvm_register_segtype() sets this. */
void * private ; /* For the segtype handler to use. */
2004-05-04 21:25:57 +00:00
} ;
struct segtype_handler {
const char * ( * name ) ( const struct lv_segment * seg ) ;
2011-06-17 14:14:19 +00:00
const char * ( * target_name ) ( const struct lv_segment * seg ,
const struct lv_activate_opts * laopts ) ;
2004-05-04 21:25:57 +00:00
void ( * display ) ( const struct lv_segment * seg ) ;
int ( * text_export ) ( const struct lv_segment * seg ,
struct formatter * f ) ;
2011-08-30 14:55:15 +00:00
int ( * text_import_area_count ) ( const struct dm_config_node * sn ,
2004-05-04 21:25:57 +00:00
uint32_t * area_count ) ;
int ( * text_import ) ( struct lv_segment * seg ,
2011-08-30 14:55:15 +00:00
const struct dm_config_node * sn ,
2005-10-16 23:03:59 +00:00
struct dm_hash_table * pv_hash ) ;
2004-05-04 21:25:57 +00:00
int ( * merge_segments ) ( struct lv_segment * seg1 ,
struct lv_segment * seg2 ) ;
2005-11-08 22:52:26 +00:00
int ( * add_target_line ) ( struct dev_manager * dm , struct dm_pool * mem ,
2011-06-17 14:14:19 +00:00
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 ) ;
2010-01-15 16:35:26 +00:00
int ( * target_status_compatible ) ( const char * type ) ;
2015-11-30 21:24:31 +01:00
int ( * check_transient_status ) ( struct dm_pool * mem ,
struct lv_segment * seg , char * params ) ;
2009-10-01 00:35:29 +00:00
int ( * target_percent ) ( void * * target_state ,
2014-06-09 12:08:27 +02:00
dm_percent_t * percent ,
2009-10-01 00:35:29 +00:00
struct dm_pool * mem ,
2006-05-16 20:53:13 +00:00
struct cmd_context * cmd ,
2006-05-16 16:48:31 +00:00
struct lv_segment * seg , char * params ,
2004-05-04 21:25:57 +00:00
uint64_t * total_numerator ,
2008-07-15 00:25:52 +00:00
uint64_t * total_denominator ) ;
2009-02-28 20:04:24 +00:00
int ( * target_present ) ( struct cmd_context * cmd ,
const struct lv_segment * seg ,
2008-04-07 10:23:47 +00:00
unsigned * attributes ) ;
2006-10-03 17:55:20 +00:00
int ( * modules_needed ) ( struct dm_pool * mem ,
const struct lv_segment * seg ,
2008-11-03 22:14:30 +00:00
struct dm_list * modules ) ;
2010-12-20 13:32:49 +00:00
void ( * destroy ) ( struct segment_type * segtype ) ;
2018-01-29 16:28:57 +01:00
int ( * target_monitored ) ( struct lv_segment * seg , int * pending , int * monitored ) ;
2007-01-24 16:51:24 +00:00
int ( * target_monitor_events ) ( struct lv_segment * seg , int events ) ;
int ( * target_unmonitor_events ) ( struct lv_segment * seg , int events ) ;
2004-05-04 21:25:57 +00:00
} ;
struct segment_type * get_segtype_from_string ( struct cmd_context * cmd ,
const char * str ) ;
2016-06-28 23:44:15 +01:00
struct segment_type * get_segtype_from_flag ( struct cmd_context * cmd ,
uint64_t flag ) ;
2004-05-04 21:25:57 +00:00
2009-07-08 12:36:01 +00:00
struct segtype_library ;
int lvm_register_segtype ( struct segtype_library * seglib ,
struct segment_type * segtype ) ;
2018-05-30 12:44:24 +02:00
struct segment_type * init_linear_segtype ( struct cmd_context * cmd ) ;
2004-05-04 21:25:57 +00:00
struct segment_type * init_striped_segtype ( struct cmd_context * cmd ) ;
2004-05-11 16:01:58 +00:00
struct segment_type * init_zero_segtype ( struct cmd_context * cmd ) ;
struct segment_type * init_error_segtype ( struct cmd_context * cmd ) ;
2008-06-25 16:52:27 +00:00
struct segment_type * init_free_segtype ( struct cmd_context * cmd ) ;
2011-08-02 22:07:20 +00:00
struct segment_type * init_unknown_segtype ( struct cmd_context * cmd ,
const char * name ) ;
2014-02-27 14:46:11 +01:00
# define RAID_FEATURE_RAID10 (1U << 0) /* version 1.3 */
2015-09-24 19:52:22 +01:00
# define RAID_FEATURE_RAID0 (1U << 1) /* version 1.7 */
# define RAID_FEATURE_RESHAPING (1U << 2) /* version 1.8 */
2016-10-27 11:38:16 +02:00
# define RAID_FEATURE_RAID4 (1U << 3) /* ! version 1.8 or 1.9.0 */
2017-03-17 16:46:33 +01:00
# define RAID_FEATURE_SHRINK (1U << 4) /* version 1.9.0 */
# define RAID_FEATURE_RESHAPE (1U << 5) /* version 1.10.1 */
2017-06-14 08:33:42 -05:00
/*
* RAID_FEATURE_NEW_DEVICES_ACCEPT_REBUILD
* This signifies a behavioral change in dm - raid . Prior to upstream kernel
* commit 33e53 f068 , the kernel would refuse to allow ' rebuild ' CTR args to
* be submitted when other devices in the array had uninitialized superblocks .
* After the commit , these parameters were allowed .
*
* The most obvious useful case of this new behavior is up - converting a
* linear device to RAID1 . A new superblock is allocated for the linear dev
* and it will be uninitialized , while all the new images are specified for
* ' rebuild ' . This valid scenario would not have been allowed prior to
* commit 33e53 f068 .
*
* Commit 33e53 f068 did not bump the dm - raid version number . So it exists
* in some , but not all 1.8 .1 versions of dm - raid . The only way to be
* certain the new behavior exists is to check for version 1.9 .0 .
*/
# define RAID_FEATURE_NEW_DEVICES_ACCEPT_REBUILD (1U << 6) /* version 1.9.0 */
2014-02-27 14:46:11 +01:00
2021-09-24 17:36:29 +02:00
bool raid_is_available ( const struct logical_volume * lv ) ;
2011-08-02 22:07:20 +00:00
# ifdef RAID_INTERNAL
2011-08-24 13:41:46 +00:00
int init_raid_segtypes ( struct cmd_context * cmd , struct segtype_library * seglib ) ;
2011-08-02 22:07:20 +00:00
# endif
2004-05-04 21:25:57 +00:00
2014-02-27 14:46:11 +01:00
# define THIN_FEATURE_DISCARDS (1U << 0)
# define THIN_FEATURE_EXTERNAL_ORIGIN (1U << 1)
# define THIN_FEATURE_HELD_ROOT (1U << 2)
# define THIN_FEATURE_BLOCK_SIZE (1U << 3)
# define THIN_FEATURE_DISCARDS_NON_POWER_2 (1U << 4)
# define THIN_FEATURE_METADATA_RESIZE (1U << 5)
# define THIN_FEATURE_EXTERNAL_ORIGIN_EXTEND (1U << 6)
2015-01-13 15:23:03 +01:00
# define THIN_FEATURE_ERROR_IF_NO_SPACE (1U << 7)
2014-02-27 14:46:11 +01:00
2011-08-25 10:00:09 +00:00
# ifdef THIN_INTERNAL
int init_thin_segtypes ( struct cmd_context * cmd , struct segtype_library * seglib ) ;
# endif
2014-01-27 05:27:16 -06:00
# ifdef CACHE_INTERNAL
int init_cache_segtypes ( struct cmd_context * cmd , struct segtype_library * seglib ) ;
# endif
2018-06-29 11:11:14 +02:00
# ifdef VDO_INTERNAL
int init_vdo_segtypes ( struct cmd_context * cmd , struct segtype_library * seglib ) ;
# endif
2021-01-21 21:18:05 +01:00
# define VDO_FEATURE_ONLINE_RENAME (1U << 0) /* version 6.2.3 */
2022-07-08 23:35:06 +02:00
# define VDO_FEATURE_VERSION4 (1U << 1) /* version 8.2.0 */
2021-01-21 21:18:05 +01:00
2018-08-27 14:53:09 -05:00
int init_writecache_segtypes ( struct cmd_context * cmd , struct segtype_library * seglib ) ;
2019-11-20 16:07:27 -06:00
int init_integrity_segtypes ( struct cmd_context * cmd , struct segtype_library * seglib ) ;
2015-07-23 11:32:09 +02:00
# define CACHE_FEATURE_POLICY_MQ (1U << 0)
# define CACHE_FEATURE_POLICY_SMQ (1U << 1)
2017-02-26 20:19:07 +01:00
# define CACHE_FEATURE_METADATA2 (1U << 2)
2015-07-23 11:32:09 +02:00
2014-02-27 14:46:11 +01:00
# define SNAPSHOT_FEATURE_FIXED_LEAK (1U << 0) /* version 1.12 */
2004-05-04 21:25:57 +00:00
# ifdef SNAPSHOT_INTERNAL
struct segment_type * init_snapshot_segtype ( struct cmd_context * cmd ) ;
# endif
2014-02-27 14:46:11 +01:00
# define MIRROR_LOG_CLUSTERED (1U << 0)
2004-05-04 21:25:57 +00:00
# ifdef MIRRORED_INTERNAL
struct segment_type * init_mirrored_segtype ( struct cmd_context * cmd ) ;
# endif
2004-09-16 18:40:56 +00:00
# ifdef CRYPT_INTERNAL
struct segment_type * init_crypt_segtype ( struct cmd_context * cmd ) ;
# endif
2004-05-04 21:25:57 +00:00
# endif