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 9 * or http://www.opensolaris.org/os/licensing. 10 * See the License for the specific language governing permissions 11 * and limitations under the License. 12 * 13 * When distributing Covered Code, include this CDDL HEADER in each 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 2009 Sun Microsystems, Inc. All rights reserved. 23 * Use is subject to license terms. 24 */ 25 26 #ifndef _SYS_FS_UFS_LOG_H 27 #define _SYS_FS_UFS_LOG_H 28 29 #include <sys/buf.h> 30 #include <sys/fs/ufs_trans.h> 31 #include <sys/fs/ufs_filio.h> 32 #include <sys/fs/ufs_inode.h> 33 34 #ifdef __cplusplus 35 extern "C" { 36 #endif 37 38 typedef struct lufs_save { 39 buf_t *sv_bp; 40 size_t sv_nb_left; 41 int sv_error; 42 } lufs_save_t; 43 44 typedef struct lufs_buf { 45 buf_t lb_buf; 46 void *lb_ptr; 47 } lufs_buf_t; 48 49 /* 50 * Log space is stored as extents 51 */ 52 #define LUFS_EXTENTS (UINT32_C(0)) 53 #define LS_SECTORS 2 54 55 typedef struct extent { 56 uint32_t lbno; /* Logical block # within the space */ 57 uint32_t pbno; /* Physical block number of extent. */ 58 /* in disk blocks for non-MTB ufs */ 59 /* in frags for MTB ufs */ 60 uint32_t nbno; /* # blocks in this extent */ 61 } extent_t; 62 63 typedef struct ic_extent { 64 uint32_t ic_lbno; /* Logical block # within the space */ 65 uint32_t ic_nbno; /* # blocks in this extent */ 66 daddr_t ic_pbno; /* Physical block number of extent. */ 67 /* (always in disk blocks) */ 68 } ic_extent_t; 69 70 typedef struct extent_block { 71 uint32_t type; /* Set to LUFS_EXTENTS to identify */ 72 /* structure on disk. */ 73 int32_t chksum; /* Checksum over entire block. */ 74 uint32_t nextents; /* Size of extents array. */ 75 uint32_t nbytes; /* # bytes mapped by extent_block. */ 76 uint32_t nextbno; /* blkno of next extent_block. */ 77 extent_t extents[1]; 78 } extent_block_t; 79 80 typedef struct ic_extent_block { 81 uint32_t ic_nextents; /* Size of extents array. */ 82 uint32_t ic_nbytes; /* # bytes mapped by extent_block. */ 83 uint32_t ic_nextbno; /* blkno of next extent_block. */ 84 ic_extent_t ic_extents[1]; 85 } ic_extent_block_t; 86 87 /* 88 * Don't size the incore buffers too small or too large 89 */ 90 #define LDL_MINTRANSFER (UINT32_C(32768)) /* 32 k */ 91 #define LDL_MAXTRANSFER (UINT32_C(1048576)) /* 1 M */ 92 93 /* 94 * LDL_DIVISOR (ldl_divisor) is the number to calculate the log size 95 * from the file system size according to the calculation in lufs_enable() 96 */ 97 #define LDL_DIVISOR 1024 /* 1024 gives 1MB per 1GB */ 98 99 /* 100 * This gives the maximum size of log for which the 1MB per 1GB rule 101 * applies. The size of the log will only be greater than this based 102 * on the cylinder group space requirements. 103 */ 104 #define LDL_SOFTLOGCAP (256 * 1024 * 1024) 105 106 /* 107 * But set reasonable min/max units 108 */ 109 #define LDL_MINLOGSIZE (1024 * 1024) 110 #define LDL_MAXLOGSIZE (512 * 1024 * 1024) 111 112 /* 113 * Log space requirement per cylinder group. This needs to accommodate a 114 * cg delta (inc. header) and have a factor to cover other deltas involved 115 * in a single transaction which could touch all cyl groups in a file system. 116 */ 117 #define LDL_CGSIZEREQ(fs) \ 118 ((fs)->fs_cgsize + ((fs)->fs_cgsize >> 1)) 119 120 #define LDL_MINBUFSIZE (32 * 1024) 121 #define LDL_USABLE_BSIZE (DEV_BSIZE - sizeof (sect_trailer_t)) 122 #define NB_LEFT_IN_SECTOR(off) (LDL_USABLE_BSIZE - ((off) - dbtob(btodb(off)))) 123 124 typedef struct cirbuf { 125 buf_t *cb_bp; /* buf's with space in circular buf */ 126 buf_t *cb_dirty; /* filling this buffer for log write */ 127 buf_t *cb_free; /* free bufs list */ 128 caddr_t cb_va; /* address of circular buffer */ 129 size_t cb_nb; /* size of circular buffer */ 130 krwlock_t cb_rwlock; /* r/w lock to protect list mgmt. */ 131 } cirbuf_t; 132 133 #define LUFS_VERSION (UINT32_C(1)) /* Version 1 */ 134 #define LUFS_VERSION_LATEST LUFS_VERSION 135 136 /* 137 * The old Disksuite unit structure has been split into two parts -- the 138 * incore part which is created at run time and the ondisk structure. To 139 * minimize code changes, the incore structure retains the old name, 140 * ml_unit_t and the ondisk structure is called ml_odunit_t. The ondisk 141 * structure is stored at the beginning of the log. 142 * 143 * This structure must fit into a sector (512b) 144 * 145 */ 146 typedef struct ml_odunit { 147 uint32_t od_version; /* version number */ 148 uint32_t od_badlog; /* is the log okay? */ 149 uint32_t od_unused1; 150 151 /* 152 * Important constants 153 */ 154 uint32_t od_maxtransfer; /* max transfer in bytes */ 155 uint32_t od_devbsize; /* device bsize */ 156 int32_t od_bol_lof; /* byte offset to begin of log */ 157 int32_t od_eol_lof; /* byte offset to end of log */ 158 159 /* 160 * The disk space is split into state and circular log 161 */ 162 uint32_t od_requestsize; /* size requested by user */ 163 uint32_t od_statesize; /* size of state area in bytes */ 164 uint32_t od_logsize; /* size of log area in bytes */ 165 int32_t od_statebno; /* first block of state area */ 166 int32_t od_unused2; 167 168 /* 169 * Head and tail of log 170 */ 171 int32_t od_head_lof; /* byte offset of head */ 172 uint32_t od_head_ident; /* head sector id # */ 173 int32_t od_tail_lof; /* byte offset of tail */ 174 uint32_t od_tail_ident; /* tail sector id # */ 175 uint32_t od_chksum; /* checksum to verify ondisk contents */ 176 177 /* 178 * Used for error recovery 179 */ 180 uint32_t od_head_tid; /* used for logscan; set at sethead */ 181 182 /* 183 * Debug bits 184 */ 185 int32_t od_debug; 186 187 /* 188 * Misc 189 */ 190 struct timeval od_timestamp; /* time of last state change */ 191 } ml_odunit_t; 192 193 typedef struct ml_unit { 194 struct ml_unit *un_next; /* next incore log */ 195 int un_flags; /* Incore state */ 196 buf_t *un_bp; /* contains memory for un_ondisk */ 197 struct ufsvfs *un_ufsvfs; /* backpointer to ufsvfs */ 198 dev_t un_dev; /* for convenience */ 199 ic_extent_block_t *un_ebp; /* block of extents */ 200 size_t un_nbeb; /* # bytes used by *un_ebp */ 201 struct mt_map *un_deltamap; /* deltamap */ 202 struct mt_map *un_logmap; /* logmap includes moby trans stuff */ 203 struct mt_map *un_matamap; /* optional - matamap */ 204 205 /* 206 * Used for managing transactions 207 */ 208 uint32_t un_maxresv; /* maximum reservable space */ 209 uint32_t un_resv; /* reserved byte count for this trans */ 210 uint32_t un_resv_wantin; /* reserved byte count for next trans */ 211 212 /* 213 * Used during logscan 214 */ 215 uint32_t un_tid; 216 217 /* 218 * Read/Write Buffers 219 */ 220 cirbuf_t un_rdbuf; /* read buffer space */ 221 cirbuf_t un_wrbuf; /* write buffer space */ 222 223 /* 224 * Ondisk state 225 */ 226 ml_odunit_t un_ondisk; /* ondisk log information */ 227 228 /* 229 * locks 230 */ 231 kmutex_t un_log_mutex; /* allows one log write at a time */ 232 kmutex_t un_state_mutex; /* only 1 state update at a time */ 233 } ml_unit_t; 234 235 /* 236 * Macros to allow access to the ondisk elements via the ml_unit_t incore 237 * structure. 238 */ 239 240 #define un_version un_ondisk.od_version 241 #define un_badlog un_ondisk.od_badlog 242 #define un_maxtransfer un_ondisk.od_maxtransfer 243 #define un_devbsize un_ondisk.od_devbsize 244 #define un_bol_lof un_ondisk.od_bol_lof 245 #define un_eol_lof un_ondisk.od_eol_lof 246 #define un_statesize un_ondisk.od_statesize 247 #define un_logsize un_ondisk.od_logsize 248 #define un_statebno un_ondisk.od_statebno 249 #define un_requestsize un_ondisk.od_requestsize 250 #define un_head_lof un_ondisk.od_head_lof 251 #define un_head_ident un_ondisk.od_head_ident 252 #define un_tail_lof un_ondisk.od_tail_lof 253 #define un_tail_ident un_ondisk.od_tail_ident 254 #define un_chksum un_ondisk.od_chksum 255 #define un_head_tid un_ondisk.od_head_tid 256 #define un_debug un_ondisk.od_debug 257 #define un_timestamp un_ondisk.od_timestamp 258 259 /* 260 * un_flags 261 */ 262 #define LDL_SCAN 0x0001 /* log scan in progress */ 263 #define LDL_ERROR 0x0002 /* in error state */ 264 #define LDL_NOROLL 0x0004 /* Log Not Yet Rollable */ 265 266 typedef struct sect_trailer { 267 uint32_t st_tid; /* transaction id */ 268 uint32_t st_ident; /* unique sector id */ 269 } sect_trailer_t; 270 271 /* 272 * map block 273 */ 274 #define MAPBLOCKSIZE (8192) 275 #define MAPBLOCKSHIFT (13) 276 #define MAPBLOCKOFF (MAPBLOCKSIZE-1) 277 #define MAPBLOCKMASK (~MAPBLOCKOFF) 278 #define DEV_BMASK (DEV_BSIZE - 1) 279 280 /* 281 * cached roll buffer 282 */ 283 typedef struct crb { 284 int64_t c_mof; /* master file offset of buffer */ 285 caddr_t c_buf; /* pointer to cached roll buffer */ 286 uint32_t c_nb; /* size of buffer */ 287 ushort_t c_refcnt; /* reference count on crb */ 288 uchar_t c_invalid; /* crb should not be used */ 289 } crb_t; 290 291 #define CRB_END ((crb_t *)1) /* must be non zero */ 292 293 /* 294 * delta header 295 */ 296 struct delta { 297 int64_t d_mof; /* byte offset on device to start writing */ 298 /* delta */ 299 int32_t d_nb; /* # bytes in the delta */ 300 delta_t d_typ; /* Type of delta. Defined in ufs_trans.h */ 301 }; 302 /* 303 * common map entry 304 */ 305 typedef struct mapentry mapentry_t; 306 struct mapentry { 307 /* 308 * doubly linked list of all mapentries in map -- MUST BE FIRST 309 */ 310 mapentry_t *me_next; 311 mapentry_t *me_prev; 312 313 mapentry_t *me_hash; 314 mapentry_t *me_agenext; 315 mapentry_t *me_cancel; 316 crb_t *me_crb; 317 int (*me_func)(); 318 ulong_t me_arg; 319 ulong_t me_age; 320 struct delta me_delta; 321 uint32_t me_tid; 322 off_t me_lof; 323 ushort_t me_flags; 324 }; 325 326 #define me_mof me_delta.d_mof 327 #define me_nb me_delta.d_nb 328 #define me_dt me_delta.d_typ 329 330 /* 331 * me_flags 332 */ 333 #define ME_SCAN (0x0001) /* entry from log scan */ 334 #define ME_HASH (0x0002) /* on hash list */ 335 #define ME_CANCEL (0x0004) /* on cancel list */ 336 #define ME_AGE (0x0008) /* on age list */ 337 #define ME_LIST (0x0010) /* on list list */ 338 #define ME_ROLL (0x0020) /* on pseudo-roll list */ 339 #define ME_USER (0x0040) /* User Block DT_CANCEL entry */ 340 341 /* 342 * MAP TYPES 343 */ 344 enum maptypes { 345 deltamaptype, logmaptype, matamaptype 346 }; 347 348 /* 349 * MAP 350 */ 351 #define DELTAMAP_NHASH (512) 352 #define LOGMAP_NHASH (2048) 353 #define MAP_INDEX(mof, mtm) \ 354 (((mof) >> MAPBLOCKSHIFT) & (mtm->mtm_nhash-1)) 355 #define MAP_HASH(mof, mtm) \ 356 ((mtm)->mtm_hash + MAP_INDEX((mof), (mtm))) 357 358 typedef struct mt_map { 359 /* 360 * anchor doubly linked list this map's entries -- MUST BE FIRST 361 */ 362 mapentry_t *mtm_next; 363 mapentry_t *mtm_prev; 364 365 enum maptypes mtm_type; /* map type */ 366 int mtm_flags; /* generic flags */ 367 int mtm_ref; /* PTE like ref bit */ 368 ulong_t mtm_debug; /* set at create time */ 369 ulong_t mtm_age; /* mono-inc; tags mapentries */ 370 mapentry_t *mtm_cancel; /* to be canceled at commit */ 371 ulong_t mtm_nhash; /* # of hash anchors */ 372 mapentry_t **mtm_hash; /* array of singly linked lists */ 373 struct topstats *mtm_tops; /* trans ops - enabled by an ioctl */ 374 long mtm_nme; /* # of mapentries */ 375 long mtm_nmet; /* # of mapentries this transaction */ 376 long mtm_cfrags; /* Canceled frags */ 377 long mtm_cfragmax; /* Maximum canceled frags */ 378 /* 379 * used after logscan to set the log's tail 380 */ 381 off_t mtm_tail_lof; 382 size_t mtm_tail_nb; 383 384 /* 385 * debug field for Scan test 386 */ 387 off_t mtm_trimlof; /* log was trimmed to this lof */ 388 off_t mtm_trimtail; /* tail lof before trimming */ 389 off_t mtm_trimalof; /* lof of last allocation delta */ 390 off_t mtm_trimclof; /* lof of last commit delta */ 391 off_t mtm_trimrlof; /* lof of last rolled delta */ 392 ml_unit_t *mtm_ul; /* log unit for this map */ 393 394 /* 395 * moby trans stuff 396 */ 397 uint32_t mtm_tid; 398 uint32_t mtm_committid; 399 ushort_t mtm_closed; 400 ushort_t mtm_seq; 401 long mtm_wantin; 402 long mtm_active; 403 long mtm_activesync; 404 ulong_t mtm_dirty; 405 kmutex_t mtm_lock; 406 kcondvar_t mtm_cv_commit; 407 kcondvar_t mtm_cv_next; 408 kcondvar_t mtm_cv_eot; 409 410 /* 411 * mutex that protects all the fields in mt_map except 412 * mtm_mapnext and mtm_refcnt 413 */ 414 kmutex_t mtm_mutex; 415 416 /* 417 * logmap only condition variables 418 */ 419 kcondvar_t mtm_to_roll_cv; /* roll log or kill roll thread */ 420 kcondvar_t mtm_from_roll_cv; /* log rolled or thread exiting */ 421 422 /* 423 * rw lock for the agenext mapentry field 424 */ 425 krwlock_t mtm_rwlock; 426 /* 427 * DEBUG: runtestscan 428 */ 429 kmutex_t mtm_scan_mutex; 430 431 /* 432 * logmap only taskq sync count variable, protected by mtm_lock. 433 * keeps track of the number of pending top_issue_sync 434 * dispatches. 435 */ 436 int mtm_taskq_sync_count; 437 438 /* 439 * logmap only condition variable, to synchronize with lufs_unsnarf. 440 */ 441 kcondvar_t mtm_cv; 442 } mt_map_t; 443 444 /* 445 * mtm_flags 446 */ 447 #define MTM_ROLL_EXIT 0x00000001 /* force roll thread to exit */ 448 #define MTM_ROLL_RUNNING 0x00000002 /* roll thread is running */ 449 #define MTM_FORCE_ROLL 0x00000004 /* force at least one roll cycle */ 450 #define MTM_ROLLING 0x00000008 /* currently rolling the log */ 451 #define MTM_CANCELED 0x00000010 /* cancel entries were removed */ 452 453 /* 454 * Generic range checking macros 455 */ 456 #define OVERLAP(sof, snb, dof, dnb) \ 457 (((sof) >= (dof) && (sof) < ((dof) + (dnb))) || \ 458 ((dof) >= (sof) && (dof) < ((sof) + (snb)))) 459 #define WITHIN(sof, snb, dof, dnb) \ 460 (((sof) >= (dof)) && (((sof) + (snb)) <= ((dof) + (dnb)))) 461 #define DATAoverlapME(mof, hnb, me) \ 462 (OVERLAP((mof), (hnb), (me)->me_mof, (me)->me_nb)) 463 #define MEwithinDATA(me, mof, hnb) \ 464 (WITHIN((me)->me_mof, (me)->me_nb, (mof), (hnb))) 465 #define DATAwithinME(mof, hnb, me) \ 466 (WITHIN((mof), (hnb), (me)->me_mof, (me)->me_nb)) 467 #define DATAwithinCRB(mof, nb, crb) \ 468 (WITHIN((mof), (nb), (crb)->c_mof, (crb)->c_nb)) 469 470 /* 471 * TRANSACTION OPS STATS 472 */ 473 typedef struct topstats { 474 uint64_t mtm_top_num[TOP_MAX]; 475 uint64_t mtm_top_size_etot[TOP_MAX]; 476 uint64_t mtm_top_size_rtot[TOP_MAX]; 477 uint64_t mtm_top_size_max[TOP_MAX]; 478 uint64_t mtm_top_size_min[TOP_MAX]; 479 uint64_t mtm_delta_num[DT_MAX]; 480 } topstats_t; 481 482 /* 483 * fio_lufs_stats_t is used by _FIO_GET_TOP_STATS ioctl for getting topstats 484 */ 485 typedef struct fio_lufs_stats { 486 uint32_t ls_debug; /* out: un_debug value */ 487 uint32_t _ls_pad; /* make size 64-bit aligned on x86 */ 488 topstats_t ls_topstats; /* out: transaction stats */ 489 } fio_lufs_stats_t; 490 491 /* 492 * roll buf structure; one per roll buffer 493 */ 494 typedef uint16_t rbsecmap_t; 495 typedef struct rollbuf { 496 buf_t rb_bh; /* roll buffer header */ 497 struct rollbuf *rb_next; /* link for mof ordered roll bufs */ 498 crb_t *rb_crb; /* cached roll buffer to roll */ 499 mapentry_t *rb_age; /* age list */ 500 rbsecmap_t rb_secmap; /* sector map */ 501 } rollbuf_t; 502 503 /* 504 * un_debug 505 * MT_TRANSACT - keep per thread accounting of tranactions 506 * MT_MATAMAP - double check deltas and ops against matamap 507 * MT_WRITE_CHECK - check master+deltas against metadata write 508 * MT_LOG_WRITE_CHECK - read after write for log writes 509 * MT_CHECK_MAP - check map after every insert/delete 510 * MT_TRACE - trace transactions (used with MT_TRANSACT) 511 * MT_SIZE - fail on size errors (used with MT_TRANSACT) 512 * MT_NOASYNC - force every op to be sync 513 * MT_FORCEROLL - forcibly roll the log after every commit 514 * MT_SCAN - running runtestscan; special case as needed 515 */ 516 #define MT_NONE (0x00000000) 517 #define MT_TRANSACT (0x00000001) 518 #define MT_MATAMAP (0x00000002) 519 #define MT_WRITE_CHECK (0x00000004) 520 #define MT_LOG_WRITE_CHECK (0x00000008) 521 #define MT_CHECK_MAP (0x00000010) 522 #define MT_TRACE (0x00000020) 523 #define MT_SIZE (0x00000040) 524 #define MT_NOASYNC (0x00000080) 525 #define MT_FORCEROLL (0x00000100) 526 #define MT_SCAN (0x00000200) 527 528 struct logstats { 529 kstat_named_t ls_lreads; /* master reads */ 530 kstat_named_t ls_lwrites; /* master writes */ 531 kstat_named_t ls_lreadsinmem; /* log reads in memory */ 532 kstat_named_t ls_ldlreads; /* log reads */ 533 kstat_named_t ls_ldlwrites; /* log writes */ 534 kstat_named_t ls_mreads; /* log master reads */ 535 kstat_named_t ls_rreads; /* log roll reads */ 536 kstat_named_t ls_rwrites; /* log roll writes */ 537 }; 538 539 #ifdef _KERNEL 540 541 typedef struct threadtrans { 542 ulong_t deltas_size; /* size of deltas this transaction */ 543 uint32_t last_async_tid; /* last async transaction id */ 544 uchar_t any_deltas; /* any deltas done this transaction */ 545 #ifdef DEBUG 546 uint_t topid; /* transaction type */ 547 ulong_t esize; /* estimated trans size */ 548 ulong_t rsize; /* real trans size */ 549 dev_t dev; /* device */ 550 #endif /* DEBUG */ 551 } threadtrans_t; 552 553 /* 554 * Log layer protos -- lufs_log.c 555 */ 556 extern void ldl_strategy(ml_unit_t *, buf_t *); 557 extern void ldl_round_commit(ml_unit_t *); 558 extern void ldl_push_commit(ml_unit_t *); 559 extern int ldl_need_commit(ml_unit_t *); 560 extern int ldl_has_space(ml_unit_t *, mapentry_t *); 561 extern void ldl_write(ml_unit_t *, caddr_t, offset_t, mapentry_t *); 562 extern void ldl_waito(ml_unit_t *); 563 extern int ldl_read(ml_unit_t *, caddr_t, offset_t, off_t, 564 mapentry_t *); 565 extern void ldl_sethead(ml_unit_t *, off_t, uint32_t); 566 extern void ldl_settail(ml_unit_t *, off_t, size_t); 567 extern ulong_t ldl_logscan_nbcommit(off_t); 568 extern int ldl_logscan_read(ml_unit_t *, off_t *, size_t, caddr_t); 569 extern void ldl_logscan_begin(ml_unit_t *); 570 extern void ldl_logscan_end(ml_unit_t *); 571 extern int ldl_need_roll(ml_unit_t *); 572 extern void ldl_seterror(ml_unit_t *, char *); 573 extern size_t ldl_bufsize(ml_unit_t *); 574 extern void ldl_savestate(ml_unit_t *); 575 extern void free_cirbuf(cirbuf_t *); 576 extern void alloc_rdbuf(cirbuf_t *, size_t, size_t); 577 extern void alloc_wrbuf(cirbuf_t *, size_t); 578 579 /* 580 * trans driver layer -- lufs.c 581 */ 582 extern int trans_not_wait(struct buf *cb); 583 extern int trans_not_done(struct buf *cb); 584 extern int trans_wait(struct buf *cb); 585 extern int trans_done(struct buf *cb); 586 extern void lufs_strategy(ml_unit_t *, buf_t *); 587 extern void lufs_read_strategy(ml_unit_t *, buf_t *); 588 extern void lufs_write_strategy(ml_unit_t *, buf_t *); 589 extern void lufs_init(void); 590 extern uint32_t lufs_hd_genid(const ml_unit_t *); 591 extern int lufs_enable(struct vnode *, struct fiolog *, cred_t *); 592 extern int lufs_disable(vnode_t *, struct fiolog *); 593 594 /* 595 * transaction op layer -- lufs_top.c 596 */ 597 extern void _init_top(void); 598 extern int top_read_roll(rollbuf_t *, ml_unit_t *); 599 600 601 /* 602 * map layer -- lufs_map.c 603 */ 604 extern void map_free_entries(mt_map_t *); 605 extern int matamap_overlap(mt_map_t *, offset_t, off_t); 606 extern int matamap_within(mt_map_t *, offset_t, off_t); 607 extern int deltamap_need_commit(mt_map_t *); 608 extern void deltamap_add(mt_map_t *, offset_t, off_t, delta_t, 609 int (*)(), ulong_t, threadtrans_t *tp); 610 extern mapentry_t *deltamap_remove(mt_map_t *, offset_t, off_t); 611 extern void deltamap_del(mt_map_t *, offset_t, off_t); 612 extern void deltamap_push(ml_unit_t *); 613 extern void logmap_cancel_remove(mt_map_t *); 614 extern int logmap_need_commit(mt_map_t *); 615 extern int logmap_need_roll_async(mt_map_t *); 616 extern int logmap_need_roll_sync(mt_map_t *); 617 extern void logmap_start_roll(ml_unit_t *); 618 extern void logmap_kill_roll(ml_unit_t *); 619 extern void logmap_forceroll(mt_map_t *); 620 extern void logmap_forceroll_nowait(mt_map_t *); 621 extern int logmap_overlap(mt_map_t *, offset_t, off_t); 622 extern void logmap_remove_roll(mt_map_t *, offset_t, off_t); 623 extern int logmap_next_roll(mt_map_t *, offset_t *); 624 extern int logmap_list_get(mt_map_t *, offset_t, off_t, 625 mapentry_t **); 626 extern int logmap_list_get_roll(mt_map_t *, offset_t, rollbuf_t *); 627 extern void logmap_list_put(mt_map_t *, mapentry_t *); 628 extern void logmap_list_put_roll(mt_map_t *, mapentry_t *); 629 extern int logmap_setup_read(mapentry_t *, rollbuf_t *); 630 extern void logmap_make_space(struct mt_map *, ml_unit_t *, 631 mapentry_t *); 632 extern void logmap_add(ml_unit_t *, char *, offset_t, mapentry_t *); 633 extern void logmap_add_buf(ml_unit_t *, char *, offset_t, 634 mapentry_t *, caddr_t, uint32_t); 635 extern void logmap_commit(ml_unit_t *, uint32_t); 636 extern void logmap_sethead(mt_map_t *, ml_unit_t *); 637 extern void logmap_settail(mt_map_t *, ml_unit_t *); 638 extern void logmap_roll_dev(ml_unit_t *ul); 639 extern void logmap_cancel(ml_unit_t *, offset_t, off_t, int); 640 extern void logmap_free_cancel(mt_map_t *, mapentry_t **); 641 extern int logmap_iscancel(mt_map_t *, offset_t, off_t); 642 extern void logmap_logscan(ml_unit_t *); 643 extern mt_map_t *map_put(mt_map_t *); 644 extern mt_map_t *map_get(ml_unit_t *, enum maptypes, int); 645 extern void _init_map(void); 646 647 /* 648 * scan and roll threads -- lufs_thread.c 649 */ 650 extern void trans_roll(ml_unit_t *); 651 652 /* 653 * DEBUG 654 */ 655 #ifdef DEBUG 656 extern int map_put_debug(mt_map_t *); 657 extern int map_get_debug(ml_unit_t *, mt_map_t *); 658 extern int top_write_debug(ml_unit_t *, mapentry_t *, offset_t, off_t); 659 extern int matamap_overlap(mt_map_t *, offset_t, off_t); 660 extern int ldl_sethead_debug(ml_unit_t *); 661 extern int map_check_linkage(mt_map_t *); 662 extern int logmap_logscan_debug(mt_map_t *, mapentry_t *); 663 extern int map_check_ldl_write(ml_unit_t *, caddr_t, offset_t, 664 mapentry_t *); 665 extern int logmap_logscan_commit_debug(off_t, mt_map_t *); 666 extern int logmap_logscan_add_debug(struct delta *, mt_map_t *); 667 extern int top_delta_debug(ml_unit_t *, offset_t, off_t, delta_t); 668 extern int top_begin_debug(ml_unit_t *, top_t, ulong_t); 669 extern int top_end_debug(ml_unit_t *, mt_map_t *, top_t, ulong_t); 670 extern int top_roll_debug(ml_unit_t *); 671 extern int top_init_debug(void); 672 extern int lufs_initialize_debug(ml_odunit_t *); 673 #endif /* DEBUG */ 674 675 extern uint64_t delta_stats[DT_MAX]; 676 extern uint64_t roll_stats[DT_MAX]; 677 extern struct logstats logstats; 678 extern int ufs_crb_enable; 679 680 extern uint_t topkey; 681 extern uint32_t ufs_ncg_log; 682 683 extern uint_t lufs_debug; 684 685 #endif /* _KERNEL */ 686 687 #ifdef __cplusplus 688 } 689 #endif 690 691 #endif /* _SYS_FS_UFS_LOG_H */ 692