~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

Linux Cross Reference
Linux/include/linux/lvm.h

Version: ~ [ 2.4.0 ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /*
  2  * include/linux/lvm.h
  3  * kernel/lvm.h
  4  * tools/lib/lvm.h
  5  *
  6  * Copyright (C) 1997 - 2000  Heinz Mauelshagen, Sistina Software
  7  *
  8  * February-November 1997
  9  * May-July 1998
 10  * January-March,July,September,October,Dezember 1999
 11  * January,February,July,November 2000
 12  *
 13  * lvm is free software; you can redistribute it and/or modify
 14  * it under the terms of the GNU General Public License as published by
 15  * the Free Software Foundation; either version 2, or (at your option)
 16  * any later version.
 17  * 
 18  * lvm is distributed in the hope that it will be useful,
 19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
 20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 21  * GNU General Public License for more details.
 22  * 
 23  * You should have received a copy of the GNU General Public License
 24  * along with GNU CC; see the file COPYING.  If not, write to
 25  * the Free Software Foundation, 59 Temple Place - Suite 330,
 26  * Boston, MA 02111-1307, USA. 
 27  *
 28  */
 29 
 30 /*
 31  * Changelog
 32  *
 33  *    10/10/1997 - beginning of new structure creation
 34  *    12/05/1998 - incorporated structures from lvm_v1.h and deleted lvm_v1.h
 35  *    07/06/1998 - avoided LVM_KMALLOC_MAX define by using vmalloc/vfree
 36  *                 instead of kmalloc/kfree
 37  *    01/07/1998 - fixed wrong LVM_MAX_SIZE
 38  *    07/07/1998 - extended pe_t structure by ios member (for statistic)
 39  *    02/08/1998 - changes for official char/block major numbers
 40  *    07/08/1998 - avoided init_module() and cleanup_module() to be static
 41  *    29/08/1998 - seprated core and disk structure type definitions
 42  *    01/09/1998 - merged kernel integration version (mike)
 43  *    20/01/1999 - added LVM_PE_DISK_OFFSET macro for use in
 44  *                 vg_read_with_pv_and_lv(), pv_move_pe(), pv_show_pe_text()...
 45  *    18/02/1999 - added definition of time_disk_t structure for;
 46  *                 keeps time stamps on disk for nonatomic writes (future)
 47  *    15/03/1999 - corrected LV() and VG() macro definition to use argument
 48  *                 instead of minor
 49  *    03/07/1999 - define for genhd.c name handling
 50  *    23/07/1999 - implemented snapshot part
 51  *    08/12/1999 - changed LVM_LV_SIZE_MAX macro to reflect current 1TB limit
 52  *    01/01/2000 - extended lv_v2 core structure by wait_queue member
 53  *    12/02/2000 - integrated Andrea Arcagnelli's snapshot work
 54  *    18/02/2000 - seperated user and kernel space parts by 
 55  *                 #ifdef them with __KERNEL__
 56  *    08/03/2000 - implemented cluster/shared bits for vg_access
 57  *    26/06/2000 - implemented snapshot persistency and resizing support
 58  *    02/11/2000 - added hash table size member to lv structure
 59  *    12/11/2000 - removed unneeded timestamp definitions
 60  *
 61  */
 62 
 63 
 64 #ifndef _LVM_H_INCLUDE
 65 #define _LVM_H_INCLUDE
 66 
 67 #define _LVM_KERNEL_H_VERSION   "LVM 0.9 (13/11/2000)"
 68 
 69 #include <linux/config.h>
 70 #include <linux/version.h>
 71 #include <endian.h>
 72 
 73 /*
 74  * preprocessor definitions
 75  */
 76 /* if you like emergency reset code in the driver */
 77 #define LVM_TOTAL_RESET
 78 
 79 #ifdef __KERNEL__
 80 #define LVM_GET_INODE
 81 #undef  LVM_HD_NAME /* display nice names in /proc/partitions */
 82 
 83 /* lots of debugging output (see driver source)
 84    #define DEBUG_LVM_GET_INFO
 85    #define DEBUG
 86    #define DEBUG_MAP
 87    #define DEBUG_MAP_SIZE
 88    #define DEBUG_IOCTL
 89    #define DEBUG_READ
 90    #define DEBUG_GENDISK
 91    #define DEBUG_VG_CREATE
 92    #define DEBUG_LVM_BLK_OPEN
 93    #define DEBUG_KFREE
 94  */
 95 #endif                          /* #ifdef __KERNEL__ */
 96 
 97 #ifndef __KERNEL__
 98 #define __KERNEL__
 99 #include <linux/kdev_t.h>
100 #include <linux/list.h>
101 #undef __KERNEL__
102 #else
103 #include <linux/kdev_t.h>
104 #include <linux/list.h>
105 #endif                          /* #ifndef __KERNEL__ */
106 
107 #include <asm/types.h>
108 #include <linux/major.h>
109 
110 #ifdef __KERNEL__
111 #include <linux/spinlock.h>
112 #include <asm/semaphore.h>
113 #endif                          /* #ifdef __KERNEL__ */
114 
115 #include <asm/page.h>
116 
117 #if !defined ( LVM_BLK_MAJOR) || !defined ( LVM_CHAR_MAJOR)
118 #error Bad include/linux/major.h - LVM MAJOR undefined
119 #endif
120 
121 #ifdef  BLOCK_SIZE
122 #undef  BLOCK_SIZE
123 #endif
124 
125 #ifdef CONFIG_ARCH_S390 
126 #define BLOCK_SIZE      4096
127 #else
128 #define BLOCK_SIZE      1024
129 #endif
130 
131 #ifndef SECTOR_SIZE
132 #define SECTOR_SIZE     512
133 #endif
134 
135 #define LVM_STRUCT_VERSION      1       /* structure version */
136 
137 #define LVM_DIR_PREFIX  "/dev/"
138 
139 #ifndef min
140 #define min(a,b) (((a)<(b))?(a):(b))
141 #endif
142 #ifndef max
143 #define max(a,b) (((a)>(b))?(a):(b))
144 #endif
145 
146 /* set the default structure version */
147 #if ( LVM_STRUCT_VERSION == 1)
148 #define pv_t pv_v2_t
149 #define lv_t lv_v4_t
150 #define vg_t vg_v3_t
151 #define pv_disk_t pv_disk_v2_t
152 #define lv_disk_t lv_disk_v3_t
153 #define vg_disk_t vg_disk_v2_t
154 #define lv_block_exception_t lv_block_exception_v1_t
155 #define lv_COW_table_disk_t lv_COW_table_disk_v1_t
156 #endif
157 
158 
159 
160 /*
161  * i/o protocol version
162  *
163  * defined here for the driver and defined seperate in the
164  * user land tools/lib/liblvm.h
165  *
166  */
167 #define LVM_DRIVER_IOP_VERSION          10
168 
169 #define LVM_NAME        "lvm"
170 #define LVM_GLOBAL      "global"
171 #define LVM_DIR         "lvm"
172 #define LVM_VG_SUBDIR   "VGs"
173 #define LVM_LV_SUBDIR   "LVs"
174 #define LVM_PV_SUBDIR   "PVs"
175 
176 /*
177  * VG/LV indexing macros
178  */
179 /* character minor maps directly to volume group */
180 #define VG_CHR(a) ( a)
181 
182 /* block minor indexes into a volume group/logical volume indirection table */
183 #define VG_BLK(a)       ( vg_lv_map[a].vg_number)
184 #define LV_BLK(a)       ( vg_lv_map[a].lv_number)
185 
186 /*
187  * absolute limits for VGs, PVs per VG and LVs per VG
188  */
189 #define ABS_MAX_VG      99
190 #define ABS_MAX_PV      256
191 #define ABS_MAX_LV      256     /* caused by 8 bit minor */
192 
193 #define MAX_VG  ABS_MAX_VG
194 #define MAX_LV  ABS_MAX_LV
195 #define MAX_PV  ABS_MAX_PV
196 
197 #if ( MAX_VG > ABS_MAX_VG)
198 #undef MAX_VG
199 #define MAX_VG ABS_MAX_VG
200 #endif
201 
202 #if ( MAX_LV > ABS_MAX_LV)
203 #undef MAX_LV
204 #define MAX_LV ABS_MAX_LV
205 #endif
206 
207 
208 /*
209  * VGDA: default disk spaces and offsets
210  *
211  *   there's space after the structures for later extensions.
212  *
213  *   offset            what                                size
214  *   ---------------   ----------------------------------  ------------
215  *   0                 physical volume structure           ~500 byte
216  *
217  *   1K                volume group structure              ~200 byte
218  *
219  *   5K                time stamp structure                ~
220  *
221  *   6K                namelist of physical volumes        128 byte each
222  *
223  *   6k + n * 128byte  n logical volume structures         ~300 byte each
224  *
225  *   + m * 328byte     m physical extent alloc. structs    4 byte each
226  *
227  *   End of disk -     first physical extent               typical 4 megabyte
228  *   PE total *
229  *   PE size
230  *
231  *
232  */
233 
234 /* DONT TOUCH THESE !!! */
235 /* base of PV structure in disk partition */
236 #define LVM_PV_DISK_BASE        0L
237 
238 /* size reserved for PV structure on disk */
239 #define LVM_PV_DISK_SIZE        1024L
240 
241 /* base of VG structure in disk partition */
242 #define LVM_VG_DISK_BASE        LVM_PV_DISK_SIZE
243 
244 /* size reserved for VG structure */
245 #define LVM_VG_DISK_SIZE        ( 9 * 512L)
246 
247 /* size reserved for timekeeping */
248 #define LVM_TIMESTAMP_DISK_BASE ( LVM_VG_DISK_BASE +  LVM_VG_DISK_SIZE)
249 #define LVM_TIMESTAMP_DISK_SIZE 512L    /* reserved for timekeeping */
250 
251 /* name list of physical volumes on disk */
252 #define LVM_PV_UUIDLIST_DISK_BASE ( LVM_TIMESTAMP_DISK_BASE + \
253                                     LVM_TIMESTAMP_DISK_SIZE)
254 
255 /* now for the dynamically calculated parts of the VGDA */
256 #define LVM_LV_DISK_OFFSET(a, b) ( (a)->lv_on_disk.base + \
257                                    sizeof ( lv_disk_t) * b)
258 #define LVM_DISK_SIZE(pv)        ( (pv)->pe_on_disk.base + \
259                                    (pv)->pe_on_disk.size)
260 #define LVM_PE_DISK_OFFSET(pe, pv)      ( pe * pv->pe_size + \
261                                           ( LVM_DISK_SIZE ( pv) / SECTOR_SIZE))
262 #define LVM_PE_ON_DISK_BASE(pv) \
263    { int rest; \
264      pv->pe_on_disk.base = pv->lv_on_disk.base + pv->lv_on_disk.size; \
265      if ( ( rest = pv->pe_on_disk.base % SECTOR_SIZE) != 0) \
266         pv->pe_on_disk.base += ( SECTOR_SIZE - rest); \
267    }
268 /* END default disk spaces and offsets for PVs */
269 
270 
271 /*
272  * LVM_PE_T_MAX corresponds to:
273  *
274  * 8KB PE size can map a ~512 MB logical volume at the cost of 1MB memory,
275  *
276  * 128MB PE size can map a 8TB logical volume at the same cost of memory.
277  *
278  * Default PE size of 4 MB gives a maximum logical volume size of 256 GB.
279  *
280  * Maximum PE size of 16GB gives a maximum logical volume size of 1024 TB.
281  *
282  * AFAIK, the actual kernels limit this to 1 TB.
283  *
284  * Should be a sufficient spectrum ;*)
285  */
286 
287 /* This is the usable size of pe_disk_t.le_num !!!        v     v */
288 #define LVM_PE_T_MAX            ( ( 1 << ( sizeof ( uint16_t) * 8)) - 2)
289 
290 #define LVM_LV_SIZE_MAX(a)      ( ( long long) LVM_PE_T_MAX * (a)->pe_size > ( long long) 1024*1024/SECTOR_SIZE*1024*1024 ? ( long long) 1024*1024/SECTOR_SIZE*1024*1024 : ( long long) LVM_PE_T_MAX * (a)->pe_size)
291 #define LVM_MIN_PE_SIZE         ( 8192L / SECTOR_SIZE) /* 8 KB in sectors */
292 #define LVM_MAX_PE_SIZE         ( 16L * 1024L * 1024L / SECTOR_SIZE * 1024)     /* 16GB in sectors */
293 #define LVM_DEFAULT_PE_SIZE     ( 4096L * 1024 / SECTOR_SIZE)   /* 4 MB in sectors */
294 #define LVM_DEFAULT_STRIPE_SIZE 16L     /* 16 KB  */
295 #define LVM_MIN_STRIPE_SIZE     ( PAGE_SIZE>>9)         /* PAGESIZE in sectors */
296 #define LVM_MAX_STRIPE_SIZE     ( 512L * 1024 / SECTOR_SIZE)    /* 512 KB in sectors */
297 #define LVM_MAX_STRIPES         128     /* max # of stripes */
298 #define LVM_MAX_SIZE            ( 1024LU * 1024 / SECTOR_SIZE * 1024 * 1024)    /* 1TB[sectors] */
299 #define LVM_MAX_MIRRORS         2       /* future use */
300 #define LVM_MIN_READ_AHEAD      2       /* minimum read ahead sectors */
301 #define LVM_MAX_READ_AHEAD      120     /* maximum read ahead sectors */
302 #define LVM_MAX_LV_IO_TIMEOUT   60      /* seconds I/O timeout (future use) */
303 #define LVM_PARTITION           0xfe    /* LVM partition id */
304 #define LVM_NEW_PARTITION       0x8e    /* new LVM partition id (10/09/1999) */
305 #define LVM_PE_SIZE_PV_SIZE_REL 5       /* max relation PV size and PE size */
306 
307 #define LVM_SNAPSHOT_MAX_CHUNK  1024    /* 1024 KB */
308 #define LVM_SNAPSHOT_DEF_CHUNK  64      /* 64  KB */
309 #define LVM_SNAPSHOT_MIN_CHUNK  1       /* 1   KB */
310 
311 #define UNDEF   -1
312 #define FALSE   0
313 #define TRUE    1
314 
315 
316 #define LVM_GET_COW_TABLE_CHUNKS_PER_PE(vg, lv) ( \
317         vg->pe_size / lv->lv_chunk_size)
318 
319 #define LVM_GET_COW_TABLE_ENTRIES_PER_PE(vg, lv) ( \
320 { \
321         int COW_table_entries_per_PE; \
322         int COW_table_chunks_per_PE; \
323 \
324         COW_table_entries_per_PE = LVM_GET_COW_TABLE_CHUNKS_PER_PE(vg, lv); \
325         COW_table_chunks_per_PE = ( COW_table_entries_per_PE * sizeof(lv_COW_table_disk_t) / SECTOR_SIZE + lv->lv_chunk_size - 1) / lv->lv_chunk_size; \
326         COW_table_entries_per_PE - COW_table_chunks_per_PE;})
327 
328 
329 /* to disk and to core data conversion macros */
330 #if __BYTE_ORDER == __BIG_ENDIAN
331 
332 #define LVM_TO_CORE16(x) ( \
333         ((uint16_t)((((uint16_t)(x) & 0x00FFU) << 8) | \
334                     (((uint16_t)(x) & 0xFF00U) >> 8))))
335 
336 #define LVM_TO_DISK16(x) LVM_TO_CORE16(x)
337 
338 #define LVM_TO_CORE32(x) ( \
339         ((uint32_t)((((uint32_t)(x) & 0x000000FFU) << 24) | \
340                     (((uint32_t)(x) & 0x0000FF00U) << 8))) \
341                     (((uint32_t)(x) & 0x00FF0000U) >> 8))) \
342                     (((uint32_t)(x) & 0xFF000000U) >> 24))))
343 
344 #define LVM_TO_DISK32(x) LVM_TO_CORE32(x)
345 
346 #define LVM_TO_CORE64(x) \
347         ((uint64_t)((((uint64_t)(x) & 0x00000000000000FFULL) << 56) | \
348                     (((uint64_t)(x) & 0x000000000000FF00ULL) << 40) | \
349                     (((uint64_t)(x) & 0x0000000000FF0000ULL) << 24) | \
350                     (((uint64_t)(x) & 0x00000000FF000000ULL) <<  8) | \
351                     (((uint64_t)(x) & 0x000000FF00000000ULL) >>  8) | \
352                     (((uint64_t)(x) & 0x0000FF0000000000ULL) >> 24) | \
353                     (((uint64_t)(x) & 0x00FF000000000000ULL) >> 40) | \
354                     (((uint64_t)(x) & 0xFF00000000000000ULL) >> 56))) 
355 
356 #define LVM_TO_DISK64(x) LVM_TO_CORE64(x)
357 
358 #elif __BYTE_ORDER == __LITTLE_ENDIAN
359 
360 #define LVM_TO_CORE16(x) x
361 #define LVM_TO_DISK16(x) x
362 #define LVM_TO_CORE32(x) x
363 #define LVM_TO_DISK32(x) x
364 #define LVM_TO_CORE64(x) x
365 #define LVM_TO_DISK64(x) x
366 
367 #else
368 
369 #error "__BYTE_ORDER must be defined as __LITTLE_ENDIAN or __BIG_ENDIAN"
370 
371 #endif /* #if __BYTE_ORDER == __BIG_ENDIAN */
372 
373 
374 /*
375  * ioctls
376  */
377 /* volume group */
378 #define VG_CREATE               _IOW ( 0xfe, 0x00, 1)
379 #define VG_REMOVE               _IOW ( 0xfe, 0x01, 1)
380 
381 #define VG_EXTEND               _IOW ( 0xfe, 0x03, 1)
382 #define VG_REDUCE               _IOW ( 0xfe, 0x04, 1)
383 
384 #define VG_STATUS               _IOWR ( 0xfe, 0x05, 1)
385 #define VG_STATUS_GET_COUNT     _IOWR ( 0xfe, 0x06, 1)
386 #define VG_STATUS_GET_NAMELIST  _IOWR ( 0xfe, 0x07, 1)
387 
388 #define VG_SET_EXTENDABLE       _IOW ( 0xfe, 0x08, 1)
389 #define VG_RENAME               _IOW ( 0xfe, 0x09, 1)
390 
391 
392 /* logical volume */
393 #define LV_CREATE               _IOW ( 0xfe, 0x20, 1)
394 #define LV_REMOVE               _IOW ( 0xfe, 0x21, 1)
395 
396 #define LV_ACTIVATE             _IO ( 0xfe, 0x22)
397 #define LV_DEACTIVATE           _IO ( 0xfe, 0x23)
398 
399 #define LV_EXTEND               _IOW ( 0xfe, 0x24, 1)
400 #define LV_REDUCE               _IOW ( 0xfe, 0x25, 1)
401 
402 #define LV_STATUS_BYNAME        _IOWR ( 0xfe, 0x26, 1)
403 #define LV_STATUS_BYINDEX       _IOWR ( 0xfe, 0x27, 1)
404 
405 #define LV_SET_ACCESS           _IOW ( 0xfe, 0x28, 1)
406 #define LV_SET_ALLOCATION       _IOW ( 0xfe, 0x29, 1)
407 #define LV_SET_STATUS           _IOW ( 0xfe, 0x2a, 1)
408 
409 #define LE_REMAP                _IOW ( 0xfe, 0x2b, 1)
410 
411 #define LV_SNAPSHOT_USE_RATE    _IOWR ( 0xfe, 0x2c, 1)
412 
413 #define LV_STATUS_BYDEV         _IOWR ( 0xfe, 0x2e, 1)
414 
415 #define LV_RENAME               _IOW ( 0xfe, 0x2f, 1)
416 
417 #define LV_BMAP                 _IOWR ( 0xfe, 0x30, 1)
418 
419 
420 /* physical volume */
421 #define PV_STATUS               _IOWR ( 0xfe, 0x40, 1)
422 #define PV_CHANGE               _IOWR ( 0xfe, 0x41, 1)
423 #define PV_FLUSH                _IOW ( 0xfe, 0x42, 1)
424 
425 /* physical extent */
426 #define PE_LOCK_UNLOCK          _IOW ( 0xfe, 0x50, 1)
427 
428 /* i/o protocol version */
429 #define LVM_GET_IOP_VERSION     _IOR ( 0xfe, 0x98, 1)
430 
431 #ifdef LVM_TOTAL_RESET
432 /* special reset function for testing purposes */
433 #define LVM_RESET               _IO ( 0xfe, 0x99)
434 #endif
435 
436 /* lock the logical volume manager */
437 #define LVM_LOCK_LVM            _IO ( 0xfe, 0x100)
438 /* END ioctls */
439 
440 
441 /*
442  * Status flags
443  */
444 /* volume group */
445 #define VG_ACTIVE            0x01       /* vg_status */
446 #define VG_EXPORTED          0x02       /*     "     */
447 #define VG_EXTENDABLE        0x04       /*     "     */
448 
449 #define VG_READ              0x01       /* vg_access */
450 #define VG_WRITE             0x02       /*     "     */
451 #define VG_CLUSTERED         0x04       /*     "     */
452 #define VG_SHARED            0x08       /*     "     */
453 
454 /* logical volume */
455 #define LV_ACTIVE            0x01       /* lv_status */
456 #define LV_SPINDOWN          0x02       /*     "     */
457 
458 #define LV_READ              0x01       /* lv_access */
459 #define LV_WRITE             0x02       /*     "     */
460 #define LV_SNAPSHOT          0x04       /*     "     */
461 #define LV_SNAPSHOT_ORG      0x08       /*     "     */
462 
463 #define LV_BADBLOCK_ON       0x01       /* lv_badblock */
464 
465 #define LV_STRICT            0x01       /* lv_allocation */
466 #define LV_CONTIGUOUS        0x02       /*       "       */
467 
468 /* physical volume */
469 #define PV_ACTIVE            0x01       /* pv_status */
470 #define PV_ALLOCATABLE       0x02       /* pv_allocatable */
471 
472 
473 /*
474  * Structure definitions core/disk follow
475  *
476  * conditional conversion takes place on big endian architectures
477  * in functions * pv_copy_*(), vg_copy_*() and lv_copy_*()
478  *
479  */
480 
481 #define NAME_LEN                128     /* don't change!!! */
482 #define UUID_LEN                32      /* don't change!!! */
483 
484 /* copy on write tables in disk format */
485 typedef struct {
486         uint64_t pv_org_number;
487         uint64_t pv_org_rsector;
488         uint64_t pv_snap_number;
489         uint64_t pv_snap_rsector;
490 } lv_COW_table_disk_v1_t;
491 
492 /* remap physical sector/rdev pairs including hash */
493 typedef struct {
494         struct list_head hash;
495         ulong rsector_org;
496         kdev_t rdev_org;
497         ulong rsector_new;
498         kdev_t rdev_new;
499 } lv_block_exception_v1_t;
500 
501 /* disk stored pe information */
502 typedef struct {
503         uint16_t lv_num;
504         uint16_t le_num;
505 } pe_disk_t;
506 
507 /* disk stored PV, VG, LV and PE size and offset information */
508 typedef struct {
509         uint32_t base;
510         uint32_t size;
511 } lvm_disk_data_t;
512 
513 
514 /*
515  * Structure Physical Volume (PV) Version 1
516  */
517 
518 /* core */
519 typedef struct {
520         char id[2];             /* Identifier */
521         unsigned short version; /* HM lvm version */
522         lvm_disk_data_t pv_on_disk;
523         lvm_disk_data_t vg_on_disk;
524         lvm_disk_data_t pv_namelist_on_disk;
525         lvm_disk_data_t lv_on_disk;
526         lvm_disk_data_t pe_on_disk;
527         char pv_name[NAME_LEN];
528         char vg_name[NAME_LEN];
529         char system_id[NAME_LEN];       /* for vgexport/vgimport */
530         kdev_t pv_dev;
531         uint pv_number;
532         uint pv_status;
533         uint pv_allocatable;
534         uint pv_size;           /* HM */
535         uint lv_cur;
536         uint pe_size;
537         uint pe_total;
538         uint pe_allocated;
539         uint pe_stale;          /* for future use */
540         pe_disk_t *pe;          /* HM */
541         struct inode *inode;    /* HM */
542 } pv_v1_t;
543 
544 /* core */
545 typedef struct {
546         char id[2];             /* Identifier */
547         unsigned short version; /* HM lvm version */
548         lvm_disk_data_t pv_on_disk;
549         lvm_disk_data_t vg_on_disk;
550         lvm_disk_data_t pv_uuidlist_on_disk;
551         lvm_disk_data_t lv_on_disk;
552         lvm_disk_data_t pe_on_disk;
553         char pv_name[NAME_LEN];
554         char vg_name[NAME_LEN];
555         char system_id[NAME_LEN];       /* for vgexport/vgimport */
556         kdev_t pv_dev;
557         uint pv_number;
558         uint pv_status;
559         uint pv_allocatable;
560         uint pv_size;           /* HM */
561         uint lv_cur;
562         uint pe_size;
563         uint pe_total;
564         uint pe_allocated;
565         uint pe_stale;          /* for future use */
566         pe_disk_t *pe;          /* HM */
567         struct inode *inode;    /* HM */
568         char pv_uuid[UUID_LEN+1];
569 } pv_v2_t;
570 
571 
572 /* disk */
573 typedef struct {
574         uint8_t id[2];          /* Identifier */
575         uint16_t version;               /* HM lvm version */
576         lvm_disk_data_t pv_on_disk;
577         lvm_disk_data_t vg_on_disk;
578         lvm_disk_data_t pv_namelist_on_disk;
579         lvm_disk_data_t lv_on_disk;
580         lvm_disk_data_t pe_on_disk;
581         uint8_t pv_name[NAME_LEN];
582         uint8_t vg_name[NAME_LEN];
583         uint8_t system_id[NAME_LEN];    /* for vgexport/vgimport */
584         uint32_t pv_major;
585         uint32_t pv_number;
586         uint32_t pv_status;
587         uint32_t pv_allocatable;
588         uint32_t pv_size;               /* HM */
589         uint32_t lv_cur;
590         uint32_t pe_size;
591         uint32_t pe_total;
592         uint32_t pe_allocated;
593 } pv_disk_v1_t;
594 
595 /* disk */
596 typedef struct {
597         uint8_t id[2];          /* Identifier */
598         uint16_t version;               /* HM lvm version */
599         lvm_disk_data_t pv_on_disk;
600         lvm_disk_data_t vg_on_disk;
601         lvm_disk_data_t pv_uuidlist_on_disk;
602         lvm_disk_data_t lv_on_disk;
603         lvm_disk_data_t pe_on_disk;
604         uint8_t pv_uuid[NAME_LEN];
605         uint8_t vg_name[NAME_LEN];
606         uint8_t system_id[NAME_LEN];    /* for vgexport/vgimport */
607         uint32_t pv_major;
608         uint32_t pv_number;
609         uint32_t pv_status;
610         uint32_t pv_allocatable;
611         uint32_t pv_size;               /* HM */
612         uint32_t lv_cur;
613         uint32_t pe_size;
614         uint32_t pe_total;
615         uint32_t pe_allocated;
616 } pv_disk_v2_t;
617 
618 
619 /*
620  * Structures for Logical Volume (LV)
621  */
622 
623 /* core PE information */
624 typedef struct {
625         kdev_t dev;
626         ulong pe;               /* to be changed if > 2TB */
627         ulong reads;
628         ulong writes;
629 } pe_t;
630 
631 typedef struct {
632         char lv_name[NAME_LEN];
633         kdev_t old_dev;
634         kdev_t new_dev;
635         ulong old_pe;
636         ulong new_pe;
637 } le_remap_req_t;
638 
639 typedef struct lv_bmap {
640         ulong lv_block;
641         dev_t lv_dev;
642 } lv_bmap_t;
643 
644 /*
645  * Structure Logical Volume (LV) Version 3
646  */
647 
648 /* core */
649 typedef struct lv_v4 {
650         char lv_name[NAME_LEN];
651         char vg_name[NAME_LEN];
652         uint lv_access;
653         uint lv_status;
654         uint lv_open;           /* HM */
655         kdev_t lv_dev;          /* HM */
656         uint lv_number;         /* HM */
657         uint lv_mirror_copies;  /* for future use */
658         uint lv_recovery;       /*       "        */
659         uint lv_schedule;       /*       "        */
660         uint lv_size;
661         pe_t *lv_current_pe;    /* HM */
662         uint lv_current_le;     /* for future use */
663         uint lv_allocated_le;
664         uint lv_stripes;
665         uint lv_stripesize;
666         uint lv_badblock;       /* for future use */
667         uint lv_allocation;
668         uint lv_io_timeout;     /* for future use */
669         uint lv_read_ahead;
670 
671         /* delta to version 1 starts here */
672         struct lv_v4 *lv_snapshot_org;
673         struct lv_v4 *lv_snapshot_prev;
674         struct lv_v4 *lv_snapshot_next;
675         lv_block_exception_t *lv_block_exception;
676         uint lv_remap_ptr;
677         uint lv_remap_end;
678         uint lv_chunk_size;
679         uint lv_snapshot_minor;
680 #ifdef __KERNEL__
681         struct kiobuf *lv_iobuf;
682         struct semaphore lv_snapshot_sem;
683         struct list_head *lv_snapshot_hash_table;
684         ulong lv_snapshot_hash_table_size;
685         ulong lv_snapshot_hash_mask;
686         struct page *lv_COW_table_page;
687         wait_queue_head_t lv_snapshot_wait;
688         int     lv_snapshot_use_rate;
689         void    *vg;
690 #else
691         char dummy[200];
692 #endif
693 } lv_v4_t;
694 
695 /* disk */
696 typedef struct {
697         uint8_t lv_name[NAME_LEN];
698         uint8_t vg_name[NAME_LEN];
699         uint32_t lv_access;
700         uint32_t lv_status;
701         uint32_t lv_open;               /* HM */
702         uint32_t lv_dev;                /* HM */
703         uint32_t lv_number;     /* HM */
704         uint32_t lv_mirror_copies;      /* for future use */
705         uint32_t lv_recovery;   /*       "        */
706         uint32_t lv_schedule;   /*       "        */
707         uint32_t lv_size;
708         uint32_t lv_snapshot_minor;/* minor number of original */
709         uint16_t lv_chunk_size; /* chunk size of snapshot */
710         uint16_t dummy;
711         uint32_t lv_allocated_le;
712         uint32_t lv_stripes;
713         uint32_t lv_stripesize;
714         uint32_t lv_badblock;   /* for future use */
715         uint32_t lv_allocation;
716         uint32_t lv_io_timeout; /* for future use */
717         uint32_t lv_read_ahead; /* HM */
718 } lv_disk_v3_t;
719 
720 /*
721  * Structure Volume Group (VG) Version 1
722  */
723 
724 /* core */
725 typedef struct {
726         char vg_name[NAME_LEN]; /* volume group name */
727         uint vg_number;         /* volume group number */
728         uint vg_access;         /* read/write */
729         uint vg_status;         /* active or not */
730         uint lv_max;            /* maximum logical volumes */
731         uint lv_cur;            /* current logical volumes */
732         uint lv_open;           /* open    logical volumes */
733         uint pv_max;            /* maximum physical volumes */
734         uint pv_cur;            /* current physical volumes FU */
735         uint pv_act;            /* active physical volumes */
736         uint dummy;             /* was obsolete max_pe_per_pv */
737         uint vgda;              /* volume group descriptor arrays FU */
738         uint pe_size;           /* physical extent size in sectors */
739         uint pe_total;          /* total of physical extents */
740         uint pe_allocated;      /* allocated physical extents */
741         uint pvg_total;         /* physical volume groups FU */
742         struct proc_dir_entry *proc;
743         pv_t *pv[ABS_MAX_PV + 1];       /* physical volume struct pointers */
744         lv_t *lv[ABS_MAX_LV + 1];       /* logical  volume struct pointers */
745 } vg_v1_t;
746 
747 typedef struct {
748         char vg_name[NAME_LEN]; /* volume group name */
749         uint vg_number;         /* volume group number */
750         uint vg_access;         /* read/write */
751         uint vg_status;         /* active or not */
752         uint lv_max;            /* maximum logical volumes */
753         uint lv_cur;            /* current logical volumes */
754         uint lv_open;           /* open    logical volumes */
755         uint pv_max;            /* maximum physical volumes */
756         uint pv_cur;            /* current physical volumes FU */
757         uint pv_act;            /* active physical volumes */
758         uint dummy;             /* was obsolete max_pe_per_pv */
759         uint vgda;              /* volume group descriptor arrays FU */
760         uint pe_size;           /* physical extent size in sectors */
761         uint pe_total;          /* total of physical extents */
762         uint pe_allocated;      /* allocated physical extents */
763         uint pvg_total;         /* physical volume groups FU */
764         struct proc_dir_entry *proc;
765         pv_t *pv[ABS_MAX_PV + 1];       /* physical volume struct pointers */
766         lv_t *lv[ABS_MAX_LV + 1];       /* logical  volume struct pointers */
767         char vg_uuid[UUID_LEN+1];       /* volume group UUID */
768 #ifdef __KERNEL__
769         struct proc_dir_entry *vg_dir_pde;
770         struct proc_dir_entry *lv_subdir_pde;
771         struct proc_dir_entry *pv_subdir_pde;
772 #else
773         char dummy1[200];
774 #endif
775 } vg_v3_t;
776 
777 
778 /* disk */
779 typedef struct {
780         uint8_t vg_name[NAME_LEN];      /* volume group name */
781         uint32_t vg_number;     /* volume group number */
782         uint32_t vg_access;     /* read/write */
783         uint32_t vg_status;     /* active or not */
784         uint32_t lv_max;                /* maximum logical volumes */
785         uint32_t lv_cur;                /* current logical volumes */
786         uint32_t lv_open;               /* open    logical volumes */
787         uint32_t pv_max;                /* maximum physical volumes */
788         uint32_t pv_cur;                /* current physical volumes FU */
789         uint32_t pv_act;                /* active physical volumes */
790         uint32_t dummy;
791         uint32_t vgda;          /* volume group descriptor arrays FU */
792         uint32_t pe_size;               /* physical extent size in sectors */
793         uint32_t pe_total;              /* total of physical extents */
794         uint32_t pe_allocated;  /* allocated physical extents */
795         uint32_t pvg_total;     /* physical volume groups FU */
796 } vg_disk_v1_t;
797 
798 typedef struct {
799         uint8_t vg_uuid[UUID_LEN];      /* volume group UUID */
800         uint8_t vg_name_dummy[NAME_LEN-UUID_LEN];       /* rest of v1 VG name */
801         uint32_t vg_number;     /* volume group number */
802         uint32_t vg_access;     /* read/write */
803         uint32_t vg_status;     /* active or not */
804         uint32_t lv_max;                /* maximum logical volumes */
805         uint32_t lv_cur;                /* current logical volumes */
806         uint32_t lv_open;               /* open    logical volumes */
807         uint32_t pv_max;                /* maximum physical volumes */
808         uint32_t pv_cur;                /* current physical volumes FU */
809         uint32_t pv_act;                /* active physical volumes */
810         uint32_t dummy;
811         uint32_t vgda;          /* volume group descriptor arrays FU */
812         uint32_t pe_size;               /* physical extent size in sectors */
813         uint32_t pe_total;              /* total of physical extents */
814         uint32_t pe_allocated;  /* allocated physical extents */
815         uint32_t pvg_total;     /* physical volume groups FU */
816 } vg_disk_v2_t;
817 
818 
819 /*
820  * Request structures for ioctls
821  */
822 
823 /* Request structure PV_STATUS_BY_NAME... */
824 typedef struct {
825         char pv_name[NAME_LEN];
826         pv_t *pv;
827 } pv_status_req_t, pv_change_req_t;
828 
829 /* Request structure PV_FLUSH */
830 typedef struct {
831         char pv_name[NAME_LEN];
832         kdev_t pv_dev;
833 } pv_flush_req_t;
834 
835 
836 /* Request structure PE_MOVE */
837 typedef struct {
838         enum {
839                 LOCK_PE, UNLOCK_PE
840         } lock;
841         struct {
842                 kdev_t lv_dev;
843                 kdev_t pv_dev;
844                 ulong pv_offset;
845         } data;
846 } pe_lock_req_t;
847 
848 
849 /* Request structure LV_STATUS_BYNAME */
850 typedef struct {
851         char lv_name[NAME_LEN];
852         lv_t *lv;
853 } lv_status_byname_req_t, lv_req_t;
854 
855 /* Request structure LV_STATUS_BYINDEX */
856 typedef struct {
857         ulong lv_index;
858         lv_t *lv;
859         /* Transfer size because user space and kernel space differ */
860         ushort size;
861 } lv_status_byindex_req_t;
862 
863 /* Request structure LV_STATUS_BYDEV... */
864 typedef struct {
865         dev_t dev;
866         pv_t *lv;
867 } lv_status_bydev_req_t;
868 
869 
870 /* Request structure LV_SNAPSHOT_USE_RATE */
871 typedef struct {
872         int     block;
873         int     rate;
874 } lv_snapshot_use_rate_req_t;
875 
876 #endif                          /* #ifndef _LVM_H_INCLUDE */
877 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

This page was automatically generated by the LXR engine.
Visit the LXR main site for more information.