- Stephen Rothwell: APM updates
[davej-history.git] / include / linux / lvm.h
blob2600a75a17a4490bdc10a0ee7c4207d44f21d0ad
1 /*
2 * kernel/lvm.h
4 * Copyright (C) 1997 - 2000 Heinz Mauelshagen, Germany
6 * February-November 1997
7 * May-July 1998
8 * January-March,July,September,October,Dezember 1999
9 * January 2000
11 * lvm is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2, or (at your option)
14 * any later version.
16 * lvm is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with GNU CC; see the file COPYING. If not, write to
23 * the Free Software Foundation, 59 Temple Place - Suite 330,
24 * Boston, MA 02111-1307, USA.
29 * Changelog
31 * 10/10/1997 - beginning of new structure creation
32 * 12/05/1998 - incorporated structures from lvm_v1.h and deleted lvm_v1.h
33 * 07/06/1998 - avoided LVM_KMALLOC_MAX define by using vmalloc/vfree
34 * instead of kmalloc/kfree
35 * 01/07/1998 - fixed wrong LVM_MAX_SIZE
36 * 07/07/1998 - extended pe_t structure by ios member (for statistic)
37 * 02/08/1998 - changes for official char/block major numbers
38 * 07/08/1998 - avoided init_module() and cleanup_module() to be static
39 * 29/08/1998 - seprated core and disk structure type definitions
40 * 01/09/1998 - merged kernel integration version (mike)
41 * 20/01/1999 - added LVM_PE_DISK_OFFSET macro for use in
42 * vg_read_with_pv_and_lv(), pv_move_pe(), pv_show_pe_text()...
43 * 18/02/1999 - added definition of time_disk_t structure for;
44 * keeps time stamps on disk for nonatomic writes (future)
45 * 15/03/1999 - corrected LV() and VG() macro definition to use argument
46 * instead of minor
47 * 03/07/1999 - define for genhd.c name handling
48 * 23/07/1999 - implemented snapshot part
49 * 08/12/1999 - changed LVM_LV_SIZE_MAX macro to reflect current 1TB limit
50 * 01/01/2000 - extended lv_v2 core structure by wait_queue member
51 * 12/02/2000 - integrated Andrea Arcagnelli's snapshot work
56 #ifndef _LVM_H_INCLUDE
57 #define _LVM_H_INCLUDE
59 #define _LVM_H_VERSION "LVM 0.8final (15/2/2000)"
62 * preprocessor definitions
64 /* if you like emergency reset code in the driver */
65 #define LVM_TOTAL_RESET
67 #define LVM_GET_INODE
68 #undef LVM_HD_NAME
70 /* lots of debugging output (see driver source)
71 #define DEBUG_LVM_GET_INFO
72 #define DEBUG
73 #define DEBUG_MAP
74 #define DEBUG_MAP_SIZE
75 #define DEBUG_IOCTL
76 #define DEBUG_READ
77 #define DEBUG_GENDISK
78 #define DEBUG_VG_CREATE
79 #define DEBUG_LVM_BLK_OPEN
80 #define DEBUG_KFREE
83 #include <linux/version.h>
85 #ifndef __KERNEL__
86 #define ____NOT_KERNEL____
87 #define __KERNEL__
88 #endif
89 #include <linux/kdev_t.h>
90 #ifdef ____NOT_KERNEL____
91 #undef ____NOT_KERNEL____
92 #undef __KERNEL__
93 #endif
95 #include <linux/major.h>
97 #if LINUX_VERSION_CODE >= KERNEL_VERSION ( 2, 3 ,0)
98 #include <linux/spinlock.h>
99 #else
100 #include <asm/spinlock.h>
101 #endif
103 #include <asm/semaphore.h>
104 #include <asm/page.h>
106 #if !defined ( LVM_BLK_MAJOR) || !defined ( LVM_CHAR_MAJOR)
107 #error Bad include/linux/major.h - LVM MAJOR undefined
108 #endif
111 #define LVM_STRUCT_VERSION 1 /* structure version */
113 #ifndef min
114 #define min(a,b) (((a)<(b))?(a):(b))
115 #endif
116 #ifndef max
117 #define max(a,b) (((a)>(b))?(a):(b))
118 #endif
120 /* set the default structure version */
121 #if ( LVM_STRUCT_VERSION == 1)
122 #define pv_t pv_v1_t
123 #define lv_t lv_v2_t
124 #define vg_t vg_v1_t
125 #define pv_disk_t pv_disk_v1_t
126 #define lv_disk_t lv_disk_v1_t
127 #define vg_disk_t vg_disk_v1_t
128 #define lv_exception_t lv_v2_exception_t
129 #endif
133 * i/o protocoll version
135 * defined here for the driver and defined seperate in the
136 * user land LVM parts
139 #define LVM_DRIVER_IOP_VERSION 6
141 #define LVM_NAME "lvm"
144 * VG/LV indexing macros
146 /* character minor maps directly to volume group */
147 #define VG_CHR(a) ( a)
149 /* block minor indexes into a volume group/logical volume indirection table */
150 #define VG_BLK(a) ( vg_lv_map[a].vg_number)
151 #define LV_BLK(a) ( vg_lv_map[a].lv_number)
154 * absolute limits for VGs, PVs per VG and LVs per VG
156 #define ABS_MAX_VG 99
157 #define ABS_MAX_PV 256
158 #define ABS_MAX_LV 256 /* caused by 8 bit minor */
160 #define MAX_VG ABS_MAX_VG
161 #define MAX_LV ABS_MAX_LV
162 #define MAX_PV ABS_MAX_PV
164 #if ( MAX_VG > ABS_MAX_VG)
165 #undef MAX_VG
166 #define MAX_VG ABS_MAX_VG
167 #endif
169 #if ( MAX_LV > ABS_MAX_LV)
170 #undef MAX_LV
171 #define MAX_LV ABS_MAX_LV
172 #endif
176 * VGDA: default disk spaces and offsets
178 * there's space after the structures for later extensions.
180 * offset what size
181 * --------------- ---------------------------------- ------------
182 * 0 physical volume structure ~500 byte
184 * 1K volume group structure ~200 byte
186 * 5K time stamp structure ~
188 * 6K namelist of physical volumes 128 byte each
190 * 6k + n * 128byte n logical volume structures ~300 byte each
192 * + m * 328byte m physical extent alloc. structs 4 byte each
194 * End of disk - first physical extent typical 4 megabyte
195 * PE total *
196 * PE size
201 /* DONT TOUCH THESE !!! */
202 /* base of PV structure in disk partition */
203 #define LVM_PV_DISK_BASE 0L
205 /* size reserved for PV structure on disk */
206 #define LVM_PV_DISK_SIZE 1024L
208 /* base of VG structure in disk partition */
209 #define LVM_VG_DISK_BASE LVM_PV_DISK_SIZE
211 /* size reserved for VG structure */
212 #define LVM_VG_DISK_SIZE ( 9 * 512L)
214 /* size reserved for timekeeping */
215 #define LVM_TIMESTAMP_DISK_BASE ( LVM_VG_DISK_BASE + LVM_VG_DISK_SIZE)
216 #define LVM_TIMESTAMP_DISK_SIZE 512L /* reserved for timekeeping */
218 /* name list of physical volumes on disk */
219 #define LVM_PV_NAMELIST_DISK_BASE ( LVM_TIMESTAMP_DISK_BASE + \
220 LVM_TIMESTAMP_DISK_SIZE)
222 /* now for the dynamically calculated parts of the VGDA */
223 #define LVM_LV_DISK_OFFSET(a, b) ( (a)->lv_on_disk.base + sizeof ( lv_t) * b)
224 #define LVM_DISK_SIZE(pv) ( (pv)->pe_on_disk.base + \
225 (pv)->pe_on_disk.size)
226 #define LVM_PE_DISK_OFFSET(pe, pv) ( pe * pv->pe_size + \
227 ( LVM_DISK_SIZE ( pv) / SECTOR_SIZE))
228 #define LVM_PE_ON_DISK_BASE(pv) \
229 { int rest; \
230 pv->pe_on_disk.base = pv->lv_on_disk.base + pv->lv_on_disk.size; \
231 if ( ( rest = pv->pe_on_disk.base % SECTOR_SIZE) != 0) \
232 pv->pe_on_disk.base += ( SECTOR_SIZE - rest); \
234 /* END default disk spaces and offsets for PVs */
238 * LVM_PE_T_MAX corresponds to:
240 * 8KB PE size can map a ~512 MB logical volume at the cost of 1MB memory,
242 * 128MB PE size can map a 8TB logical volume at the same cost of memory.
244 * Default PE size of 4 MB gives a maximum logical volume size of 256 GB.
246 * Maximum PE size of 16GB gives a maximum logical volume size of 1024 TB.
248 * AFAIK, the actual kernels limit this to 1 TB.
250 * Should be a sufficient spectrum ;*)
253 /* This is the usable size of disk_pe_t.le_num !!! v v */
254 #define LVM_PE_T_MAX ( ( 1 << ( sizeof ( uint16_t) * 8)) - 2)
256 #define LVM_LV_SIZE_MAX(a) ( ( long long) LVM_PE_T_MAX * (a)->pe_size > ( long long) 2*1024*1024*1024 ? ( long long) 2*1024*1024*1024 : ( long long) LVM_PE_T_MAX * (a)->pe_size)
257 #define LVM_MIN_PE_SIZE ( 8L * 2) /* 8 KB in sectors */
258 #define LVM_MAX_PE_SIZE ( 16L * 1024L * 1024L * 2) /* 16GB in sectors */
259 #define LVM_DEFAULT_PE_SIZE ( 4096L * 2) /* 4 MB in sectors */
260 #define LVM_DEFAULT_STRIPE_SIZE 16L /* 16 KB */
261 #define LVM_MIN_STRIPE_SIZE ( PAGE_SIZE>>9) /* PAGESIZE in sectors */
262 #define LVM_MAX_STRIPE_SIZE ( 512L * 2) /* 512 KB in sectors */
263 #define LVM_MAX_STRIPES 128 /* max # of stripes */
264 #define LVM_MAX_SIZE ( 1024LU * 1024 * 1024 * 2) /* 1TB[sectors] */
265 #define LVM_MAX_MIRRORS 2 /* future use */
266 #define LVM_MIN_READ_AHEAD 0 /* minimum read ahead sectors */
267 #define LVM_MAX_READ_AHEAD 256 /* maximum read ahead sectors */
268 #define LVM_MAX_LV_IO_TIMEOUT 60 /* seconds I/O timeout (future use) */
269 #define LVM_PARTITION 0xfe /* LVM partition id */
270 #define LVM_NEW_PARTITION 0x8e /* new LVM partition id (10/09/1999) */
271 #define LVM_PE_SIZE_PV_SIZE_REL 5 /* max relation PV size and PE size */
273 #define LVM_SNAPSHOT_MAX_CHUNK 1024 /* 1024 KB */
274 #define LVM_SNAPSHOT_DEF_CHUNK 64 /* 64 KB */
275 #define LVM_SNAPSHOT_MIN_CHUNK 1 /* 1 KB */
277 #define UNDEF -1
278 #define FALSE 0
279 #define TRUE 1
283 * ioctls
285 /* volume group */
286 #define VG_CREATE _IOW ( 0xfe, 0x00, 1)
287 #define VG_REMOVE _IOW ( 0xfe, 0x01, 1)
289 #define VG_EXTEND _IOW ( 0xfe, 0x03, 1)
290 #define VG_REDUCE _IOW ( 0xfe, 0x04, 1)
292 #define VG_STATUS _IOWR ( 0xfe, 0x05, 1)
293 #define VG_STATUS_GET_COUNT _IOWR ( 0xfe, 0x06, 1)
294 #define VG_STATUS_GET_NAMELIST _IOWR ( 0xfe, 0x07, 1)
296 #define VG_SET_EXTENDABLE _IOW ( 0xfe, 0x08, 1)
299 /* logical volume */
300 #define LV_CREATE _IOW ( 0xfe, 0x20, 1)
301 #define LV_REMOVE _IOW ( 0xfe, 0x21, 1)
303 #define LV_ACTIVATE _IO ( 0xfe, 0x22)
304 #define LV_DEACTIVATE _IO ( 0xfe, 0x23)
306 #define LV_EXTEND _IOW ( 0xfe, 0x24, 1)
307 #define LV_REDUCE _IOW ( 0xfe, 0x25, 1)
309 #define LV_STATUS_BYNAME _IOWR ( 0xfe, 0x26, 1)
310 #define LV_STATUS_BYINDEX _IOWR ( 0xfe, 0x27, 1)
312 #define LV_SET_ACCESS _IOW ( 0xfe, 0x28, 1)
313 #define LV_SET_ALLOCATION _IOW ( 0xfe, 0x29, 1)
314 #define LV_SET_STATUS _IOW ( 0xfe, 0x2a, 1)
316 #define LE_REMAP _IOW ( 0xfe, 0x2b, 1)
319 /* physical volume */
320 #define PV_STATUS _IOWR ( 0xfe, 0x40, 1)
321 #define PV_CHANGE _IOWR ( 0xfe, 0x41, 1)
322 #define PV_FLUSH _IOW ( 0xfe, 0x42, 1)
324 /* physical extent */
325 #define PE_LOCK_UNLOCK _IOW ( 0xfe, 0x50, 1)
327 /* i/o protocol version */
328 #define LVM_GET_IOP_VERSION _IOR ( 0xfe, 0x98, 1)
330 #ifdef LVM_TOTAL_RESET
331 /* special reset function for testing purposes */
332 #define LVM_RESET _IO ( 0xfe, 0x99)
333 #endif
335 /* lock the logical volume manager */
336 #define LVM_LOCK_LVM _IO ( 0xfe, 0x100)
337 /* END ioctls */
341 * Status flags
343 /* volume group */
344 #define VG_ACTIVE 0x01 /* vg_status */
345 #define VG_EXPORTED 0x02 /* " */
346 #define VG_EXTENDABLE 0x04 /* " */
348 #define VG_READ 0x01 /* vg_access */
349 #define VG_WRITE 0x02 /* " */
351 /* logical volume */
352 #define LV_ACTIVE 0x01 /* lv_status */
353 #define LV_SPINDOWN 0x02 /* " */
355 #define LV_READ 0x01 /* lv_access */
356 #define LV_WRITE 0x02 /* " */
357 #define LV_SNAPSHOT 0x04 /* " */
358 #define LV_SNAPSHOT_ORG 0x08 /* " */
360 #define LV_BADBLOCK_ON 0x01 /* lv_badblock */
362 #define LV_STRICT 0x01 /* lv_allocation */
363 #define LV_CONTIGUOUS 0x02 /* " */
365 /* physical volume */
366 #define PV_ACTIVE 0x01 /* pv_status */
367 #define PV_ALLOCATABLE 0x02 /* pv_allocatable */
371 * Structure definitions core/disk follow
373 * conditional conversion takes place on big endian architectures
374 * in functions * pv_copy_*(), vg_copy_*() and lv_copy_*()
378 #define NAME_LEN 128 /* don't change!!! */
379 #define UUID_LEN 16 /* don't change!!! */
381 /* remap physical sector/rdev pairs */
382 typedef struct
384 struct list_head hash;
385 ulong rsector_org;
386 kdev_t rdev_org;
387 ulong rsector_new;
388 kdev_t rdev_new;
389 } lv_block_exception_t;
392 /* disk stored pe information */
393 typedef struct
395 uint16_t lv_num;
396 uint16_t le_num;
398 disk_pe_t;
400 /* disk stored PV, VG, LV and PE size and offset information */
401 typedef struct
403 uint32_t base;
404 uint32_t size;
406 lvm_disk_data_t;
410 * Structure Physical Volume (PV) Version 1
413 /* core */
414 typedef struct
416 uint8_t id[2]; /* Identifier */
417 uint16_t version; /* HM lvm version */
418 lvm_disk_data_t pv_on_disk;
419 lvm_disk_data_t vg_on_disk;
420 lvm_disk_data_t pv_namelist_on_disk;
421 lvm_disk_data_t lv_on_disk;
422 lvm_disk_data_t pe_on_disk;
423 uint8_t pv_name[NAME_LEN];
424 uint8_t vg_name[NAME_LEN];
425 uint8_t system_id[NAME_LEN]; /* for vgexport/vgimport */
426 kdev_t pv_dev;
427 uint32_t pv_number;
428 uint32_t pv_status;
429 uint32_t pv_allocatable;
430 uint32_t pv_size; /* HM */
431 uint32_t lv_cur;
432 uint32_t pe_size;
433 uint32_t pe_total;
434 uint32_t pe_allocated;
435 uint32_t pe_stale; /* for future use */
437 disk_pe_t *pe; /* HM */
438 struct inode *inode; /* HM */
440 pv_v1_t;
442 /* disk */
443 typedef struct
445 uint8_t id[2]; /* Identifier */
446 uint16_t version; /* HM lvm version */
447 lvm_disk_data_t pv_on_disk;
448 lvm_disk_data_t vg_on_disk;
449 lvm_disk_data_t pv_namelist_on_disk;
450 lvm_disk_data_t lv_on_disk;
451 lvm_disk_data_t pe_on_disk;
452 uint8_t pv_name[NAME_LEN];
453 uint8_t vg_name[NAME_LEN];
454 uint8_t system_id[NAME_LEN]; /* for vgexport/vgimport */
455 uint32_t pv_major;
456 uint32_t pv_number;
457 uint32_t pv_status;
458 uint32_t pv_allocatable;
459 uint32_t pv_size; /* HM */
460 uint32_t lv_cur;
461 uint32_t pe_size;
462 uint32_t pe_total;
463 uint32_t pe_allocated;
465 pv_disk_v1_t;
469 * Structure Physical Volume (PV) Version 2 (future!)
472 typedef struct
474 uint8_t id[2]; /* Identifier */
475 uint16_t version; /* HM lvm version */
476 lvm_disk_data_t pv_on_disk;
477 lvm_disk_data_t vg_on_disk;
478 lvm_disk_data_t pv_uuid_on_disk;
479 lvm_disk_data_t lv_on_disk;
480 lvm_disk_data_t pe_on_disk;
481 uint8_t pv_name[NAME_LEN];
482 uint8_t vg_name[NAME_LEN];
483 uint8_t system_id[NAME_LEN]; /* for vgexport/vgimport */
484 kdev_t pv_dev;
485 uint32_t pv_number;
486 uint32_t pv_status;
487 uint32_t pv_allocatable;
488 uint32_t pv_size; /* HM */
489 uint32_t lv_cur;
490 uint32_t pe_size;
491 uint32_t pe_total;
492 uint32_t pe_allocated;
493 uint32_t pe_stale; /* for future use */
494 disk_pe_t *pe; /* HM */
495 struct inode *inode; /* HM */
496 /* delta to version 1 starts here */
497 uint8_t pv_uuid[UUID_LEN];
498 uint32_t pv_atime; /* PV access time */
499 uint32_t pv_ctime; /* PV creation time */
500 uint32_t pv_mtime; /* PV modification time */
502 pv_v2_t;
506 * Structures for Logical Volume (LV)
509 /* core PE information */
510 typedef struct
512 kdev_t dev;
513 uint32_t pe; /* to be changed if > 2TB */
514 uint32_t reads;
515 uint32_t writes;
517 pe_t;
519 typedef struct
521 uint8_t lv_name[NAME_LEN];
522 kdev_t old_dev;
523 kdev_t new_dev;
524 ulong old_pe;
525 ulong new_pe;
527 le_remap_req_t;
532 * Structure Logical Volume (LV) Version 1
535 /* disk */
536 typedef struct
538 uint8_t lv_name[NAME_LEN];
539 uint8_t vg_name[NAME_LEN];
540 uint32_t lv_access;
541 uint32_t lv_status;
542 uint32_t lv_open; /* HM */
543 uint32_t lv_dev; /* HM */
544 uint32_t lv_number; /* HM */
545 uint32_t lv_mirror_copies; /* for future use */
546 uint32_t lv_recovery; /* " */
547 uint32_t lv_schedule; /* " */
548 uint32_t lv_size;
549 uint32_t dummy;
550 uint32_t lv_current_le; /* for future use */
551 uint32_t lv_allocated_le;
552 uint32_t lv_stripes;
553 uint32_t lv_stripesize;
554 uint32_t lv_badblock; /* for future use */
555 uint32_t lv_allocation;
556 uint32_t lv_io_timeout; /* for future use */
557 uint32_t lv_read_ahead; /* HM, for future use */
559 lv_disk_v1_t;
563 * Structure Logical Volume (LV) Version 2
566 /* core */
567 typedef struct lv_v2
569 uint8_t lv_name[NAME_LEN];
570 uint8_t vg_name[NAME_LEN];
571 uint32_t lv_access;
572 uint32_t lv_status;
573 uint32_t lv_open; /* HM */
574 kdev_t lv_dev; /* HM */
575 uint32_t lv_number; /* HM */
576 uint32_t lv_mirror_copies; /* for future use */
577 uint32_t lv_recovery; /* " */
578 uint32_t lv_schedule; /* " */
579 uint32_t lv_size;
580 pe_t *lv_current_pe; /* HM */
581 uint32_t lv_current_le; /* for future use */
582 uint32_t lv_allocated_le;
583 uint32_t lv_stripes;
584 uint32_t lv_stripesize;
585 uint32_t lv_badblock; /* for future use */
586 uint32_t lv_allocation;
587 uint32_t lv_io_timeout; /* for future use */
588 uint32_t lv_read_ahead;
590 /* delta to version 1 starts here */
591 struct lv_v2 *lv_snapshot_org;
592 struct lv_v2 *lv_snapshot_prev;
593 struct lv_v2 *lv_snapshot_next;
594 lv_block_exception_t *lv_block_exception;
595 uint8_t __unused;
596 uint32_t lv_remap_ptr;
597 uint32_t lv_remap_end;
598 uint32_t lv_chunk_size;
599 uint32_t lv_snapshot_minor;
600 struct kiobuf * lv_iobuf;
601 struct semaphore lv_snapshot_sem;
602 struct list_head * lv_snapshot_hash_table;
603 unsigned long lv_snapshot_hash_mask;
604 } lv_v2_t;
606 /* disk */
607 typedef struct
609 uint8_t lv_name[NAME_LEN];
610 uint8_t vg_name[NAME_LEN];
611 uint32_t lv_access;
612 uint32_t lv_status;
613 uint32_t lv_open; /* HM */
614 uint32_t lv_dev; /* HM */
615 uint32_t lv_number; /* HM */
616 uint32_t lv_mirror_copies; /* for future use */
617 uint32_t lv_recovery; /* " */
618 uint32_t lv_schedule; /* " */
619 uint32_t lv_size;
620 uint32_t dummy;
621 uint32_t lv_current_le; /* for future use */
622 uint32_t lv_allocated_le;
623 uint32_t lv_stripes;
624 uint32_t lv_stripesize;
625 uint32_t lv_badblock; /* for future use */
626 uint32_t lv_allocation;
627 uint32_t lv_io_timeout; /* for future use */
628 uint32_t lv_read_ahead; /* HM, for future use */
630 lv_disk_v2_t;
634 * Structure Volume Group (VG) Version 1
637 typedef struct
639 uint8_t vg_name[NAME_LEN]; /* volume group name */
640 uint32_t vg_number; /* volume group number */
641 uint32_t vg_access; /* read/write */
642 uint32_t vg_status; /* active or not */
643 uint32_t lv_max; /* maximum logical volumes */
644 uint32_t lv_cur; /* current logical volumes */
645 uint32_t lv_open; /* open logical volumes */
646 uint32_t pv_max; /* maximum physical volumes */
647 uint32_t pv_cur; /* current physical volumes FU */
648 uint32_t pv_act; /* active physical volumes */
649 uint32_t dummy; /* was obsolete max_pe_per_pv */
650 uint32_t vgda; /* volume group descriptor arrays FU */
651 uint32_t pe_size; /* physical extent size in sectors */
652 uint32_t pe_total; /* total of physical extents */
653 uint32_t pe_allocated; /* allocated physical extents */
654 uint32_t pvg_total; /* physical volume groups FU */
655 struct proc_dir_entry *proc;
656 pv_t *pv[ABS_MAX_PV + 1]; /* physical volume struct pointers */
657 lv_t *lv[ABS_MAX_LV + 1]; /* logical volume struct pointers */
659 vg_v1_t;
661 typedef struct
663 uint8_t vg_name[NAME_LEN]; /* volume group name */
664 uint32_t vg_number; /* volume group number */
665 uint32_t vg_access; /* read/write */
666 uint32_t vg_status; /* active or not */
667 uint32_t lv_max; /* maximum logical volumes */
668 uint32_t lv_cur; /* current logical volumes */
669 uint32_t lv_open; /* open logical volumes */
670 uint32_t pv_max; /* maximum physical volumes */
671 uint32_t pv_cur; /* current physical volumes FU */
672 uint32_t pv_act; /* active physical volumes */
673 uint32_t dummy;
674 uint32_t vgda; /* volume group descriptor arrays FU */
675 uint32_t pe_size; /* physical extent size in sectors */
676 uint32_t pe_total; /* total of physical extents */
677 uint32_t pe_allocated; /* allocated physical extents */
678 uint32_t pvg_total; /* physical volume groups FU */
680 vg_disk_v1_t;
683 * Structure Volume Group (VG) Version 2
686 typedef struct
688 uint8_t vg_name[NAME_LEN]; /* volume group name */
689 uint32_t vg_number; /* volume group number */
690 uint32_t vg_access; /* read/write */
691 uint32_t vg_status; /* active or not */
692 uint32_t lv_max; /* maximum logical volumes */
693 uint32_t lv_cur; /* current logical volumes */
694 uint32_t lv_open; /* open logical volumes */
695 uint32_t pv_max; /* maximum physical volumes */
696 uint32_t pv_cur; /* current physical volumes FU */
697 uint32_t pv_act; /* future: active physical volumes */
698 uint32_t max_pe_per_pv; /* OBSOLETE maximum PE/PV */
699 uint32_t vgda; /* volume group descriptor arrays FU */
700 uint32_t pe_size; /* physical extent size in sectors */
701 uint32_t pe_total; /* total of physical extents */
702 uint32_t pe_allocated; /* allocated physical extents */
703 uint32_t pvg_total; /* physical volume groups FU */
704 struct proc_dir_entry *proc;
705 pv_t *pv[ABS_MAX_PV + 1]; /* physical volume struct pointers */
706 lv_t *lv[ABS_MAX_LV + 1]; /* logical volume struct pointers */
707 /* delta to version 1 starts here */
708 uint8_t vg_uuid[UUID_LEN]; /* volume group UUID */
709 time_t vg_atime; /* VG access time */
710 time_t vg_ctime; /* VG creation time */
711 time_t vg_mtime; /* VG modification time */
713 vg_v2_t;
717 * Timekeeping structure on disk (0.7 feature)
719 * Holds several timestamps for start/stop time of non
720 * atomic VGDA disk i/o operations
724 typedef struct
726 uint32_t seconds; /* seconds since the epoch */
727 uint32_t jiffies; /* micro timer */
729 lvm_time_t;
731 #define TIMESTAMP_ID_SIZE 2
732 typedef struct
734 uint8_t id[TIMESTAMP_ID_SIZE]; /* Identifier */
735 lvm_time_t pv_vg_lv_pe_io_begin;
736 lvm_time_t pv_vg_lv_pe_io_end;
737 lvm_time_t pv_io_begin;
738 lvm_time_t pv_io_end;
739 lvm_time_t vg_io_begin;
740 lvm_time_t vg_io_end;
741 lvm_time_t lv_io_begin;
742 lvm_time_t lv_io_end;
743 lvm_time_t pe_io_begin;
744 lvm_time_t pe_io_end;
745 lvm_time_t pe_move_io_begin;
746 lvm_time_t pe_move_io_end;
747 uint8_t dummy[LVM_TIMESTAMP_DISK_SIZE -
748 TIMESTAMP_ID_SIZE -
749 12 * sizeof (lvm_time_t)];
750 /* ATTENTION ^^ */
752 timestamp_disk_t;
754 /* same on disk and in core so far */
755 typedef timestamp_disk_t timestamp_t;
757 /* function identifiers for timestamp actions */
758 typedef enum
760 PV_VG_LV_PE_IO_BEGIN,
761 PV_VG_LV_PE_IO_END,
762 PV_IO_BEGIN,
763 PV_IO_END,
764 VG_IO_BEGIN,
765 VG_IO_END,
766 LV_IO_BEGIN,
767 LV_IO_END,
768 PE_IO_BEGIN,
769 PE_IO_END,
770 PE_MOVE_IO_BEGIN,
771 PE_MOVE_IO_END
773 ts_fct_id_t;
777 * Request structures for ioctls
780 /* Request structure PV_STATUS */
781 typedef struct
783 char pv_name[NAME_LEN];
784 pv_t *pv;
786 pv_status_req_t, pv_change_req_t;
788 /* Request structure PV_FLUSH */
789 typedef struct
791 char pv_name[NAME_LEN];
793 pv_flush_req_t;
796 /* Request structure PE_MOVE */
797 typedef struct
799 enum
801 LOCK_PE, UNLOCK_PE
803 lock;
804 struct
806 kdev_t lv_dev;
807 kdev_t pv_dev;
808 uint32_t pv_offset;
810 data;
812 pe_lock_req_t;
815 /* Request structure LV_STATUS_BYNAME */
816 typedef struct
818 char lv_name[NAME_LEN];
819 lv_t *lv;
821 lv_status_byname_req_t, lv_req_t;
823 /* Request structure LV_STATUS_BYINDEX */
824 typedef struct
826 ulong lv_index;
827 lv_t *lv;
829 lv_status_byindex_req_t;
831 #endif /* #ifndef _LVM_H_INCLUDE */