diff options
author | Jeff Mahoney <jeffm@suse.com> | 2009-03-30 14:02:45 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-03-30 15:16:39 -0400 |
commit | a9dd364358fbdc68faee5d20c2d648c320dc3cf0 (patch) | |
tree | effcf61e5e198083faff82dc1e0bd6071639fca8 /fs/reiserfs/stree.c | |
parent | 0222e6571c332563a48d4cf5487b67feabe60b5e (diff) |
reiserfs: rename p_s_sb to sb
This patch is a simple s/p_s_sb/sb/g to the reiserfs code. This is the
first in a series of patches to rip out some of the awful variable
naming in reiserfs.
Signed-off-by: Jeff Mahoney <jeffm@suse.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/reiserfs/stree.c')
-rw-r--r-- | fs/reiserfs/stree.c | 126 |
1 files changed, 63 insertions, 63 deletions
diff --git a/fs/reiserfs/stree.c b/fs/reiserfs/stree.c index a65bfee28bb8..00fd879c4a2a 100644 --- a/fs/reiserfs/stree.c +++ b/fs/reiserfs/stree.c | |||
@@ -245,7 +245,7 @@ static const struct reiserfs_key MAX_KEY = { | |||
245 | static inline const struct reiserfs_key *get_lkey(const struct treepath | 245 | static inline const struct reiserfs_key *get_lkey(const struct treepath |
246 | *p_s_chk_path, | 246 | *p_s_chk_path, |
247 | const struct super_block | 247 | const struct super_block |
248 | *p_s_sb) | 248 | *sb) |
249 | { | 249 | { |
250 | int n_position, n_path_offset = p_s_chk_path->path_length; | 250 | int n_position, n_path_offset = p_s_chk_path->path_length; |
251 | struct buffer_head *p_s_parent; | 251 | struct buffer_head *p_s_parent; |
@@ -282,14 +282,14 @@ static inline const struct reiserfs_key *get_lkey(const struct treepath | |||
282 | } | 282 | } |
283 | /* Return MIN_KEY if we are in the root of the buffer tree. */ | 283 | /* Return MIN_KEY if we are in the root of the buffer tree. */ |
284 | if (PATH_OFFSET_PBUFFER(p_s_chk_path, FIRST_PATH_ELEMENT_OFFSET)-> | 284 | if (PATH_OFFSET_PBUFFER(p_s_chk_path, FIRST_PATH_ELEMENT_OFFSET)-> |
285 | b_blocknr == SB_ROOT_BLOCK(p_s_sb)) | 285 | b_blocknr == SB_ROOT_BLOCK(sb)) |
286 | return &MIN_KEY; | 286 | return &MIN_KEY; |
287 | return &MAX_KEY; | 287 | return &MAX_KEY; |
288 | } | 288 | } |
289 | 289 | ||
290 | /* Get delimiting key of the buffer at the path and its right neighbor. */ | 290 | /* Get delimiting key of the buffer at the path and its right neighbor. */ |
291 | inline const struct reiserfs_key *get_rkey(const struct treepath *p_s_chk_path, | 291 | inline const struct reiserfs_key *get_rkey(const struct treepath *p_s_chk_path, |
292 | const struct super_block *p_s_sb) | 292 | const struct super_block *sb) |
293 | { | 293 | { |
294 | int n_position, n_path_offset = p_s_chk_path->path_length; | 294 | int n_position, n_path_offset = p_s_chk_path->path_length; |
295 | struct buffer_head *p_s_parent; | 295 | struct buffer_head *p_s_parent; |
@@ -325,7 +325,7 @@ inline const struct reiserfs_key *get_rkey(const struct treepath *p_s_chk_path, | |||
325 | } | 325 | } |
326 | /* Return MAX_KEY if we are in the root of the buffer tree. */ | 326 | /* Return MAX_KEY if we are in the root of the buffer tree. */ |
327 | if (PATH_OFFSET_PBUFFER(p_s_chk_path, FIRST_PATH_ELEMENT_OFFSET)-> | 327 | if (PATH_OFFSET_PBUFFER(p_s_chk_path, FIRST_PATH_ELEMENT_OFFSET)-> |
328 | b_blocknr == SB_ROOT_BLOCK(p_s_sb)) | 328 | b_blocknr == SB_ROOT_BLOCK(sb)) |
329 | return &MAX_KEY; | 329 | return &MAX_KEY; |
330 | return &MIN_KEY; | 330 | return &MIN_KEY; |
331 | } | 331 | } |
@@ -337,7 +337,7 @@ inline const struct reiserfs_key *get_rkey(const struct treepath *p_s_chk_path, | |||
337 | this case get_lkey and get_rkey return a special key which is MIN_KEY or MAX_KEY. */ | 337 | this case get_lkey and get_rkey return a special key which is MIN_KEY or MAX_KEY. */ |
338 | static inline int key_in_buffer(struct treepath *p_s_chk_path, /* Path which should be checked. */ | 338 | static inline int key_in_buffer(struct treepath *p_s_chk_path, /* Path which should be checked. */ |
339 | const struct cpu_key *p_s_key, /* Key which should be checked. */ | 339 | const struct cpu_key *p_s_key, /* Key which should be checked. */ |
340 | struct super_block *p_s_sb /* Super block pointer. */ | 340 | struct super_block *sb /* Super block pointer. */ |
341 | ) | 341 | ) |
342 | { | 342 | { |
343 | 343 | ||
@@ -348,11 +348,11 @@ static inline int key_in_buffer(struct treepath *p_s_chk_path, /* Path which sho | |||
348 | RFALSE(!PATH_PLAST_BUFFER(p_s_chk_path)->b_bdev, | 348 | RFALSE(!PATH_PLAST_BUFFER(p_s_chk_path)->b_bdev, |
349 | "PAP-5060: device must not be NODEV"); | 349 | "PAP-5060: device must not be NODEV"); |
350 | 350 | ||
351 | if (comp_keys(get_lkey(p_s_chk_path, p_s_sb), p_s_key) == 1) | 351 | if (comp_keys(get_lkey(p_s_chk_path, sb), p_s_key) == 1) |
352 | /* left delimiting key is bigger, that the key we look for */ | 352 | /* left delimiting key is bigger, that the key we look for */ |
353 | return 0; | 353 | return 0; |
354 | // if ( comp_keys(p_s_key, get_rkey(p_s_chk_path, p_s_sb)) != -1 ) | 354 | // if ( comp_keys(p_s_key, get_rkey(p_s_chk_path, sb)) != -1 ) |
355 | if (comp_keys(get_rkey(p_s_chk_path, p_s_sb), p_s_key) != 1) | 355 | if (comp_keys(get_rkey(p_s_chk_path, sb), p_s_key) != 1) |
356 | /* p_s_key must be less than right delimitiing key */ | 356 | /* p_s_key must be less than right delimitiing key */ |
357 | return 0; | 357 | return 0; |
358 | return 1; | 358 | return 1; |
@@ -546,7 +546,7 @@ static void search_by_key_reada(struct super_block *s, | |||
546 | /************************************************************************** | 546 | /************************************************************************** |
547 | * Algorithm SearchByKey * | 547 | * Algorithm SearchByKey * |
548 | * look for item in the Disk S+Tree by its key * | 548 | * look for item in the Disk S+Tree by its key * |
549 | * Input: p_s_sb - super block * | 549 | * Input: sb - super block * |
550 | * p_s_key - pointer to the key to search * | 550 | * p_s_key - pointer to the key to search * |
551 | * Output: ITEM_FOUND, ITEM_NOT_FOUND or IO_ERROR * | 551 | * Output: ITEM_FOUND, ITEM_NOT_FOUND or IO_ERROR * |
552 | * p_s_search_path - path from the root to the needed leaf * | 552 | * p_s_search_path - path from the root to the needed leaf * |
@@ -566,7 +566,7 @@ static void search_by_key_reada(struct super_block *s, | |||
566 | correctness of the top of the path but need not be checked for the | 566 | correctness of the top of the path but need not be checked for the |
567 | correctness of the bottom of the path */ | 567 | correctness of the bottom of the path */ |
568 | /* The function is NOT SCHEDULE-SAFE! */ | 568 | /* The function is NOT SCHEDULE-SAFE! */ |
569 | int search_by_key(struct super_block *p_s_sb, const struct cpu_key *p_s_key, /* Key to search. */ | 569 | int search_by_key(struct super_block *sb, const struct cpu_key *p_s_key, /* Key to search. */ |
570 | struct treepath *p_s_search_path,/* This structure was | 570 | struct treepath *p_s_search_path,/* This structure was |
571 | allocated and initialized | 571 | allocated and initialized |
572 | by the calling | 572 | by the calling |
@@ -592,7 +592,7 @@ int search_by_key(struct super_block *p_s_sb, const struct cpu_key *p_s_key, /* | |||
592 | int n_repeat_counter = 0; | 592 | int n_repeat_counter = 0; |
593 | #endif | 593 | #endif |
594 | 594 | ||
595 | PROC_INFO_INC(p_s_sb, search_by_key); | 595 | PROC_INFO_INC(sb, search_by_key); |
596 | 596 | ||
597 | /* As we add each node to a path we increase its count. This means that | 597 | /* As we add each node to a path we increase its count. This means that |
598 | we must be careful to release all nodes in a path before we either | 598 | we must be careful to release all nodes in a path before we either |
@@ -605,13 +605,13 @@ int search_by_key(struct super_block *p_s_sb, const struct cpu_key *p_s_key, /* | |||
605 | /* With each iteration of this loop we search through the items in the | 605 | /* With each iteration of this loop we search through the items in the |
606 | current node, and calculate the next current node(next path element) | 606 | current node, and calculate the next current node(next path element) |
607 | for the next iteration of this loop.. */ | 607 | for the next iteration of this loop.. */ |
608 | n_block_number = SB_ROOT_BLOCK(p_s_sb); | 608 | n_block_number = SB_ROOT_BLOCK(sb); |
609 | expected_level = -1; | 609 | expected_level = -1; |
610 | while (1) { | 610 | while (1) { |
611 | 611 | ||
612 | #ifdef CONFIG_REISERFS_CHECK | 612 | #ifdef CONFIG_REISERFS_CHECK |
613 | if (!(++n_repeat_counter % 50000)) | 613 | if (!(++n_repeat_counter % 50000)) |
614 | reiserfs_warning(p_s_sb, "PAP-5100", | 614 | reiserfs_warning(sb, "PAP-5100", |
615 | "%s: there were %d iterations of " | 615 | "%s: there were %d iterations of " |
616 | "while loop looking for key %K", | 616 | "while loop looking for key %K", |
617 | current->comm, n_repeat_counter, | 617 | current->comm, n_repeat_counter, |
@@ -622,14 +622,14 @@ int search_by_key(struct super_block *p_s_sb, const struct cpu_key *p_s_key, /* | |||
622 | p_s_last_element = | 622 | p_s_last_element = |
623 | PATH_OFFSET_PELEMENT(p_s_search_path, | 623 | PATH_OFFSET_PELEMENT(p_s_search_path, |
624 | ++p_s_search_path->path_length); | 624 | ++p_s_search_path->path_length); |
625 | fs_gen = get_generation(p_s_sb); | 625 | fs_gen = get_generation(sb); |
626 | 626 | ||
627 | /* Read the next tree node, and set the last element in the path to | 627 | /* Read the next tree node, and set the last element in the path to |
628 | have a pointer to it. */ | 628 | have a pointer to it. */ |
629 | if ((p_s_bh = p_s_last_element->pe_buffer = | 629 | if ((p_s_bh = p_s_last_element->pe_buffer = |
630 | sb_getblk(p_s_sb, n_block_number))) { | 630 | sb_getblk(sb, n_block_number))) { |
631 | if (!buffer_uptodate(p_s_bh) && reada_count > 1) { | 631 | if (!buffer_uptodate(p_s_bh) && reada_count > 1) { |
632 | search_by_key_reada(p_s_sb, reada_bh, | 632 | search_by_key_reada(sb, reada_bh, |
633 | reada_blocks, reada_count); | 633 | reada_blocks, reada_count); |
634 | } | 634 | } |
635 | ll_rw_block(READ, 1, &p_s_bh); | 635 | ll_rw_block(READ, 1, &p_s_bh); |
@@ -644,25 +644,25 @@ int search_by_key(struct super_block *p_s_sb, const struct cpu_key *p_s_key, /* | |||
644 | } | 644 | } |
645 | reada_count = 0; | 645 | reada_count = 0; |
646 | if (expected_level == -1) | 646 | if (expected_level == -1) |
647 | expected_level = SB_TREE_HEIGHT(p_s_sb); | 647 | expected_level = SB_TREE_HEIGHT(sb); |
648 | expected_level--; | 648 | expected_level--; |
649 | 649 | ||
650 | /* It is possible that schedule occurred. We must check whether the key | 650 | /* It is possible that schedule occurred. We must check whether the key |
651 | to search is still in the tree rooted from the current buffer. If | 651 | to search is still in the tree rooted from the current buffer. If |
652 | not then repeat search from the root. */ | 652 | not then repeat search from the root. */ |
653 | if (fs_changed(fs_gen, p_s_sb) && | 653 | if (fs_changed(fs_gen, sb) && |
654 | (!B_IS_IN_TREE(p_s_bh) || | 654 | (!B_IS_IN_TREE(p_s_bh) || |
655 | B_LEVEL(p_s_bh) != expected_level || | 655 | B_LEVEL(p_s_bh) != expected_level || |
656 | !key_in_buffer(p_s_search_path, p_s_key, p_s_sb))) { | 656 | !key_in_buffer(p_s_search_path, p_s_key, sb))) { |
657 | PROC_INFO_INC(p_s_sb, search_by_key_fs_changed); | 657 | PROC_INFO_INC(sb, search_by_key_fs_changed); |
658 | PROC_INFO_INC(p_s_sb, search_by_key_restarted); | 658 | PROC_INFO_INC(sb, search_by_key_restarted); |
659 | PROC_INFO_INC(p_s_sb, | 659 | PROC_INFO_INC(sb, |
660 | sbk_restarted[expected_level - 1]); | 660 | sbk_restarted[expected_level - 1]); |
661 | pathrelse(p_s_search_path); | 661 | pathrelse(p_s_search_path); |
662 | 662 | ||
663 | /* Get the root block number so that we can repeat the search | 663 | /* Get the root block number so that we can repeat the search |
664 | starting from the root. */ | 664 | starting from the root. */ |
665 | n_block_number = SB_ROOT_BLOCK(p_s_sb); | 665 | n_block_number = SB_ROOT_BLOCK(sb); |
666 | expected_level = -1; | 666 | expected_level = -1; |
667 | right_neighbor_of_leaf_node = 0; | 667 | right_neighbor_of_leaf_node = 0; |
668 | 668 | ||
@@ -674,12 +674,12 @@ int search_by_key(struct super_block *p_s_sb, const struct cpu_key *p_s_key, /* | |||
674 | equal to the MAX_KEY. Latter case is only possible in | 674 | equal to the MAX_KEY. Latter case is only possible in |
675 | "finish_unfinished()" processing during mount. */ | 675 | "finish_unfinished()" processing during mount. */ |
676 | RFALSE(comp_keys(&MAX_KEY, p_s_key) && | 676 | RFALSE(comp_keys(&MAX_KEY, p_s_key) && |
677 | !key_in_buffer(p_s_search_path, p_s_key, p_s_sb), | 677 | !key_in_buffer(p_s_search_path, p_s_key, sb), |
678 | "PAP-5130: key is not in the buffer"); | 678 | "PAP-5130: key is not in the buffer"); |
679 | #ifdef CONFIG_REISERFS_CHECK | 679 | #ifdef CONFIG_REISERFS_CHECK |
680 | if (cur_tb) { | 680 | if (cur_tb) { |
681 | print_cur_tb("5140"); | 681 | print_cur_tb("5140"); |
682 | reiserfs_panic(p_s_sb, "PAP-5140", | 682 | reiserfs_panic(sb, "PAP-5140", |
683 | "schedule occurred in do_balance!"); | 683 | "schedule occurred in do_balance!"); |
684 | } | 684 | } |
685 | #endif | 685 | #endif |
@@ -687,7 +687,7 @@ int search_by_key(struct super_block *p_s_sb, const struct cpu_key *p_s_key, /* | |||
687 | // make sure, that the node contents look like a node of | 687 | // make sure, that the node contents look like a node of |
688 | // certain level | 688 | // certain level |
689 | if (!is_tree_node(p_s_bh, expected_level)) { | 689 | if (!is_tree_node(p_s_bh, expected_level)) { |
690 | reiserfs_error(p_s_sb, "vs-5150", | 690 | reiserfs_error(sb, "vs-5150", |
691 | "invalid format found in block %ld. " | 691 | "invalid format found in block %ld. " |
692 | "Fsck?", p_s_bh->b_blocknr); | 692 | "Fsck?", p_s_bh->b_blocknr); |
693 | pathrelse(p_s_search_path); | 693 | pathrelse(p_s_search_path); |
@@ -697,7 +697,7 @@ int search_by_key(struct super_block *p_s_sb, const struct cpu_key *p_s_key, /* | |||
697 | /* ok, we have acquired next formatted node in the tree */ | 697 | /* ok, we have acquired next formatted node in the tree */ |
698 | n_node_level = B_LEVEL(p_s_bh); | 698 | n_node_level = B_LEVEL(p_s_bh); |
699 | 699 | ||
700 | PROC_INFO_BH_STAT(p_s_sb, p_s_bh, n_node_level - 1); | 700 | PROC_INFO_BH_STAT(sb, p_s_bh, n_node_level - 1); |
701 | 701 | ||
702 | RFALSE(n_node_level < n_stop_level, | 702 | RFALSE(n_node_level < n_stop_level, |
703 | "vs-5152: tree level (%d) is less than stop level (%d)", | 703 | "vs-5152: tree level (%d) is less than stop level (%d)", |
@@ -776,7 +776,7 @@ int search_by_key(struct super_block *p_s_sb, const struct cpu_key *p_s_key, /* | |||
776 | units of directory entries. */ | 776 | units of directory entries. */ |
777 | 777 | ||
778 | /* The function is NOT SCHEDULE-SAFE! */ | 778 | /* The function is NOT SCHEDULE-SAFE! */ |
779 | int search_for_position_by_key(struct super_block *p_s_sb, /* Pointer to the super block. */ | 779 | int search_for_position_by_key(struct super_block *sb, /* Pointer to the super block. */ |
780 | const struct cpu_key *p_cpu_key, /* Key to search (cpu variable) */ | 780 | const struct cpu_key *p_cpu_key, /* Key to search (cpu variable) */ |
781 | struct treepath *p_s_search_path /* Filled up by this function. */ | 781 | struct treepath *p_s_search_path /* Filled up by this function. */ |
782 | ) | 782 | ) |
@@ -789,13 +789,13 @@ int search_for_position_by_key(struct super_block *p_s_sb, /* Pointer to the sup | |||
789 | 789 | ||
790 | /* If searching for directory entry. */ | 790 | /* If searching for directory entry. */ |
791 | if (is_direntry_cpu_key(p_cpu_key)) | 791 | if (is_direntry_cpu_key(p_cpu_key)) |
792 | return search_by_entry_key(p_s_sb, p_cpu_key, p_s_search_path, | 792 | return search_by_entry_key(sb, p_cpu_key, p_s_search_path, |
793 | &de); | 793 | &de); |
794 | 794 | ||
795 | /* If not searching for directory entry. */ | 795 | /* If not searching for directory entry. */ |
796 | 796 | ||
797 | /* If item is found. */ | 797 | /* If item is found. */ |
798 | retval = search_item(p_s_sb, p_cpu_key, p_s_search_path); | 798 | retval = search_item(sb, p_cpu_key, p_s_search_path); |
799 | if (retval == IO_ERROR) | 799 | if (retval == IO_ERROR) |
800 | return retval; | 800 | return retval; |
801 | if (retval == ITEM_FOUND) { | 801 | if (retval == ITEM_FOUND) { |
@@ -817,7 +817,7 @@ int search_for_position_by_key(struct super_block *p_s_sb, /* Pointer to the sup | |||
817 | p_le_ih = | 817 | p_le_ih = |
818 | B_N_PITEM_HEAD(PATH_PLAST_BUFFER(p_s_search_path), | 818 | B_N_PITEM_HEAD(PATH_PLAST_BUFFER(p_s_search_path), |
819 | --PATH_LAST_POSITION(p_s_search_path)); | 819 | --PATH_LAST_POSITION(p_s_search_path)); |
820 | n_blk_size = p_s_sb->s_blocksize; | 820 | n_blk_size = sb->s_blocksize; |
821 | 821 | ||
822 | if (comp_short_keys(&(p_le_ih->ih_key), p_cpu_key)) { | 822 | if (comp_short_keys(&(p_le_ih->ih_key), p_cpu_key)) { |
823 | return FILE_NOT_FOUND; | 823 | return FILE_NOT_FOUND; |
@@ -957,7 +957,7 @@ static char prepare_for_delete_or_cut(struct reiserfs_transaction_handle *th, st | |||
957 | int *p_n_cut_size, unsigned long long n_new_file_length /* MAX_KEY_OFFSET in case of delete. */ | 957 | int *p_n_cut_size, unsigned long long n_new_file_length /* MAX_KEY_OFFSET in case of delete. */ |
958 | ) | 958 | ) |
959 | { | 959 | { |
960 | struct super_block *p_s_sb = inode->i_sb; | 960 | struct super_block *sb = inode->i_sb; |
961 | struct item_head *p_le_ih = PATH_PITEM_HEAD(p_s_path); | 961 | struct item_head *p_le_ih = PATH_PITEM_HEAD(p_s_path); |
962 | struct buffer_head *p_s_bh = PATH_PLAST_BUFFER(p_s_path); | 962 | struct buffer_head *p_s_bh = PATH_PLAST_BUFFER(p_s_path); |
963 | 963 | ||
@@ -986,7 +986,7 @@ static char prepare_for_delete_or_cut(struct reiserfs_transaction_handle *th, st | |||
986 | 986 | ||
987 | /* Case of an indirect item. */ | 987 | /* Case of an indirect item. */ |
988 | { | 988 | { |
989 | int blk_size = p_s_sb->s_blocksize; | 989 | int blk_size = sb->s_blocksize; |
990 | struct item_head s_ih; | 990 | struct item_head s_ih; |
991 | int need_re_search; | 991 | int need_re_search; |
992 | int delete = 0; | 992 | int delete = 0; |
@@ -1023,9 +1023,9 @@ static char prepare_for_delete_or_cut(struct reiserfs_transaction_handle *th, st | |||
1023 | block = get_block_num(unfm, 0); | 1023 | block = get_block_num(unfm, 0); |
1024 | 1024 | ||
1025 | if (block != 0) { | 1025 | if (block != 0) { |
1026 | reiserfs_prepare_for_journal(p_s_sb, p_s_bh, 1); | 1026 | reiserfs_prepare_for_journal(sb, p_s_bh, 1); |
1027 | put_block_num(unfm, 0, 0); | 1027 | put_block_num(unfm, 0, 0); |
1028 | journal_mark_dirty (th, p_s_sb, p_s_bh); | 1028 | journal_mark_dirty (th, sb, p_s_bh); |
1029 | reiserfs_free_block(th, inode, block, 1); | 1029 | reiserfs_free_block(th, inode, block, 1); |
1030 | } | 1030 | } |
1031 | 1031 | ||
@@ -1049,9 +1049,9 @@ static char prepare_for_delete_or_cut(struct reiserfs_transaction_handle *th, st | |||
1049 | /* a trick. If the buffer has been logged, this will do nothing. If | 1049 | /* a trick. If the buffer has been logged, this will do nothing. If |
1050 | ** we've broken the loop without logging it, it will restore the | 1050 | ** we've broken the loop without logging it, it will restore the |
1051 | ** buffer */ | 1051 | ** buffer */ |
1052 | reiserfs_restore_prepared_buffer(p_s_sb, p_s_bh); | 1052 | reiserfs_restore_prepared_buffer(sb, p_s_bh); |
1053 | } while (need_re_search && | 1053 | } while (need_re_search && |
1054 | search_for_position_by_key(p_s_sb, p_s_item_key, p_s_path) == POSITION_FOUND); | 1054 | search_for_position_by_key(sb, p_s_item_key, p_s_path) == POSITION_FOUND); |
1055 | pos_in_item(p_s_path) = pos * UNFM_P_SIZE; | 1055 | pos_in_item(p_s_path) = pos * UNFM_P_SIZE; |
1056 | 1056 | ||
1057 | if (*p_n_cut_size == 0) { | 1057 | if (*p_n_cut_size == 0) { |
@@ -1090,7 +1090,7 @@ static int calc_deleted_bytes_number(struct tree_balance *p_s_tb, char c_mode) | |||
1090 | 1090 | ||
1091 | static void init_tb_struct(struct reiserfs_transaction_handle *th, | 1091 | static void init_tb_struct(struct reiserfs_transaction_handle *th, |
1092 | struct tree_balance *p_s_tb, | 1092 | struct tree_balance *p_s_tb, |
1093 | struct super_block *p_s_sb, | 1093 | struct super_block *sb, |
1094 | struct treepath *p_s_path, int n_size) | 1094 | struct treepath *p_s_path, int n_size) |
1095 | { | 1095 | { |
1096 | 1096 | ||
@@ -1098,7 +1098,7 @@ static void init_tb_struct(struct reiserfs_transaction_handle *th, | |||
1098 | 1098 | ||
1099 | memset(p_s_tb, '\0', sizeof(struct tree_balance)); | 1099 | memset(p_s_tb, '\0', sizeof(struct tree_balance)); |
1100 | p_s_tb->transaction_handle = th; | 1100 | p_s_tb->transaction_handle = th; |
1101 | p_s_tb->tb_sb = p_s_sb; | 1101 | p_s_tb->tb_sb = sb; |
1102 | p_s_tb->tb_path = p_s_path; | 1102 | p_s_tb->tb_path = p_s_path; |
1103 | PATH_OFFSET_PBUFFER(p_s_path, ILLEGAL_PATH_ELEMENT_OFFSET) = NULL; | 1103 | PATH_OFFSET_PBUFFER(p_s_path, ILLEGAL_PATH_ELEMENT_OFFSET) = NULL; |
1104 | PATH_OFFSET_POSITION(p_s_path, ILLEGAL_PATH_ELEMENT_OFFSET) = 0; | 1104 | PATH_OFFSET_POSITION(p_s_path, ILLEGAL_PATH_ELEMENT_OFFSET) = 0; |
@@ -1147,7 +1147,7 @@ int reiserfs_delete_item(struct reiserfs_transaction_handle *th, struct treepath | |||
1147 | struct inode *p_s_inode, /* inode is here just to update i_blocks and quotas */ | 1147 | struct inode *p_s_inode, /* inode is here just to update i_blocks and quotas */ |
1148 | struct buffer_head *p_s_un_bh) | 1148 | struct buffer_head *p_s_un_bh) |
1149 | { /* NULL or unformatted node pointer. */ | 1149 | { /* NULL or unformatted node pointer. */ |
1150 | struct super_block *p_s_sb = p_s_inode->i_sb; | 1150 | struct super_block *sb = p_s_inode->i_sb; |
1151 | struct tree_balance s_del_balance; | 1151 | struct tree_balance s_del_balance; |
1152 | struct item_head s_ih; | 1152 | struct item_head s_ih; |
1153 | struct item_head *q_ih; | 1153 | struct item_head *q_ih; |
@@ -1161,7 +1161,7 @@ int reiserfs_delete_item(struct reiserfs_transaction_handle *th, struct treepath | |||
1161 | 1161 | ||
1162 | BUG_ON(!th->t_trans_id); | 1162 | BUG_ON(!th->t_trans_id); |
1163 | 1163 | ||
1164 | init_tb_struct(th, &s_del_balance, p_s_sb, p_s_path, | 1164 | init_tb_struct(th, &s_del_balance, sb, p_s_path, |
1165 | 0 /*size is unknown */ ); | 1165 | 0 /*size is unknown */ ); |
1166 | 1166 | ||
1167 | while (1) { | 1167 | while (1) { |
@@ -1185,15 +1185,15 @@ int reiserfs_delete_item(struct reiserfs_transaction_handle *th, struct treepath | |||
1185 | if (n_ret_value != REPEAT_SEARCH) | 1185 | if (n_ret_value != REPEAT_SEARCH) |
1186 | break; | 1186 | break; |
1187 | 1187 | ||
1188 | PROC_INFO_INC(p_s_sb, delete_item_restarted); | 1188 | PROC_INFO_INC(sb, delete_item_restarted); |
1189 | 1189 | ||
1190 | // file system changed, repeat search | 1190 | // file system changed, repeat search |
1191 | n_ret_value = | 1191 | n_ret_value = |
1192 | search_for_position_by_key(p_s_sb, p_s_item_key, p_s_path); | 1192 | search_for_position_by_key(sb, p_s_item_key, p_s_path); |
1193 | if (n_ret_value == IO_ERROR) | 1193 | if (n_ret_value == IO_ERROR) |
1194 | break; | 1194 | break; |
1195 | if (n_ret_value == FILE_NOT_FOUND) { | 1195 | if (n_ret_value == FILE_NOT_FOUND) { |
1196 | reiserfs_warning(p_s_sb, "vs-5340", | 1196 | reiserfs_warning(sb, "vs-5340", |
1197 | "no items of the file %K found", | 1197 | "no items of the file %K found", |
1198 | p_s_item_key); | 1198 | p_s_item_key); |
1199 | break; | 1199 | break; |
@@ -1216,8 +1216,8 @@ int reiserfs_delete_item(struct reiserfs_transaction_handle *th, struct treepath | |||
1216 | ** the unfm node once | 1216 | ** the unfm node once |
1217 | */ | 1217 | */ |
1218 | if (!S_ISLNK(p_s_inode->i_mode) && is_direct_le_ih(q_ih)) { | 1218 | if (!S_ISLNK(p_s_inode->i_mode) && is_direct_le_ih(q_ih)) { |
1219 | if ((le_ih_k_offset(q_ih) & (p_s_sb->s_blocksize - 1)) == 1) { | 1219 | if ((le_ih_k_offset(q_ih) & (sb->s_blocksize - 1)) == 1) { |
1220 | quota_cut_bytes = p_s_sb->s_blocksize + UNFM_P_SIZE; | 1220 | quota_cut_bytes = sb->s_blocksize + UNFM_P_SIZE; |
1221 | } else { | 1221 | } else { |
1222 | quota_cut_bytes = 0; | 1222 | quota_cut_bytes = 0; |
1223 | } | 1223 | } |
@@ -1258,7 +1258,7 @@ int reiserfs_delete_item(struct reiserfs_transaction_handle *th, struct treepath | |||
1258 | do_balance(&s_del_balance, NULL, NULL, M_DELETE); | 1258 | do_balance(&s_del_balance, NULL, NULL, M_DELETE); |
1259 | 1259 | ||
1260 | #ifdef REISERQUOTA_DEBUG | 1260 | #ifdef REISERQUOTA_DEBUG |
1261 | reiserfs_debug(p_s_sb, REISERFS_DEBUG_CODE, | 1261 | reiserfs_debug(sb, REISERFS_DEBUG_CODE, |
1262 | "reiserquota delete_item(): freeing %u, id=%u type=%c", | 1262 | "reiserquota delete_item(): freeing %u, id=%u type=%c", |
1263 | quota_cut_bytes, p_s_inode->i_uid, head2type(&s_ih)); | 1263 | quota_cut_bytes, p_s_inode->i_uid, head2type(&s_ih)); |
1264 | #endif | 1264 | #endif |
@@ -1430,8 +1430,8 @@ static int maybe_indirect_to_direct(struct reiserfs_transaction_handle *th, | |||
1430 | const struct cpu_key *p_s_item_key, | 1430 | const struct cpu_key *p_s_item_key, |
1431 | loff_t n_new_file_size, char *p_c_mode) | 1431 | loff_t n_new_file_size, char *p_c_mode) |
1432 | { | 1432 | { |
1433 | struct super_block *p_s_sb = p_s_inode->i_sb; | 1433 | struct super_block *sb = p_s_inode->i_sb; |
1434 | int n_block_size = p_s_sb->s_blocksize; | 1434 | int n_block_size = sb->s_blocksize; |
1435 | int cut_bytes; | 1435 | int cut_bytes; |
1436 | BUG_ON(!th->t_trans_id); | 1436 | BUG_ON(!th->t_trans_id); |
1437 | BUG_ON(n_new_file_size != p_s_inode->i_size); | 1437 | BUG_ON(n_new_file_size != p_s_inode->i_size); |
@@ -1509,7 +1509,7 @@ int reiserfs_cut_from_item(struct reiserfs_transaction_handle *th, | |||
1509 | struct inode *p_s_inode, | 1509 | struct inode *p_s_inode, |
1510 | struct page *page, loff_t n_new_file_size) | 1510 | struct page *page, loff_t n_new_file_size) |
1511 | { | 1511 | { |
1512 | struct super_block *p_s_sb = p_s_inode->i_sb; | 1512 | struct super_block *sb = p_s_inode->i_sb; |
1513 | /* Every function which is going to call do_balance must first | 1513 | /* Every function which is going to call do_balance must first |
1514 | create a tree_balance structure. Then it must fill up this | 1514 | create a tree_balance structure. Then it must fill up this |
1515 | structure by using the init_tb_struct and fix_nodes functions. | 1515 | structure by using the init_tb_struct and fix_nodes functions. |
@@ -1560,7 +1560,7 @@ int reiserfs_cut_from_item(struct reiserfs_transaction_handle *th, | |||
1560 | /* removing of last unformatted node will change value we | 1560 | /* removing of last unformatted node will change value we |
1561 | have to return to truncate. Save it */ | 1561 | have to return to truncate. Save it */ |
1562 | retval2 = n_ret_value; | 1562 | retval2 = n_ret_value; |
1563 | /*retval2 = p_s_sb->s_blocksize - (n_new_file_size & (p_s_sb->s_blocksize - 1)); */ | 1563 | /*retval2 = sb->s_blocksize - (n_new_file_size & (sb->s_blocksize - 1)); */ |
1564 | 1564 | ||
1565 | /* So, we have performed the first part of the conversion: | 1565 | /* So, we have performed the first part of the conversion: |
1566 | inserting the new direct item. Now we are removing the | 1566 | inserting the new direct item. Now we are removing the |
@@ -1569,16 +1569,16 @@ int reiserfs_cut_from_item(struct reiserfs_transaction_handle *th, | |||
1569 | set_cpu_key_k_type(p_s_item_key, TYPE_INDIRECT); | 1569 | set_cpu_key_k_type(p_s_item_key, TYPE_INDIRECT); |
1570 | p_s_item_key->key_length = 4; | 1570 | p_s_item_key->key_length = 4; |
1571 | n_new_file_size -= | 1571 | n_new_file_size -= |
1572 | (n_new_file_size & (p_s_sb->s_blocksize - 1)); | 1572 | (n_new_file_size & (sb->s_blocksize - 1)); |
1573 | tail_pos = n_new_file_size; | 1573 | tail_pos = n_new_file_size; |
1574 | set_cpu_key_k_offset(p_s_item_key, n_new_file_size + 1); | 1574 | set_cpu_key_k_offset(p_s_item_key, n_new_file_size + 1); |
1575 | if (search_for_position_by_key | 1575 | if (search_for_position_by_key |
1576 | (p_s_sb, p_s_item_key, | 1576 | (sb, p_s_item_key, |
1577 | p_s_path) == POSITION_NOT_FOUND) { | 1577 | p_s_path) == POSITION_NOT_FOUND) { |
1578 | print_block(PATH_PLAST_BUFFER(p_s_path), 3, | 1578 | print_block(PATH_PLAST_BUFFER(p_s_path), 3, |
1579 | PATH_LAST_POSITION(p_s_path) - 1, | 1579 | PATH_LAST_POSITION(p_s_path) - 1, |
1580 | PATH_LAST_POSITION(p_s_path) + 1); | 1580 | PATH_LAST_POSITION(p_s_path) + 1); |
1581 | reiserfs_panic(p_s_sb, "PAP-5580", "item to " | 1581 | reiserfs_panic(sb, "PAP-5580", "item to " |
1582 | "convert does not exist (%K)", | 1582 | "convert does not exist (%K)", |
1583 | p_s_item_key); | 1583 | p_s_item_key); |
1584 | } | 1584 | } |
@@ -1595,14 +1595,14 @@ int reiserfs_cut_from_item(struct reiserfs_transaction_handle *th, | |||
1595 | if (n_ret_value != REPEAT_SEARCH) | 1595 | if (n_ret_value != REPEAT_SEARCH) |
1596 | break; | 1596 | break; |
1597 | 1597 | ||
1598 | PROC_INFO_INC(p_s_sb, cut_from_item_restarted); | 1598 | PROC_INFO_INC(sb, cut_from_item_restarted); |
1599 | 1599 | ||
1600 | n_ret_value = | 1600 | n_ret_value = |
1601 | search_for_position_by_key(p_s_sb, p_s_item_key, p_s_path); | 1601 | search_for_position_by_key(sb, p_s_item_key, p_s_path); |
1602 | if (n_ret_value == POSITION_FOUND) | 1602 | if (n_ret_value == POSITION_FOUND) |
1603 | continue; | 1603 | continue; |
1604 | 1604 | ||
1605 | reiserfs_warning(p_s_sb, "PAP-5610", "item %K not found", | 1605 | reiserfs_warning(sb, "PAP-5610", "item %K not found", |
1606 | p_s_item_key); | 1606 | p_s_item_key); |
1607 | unfix_nodes(&s_cut_balance); | 1607 | unfix_nodes(&s_cut_balance); |
1608 | return (n_ret_value == IO_ERROR) ? -EIO : -ENOENT; | 1608 | return (n_ret_value == IO_ERROR) ? -EIO : -ENOENT; |
@@ -1616,7 +1616,7 @@ int reiserfs_cut_from_item(struct reiserfs_transaction_handle *th, | |||
1616 | indirect_to_direct_roll_back(th, p_s_inode, p_s_path); | 1616 | indirect_to_direct_roll_back(th, p_s_inode, p_s_path); |
1617 | } | 1617 | } |
1618 | if (n_ret_value == NO_DISK_SPACE) | 1618 | if (n_ret_value == NO_DISK_SPACE) |
1619 | reiserfs_warning(p_s_sb, "reiserfs-5092", | 1619 | reiserfs_warning(sb, "reiserfs-5092", |
1620 | "NO_DISK_SPACE"); | 1620 | "NO_DISK_SPACE"); |
1621 | unfix_nodes(&s_cut_balance); | 1621 | unfix_nodes(&s_cut_balance); |
1622 | return -EIO; | 1622 | return -EIO; |
@@ -1642,11 +1642,11 @@ int reiserfs_cut_from_item(struct reiserfs_transaction_handle *th, | |||
1642 | p_le_ih = PATH_PITEM_HEAD(s_cut_balance.tb_path); | 1642 | p_le_ih = PATH_PITEM_HEAD(s_cut_balance.tb_path); |
1643 | if (!S_ISLNK(p_s_inode->i_mode) && is_direct_le_ih(p_le_ih)) { | 1643 | if (!S_ISLNK(p_s_inode->i_mode) && is_direct_le_ih(p_le_ih)) { |
1644 | if (c_mode == M_DELETE && | 1644 | if (c_mode == M_DELETE && |
1645 | (le_ih_k_offset(p_le_ih) & (p_s_sb->s_blocksize - 1)) == | 1645 | (le_ih_k_offset(p_le_ih) & (sb->s_blocksize - 1)) == |
1646 | 1) { | 1646 | 1) { |
1647 | // FIXME: this is to keep 3.5 happy | 1647 | // FIXME: this is to keep 3.5 happy |
1648 | REISERFS_I(p_s_inode)->i_first_direct_byte = U32_MAX; | 1648 | REISERFS_I(p_s_inode)->i_first_direct_byte = U32_MAX; |
1649 | quota_cut_bytes = p_s_sb->s_blocksize + UNFM_P_SIZE; | 1649 | quota_cut_bytes = sb->s_blocksize + UNFM_P_SIZE; |
1650 | } else { | 1650 | } else { |
1651 | quota_cut_bytes = 0; | 1651 | quota_cut_bytes = 0; |
1652 | } | 1652 | } |
@@ -1659,18 +1659,18 @@ int reiserfs_cut_from_item(struct reiserfs_transaction_handle *th, | |||
1659 | sure, that we exactly remove last unformatted node pointer | 1659 | sure, that we exactly remove last unformatted node pointer |
1660 | of the item */ | 1660 | of the item */ |
1661 | if (!is_indirect_le_ih(le_ih)) | 1661 | if (!is_indirect_le_ih(le_ih)) |
1662 | reiserfs_panic(p_s_sb, "vs-5652", | 1662 | reiserfs_panic(sb, "vs-5652", |
1663 | "item must be indirect %h", le_ih); | 1663 | "item must be indirect %h", le_ih); |
1664 | 1664 | ||
1665 | if (c_mode == M_DELETE && ih_item_len(le_ih) != UNFM_P_SIZE) | 1665 | if (c_mode == M_DELETE && ih_item_len(le_ih) != UNFM_P_SIZE) |
1666 | reiserfs_panic(p_s_sb, "vs-5653", "completing " | 1666 | reiserfs_panic(sb, "vs-5653", "completing " |
1667 | "indirect2direct conversion indirect " | 1667 | "indirect2direct conversion indirect " |
1668 | "item %h being deleted must be of " | 1668 | "item %h being deleted must be of " |
1669 | "4 byte long", le_ih); | 1669 | "4 byte long", le_ih); |
1670 | 1670 | ||
1671 | if (c_mode == M_CUT | 1671 | if (c_mode == M_CUT |
1672 | && s_cut_balance.insert_size[0] != -UNFM_P_SIZE) { | 1672 | && s_cut_balance.insert_size[0] != -UNFM_P_SIZE) { |
1673 | reiserfs_panic(p_s_sb, "vs-5654", "can not complete " | 1673 | reiserfs_panic(sb, "vs-5654", "can not complete " |
1674 | "indirect2direct conversion of %h " | 1674 | "indirect2direct conversion of %h " |
1675 | "(CUT, insert_size==%d)", | 1675 | "(CUT, insert_size==%d)", |
1676 | le_ih, s_cut_balance.insert_size[0]); | 1676 | le_ih, s_cut_balance.insert_size[0]); |