Commit b9d4cb12 authored by Dave Jones's avatar Dave Jones Committed by Linus Torvalds

[PATCH] struct super_block cleanup - reiserfs

Original from: Brian Gerst <bgerst@didntduck.org>
Has had a once over by Chris Mason and Al.

Seperates reiserfs_sb_info from struct super_block.

						Brian Gerst
parent 8c9df7a5
......@@ -1527,7 +1527,7 @@ static inline void do_balance_completed (struct tree_balance * tb)
** and then free them now
*/
tb->tb_sb->u.reiserfs_sb.s_do_balance ++;
REISERFS_SB(tb->tb_sb)->s_do_balance ++;
/* release all nodes hold to perform the balancing */
......
......@@ -1988,13 +1988,13 @@ void * reiserfs_kmalloc (size_t size, int flags, struct super_block * s)
vp = kmalloc (size, flags);
if (vp) {
s->u.reiserfs_sb.s_kmallocs += size;
if (s->u.reiserfs_sb.s_kmallocs > malloced + 200000) {
reiserfs_warning ("vs-8301: reiserfs_kmalloc: allocated memory %d\n", s->u.reiserfs_sb.s_kmallocs);
malloced = s->u.reiserfs_sb.s_kmallocs;
REISERFS_SB(s)->s_kmallocs += size;
if (REISERFS_SB(s)->s_kmallocs > malloced + 200000) {
reiserfs_warning ("vs-8301: reiserfs_kmalloc: allocated memory %d\n", REISERFS_SB(s)->s_kmallocs);
malloced = REISERFS_SB(s)->s_kmallocs;
}
}
/*printk ("malloc : size %d, allocated %d\n", size, s->u.reiserfs_sb.s_kmallocs);*/
/*printk ("malloc : size %d, allocated %d\n", size, REISERFS_SB(s)->s_kmallocs);*/
return vp;
}
......@@ -2002,9 +2002,9 @@ void reiserfs_kfree (const void * vp, size_t size, struct super_block * s)
{
kfree (vp);
s->u.reiserfs_sb.s_kmallocs -= size;
if (s->u.reiserfs_sb.s_kmallocs < 0)
reiserfs_warning ("vs-8302: reiserfs_kfree: allocated memory %d\n", s->u.reiserfs_sb.s_kmallocs);
REISERFS_SB(s)->s_kmallocs -= size;
if (REISERFS_SB(s)->s_kmallocs < 0)
reiserfs_warning ("vs-8302: reiserfs_kfree: allocated memory %d\n", REISERFS_SB(s)->s_kmallocs);
}
#endif
......@@ -2062,7 +2062,7 @@ static int get_mem_for_virtual_node (struct tree_balance * tb)
#ifdef CONFIG_REISERFS_CHECK
reiserfs_warning ("vs-8345: get_mem_for_virtual_node: "
"kmalloc failed. reiserfs kmalloced %d bytes\n",
tb->tb_sb->u.reiserfs_sb.s_kmallocs);
REISERFS_SB(tb->tb_sb)->s_kmallocs);
#endif
tb->vn_buf_size = 0;
}
......@@ -2290,7 +2290,7 @@ int fix_nodes (int n_op_mode,
int windex ;
struct buffer_head * p_s_tbS0 = PATH_PLAST_BUFFER(p_s_tb->tb_path);
++ p_s_tb -> tb_sb -> u.reiserfs_sb.s_fix_nodes;
++ REISERFS_SB(p_s_tb -> tb_sb) -> s_fix_nodes;
n_pos_in_item = p_s_tb->tb_path->pos_in_item;
......
......@@ -623,10 +623,10 @@ static void balance_internal_when_delete (struct tree_balance * tb,
new_root = tb->L[h-1];
/* switch super block's tree root block number to the new value */
PUT_SB_ROOT_BLOCK( tb->tb_sb, new_root->b_blocknr );
//tb->tb_sb->u.reiserfs_sb.s_rs->s_tree_height --;
//REISERFS_SB(tb->tb_sb)->s_rs->s_tree_height --;
PUT_SB_TREE_HEIGHT( tb->tb_sb, SB_TREE_HEIGHT(tb->tb_sb) - 1 );
do_balance_mark_sb_dirty (tb, tb->tb_sb->u.reiserfs_sb.s_sbh, 1);
do_balance_mark_sb_dirty (tb, REISERFS_SB(tb->tb_sb)->s_sbh, 1);
/*&&&&&&&&&&&&&&&&&&&&&&*/
if (h > 1)
/* use check_internal if new root is an internal node */
......@@ -949,7 +949,7 @@ int balance_internal (struct tree_balance * tb, /* tree_balance structure */
/* Change root in structure super block. */
PUT_SB_ROOT_BLOCK( tb->tb_sb, tbSh->b_blocknr );
PUT_SB_TREE_HEIGHT( tb->tb_sb, SB_TREE_HEIGHT(tb->tb_sb) + 1 );
do_balance_mark_sb_dirty (tb, tb->tb_sb->u.reiserfs_sb.s_sbh, 1);
do_balance_mark_sb_dirty (tb, REISERFS_SB(tb->tb_sb)->s_sbh, 1);
tb->tb_sb->s_dirt = 1;
}
......
......@@ -1176,7 +1176,7 @@ void reiserfs_read_inode2 (struct inode * inode, void *p)
nlink==0: processing of open-unlinked and half-truncated files
during mount (fs/reiserfs/super.c:finish_unfinished()). */
if( ( inode -> i_nlink == 0 ) &&
! inode -> i_sb -> u.reiserfs_sb.s_is_unlinked_ok ) {
! REISERFS_SB(inode -> i_sb) -> s_is_unlinked_ok ) {
reiserfs_warning( "vs-13075: reiserfs_read_inode2: "
"dead inode read from disk %K. "
"This is likely to be race with knfsd. Ignore\n",
......@@ -1515,7 +1515,7 @@ struct inode * reiserfs_new_inode (struct reiserfs_transaction_handle *th,
else
#if defined( USE_INODE_GENERATION_COUNTER )
inode->i_generation =
le32_to_cpu( sb -> u.reiserfs_sb.s_rs -> s_inode_generation );
le32_to_cpu( REISERFS_SB(sb) -> s_rs -> s_inode_generation );
#else
inode->i_generation = ++event;
#endif
......
......@@ -183,7 +183,7 @@ static __u32 get_third_component (struct super_block * s,
if (len == 2 && name[0] == '.' && name[1] == '.')
return DOT_DOT_OFFSET;
res = s->u.reiserfs_sb.s_hash_function (name, len);
res = REISERFS_SB(s)->s_hash_function (name, len);
// take bits from 7-th to 30-th including both bounds
res = GET_HASH_VALUE(res);
......
......@@ -592,7 +592,7 @@ void store_print_tb (struct tree_balance * tb)
"MODE=%c, ITEM_POS=%d POS_IN_ITEM=%d\n"
"=====================================================================\n"
"* h * S * L * R * F * FL * FR * CFL * CFR *\n",
tb->tb_sb->u.reiserfs_sb.s_do_balance,
REISERFS_SB(tb->tb_sb)->s_do_balance,
tb->tb_mode, PATH_LAST_POSITION (tb->tb_path), tb->tb_path->pos_in_item);
for (h = 0; h < sizeof(tb->insert_size) / sizeof (tb->insert_size[0]); h ++) {
......@@ -717,9 +717,9 @@ void print_statistics (struct super_block * s)
/*
printk ("reiserfs_put_super: session statistics: balances %d, fix_nodes %d, \
bmap with search %d, without %d, dir2ind %d, ind2dir %d\n",
s->u.reiserfs_sb.s_do_balance, s->u.reiserfs_sb.s_fix_nodes,
s->u.reiserfs_sb.s_bmaps, s->u.reiserfs_sb.s_bmaps_without_search,
s->u.reiserfs_sb.s_direct2indirect, s->u.reiserfs_sb.s_indirect2direct);
REISERFS_SB(s)->s_do_balance, REISERFS_SB(s)->s_fix_nodes,
REISERFS_SB(s)->s_bmaps, REISERFS_SB(s)->s_bmaps_without_search,
REISERFS_SB(s)->s_direct2indirect, REISERFS_SB(s)->s_indirect2direct);
*/
}
......@@ -82,9 +82,9 @@ int reiserfs_version_in_proc( char *buffer, char **start, off_t offset,
sb = procinfo_prologue( to_kdev_t((int)data) );
if( sb == NULL )
return -ENOENT;
if ( sb->u.reiserfs_sb.s_properties & (1 << REISERFS_3_6) ) {
if ( REISERFS_SB(sb)->s_properties & (1 << REISERFS_3_6) ) {
format = "3.6";
} else if ( sb->u.reiserfs_sb.s_properties & (1 << REISERFS_3_5) ) {
} else if ( REISERFS_SB(sb)->s_properties & (1 << REISERFS_3_5) ) {
format = "3.5";
} else {
format = "unknown";
......@@ -140,7 +140,7 @@ int reiserfs_super_in_proc( char *buffer, char **start, off_t offset,
sb = procinfo_prologue( to_kdev_t((int)data) );
if( sb == NULL )
return -ENOENT;
r = &sb->u.reiserfs_sb;
r = REISERFS_SB(sb);
len += sprintf( &buffer[ len ],
"state: \t%s\n"
"mount options: \t%s%s%s%s%s%s%s%s%s%s%s%s\n"
......@@ -220,7 +220,7 @@ int reiserfs_per_level_in_proc( char *buffer, char **start, off_t offset,
sb = procinfo_prologue( to_kdev_t((int)data) );
if( sb == NULL )
return -ENOENT;
r = &sb->u.reiserfs_sb;
r = REISERFS_SB(sb);
len += sprintf( &buffer[ len ],
"level\t"
......@@ -293,13 +293,13 @@ int reiserfs_bitmap_in_proc( char *buffer, char **start, off_t offset,
int count, int *eof, void *data )
{
struct super_block *sb;
struct reiserfs_sb_info *r = &sb->u.reiserfs_sb;
struct reiserfs_sb_info *r;
int len = 0;
sb = procinfo_prologue( to_kdev_t((int)data) );
if( sb == NULL )
return -ENOENT;
r = &sb->u.reiserfs_sb;
r = REISERFS_SB(sb);
len += sprintf( &buffer[ len ], "free_block: %lu\n"
"find_forward:"
......@@ -340,7 +340,7 @@ int reiserfs_on_disk_super_in_proc( char *buffer, char **start, off_t offset,
sb = procinfo_prologue( to_kdev_t((int)data) );
if( sb == NULL )
return -ENOENT;
sb_info = &sb->u.reiserfs_sb;
sb_info = REISERFS_SB(sb);
rs = sb_info -> s_rs;
hash_code = DFL( s_hash_function_code );
......@@ -397,7 +397,7 @@ int reiserfs_oidmap_in_proc( char *buffer, char **start, off_t offset,
sb = procinfo_prologue( to_kdev_t((int)data) );
if( sb == NULL )
return -ENOENT;
sb_info = &sb->u.reiserfs_sb;
sb_info = REISERFS_SB(sb);
rs = sb_info -> s_rs;
mapsize = le16_to_cpu( rs -> s_v1.s_oid_cursize );
total_used = 0;
......@@ -449,7 +449,7 @@ int reiserfs_journal_in_proc( char *buffer, char **start, off_t offset,
sb = procinfo_prologue( to_kdev_t((int)data) );
if( sb == NULL )
return -ENOENT;
r = &sb->u.reiserfs_sb;
r = REISERFS_SB(sb);
rs = r -> s_rs;
jp = &rs->s_v1.s_journal;
......@@ -557,9 +557,9 @@ static const char *proc_info_root_name = "fs/reiserfs";
int reiserfs_proc_info_init( struct super_block *sb )
{
spin_lock_init( & __PINFO( sb ).lock );
sb->u.reiserfs_sb.procdir = proc_mkdir(sb->s_id, proc_info_root);
if( sb->u.reiserfs_sb.procdir ) {
sb->u.reiserfs_sb.procdir -> owner = THIS_MODULE;
REISERFS_SB(sb)->procdir = proc_mkdir(sb->s_id, proc_info_root);
if( REISERFS_SB(sb)->procdir ) {
REISERFS_SB(sb)->procdir -> owner = THIS_MODULE;
return 0;
}
reiserfs_warning( "reiserfs: cannot create /proc/%s/%s\n",
......@@ -575,7 +575,7 @@ int reiserfs_proc_info_done( struct super_block *sb )
spin_unlock( & __PINFO( sb ).lock );
if ( proc_info_root ) {
remove_proc_entry( sb->s_id, proc_info_root );
sb->u.reiserfs_sb.procdir = NULL;
REISERFS_SB(sb)->procdir = NULL;
}
return 0;
}
......@@ -587,14 +587,14 @@ int reiserfs_proc_info_done( struct super_block *sb )
struct proc_dir_entry *reiserfs_proc_register( struct super_block *sb,
char *name, read_proc_t *func )
{
return ( sb->u.reiserfs_sb.procdir ) ? create_proc_read_entry
( name, 0, sb->u.reiserfs_sb.procdir, func,
return ( REISERFS_SB(sb)->procdir ) ? create_proc_read_entry
( name, 0, REISERFS_SB(sb)->procdir, func,
( void * ) kdev_t_to_nr( sb -> s_dev ) ) : NULL;
}
void reiserfs_proc_unregister( struct super_block *sb, const char *name )
{
remove_proc_entry( name, sb->u.reiserfs_sb.procdir );
remove_proc_entry( name, REISERFS_SB(sb)->procdir );
}
struct proc_dir_entry *reiserfs_proc_register_global( char *name,
......
......@@ -1387,7 +1387,7 @@ void reiserfs_delete_object (struct reiserfs_transaction_handle *th, struct inod
__u32 *inode_generation;
inode_generation =
&th -> t_super -> u.reiserfs_sb.s_rs -> s_inode_generation;
&REISERFS_SB(th -> t_super) -> s_rs -> s_inode_generation;
*inode_generation = cpu_to_le32( le32_to_cpu( *inode_generation ) + 1 );
}
/* USE_INODE_GENERATION_COUNTER */
......
......@@ -153,7 +153,7 @@ static void finish_unfinished (struct super_block * s)
max_cpu_key.key_length = 3;
done = 0;
s -> u.reiserfs_sb.s_is_unlinked_ok = 1;
REISERFS_SB(s)->s_is_unlinked_ok = 1;
while (1) {
retval = search_item (s, &max_cpu_key, &path);
if (retval != ITEM_NOT_FOUND) {
......@@ -239,7 +239,7 @@ static void finish_unfinished (struct super_block * s)
printk ("done\n");
done ++;
}
s -> u.reiserfs_sb.s_is_unlinked_ok = 0;
REISERFS_SB(s)->s_is_unlinked_ok = 0;
pathrelse (&path);
if (done)
......@@ -378,7 +378,7 @@ static void reiserfs_put_super (struct super_block * s)
if (!(s->s_flags & MS_RDONLY)) {
journal_begin(&th, s, 10) ;
reiserfs_prepare_for_journal(s, SB_BUFFER_WITH_SB(s), 1) ;
set_sb_umount_state( SB_DISK_SUPER_BLOCK(s), s->u.reiserfs_sb.s_mount_state );
set_sb_umount_state( SB_DISK_SUPER_BLOCK(s), REISERFS_SB(s)->s_mount_state );
journal_mark_dirty(&th, s, SB_BUFFER_WITH_SB (s));
}
......@@ -396,9 +396,9 @@ static void reiserfs_put_super (struct super_block * s)
print_statistics (s);
if (s->u.reiserfs_sb.s_kmallocs != 0) {
if (REISERFS_SB(s)->s_kmallocs != 0) {
reiserfs_warning ("vs-2004: reiserfs_put_super: allocated memory left %d\n",
s->u.reiserfs_sb.s_kmallocs);
REISERFS_SB(s)->s_kmallocs);
}
reiserfs_proc_unregister( s, "journal" );
......@@ -409,6 +409,10 @@ static void reiserfs_put_super (struct super_block * s)
reiserfs_proc_unregister( s, "super" );
reiserfs_proc_unregister( s, "version" );
reiserfs_proc_info_done( s );
kfree(s->u.generic_sbp);
s->u.generic_sbp = NULL;
return;
}
......@@ -614,30 +618,30 @@ static int reiserfs_remount (struct super_block * s, int * flags, char * data)
if (*flags & MS_RDONLY) {
/* try to remount file system with read-only permissions */
if (sb_umount_state(rs) == REISERFS_VALID_FS || s->u.reiserfs_sb.s_mount_state != REISERFS_VALID_FS) {
if (sb_umount_state(rs) == REISERFS_VALID_FS || REISERFS_SB(s)->s_mount_state != REISERFS_VALID_FS) {
return 0;
}
journal_begin(&th, s, 10) ;
/* Mounting a rw partition read-only. */
reiserfs_prepare_for_journal(s, SB_BUFFER_WITH_SB(s), 1) ;
set_sb_umount_state( rs, s->u.reiserfs_sb.s_mount_state );
set_sb_umount_state( rs, REISERFS_SB(s)->s_mount_state );
journal_mark_dirty(&th, s, SB_BUFFER_WITH_SB (s));
s->s_dirt = 0;
} else {
s->u.reiserfs_sb.s_mount_state = sb_umount_state(rs) ;
REISERFS_SB(s)->s_mount_state = sb_umount_state(rs) ;
s->s_flags &= ~MS_RDONLY ; /* now it is safe to call journal_begin */
journal_begin(&th, s, 10) ;
/* Mount a partition which is read-only, read-write */
reiserfs_prepare_for_journal(s, SB_BUFFER_WITH_SB(s), 1) ;
s->u.reiserfs_sb.s_mount_state = sb_umount_state(rs);
REISERFS_SB(s)->s_mount_state = sb_umount_state(rs);
s->s_flags &= ~MS_RDONLY;
set_sb_umount_state( rs, REISERFS_ERROR_FS );
/* mark_buffer_dirty (SB_BUFFER_WITH_SB (s), 1); */
journal_mark_dirty(&th, s, SB_BUFFER_WITH_SB (s));
s->s_dirt = 0;
s->u.reiserfs_sb.s_mount_state = REISERFS_VALID_FS ;
REISERFS_SB(s)->s_mount_state = REISERFS_VALID_FS ;
}
/* this will force a full flush of all journal lists */
SB_JOURNAL(s)->j_must_wait = 1 ;
......@@ -1002,10 +1006,16 @@ static int reiserfs_fill_super(struct super_block *s, void *data, int silent)
struct reiserfs_iget4_args args ;
struct reiserfs_super_block * rs;
char *jdev_name;
struct reiserfs_sb_info *sbi;
sbi = kmalloc(sizeof(struct reiserfs_sb_info), GFP_KERNEL);
if (!sbi)
return -ENOMEM;
s->u.generic_sbp = sbi;
memset (sbi, 0, sizeof (struct reiserfs_sb_info));
memset (&s->u.reiserfs_sb, 0, sizeof (struct reiserfs_sb_info));
jdev_name = NULL;
if (parse_options ((char *) data, &(s->u.reiserfs_sb.s_mount_opt), &blocks, &jdev_name) == 0) {
if (parse_options ((char *) data, &(sbi->s_mount_opt), &blocks, &jdev_name) == 0) {
return -EINVAL;
}
......@@ -1022,8 +1032,8 @@ static int reiserfs_fill_super(struct super_block *s, void *data, int silent)
printk("sh-2021: reiserfs_fill_super: can not find reiserfs on %s\n", s->s_id);
goto error;
}
s->u.reiserfs_sb.s_mount_state = SB_REISERFS_STATE(s);
s->u.reiserfs_sb.s_mount_state = REISERFS_VALID_FS ;
sbi->s_mount_state = SB_REISERFS_STATE(s);
sbi->s_mount_state = REISERFS_VALID_FS ;
if (old_format ? read_old_bitmaps(s) : read_bitmaps(s)) {
printk ("reiserfs_fill_super: unable to read bitmap\n");
......@@ -1069,8 +1079,8 @@ static int reiserfs_fill_super(struct super_block *s, void *data, int silent)
}
// define and initialize hash function
s->u.reiserfs_sb.s_hash_function = hash_function (s);
if (s->u.reiserfs_sb.s_hash_function == NULL) {
sbi->s_hash_function = hash_function (s);
if (sbi->s_hash_function == NULL) {
dput(s->s_root) ;
s->s_root = NULL ;
goto error ;
......@@ -1078,9 +1088,9 @@ static int reiserfs_fill_super(struct super_block *s, void *data, int silent)
rs = SB_DISK_SUPER_BLOCK (s);
if (is_reiserfs_3_5 (rs) || (is_reiserfs_jr (rs) && SB_VERSION (s) == REISERFS_VERSION_1))
set_bit(REISERFS_3_5, &(s->u.reiserfs_sb.s_properties));
set_bit(REISERFS_3_5, &(sbi->s_properties));
else
set_bit(REISERFS_3_6, &(s->u.reiserfs_sb.s_properties));
set_bit(REISERFS_3_6, &(sbi->s_properties));
if (!(s->s_flags & MS_RDONLY)) {
......@@ -1105,8 +1115,8 @@ static int reiserfs_fill_super(struct super_block *s, void *data, int silent)
set_sb_version(rs,REISERFS_VERSION_2);
reiserfs_convert_objectid_map_v1(s) ;
set_bit(REISERFS_3_6, &(s->u.reiserfs_sb.s_properties));
clear_bit(REISERFS_3_5, &(s->u.reiserfs_sb.s_properties));
set_bit(REISERFS_3_6, &(sbi->s_properties));
clear_bit(REISERFS_3_5, &(sbi->s_properties));
} else {
reiserfs_warning("reiserfs: using 3.5.x disk format\n") ;
}
......@@ -1125,7 +1135,7 @@ static int reiserfs_fill_super(struct super_block *s, void *data, int silent)
}
}
// mark hash in super block: it could be unset. overwrite should be ok
set_sb_hash_function_code( rs, function2code(s->u.reiserfs_sb.s_hash_function ) );
set_sb_hash_function_code( rs, function2code(sbi->s_hash_function ) );
reiserfs_proc_info_init( s );
reiserfs_proc_register( s, "version", reiserfs_version_in_proc );
......@@ -1135,7 +1145,7 @@ static int reiserfs_fill_super(struct super_block *s, void *data, int silent)
reiserfs_proc_register( s, "on-disk-super", reiserfs_on_disk_super_in_proc );
reiserfs_proc_register( s, "oidmap", reiserfs_oidmap_in_proc );
reiserfs_proc_register( s, "journal", reiserfs_journal_in_proc );
init_waitqueue_head (&(s->u.reiserfs_sb.s_wait));
init_waitqueue_head (&(sbi->s_wait));
return 0;
......@@ -1154,6 +1164,9 @@ static int reiserfs_fill_super(struct super_block *s, void *data, int silent)
if (SB_BUFFER_WITH_SB (s))
brelse(SB_BUFFER_WITH_SB (s));
kfree(sbi);
s->u.generic_sbp = NULL;
return -EINVAL;
}
......
......@@ -35,7 +35,7 @@ int direct2indirect (struct reiserfs_transaction_handle *th, struct inode * inod
tree. */
sb->u.reiserfs_sb.s_direct2indirect ++;
REISERFS_SB(sb)->s_direct2indirect ++;
n_blk_size = sb->s_blocksize;
......@@ -202,7 +202,7 @@ int indirect2direct (struct reiserfs_transaction_handle *th,
loff_t pos, pos1; /* position of first byte of the tail */
struct cpu_key key;
p_s_sb->u.reiserfs_sb.s_indirect2direct ++;
REISERFS_SB(p_s_sb)->s_indirect2direct ++;
*p_c_mode = M_SKIP_BALANCING;
......
......@@ -651,7 +651,6 @@ struct quota_mount_options
#include <linux/ufs_fs_sb.h>
#include <linux/romfs_fs_sb.h>
#include <linux/adfs_fs_sb.h>
#include <linux/reiserfs_fs_sb.h>
#include <linux/bfs_fs_sb.h>
extern struct list_head super_blocks;
......@@ -696,7 +695,6 @@ struct super_block {
struct ufs_sb_info ufs_sb;
struct romfs_sb_info romfs_sb;
struct adfs_sb_info adfs_sb;
struct reiserfs_sb_info reiserfs_sb;
struct bfs_sb_info bfs_sb;
void *generic_sbp;
} u;
......
......@@ -21,6 +21,7 @@
#include <linux/bitops.h>
#include <linux/proc_fs.h>
#include <linux/reiserfs_fs_i.h>
#include <linux/reiserfs_fs_sb.h>
#endif
/*
......@@ -96,7 +97,7 @@ if( !( cond ) ) \
/***************************************************************************/
/*
* Structure of super block on disk, a version of which in RAM is often accessed as s->u.reiserfs_sb.s_rs
* Structure of super block on disk, a version of which in RAM is often accessed as REISERFS_SB(s)->s_rs
* the version in RAM is part of a larger structure containing fields never written to disk.
*/
#define UNSET_HASH 0 // read_super will guess about, what hash names
......@@ -176,7 +177,7 @@ struct reiserfs_super_block
// on-disk super block fields converted to cpu form
#define SB_DISK_SUPER_BLOCK(s) ((s)->u.reiserfs_sb.s_rs)
#define SB_DISK_SUPER_BLOCK(s) (REISERFS_SB(s)->s_rs)
#define SB_V1_DISK_SUPER_BLOCK(s) (&(SB_DISK_SUPER_BLOCK(s)->s_v1))
#define SB_BLOCKSIZE(s) \
le32_to_cpu ((SB_V1_DISK_SUPER_BLOCK(s)->s_blocksize))
......@@ -287,6 +288,12 @@ static inline struct reiserfs_inode_info *REISERFS_I(struct inode *inode)
{
return list_entry(inode, struct reiserfs_inode_info, vfs_inode);
}
static inline struct reiserfs_sb_info *REISERFS_SB(const struct super_block *sb)
{
return sb->u.generic_sbp;
}
/** this says about version of key of all items (but stat data) the
object consists of */
#define get_inode_item_key_version( inode ) \
......@@ -1284,7 +1291,7 @@ static inline loff_t max_reiserfs_offset (struct inode * inode)
#define REISERFS_KERNEL_MEM 0 /* reiserfs kernel memory mode */
#define REISERFS_USER_MEM 1 /* reiserfs user memory mode */
#define fs_generation(s) ((s)->u.reiserfs_sb.s_generation_counter)
#define fs_generation(s) (REISERFS_SB(s)->s_generation_counter)
#define get_generation(s) atomic_read (&fs_generation(s))
#define FILESYSTEM_CHANGED_TB(tb) (get_generation((tb)->tb_sb) != (tb)->fs_gen)
#define fs_changed(gen,s) (gen != get_generation (s))
......@@ -1884,10 +1891,10 @@ int reiserfs_journal_in_proc( char *buffer, char **start, off_t offset,
#define PROC_EXP( e ) e
#define MAX( a, b ) ( ( ( a ) > ( b ) ) ? ( a ) : ( b ) )
#define __PINFO( sb ) ( sb ) -> u.reiserfs_sb.s_proc_info_data
#define __PINFO( sb ) REISERFS_SB(sb) -> s_proc_info_data
#define PROC_INFO_MAX( sb, field, value ) \
__PINFO( sb ).field = \
MAX( ( sb ) -> u.reiserfs_sb.s_proc_info_data.field, value )
MAX( REISERFS_SB( sb ) -> s_proc_info_data.field, value )
#define PROC_INFO_INC( sb, field ) ( ++ ( __PINFO( sb ).field ) )
#define PROC_INFO_ADD( sb, field, val ) ( __PINFO( sb ).field += ( val ) )
#define PROC_INFO_BH_STAT( sb, bh, level ) \
......
......@@ -412,20 +412,20 @@ struct reiserfs_sb_info
#define REISERFS_TEST3 13
#define REISERFS_TEST4 14
#define reiserfs_r5_hash(s) ((s)->u.reiserfs_sb.s_mount_opt & (1 << FORCE_R5_HASH))
#define reiserfs_rupasov_hash(s) ((s)->u.reiserfs_sb.s_mount_opt & (1 << FORCE_RUPASOV_HASH))
#define reiserfs_tea_hash(s) ((s)->u.reiserfs_sb.s_mount_opt & (1 << FORCE_TEA_HASH))
#define reiserfs_hash_detect(s) ((s)->u.reiserfs_sb.s_mount_opt & (1 << FORCE_HASH_DETECT))
#define reiserfs_no_border(s) ((s)->u.reiserfs_sb.s_mount_opt & (1 << REISERFS_NO_BORDER))
#define reiserfs_no_unhashed_relocation(s) ((s)->u.reiserfs_sb.s_mount_opt & (1 << REISERFS_NO_UNHASHED_RELOCATION))
#define reiserfs_hashed_relocation(s) ((s)->u.reiserfs_sb.s_mount_opt & (1 << REISERFS_HASHED_RELOCATION))
#define reiserfs_test4(s) ((s)->u.reiserfs_sb.s_mount_opt & (1 << REISERFS_TEST4))
#define dont_have_tails(s) ((s)->u.reiserfs_sb.s_mount_opt & (1 << NOTAIL))
#define replay_only(s) ((s)->u.reiserfs_sb.s_mount_opt & (1 << REPLAYONLY))
#define reiserfs_dont_log(s) ((s)->u.reiserfs_sb.s_mount_opt & (1 << REISERFS_NOLOG))
#define old_format_only(s) ((s)->u.reiserfs_sb.s_properties & (1 << REISERFS_3_5))
#define convert_reiserfs(s) ((s)->u.reiserfs_sb.s_mount_opt & (1 << REISERFS_CONVERT))
#define reiserfs_r5_hash(s) (REISERFS_SB(s)->s_mount_opt & (1 << FORCE_R5_HASH))
#define reiserfs_rupasov_hash(s) (REISERFS_SB(s)->s_mount_opt & (1 << FORCE_RUPASOV_HASH))
#define reiserfs_tea_hash(s) (REISERFS_SB(s)->s_mount_opt & (1 << FORCE_TEA_HASH))
#define reiserfs_hash_detect(s) (REISERFS_SB(s)->s_mount_opt & (1 << FORCE_HASH_DETECT))
#define reiserfs_no_border(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_NO_BORDER))
#define reiserfs_no_unhashed_relocation(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_NO_UNHASHED_RELOCATION))
#define reiserfs_hashed_relocation(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_HASHED_RELOCATION))
#define reiserfs_test4(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_TEST4))
#define dont_have_tails(s) (REISERFS_SB(s)->s_mount_opt & (1 << NOTAIL))
#define replay_only(s) (REISERFS_SB(s)->s_mount_opt & (1 << REPLAYONLY))
#define reiserfs_dont_log(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_NOLOG))
#define old_format_only(s) (REISERFS_SB(s)->s_properties & (1 << REISERFS_3_5))
#define convert_reiserfs(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_CONVERT))
void reiserfs_file_buffer (struct buffer_head * bh, int list);
......@@ -439,13 +439,13 @@ int reiserfs_resize(struct super_block *, unsigned long) ;
#define SCHEDULE_OCCURRED 1
#define SB_BUFFER_WITH_SB(s) ((s)->u.reiserfs_sb.s_sbh)
#define SB_JOURNAL(s) ((s)->u.reiserfs_sb.s_journal)
#define SB_BUFFER_WITH_SB(s) (REISERFS_SB(s)->s_sbh)
#define SB_JOURNAL(s) (REISERFS_SB(s)->s_journal)
#define SB_JOURNAL_1st_RESERVED_BLOCK(s) (SB_JOURNAL(s)->j_1st_reserved_block)
#define SB_JOURNAL_LIST(s) (SB_JOURNAL(s)->j_journal_list)
#define SB_JOURNAL_LIST_INDEX(s) (SB_JOURNAL(s)->j_journal_list_index)
#define SB_JOURNAL_LEN_FREE(s) (SB_JOURNAL(s)->j_journal_len_free)
#define SB_AP_BITMAP(s) ((s)->u.reiserfs_sb.s_ap_bitmap)
#define SB_AP_BITMAP(s) (REISERFS_SB(s)->s_ap_bitmap)
#define SB_DISK_JOURNAL_HEAD(s) (SB_JOURNAL(s)->j_header_bh->)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment