Deleted Added
full compact
spa.h (208047) spa.h (209962)
1/*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE

--- 5 unchanged lines hidden (view full) ---

14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21/*
1/*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE

--- 5 unchanged lines hidden (view full) ---

14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21/*
22 * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
22 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
24 */
25
26#ifndef _SYS_SPA_H
27#define _SYS_SPA_H
28
29#include <sys/avl.h>
30#include <sys/zfs_context.h>

--- 172 unchanged lines hidden (view full) ---

203 BF64_GET_SB((dva)->dva_word[1], 0, 63, SPA_MINBLOCKSHIFT, 0)
204#define DVA_SET_OFFSET(dva, x) \
205 BF64_SET_SB((dva)->dva_word[1], 0, 63, SPA_MINBLOCKSHIFT, 0, x)
206
207#define DVA_GET_GANG(dva) BF64_GET((dva)->dva_word[1], 63, 1)
208#define DVA_SET_GANG(dva, x) BF64_SET((dva)->dva_word[1], 63, 1, x)
209
210#define BP_GET_LSIZE(bp) \
23 * Use is subject to license terms.
24 */
25
26#ifndef _SYS_SPA_H
27#define _SYS_SPA_H
28
29#include <sys/avl.h>
30#include <sys/zfs_context.h>

--- 172 unchanged lines hidden (view full) ---

203 BF64_GET_SB((dva)->dva_word[1], 0, 63, SPA_MINBLOCKSHIFT, 0)
204#define DVA_SET_OFFSET(dva, x) \
205 BF64_SET_SB((dva)->dva_word[1], 0, 63, SPA_MINBLOCKSHIFT, 0, x)
206
207#define DVA_GET_GANG(dva) BF64_GET((dva)->dva_word[1], 63, 1)
208#define DVA_SET_GANG(dva, x) BF64_SET((dva)->dva_word[1], 63, 1, x)
209
210#define BP_GET_LSIZE(bp) \
211 (BP_IS_HOLE(bp) ? 0 : \
212 BF64_GET_SB((bp)->blk_prop, 0, 16, SPA_MINBLOCKSHIFT, 1))
211 BF64_GET_SB((bp)->blk_prop, 0, 16, SPA_MINBLOCKSHIFT, 1)
212
213#define BP_SET_LSIZE(bp, x) \
214 BF64_SET_SB((bp)->blk_prop, 0, 16, SPA_MINBLOCKSHIFT, 1, x)
215
216#define BP_GET_PSIZE(bp) \
217 BF64_GET_SB((bp)->blk_prop, 16, 16, SPA_MINBLOCKSHIFT, 1)
218#define BP_SET_PSIZE(bp, x) \
219 BF64_SET_SB((bp)->blk_prop, 16, 16, SPA_MINBLOCKSHIFT, 1, x)
220

--- 103 unchanged lines hidden (view full) ---

324 char *altroot, size_t buflen);
325extern int spa_create(const char *pool, nvlist_t *config, nvlist_t *props,
326 const char *history_str, nvlist_t *zplprops);
327extern int spa_check_rootconf(char *devpath, char *devid,
328 nvlist_t **bestconf, uint64_t *besttxg);
329extern boolean_t spa_rootdev_validate(nvlist_t *nv);
330extern int spa_import_rootpool(char *devpath, char *devid);
331extern int spa_import(const char *pool, nvlist_t *config, nvlist_t *props);
213#define BP_SET_LSIZE(bp, x) \
214 BF64_SET_SB((bp)->blk_prop, 0, 16, SPA_MINBLOCKSHIFT, 1, x)
215
216#define BP_GET_PSIZE(bp) \
217 BF64_GET_SB((bp)->blk_prop, 16, 16, SPA_MINBLOCKSHIFT, 1)
218#define BP_SET_PSIZE(bp, x) \
219 BF64_SET_SB((bp)->blk_prop, 16, 16, SPA_MINBLOCKSHIFT, 1, x)
220

--- 103 unchanged lines hidden (view full) ---

324 char *altroot, size_t buflen);
325extern int spa_create(const char *pool, nvlist_t *config, nvlist_t *props,
326 const char *history_str, nvlist_t *zplprops);
327extern int spa_check_rootconf(char *devpath, char *devid,
328 nvlist_t **bestconf, uint64_t *besttxg);
329extern boolean_t spa_rootdev_validate(nvlist_t *nv);
330extern int spa_import_rootpool(char *devpath, char *devid);
331extern int spa_import(const char *pool, nvlist_t *config, nvlist_t *props);
332extern int spa_import_faulted(const char *, nvlist_t *, nvlist_t *);
332extern int spa_import_verbatim(const char *, nvlist_t *, nvlist_t *);
333extern nvlist_t *spa_tryimport(nvlist_t *tryconfig);
334extern int spa_destroy(char *pool);
335extern int spa_export(char *pool, nvlist_t **oldconfig, boolean_t force,
336 boolean_t hardforce);
337extern int spa_reset(char *pool);
338extern void spa_async_request(spa_t *spa, int flag);
339extern void spa_async_unrequest(spa_t *spa, int flag);
340extern void spa_async_suspend(spa_t *spa);

--- 6 unchanged lines hidden (view full) ---

347#define SPA_ASYNC_PROBE 0x04
348#define SPA_ASYNC_RESILVER_DONE 0x08
349#define SPA_ASYNC_RESILVER 0x10
350
351/* device manipulation */
352extern int spa_vdev_add(spa_t *spa, nvlist_t *nvroot);
353extern int spa_vdev_attach(spa_t *spa, uint64_t guid, nvlist_t *nvroot,
354 int replacing);
333extern nvlist_t *spa_tryimport(nvlist_t *tryconfig);
334extern int spa_destroy(char *pool);
335extern int spa_export(char *pool, nvlist_t **oldconfig, boolean_t force,
336 boolean_t hardforce);
337extern int spa_reset(char *pool);
338extern void spa_async_request(spa_t *spa, int flag);
339extern void spa_async_unrequest(spa_t *spa, int flag);
340extern void spa_async_suspend(spa_t *spa);

--- 6 unchanged lines hidden (view full) ---

347#define SPA_ASYNC_PROBE 0x04
348#define SPA_ASYNC_RESILVER_DONE 0x08
349#define SPA_ASYNC_RESILVER 0x10
350
351/* device manipulation */
352extern int spa_vdev_add(spa_t *spa, nvlist_t *nvroot);
353extern int spa_vdev_attach(spa_t *spa, uint64_t guid, nvlist_t *nvroot,
354 int replacing);
355extern int spa_vdev_detach(spa_t *spa, uint64_t guid, int replace_done);
355extern int spa_vdev_detach(spa_t *spa, uint64_t guid, uint64_t pguid,
356 int replace_done);
356extern int spa_vdev_remove(spa_t *spa, uint64_t guid, boolean_t unspare);
357extern int spa_vdev_setpath(spa_t *spa, uint64_t guid, const char *newpath);
357extern int spa_vdev_remove(spa_t *spa, uint64_t guid, boolean_t unspare);
358extern int spa_vdev_setpath(spa_t *spa, uint64_t guid, const char *newpath);
359extern int spa_vdev_setfru(spa_t *spa, uint64_t guid, const char *newfru);
358
359/* spare state (which is global across all pools) */
360extern void spa_spare_add(vdev_t *vd);
361extern void spa_spare_remove(vdev_t *vd);
362extern boolean_t spa_spare_exists(uint64_t guid, uint64_t *pool, int *refcnt);
363extern void spa_spare_activate(vdev_t *vd);
364
365/* L2ARC state (which is global across all pools) */

--- 105 unchanged lines hidden (view full) ---

471extern void spa_upgrade(spa_t *spa, uint64_t version);
472extern void spa_evict_all(void);
473extern vdev_t *spa_lookup_by_guid(spa_t *spa, uint64_t guid,
474 boolean_t l2cache);
475extern boolean_t spa_has_spare(spa_t *, uint64_t guid);
476extern uint64_t bp_get_dasize(spa_t *spa, const blkptr_t *bp);
477extern boolean_t spa_has_slogs(spa_t *spa);
478extern boolean_t spa_is_root(spa_t *spa);
360
361/* spare state (which is global across all pools) */
362extern void spa_spare_add(vdev_t *vd);
363extern void spa_spare_remove(vdev_t *vd);
364extern boolean_t spa_spare_exists(uint64_t guid, uint64_t *pool, int *refcnt);
365extern void spa_spare_activate(vdev_t *vd);
366
367/* L2ARC state (which is global across all pools) */

--- 105 unchanged lines hidden (view full) ---

473extern void spa_upgrade(spa_t *spa, uint64_t version);
474extern void spa_evict_all(void);
475extern vdev_t *spa_lookup_by_guid(spa_t *spa, uint64_t guid,
476 boolean_t l2cache);
477extern boolean_t spa_has_spare(spa_t *, uint64_t guid);
478extern uint64_t bp_get_dasize(spa_t *spa, const blkptr_t *bp);
479extern boolean_t spa_has_slogs(spa_t *spa);
480extern boolean_t spa_is_root(spa_t *spa);
481extern boolean_t spa_writeable(spa_t *spa);
482extern int spa_mode(spa_t *spa);
483extern uint64_t zfs_strtonum(const char *str, char **nptr);
484#define strtonum(str, nptr) zfs_strtonum((str), (nptr))
479
480/* history logging */
481typedef enum history_log_type {
482 LOG_CMD_POOL_CREATE,
483 LOG_CMD_NORMAL,
484 LOG_INTERNAL
485} history_log_type_t;
486

--- 37 unchanged lines hidden (view full) ---

524extern void spa_init(int flags);
525extern void spa_fini(void);
526extern void spa_boot_init();
527
528/* properties */
529extern int spa_prop_set(spa_t *spa, nvlist_t *nvp);
530extern int spa_prop_get(spa_t *spa, nvlist_t **nvp);
531extern void spa_prop_clear_bootfs(spa_t *spa, uint64_t obj, dmu_tx_t *tx);
485
486/* history logging */
487typedef enum history_log_type {
488 LOG_CMD_POOL_CREATE,
489 LOG_CMD_NORMAL,
490 LOG_INTERNAL
491} history_log_type_t;
492

--- 37 unchanged lines hidden (view full) ---

530extern void spa_init(int flags);
531extern void spa_fini(void);
532extern void spa_boot_init();
533
534/* properties */
535extern int spa_prop_set(spa_t *spa, nvlist_t *nvp);
536extern int spa_prop_get(spa_t *spa, nvlist_t **nvp);
537extern void spa_prop_clear_bootfs(spa_t *spa, uint64_t obj, dmu_tx_t *tx);
538extern void spa_configfile_set(spa_t *, nvlist_t *, boolean_t);
532
533/* asynchronous event notification */
534extern void spa_event_notify(spa_t *spa, vdev_t *vdev, const char *name);
535
536#ifdef ZFS_DEBUG
537#define dprintf_bp(bp, fmt, ...) do { \
538 if (zfs_flags & ZFS_DEBUG_DPRINTF) { \
539 char *__blkbuf = kmem_alloc(BP_SPRINTF_LEN, KM_SLEEP); \
540 sprintf_blkptr(__blkbuf, BP_SPRINTF_LEN, (bp)); \
541 dprintf(fmt " %s\n", __VA_ARGS__, __blkbuf); \
542 kmem_free(__blkbuf, BP_SPRINTF_LEN); \
543 } \
544_NOTE(CONSTCOND) } while (0)
545#else
546#define dprintf_bp(bp, fmt, ...)
547#endif
548
539
540/* asynchronous event notification */
541extern void spa_event_notify(spa_t *spa, vdev_t *vdev, const char *name);
542
543#ifdef ZFS_DEBUG
544#define dprintf_bp(bp, fmt, ...) do { \
545 if (zfs_flags & ZFS_DEBUG_DPRINTF) { \
546 char *__blkbuf = kmem_alloc(BP_SPRINTF_LEN, KM_SLEEP); \
547 sprintf_blkptr(__blkbuf, BP_SPRINTF_LEN, (bp)); \
548 dprintf(fmt " %s\n", __VA_ARGS__, __blkbuf); \
549 kmem_free(__blkbuf, BP_SPRINTF_LEN); \
550 } \
551_NOTE(CONSTCOND) } while (0)
552#else
553#define dprintf_bp(bp, fmt, ...)
554#endif
555
549extern int spa_mode; /* mode, e.g. FREAD | FWRITE */
556extern int spa_mode_global; /* mode, e.g. FREAD | FWRITE */
550
551#ifdef __cplusplus
552}
553#endif
554
555#endif /* _SYS_SPA_H */
557
558#ifdef __cplusplus
559}
560#endif
561
562#endif /* _SYS_SPA_H */