reiserfs-journal-relocation.diff
PATCH 1/1 reiserfs-journal-relocation.diff
Hello.
This patch (against 2.5.2-pre11) is to support reiserfs journal on various block devices. The project was ordered and sponsored by ApplianceWare.
Please, apply.
Thanks,
Edward.
fs/reiserfs/Makefile +1 -1
@@ -9,7 +9,7 @@ O_TARGET := reiserfs.o obj-y := bitmap.o do_balan.o namei.o inode.o file.o dir.o fix_node.o super.o prints.o objectid.o \ -lbalance.o ibalance.o stree.o hashes.o buffer2.o tail_conversion.o journal.o resize.o tail_conversion.o version.o item_ops.o ioctl.o procfs.o +lbalance.o ibalance.o stree.o hashes.o buffer2.o tail_conversion.o journal.o resize.o tail_conversion.o item_ops.o ioctl.o procfs.o obj-m := $(O_TARGET)
fs/reiserfs/bitmap.c +12 -9
@@ -382,16 +382,18 @@ goto free_and_return ; } search_start = new_block ; -if (search_start >=reiserfs_get_journal_block (s) && - search_start < (reiserfs_get_journal_block (s) +JOURNAL_BLOCK_COUNT )) { -reiserfs_warning ("vs-4130: reiserfs_new_blocknrs: trying to allocate log block %lu\n" , - search_start) ; - search_start++ ; - amount_needed++ ; -continue ; - } - + +/* make sure the block is not of journal or reserved area */ +if (is_block_in_log_or_reserved_area (s, search_start)) { +reiserfs_warning ("vs-4130: reiserfs_new_blocknrs: trying to allocate log block %lu\n" , + search_start) ; + search_start++ ; + amount_needed++ ; +continue ; + } + +reiserfs_prepare_for_journal (s,SB_AP_BITMAP (s)[i],1 ) ; RFALSE( buffer_locked (SB_AP_BITMAP (s)[i]) ||
@@ -588,6 +590,7 @@ *free_blocknrs =0 ; blks =PREALLOCATION_SIZE -1 ;for (blks_gotten=0 ; blks_gotten<PREALLOCATION_SIZE ; blks_gotten++) { + ret = do_reiserfs_new_blocknrs(th, free_blocknrs, search_start, 1/*amount_needed*/, 0/*for root reserved*/,
fs/reiserfs/journal.c +267 -74
633 lines not on this page · raw message
fs/reiserfs/objectid.c +9 -6
@@ -5,9 +5,10 @@#include <linux/config.h> #include <linux/string.h> #include <linux/locks.h> +#include <linux/random.h> #include <linux/sched.h> #include <linux/reiserfs_fs.h> - +#include <linux/reiserfs_fs_sb.h> // find where objectid map starts #define objectid_map (s,rs) (old_format_only (s) ? \
@@ -145,7 +146,7 @@ }/* JDM comparing two little-endian values for equality -- safe */ -if (rs->s_oid_cursize == rs->s_oid_maxsize) { +if (sb_oid_cursize (rs) ==sb_oid_maxsize (rs)) {/* objectid map must be expanded, but there is no space */ PROC_INFO_INC ( s, leaked_oid );return ;
@@ -169,9 +170,9 @@int reiserfs_convert_objectid_map_v1 (struct super_block *s) {struct reiserfs_super_block *disk_sb =SB_DISK_SUPER_BLOCK (s); -int cur_size =le16_to_cpu (disk_sb->s_oid_cursize) ; +int cur_size =sb_oid_cursize (disk_sb);int new_size = (s->s_blocksize -SB_SIZE ) /sizeof (__u32) /2 *2 ; -int old_max =le16_to_cpu (disk_sb->s_oid_maxsize) ; +int old_max =sb_oid_maxsize (disk_sb);struct reiserfs_super_block_v1 *disk_sb_v1 ;__u32 *objectid_map, *new_objectid_map ;int i ;
@@ -185,7 +186,7 @@** map */ objectid_map[new_size -1 ] = objectid_map[cur_size -1 ] ; - disk_sb->s_oid_cursize =cpu_to_le16 (new_size) ; +set_sb_oid_cursize (disk_sb,new_size) ; }/* move the smaller objectid map past the end of the new super */ for (i = new_size -1 ; i >=0 ; i--) {
@@ -194,9 +195,11 @@/* set the max size so we don't overflow later */ - disk_sb->s_oid_maxsize =cpu_to_le16 (new_size) ; +set_sb_oid_maxsize (disk_sb,new_size) ;/* finally, zero out the unused chunk of the new super */ +memset (disk_sb->s_label,0 ,sizeof (disk_sb->s_label)) ; +generate_random_uuid (disk_sb->s_uuid);memset (disk_sb->s_unused,0 ,sizeof (disk_sb->s_unused)) ;return 0 ; }
fs/reiserfs/prints.c +17 -18
@@ -485,12 +485,13 @@char *version; -if (strncmp (rs->s_magic,REISERFS_SUPER_MAGIC_STRING , -strlen (REISERFS_SUPER_MAGIC_STRING )) ==0 ) { +if (is_reiserfs_3_5 (rs)) { version ="3.5" ; - }else if (strncmp (rs->s_magic,REISER2FS_SUPER_MAGIC_STRING , -strlen (REISER2FS_SUPER_MAGIC_STRING )) ==0 ) { + }else if (is_reiserfs_3_6 (rs)) { version ="3.6" ; + }else if (is_reiserfs_jr (rs)) { + version = ((sb_version (rs) ==REISERFS_VERSION_2 ) ? +"3.6" :"3.5" ); }else {return 1 ; }
@@ -505,27 +506,25 @@// someone stores reiserfs super block in some data block ;) // skipped = (bh->b_blocknr * bh->b_size) / sb_blocksize(rs); skipped = bh->b_blocknr; - data_blocks =sb_block_count (rs) - skipped -1 - -sb_bmap_nr (rs) - (sb_orig_journal_size (rs) +1 ) - -sb_free_blocks (rs); -printk ("Busy blocks (skipped %d, bitmaps - %d, journal blocks - %d\n" -"1 super blocks, %d data blocks\n" , - skipped,sb_bmap_nr (rs), - (sb_orig_journal_size (rs) +1 ), data_blocks); + data_blocks =sb_block_count (rs) - skipped -1 -sb_bmap_nr (rs) - + (!is_reiserfs_jr (rs) ?sb_jp_journal_size (rs) +1 :sb_reserved_for_journal (rs)) - +sb_free_blocks (rs); +printk ("Busy blocks (skipped %d, bitmaps - %d, journal (or reserved) blocks - %d\n" +"1 super block, %d data blocks\n" , + skipped,sb_bmap_nr (rs), (!is_reiserfs_jr (rs) ? (sb_jp_journal_size (rs) +1 ) : +sb_reserved_for_journal (rs)) , data_blocks);printk ("Root block %u\n" ,sb_root_block (rs)); -printk ("Journal block (first) %d\n" ,sb_journal_block (rs)); -printk ("Journal dev %d\n" ,sb_journal_dev (rs)); -printk ("Journal orig size %d\n" ,sb_orig_journal_size (rs)); -printk ("Filesystem state %s\n" , - (sb_state (rs) ==REISERFS_VALID_FS ) ?"VALID" :"ERROR" ); +printk ("Journal block (first) %d\n" ,sb_jp_journal_1st_block (rs)); +printk ("Journal dev %d\n" ,sb_jp_journal_dev (rs)); +printk ("Journal orig size %d\n" ,sb_jp_journal_size (rs)); +printk ("FS state %d\n" ,sb_fs_state (rs));printk ("Hash function \"%s\"\n" ,sb_hash_function_code (rs) ==TEA_HASH ?"tea" : (sb_hash_function_code (rs) ==YURA_HASH ?"rupasov" : (sb_hash_function_code (rs) ==R5_HASH ?"r5" :"unknown" ))); - +printk ("Tree height %d\n" ,sb_tree_height (rs));return 0 ; } -static int print_desc_block (struct buffer_head * bh) {
fs/reiserfs/procfs.c +46 -45
204 lines not on this page · raw message
fs/reiserfs/resize.c +1 -1
@@ -112,7 +112,7 @@ bitmap[i] =SB_AP_BITMAP (s)[i];for (i = bmap_nr; i < bmap_nr_new; i++) { bitmap[i] =reiserfs_getblk (s, i * s->s_blocksize *8 ); -memset (bitmap[i]->b_data,0 , sb->s_blocksize); +memset (bitmap[i]->b_data,0 ,sb_blocksize (sb));reiserfs_test_and_set_le_bit (0 , bitmap[i]->b_data);mark_buffer_dirty (bitmap[i]) ;
fs/reiserfs/super.c +106 -77
307 lines not on this page · raw message
fs/reiserfs/version.c +0 -7
@@ -1,7 +0,0 @@ -/* -* Copyright 2000 by Hans Reiser, licensing governed by reiserfs/README -*/ - -char *reiserfs_get_version_string (void ) { -return "ReiserFS version 3.6.25" ; -}
include/linux/reiserfs_fs.h +149 -21
226 lines not on this page · raw message
include/linux/reiserfs_fs_sb.h +78 -149
274 lines not on this page · raw message