* stage2/fsys_reiserfs.c (reiserfs_super_block): Updated

to better match recent reiserfs versions.
(reiserfs_mount): Handle cases where journal can't be found,
e.g. journal on another disk or unexpected journal parameters.
In that case the journal isn't used.
This commit is contained in:
jochen 2001-10-11 11:14:29 +00:00
parent 62e7ed8b60
commit 3793b1777b
2 changed files with 26 additions and 17 deletions

View file

@ -1,3 +1,11 @@
2001-10-11 Jochen Hoenicke <jochen@gnu.org>
* stage2/fsys_reiserfs.c (reiserfs_super_block): Updated
to better match recent reiserfs versions.
(reiserfs_mount): Handle cases where journal can't be found,
e.g. journal on another disk or unexpected journal parameters.
In that case the journal isn't used.
2001-10-10 Jochen Hoenicke <jochen@gnu.org> 2001-10-10 Jochen Hoenicke <jochen@gnu.org>
* stage2/fsys_reiserfs.c (reiserfs_mount): Don't look at * stage2/fsys_reiserfs.c (reiserfs_mount): Don't look at

View file

@ -57,12 +57,12 @@ struct reiserfs_super_block
__u32 s_root_block; /* root block number */ __u32 s_root_block; /* root block number */
__u32 s_journal_block; /* journal block number */ __u32 s_journal_block; /* journal block number */
__u32 s_journal_dev; /* journal device number */ __u32 s_journal_dev; /* journal device number */
__u32 s_orig_journal_size; /* size of the journal on FS creation. used to make sure they don't overflow it */ __u32 s_journal_size; /* size of the journal on FS creation. used to make sure they don't overflow it */
__u32 s_journal_trans_max ; /* max number of blocks in a transaction. */ __u32 s_journal_trans_max; /* max number of blocks in a transaction. */
__u32 s_journal_block_count ; /* total size of the journal. can change over time */ __u32 s_journal_magic; /* random value made on fs creation */
__u32 s_journal_max_batch ; /* max number of blocks to batch into a trans */ __u32 s_journal_max_batch; /* max number of blocks to batch into a trans */
__u32 s_journal_max_commit_age ; /* in seconds, how old can an async commit be */ __u32 s_journal_max_commit_age; /* in seconds, how old can an async commit be */
__u32 s_journal_max_trans_age ; /* in seconds, how old can a transaction be */ __u32 s_journal_max_trans_age; /* in seconds, how old can a transaction be */
__u16 s_blocksize; /* block size */ __u16 s_blocksize; /* block size */
__u16 s_oid_maxsize; /* max size of object id array */ __u16 s_oid_maxsize; /* max size of object id array */
__u16 s_oid_cursize; /* current size of object id array */ __u16 s_oid_cursize; /* current size of object id array */
@ -296,19 +296,21 @@ struct reiserfs_de_head
#define FSYSREISER_MIN_BLOCKSIZE SECTOR_SIZE #define FSYSREISER_MIN_BLOCKSIZE SECTOR_SIZE
#define FSYSREISER_MAX_BLOCKSIZE FSYSREISER_CACHE_SIZE / 3 #define FSYSREISER_MAX_BLOCKSIZE FSYSREISER_CACHE_SIZE / 3
/* Info about currently opened file */
struct fsys_reiser_fileinfo struct fsys_reiser_fileinfo
{ {
__u32 k_dir_id; __u32 k_dir_id;
__u32 k_objectid; __u32 k_objectid;
}; };
/* In memory info about the currently mounted filesystem */
struct fsys_reiser_info struct fsys_reiser_info
{ {
/* The last read item head */ /* The last read item head */
struct item_head *current_ih; struct item_head *current_ih;
/* The last read item */ /* The last read item */
char *current_item; char *current_item;
/* The information for the currently open file */ /* The information for the currently opened file */
struct fsys_reiser_fileinfo fileinfo; struct fsys_reiser_fileinfo fileinfo;
/* The start of the journal */ /* The start of the journal */
__u32 journal_block; __u32 journal_block;
@ -485,7 +487,6 @@ journal_init (void)
if (desc_block >= block_count) if (desc_block >= block_count)
return 0; return 0;
INFO->journal_transactions = 0;
INFO->journal_first_desc = desc_block; INFO->journal_first_desc = desc_block;
next_trans_id = header.j_last_flush_trans_id + 1; next_trans_id = header.j_last_flush_trans_id + 1;
@ -617,17 +618,17 @@ reiserfs_mount (void)
|| (SECTOR_SIZE << INFO->blocksize_shift) != super.s_blocksize) || (SECTOR_SIZE << INFO->blocksize_shift) != super.s_blocksize)
return 0; return 0;
if (super.s_journal_block != 0) /* Initialize journal code. If something fails we end with zero
* journal_transactions, so we don't access the journal at all.
*/
INFO->journal_transactions = 0;
if (super.s_journal_block != 0 && super.s_journal_dev == 0)
{ {
INFO->journal_block = super.s_journal_block; INFO->journal_block = super.s_journal_block;
/* I am not using s_journal_block_count here, because INFO->journal_block_count = super.s_journal_size;
* that field doesn't contain any sane value. if (is_power_of_two (INFO->journal_block_count))
*/ journal_init ();
INFO->journal_block_count = super.s_orig_journal_size;
if (! is_power_of_two (INFO->journal_block_count))
return 0;
journal_init ();
/* Read in super block again, maybe it is in the journal */ /* Read in super block again, maybe it is in the journal */
block_read (superblock >> INFO->blocksize_shift, block_read (superblock >> INFO->blocksize_shift,
0, sizeof (struct reiserfs_super_block), (char *) &super); 0, sizeof (struct reiserfs_super_block), (char *) &super);
@ -657,7 +658,7 @@ reiserfs_mount (void)
/***************** TREE ACCESSING METHODS *****************************/ /***************** TREE ACCESSING METHODS *****************************/
/* I assume you are familiar with the ReiserFS tree, if not go to /* I assume you are familiar with the ReiserFS tree, if not go to
* http://devlinux.com/projects/reiserfs/ * http://www.namesys.com/content_table.html
* *
* My tree node cache is organized as following * My tree node cache is organized as following
* 0 ROOT node * 0 ROOT node