/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2004 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _SYS_MD_TRANS_H
#define _SYS_MD_TRANS_H
#pragma ident "%Z%%M% %I% %E% SMI"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct cirbuf32 {
} cirbuf32_t;
typedef struct cirbuf_ic {
} cirbuf_ic_t;
typedef struct ml_unit {
/*
* mdd infrastructure stuff
*/
/*
* metatrans infrastructure stuff
*/
/*
* log specific stuff
*/
/*
* spares
*/
/*
* following are incore only elements.
* Incore elements must always be at the end
* of this data struture.
*/
} ml_unit_t;
#pragma pack(4)
#endif
typedef struct ml_unit32_od {
/*
* mdd infrastructure stuff
*/
/*
* metatrans infrastructure stuff
*/
/*
* log specific stuff
*/
/*
* spares
*/
#pragma pack()
#endif
sizeof (uint_t)))
/*
* un_status
*/
typedef struct sect_trailer {
/*
* ioctls
*/
/*
* following bits are used in status word in the common section
* of unit structure
*/
/*
* map block
*/
/*
* delta header
*/
struct delta {
};
/*
* common map entry
*/
struct mapentry {
/*
* doubly linked list of all mapentries in map -- MUST BE FIRST
*/
int (*me_func)();
};
/*
* me_flags
*/
/*
* TRANSACTION OPS STATS
* mt_top_size_* should be 64bit but that would
* require test recompilations. It does not hurt the kernel
* so leave as 32 bit for now.
*/
struct topstats {
};
/*
* MAP STATS (global struct that is not updated if compiled w/o ASSERTs)
* some members of transstats need to be 64bit. See the comment above.
*/
struct transstats {
/* trans.c */
/* trans_delta.c */
/* trans_thread.c */
/* trans_top.c */
/* trans_log.c */
} transstats;
#ifdef DEBUG
#define TRANSSTATSMAX(m, v) \
if ((v) > transstats.m)\
transstats.m = (v);
#else
#define TRANSSTATS(f)
#define TRANSSTATSADD(f, n)
#define TRANSSTATSMAX(m, v)
#endif /* DEBUG */
/*
* MAP TYPES
*/
enum maptypes {
};
/*
* MAP
*/
typedef struct mt_map {
/*
* anchor doubly linked list this map's entries -- MUST BE FIRST
*/
/*
* the following are protected by the global map_mutex
*/
/*
* used after logscan to set the log's tail
*/
/*
* debug field for Scan test
*/
/*
* moby trans stuff
*/
int mtm_wantin;
int mtm_active;
int mtm_activesync;
/*
* mutex that protects all the fields in mt_map except
* mtm_mapnext and mtm_refcnt
*/
/*
* rw lock for the mapentry fields agenext and locnext
*/
/*
* DEBUG: runtestscan
*/
} mt_map_t;
/*
* mtm_flags
*/
/*
* Generic range checking macros
*/
typedef struct mt_unit {
struct mdc_unit c; /* common stuff */
/*
* infrastructure
*/
/*
* log and master device
*/
/*
* spares
*/
/*
* following are incore only elements.
* Incore elements must always be at the end
* of this data struture.
*/
} mt_unit_t;
typedef struct mt_unit32_od {
mdc_unit32_od_t c; /* common stuff */
/*
* infrastructure
*/
/*
* log and master device
*/
/*
* spares
*/
/*
* prewrite info (per buf); stored as array at beginning of prewrite area
*/
struct prewrite {
/* 1's write this sector in the buf */
};
/*
* pw_flags
*/
/*
* log state
*/
struct logstate {
};
/*
* log state defines
*/
/*
* un_debug
* MT_TRANSACT - keep per thread accounting of tranactions
* MT_MATAMAP - double check deltas and ops against matamap
* MT_WRITE_CHECK - check master+deltas against metadata write
* MT_LOG_WRITE_CHECK - read after write for log writes
* MT_TRACE - trace transactions (used with MT_TRANSACT)
* MT_SIZE - fail on size errors (used with MT_TRANSACT)
* MT_NOASYNC - force every op to be sync
* MT_FORCEROLL - forcibly roll the log after every commit
* MT_SCAN - running runtestscan; special case as needed
* MT_SHADOW - copy metatrans device writes to shadow dev.
* MT_PREWRITE - process prewrite area every roll
*/
/* Type 2 trans records */
#ifdef _KERNEL
} md_tps_t;
/*
* Log layer protos -- trans_log.c
*/
extern void _init_ldl(void);
extern void _fini_ldl(void);
extern void md_ldl_round_commit(mt_unit_t *);
extern void md_ldl_push_commit(mt_unit_t *);
extern int md_ldl_need_commit(ml_unit_t *);
mapentry_t *);
extern void md_ldl_waito(ml_unit_t *);
mapentry_t *);
struct buf *);
struct buf *);
extern void ldl_setpwvalid(ml_unit_t *);
extern int ldl_build_incore(ml_unit_t *, int);
extern void ldl_close_dev(ml_unit_t *);
extern int ldl_snarf(void);
extern void ldl_logscan_seterror(ml_unit_t *);
extern void ldl_logscan_saverror(ml_unit_t *);
caddr_t);
extern void md_ldl_logscan_end(ml_unit_t *);
extern int md_ldl_need_roll(ml_unit_t *);
extern int md_ldl_empty(ml_unit_t *);
extern int ldl_pwvalid(ml_unit_t *);
extern void ldl_waitscan(ml_unit_t *);
extern void md_ldl_seterror(ml_unit_t *);
extern int ldl_isherror(ml_unit_t *);
extern int ldl_iserror(ml_unit_t *);
extern int ldl_isanyerror(ml_unit_t *);
extern void ldl_start_scan(mt_unit_t *);
extern void ldl_opened_trans(mt_unit_t *, int);
extern void ldl_open_trans(mt_unit_t *, int);
extern void ldl_close_trans(mt_unit_t *);
extern void ldl_open_underlying(mt_unit_t *);
extern void ldl_snarf_done();
extern void ldl_cleanup(ml_unit_t *);
/*
* trans driver layer -- mdtrans.c
*/
extern kmem_cache_t *trans_child_cache;
extern void *md_trans_zalloc(size_t);
extern void *md_trans_zalloc_nosleep(size_t);
extern void *md_trans_alloc(size_t);
extern void *md_trans_alloc_nosleep(size_t);
extern void md_trans_free(void *, size_t);
extern void trans_close_all_devs(mt_unit_t *);
extern int trans_open_all_devs(mt_unit_t *);
extern int trans_build_incore(void *, int);
extern void trans_commit(mt_unit_t *, int);
extern int trans_detach(mt_unit_t *, int);
extern void trans_attach(mt_unit_t *, int);
/*
* transaction ioctl -- trans_ioctl.c
*/
/* rename named service functions */
/*
* transaction op layer -- trans_top.c
*/
extern void _init_md_top(void);
extern void _fini_top(void);
extern void top_build_incore(mt_unit_t *);
/*
* map layer -- trans_delta.c
*/
extern void md_map_free_entries(mt_map_t *);
extern int md_deltamap_need_commit(mt_map_t *);
int (*)(), uintptr_t);
extern void md_deltamap_push(mt_unit_t *);
extern int md_logmap_need_commit(mt_map_t *);
extern int md_logmap_need_roll_async(mt_map_t *);
extern int md_logmap_need_roll_sync(mt_map_t *);
extern int md_logmap_need_roll(mt_map_t *);
extern void md_logmap_start_roll(mt_unit_t *);
extern void md_logmap_kill_roll(mt_map_t *);
extern void md_logmap_forceroll(mt_map_t *);
off_t);
off_t);
md_dev64_t *);
off_t, mapentry_t **);
void *);
ushort_t *);
mapentry_t *);
mapentry_t *);
mapentry_t *);
offset_t, mapentry_t *);
extern void md_logmap_commit(mt_unit_t *);
struct buf *);
extern int md_logmap_ud_done(struct buf *);
extern void md_logmap_ud_wait();
off_t);
off_t);
extern void map_build_incore(mt_unit_t *);
extern void _init_md_map(void);
extern void _fini_map(void);
/*
* scan and roll threads -- trans_thread.c
*/
extern void md_trans_roll(ml_unit_t *);
extern void trans_scan(mt_unit_t *);
extern void trans_roll_prewrite(ml_unit_t *);
#endif /* _KERNEL */
#ifdef __cplusplus
}
#endif
#endif /* _SYS_MD_TRANS_H */