xref: /netbsd-src/external/gpl2/lvm2/dist/include/lv_alloc.h (revision bec4d750d436214708904d6a2c66f8d979761c4b)
1*bec4d750Shaad /*	$NetBSD: lv_alloc.h,v 1.1.1.2 2009/02/18 11:16:47 haad Exp $	*/
256a34939Shaad 
356a34939Shaad /*
456a34939Shaad  * Copyright (C) 2003-2004 Sistina Software, Inc. All rights reserved.
556a34939Shaad  * Copyright (C) 2004-2006 Red Hat, Inc. All rights reserved.
656a34939Shaad  *
756a34939Shaad  * This file is part of LVM2.
856a34939Shaad  *
956a34939Shaad  * This copyrighted material is made available to anyone wishing to use,
1056a34939Shaad  * modify, copy, or redistribute it subject to the terms and conditions
1156a34939Shaad  * of the GNU Lesser General Public License v.2.1.
1256a34939Shaad  *
1356a34939Shaad  * You should have received a copy of the GNU Lesser General Public License
1456a34939Shaad  * along with this program; if not, write to the Free Software Foundation,
1556a34939Shaad  * Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
1656a34939Shaad  */
1756a34939Shaad 
1856a34939Shaad #ifndef _LVM_LV_ALLOC_H
1956a34939Shaad 
2056a34939Shaad struct lv_segment *alloc_lv_segment(struct dm_pool *mem,
2156a34939Shaad 				    const struct segment_type *segtype,
2256a34939Shaad 				    struct logical_volume *lv,
2356a34939Shaad 				    uint32_t le, uint32_t len,
2456a34939Shaad 				    uint32_t status,
2556a34939Shaad 				    uint32_t stripe_size,
2656a34939Shaad 				    struct logical_volume *log_lv,
2756a34939Shaad 				    uint32_t area_count,
2856a34939Shaad 				    uint32_t area_len,
2956a34939Shaad 				    uint32_t chunk_size,
3056a34939Shaad 				    uint32_t region_size,
3156a34939Shaad 				    uint32_t extents_copied);
3256a34939Shaad 
3356a34939Shaad struct lv_segment *alloc_snapshot_seg(struct logical_volume *lv,
3456a34939Shaad 				      uint32_t status, uint32_t old_le_count);
3556a34939Shaad 
3656a34939Shaad int set_lv_segment_area_pv(struct lv_segment *seg, uint32_t area_num,
3756a34939Shaad 			   struct physical_volume *pv, uint32_t pe);
3856a34939Shaad int set_lv_segment_area_lv(struct lv_segment *seg, uint32_t area_num,
3956a34939Shaad 			   struct logical_volume *lv, uint32_t le,
4056a34939Shaad 			   uint32_t flags);
4156a34939Shaad int move_lv_segment_area(struct lv_segment *seg_to, uint32_t area_to,
4256a34939Shaad 			 struct lv_segment *seg_from, uint32_t area_from);
4356a34939Shaad void release_lv_segment_area(struct lv_segment *seg, uint32_t s,
4456a34939Shaad 			     uint32_t area_reduction);
4556a34939Shaad 
4656a34939Shaad struct alloc_handle;
4756a34939Shaad struct alloc_handle *allocate_extents(struct volume_group *vg,
4856a34939Shaad 				      struct logical_volume *lv,
4956a34939Shaad                                       const struct segment_type *segtype,
5056a34939Shaad                                       uint32_t stripes,
5156a34939Shaad                                       uint32_t mirrors, uint32_t log_count,
52*bec4d750Shaad 				      uint32_t log_region_size, uint32_t extents,
5356a34939Shaad                                       struct dm_list *allocatable_pvs,
5456a34939Shaad 				      alloc_policy_t alloc,
5556a34939Shaad 				      struct dm_list *parallel_areas);
5656a34939Shaad 
5756a34939Shaad int lv_add_segment(struct alloc_handle *ah,
5856a34939Shaad 		   uint32_t first_area, uint32_t num_areas,
5956a34939Shaad 		   struct logical_volume *lv,
6056a34939Shaad                    const struct segment_type *segtype,
6156a34939Shaad                    uint32_t stripe_size,
6256a34939Shaad                    uint32_t status,
6356a34939Shaad 		   uint32_t region_size,
6456a34939Shaad                    struct logical_volume *log_lv);
6556a34939Shaad 
6656a34939Shaad int lv_add_mirror_areas(struct alloc_handle *ah,
6756a34939Shaad 			struct logical_volume *lv, uint32_t le,
6856a34939Shaad 			uint32_t region_size);
6956a34939Shaad int lv_add_mirror_lvs(struct logical_volume *lv,
7056a34939Shaad 		      struct logical_volume **sub_lvs,
7156a34939Shaad 		      uint32_t num_extra_areas,
7256a34939Shaad 		      uint32_t status, uint32_t region_size);
7356a34939Shaad 
7456a34939Shaad int lv_add_log_segment(struct alloc_handle *ah, struct logical_volume *log_lv);
7556a34939Shaad int lv_add_virtual_segment(struct logical_volume *lv, uint32_t status,
7656a34939Shaad                            uint32_t extents, const struct segment_type *segtype);
7756a34939Shaad 
7856a34939Shaad void alloc_destroy(struct alloc_handle *ah);
7956a34939Shaad 
8056a34939Shaad struct dm_list *build_parallel_areas_from_lv(struct cmd_context *cmd,
8156a34939Shaad 					  struct logical_volume *lv);
8256a34939Shaad 
8356a34939Shaad #endif
84