--- linux/include/linux/reiserfs_fs_sb.h.orig Fri Dec 14 12:52:46 2001 +++ linux/include/linux/reiserfs_fs_sb.h Fri Dec 14 18:31:59 2001 @@ -407,6 +407,8 @@ /* To be obsoleted soon by per buffer seals.. -Hans */ atomic_t s_generation_counter; // increased by one every time the // tree gets re-balanced + unsigned int s_properties; /* File system properties. Currently holds + on-disk FS format */ /* session statistics */ int s_kmallocs; @@ -424,7 +426,11 @@ struct proc_dir_entry *procdir; }; +/* Definitions of reiserfs on-disk properties: */ +#define REISERFS_3_5 0 +#define REISERFS_3_6 1 +/* Mount options */ #define NOTAIL 0 /* -o notail: no tails will be created in a session */ #define REPLAYONLY 3 /* replay journal and return 0. Use by fsck */ #define REISERFS_NOLOG 4 /* -o nolog: turn journalling off */ @@ -474,7 +480,8 @@ #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) ((SB_VERSION(s) != REISERFS_VERSION_2) && !((s)->u.reiserfs_sb.s_mount_opt & (1 << REISERFS_CONVERT))) +#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)) void reiserfs_file_buffer (struct buffer_head * bh, int list); --- linux/fs/reiserfs/super.c.orig Fri Dec 14 12:53:16 2001 +++ linux/fs/reiserfs/super.c Fri Dec 14 18:34:11 2001 @@ -724,19 +724,21 @@ if ( old_magic ) { // filesystem created under 3.5.x found - if (!old_format_only (s)) { + if (convert_reiserfs(s)) { reiserfs_warning("reiserfs: converting 3.5.x filesystem to the new format\n") ; // after this 3.5.x will not be able to mount this partition memcpy (rs->s_magic, REISER2FS_SUPER_MAGIC_STRING, sizeof (REISER2FS_SUPER_MAGIC_STRING)); reiserfs_convert_objectid_map_v1(s) ; + set_bit(REISERFS_3_6, &(s->u.reiserfs_sb.s_properties)); } else { reiserfs_warning("reiserfs: using 3.5.x disk format\n") ; + set_bit(REISERFS_3_5, &(s->u.reiserfs_sb.s_properties)); } } else { // new format found - set_bit (REISERFS_CONVERT, &(s->u.reiserfs_sb.s_mount_opt)); + set_bit(REISERFS_3_6, &(s->u.reiserfs_sb.s_properties)); } // mark hash in super block: it could be unset. overwrite should be ok @@ -750,7 +752,9 @@ if (strncmp (rs->s_magic, REISER2FS_SUPER_MAGIC_STRING, strlen ( REISER2FS_SUPER_MAGIC_STRING))) { reiserfs_warning("reiserfs: using 3.5.x disk format\n") ; - } + set_bit(REISERFS_3_5, &(s->u.reiserfs_sb.s_properties)); + } else + set_bit(REISERFS_3_6, &(s->u.reiserfs_sb.s_properties)); } reiserfs_proc_info_init( s ); --- linux/fs/reiserfs/procfs.c.orig Fri Dec 14 12:53:16 2001 +++ linux/fs/reiserfs/procfs.c Fri Dec 14 18:31:59 2001 @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include @@ -76,12 +77,20 @@ { int len = 0; struct super_block *sb; + char *format; sb = procinfo_prologue( ( kdev_t ) ( int ) data ); if( sb == NULL ) return -ENOENT; + if ( sb->u.reiserfs_sb.s_properties & (1 << REISERFS_3_6) ) { + format = "3.6"; + } else if ( sb->u.reiserfs_sb.s_properties & (1 << REISERFS_3_5) ) { + format = "3.5"; + } else { + format = "unknown"; + } len += sprintf( &buffer[ len ], "%s format\twith checks %s\n", - old_format_only( sb ) ? "old" : "new", + format, #if defined( CONFIG_REISERFS_CHECK ) "on" #else @@ -179,7 +188,7 @@ dont_have_tails( sb ) ? "NO_TAILS " : "TAILS ", replay_only( sb ) ? "REPLAY_ONLY " : "", reiserfs_dont_log( sb ) ? "DONT_LOG " : "LOG ", - old_format_only( sb ) ? "CONV " : "", + convert_reiserfs( sb ) ? "CONV " : "", atomic_read( &r -> s_generation_counter ), SF( s_kmallocs ), .