1/* Copyright 1996-2002 Hans Reiser, see reiserfs/README for licensing 2 * and copyright details */ 3 4#ifndef _LINUX_REISER_FS_SB 5#define _LINUX_REISER_FS_SB 6 7#ifdef __KERNEL__ 8#include <linux/tqueue.h> 9#endif 10 11// 12// super block's field values 13// 14/*#define REISERFS_VERSION 0 undistributed bitmap */ 15/*#define REISERFS_VERSION 1 distributed bitmap and resizer*/ 16#define REISERFS_VERSION_2 2 /* distributed bitmap, resizer, 64-bit, etc*/ 17#define UNSET_HASH 0 // read_super will guess about, what hash names 18 // in directories were sorted with 19#define TEA_HASH 1 20#define YURA_HASH 2 21#define R5_HASH 3 22#define DEFAULT_HASH R5_HASH 23 24/* this is the on disk super block */ 25 26struct reiserfs_super_block 27{ 28 __u32 s_block_count; 29 __u32 s_free_blocks; /* free blocks count */ 30 __u32 s_root_block; /* root block number */ 31 __u32 s_journal_block; /* journal block number */ 32 __u32 s_journal_dev; /* journal device number */ 33 34 /* Since journal size is currently a #define in a header file, if 35 ** someone creates a disk with a 16MB journal and moves it to a 36 ** system with 32MB journal default, they will overflow their journal 37 ** when they mount the disk. s_orig_journal_size, plus some checks 38 ** while mounting (inside journal_init) prevent that from happening 39 */ 40 41 /* great comment Chris. Thanks. -Hans */ 42 43 __u32 s_orig_journal_size; 44 __u32 s_journal_trans_max ; /* max number of blocks in a transaction. */ 45 __u32 s_journal_block_count ; /* total size of the journal. can change over time */ 46 __u32 s_journal_max_batch ; /* max number of blocks to batch into a trans */ 47 __u32 s_journal_max_commit_age ; /* in seconds, how old can an async commit be */ 48 __u32 s_journal_max_trans_age ; /* in seconds, how old can a transaction be */ 49 __u16 s_blocksize; /* block size */ 50 __u16 s_oid_maxsize; /* max size of object id array, see get_objectid() commentary */ 51 __u16 s_oid_cursize; /* current size of object id array */ 52 __u16 s_state; /* valid or error */ 53 char s_magic[12]; /* reiserfs magic string indicates that file system is reiserfs */ 54 __u32 s_hash_function_code; /* indicate, what hash function is being use to sort names in a directory*/ 55 __u16 s_tree_height; /* height of disk tree */ 56 __u16 s_bmap_nr; /* amount of bitmap blocks needed to address each block of file system */ 57 __u16 s_version; /* I'd prefer it if this was a string, 58 something like "3.6.4", and maybe 59 16 bytes long mostly unused. We 60 don't need to save bytes in the 61 superblock. -Hans */ 62 __u16 s_reserved; 63 __u32 s_inode_generation; 64 __u32 s_flags; /* Right now used only by inode-attributes, if enabled */ 65 unsigned char s_uuid[16]; /* filesystem unique identifier */ 66 unsigned char s_label[16]; /* filesystem volume label */ 67 char s_unused[88] ; /* zero filled by mkreiserfs and 68 * reiserfs_convert_objectid_map_v1() 69 * so any additions must be updated 70 * there as well. */ 71} __attribute__ ((__packed__)); 72 73typedef enum { 74 reiserfs_attrs_cleared = 0x00000001, 75} reiserfs_super_block_flags; 76 77#define SB_SIZE (sizeof(struct reiserfs_super_block)) 78/* struct reiserfs_super_block accessors/mutators 79 * since this is a disk structure, it will always be in 80 * little endian format. */ 81#define sb_block_count(sbp) (le32_to_cpu((sbp)->s_block_count)) 82#define set_sb_block_count(sbp,v) ((sbp)->s_block_count = cpu_to_le32(v)) 83#define sb_free_blocks(sbp) (le32_to_cpu((sbp)->s_free_blocks)) 84#define set_sb_free_blocks(sbp,v) ((sbp)->s_free_blocks = cpu_to_le32(v)) 85#define sb_root_block(sbp) (le32_to_cpu((sbp)->s_root_block)) 86#define set_sb_root_block(sbp,v) ((sbp)->s_root_block = cpu_to_le32(v)) 87#define sb_journal_block(sbp) (le32_to_cpu((sbp)->s_journal_block)) 88#define set_sb_journal_block(sbp,v) ((sbp)->s_journal_block = cpu_to_le32(v)) 89#define sb_journal_dev(sbp) (le32_to_cpu((sbp)->s_journal_dev)) 90#define set_sb_journal_dev(sbp,v) ((sbp)->s_journal_dev = cpu_to_le32(v)) 91#define sb_orig_journal_size(sbp) (le32_to_cpu((sbp)->s_orig_journal_size)) 92#define set_sb_orig_journal_size(sbp,v) \ 93 ((sbp)->s_orig_journal_size = cpu_to_le32(v)) 94#define sb_journal_trans_max(sbp) (le32_to_cpu((sbp)->s_journal_trans_max)) 95#define set_journal_trans_max(sbp,v) \ 96 ((sbp)->s_journal_trans_max = cpu_to_le32(v)) 97#define sb_journal_block_count(sbp) (le32_to_cpu((sbp)->journal_block_count)) 98#define sb_set_journal_block_count(sbp,v) \ 99 ((sbp)->s_journal_block_count = cpu_to_le32(v)) 100#define sb_journal_max_batch(sbp) (le32_to_cpu((sbp)->s_journal_max_batch)) 101#define set_sb_journal_max_batch(sbp,v) \ 102 ((sbp)->s_journal_max_batch = cpu_to_le32(v)) 103#define sb_jourmal_max_commit_age(sbp) \ 104 (le32_to_cpu((sbp)->s_journal_max_commit_age)) 105#define set_sb_journal_max_commit_age(sbp,v) \ 106 ((sbp)->s_journal_max_commit_age = cpu_to_le32(v)) 107#define sb_jourmal_max_trans_age(sbp) \ 108 (le32_to_cpu((sbp)->s_journal_max_trans_age)) 109#define set_sb_journal_max_trans_age(sbp,v) \ 110 ((sbp)->s_journal_max_trans_age = cpu_to_le32(v)) 111#define sb_blocksize(sbp) (le16_to_cpu((sbp)->s_blocksize)) 112#define set_sb_blocksize(sbp,v) ((sbp)->s_blocksize = cpu_to_le16(v)) 113#define sb_oid_maxsize(sbp) (le16_to_cpu((sbp)->s_oid_maxsize)) 114#define set_sb_oid_maxsize(sbp,v) ((sbp)->s_oid_maxsize = cpu_to_le16(v)) 115#define sb_oid_cursize(sbp) (le16_to_cpu((sbp)->s_oid_cursize)) 116#define set_sb_oid_cursize(sbp,v) ((sbp)->s_oid_cursize = cpu_to_le16(v)) 117#define sb_state(sbp) (le16_to_cpu((sbp)->s_state)) 118#define set_sb_state(sbp,v) ((sbp)->s_state = cpu_to_le16(v)) 119#define sb_hash_function_code(sbp) \ 120 (le32_to_cpu((sbp)->s_hash_function_code)) 121#define set_sb_hash_function_code(sbp,v) \ 122 ((sbp)->s_hash_function_code = cpu_to_le32(v)) 123#define sb_tree_height(sbp) (le16_to_cpu((sbp)->s_tree_height)) 124#define set_sb_tree_height(sbp,v) ((sbp)->s_tree_height = cpu_to_le16(v)) 125#define sb_bmap_nr(sbp) (le16_to_cpu((sbp)->s_bmap_nr)) 126#define set_sb_bmap_nr(sbp,v) ((sbp)->s_bmap_nr = cpu_to_le16(v)) 127#define sb_version(sbp) (le16_to_cpu((sbp)->s_version)) 128#define set_sb_version(sbp,v) ((sbp)->s_version = cpu_to_le16(v)) 129 130/* this is the super from 3.5.X, where X >= 10 */ 131struct reiserfs_super_block_v1 132{ 133 __u32 s_block_count; /* blocks count */ 134 __u32 s_free_blocks; /* free blocks count */ 135 __u32 s_root_block; /* root block number */ 136 __u32 s_journal_block; /* journal block number */ 137 __u32 s_journal_dev; /* journal device number */ 138 __u32 s_orig_journal_size; /* size of the journal on FS creation. used to make sure they don't overflow it */ 139 __u32 s_journal_trans_max ; /* max number of blocks in a transaction. */ 140 __u32 s_journal_block_count ; /* total size of the journal. can change over time */ 141 __u32 s_journal_max_batch ; /* max number of blocks to batch into a trans */ 142 __u32 s_journal_max_commit_age ; /* in seconds, how old can an async commit be */ 143 __u32 s_journal_max_trans_age ; /* in seconds, how old can a transaction be */ 144 __u16 s_blocksize; /* block size */ 145 __u16 s_oid_maxsize; /* max size of object id array, see get_objectid() commentary */ 146 __u16 s_oid_cursize; /* current size of object id array */ 147 __u16 s_state; /* valid or error */ 148 char s_magic[16]; /* reiserfs magic string indicates that file system is reiserfs */ 149 __u16 s_tree_height; /* height of disk tree */ 150 __u16 s_bmap_nr; /* amount of bitmap blocks needed to address each block of file system */ 151 __u32 s_reserved; 152} __attribute__ ((__packed__)); 153 154#define SB_SIZE_V1 (sizeof(struct reiserfs_super_block_v1)) 155 156/* LOGGING -- */ 157 158/* These all interelate for performance. 159** 160** If the journal block count is smaller than n transactions, you lose speed. 161** I don't know what n is yet, I'm guessing 8-16. 162** 163** typical transaction size depends on the application, how often fsync is 164** called, and how many metadata blocks you dirty in a 30 second period. 165** The more small files (<16k) you use, the larger your transactions will 166** be. 167** 168** If your journal fills faster than dirty buffers get flushed to disk, it must flush them before allowing the journal 169** to wrap, which slows things down. If you need high speed meta data updates, the journal should be big enough 170** to prevent wrapping before dirty meta blocks get to disk. 171** 172** If the batch max is smaller than the transaction max, you'll waste space at the end of the journal 173** because journal_end sets the next transaction to start at 0 if the next transaction has any chance of wrapping. 174** 175** The large the batch max age, the better the speed, and the more meta data changes you'll lose after a crash. 176** 177*/ 178 179/* don't mess with these for a while */ 180 /* we have a node size define somewhere in reiserfs_fs.h. -Hans */ 181#define JOURNAL_BLOCK_SIZE 4096 /* BUG gotta get rid of this */ 182#define JOURNAL_MAX_CNODE 1500 /* max cnodes to allocate. */ 183#define JOURNAL_TRANS_MAX 1024 /* biggest possible single transaction, don't change for now (8/3/99) */ 184#define JOURNAL_HASH_SIZE 8192 185#define JOURNAL_NUM_BITMAPS 5 /* number of copies of the bitmaps to have floating. Must be >= 2 */ 186#define JOURNAL_LIST_COUNT 64 187 188/* these are bh_state bit flag offset numbers, for use in the buffer head */ 189 190#define BH_JDirty 16 /* journal data needs to be written before buffer can be marked dirty */ 191#define BH_JDirty_wait 18 /* commit is done, buffer marked dirty */ 192#define BH_JNew 19 /* buffer allocated during this transaction, no need to write if freed during this trans too */ 193 194/* ugly. metadata blocks must be prepared before they can be logged. 195** prepared means unlocked and cleaned. If the block is prepared, but not 196** logged for some reason, any bits cleared while preparing it must be 197** set again. 198*/ 199#define BH_JPrepared 20 /* block has been prepared for the log */ 200#define BH_JRestore_dirty 22 /* restore the dirty bit later */ 201 202/* One of these for every block in every transaction 203** Each one is in two hash tables. First, a hash of the current transaction, and after journal_end, a 204** hash of all the in memory transactions. 205** next and prev are used by the current transaction (journal_hash). 206** hnext and hprev are used by journal_list_hash. If a block is in more than one transaction, the journal_list_hash 207** links it in multiple times. This allows flush_journal_list to remove just the cnode belonging 208** to a given transaction. 209*/ 210struct reiserfs_journal_cnode { 211 struct buffer_head *bh ; /* real buffer head */ 212 kdev_t dev ; /* dev of real buffer head */ 213 unsigned long blocknr ; /* block number of real buffer head, == 0 when buffer on disk */ 214 long state ; 215 struct reiserfs_journal_list *jlist ; /* journal list this cnode lives in */ 216 struct reiserfs_journal_cnode *next ; /* next in transaction list */ 217 struct reiserfs_journal_cnode *prev ; /* prev in transaction list */ 218 struct reiserfs_journal_cnode *hprev ; /* prev in hash list */ 219 struct reiserfs_journal_cnode *hnext ; /* next in hash list */ 220}; 221 222struct reiserfs_bitmap_node { 223 int id ; 224 char *data ; 225 struct list_head list ; 226} ; 227 228struct reiserfs_list_bitmap { 229 struct reiserfs_journal_list *journal_list ; 230 struct reiserfs_bitmap_node **bitmaps ; 231} ; 232 233/* 234** transaction handle which is passed around for all journal calls 235*/ 236struct reiserfs_transaction_handle { 237 /* ifdef it. -Hans */ 238 char *t_caller ; /* debugging use */ 239 int t_blocks_logged ; /* number of blocks this writer has logged */ 240 int t_blocks_allocated ; /* number of blocks this writer allocated */ 241 unsigned long t_trans_id ; /* sanity check, equals the current trans id */ 242 struct super_block *t_super ; /* super for this FS when journal_begin was 243 called. saves calls to reiserfs_get_super */ 244 int displace_new_blocks:1; /* if new block allocation occurres, that block 245 should be displaced from others */ 246} ; 247 248/* 249** one of these for each transaction. The most important part here is the j_realblock. 250** this list of cnodes is used to hash all the blocks in all the commits, to mark all the 251** real buffer heads dirty once all the commits hit the disk, 252** and to make sure every real block in a transaction is on disk before allowing the log area 253** to be overwritten */ 254struct reiserfs_journal_list { 255 unsigned long j_start ; 256 unsigned long j_len ; 257 atomic_t j_nonzerolen ; 258 atomic_t j_commit_left ; 259 atomic_t j_flushing ; 260 atomic_t j_commit_flushing ; 261 atomic_t j_older_commits_done ; /* all commits older than this on disk*/ 262 unsigned long j_trans_id ; 263 time_t j_timestamp ; 264 struct reiserfs_list_bitmap *j_list_bitmap ; 265 struct buffer_head *j_commit_bh ; /* commit buffer head */ 266 struct reiserfs_journal_cnode *j_realblock ; 267 struct reiserfs_journal_cnode *j_freedlist ; /* list of buffers that were freed during this trans. free each of these on flush */ 268 wait_queue_head_t j_commit_wait ; /* wait for all the commit blocks to be flushed */ 269 wait_queue_head_t j_flush_wait ; /* wait for all the real blocks to be flushed */ 270} ; 271 272struct reiserfs_page_list ; /* defined in reiserfs_fs.h */ 273 274struct reiserfs_journal { 275 struct buffer_head ** j_ap_blocks ; /* journal blocks on disk */ 276 struct reiserfs_journal_cnode *j_last ; /* newest journal block */ 277 struct reiserfs_journal_cnode *j_first ; /* oldest journal block. start here for traverse */ 278 279 long j_state ; 280 unsigned long j_trans_id ; 281 unsigned long j_mount_id ; 282 unsigned long j_start ; /* start of current waiting commit (index into j_ap_blocks) */ 283 unsigned long j_len ; /* lenght of current waiting commit */ 284 unsigned long j_len_alloc ; /* number of buffers requested by journal_begin() */ 285 atomic_t j_wcount ; /* count of writers for current commit */ 286 unsigned long j_bcount ; /* batch count. allows turning X transactions into 1 */ 287 unsigned long j_first_unflushed_offset ; /* first unflushed transactions offset */ 288 unsigned long j_last_flush_trans_id ; /* last fully flushed journal timestamp */ 289 struct buffer_head *j_header_bh ; 290 291 /* j_flush_pages must be flushed before the current transaction can 292 ** commit 293 */ 294 struct reiserfs_page_list *j_flush_pages ; 295 time_t j_trans_start_time ; /* time this transaction started */ 296 wait_queue_head_t j_wait ; /* wait journal_end to finish I/O */ 297 atomic_t j_wlock ; /* lock for j_wait */ 298 wait_queue_head_t j_join_wait ; /* wait for current transaction to finish before starting new one */ 299 atomic_t j_jlock ; /* lock for j_join_wait */ 300 int j_journal_list_index ; /* journal list number of the current trans */ 301 int j_list_bitmap_index ; /* number of next list bitmap to use */ 302 int j_must_wait ; /* no more journal begins allowed. MUST sleep on j_join_wait */ 303 int j_next_full_flush ; /* next journal_end will flush all journal list */ 304 int j_next_async_flush ; /* next journal_end will flush all async commits */ 305 306 int j_cnode_used ; /* number of cnodes on the used list */ 307 int j_cnode_free ; /* number of cnodes on the free list */ 308 309 struct reiserfs_journal_cnode *j_cnode_free_list ; 310 struct reiserfs_journal_cnode *j_cnode_free_orig ; /* orig pointer returned from vmalloc */ 311 312 int j_free_bitmap_nodes ; 313 int j_used_bitmap_nodes ; 314 struct list_head j_bitmap_nodes ; 315 struct inode j_dummy_inode ; 316 struct reiserfs_list_bitmap j_list_bitmap[JOURNAL_NUM_BITMAPS] ; /* array of bitmaps to record the deleted blocks */ 317 struct reiserfs_journal_list j_journal_list[JOURNAL_LIST_COUNT] ; /* array of all the journal lists */ 318 struct reiserfs_journal_cnode *j_hash_table[JOURNAL_HASH_SIZE] ; /* hash table for real buffer heads in current trans */ 319 struct reiserfs_journal_cnode *j_list_hash_table[JOURNAL_HASH_SIZE] ; /* hash table for all the real buffer heads in all 320 the transactions */ 321 struct list_head j_prealloc_list; /* list of inodes which have preallocated blocks */ 322}; 323 324#define JOURNAL_DESC_MAGIC "ReIsErLB" /* ick. magic string to find desc blocks in the journal */ 325 326 327typedef __u32 (*hashf_t) (const signed char *, int); 328 329struct reiserfs_bitmap_info 330{ 331 // FIXME: Won't work with block sizes > 8K 332 __u16 first_zero_hint; 333 __u16 free_count; 334 struct buffer_head *bh; /* the actual bitmap */ 335}; 336 337struct proc_dir_entry; 338 339#if defined(CONFIG_PROC_FS) && defined(CONFIG_REISERFS_PROC_INFO) 340typedef unsigned long int stat_cnt_t; 341typedef struct reiserfs_proc_info_data 342{ 343 spinlock_t lock; 344 int exiting; 345 int max_hash_collisions; 346 347 stat_cnt_t breads; 348 stat_cnt_t bread_miss; 349 stat_cnt_t search_by_key; 350 stat_cnt_t search_by_key_fs_changed; 351 stat_cnt_t search_by_key_restarted; 352 353 stat_cnt_t insert_item_restarted; 354 stat_cnt_t paste_into_item_restarted; 355 stat_cnt_t cut_from_item_restarted; 356 stat_cnt_t delete_solid_item_restarted; 357 stat_cnt_t delete_item_restarted; 358 359 stat_cnt_t leaked_oid; 360 stat_cnt_t leaves_removable; 361 362 /* balances per level. Use explicit 5 as MAX_HEIGHT is not visible yet. */ 363 stat_cnt_t balance_at[ 5 ]; 364 /* sbk == search_by_key */ 365 stat_cnt_t sbk_read_at[ 5 ]; 366 stat_cnt_t sbk_fs_changed[ 5 ]; 367 stat_cnt_t sbk_restarted[ 5 ]; 368 stat_cnt_t items_at[ 5 ]; 369 stat_cnt_t free_at[ 5 ]; 370 stat_cnt_t can_node_be_removed[ 5 ]; 371 long int lnum[ 5 ]; 372 long int rnum[ 5 ]; 373 long int lbytes[ 5 ]; 374 long int rbytes[ 5 ]; 375 stat_cnt_t get_neighbors[ 5 ]; 376 stat_cnt_t get_neighbors_restart[ 5 ]; 377 stat_cnt_t need_l_neighbor[ 5 ]; 378 stat_cnt_t need_r_neighbor[ 5 ]; 379 380 stat_cnt_t free_block; 381 struct __scan_bitmap_stats { 382 stat_cnt_t call; 383 stat_cnt_t wait; 384 stat_cnt_t bmap; 385 stat_cnt_t retry; 386 stat_cnt_t in_journal_hint; 387 stat_cnt_t in_journal_nohint; 388 stat_cnt_t stolen; 389 } scan_bitmap; 390 struct __journal_stats { 391 stat_cnt_t in_journal; 392 stat_cnt_t in_journal_bitmap; 393 stat_cnt_t in_journal_reusable; 394 stat_cnt_t lock_journal; 395 stat_cnt_t lock_journal_wait; 396 stat_cnt_t journal_being; 397 stat_cnt_t journal_relock_writers; 398 stat_cnt_t journal_relock_wcount; 399 stat_cnt_t mark_dirty; 400 stat_cnt_t mark_dirty_already; 401 stat_cnt_t mark_dirty_notjournal; 402 stat_cnt_t restore_prepared; 403 stat_cnt_t prepare; 404 stat_cnt_t prepare_retry; 405 } journal; 406} reiserfs_proc_info_data_t; 407#else 408typedef struct reiserfs_proc_info_data 409{} reiserfs_proc_info_data_t; 410#endif 411 412/* reiserfs union of in-core super block data */ 413struct reiserfs_sb_info 414{ 415 struct buffer_head * s_sbh; /* Buffer containing the super block */ 416 /* both the comment and the choice of 417 name are unclear for s_rs -Hans */ 418 struct reiserfs_super_block * s_rs; /* Pointer to the super block in the buffer */ 419 struct reiserfs_bitmap_info * s_ap_bitmap; 420 struct reiserfs_journal *s_journal ; /* pointer to journal information */ 421 unsigned short s_mount_state; /* reiserfs state (valid, invalid) */ 422 423 /* Comment? -Hans */ 424 void (*end_io_handler)(struct buffer_head *, int); 425 hashf_t s_hash_function; /* pointer to function which is used 426 to sort names in directory. Set on 427 mount */ 428 unsigned long s_mount_opt; /* reiserfs's mount options are set 429 here (currently - NOTAIL, NOLOG, 430 REPLAYONLY) */ 431 432 struct { /* This is a structure that describes block allocator options */ 433 unsigned long bits; /* Bitfield for enable/disable kind of options */ 434 unsigned long large_file_size; /* size started from which we consider file to be a large one(in blocks) */ 435 int border; /* percentage of disk, border takes */ 436 int preallocmin; /* Minimal file size (in blocks) starting from which we do preallocations */ 437 int preallocsize; /* Number of blocks we try to prealloc when file 438 reaches preallocmin size (in blocks) or 439 prealloc_list is empty. */ 440 } s_alloc_options; 441 442 /* Comment? -Hans */ 443 wait_queue_head_t s_wait; 444 /* To be obsoleted soon by per buffer seals.. -Hans */ 445 atomic_t s_generation_counter; // increased by one every time the 446 // tree gets re-balanced 447 unsigned long s_properties; /* File system properties. Currently holds 448 on-disk FS format */ 449 450 /* session statistics */ 451 int s_kmallocs; 452 int s_disk_reads; 453 int s_disk_writes; 454 int s_fix_nodes; 455 int s_do_balance; 456 int s_unneeded_left_neighbor; 457 int s_good_search_by_key_reada; 458 int s_bmaps; 459 int s_bmaps_without_search; 460 int s_direct2indirect; 461 int s_indirect2direct; 462 /* set up when it's ok for reiserfs_read_inode2() to read from 463 disk inode with nlink==0. Currently this is only used during 464 finish_unfinished() processing at mount time */ 465 int s_is_unlinked_ok; 466 reiserfs_proc_info_data_t s_proc_info_data; 467 struct proc_dir_entry *procdir; 468 int reserved_blocks; /* amount of blocks reserved for further allocations */ 469}; 470 471/* Definitions of reiserfs on-disk properties: */ 472#define REISERFS_3_5 0 473#define REISERFS_3_6 1 474 475/* Mount options */ 476#define REISERFS_LARGETAIL 0 /* large tails will be created in a session */ 477#define REISERFS_SMALLTAIL 17 /* small (for files less than block size) tails will be created in a session */ 478#define REPLAYONLY 3 /* replay journal and return 0. Use by fsck */ 479#define REISERFS_NOLOG 4 /* -o nolog: turn journalling off */ 480#define REISERFS_CONVERT 5 /* -o conv: causes conversion of old 481 format super block to the new 482 format. If not specified - old 483 partition will be dealt with in a 484 manner of 3.5.x */ 485 486/* -o hash={tea, rupasov, r5, detect} is meant for properly mounting 487** reiserfs disks from 3.5.19 or earlier. 99% of the time, this option 488** is not required. If the normal autodection code can't determine which 489** hash to use (because both hases had the same value for a file) 490** use this option to force a specific hash. It won't allow you to override 491** the existing hash on the FS, so if you have a tea hash disk, and mount 492** with -o hash=rupasov, the mount will fail. 493*/ 494#define FORCE_TEA_HASH 6 /* try to force tea hash on mount */ 495#define FORCE_RUPASOV_HASH 7 /* try to force rupasov hash on mount */ 496#define FORCE_R5_HASH 8 /* try to force rupasov hash on mount */ 497#define FORCE_HASH_DETECT 9 /* try to detect hash function on mount */ 498 499 500/* used for testing experimental features, makes benchmarking new 501 features with and without more convenient, should never be used by 502 users in any code shipped to users (ideally) */ 503 504#define REISERFS_NO_BORDER 11 505#define REISERFS_NO_UNHASHED_RELOCATION 12 506#define REISERFS_HASHED_RELOCATION 13 507#define REISERFS_TEST4 14 508 509#define REISERFS_TEST1 11 510#define REISERFS_TEST2 12 511#define REISERFS_TEST3 13 512#define REISERFS_TEST4 14 513 514#define REISERFS_ATTRS (15) 515 516#define reiserfs_r5_hash(s) ((s)->u.reiserfs_sb.s_mount_opt & (1 << FORCE_R5_HASH)) 517#define reiserfs_rupasov_hash(s) ((s)->u.reiserfs_sb.s_mount_opt & (1 << FORCE_RUPASOV_HASH)) 518#define reiserfs_tea_hash(s) ((s)->u.reiserfs_sb.s_mount_opt & (1 << FORCE_TEA_HASH)) 519#define reiserfs_hash_detect(s) ((s)->u.reiserfs_sb.s_mount_opt & (1 << FORCE_HASH_DETECT)) 520#define reiserfs_no_border(s) ((s)->u.reiserfs_sb.s_mount_opt & (1 << REISERFS_NO_BORDER)) 521#define reiserfs_no_unhashed_relocation(s) ((s)->u.reiserfs_sb.s_mount_opt & (1 << REISERFS_NO_UNHASHED_RELOCATION)) 522#define reiserfs_hashed_relocation(s) ((s)->u.reiserfs_sb.s_mount_opt & (1 << REISERFS_HASHED_RELOCATION)) 523#define reiserfs_test4(s) ((s)->u.reiserfs_sb.s_mount_opt & (1 << REISERFS_TEST4)) 524 525#define have_large_tails(s) ((s)->u.reiserfs_sb.s_mount_opt & (1 << REISERFS_LARGETAIL)) 526#define have_small_tails(s) ((s)->u.reiserfs_sb.s_mount_opt & (1 << REISERFS_SMALLTAIL)) 527#define replay_only(s) ((s)->u.reiserfs_sb.s_mount_opt & (1 << REPLAYONLY)) 528#define reiserfs_dont_log(s) ((s)->u.reiserfs_sb.s_mount_opt & (1 << REISERFS_NOLOG)) 529#define reiserfs_attrs(s) ((s)->u.reiserfs_sb.s_mount_opt & (1 << REISERFS_ATTRS)) 530#define old_format_only(s) ((s)->u.reiserfs_sb.s_properties & (1 << REISERFS_3_5)) 531#define convert_reiserfs(s) ((s)->u.reiserfs_sb.s_mount_opt & (1 << REISERFS_CONVERT)) 532 533 534void reiserfs_file_buffer (struct buffer_head * bh, int list); 535int reiserfs_is_super(struct super_block *s) ; 536int journal_mark_dirty(struct reiserfs_transaction_handle *, struct super_block *, struct buffer_head *bh) ; 537int flush_old_commits(struct super_block *s, int) ; 538int show_reiserfs_locks(void) ; 539int reiserfs_resize(struct super_block *, unsigned long) ; 540 541#define CARRY_ON 0 542#define SCHEDULE_OCCURRED 1 543 544 545#define SB_BUFFER_WITH_SB(s) ((s)->u.reiserfs_sb.s_sbh) 546#define SB_JOURNAL(s) ((s)->u.reiserfs_sb.s_journal) 547#define SB_JOURNAL_LIST(s) (SB_JOURNAL(s)->j_journal_list) 548#define SB_JOURNAL_LIST_INDEX(s) (SB_JOURNAL(s)->j_journal_list_index) 549#define SB_JOURNAL_LEN_FREE(s) (SB_JOURNAL(s)->j_journal_len_free) 550#define SB_AP_BITMAP(s) ((s)->u.reiserfs_sb.s_ap_bitmap) 551 552 553// on-disk super block fields converted to cpu form 554#define SB_DISK_SUPER_BLOCK(s) ((s)->u.reiserfs_sb.s_rs) 555#define SB_BLOCK_COUNT(s) sb_block_count (SB_DISK_SUPER_BLOCK(s)) 556#define SB_FREE_BLOCKS(s) sb_free_blocks (SB_DISK_SUPER_BLOCK(s)) 557#define SB_REISERFS_MAGIC(s) (SB_DISK_SUPER_BLOCK(s)->s_magic) 558#define SB_ROOT_BLOCK(s) sb_root_block (SB_DISK_SUPER_BLOCK(s)) 559#define SB_TREE_HEIGHT(s) sb_tree_height (SB_DISK_SUPER_BLOCK(s)) 560#define SB_REISERFS_STATE(s) sb_state (SB_DISK_SUPER_BLOCK(s)) 561#define SB_VERSION(s) sb_version (SB_DISK_SUPER_BLOCK(s)) 562#define SB_BMAP_NR(s) sb_bmap_nr(SB_DISK_SUPER_BLOCK(s)) 563 564#define PUT_SB_BLOCK_COUNT(s, val) do { set_sb_block_count( SB_DISK_SUPER_BLOCK(s), val); } while (0) 565#define PUT_SB_FREE_BLOCKS(s, val) do { set_sb_free_blocks( SB_DISK_SUPER_BLOCK(s), val); } while (0) 566#define PUT_SB_ROOT_BLOCK(s, val) do { set_sb_root_block( SB_DISK_SUPER_BLOCK(s), val); } while (0) 567#define PUT_SB_TREE_HEIGHT(s, val) do { set_sb_tree_height( SB_DISK_SUPER_BLOCK(s), val); } while (0) 568#define PUT_SB_REISERFS_STATE(s, val) do { set_sb_state( SB_DISK_SUPER_BLOCK(s), val); } while (0) 569#define PUT_SB_VERSION(s, val) do { set_sb_version( SB_DISK_SUPER_BLOCK(s), val); } while (0) 570#define PUT_SB_BMAP_NR(s, val) do { set_sb_bmap_nr( SB_DISK_SUPER_BLOCK(s), val); } while (0) 571 572#endif /* _LINUX_REISER_FS_SB */ 573