diff options
Diffstat (limited to 'fs/reiserfs')
-rw-r--r-- | fs/reiserfs/bitmap.c | 11 | ||||
-rw-r--r-- | fs/reiserfs/dir.c | 8 | ||||
-rw-r--r-- | fs/reiserfs/file.c | 13 | ||||
-rw-r--r-- | fs/reiserfs/inode.c | 14 | ||||
-rw-r--r-- | fs/reiserfs/item_ops.c | 5 | ||||
-rw-r--r-- | fs/reiserfs/journal.c | 14 | ||||
-rw-r--r-- | fs/reiserfs/namei.c | 2 | ||||
-rw-r--r-- | fs/reiserfs/objectid.c | 18 | ||||
-rw-r--r-- | fs/reiserfs/procfs.c | 4 | ||||
-rw-r--r-- | fs/reiserfs/stree.c | 51 | ||||
-rw-r--r-- | fs/reiserfs/super.c | 35 |
11 files changed, 92 insertions, 83 deletions
diff --git a/fs/reiserfs/bitmap.c b/fs/reiserfs/bitmap.c index a4e2ed544bbe..49c479c9454a 100644 --- a/fs/reiserfs/bitmap.c +++ b/fs/reiserfs/bitmap.c | |||
@@ -260,8 +260,9 @@ static inline int block_group_used(struct super_block *s, u32 id) { | |||
260 | /* | 260 | /* |
261 | * the packing is returned in disk byte order | 261 | * the packing is returned in disk byte order |
262 | */ | 262 | */ |
263 | u32 reiserfs_choose_packing(struct inode *dir) { | 263 | __le32 reiserfs_choose_packing(struct inode *dir) |
264 | u32 packing; | 264 | { |
265 | __le32 packing; | ||
265 | if (TEST_OPTION(packing_groups, dir->i_sb)) { | 266 | if (TEST_OPTION(packing_groups, dir->i_sb)) { |
266 | u32 parent_dir = le32_to_cpu(INODE_PKEY(dir)->k_dir_id); | 267 | u32 parent_dir = le32_to_cpu(INODE_PKEY(dir)->k_dir_id); |
267 | /* | 268 | /* |
@@ -655,7 +656,7 @@ static int get_left_neighbor(reiserfs_blocknr_hint_t *hint) | |||
655 | struct buffer_head * bh; | 656 | struct buffer_head * bh; |
656 | struct item_head * ih; | 657 | struct item_head * ih; |
657 | int pos_in_item; | 658 | int pos_in_item; |
658 | __u32 * item; | 659 | __le32 * item; |
659 | int ret = 0; | 660 | int ret = 0; |
660 | 661 | ||
661 | if (!hint->path) /* reiserfs code can call this function w/o pointer to path | 662 | if (!hint->path) /* reiserfs code can call this function w/o pointer to path |
@@ -736,7 +737,7 @@ static inline int this_blocknr_allocation_would_make_it_a_large_file(reiserfs_bl | |||
736 | #ifdef DISPLACE_NEW_PACKING_LOCALITIES | 737 | #ifdef DISPLACE_NEW_PACKING_LOCALITIES |
737 | static inline void displace_new_packing_locality (reiserfs_blocknr_hint_t *hint) | 738 | static inline void displace_new_packing_locality (reiserfs_blocknr_hint_t *hint) |
738 | { | 739 | { |
739 | struct reiserfs_key * key = &hint->key; | 740 | struct in_core_key * key = &hint->key; |
740 | 741 | ||
741 | hint->th->displace_new_blocks = 0; | 742 | hint->th->displace_new_blocks = 0; |
742 | hint->search_start = hint->beg + keyed_hash((char*)(&key->k_objectid),4) % (hint->end - hint->beg); | 743 | hint->search_start = hint->beg + keyed_hash((char*)(&key->k_objectid),4) % (hint->end - hint->beg); |
@@ -777,7 +778,7 @@ static inline int old_way (reiserfs_blocknr_hint_t * hint) | |||
777 | 778 | ||
778 | static inline void hundredth_slices (reiserfs_blocknr_hint_t * hint) | 779 | static inline void hundredth_slices (reiserfs_blocknr_hint_t * hint) |
779 | { | 780 | { |
780 | struct reiserfs_key * key = &hint->key; | 781 | struct in_core_key * key = &hint->key; |
781 | b_blocknr_t slice_start; | 782 | b_blocknr_t slice_start; |
782 | 783 | ||
783 | slice_start = (keyed_hash((char*)(&key->k_dir_id),4) % 100) * (hint->end / 100); | 784 | slice_start = (keyed_hash((char*)(&key->k_dir_id),4) % 100) * (hint->end / 100); |
diff --git a/fs/reiserfs/dir.c b/fs/reiserfs/dir.c index d1514a9b0514..fbde4b01a325 100644 --- a/fs/reiserfs/dir.c +++ b/fs/reiserfs/dir.c | |||
@@ -209,8 +209,8 @@ static int reiserfs_readdir (struct file * filp, void * dirent, filldir_t filldi | |||
209 | /* compose directory item containing "." and ".." entries (entries are | 209 | /* compose directory item containing "." and ".." entries (entries are |
210 | not aligned to 4 byte boundary) */ | 210 | not aligned to 4 byte boundary) */ |
211 | /* the last four params are LE */ | 211 | /* the last four params are LE */ |
212 | void make_empty_dir_item_v1 (char * body, __u32 dirid, __u32 objid, | 212 | void make_empty_dir_item_v1 (char * body, __le32 dirid, __le32 objid, |
213 | __u32 par_dirid, __u32 par_objid) | 213 | __le32 par_dirid, __le32 par_objid) |
214 | { | 214 | { |
215 | struct reiserfs_de_head * deh; | 215 | struct reiserfs_de_head * deh; |
216 | 216 | ||
@@ -242,8 +242,8 @@ void make_empty_dir_item_v1 (char * body, __u32 dirid, __u32 objid, | |||
242 | } | 242 | } |
243 | 243 | ||
244 | /* compose directory item containing "." and ".." entries */ | 244 | /* compose directory item containing "." and ".." entries */ |
245 | void make_empty_dir_item (char * body, __u32 dirid, __u32 objid, | 245 | void make_empty_dir_item (char * body, __le32 dirid, __le32 objid, |
246 | __u32 par_dirid, __u32 par_objid) | 246 | __le32 par_dirid, __le32 par_objid) |
247 | { | 247 | { |
248 | struct reiserfs_de_head * deh; | 248 | struct reiserfs_de_head * deh; |
249 | 249 | ||
diff --git a/fs/reiserfs/file.c b/fs/reiserfs/file.c index 26950113af8c..2230afff1870 100644 --- a/fs/reiserfs/file.c +++ b/fs/reiserfs/file.c | |||
@@ -166,7 +166,7 @@ static int reiserfs_allocate_blocks_for_region( | |||
166 | struct cpu_key key; // cpu key of item that we are going to deal with | 166 | struct cpu_key key; // cpu key of item that we are going to deal with |
167 | struct item_head *ih; // pointer to item head that we are going to deal with | 167 | struct item_head *ih; // pointer to item head that we are going to deal with |
168 | struct buffer_head *bh; // Buffer head that contains items that we are going to deal with | 168 | struct buffer_head *bh; // Buffer head that contains items that we are going to deal with |
169 | __u32 * item; // pointer to item we are going to deal with | 169 | __le32 * item; // pointer to item we are going to deal with |
170 | INITIALIZE_PATH(path); // path to item, that we are going to deal with. | 170 | INITIALIZE_PATH(path); // path to item, that we are going to deal with. |
171 | b_blocknr_t *allocated_blocks; // Pointer to a place where allocated blocknumbers would be stored. | 171 | b_blocknr_t *allocated_blocks; // Pointer to a place where allocated blocknumbers would be stored. |
172 | reiserfs_blocknr_hint_t hint; // hint structure for block allocator. | 172 | reiserfs_blocknr_hint_t hint; // hint structure for block allocator. |
@@ -891,7 +891,7 @@ static int reiserfs_prepare_file_region_for_write( | |||
891 | struct item_head *ih = NULL; // pointer to item head that we are going to deal with | 891 | struct item_head *ih = NULL; // pointer to item head that we are going to deal with |
892 | struct buffer_head *itembuf=NULL; // Buffer head that contains items that we are going to deal with | 892 | struct buffer_head *itembuf=NULL; // Buffer head that contains items that we are going to deal with |
893 | INITIALIZE_PATH(path); // path to item, that we are going to deal with. | 893 | INITIALIZE_PATH(path); // path to item, that we are going to deal with. |
894 | __u32 * item=NULL; // pointer to item we are going to deal with | 894 | __le32 * item=NULL; // pointer to item we are going to deal with |
895 | int item_pos=-1; /* Position in indirect item */ | 895 | int item_pos=-1; /* Position in indirect item */ |
896 | 896 | ||
897 | 897 | ||
@@ -1284,10 +1284,11 @@ static ssize_t reiserfs_file_write( struct file *file, /* the file we are going | |||
1284 | reiserfs_claim_blocks_to_be_allocated(inode->i_sb, num_pages << (PAGE_CACHE_SHIFT - inode->i_blkbits)); | 1284 | reiserfs_claim_blocks_to_be_allocated(inode->i_sb, num_pages << (PAGE_CACHE_SHIFT - inode->i_blkbits)); |
1285 | reiserfs_write_unlock(inode->i_sb); | 1285 | reiserfs_write_unlock(inode->i_sb); |
1286 | 1286 | ||
1287 | if ( !num_pages ) { /* If we do not have enough space even for */ | 1287 | if ( !num_pages ) { /* If we do not have enough space even for a single page... */ |
1288 | res = -ENOSPC; /* single page, return -ENOSPC */ | 1288 | if ( pos > inode->i_size+inode->i_sb->s_blocksize-(pos & (inode->i_sb->s_blocksize-1))) { |
1289 | if ( pos > (inode->i_size & (inode->i_sb->s_blocksize-1))) | 1289 | res = -ENOSPC; |
1290 | break; // In case we are writing past the file end, break. | 1290 | break; // In case we are writing past the end of the last file block, break. |
1291 | } | ||
1291 | // Otherwise we are possibly overwriting the file, so | 1292 | // Otherwise we are possibly overwriting the file, so |
1292 | // let's set write size to be equal or less than blocksize. | 1293 | // let's set write size to be equal or less than blocksize. |
1293 | // This way we get it correctly for file holes. | 1294 | // This way we get it correctly for file holes. |
diff --git a/fs/reiserfs/inode.c b/fs/reiserfs/inode.c index 7543031396f4..2711dff1b7b4 100644 --- a/fs/reiserfs/inode.c +++ b/fs/reiserfs/inode.c | |||
@@ -173,7 +173,7 @@ static inline void fix_tail_page_for_writing(struct page *page) { | |||
173 | done already or non-hole position has been found in the indirect item */ | 173 | done already or non-hole position has been found in the indirect item */ |
174 | static inline int allocation_needed (int retval, b_blocknr_t allocated, | 174 | static inline int allocation_needed (int retval, b_blocknr_t allocated, |
175 | struct item_head * ih, | 175 | struct item_head * ih, |
176 | __u32 * item, int pos_in_item) | 176 | __le32 * item, int pos_in_item) |
177 | { | 177 | { |
178 | if (allocated) | 178 | if (allocated) |
179 | return 0; | 179 | return 0; |
@@ -278,7 +278,7 @@ research: | |||
278 | bh = get_last_bh (&path); | 278 | bh = get_last_bh (&path); |
279 | ih = get_ih (&path); | 279 | ih = get_ih (&path); |
280 | if (is_indirect_le_ih (ih)) { | 280 | if (is_indirect_le_ih (ih)) { |
281 | __u32 * ind_item = (__u32 *)B_I_PITEM (bh, ih); | 281 | __le32 * ind_item = (__le32 *)B_I_PITEM (bh, ih); |
282 | 282 | ||
283 | /* FIXME: here we could cache indirect item or part of it in | 283 | /* FIXME: here we could cache indirect item or part of it in |
284 | the inode to avoid search_by_key in case of subsequent | 284 | the inode to avoid search_by_key in case of subsequent |
@@ -581,7 +581,7 @@ int reiserfs_get_block (struct inode * inode, sector_t block, | |||
581 | struct cpu_key key; | 581 | struct cpu_key key; |
582 | struct buffer_head * bh, * unbh = NULL; | 582 | struct buffer_head * bh, * unbh = NULL; |
583 | struct item_head * ih, tmp_ih; | 583 | struct item_head * ih, tmp_ih; |
584 | __u32 * item; | 584 | __le32 * item; |
585 | int done; | 585 | int done; |
586 | int fs_gen; | 586 | int fs_gen; |
587 | struct reiserfs_transaction_handle *th = NULL; | 587 | struct reiserfs_transaction_handle *th = NULL; |
@@ -746,7 +746,7 @@ start_trans: | |||
746 | done = 0; | 746 | done = 0; |
747 | do { | 747 | do { |
748 | if (is_statdata_le_ih (ih)) { | 748 | if (is_statdata_le_ih (ih)) { |
749 | __u32 unp = 0; | 749 | __le32 unp = 0; |
750 | struct cpu_key tmp_key; | 750 | struct cpu_key tmp_key; |
751 | 751 | ||
752 | /* indirect item has to be inserted */ | 752 | /* indirect item has to be inserted */ |
@@ -1341,8 +1341,8 @@ void reiserfs_read_locked_inode (struct inode * inode, struct reiserfs_iget_args | |||
1341 | key.version = KEY_FORMAT_3_5; | 1341 | key.version = KEY_FORMAT_3_5; |
1342 | key.on_disk_key.k_dir_id = dirino; | 1342 | key.on_disk_key.k_dir_id = dirino; |
1343 | key.on_disk_key.k_objectid = inode->i_ino; | 1343 | key.on_disk_key.k_objectid = inode->i_ino; |
1344 | key.on_disk_key.u.k_offset_v1.k_offset = SD_OFFSET; | 1344 | key.on_disk_key.k_offset = 0; |
1345 | key.on_disk_key.u.k_offset_v1.k_uniqueness = SD_UNIQUENESS; | 1345 | key.on_disk_key.k_type = 0; |
1346 | 1346 | ||
1347 | /* look for the object's stat data */ | 1347 | /* look for the object's stat data */ |
1348 | retval = search_item (inode->i_sb, &key, &path_to_sd); | 1348 | retval = search_item (inode->i_sb, &key, &path_to_sd); |
@@ -2067,7 +2067,7 @@ static int map_block_for_writepage(struct inode *inode, | |||
2067 | struct item_head tmp_ih ; | 2067 | struct item_head tmp_ih ; |
2068 | struct item_head *ih ; | 2068 | struct item_head *ih ; |
2069 | struct buffer_head *bh ; | 2069 | struct buffer_head *bh ; |
2070 | __u32 *item ; | 2070 | __le32 *item ; |
2071 | struct cpu_key key ; | 2071 | struct cpu_key key ; |
2072 | INITIALIZE_PATH(path) ; | 2072 | INITIALIZE_PATH(path) ; |
2073 | int pos_in_item ; | 2073 | int pos_in_item ; |
diff --git a/fs/reiserfs/item_ops.c b/fs/reiserfs/item_ops.c index 9cf7c13b120d..0ce33db1acdf 100644 --- a/fs/reiserfs/item_ops.c +++ b/fs/reiserfs/item_ops.c | |||
@@ -296,10 +296,11 @@ static void print_sequence (__u32 start, int len) | |||
296 | static void indirect_print_item (struct item_head * ih, char * item) | 296 | static void indirect_print_item (struct item_head * ih, char * item) |
297 | { | 297 | { |
298 | int j; | 298 | int j; |
299 | __u32 * unp, prev = INT_MAX; | 299 | __le32 * unp; |
300 | __u32 prev = INT_MAX; | ||
300 | int num; | 301 | int num; |
301 | 302 | ||
302 | unp = (__u32 *)item; | 303 | unp = (__le32 *)item; |
303 | 304 | ||
304 | if (ih_item_len(ih) % UNFM_P_SIZE) | 305 | if (ih_item_len(ih) % UNFM_P_SIZE) |
305 | reiserfs_warning (NULL, "indirect_print_item: invalid item len"); | 306 | reiserfs_warning (NULL, "indirect_print_item: invalid item len"); |
diff --git a/fs/reiserfs/journal.c b/fs/reiserfs/journal.c index c9ad3a7849f4..3072cfdee959 100644 --- a/fs/reiserfs/journal.c +++ b/fs/reiserfs/journal.c | |||
@@ -2306,13 +2306,16 @@ static int journal_init_dev( struct super_block *super, | |||
2306 | if( !IS_ERR( journal -> j_dev_file ) ) { | 2306 | if( !IS_ERR( journal -> j_dev_file ) ) { |
2307 | struct inode *jdev_inode = journal->j_dev_file->f_mapping->host; | 2307 | struct inode *jdev_inode = journal->j_dev_file->f_mapping->host; |
2308 | if( !S_ISBLK( jdev_inode -> i_mode ) ) { | 2308 | if( !S_ISBLK( jdev_inode -> i_mode ) ) { |
2309 | reiserfs_warning (super, "journal_init_dev: '%s' is " | 2309 | reiserfs_warning(super, "journal_init_dev: '%s' is " |
2310 | "not a block device", jdev_name ); | 2310 | "not a block device", jdev_name ); |
2311 | result = -ENOTBLK; | 2311 | result = -ENOTBLK; |
2312 | release_journal_dev( super, journal ); | ||
2312 | } else { | 2313 | } else { |
2313 | /* ok */ | 2314 | /* ok */ |
2314 | journal->j_dev_bd = I_BDEV(jdev_inode); | 2315 | journal->j_dev_bd = I_BDEV(jdev_inode); |
2315 | set_blocksize(journal->j_dev_bd, super->s_blocksize); | 2316 | set_blocksize(journal->j_dev_bd, super->s_blocksize); |
2317 | reiserfs_info(super, "journal_init_dev: journal device: %s\n", | ||
2318 | bdevname(journal->j_dev_bd, b)); | ||
2316 | } | 2319 | } |
2317 | } else { | 2320 | } else { |
2318 | result = PTR_ERR( journal -> j_dev_file ); | 2321 | result = PTR_ERR( journal -> j_dev_file ); |
@@ -2321,11 +2324,6 @@ static int journal_init_dev( struct super_block *super, | |||
2321 | "journal_init_dev: Cannot open '%s': %i", | 2324 | "journal_init_dev: Cannot open '%s': %i", |
2322 | jdev_name, result ); | 2325 | jdev_name, result ); |
2323 | } | 2326 | } |
2324 | if( result != 0 ) { | ||
2325 | release_journal_dev( super, journal ); | ||
2326 | } | ||
2327 | reiserfs_info(super, "journal_init_dev: journal device: %s\n", | ||
2328 | bdevname(journal->j_dev_bd, b)); | ||
2329 | return result; | 2327 | return result; |
2330 | } | 2328 | } |
2331 | 2329 | ||
@@ -2393,7 +2391,7 @@ int journal_init(struct super_block *p_s_sb, const char * j_dev_name, int old_fo | |||
2393 | jh = (struct reiserfs_journal_header *)(bhjh->b_data); | 2391 | jh = (struct reiserfs_journal_header *)(bhjh->b_data); |
2394 | 2392 | ||
2395 | /* make sure that journal matches to the super block */ | 2393 | /* make sure that journal matches to the super block */ |
2396 | if (is_reiserfs_jr(rs) && (jh->jh_journal.jp_journal_magic != sb_jp_journal_magic(rs))) { | 2394 | if (is_reiserfs_jr(rs) && (le32_to_cpu(jh->jh_journal.jp_journal_magic) != sb_jp_journal_magic(rs))) { |
2397 | reiserfs_warning (p_s_sb, "sh-460: journal header magic %x " | 2395 | reiserfs_warning (p_s_sb, "sh-460: journal header magic %x " |
2398 | "(device %s) does not match to magic found in super " | 2396 | "(device %s) does not match to magic found in super " |
2399 | "block %x", | 2397 | "block %x", |
diff --git a/fs/reiserfs/namei.c b/fs/reiserfs/namei.c index 80e92d9b81cb..7d4dc5f5aa8b 100644 --- a/fs/reiserfs/namei.c +++ b/fs/reiserfs/namei.c | |||
@@ -608,7 +608,7 @@ static int reiserfs_create (struct inode * dir, struct dentry *dentry, int mode, | |||
608 | goto out_failed; | 608 | goto out_failed; |
609 | } | 609 | } |
610 | 610 | ||
611 | retval = reiserfs_new_inode (&th, dir, mode, 0, 0/*i_size*/, dentry, inode); | 611 | retval = reiserfs_new_inode (&th, dir, mode, NULL, 0/*i_size*/, dentry, inode); |
612 | if (retval) | 612 | if (retval) |
613 | goto out_failed; | 613 | goto out_failed; |
614 | 614 | ||
diff --git a/fs/reiserfs/objectid.c b/fs/reiserfs/objectid.c index 0785c43a7486..bfe8e25ef293 100644 --- a/fs/reiserfs/objectid.c +++ b/fs/reiserfs/objectid.c | |||
@@ -11,13 +11,13 @@ | |||
11 | 11 | ||
12 | // find where objectid map starts | 12 | // find where objectid map starts |
13 | #define objectid_map(s,rs) (old_format_only (s) ? \ | 13 | #define objectid_map(s,rs) (old_format_only (s) ? \ |
14 | (__u32 *)((struct reiserfs_super_block_v1 *)(rs) + 1) :\ | 14 | (__le32 *)((struct reiserfs_super_block_v1 *)(rs) + 1) :\ |
15 | (__u32 *)((rs) + 1)) | 15 | (__le32 *)((rs) + 1)) |
16 | 16 | ||
17 | 17 | ||
18 | #ifdef CONFIG_REISERFS_CHECK | 18 | #ifdef CONFIG_REISERFS_CHECK |
19 | 19 | ||
20 | static void check_objectid_map (struct super_block * s, __u32 * map) | 20 | static void check_objectid_map (struct super_block * s, __le32 * map) |
21 | { | 21 | { |
22 | if (le32_to_cpu (map[0]) != 1) | 22 | if (le32_to_cpu (map[0]) != 1) |
23 | reiserfs_panic (s, "vs-15010: check_objectid_map: map corrupted: %lx", | 23 | reiserfs_panic (s, "vs-15010: check_objectid_map: map corrupted: %lx", |
@@ -27,7 +27,7 @@ static void check_objectid_map (struct super_block * s, __u32 * map) | |||
27 | } | 27 | } |
28 | 28 | ||
29 | #else | 29 | #else |
30 | static void check_objectid_map (struct super_block * s, __u32 * map) | 30 | static void check_objectid_map (struct super_block * s, __le32 * map) |
31 | {;} | 31 | {;} |
32 | #endif | 32 | #endif |
33 | 33 | ||
@@ -52,7 +52,7 @@ __u32 reiserfs_get_unused_objectid (struct reiserfs_transaction_handle *th) | |||
52 | { | 52 | { |
53 | struct super_block * s = th->t_super; | 53 | struct super_block * s = th->t_super; |
54 | struct reiserfs_super_block * rs = SB_DISK_SUPER_BLOCK (s); | 54 | struct reiserfs_super_block * rs = SB_DISK_SUPER_BLOCK (s); |
55 | __u32 * map = objectid_map (s, rs); | 55 | __le32 * map = objectid_map (s, rs); |
56 | __u32 unused_objectid; | 56 | __u32 unused_objectid; |
57 | 57 | ||
58 | BUG_ON (!th->t_trans_id); | 58 | BUG_ON (!th->t_trans_id); |
@@ -97,7 +97,7 @@ void reiserfs_release_objectid (struct reiserfs_transaction_handle *th, | |||
97 | { | 97 | { |
98 | struct super_block * s = th->t_super; | 98 | struct super_block * s = th->t_super; |
99 | struct reiserfs_super_block * rs = SB_DISK_SUPER_BLOCK (s); | 99 | struct reiserfs_super_block * rs = SB_DISK_SUPER_BLOCK (s); |
100 | __u32 * map = objectid_map (s, rs); | 100 | __le32 * map = objectid_map (s, rs); |
101 | int i = 0; | 101 | int i = 0; |
102 | 102 | ||
103 | BUG_ON (!th->t_trans_id); | 103 | BUG_ON (!th->t_trans_id); |
@@ -172,12 +172,12 @@ int reiserfs_convert_objectid_map_v1(struct super_block *s) { | |||
172 | int new_size = (s->s_blocksize - SB_SIZE) / sizeof(__u32) / 2 * 2 ; | 172 | int new_size = (s->s_blocksize - SB_SIZE) / sizeof(__u32) / 2 * 2 ; |
173 | int old_max = sb_oid_maxsize(disk_sb); | 173 | int old_max = sb_oid_maxsize(disk_sb); |
174 | struct reiserfs_super_block_v1 *disk_sb_v1 ; | 174 | struct reiserfs_super_block_v1 *disk_sb_v1 ; |
175 | __u32 *objectid_map, *new_objectid_map ; | 175 | __le32 *objectid_map, *new_objectid_map ; |
176 | int i ; | 176 | int i ; |
177 | 177 | ||
178 | disk_sb_v1=(struct reiserfs_super_block_v1 *)(SB_BUFFER_WITH_SB(s)->b_data); | 178 | disk_sb_v1=(struct reiserfs_super_block_v1 *)(SB_BUFFER_WITH_SB(s)->b_data); |
179 | objectid_map = (__u32 *)(disk_sb_v1 + 1) ; | 179 | objectid_map = (__le32 *)(disk_sb_v1 + 1) ; |
180 | new_objectid_map = (__u32 *)(disk_sb + 1) ; | 180 | new_objectid_map = (__le32 *)(disk_sb + 1) ; |
181 | 181 | ||
182 | if (cur_size > new_size) { | 182 | if (cur_size > new_size) { |
183 | /* mark everyone used that was listed as free at the end of the objectid | 183 | /* mark everyone used that was listed as free at the end of the objectid |
diff --git a/fs/reiserfs/procfs.c b/fs/reiserfs/procfs.c index f4ea81ae0e0f..e242ebc7f6f6 100644 --- a/fs/reiserfs/procfs.c +++ b/fs/reiserfs/procfs.c | |||
@@ -73,8 +73,8 @@ int reiserfs_global_version_in_proc( char *buffer, char **start, off_t offset, | |||
73 | #define DFL( x ) D4C( rs -> s_v1.x ) | 73 | #define DFL( x ) D4C( rs -> s_v1.x ) |
74 | 74 | ||
75 | #define objectid_map( s, rs ) (old_format_only (s) ? \ | 75 | #define objectid_map( s, rs ) (old_format_only (s) ? \ |
76 | (__u32 *)((struct reiserfs_super_block_v1 *)rs + 1) : \ | 76 | (__le32 *)((struct reiserfs_super_block_v1 *)rs + 1) : \ |
77 | (__u32 *)(rs + 1)) | 77 | (__le32 *)(rs + 1)) |
78 | #define MAP( i ) D4C( objectid_map( sb, rs )[ i ] ) | 78 | #define MAP( i ) D4C( objectid_map( sb, rs )[ i ] ) |
79 | 79 | ||
80 | #define DJF( x ) le32_to_cpu( rs -> x ) | 80 | #define DJF( x ) le32_to_cpu( rs -> x ) |
diff --git a/fs/reiserfs/stree.c b/fs/reiserfs/stree.c index 73ec5212178b..da23ba75f3d5 100644 --- a/fs/reiserfs/stree.c +++ b/fs/reiserfs/stree.c | |||
@@ -87,22 +87,20 @@ inline void copy_item_head(struct item_head * p_v_to, | |||
87 | inline int comp_short_keys (const struct reiserfs_key * le_key, | 87 | inline int comp_short_keys (const struct reiserfs_key * le_key, |
88 | const struct cpu_key * cpu_key) | 88 | const struct cpu_key * cpu_key) |
89 | { | 89 | { |
90 | __u32 * p_s_le_u32, * p_s_cpu_u32; | 90 | __u32 n; |
91 | int n_key_length = REISERFS_SHORT_KEY_LEN; | 91 | n = le32_to_cpu(le_key->k_dir_id); |
92 | 92 | if (n < cpu_key->on_disk_key.k_dir_id) | |
93 | p_s_le_u32 = (__u32 *)le_key; | ||
94 | p_s_cpu_u32 = (__u32 *)&cpu_key->on_disk_key; | ||
95 | for( ; n_key_length--; ++p_s_le_u32, ++p_s_cpu_u32 ) { | ||
96 | if ( le32_to_cpu (*p_s_le_u32) < *p_s_cpu_u32 ) | ||
97 | return -1; | 93 | return -1; |
98 | if ( le32_to_cpu (*p_s_le_u32) > *p_s_cpu_u32 ) | 94 | if (n > cpu_key->on_disk_key.k_dir_id) |
95 | return 1; | ||
96 | n = le32_to_cpu(le_key->k_objectid); | ||
97 | if (n < cpu_key->on_disk_key.k_objectid) | ||
98 | return -1; | ||
99 | if (n > cpu_key->on_disk_key.k_objectid) | ||
99 | return 1; | 100 | return 1; |
100 | } | ||
101 | |||
102 | return 0; | 101 | return 0; |
103 | } | 102 | } |
104 | 103 | ||
105 | |||
106 | /* k1 is pointer to on-disk structure which is stored in little-endian | 104 | /* k1 is pointer to on-disk structure which is stored in little-endian |
107 | form. k2 is pointer to cpu variable. | 105 | form. k2 is pointer to cpu variable. |
108 | Compare keys using all 4 key fields. | 106 | Compare keys using all 4 key fields. |
@@ -152,18 +150,15 @@ inline int comp_short_le_keys (const struct reiserfs_key * key1, const struct re | |||
152 | 150 | ||
153 | inline void le_key2cpu_key (struct cpu_key * to, const struct reiserfs_key * from) | 151 | inline void le_key2cpu_key (struct cpu_key * to, const struct reiserfs_key * from) |
154 | { | 152 | { |
153 | int version; | ||
155 | to->on_disk_key.k_dir_id = le32_to_cpu (from->k_dir_id); | 154 | to->on_disk_key.k_dir_id = le32_to_cpu (from->k_dir_id); |
156 | to->on_disk_key.k_objectid = le32_to_cpu (from->k_objectid); | 155 | to->on_disk_key.k_objectid = le32_to_cpu (from->k_objectid); |
157 | 156 | ||
158 | // find out version of the key | 157 | // find out version of the key |
159 | to->version = le_key_version (from); | 158 | version = le_key_version (from); |
160 | if (to->version == KEY_FORMAT_3_5) { | 159 | to->version = version; |
161 | to->on_disk_key.u.k_offset_v1.k_offset = le32_to_cpu (from->u.k_offset_v1.k_offset); | 160 | to->on_disk_key.k_offset = le_key_k_offset(version, from); |
162 | to->on_disk_key.u.k_offset_v1.k_uniqueness = le32_to_cpu (from->u.k_offset_v1.k_uniqueness); | 161 | to->on_disk_key.k_type = le_key_k_type(version, from); |
163 | } else { | ||
164 | to->on_disk_key.u.k_offset_v2.k_offset = offset_v2_k_offset(&from->u.k_offset_v2); | ||
165 | to->on_disk_key.u.k_offset_v2.k_type = offset_v2_k_type(&from->u.k_offset_v2); | ||
166 | } | ||
167 | } | 162 | } |
168 | 163 | ||
169 | 164 | ||
@@ -228,8 +223,14 @@ extern struct tree_balance * cur_tb; | |||
228 | const struct reiserfs_key MIN_KEY = {0, 0, {{0, 0},}}; | 223 | const struct reiserfs_key MIN_KEY = {0, 0, {{0, 0},}}; |
229 | 224 | ||
230 | /* Maximal possible key. It is never in the tree. */ | 225 | /* Maximal possible key. It is never in the tree. */ |
231 | const struct reiserfs_key MAX_KEY = {0xffffffff, 0xffffffff, {{0xffffffff, 0xffffffff},}}; | 226 | const struct reiserfs_key MAX_KEY = { |
227 | __constant_cpu_to_le32(0xffffffff), | ||
228 | __constant_cpu_to_le32(0xffffffff), | ||
229 | {{__constant_cpu_to_le32(0xffffffff), | ||
230 | __constant_cpu_to_le32(0xffffffff)},} | ||
231 | }; | ||
232 | 232 | ||
233 | const struct in_core_key MAX_IN_CORE_KEY = {~0U, ~0U, ~0ULL>>4, 15}; | ||
233 | 234 | ||
234 | /* Get delimiting key of the buffer by looking for it in the buffers in the path, starting from the bottom | 235 | /* Get delimiting key of the buffer by looking for it in the buffers in the path, starting from the bottom |
235 | of the path, and going upwards. We must check the path's validity at each step. If the key is not in | 236 | of the path, and going upwards. We must check the path's validity at each step. If the key is not in |
@@ -997,7 +998,7 @@ static char prepare_for_delete_or_cut( | |||
997 | int n_unfm_number, /* Number of the item unformatted nodes. */ | 998 | int n_unfm_number, /* Number of the item unformatted nodes. */ |
998 | n_counter, | 999 | n_counter, |
999 | n_blk_size; | 1000 | n_blk_size; |
1000 | __u32 * p_n_unfm_pointer; /* Pointer to the unformatted node number. */ | 1001 | __le32 * p_n_unfm_pointer; /* Pointer to the unformatted node number. */ |
1001 | __u32 tmp; | 1002 | __u32 tmp; |
1002 | struct item_head s_ih; /* Item header. */ | 1003 | struct item_head s_ih; /* Item header. */ |
1003 | char c_mode; /* Returned mode of the balance. */ | 1004 | char c_mode; /* Returned mode of the balance. */ |
@@ -1059,7 +1060,7 @@ static char prepare_for_delete_or_cut( | |||
1059 | /* pointers to be cut */ | 1060 | /* pointers to be cut */ |
1060 | n_unfm_number -= pos_in_item (p_s_path); | 1061 | n_unfm_number -= pos_in_item (p_s_path); |
1061 | /* Set pointer to the last unformatted node pointer that is to be cut. */ | 1062 | /* Set pointer to the last unformatted node pointer that is to be cut. */ |
1062 | p_n_unfm_pointer = (__u32 *)B_I_PITEM(p_s_bh, &s_ih) + I_UNFM_NUM(&s_ih) - 1 - *p_n_removed; | 1063 | p_n_unfm_pointer = (__le32 *)B_I_PITEM(p_s_bh, &s_ih) + I_UNFM_NUM(&s_ih) - 1 - *p_n_removed; |
1063 | 1064 | ||
1064 | 1065 | ||
1065 | /* We go through the unformatted nodes pointers of the indirect | 1066 | /* We go through the unformatted nodes pointers of the indirect |
@@ -1081,8 +1082,8 @@ static char prepare_for_delete_or_cut( | |||
1081 | need_research = 1 ; | 1082 | need_research = 1 ; |
1082 | break; | 1083 | break; |
1083 | } | 1084 | } |
1084 | RFALSE( p_n_unfm_pointer < (__u32 *)B_I_PITEM(p_s_bh, &s_ih) || | 1085 | RFALSE( p_n_unfm_pointer < (__le32 *)B_I_PITEM(p_s_bh, &s_ih) || |
1085 | p_n_unfm_pointer > (__u32 *)B_I_PITEM(p_s_bh, &s_ih) + I_UNFM_NUM(&s_ih) - 1, | 1086 | p_n_unfm_pointer > (__le32 *)B_I_PITEM(p_s_bh, &s_ih) + I_UNFM_NUM(&s_ih) - 1, |
1086 | "vs-5265: pointer out of range"); | 1087 | "vs-5265: pointer out of range"); |
1087 | 1088 | ||
1088 | /* Hole, nothing to remove. */ | 1089 | /* Hole, nothing to remove. */ |
@@ -1431,7 +1432,7 @@ int reiserfs_delete_object (struct reiserfs_transaction_handle *th, struct inode | |||
1431 | #if defined( USE_INODE_GENERATION_COUNTER ) | 1432 | #if defined( USE_INODE_GENERATION_COUNTER ) |
1432 | if( !old_format_only ( th -> t_super ) ) | 1433 | if( !old_format_only ( th -> t_super ) ) |
1433 | { | 1434 | { |
1434 | __u32 *inode_generation; | 1435 | __le32 *inode_generation; |
1435 | 1436 | ||
1436 | inode_generation = | 1437 | inode_generation = |
1437 | &REISERFS_SB(th -> t_super) -> s_rs -> s_inode_generation; | 1438 | &REISERFS_SB(th -> t_super) -> s_rs -> s_inode_generation; |
diff --git a/fs/reiserfs/super.c b/fs/reiserfs/super.c index bcdf2438d152..31e75125f48b 100644 --- a/fs/reiserfs/super.c +++ b/fs/reiserfs/super.c | |||
@@ -110,7 +110,7 @@ static void reiserfs_unlockfs(struct super_block *s) { | |||
110 | reiserfs_allow_writes(s) ; | 110 | reiserfs_allow_writes(s) ; |
111 | } | 111 | } |
112 | 112 | ||
113 | extern const struct reiserfs_key MAX_KEY; | 113 | extern const struct in_core_key MAX_IN_CORE_KEY; |
114 | 114 | ||
115 | 115 | ||
116 | /* this is used to delete "save link" when there are no items of a | 116 | /* this is used to delete "save link" when there are no items of a |
@@ -164,7 +164,7 @@ static int finish_unfinished (struct super_block * s) | |||
164 | 164 | ||
165 | /* compose key to look for "save" links */ | 165 | /* compose key to look for "save" links */ |
166 | max_cpu_key.version = KEY_FORMAT_3_5; | 166 | max_cpu_key.version = KEY_FORMAT_3_5; |
167 | max_cpu_key.on_disk_key = MAX_KEY; | 167 | max_cpu_key.on_disk_key = MAX_IN_CORE_KEY; |
168 | max_cpu_key.key_length = 3; | 168 | max_cpu_key.key_length = 3; |
169 | 169 | ||
170 | #ifdef CONFIG_QUOTA | 170 | #ifdef CONFIG_QUOTA |
@@ -216,10 +216,10 @@ static int finish_unfinished (struct super_block * s) | |||
216 | 216 | ||
217 | /* reiserfs_iget needs k_dirid and k_objectid only */ | 217 | /* reiserfs_iget needs k_dirid and k_objectid only */ |
218 | item = B_I_PITEM (bh, ih); | 218 | item = B_I_PITEM (bh, ih); |
219 | obj_key.on_disk_key.k_dir_id = le32_to_cpu (*(__u32 *)item); | 219 | obj_key.on_disk_key.k_dir_id = le32_to_cpu (*(__le32 *)item); |
220 | obj_key.on_disk_key.k_objectid = le32_to_cpu (ih->ih_key.k_objectid); | 220 | obj_key.on_disk_key.k_objectid = le32_to_cpu (ih->ih_key.k_objectid); |
221 | obj_key.on_disk_key.u.k_offset_v1.k_offset = 0; | 221 | obj_key.on_disk_key.k_offset = 0; |
222 | obj_key.on_disk_key.u.k_offset_v1.k_uniqueness = 0; | 222 | obj_key.on_disk_key.k_type = 0; |
223 | 223 | ||
224 | pathrelse (&path); | 224 | pathrelse (&path); |
225 | 225 | ||
@@ -304,7 +304,7 @@ void add_save_link (struct reiserfs_transaction_handle * th, | |||
304 | int retval; | 304 | int retval; |
305 | struct cpu_key key; | 305 | struct cpu_key key; |
306 | struct item_head ih; | 306 | struct item_head ih; |
307 | __u32 link; | 307 | __le32 link; |
308 | 308 | ||
309 | BUG_ON (!th->t_trans_id); | 309 | BUG_ON (!th->t_trans_id); |
310 | 310 | ||
@@ -889,12 +889,18 @@ static int reiserfs_parse_options (struct super_block * s, char * options, /* st | |||
889 | char * p; | 889 | char * p; |
890 | 890 | ||
891 | p = NULL; | 891 | p = NULL; |
892 | /* "resize=NNN" */ | 892 | /* "resize=NNN" or "resize=auto" */ |
893 | *blocks = simple_strtoul (arg, &p, 0); | 893 | |
894 | if (*p != '\0') { | 894 | if (!strcmp(arg, "auto")) { |
895 | /* NNN does not look like a number */ | 895 | /* From JFS code, to auto-get the size.*/ |
896 | reiserfs_warning (s, "reiserfs_parse_options: bad value %s", arg); | 896 | *blocks = s->s_bdev->bd_inode->i_size >> s->s_blocksize_bits; |
897 | return 0; | 897 | } else { |
898 | *blocks = simple_strtoul (arg, &p, 0); | ||
899 | if (*p != '\0') { | ||
900 | /* NNN does not look like a number */ | ||
901 | reiserfs_warning (s, "reiserfs_parse_options: bad value %s", arg); | ||
902 | return 0; | ||
903 | } | ||
898 | } | 904 | } |
899 | } | 905 | } |
900 | 906 | ||
@@ -903,7 +909,8 @@ static int reiserfs_parse_options (struct super_block * s, char * options, /* st | |||
903 | unsigned long val = simple_strtoul (arg, &p, 0); | 909 | unsigned long val = simple_strtoul (arg, &p, 0); |
904 | /* commit=NNN (time in seconds) */ | 910 | /* commit=NNN (time in seconds) */ |
905 | if ( *p != '\0' || val >= (unsigned int)-1) { | 911 | if ( *p != '\0' || val >= (unsigned int)-1) { |
906 | reiserfs_warning (s, "reiserfs_parse_options: bad value %s", arg); return 0; | 912 | reiserfs_warning (s, "reiserfs_parse_options: bad value %s", arg); |
913 | return 0; | ||
907 | } | 914 | } |
908 | *commit_max_age = (unsigned int)val; | 915 | *commit_max_age = (unsigned int)val; |
909 | } | 916 | } |
@@ -1329,7 +1336,7 @@ static int read_super_block (struct super_block * s, int offset) | |||
1329 | return 1; | 1336 | return 1; |
1330 | } | 1337 | } |
1331 | 1338 | ||
1332 | if ( rs->s_v1.s_root_block == -1 ) { | 1339 | if ( rs->s_v1.s_root_block == cpu_to_le32(-1) ) { |
1333 | brelse(bh) ; | 1340 | brelse(bh) ; |
1334 | reiserfs_warning (s, "Unfinished reiserfsck --rebuild-tree run detected. Please run\n" | 1341 | reiserfs_warning (s, "Unfinished reiserfsck --rebuild-tree run detected. Please run\n" |
1335 | "reiserfsck --rebuild-tree and wait for a completion. If that fails\n" | 1342 | "reiserfsck --rebuild-tree and wait for a completion. If that fails\n" |