reiserfs cleanup patchset
cover reiserfs cleanup patchset
Hi all -
I've had this patchset kicking around for a while. After a conversation this past week about code that was horrible to read (using reiserfs's balance_leaf as the primary example) and seeing that Dave Jones had scratched a bit of an itch, I decided it was time to resync and push it out so I don't have to update it forever.
BTW, as I'm basically the only person with substantial patches against reiserfs, I'm 100% ok with disrupting context to this extent. :)
This set consists of 29 patches in a few areas.
1 - Convert the commit workqueue to a per-fs workqueue
2 - Clean up ugly accessor macros to use more readable names
3 - Clean up comments to use the normal kernel style
4 - Remove the unused nblocks argument from journal_end
5 - Remove superblock argument from journal_end (it's in the trans handle) 6 - Remove superblock argument from journal_mark_dirty (see #5) 7 - Remove blocks argument from journal_join (it's always 1)
8 - Remove leading whitespace from labels
9 - Remove unnecessary parents
10 - Clean up dirent creation
11 - Clean up hash detection
12-29 - Clean up balance_leaf - This 2500-line function goes through
6 easily distinguishable stages, each with several sub-parts. The patch set splits up the stages and then reformats them to keep the split as obvious as possible. The final result is a whole lot easier to follow and easier on the eyes.
-Jeff
PATCH 1/29 reiserfs: use per-fs commit workqueues
The reiserfs write lock hasn't been the BKL for some time. There's no need to have different file systems queued up on the same workqueue.
--- fs/reiserfs/journal.c | 22 +++------------------- fs/reiserfs/reiserfs.h | 2 ++ fs/reiserfs/super.c | 21 +++++++++++++++------ 3 files changed, 20 insertions(+), 25 deletions(-)
fs/reiserfs/journal.c +3 -19
@@ -58,13 +58,6 @@#define JOURNAL_WORK_ENTRY (h) (list_entry((h), struct reiserfs_journal_list, \ j_working_list)) -/* the number of mounted filesystems. This is used to decide when to -** start and kill the commit workqueue -*/ -static int reiserfs_mounted_fs_count; - -static struct workqueue_struct *commit_wq; -#define JOURNAL_TRANS_HALF 1018/* must be correct to keep the desc and commit structs at 4k */ #define BUFNR 64/*read ahead */
@@ -1909,7 +1902,6 @@ static int do_journal_release(struct rei } } - reiserfs_mounted_fs_count--;/* wait for all commits to finish */ cancel_delayed_work (&SB_JOURNAL (sb)->j_work);
@@ -1920,12 +1912,7 @@ static int do_journal_release(struct reireiserfs_write_unlock (sb);cancel_delayed_work_sync (&REISERFS_SB (sb)->old_work); -flush_workqueue (commit_wq); - -if (!reiserfs_mounted_fs_count) { -destroy_workqueue (commit_wq); - commit_wq =NULL ; - } +flush_workqueue (REISERFS_SB (sb)->commit_wq);free_journal_ram (sb);
@@ -2799,10 +2786,6 @@ int journal_init(struct super_block *sb, goto free_and_return; } - reiserfs_mounted_fs_count++; -if (reiserfs_mounted_fs_count <=1 ) - commit_wq =alloc_workqueue ("reiserfs" ,WQ_MEM_RECLAIM ,0 ); -INIT_DELAYED_WORK (&journal->j_work, flush_async_commits); journal->j_work_sb = sb;return 0 ;
@@ -4115,7 +4098,8 @@ static int do_journal_end(struct reiserfflush_commit_list (sb, jl,1 );flush_journal_list (sb, jl,1 ); }else if (!(jl->j_state &LIST_COMMIT_PENDING )) -queue_delayed_work (commit_wq, &journal->j_work,HZ /10 ); +queue_delayed_work (REISERFS_SB (sb)->commit_wq, + &journal->j_work,HZ /10 );/* if the next transaction has any chance of wrapping, flush ** transactions that might get overwritten. If any journal lists are very
fs/reiserfs/reiserfs.h +2 -0
@@ -431,6 +431,8 @@ struct reiserfs_sb_info {/* Depth of the lock, start from -1 like the bkl */ int lock_depth; +struct workqueue_struct *commit_wq; +/* Comment? -Hans */ void (*end_io_handler) (struct buffer_head *,int );hashf_t s_hash_function;/* pointer to function which is used
fs/reiserfs/super.c +15 -6
@@ -560,6 +560,7 @@ static void reiserfs_put_super(struct sureiserfs_write_unlock (s);mutex_destroy (&REISERFS_SB (s)->lock); +destroy_workqueue (REISERFS_SB (s)->commit_wq);kfree (s->s_fs_info); s->s_fs_info =NULL ; }
@@ -1796,6 +1797,14 @@ static int reiserfs_fill_super(struct sumutex_init (&sbi->lock); sbi->lock_depth =-1 ; + sbi->commit_wq =alloc_workqueue ("reiserfs/%s" ,WQ_MEM_RECLAIM ,0 , + s->s_id); +if (!sbi->commit_wq) { +SWARN (silent, s,"" ,"Cannot allocate commit workqueue" ); + errval = -ENOMEM ; + goto error_unlocked; + } + jdev_name =NULL ; if (reiserfs_parse_options (s, (char *)data, &(sbi->s_mount_opt), &blocks, &jdev_name,
@@ -2402,18 +2411,18 @@ static int __init init_reiserfs_fs(void) {int ret; -if ((ret =init_inodecache ())) { + ret =init_inodecache (); +if (ret)return ret; - }reiserfs_proc_info_global_init (); ret =register_filesystem (&reiserfs_fs_type); +if (ret) + goto out; -if (ret ==0 ) { -return 0 ; - } - +return 0 ; +out:reiserfs_proc_info_global_done ();destroy_inodecache ();
PATCH 2/29 reiserfs: cleanup, rename key and item accessors to more friendly names
In reply to Jeff MahoneyThis patch does a quick search and replace:B_N_PITEM_HEAD() -> item_head()B_N_PDELIM_KEY() -> internal_key()B_N_PKEY() -> leaf_key()B_N_PITEM() -> item_body()
And the item_head version:B_I_PITEM() -> ih_item_body()I_ENTRY_COUNT() -> ih_entry_count()
And the treepath variants:get_ih() -> tp_item_head()PATH_PITEM_HEAD() -> tp_item_head()get_item() -> tp_item_body()
... which makes the code much easier on the eyes.
I've also removed a few unused macros.
Checkpatch will complain about the 80 character limit for do_balan.c. I've addressed that in a later patchset to split up balance_leaf().
--- fs/reiserfs/bitmap.c | 4 fs/reiserfs/dir.c | 8 - fs/reiserfs/do_balan.c | 98 +++++++++++------------ fs/reiserfs/fix_node.c | 20 ++-- fs/reiserfs/ibalance.c | 20 ++-- fs/reiserfs/inode.c | 36 ++++---- fs/reiserfs/item_ops.c | 4 fs/reiserfs/lbalance.c | 76 +++++++++--------- fs/reiserfs/namei.c | 14 +-- fs/reiserfs/prints.c | 10 +- fs/reiserfs/reiserfs.h | 175 ++++++++++++++++++++++++++---------------- fs/reiserfs/stree.c | 44 +++++----- fs/reiserfs/super.c | 4 fs/reiserfs/tail_conversion.c | 10 +- 14 files changed, 284 insertions(+), 239 deletions(-)
fs/reiserfs/bitmap.c +2 -2
@@ -819,9 +819,9 @@ static int get_left_neighbor(reiserfs_bl path = hint->path; bh =get_last_bh (path);RFALSE (!bh,"green-4002: Illegal path specified to get_left_neighbor" ); - ih =get_ih (path); + ih =tp_item_head (path); pos_in_item = path->pos_in_item; - item =get_item (path); + item =tp_item_body (path); hint->search_start = bh->b_blocknr;
fs/reiserfs/dir.c +4 -4
@@ -110,17 +110,17 @@ int reiserfs_readdir_inode(struct inode item_num, B_NR_ITEMS(bh));/* and entry must be not more than number of entries in the item */ -RFALSE (I_ENTRY_COUNT (ih) < entry_num, +RFALSE (ih_entry_count (ih) < entry_num,"vs-9010: entry number is too big %d (%d)" , - entry_num,I_ENTRY_COUNT (ih)); + entry_num,ih_entry_count (ih));if (search_res ==POSITION_FOUND - || entry_num <I_ENTRY_COUNT (ih)) { + || entry_num <ih_entry_count (ih)) {/* go through all entries in the directory item beginning from the entry, that has been found */ struct reiserfs_de_head *deh =B_I_DEH (bh, ih) + entry_num; -for (; entry_num <I_ENTRY_COUNT (ih); +for (; entry_num <ih_entry_count (ih); entry_num++, deh++) {int d_reclen;char *d_name;
fs/reiserfs/do_balan.c +49 -49
270 lines not on this page · raw message
fs/reiserfs/fix_node.c +10 -10
@@ -105,7 +105,7 @@ static void create_virtual_node(struct t vn->vn_free_ptr += vn->vn_nr_item *sizeof (struct virtual_item );/* first item in the node */ - ih =B_N_PITEM_HEAD (Sh,0 ); + ih =item_head (Sh,0 );/* define the mergeability for 0-th item (if it is not being deleted) */ if (op_is_left_mergeable(&(ih->ih_key), Sh->b_size)
@@ -128,7 +128,7 @@ static void create_virtual_node(struct t vi->vi_item_len +=ih_item_len (ih + j) +IH_SIZE ; vi->vi_ih = ih + j; - vi->vi_item =B_I_PITEM (Sh, ih + j); + vi->vi_item =ih_item_body (Sh, ih + j); vi->vi_uarea = vn->vn_free_ptr;// FIXME: there is no check, that item operation did not
@@ -168,7 +168,7 @@ static void create_virtual_node(struct tif (tb->CFR[0 ]) {struct reiserfs_key *key; - key =B_N_PDELIM_KEY (tb->CFR[0 ], tb->rkey[0 ]); + key =internal_key (tb->CFR[0 ], tb->rkey[0 ]);if (op_is_left_mergeable (key, Sh->b_size) && (vn->vn_mode !=M_DELETE || vn->vn_affected_item_num !=B_NR_ITEMS (Sh) -1 ))
@@ -182,8 +182,8 @@ static void create_virtual_node(struct t/* we delete last item and it could be merged with right neighbor's first item */ if (! (B_NR_ITEMS (Sh) ==1 - &&is_direntry_le_ih (B_N_PITEM_HEAD (Sh,0 )) - &&I_ENTRY_COUNT (B_N_PITEM_HEAD (Sh,0 )) ==1 )) { + &&is_direntry_le_ih (item_head (Sh,0 )) + &&ih_entry_count (item_head (Sh,0 )) ==1 )) {/* node contains more than 1 item, or item is not directory item, or this item contains more than 1 entry */ print_block (Sh,0 ,-1 ,-1 ); reiserfs_panic(tb->tb_sb, "vs-8045",
@@ -675,10 +675,10 @@ static int are_leaves_removable(struct t"vs-8125: item number must be 1: it is %d" , B_NR_ITEMS(S0)); - ih =B_N_PITEM_HEAD (S0 ,0 ); + ih =item_head (S0 ,0 );if (tb->CFR[0 ] && !comp_short_le_keys (&(ih->ih_key), -B_N_PDELIM_KEY (tb->CFR[0 ], +internal_key (tb->CFR[0 ], tb->rkey[0 ])))if (is_direntry_le_ih (ih)) {/* Directory must be in correct state here: that is
@@ -1036,7 +1036,7 @@ static int get_far_parent(struct tree_ba/* Form key to get parent of the left/right neighbor. */ le_key2cpu_key(&s_lr_father_key, - B_N_PDELIM_KEY(*pcom_father, + internal_key(*pcom_father, (c_lr_par == LEFT_PARENTS) ? (tb->lkey[h - 1] = position -
@@ -1175,9 +1175,9 @@ static inline int can_node_be_removed(instruct item_head *ih;struct reiserfs_key *r_key =NULL ; - ih =B_N_PITEM_HEAD (Sh,0 ); + ih =item_head (Sh,0 );if (tb->CFR[h]) - r_key =B_N_PDELIM_KEY (tb->CFR[h], tb->rkey[h]); + r_key =internal_key (tb->CFR[h], tb->rkey[h]);if (lfree + rfree + sfree <MAX_CHILD_SIZE (Sh) + levbytes /* shifting may merge items which might save space */
fs/reiserfs/ibalance.c +10 -10
@@ -153,7 +153,7 @@ static void internal_insert_childs(strucmemcpy (dc, new_dc,DC_SIZE * count);/* prepare space for count items */ - ih =B_N_PDELIM_KEY (cur, ((to ==-1 ) ?0 : to)); + ih =internal_key (cur, ((to ==-1 ) ?0 : to));memmove (ih + count, ih, (nr - to) *KEY_SIZE + (nr +1 + count) *DC_SIZE );
@@ -233,7 +233,7 @@ static void internal_delete_pointers_ite dc =B_N_CHILD (cur, first_p);memmove (dc, dc + del_num, (nr +1 - first_p - del_num) *DC_SIZE ); - key =B_N_PDELIM_KEY (cur, first_i); + key =internal_key (cur, first_i);memmove (key, key + del_num, (nr - first_i - del_num) *KEY_SIZE + (nr +1 - del_num) *DC_SIZE );
@@ -330,13 +330,13 @@ static void internal_copy_pointers_itemsmemcpy (dc,B_N_CHILD (src, src_order),DC_SIZE * cpy_num);/* prepare space for cpy_num - 1 item headers */ - key =B_N_PDELIM_KEY (dest, dest_order); + key =internal_key (dest, dest_order);memmove (key + cpy_num -1 , key,KEY_SIZE * (nr_dest - dest_order) +DC_SIZE * (nr_dest + cpy_num));/* insert headers */ -memcpy (key,B_N_PDELIM_KEY (src, src_order),KEY_SIZE * (cpy_num -1 )); +memcpy (key,internal_key (src, src_order),KEY_SIZE * (cpy_num -1 ));/* sizes, item number */ set_blkh_nr_item (blkh,blkh_nr_item (blkh) + (cpy_num -1 ));
@@ -429,12 +429,12 @@ static void internal_insert_key(struct b nr =blkh_nr_item (blkh);/* prepare space for inserting key */ - key =B_N_PDELIM_KEY (dest, dest_position_before); + key =internal_key (dest, dest_position_before);memmove (key +1 , key, (nr - dest_position_before) *KEY_SIZE + (nr +1 ) *DC_SIZE );/* insert key */ -memcpy (key,B_N_PDELIM_KEY (src, src_position),KEY_SIZE ); +memcpy (key,internal_key (src, src_position),KEY_SIZE );/* Change dirt, free space, item number fields. */
@@ -717,7 +717,7 @@ static void replace_lkey(struct tree_balif (B_NR_ITEMS (PATH_H_PBUFFER (tb->tb_path, h)) ==0 )return ; -memcpy (B_N_PDELIM_KEY (tb->CFL[h], tb->lkey[h]), key,KEY_SIZE ); +memcpy (internal_key (tb->CFL[h], tb->lkey[h]), key,KEY_SIZE );do_balance_mark_internal_dirty (tb, tb->CFL[h],0 ); }
@@ -732,7 +732,7 @@ static void replace_rkey(struct tree_bal"R[h] can not be empty if it exists (item number=%d)" , B_NR_ITEMS(tb->R[h])); -memcpy (B_N_PDELIM_KEY (tb->CFR[h], tb->rkey[h]), key,KEY_SIZE ); +memcpy (internal_key (tb->CFR[h], tb->rkey[h]), key,KEY_SIZE );do_balance_mark_internal_dirty (tb, tb->CFR[h],0 ); }
@@ -997,7 +997,7 @@ int balance_internal(struct tree_balance/* new items don't fall into S_new */ /* store the delimiting key for the next level */ /* new_insert_key = (n - snum)'th key in S[h] */ -memcpy (&new_insert_key,B_N_PDELIM_KEY (tbSh, n - snum), +memcpy (&new_insert_key,internal_key (tbSh, n - snum),KEY_SIZE );/* last parameter is del_par */ internal_move_pointers_items(&dest_bi, &src_bi,
@@ -1008,7 +1008,7 @@ int balance_internal(struct tree_balance/* store the delimiting key for the next level */ /* new_insert_key = (n + insert_item - snum)'th key in S[h] */ memcpy (&new_insert_key, -B_N_PDELIM_KEY (tbSh, n + insert_num - snum), +internal_key (tbSh, n + insert_num - snum),KEY_SIZE );/* last parameter is del_par */ internal_move_pointers_items(&dest_bi, &src_bi,
fs/reiserfs/inode.c +18 -18
@@ -295,9 +295,9 @@ static int _get_block_create_0(struct in }// bh =get_last_bh (&path); - ih =get_ih (&path); + ih =tp_item_head (&path);if (is_indirect_le_ih (ih)) { -__le32 *ind_item = (__le32 *)B_I_PITEM (bh, ih); +__le32 *ind_item = (__le32 *)ih_item_body (bh, ih);/* FIXME: here we could cache indirect item or part of it in the inode to avoid search_by_key in case of subsequent
@@ -383,7 +383,7 @@ static int _get_block_create_0(struct in }else { chars =ih_item_len (ih) - path.pos_in_item; } -memcpy (p,B_I_PITEM (bh, ih) + path.pos_in_item, chars); +memcpy (p,ih_item_body (bh, ih) + path.pos_in_item, chars);if (done)break ;
@@ -404,7 +404,7 @@ static int _get_block_create_0(struct in// i/o error most likely break ; bh =get_last_bh (&path); - ih =get_ih (&path); + ih =tp_item_head (&path); }while (1 );flush_dcache_page (bh_result->b_page);
@@ -684,8 +684,8 @@ int reiserfs_get_block(struct inode *ino } bh =get_last_bh (&path); - ih =get_ih (&path); - item =get_item (&path); + ih =tp_item_head (&path); + item =tp_item_body (&path); pos_in_item = path.pos_in_item; fs_gen =get_generation (inode->i_sb);
@@ -1031,8 +1031,8 @@ int reiserfs_get_block(struct inode *ino goto failure; } bh =get_last_bh (&path); - ih =get_ih (&path); - item =get_item (&path); + ih =tp_item_head (&path); + item =tp_item_body (&path); pos_in_item = path.pos_in_item; }while (1 );
@@ -1133,7 +1133,7 @@ static void init_inode(struct inode *ino//int version = ITEM_VERSION_1; bh =PATH_PLAST_BUFFER (path); - ih =PATH_PITEM_HEAD (path); + ih =tp_item_head (path);copy_key (INODE_PKEY (inode), &(ih->ih_key));
@@ -1147,7 +1147,7 @@ static void init_inode(struct inode *inoif (stat_data_v1 (ih)) {struct stat_data_v1 *sd = - (struct stat_data_v1 *)B_I_PITEM (bh, ih); + (struct stat_data_v1 *)ih_item_body (bh, ih);unsigned long blocks;set_inode_item_key_version (inode,KEY_FORMAT_3_5 );
@@ -1195,7 +1195,7 @@ static void init_inode(struct inode *ino }else {// new stat data found, but object may have old items // (directories and symlinks) -struct stat_data *sd = (struct stat_data *)B_I_PITEM (bh, ih); +struct stat_data *sd = (struct stat_data *)ih_item_body (bh, ih); inode->i_mode =sd_v2_mode (sd);set_nlink (inode,sd_v2_nlink (sd));
@@ -1307,7 +1307,7 @@ static void update_stat_data(struct treestruct item_head *ih; bh =PATH_PLAST_BUFFER (path); - ih =PATH_PITEM_HEAD (path); + ih =tp_item_head (path);if (!is_statdata_le_ih (ih)) reiserfs_panic(inode->i_sb, "vs-13065", "key %k, found item %h",
@@ -1315,9 +1315,9 @@ static void update_stat_data(struct treeif (stat_data_v1 (ih)) {// path points to old stat data -inode2sd_v1 (B_I_PITEM (bh, ih), inode, size); +inode2sd_v1 (ih_item_body (bh, ih), inode, size); }else { -inode2sd (B_I_PITEM (bh, ih), inode, size); +inode2sd (ih_item_body (bh, ih), inode, size); }return ;
@@ -1368,7 +1368,7 @@ void reiserfs_update_sd_size(struct reis** search if the stat data item has moved */ bh =get_last_bh (&path); - ih =get_ih (&path); + ih =tp_item_head (&path);copy_item_head (&tmp_ih, ih); fs_gen =get_generation (inode->i_sb);reiserfs_prepare_for_journal (inode->i_sb, bh,1 );
@@ -2232,8 +2232,8 @@ static int map_block_for_writepage(struc } bh =get_last_bh (&path); - ih =get_ih (&path); - item =get_item (&path); + ih =tp_item_head (&path); + item =tp_item_body (&path); pos_in_item = path.pos_in_item;/* we've found an unformatted node */
@@ -2281,7 +2281,7 @@ static int map_block_for_writepage(struc goto research; } -memcpy (B_I_PITEM (bh, ih) + pos_in_item, p + bytes_copied, +memcpy (ih_item_body (bh, ih) + pos_in_item, p + bytes_copied, copy_size);journal_mark_dirty (&th, inode->i_sb, bh);
fs/reiserfs/item_ops.c +2 -2
@@ -396,7 +396,7 @@ static void direntry_print_item(struct i deh = (struct reiserfs_de_head *)item; -for (i =0 ; i <I_ENTRY_COUNT (ih); i++, deh++) { +for (i =0 ; i <ih_entry_count (ih); i++, deh++) { namelen = (i ? (deh_location (deh -1 )) :ih_item_len (ih)) -deh_location (deh);
@@ -430,7 +430,7 @@ static void direntry_check_item(struct i// FIXME: type something here! deh = (struct reiserfs_de_head *)item; -for (i =0 ; i <I_ENTRY_COUNT (ih); i++, deh++) { +for (i =0 ; i <ih_entry_count (ih); i++, deh++) { ; } }
fs/reiserfs/lbalance.c +38 -38
246 lines not on this page · raw message
fs/reiserfs/namei.c +7 -7
@@ -31,7 +31,7 @@ static int bin_search_in_dir_item(structint rbound, lbound, j; lbound =0 ; - rbound =I_ENTRY_COUNT (ih) -1 ; + rbound =ih_entry_count (ih) -1 ;for (j = (rbound + lbound) /2 ; lbound <= rbound; j = (rbound + lbound) /2 ) {
@@ -57,7 +57,7 @@ static inline void set_de_item_location( struct treepath *path) { de->de_bh =get_last_bh (path); - de->de_ih =get_ih (path); + de->de_ih =tp_item_head (path); de->de_deh =B_I_DEH (de->de_bh, de->de_ih); de->de_item_num =PATH_LAST_POSITION (path); }
@@ -71,7 +71,7 @@ inline void set_de_name_and_namelen(stru de->de_entrylen =entry_length (de->de_bh, de->de_ih, de->de_entry_num); de->de_namelen = de->de_entrylen - (de_with_sd (deh) ?SD_SIZE :0 ); - de->de_name =B_I_PITEM (de->de_bh, de->de_ih) +deh_location (deh); + de->de_name =ih_item_body (de->de_bh, de->de_ih) +deh_location (deh);if (de->de_name[de->de_namelen -1 ] ==0 ) de->de_namelen =strlen (de->de_name); }
@@ -220,7 +220,7 @@ static int linear_search_in_dir_item(str i = de->de_entry_num; -if (i ==I_ENTRY_COUNT (de->de_ih) || +if (i ==ih_entry_count (de->de_ih) ||GET_HASH_VALUE (deh_offset (deh + i)) !=GET_HASH_VALUE (cpu_key_k_offset (key))) { i--;
@@ -1331,7 +1331,7 @@ static int reiserfs_rename(struct inodereturn -EIO ; } -copy_item_head (&old_entry_ih,get_ih (&old_entry_path)); +copy_item_head (&old_entry_ih,tp_item_head (&old_entry_path));reiserfs_prepare_for_journal (old_inode->i_sb, old_de.de_bh,1 );
@@ -1351,7 +1351,7 @@ static int reiserfs_rename(struct inodereturn -EIO ; } -copy_item_head (&new_entry_ih,get_ih (&new_entry_path)); +copy_item_head (&new_entry_ih,tp_item_head (&new_entry_path));reiserfs_prepare_for_journal (old_inode->i_sb, new_de.de_bh,1 );
@@ -1369,7 +1369,7 @@ static int reiserfs_rename(struct inodereturn -EIO ; }copy_item_head (&dot_dot_ih, -get_ih (&dot_dot_entry_path)); +tp_item_head (&dot_dot_entry_path));// node containing ".." gets into transaction reiserfs_prepare_for_journal (old_inode->i_sb, dot_dot_de.de_bh,1 );
fs/reiserfs/prints.c +5 -5
@@ -439,7 +439,7 @@ static int print_internal(struct buffer_ dc =B_N_CHILD (bh, from);reiserfs_printk ("PTR %d: %y " , from, dc); -for (i = from, key =B_N_PDELIM_KEY (bh, from), dc++; i < to; +for (i = from, key =internal_key (bh, from), dc++; i < to; i++, key++, dc++) {reiserfs_printk ("KEY %d: %k PTR %d: %y " , i, key, i +1 , dc);if (i && i %4 ==0 )
@@ -463,7 +463,7 @@ static int print_leaf(struct buffer_headcheck_leaf (bh); blkh =B_BLK_HEAD (bh); - ih =B_N_PITEM_HEAD (bh,0 ); + ih =item_head (bh,0 ); nr =blkh_nr_item (blkh); printk
@@ -496,7 +496,7 @@ static int print_leaf(struct buffer_head ("-------------------------------------------------------------------------------\n" );reiserfs_printk ("|%2d| %h |\n" , i, ih);if (print_mode &PRINT_LEAF_ITEMS ) -op_print_item (ih,B_I_PITEM (bh, ih)); +op_print_item (ih,ih_item_body (bh, ih)); } printk
@@ -744,8 +744,8 @@ void check_leaf(struct buffer_head *bh)if (!bh)return ;check_leaf_block_head (bh); -for (i =0 , ih =B_N_PITEM_HEAD (bh,0 ); i <B_NR_ITEMS (bh); i++, ih++) -op_check_item (ih,B_I_PITEM (bh, ih)); +for (i =0 , ih =item_head (bh,0 ); i <B_NR_ITEMS (bh); i++, ih++) +op_check_item (ih,ih_item_body (bh, ih)); }void check_internal (struct buffer_head *bh)
fs/reiserfs/reiserfs.h +110 -65
234 lines not on this page · raw message
fs/reiserfs/stree.c +22 -22
173 lines not on this page · raw message
fs/reiserfs/super.c +2 -2
@@ -259,7 +259,7 @@ static int finish_unfinished(struct supebreak ; } item_pos--; - ih =B_N_PITEM_HEAD (bh, item_pos); + ih =item_head (bh, item_pos);if (le32_to_cpu (ih->ih_key.k_dir_id) !=MAX_KEY_OBJECTID )/* there are no "save" links anymore */
@@ -272,7 +272,7 @@ static int finish_unfinished(struct supe truncate =0 ;/* reiserfs_iget needs k_dirid and k_objectid only */ - item =B_I_PITEM (bh, ih); + item =ih_item_body (bh, ih); obj_key.on_disk_key.k_dir_id =le32_to_cpu (*(__le32 *) item); obj_key.on_disk_key.k_objectid =le32_to_cpu (ih->ih_key.k_objectid);
fs/reiserfs/tail_conversion.c +5 -5
@@ -20,7 +20,7 @@ int direct2indirect(struct reiserfs_tran {struct super_block *sb = inode->i_sb;struct buffer_head *up_to_date_bh; -struct item_head *p_le_ih =PATH_PITEM_HEAD (path); +struct item_head *p_le_ih =tp_item_head (path);unsigned long total_tail =0 ;struct cpu_key end_key;/* Key to search for the last byte of the converted item. */
@@ -55,7 +55,7 @@ int direct2indirect(struct reiserfs_tranreturn -EIO ; } - p_le_ih =PATH_PITEM_HEAD (path); + p_le_ih =tp_item_head (path); unfm_ptr =cpu_to_le32 (unbh->b_blocknr);
@@ -94,7 +94,7 @@ int direct2indirect(struct reiserfs_tran POSITION_FOUND) reiserfs_panic(sb, "PAP-14050", "direct item (%K) not found", &end_key); - p_le_ih =PATH_PITEM_HEAD (path); + p_le_ih =tp_item_head (path);RFALSE (!is_direct_le_ih (p_le_ih),"vs-14055: direct item expected(%K), found %h" , &end_key, p_le_ih);
@@ -194,7 +194,7 @@ int indirect2direct(struct reiserfs_tran *mode =M_SKIP_BALANCING ;/* store item head path points to. */ -copy_item_head (&s_ih,PATH_PITEM_HEAD (path)); +copy_item_head (&s_ih,tp_item_head (path)); tail_len = (n_new_file_size & (block_size -1 ));if (get_inode_sd_version (inode) ==STAT_DATA_V2 )
@@ -220,7 +220,7 @@ int indirect2direct(struct reiserfs_tranreiserfs_panic (sb,"PAP-5520" ,"item to be converted %K does not exist" , item_key); -copy_item_head (&s_ih,PATH_PITEM_HEAD (path)); +copy_item_head (&s_ih,tp_item_head (path));#ifdef CONFIG_REISERFS_CHECK pos = le_ih_k_offset(&s_ih) - 1 + (ih_item_len(&s_ih) / UNFM_P_SIZE -
PATCH 4/29 reiserfs: cleanup, remove nblocks argument from journal_end
In reply to Jeff Mahoneyjournal_end takes a block count argument but doesn't actually use it for anything. We can remove it.
--- fs/reiserfs/file.c | 4 ++-- fs/reiserfs/inode.c | 33 +++++++++++++++------------------ fs/reiserfs/journal.c | 38 +++++++++++++++++--------------------- fs/reiserfs/namei.c | 38 +++++++++++++++++++------------------- fs/reiserfs/reiserfs.h | 7 +++---- fs/reiserfs/resize.c | 6 +++--- fs/reiserfs/stree.c | 3 +-- fs/reiserfs/super.c | 30 ++++++++++++------------------ fs/reiserfs/xattr.c | 4 ++-- fs/reiserfs/xattr_acl.c | 2 +- 10 files changed, 75 insertions(+), 90 deletions(-)
fs/reiserfs/file.c +2 -2
@@ -96,7 +96,7 @@ static int reiserfs_file_release(struct#ifdef REISERFS_PREALLOCATE reiserfs_discard_prealloc (&th, inode);#endif - err =journal_end (&th, inode->i_sb,1 ); + err =journal_end (&th, inode->i_sb);/* copy back the error code from journal_begin */ if (!err)
@@ -227,7 +227,7 @@ int reiserfs_commit_page(struct inode *i } }if (logit) { - ret =journal_end (&th, s, bh_per_page +1 ); + ret =journal_end (&th, s); drop_write_lock:reiserfs_write_unlock (s); }
fs/reiserfs/inode.c +15 -18
@@ -72,7 +72,7 @@ void reiserfs_evict_inode(struct inode *reiserfs_write_lock_nested (inode->i_sb, depth); } -if (journal_end (&th, inode->i_sb, jbegin_count)) +if (journal_end (&th, inode->i_sb)) goto out;/*
@@ -252,7 +252,6 @@ static int restart_transaction(struct re struct inode *inode, struct treepath *path) { struct super_block *s = th->t_super; -int len = th->t_blocks_allocated;int err;BUG_ON (!th->t_trans_id);
@@ -265,7 +264,7 @@ static int restart_transaction(struct rereturn 0 ; }reiserfs_update_sd (th, inode); - err =journal_end (th, s, len); + err =journal_end (th, s);if (!err) { err =journal_begin (th, s,JOURNAL_PER_BALANCE_CNT *6 );if (!err)
@@ -1791,7 +1790,7 @@ int reiserfs_write_inode(struct inode *ireiserfs_write_lock (inode->i_sb);if (!journal_begin (&th, inode->i_sb, jbegin_count)) {reiserfs_update_sd (&th, inode); -journal_end_sync (&th, inode->i_sb, jbegin_count); +journal_end_sync (&th, inode->i_sb); }reiserfs_write_unlock (inode->i_sb); }
@@ -2098,7 +2097,7 @@ int reiserfs_new_inode(struct reiserfs_tif (retval) { err = retval;reiserfs_check_path (&path_to_key); -journal_end (th, th->t_super, th->t_blocks_allocated); +journal_end (th, th->t_super); goto out_inserted_sd; }
@@ -2109,7 +2108,7 @@ int reiserfs_new_inode(struct reiserfs_tif (retval) { err = retval;reiserfs_check_path (&path_to_key); -journal_end (th, th->t_super, th->t_blocks_allocated); +journal_end (th, th->t_super); goto out_inserted_sd; } }else if (inode->i_sb->s_flags &MS_POSIXACL ) {
@@ -2126,8 +2125,7 @@ int reiserfs_new_inode(struct reiserfs_tif (retval) { err = retval;reiserfs_check_path (&path_to_key); - retval =journal_end (th, th->t_super, - th->t_blocks_allocated); + retval =journal_end (th, th->t_super);if (retval) err = retval; goto out_inserted_sd;
@@ -2149,7 +2147,7 @@ int reiserfs_new_inode(struct reiserfs_treiserfs_write_lock_nested (inode->i_sb, depth); out_end_trans: -journal_end (th, th->t_super, th->t_blocks_allocated); +journal_end (th, th->t_super);/* * Drop can be outside and it needs more credits so it's better * to have it outside
@@ -2319,8 +2317,7 @@ int reiserfs_truncate_file(struct inode*/ add_save_link (&th, inode,1 ); err2 =reiserfs_do_truncate (&th, inode, page, update_timestamps); - error = -journal_end (&th, inode->i_sb,JOURNAL_PER_BALANCE_CNT *2 +1 ); + error =journal_end (&th, inode->i_sb);if (error) goto out;
@@ -2483,7 +2480,7 @@ static int map_block_for_writepage(struc out:pathrelse (&path);if (trans_running) { -int err =journal_end (&th, inode->i_sb, jbegin_count); +int err =journal_end (&th, inode->i_sb);if (err) retval = err; trans_running =0 ;
@@ -2653,7 +2650,7 @@ static int reiserfs_write_full_page(stru }while ((bh = bh->b_this_page) != head);if (checked) { - error =journal_end (&th, s, bh_per_page +1 ); + error =journal_end (&th, s);reiserfs_write_unlock (s);if (error) goto fail;
@@ -2956,7 +2953,7 @@ static int reiserfs_write_end(struct filmark_inode_dirty (inode);reiserfs_update_sd (&myth, inode); update_sd =1 ; - ret =journal_end (&myth, inode->i_sb,1 ); + ret =journal_end (&myth, inode->i_sb);if (ret) goto journal_error; }
@@ -3045,7 +3042,7 @@ int reiserfs_commit_write(struct file *fmark_inode_dirty (inode);reiserfs_update_sd (&myth, inode); update_sd =1 ; - ret =journal_end (&myth, inode->i_sb,1 ); + ret =journal_end (&myth, inode->i_sb);if (ret) goto journal_error; }
@@ -3349,7 +3346,7 @@ int reiserfs_setattr(struct dentry *dent err =journal_begin (&th, inode->i_sb,4 );if (!err) {reiserfs_discard_prealloc (&th, inode); - err =journal_end (&th, inode->i_sb,4 ); + err =journal_end (&th, inode->i_sb); }if (err) error = err;
@@ -3401,7 +3398,7 @@ int reiserfs_setattr(struct dentry *dent error =dquot_transfer (inode, attr);reiserfs_write_lock (inode->i_sb);if (error) { -journal_end (&th, inode->i_sb, jbegin_count); +journal_end (&th, inode->i_sb);reiserfs_write_unlock (inode->i_sb); goto out; }
@@ -3415,7 +3412,7 @@ int reiserfs_setattr(struct dentry *dentif (attr->ia_valid &ATTR_GID ) inode->i_gid = attr->ia_gid;mark_inode_dirty (inode); - error =journal_end (&th, inode->i_sb, jbegin_count); + error =journal_end (&th, inode->i_sb);reiserfs_write_unlock (inode->i_sb);if (error) goto out;
fs/reiserfs/journal.c +17 -21
@@ -84,8 +84,7 @@#define WAIT 4/* wait for the log blocks to hit the disk */ static int do_journal_end (struct reiserfs_transaction_handle *, -struct super_block *,unsigned long nblocks, -int flags); +struct super_block *,int flags);static int flush_journal_list (struct super_block *s,struct reiserfs_journal_list *jl,int flushall); static int flush_commit_list(struct super_block *s,
@@ -1921,7 +1920,7 @@ static int do_journal_release(struct reiif (!error && !(sb->s_flags &MS_RDONLY )) {/* end the current trans */ BUG_ON (!th->t_trans_id); -do_journal_end (th, sb,10 ,FLUSH_ALL ); +do_journal_end (th, sb,FLUSH_ALL );/* * make sure something gets logged to force
@@ -1933,7 +1932,7 @@ static int do_journal_release(struct rei 1);journal_mark_dirty (&myth, sb,SB_BUFFER_WITH_SB (sb)); -do_journal_end (&myth, sb,1 ,FLUSH_ALL ); +do_journal_end (&myth, sb,FLUSH_ALL ); flushed =1 ; } }
@@ -1947,7 +1946,7 @@ static int do_journal_release(struct rei 1);journal_mark_dirty (&myth, sb,SB_BUFFER_WITH_SB (sb)); -do_journal_end (&myth, sb,1 ,FLUSH_ALL ); +do_journal_end (&myth, sb,FLUSH_ALL ); } }
@@ -3102,9 +3101,9 @@ static int do_journal_begin_r(struct rei/* someone might have ended the transaction while we joined */ if (old_trans_id != journal->j_trans_id) { - retval =do_journal_end (&myth, sb,1 ,0 ); + retval =do_journal_end (&myth, sb,0 ); }else { - retval =do_journal_end (&myth, sb,1 ,COMMIT_NOW ); + retval =do_journal_end (&myth, sb,COMMIT_NOW ); }if (retval)
@@ -3174,7 +3173,7 @@ int reiserfs_end_persistent_transaction(struct super_block *s = th->t_super;int ret =0 ;if (th->t_trans_id) - ret =journal_end (th, th->t_super, th->t_blocks_allocated); + ret =journal_end (th, th->t_super);else ret = -EIO ;if (th->t_refcount ==0 ) {
@@ -3375,8 +3374,7 @@ int journal_mark_dirty(struct reiserfs_treturn 0 ; } -int journal_end (struct reiserfs_transaction_handle *th, -struct super_block *sb,unsigned long nblocks) +int journal_end (struct reiserfs_transaction_handle *th,struct super_block *sb) {if (!current->journal_info && th->t_refcount >1 ) reiserfs_warning(sb, "REISER-NESTING",
@@ -3404,7 +3402,7 @@ int journal_end(struct reiserfs_transact }return 0 ; }else { -return do_journal_end (th, sb, nblocks,0 ); +return do_journal_end (th, sb,0 ); } }
@@ -3514,7 +3512,7 @@ static int can_dirty(struct reiserfs_jou* will wait until the current transaction is done/committed before returning */ int journal_end_sync (struct reiserfs_transaction_handle *th, -struct super_block *sb,unsigned long nblocks) +struct super_block *sb) {struct reiserfs_journal *journal =SB_JOURNAL (sb);
@@ -3526,7 +3524,7 @@ int journal_end_sync(struct reiserfs_tra 1);journal_mark_dirty (th, sb,SB_BUFFER_WITH_SB (sb)); } -return do_journal_end (th, sb, nblocks,COMMIT_NOW |WAIT ); +return do_journal_end (th, sb,COMMIT_NOW |WAIT ); }/* writeback the pending async commits to disk */
@@ -3586,7 +3584,7 @@ void reiserfs_flush_old_commits(struct s* no sense to do an async commit so that kreiserfsd * can do it later */ -do_journal_end (&th, sb,1 ,COMMIT_NOW |WAIT ); +do_journal_end (&th, sb,COMMIT_NOW |WAIT ); } } }
@@ -3607,8 +3605,7 @@ void reiserfs_flush_old_commits(struct s* writers in the log. */ static int check_journal_end (struct reiserfs_transaction_handle *th, -struct super_block *sb,unsigned long nblocks, -int flags) +struct super_block *sb,int flags) {time_t now;
@@ -3867,11 +3864,11 @@ static int __commit_trans_jl(struct inodreiserfs_prepare_for_journal (sb,SB_BUFFER_WITH_SB (sb),1 );journal_mark_dirty (&th, sb,SB_BUFFER_WITH_SB (sb)); - ret =journal_end (&th, sb,1 ); + ret =journal_end (&th, sb); goto flush_commit_only; } - ret =journal_end_sync (&th, sb,1 ); + ret =journal_end_sync (&th, sb);if (!ret) ret =1 ;
@@ -3978,8 +3975,7 @@ int reiserfs_prepare_for_journal(struct* journal lists, etc just won't happen. */ static int do_journal_end (struct reiserfs_transaction_handle *th, -struct super_block *sb,unsigned long nblocks, -int flags) +struct super_block *sb,int flags) {struct reiserfs_journal *journal =SB_JOURNAL (sb);struct reiserfs_journal_cnode *cn, *next, *jl_cn;
@@ -4035,7 +4031,7 @@ static int do_journal_end(struct reiserf* not return 1 it tells us if we should continue with the * journal_end, or just return */ -if (!check_journal_end (th, sb, nblocks, flags)) { +if (!check_journal_end (th, sb, flags)) {reiserfs_schedule_old_flush (sb);wake_queued_writers (sb);reiserfs_async_progress_wait (sb);
fs/reiserfs/namei.c +19 -19
@@ -672,7 +672,7 @@ static int reiserfs_create(struct inodeint err;drop_nlink (inode);reiserfs_update_sd (&th, inode); - err =journal_end (&th, dir->i_sb, jbegin_count); + err =journal_end (&th, dir->i_sb);if (err) retval = err;unlock_new_inode (inode);
@@ -684,7 +684,7 @@ static int reiserfs_create(struct inodeunlock_new_inode (inode);d_instantiate (dentry, inode); - retval =journal_end (&th, dir->i_sb, jbegin_count); + retval =journal_end (&th, dir->i_sb); out_failed:reiserfs_write_unlock (dir->i_sb);
@@ -755,7 +755,7 @@ static int reiserfs_mknod(struct inode *int err;drop_nlink (inode);reiserfs_update_sd (&th, inode); - err =journal_end (&th, dir->i_sb, jbegin_count); + err =journal_end (&th, dir->i_sb);if (err) retval = err;unlock_new_inode (inode);
@@ -765,7 +765,7 @@ static int reiserfs_mknod(struct inode *unlock_new_inode (inode);d_instantiate (dentry, inode); - retval =journal_end (&th, dir->i_sb, jbegin_count); + retval =journal_end (&th, dir->i_sb); out_failed:reiserfs_write_unlock (dir->i_sb);
@@ -847,7 +847,7 @@ static int reiserfs_mkdir(struct inode *clear_nlink (inode);DEC_DIR_INODE_NLINK (dir);reiserfs_update_sd (&th, inode); - err =journal_end (&th, dir->i_sb, jbegin_count); + err =journal_end (&th, dir->i_sb);if (err) retval = err;unlock_new_inode (inode);
@@ -859,7 +859,7 @@ static int reiserfs_mkdir(struct inode *unlock_new_inode (inode);d_instantiate (dentry, inode); - retval =journal_end (&th, dir->i_sb, jbegin_count); + retval =journal_end (&th, dir->i_sb); out_failed:reiserfs_write_unlock (dir->i_sb);return retval;
@@ -956,7 +956,7 @@ static int reiserfs_rmdir(struct inode */* prevent empty directory from getting lost */ add_save_link (&th, inode,0 /* not truncate */ ); - retval =journal_end (&th, dir->i_sb, jbegin_count); + retval =journal_end (&th, dir->i_sb);reiserfs_check_path (&path); out_rmdir:reiserfs_write_unlock (dir->i_sb);
@@ -969,7 +969,7 @@ static int reiserfs_rmdir(struct inode ** release path if operation was not complete */ pathrelse (&path); - err =journal_end (&th, dir->i_sb, jbegin_count); + err =journal_end (&th, dir->i_sb);reiserfs_write_unlock (dir->i_sb);return err ? err : retval; }
@@ -1059,14 +1059,14 @@ static int reiserfs_unlink(struct inode/* prevent file from getting lost */ add_save_link (&th, inode,0 /* not truncate */ ); - retval =journal_end (&th, dir->i_sb, jbegin_count); + retval =journal_end (&th, dir->i_sb);reiserfs_check_path (&path);reiserfs_write_unlock (dir->i_sb);return retval; end_unlink:pathrelse (&path); - err =journal_end (&th, dir->i_sb, jbegin_count); + err =journal_end (&th, dir->i_sb);reiserfs_check_path (&path);if (err) retval = err;
@@ -1153,7 +1153,7 @@ static int reiserfs_symlink(struct inodeint err;drop_nlink (inode);reiserfs_update_sd (&th, inode); - err =journal_end (&th, parent_dir->i_sb, jbegin_count); + err =journal_end (&th, parent_dir->i_sb);if (err) retval = err;unlock_new_inode (inode);
@@ -1163,7 +1163,7 @@ static int reiserfs_symlink(struct inodeunlock_new_inode (inode);d_instantiate (dentry, inode); - retval =journal_end (&th, parent_dir->i_sb, jbegin_count); + retval =journal_end (&th, parent_dir->i_sb); out_failed:reiserfs_write_unlock (parent_dir->i_sb);return retval;
@@ -1213,7 +1213,7 @@ static int reiserfs_link(struct dentry *if (retval) {int err;drop_nlink (inode); - err =journal_end (&th, dir->i_sb, jbegin_count); + err =journal_end (&th, dir->i_sb);reiserfs_write_unlock (dir->i_sb);return err ? err : retval; }
@@ -1223,7 +1223,7 @@ static int reiserfs_link(struct dentry *ihold (inode);d_instantiate (dentry, inode); - retval =journal_end (&th, dir->i_sb, jbegin_count); + retval =journal_end (&th, dir->i_sb);reiserfs_write_unlock (dir->i_sb);return retval; }
@@ -1385,7 +1385,7 @@ static int reiserfs_rename(struct inode "new entry is found, new inode == 0"); } }else if (retval) { -int err =journal_end (&th, old_dir->i_sb, jbegin_count); +int err =journal_end (&th, old_dir->i_sb);reiserfs_write_unlock (old_dir->i_sb);return err ? err : retval; }
@@ -1412,7 +1412,7 @@ static int reiserfs_rename(struct inode &old_entry_path, &old_de)) != NAME_FOUND) {pathrelse (&old_entry_path); -journal_end (&th, old_dir->i_sb, jbegin_count); +journal_end (&th, old_dir->i_sb);reiserfs_write_unlock (old_dir->i_sb);return -EIO ; }
@@ -1436,7 +1436,7 @@ static int reiserfs_rename(struct inodeif (retval !=NAME_FOUND_INVISIBLE && retval !=NAME_FOUND ) {pathrelse (&new_entry_path);pathrelse (&old_entry_path); -journal_end (&th, old_dir->i_sb, jbegin_count); +journal_end (&th, old_dir->i_sb);reiserfs_write_unlock (old_dir->i_sb);return -EIO ; }
@@ -1454,7 +1454,7 @@ static int reiserfs_rename(struct inodepathrelse (&dot_dot_entry_path);pathrelse (&new_entry_path);pathrelse (&old_entry_path); -journal_end (&th, old_dir->i_sb, jbegin_count); +journal_end (&th, old_dir->i_sb);reiserfs_write_unlock (old_dir->i_sb);return -EIO ; }
@@ -1601,7 +1601,7 @@ static int reiserfs_rename(struct inodereiserfs_update_sd (&th, new_dentry_inode); } - retval =journal_end (&th, old_dir->i_sb, jbegin_count); + retval =journal_end (&th, old_dir->i_sb);reiserfs_write_unlock (old_dir->i_sb);return retval; }
fs/reiserfs/reiserfs.h +3 -4
@@ -2914,10 +2914,9 @@ int journal_init(struct super_block *, cint journal_release (struct reiserfs_transaction_handle *,struct super_block *);int journal_release_error (struct reiserfs_transaction_handle *,struct super_block *); -int journal_end (struct reiserfs_transaction_handle *,struct super_block *, -unsigned long ); -int journal_end_sync (struct reiserfs_transaction_handle *,struct super_block *, -unsigned long ); +int journal_end (struct reiserfs_transaction_handle *,struct super_block *); +int journal_end_sync (struct reiserfs_transaction_handle *, +struct super_block *);int journal_mark_freed (struct reiserfs_transaction_handle *,struct super_block *,b_blocknr_t blocknr);int journal_transaction_should_end (struct reiserfs_transaction_handle *,int );
fs/reiserfs/resize.c +3 -3
@@ -182,7 +182,7 @@ int reiserfs_resize(struct super_block * info =SB_AP_BITMAP (s) + bmap_nr -1 ; bh =reiserfs_read_bitmap_block (s, bmap_nr -1 );if (!bh) { -int jerr =journal_end (&th, s,10 ); +int jerr =journal_end (&th, s);if (jerr)return jerr;return -EIO ;
@@ -200,7 +200,7 @@ int reiserfs_resize(struct super_block * info =SB_AP_BITMAP (s) + bmap_nr_new -1 ; bh =reiserfs_read_bitmap_block (s, bmap_nr_new -1 );if (!bh) { -int jerr =journal_end (&th, s,10 ); +int jerr =journal_end (&th, s);if (jerr)return jerr;return -EIO ;
@@ -225,5 +225,5 @@ int reiserfs_resize(struct super_block *journal_mark_dirty (&th, s,SB_BUFFER_WITH_SB (s));SB_JOURNAL (s)->j_must_wait =1 ; -return journal_end (&th, s,10 ); +return journal_end (&th, s); }
fs/reiserfs/stree.c +1 -2
@@ -1985,7 +1985,6 @@ int reiserfs_do_truncate(struct reiserfs*/ if (journal_transaction_should_end (th,0 ) ||reiserfs_transaction_free_space (th) <=JOURNAL_FOR_FREE_BLOCK_AND_UPDATE_SD ) { -int orig_len_alloc = th->t_blocks_allocated;pathrelse (&s_search_path);if (update_timestamps) {
@@ -1994,7 +1993,7 @@ int reiserfs_do_truncate(struct reiserfs }reiserfs_update_sd (th, inode); - err =journal_end (th, inode->i_sb, orig_len_alloc); + err =journal_end (th, inode->i_sb);if (err) goto out; err = journal_begin(th, inode->i_sb,
fs/reiserfs/super.c +12 -18
@@ -75,7 +75,7 @@ static int reiserfs_sync_fs(struct superdquot_writeback_dquots (s,-1 );reiserfs_write_lock (s);if (!journal_begin (&th, s,1 )) -if (!journal_end_sync (&th, s,1 )) +if (!journal_end_sync (&th, s))reiserfs_flush_old_commits (s);reiserfs_write_unlock (s);return 0 ;
@@ -139,7 +139,7 @@ static int reiserfs_freeze(struct super_ 1);journal_mark_dirty (&th, s,SB_BUFFER_WITH_SB (s));reiserfs_block_writes (&th); -journal_end_sync (&th, s,1 ); +journal_end_sync (&th, s); } }reiserfs_write_unlock (s);
@@ -179,7 +179,7 @@ static int remove_save_link_only(struct/* removals are protected by direct items */ reiserfs_release_objectid (&th,le32_to_cpu (key->k_objectid)); -return journal_end (&th, s,JOURNAL_PER_BALANCE_CNT ); +return journal_end (&th, s); }#ifdef CONFIG_QUOTA
@@ -507,7 +507,7 @@ int remove_save_link(struct inode *inode }else REISERFS_I (inode)->i_flags &= ~i_link_saved_truncate_mask; -return journal_end (&th, inode->i_sb,JOURNAL_PER_BALANCE_CNT ); +return journal_end (&th, inode->i_sb); }static void reiserfs_kill_sb (struct super_block *s)
@@ -660,7 +660,7 @@ static void reiserfs_dirty_inode(struct goto out;reiserfs_update_sd (&th, inode); -journal_end (&th, inode->i_sb,1 ); +journal_end (&th, inode->i_sb); out:reiserfs_write_unlock (inode->i_sb);
@@ -1514,7 +1514,7 @@ static int reiserfs_remount(struct super }/* this will force a full flush of all journal lists */ SB_JOURNAL (s)->j_must_wait =1 ; - err =journal_end (&th, s,10 ); + err =journal_end (&th, s);if (err) goto out_err_unlock;
@@ -2107,7 +2107,7 @@ static int reiserfs_fill_super(struct sujournal_mark_dirty (&th, s,SB_BUFFER_WITH_SB (s)); - errval =journal_end (&th, s,1 ); + errval =journal_end (&th, s);if (errval) {dput (s->s_root); s->s_root =NULL ;
@@ -2220,9 +2220,7 @@ static int reiserfs_write_dquot(struct d depth =reiserfs_write_unlock_nested (dquot->dq_sb); ret =dquot_commit (dquot);reiserfs_write_lock_nested (dquot->dq_sb, depth); - err = -journal_end (&th, dquot->dq_sb, -REISERFS_QUOTA_TRANS_BLOCKS (dquot->dq_sb)); + err =journal_end (&th, dquot->dq_sb);if (!ret && err) ret = err; out:
@@ -2245,9 +2243,7 @@ static int reiserfs_acquire_dquot(struct depth =reiserfs_write_unlock_nested (dquot->dq_sb); ret =dquot_acquire (dquot);reiserfs_write_lock_nested (dquot->dq_sb, depth); - err = -journal_end (&th, dquot->dq_sb, -REISERFS_QUOTA_INIT_BLOCKS (dquot->dq_sb)); + err =journal_end (&th, dquot->dq_sb);if (!ret && err) ret = err; out:
@@ -2272,9 +2268,7 @@ static int reiserfs_release_dquot(struct } ret =dquot_release (dquot);reiserfs_write_lock (dquot->dq_sb); - err = -journal_end (&th, dquot->dq_sb, -REISERFS_QUOTA_DEL_BLOCKS (dquot->dq_sb)); + err =journal_end (&th, dquot->dq_sb);if (!ret && err) ret = err;reiserfs_write_unlock (dquot->dq_sb);
@@ -2307,7 +2301,7 @@ static int reiserfs_write_info(struct su depth =reiserfs_write_unlock_nested (sb); ret =dquot_commit_info (sb, type);reiserfs_write_lock_nested (sb, depth); - err =journal_end (&th, sb,2 ); + err =journal_end (&th, sb);if (!ret && err) ret = err; out:
@@ -2380,7 +2374,7 @@ static int reiserfs_quota_on(struct supe err =journal_begin (&th, sb,1 );if (err) goto out; - err =journal_end_sync (&th, sb,1 ); + err =journal_end_sync (&th, sb);if (err) goto out; }
fs/reiserfs/xattr.c +2 -2
@@ -292,7 +292,7 @@ static int reiserfs_for_each_xattr(struc I_MUTEX_XATTR); err =action (dir, data);reiserfs_write_lock (inode->i_sb); - jerror =journal_end (&th, inode->i_sb, blocks); + jerror =journal_end (&th, inode->i_sb);reiserfs_write_unlock (inode->i_sb);mutex_unlock (&dir->d_parent->d_inode->i_mutex); err = jerror ?: err;
@@ -601,7 +601,7 @@ int reiserfs_xattr_set(struct inode *ino buffer, buffer_size, flags);reiserfs_write_lock (inode->i_sb); - error2 =journal_end (&th, inode->i_sb, jbegin_count); + error2 =journal_end (&th, inode->i_sb);reiserfs_write_unlock (inode->i_sb);if (error ==0 ) error = error2;
fs/reiserfs/xattr_acl.c +1 -1
@@ -39,7 +39,7 @@ reiserfs_set_acl(struct inode *inode, stif (error ==0 ) { error =__reiserfs_set_acl (&th, inode, type, acl);reiserfs_write_lock (inode->i_sb); - error2 =journal_end (&th, inode->i_sb, jcreate_blocks); + error2 =journal_end (&th, inode->i_sb);reiserfs_write_unlock (inode->i_sb);if (error2) error = error2;
PATCH 5/29 reiserfs: cleanup, remove sb argument from journal_end
In reply to Jeff Mahoneyjournal_end doesn't need a separate sb argument; it's provided by the transaction handle.
--- fs/reiserfs/file.c | 4 ++-- fs/reiserfs/inode.c | 30 +++++++++++++++--------------- fs/reiserfs/journal.c | 43 ++++++++++++++++++++++--------------------- fs/reiserfs/namei.c | 38 +++++++++++++++++++------------------- fs/reiserfs/reiserfs.h | 5 ++--- fs/reiserfs/resize.c | 6 +++--- fs/reiserfs/stree.c | 2 +- fs/reiserfs/super.c | 24 ++++++++++++------------ fs/reiserfs/xattr.c | 4 ++-- fs/reiserfs/xattr_acl.c | 2 +- 10 files changed, 79 insertions(+), 79 deletions(-)
fs/reiserfs/file.c +2 -2
@@ -96,7 +96,7 @@ static int reiserfs_file_release(struct#ifdef REISERFS_PREALLOCATE reiserfs_discard_prealloc (&th, inode);#endif - err =journal_end (&th, inode->i_sb); + err =journal_end (&th);/* copy back the error code from journal_begin */ if (!err)
@@ -227,7 +227,7 @@ int reiserfs_commit_page(struct inode *i } }if (logit) { - ret =journal_end (&th, s); + ret =journal_end (&th); drop_write_lock:reiserfs_write_unlock (s); }
fs/reiserfs/inode.c +15 -15
@@ -72,7 +72,7 @@ void reiserfs_evict_inode(struct inode *reiserfs_write_lock_nested (inode->i_sb, depth); } -if (journal_end (&th, inode->i_sb)) +if (journal_end (&th)) goto out;/*
@@ -264,7 +264,7 @@ static int restart_transaction(struct rereturn 0 ; }reiserfs_update_sd (th, inode); - err =journal_end (th, s); + err =journal_end (th);if (!err) { err =journal_begin (th, s,JOURNAL_PER_BALANCE_CNT *6 );if (!err)
@@ -1790,7 +1790,7 @@ int reiserfs_write_inode(struct inode *ireiserfs_write_lock (inode->i_sb);if (!journal_begin (&th, inode->i_sb, jbegin_count)) {reiserfs_update_sd (&th, inode); -journal_end_sync (&th, inode->i_sb); +journal_end_sync (&th); }reiserfs_write_unlock (inode->i_sb); }
@@ -2097,7 +2097,7 @@ int reiserfs_new_inode(struct reiserfs_tif (retval) { err = retval;reiserfs_check_path (&path_to_key); -journal_end (th, th->t_super); +journal_end (th); goto out_inserted_sd; }
@@ -2108,7 +2108,7 @@ int reiserfs_new_inode(struct reiserfs_tif (retval) { err = retval;reiserfs_check_path (&path_to_key); -journal_end (th, th->t_super); +journal_end (th); goto out_inserted_sd; } }else if (inode->i_sb->s_flags &MS_POSIXACL ) {
@@ -2125,7 +2125,7 @@ int reiserfs_new_inode(struct reiserfs_tif (retval) { err = retval;reiserfs_check_path (&path_to_key); - retval =journal_end (th, th->t_super); + retval =journal_end (th);if (retval) err = retval; goto out_inserted_sd;
@@ -2147,7 +2147,7 @@ int reiserfs_new_inode(struct reiserfs_treiserfs_write_lock_nested (inode->i_sb, depth); out_end_trans: -journal_end (th, th->t_super); +journal_end (th);/* * Drop can be outside and it needs more credits so it's better * to have it outside
@@ -2317,7 +2317,7 @@ int reiserfs_truncate_file(struct inode*/ add_save_link (&th, inode,1 ); err2 =reiserfs_do_truncate (&th, inode, page, update_timestamps); - error =journal_end (&th, inode->i_sb); + error =journal_end (&th);if (error) goto out;
@@ -2480,7 +2480,7 @@ static int map_block_for_writepage(struc out:pathrelse (&path);if (trans_running) { -int err =journal_end (&th, inode->i_sb); +int err =journal_end (&th);if (err) retval = err; trans_running =0 ;
@@ -2650,7 +2650,7 @@ static int reiserfs_write_full_page(stru }while ((bh = bh->b_this_page) != head);if (checked) { - error =journal_end (&th, s); + error =journal_end (&th);reiserfs_write_unlock (s);if (error) goto fail;
@@ -2953,7 +2953,7 @@ static int reiserfs_write_end(struct filmark_inode_dirty (inode);reiserfs_update_sd (&myth, inode); update_sd =1 ; - ret =journal_end (&myth, inode->i_sb); + ret =journal_end (&myth);if (ret) goto journal_error; }
@@ -3042,7 +3042,7 @@ int reiserfs_commit_write(struct file *fmark_inode_dirty (inode);reiserfs_update_sd (&myth, inode); update_sd =1 ; - ret =journal_end (&myth, inode->i_sb); + ret =journal_end (&myth);if (ret) goto journal_error; }
@@ -3346,7 +3346,7 @@ int reiserfs_setattr(struct dentry *dent err =journal_begin (&th, inode->i_sb,4 );if (!err) {reiserfs_discard_prealloc (&th, inode); - err =journal_end (&th, inode->i_sb); + err =journal_end (&th); }if (err) error = err;
@@ -3398,7 +3398,7 @@ int reiserfs_setattr(struct dentry *dent error =dquot_transfer (inode, attr);reiserfs_write_lock (inode->i_sb);if (error) { -journal_end (&th, inode->i_sb); +journal_end (&th);reiserfs_write_unlock (inode->i_sb); goto out; }
@@ -3412,7 +3412,7 @@ int reiserfs_setattr(struct dentry *dentif (attr->ia_valid &ATTR_GID ) inode->i_gid = attr->ia_gid;mark_inode_dirty (inode); - error =journal_end (&th, inode->i_sb); + error =journal_end (&th);reiserfs_write_unlock (inode->i_sb);if (error) goto out;
fs/reiserfs/journal.c +22 -21
152 lines not on this page · raw message
fs/reiserfs/namei.c +19 -19
@@ -672,7 +672,7 @@ static int reiserfs_create(struct inodeint err;drop_nlink (inode);reiserfs_update_sd (&th, inode); - err =journal_end (&th, dir->i_sb); + err =journal_end (&th);if (err) retval = err;unlock_new_inode (inode);
@@ -684,7 +684,7 @@ static int reiserfs_create(struct inodeunlock_new_inode (inode);d_instantiate (dentry, inode); - retval =journal_end (&th, dir->i_sb); + retval =journal_end (&th); out_failed:reiserfs_write_unlock (dir->i_sb);
@@ -755,7 +755,7 @@ static int reiserfs_mknod(struct inode *int err;drop_nlink (inode);reiserfs_update_sd (&th, inode); - err =journal_end (&th, dir->i_sb); + err =journal_end (&th);if (err) retval = err;unlock_new_inode (inode);
@@ -765,7 +765,7 @@ static int reiserfs_mknod(struct inode *unlock_new_inode (inode);d_instantiate (dentry, inode); - retval =journal_end (&th, dir->i_sb); + retval =journal_end (&th); out_failed:reiserfs_write_unlock (dir->i_sb);
@@ -847,7 +847,7 @@ static int reiserfs_mkdir(struct inode *clear_nlink (inode);DEC_DIR_INODE_NLINK (dir);reiserfs_update_sd (&th, inode); - err =journal_end (&th, dir->i_sb); + err =journal_end (&th);if (err) retval = err;unlock_new_inode (inode);
@@ -859,7 +859,7 @@ static int reiserfs_mkdir(struct inode *unlock_new_inode (inode);d_instantiate (dentry, inode); - retval =journal_end (&th, dir->i_sb); + retval =journal_end (&th); out_failed:reiserfs_write_unlock (dir->i_sb);return retval;
@@ -956,7 +956,7 @@ static int reiserfs_rmdir(struct inode */* prevent empty directory from getting lost */ add_save_link (&th, inode,0 /* not truncate */ ); - retval =journal_end (&th, dir->i_sb); + retval =journal_end (&th);reiserfs_check_path (&path); out_rmdir:reiserfs_write_unlock (dir->i_sb);
@@ -969,7 +969,7 @@ static int reiserfs_rmdir(struct inode ** release path if operation was not complete */ pathrelse (&path); - err =journal_end (&th, dir->i_sb); + err =journal_end (&th);reiserfs_write_unlock (dir->i_sb);return err ? err : retval; }
@@ -1059,14 +1059,14 @@ static int reiserfs_unlink(struct inode/* prevent file from getting lost */ add_save_link (&th, inode,0 /* not truncate */ ); - retval =journal_end (&th, dir->i_sb); + retval =journal_end (&th);reiserfs_check_path (&path);reiserfs_write_unlock (dir->i_sb);return retval; end_unlink:pathrelse (&path); - err =journal_end (&th, dir->i_sb); + err =journal_end (&th);reiserfs_check_path (&path);if (err) retval = err;
@@ -1153,7 +1153,7 @@ static int reiserfs_symlink(struct inodeint err;drop_nlink (inode);reiserfs_update_sd (&th, inode); - err =journal_end (&th, parent_dir->i_sb); + err =journal_end (&th);if (err) retval = err;unlock_new_inode (inode);
@@ -1163,7 +1163,7 @@ static int reiserfs_symlink(struct inodeunlock_new_inode (inode);d_instantiate (dentry, inode); - retval =journal_end (&th, parent_dir->i_sb); + retval =journal_end (&th); out_failed:reiserfs_write_unlock (parent_dir->i_sb);return retval;
@@ -1213,7 +1213,7 @@ static int reiserfs_link(struct dentry *if (retval) {int err;drop_nlink (inode); - err =journal_end (&th, dir->i_sb); + err =journal_end (&th);reiserfs_write_unlock (dir->i_sb);return err ? err : retval; }
@@ -1223,7 +1223,7 @@ static int reiserfs_link(struct dentry *ihold (inode);d_instantiate (dentry, inode); - retval =journal_end (&th, dir->i_sb); + retval =journal_end (&th);reiserfs_write_unlock (dir->i_sb);return retval; }
@@ -1385,7 +1385,7 @@ static int reiserfs_rename(struct inode "new entry is found, new inode == 0"); } }else if (retval) { -int err =journal_end (&th, old_dir->i_sb); +int err =journal_end (&th);reiserfs_write_unlock (old_dir->i_sb);return err ? err : retval; }
@@ -1412,7 +1412,7 @@ static int reiserfs_rename(struct inode &old_entry_path, &old_de)) != NAME_FOUND) {pathrelse (&old_entry_path); -journal_end (&th, old_dir->i_sb); +journal_end (&th);reiserfs_write_unlock (old_dir->i_sb);return -EIO ; }
@@ -1436,7 +1436,7 @@ static int reiserfs_rename(struct inodeif (retval !=NAME_FOUND_INVISIBLE && retval !=NAME_FOUND ) {pathrelse (&new_entry_path);pathrelse (&old_entry_path); -journal_end (&th, old_dir->i_sb); +journal_end (&th);reiserfs_write_unlock (old_dir->i_sb);return -EIO ; }
@@ -1454,7 +1454,7 @@ static int reiserfs_rename(struct inodepathrelse (&dot_dot_entry_path);pathrelse (&new_entry_path);pathrelse (&old_entry_path); -journal_end (&th, old_dir->i_sb); +journal_end (&th);reiserfs_write_unlock (old_dir->i_sb);return -EIO ; }
@@ -1601,7 +1601,7 @@ static int reiserfs_rename(struct inodereiserfs_update_sd (&th, new_dentry_inode); } - retval =journal_end (&th, old_dir->i_sb); + retval =journal_end (&th);reiserfs_write_unlock (old_dir->i_sb);return retval; }
fs/reiserfs/reiserfs.h +2 -3
@@ -2914,9 +2914,8 @@ int journal_init(struct super_block *, cint journal_release (struct reiserfs_transaction_handle *,struct super_block *);int journal_release_error (struct reiserfs_transaction_handle *,struct super_block *); -int journal_end (struct reiserfs_transaction_handle *,struct super_block *); -int journal_end_sync (struct reiserfs_transaction_handle *, -struct super_block *); +int journal_end (struct reiserfs_transaction_handle *); +int journal_end_sync (struct reiserfs_transaction_handle *);int journal_mark_freed (struct reiserfs_transaction_handle *,struct super_block *,b_blocknr_t blocknr);int journal_transaction_should_end (struct reiserfs_transaction_handle *,int );
fs/reiserfs/resize.c +3 -3
@@ -182,7 +182,7 @@ int reiserfs_resize(struct super_block * info =SB_AP_BITMAP (s) + bmap_nr -1 ; bh =reiserfs_read_bitmap_block (s, bmap_nr -1 );if (!bh) { -int jerr =journal_end (&th, s); +int jerr =journal_end (&th);if (jerr)return jerr;return -EIO ;
@@ -200,7 +200,7 @@ int reiserfs_resize(struct super_block * info =SB_AP_BITMAP (s) + bmap_nr_new -1 ; bh =reiserfs_read_bitmap_block (s, bmap_nr_new -1 );if (!bh) { -int jerr =journal_end (&th, s); +int jerr =journal_end (&th);if (jerr)return jerr;return -EIO ;
@@ -225,5 +225,5 @@ int reiserfs_resize(struct super_block *journal_mark_dirty (&th, s,SB_BUFFER_WITH_SB (s));SB_JOURNAL (s)->j_must_wait =1 ; -return journal_end (&th, s); +return journal_end (&th); }
fs/reiserfs/stree.c +1 -1
@@ -1993,7 +1993,7 @@ int reiserfs_do_truncate(struct reiserfs }reiserfs_update_sd (th, inode); - err =journal_end (th, inode->i_sb); + err =journal_end (th);if (err) goto out; err = journal_begin(th, inode->i_sb,
fs/reiserfs/super.c +12 -12
@@ -75,7 +75,7 @@ static int reiserfs_sync_fs(struct superdquot_writeback_dquots (s,-1 );reiserfs_write_lock (s);if (!journal_begin (&th, s,1 )) -if (!journal_end_sync (&th, s)) +if (!journal_end_sync (&th))reiserfs_flush_old_commits (s);reiserfs_write_unlock (s);return 0 ;
@@ -139,7 +139,7 @@ static int reiserfs_freeze(struct super_ 1);journal_mark_dirty (&th, s,SB_BUFFER_WITH_SB (s));reiserfs_block_writes (&th); -journal_end_sync (&th, s); +journal_end_sync (&th); } }reiserfs_write_unlock (s);
@@ -179,7 +179,7 @@ static int remove_save_link_only(struct/* removals are protected by direct items */ reiserfs_release_objectid (&th,le32_to_cpu (key->k_objectid)); -return journal_end (&th, s); +return journal_end (&th); }#ifdef CONFIG_QUOTA
@@ -507,7 +507,7 @@ int remove_save_link(struct inode *inode }else REISERFS_I (inode)->i_flags &= ~i_link_saved_truncate_mask; -return journal_end (&th, inode->i_sb); +return journal_end (&th); }static void reiserfs_kill_sb (struct super_block *s)
@@ -660,7 +660,7 @@ static void reiserfs_dirty_inode(struct goto out;reiserfs_update_sd (&th, inode); -journal_end (&th, inode->i_sb); +journal_end (&th); out:reiserfs_write_unlock (inode->i_sb);
@@ -1514,7 +1514,7 @@ static int reiserfs_remount(struct super }/* this will force a full flush of all journal lists */ SB_JOURNAL (s)->j_must_wait =1 ; - err =journal_end (&th, s); + err =journal_end (&th);if (err) goto out_err_unlock;
@@ -2107,7 +2107,7 @@ static int reiserfs_fill_super(struct sujournal_mark_dirty (&th, s,SB_BUFFER_WITH_SB (s)); - errval =journal_end (&th, s); + errval =journal_end (&th);if (errval) {dput (s->s_root); s->s_root =NULL ;
@@ -2220,7 +2220,7 @@ static int reiserfs_write_dquot(struct d depth =reiserfs_write_unlock_nested (dquot->dq_sb); ret =dquot_commit (dquot);reiserfs_write_lock_nested (dquot->dq_sb, depth); - err =journal_end (&th, dquot->dq_sb); + err =journal_end (&th);if (!ret && err) ret = err; out:
@@ -2243,7 +2243,7 @@ static int reiserfs_acquire_dquot(struct depth =reiserfs_write_unlock_nested (dquot->dq_sb); ret =dquot_acquire (dquot);reiserfs_write_lock_nested (dquot->dq_sb, depth); - err =journal_end (&th, dquot->dq_sb); + err =journal_end (&th);if (!ret && err) ret = err; out:
@@ -2268,7 +2268,7 @@ static int reiserfs_release_dquot(struct } ret =dquot_release (dquot);reiserfs_write_lock (dquot->dq_sb); - err =journal_end (&th, dquot->dq_sb); + err =journal_end (&th);if (!ret && err) ret = err;reiserfs_write_unlock (dquot->dq_sb);
@@ -2301,7 +2301,7 @@ static int reiserfs_write_info(struct su depth =reiserfs_write_unlock_nested (sb); ret =dquot_commit_info (sb, type);reiserfs_write_lock_nested (sb, depth); - err =journal_end (&th, sb); + err =journal_end (&th);if (!ret && err) ret = err; out:
@@ -2374,7 +2374,7 @@ static int reiserfs_quota_on(struct supe err =journal_begin (&th, sb,1 );if (err) goto out; - err =journal_end_sync (&th, sb); + err =journal_end_sync (&th);if (err) goto out; }
fs/reiserfs/xattr.c +2 -2
@@ -292,7 +292,7 @@ static int reiserfs_for_each_xattr(struc I_MUTEX_XATTR); err =action (dir, data);reiserfs_write_lock (inode->i_sb); - jerror =journal_end (&th, inode->i_sb); + jerror =journal_end (&th);reiserfs_write_unlock (inode->i_sb);mutex_unlock (&dir->d_parent->d_inode->i_mutex); err = jerror ?: err;
@@ -601,7 +601,7 @@ int reiserfs_xattr_set(struct inode *ino buffer, buffer_size, flags);reiserfs_write_lock (inode->i_sb); - error2 =journal_end (&th, inode->i_sb); + error2 =journal_end (&th);reiserfs_write_unlock (inode->i_sb);if (error ==0 ) error = error2;
fs/reiserfs/xattr_acl.c +1 -1
@@ -39,7 +39,7 @@ reiserfs_set_acl(struct inode *inode, stif (error ==0 ) { error =__reiserfs_set_acl (&th, inode, type, acl);reiserfs_write_lock (inode->i_sb); - error2 =journal_end (&th, inode->i_sb); + error2 =journal_end (&th);reiserfs_write_unlock (inode->i_sb);if (error2) error = error2;
PATCH 6/29 reiserfs: cleanup, remove sb argument from journal_mark_dirty
In reply to Jeff Mahoneyjournal_mark_dirty doesn't need a separate sb argument; It's provided by the transaction handle.
--- fs/reiserfs/bitmap.c | 8 ++++---- fs/reiserfs/do_balan.c | 3 +-- fs/reiserfs/file.c | 2 +- fs/reiserfs/fix_node.c | 2 +- fs/reiserfs/inode.c | 8 ++++---- fs/reiserfs/journal.c | 18 ++++++++---------- fs/reiserfs/namei.c | 6 +++--- fs/reiserfs/objectid.c | 4 ++-- fs/reiserfs/reiserfs.h | 2 +- fs/reiserfs/resize.c | 6 +++--- fs/reiserfs/stree.c | 2 +- fs/reiserfs/super.c | 12 ++++++------ 12 files changed, 35 insertions(+), 38 deletions(-)
fs/reiserfs/bitmap.c +4 -4
@@ -256,14 +256,14 @@ static int scan_bitmap_block(struct reis } } bi->free_count -= (end - *beg); -journal_mark_dirty (th, s, bh); +journal_mark_dirty (th, bh);brelse (bh);/* free block count calculation */ reiserfs_prepare_for_journal (s,SB_BUFFER_WITH_SB (s),1 );PUT_SB_FREE_BLOCKS (s,SB_FREE_BLOCKS (s) - (end - *beg)); -journal_mark_dirty (th, s,SB_BUFFER_WITH_SB (s)); +journal_mark_dirty (th,SB_BUFFER_WITH_SB (s));return end - (*beg); }else {
@@ -453,14 +453,14 @@ static void _reiserfs_free_block(struct "block %lu: bit already cleared", block); } apbi[nr].free_count++; -journal_mark_dirty (th, s, bmbh); +journal_mark_dirty (th, bmbh);brelse (bmbh);reiserfs_prepare_for_journal (s, sbh,1 );/* update super block */ set_sb_free_blocks (rs,sb_free_blocks (rs) +1 ); -journal_mark_dirty (th, s, sbh); +journal_mark_dirty (th, sbh);if (for_unformatted) {int depth =reiserfs_write_unlock_nested (s);dquot_free_block_nodirty (inode,1 );
fs/reiserfs/do_balan.c +1 -2
@@ -56,8 +56,7 @@ static inline void buffer_info_init_bh(sinline void do_balance_mark_leaf_dirty (struct tree_balance *tb,struct buffer_head *bh,int flag) { -journal_mark_dirty (tb->transaction_handle, - tb->transaction_handle->t_super, bh); +journal_mark_dirty (tb->transaction_handle, bh); }#define do_balance_mark_internal_dirty do_balance_mark_leaf_dirty
fs/reiserfs/file.c +1 -1
@@ -212,7 +212,7 @@ int reiserfs_commit_page(struct inode *iset_buffer_uptodate (bh);if (logit) {reiserfs_prepare_for_journal (s, bh,1 ); -journal_mark_dirty (&th, s, bh); +journal_mark_dirty (&th, bh); }else if (!buffer_dirty (bh)) {mark_buffer_dirty (bh);/*
fs/reiserfs/fix_node.c +1 -1
@@ -2572,7 +2572,7 @@ int fix_nodes(int op_mode, struct tree_b*/ reiserfs_prepare_for_journal (tb->tb_sb,SB_BUFFER_WITH_SB (tb->tb_sb),1 ); -journal_mark_dirty (tb->transaction_handle, tb->tb_sb, +journal_mark_dirty (tb->transaction_handle,SB_BUFFER_WITH_SB (tb->tb_sb));if (FILESYSTEM_CHANGED_TB (tb))return REPEAT_SEARCH ;
fs/reiserfs/inode.c +4 -4
@@ -816,7 +816,7 @@ int reiserfs_get_block(struct inode *inoreiserfs_add_ordered_list (inode, bh_result);put_block_num (item, pos_in_item, allocated_block_nr); unfm_ptr = allocated_block_nr; -journal_mark_dirty (th, inode->i_sb, bh); +journal_mark_dirty (th, bh);reiserfs_update_sd (th, inode); }set_block_dev_mapped (bh_result, unfm_ptr, inode);
@@ -1505,7 +1505,7 @@ void reiserfs_update_sd_size(struct reisbreak ; }update_stat_data (&path, inode, size); -journal_mark_dirty (th, th->t_super, bh); +journal_mark_dirty (th, bh);pathrelse (&path);return ; }
@@ -2457,7 +2457,7 @@ static int map_block_for_writepage(strucmemcpy (ih_item_body (bh, ih) + pos_in_item, p + bytes_copied, copy_size); -journal_mark_dirty (&th, inode->i_sb, bh); +journal_mark_dirty (&th, bh); bytes_copied += copy_size;set_block_dev_mapped (bh_result,0 , inode);
@@ -2627,7 +2627,7 @@ static int reiserfs_write_full_page(struif (checked) {reiserfs_prepare_for_journal (s, bh,1 ); -journal_mark_dirty (&th, s, bh); +journal_mark_dirty (&th, bh);continue ; }/*
fs/reiserfs/journal.c +8 -10
@@ -1929,8 +1929,7 @@ static int do_journal_release(struct reireiserfs_prepare_for_journal (sb,SB_BUFFER_WITH_SB (sb),1 ); -journal_mark_dirty (&myth, sb, -SB_BUFFER_WITH_SB (sb)); +journal_mark_dirty (&myth,SB_BUFFER_WITH_SB (sb));do_journal_end (&myth,FLUSH_ALL ); flushed =1 ; }
@@ -1943,8 +1942,7 @@ static int do_journal_release(struct reireiserfs_prepare_for_journal (sb,SB_BUFFER_WITH_SB (sb),1 ); -journal_mark_dirty (&myth, sb, -SB_BUFFER_WITH_SB (sb)); +journal_mark_dirty (&myth,SB_BUFFER_WITH_SB (sb));do_journal_end (&myth,FLUSH_ALL ); } }
@@ -3268,8 +3266,9 @@ int journal_begin(struct reiserfs_transa* if j_len, is bigger than j_len_alloc, it pushes j_len_alloc to 10 + j_len. */ int journal_mark_dirty (struct reiserfs_transaction_handle *th, -struct super_block *sb,struct buffer_head *bh) +struct buffer_head *bh) { +struct super_block *sb = th->t_super;struct reiserfs_journal *journal =SB_JOURNAL (sb);struct reiserfs_journal_cnode *cn =NULL ;int count_already_incd =0 ;
@@ -3522,7 +3521,7 @@ int journal_end_sync(struct reiserfs_traif (journal->j_len ==0 ) {reiserfs_prepare_for_journal (sb,SB_BUFFER_WITH_SB (sb),1 ); -journal_mark_dirty (th, sb,SB_BUFFER_WITH_SB (sb)); +journal_mark_dirty (th,SB_BUFFER_WITH_SB (sb)); }return do_journal_end (th,COMMIT_NOW |WAIT ); }
@@ -3576,8 +3575,7 @@ void reiserfs_flush_old_commits(struct sreiserfs_prepare_for_journal (sb,SB_BUFFER_WITH_SB (sb),1 ); -journal_mark_dirty (&th, sb, -SB_BUFFER_WITH_SB (sb)); +journal_mark_dirty (&th,SB_BUFFER_WITH_SB (sb));/* * we're only being called from kreiserfsd, it makes
@@ -3863,7 +3861,7 @@ static int __commit_trans_jl(struct inodif (journal->j_trans_id != id) {reiserfs_prepare_for_journal (sb,SB_BUFFER_WITH_SB (sb),1 ); -journal_mark_dirty (&th, sb,SB_BUFFER_WITH_SB (sb)); +journal_mark_dirty (&th,SB_BUFFER_WITH_SB (sb)); ret =journal_end (&th); goto flush_commit_only; }
@@ -4014,7 +4012,7 @@ static int do_journal_end(struct reiserfif (journal->j_len ==0 ) {reiserfs_prepare_for_journal (sb,SB_BUFFER_WITH_SB (sb),1 ); -journal_mark_dirty (th, sb,SB_BUFFER_WITH_SB (sb)); +journal_mark_dirty (th,SB_BUFFER_WITH_SB (sb)); }lock_journal (sb);
fs/reiserfs/namei.c +3 -3
@@ -1531,10 +1531,10 @@ static int reiserfs_rename(struct inodemark_de_visible (new_de.de_deh + new_de.de_entry_num);set_ino_in_dir_entry (&new_de,INODE_PKEY (old_inode)); -journal_mark_dirty (&th, old_dir->i_sb, new_de.de_bh); +journal_mark_dirty (&th, new_de.de_bh);mark_de_hidden (old_de.de_deh + old_de.de_entry_num); -journal_mark_dirty (&th, old_dir->i_sb, old_de.de_bh); +journal_mark_dirty (&th, old_de.de_bh); ctime =CURRENT_TIME_SEC ; old_dir->i_ctime = old_dir->i_mtime = ctime; new_dir->i_ctime = new_dir->i_mtime = ctime;
@@ -1558,7 +1558,7 @@ static int reiserfs_rename(struct inodeif (S_ISDIR (old_inode_mode)) {/* adjust ".." of renamed directory */ set_ino_in_dir_entry (&dot_dot_de,INODE_PKEY (new_dir)); -journal_mark_dirty (&th, new_dir->i_sb, dot_dot_de.de_bh); +journal_mark_dirty (&th, dot_dot_de.de_bh);/* * there (in new_dir) was no directory, so it got new link
fs/reiserfs/objectid.c +2 -2
@@ -89,7 +89,7 @@ __u32 reiserfs_get_unused_objectid(strucset_sb_oid_cursize (rs,sb_oid_cursize (rs) -2 ); } -journal_mark_dirty (th, s,SB_BUFFER_WITH_SB (s)); +journal_mark_dirty (th,SB_BUFFER_WITH_SB (s));return unused_objectid; }
@@ -107,7 +107,7 @@ void reiserfs_release_objectid(struct recheck_objectid_map (s, map);reiserfs_prepare_for_journal (s,SB_BUFFER_WITH_SB (s),1 ); -journal_mark_dirty (th, s,SB_BUFFER_WITH_SB (s)); +journal_mark_dirty (th,SB_BUFFER_WITH_SB (s));/* * start at the beginning of the objectid map (i = 0) and go to
fs/reiserfs/reiserfs.h +1 -1
@@ -2864,7 +2864,7 @@ void reiserfs_free_jh(struct buffer_headint reiserfs_add_tail_list (struct inode *inode,struct buffer_head *bh);int reiserfs_add_ordered_list (struct inode *inode,struct buffer_head *bh);int journal_mark_dirty (struct reiserfs_transaction_handle *, -struct super_block *,struct buffer_head *bh); +struct buffer_head *bh);static inline int reiserfs_file_data_log (struct inode *inode) {
fs/reiserfs/resize.c +3 -3
@@ -193,7 +193,7 @@ int reiserfs_resize(struct super_block *reiserfs_clear_le_bit (i, bh->b_data); info->free_count += s->s_blocksize *8 - block_r; -journal_mark_dirty (&th, s, bh); +journal_mark_dirty (&th, bh);brelse (bh);/* Correct new last bitmap block - It may not be full */
@@ -209,7 +209,7 @@ int reiserfs_resize(struct super_block *reiserfs_prepare_for_journal (s, bh,1 );for (i = block_r_new; i < s->s_blocksize *8 ; i++)reiserfs_set_le_bit (i, bh->b_data); -journal_mark_dirty (&th, s, bh); +journal_mark_dirty (&th, bh);brelse (bh); info->free_count -= s->s_blocksize *8 - block_r_new;
@@ -222,7 +222,7 @@ int reiserfs_resize(struct super_block *PUT_SB_BLOCK_COUNT (s, block_count_new);PUT_SB_BMAP_NR (s,bmap_would_wrap (bmap_nr_new) ? : bmap_nr_new); -journal_mark_dirty (&th, s,SB_BUFFER_WITH_SB (s)); +journal_mark_dirty (&th,SB_BUFFER_WITH_SB (s));SB_JOURNAL (s)->j_must_wait =1 ;return journal_end (&th);
fs/reiserfs/stree.c +1 -1
@@ -1101,7 +1101,7 @@ static char prepare_for_delete_or_cut(stif (block !=0 ) {reiserfs_prepare_for_journal (sb, bh,1 );put_block_num (unfm,0 ,0 ); -journal_mark_dirty (th, sb, bh); +journal_mark_dirty (th, bh);reiserfs_free_block (th, inode, block,1 ); }
fs/reiserfs/super.c +6 -6
@@ -137,7 +137,7 @@ static int reiserfs_freeze(struct super_ }else {reiserfs_prepare_for_journal (s,SB_BUFFER_WITH_SB (s),1 ); -journal_mark_dirty (&th, s,SB_BUFFER_WITH_SB (s)); +journal_mark_dirty (&th,SB_BUFFER_WITH_SB (s));reiserfs_block_writes (&th);journal_end_sync (&th); }
@@ -552,7 +552,7 @@ static void reiserfs_put_super(struct su 1);set_sb_umount_state (SB_DISK_SUPER_BLOCK (s),REISERFS_SB (s)->s_mount_state); -journal_mark_dirty (&th, s,SB_BUFFER_WITH_SB (s)); +journal_mark_dirty (&th,SB_BUFFER_WITH_SB (s)); } }
@@ -1477,7 +1477,7 @@ static int reiserfs_remount(struct super/* Mounting a rw partition read-only. */ reiserfs_prepare_for_journal (s,SB_BUFFER_WITH_SB (s),1 );set_sb_umount_state (rs,REISERFS_SB (s)->s_mount_state); -journal_mark_dirty (&th, s,SB_BUFFER_WITH_SB (s)); +journal_mark_dirty (&th,SB_BUFFER_WITH_SB (s)); }else {/* remount read-write */ if (!(s->s_flags &MS_RDONLY )) {
@@ -1509,7 +1509,7 @@ static int reiserfs_remount(struct superif (!old_format_only (s))set_sb_mnt_count (rs,sb_mnt_count (rs) +1 );/* mark_buffer_dirty (SB_BUFFER_WITH_SB (s), 1); */ -journal_mark_dirty (&th, s,SB_BUFFER_WITH_SB (s)); +journal_mark_dirty (&th,SB_BUFFER_WITH_SB (s));REISERFS_SB (s)->s_mount_state =REISERFS_VALID_FS ; }/* this will force a full flush of all journal lists */
@@ -2106,7 +2106,7 @@ static int reiserfs_fill_super(struct suset_sb_mnt_count (rs,sb_mnt_count (rs) +1 ); -journal_mark_dirty (&th, s,SB_BUFFER_WITH_SB (s)); +journal_mark_dirty (&th,SB_BUFFER_WITH_SB (s)); errval =journal_end (&th);if (errval) {dput (s->s_root);
@@ -2481,7 +2481,7 @@ static ssize_t reiserfs_quota_write(struunlock_buffer (bh);reiserfs_write_lock (sb);reiserfs_prepare_for_journal (sb, bh,1 ); -journal_mark_dirty (current->journal_info, sb, bh); +journal_mark_dirty (current->journal_info, bh);if (!journal_quota)reiserfs_add_ordered_list (inode, bh);reiserfs_write_unlock (sb);
PATCH 7/29 reiserfs: cleanup, remove blocks arg from journal_join
In reply to Jeff Mahoneyjournal_join is always called with a block count of 1. Let's just get rid of the argument.
--- fs/reiserfs/file.c | 2 +- fs/reiserfs/journal.c | 18 +++++++++--------- fs/reiserfs/reiserfs.h | 2 +- 3 files changed, 11 insertions(+), 11 deletions(-)
fs/reiserfs/file.c +1 -1
@@ -71,7 +71,7 @@ static int reiserfs_file_release(struct* aborted transaction */ jbegin_failure = err; - err =journal_join_abort (&th, inode->i_sb,1 ); + err =journal_join_abort (&th, inode->i_sb);if (err) {/*
fs/reiserfs/journal.c +9 -9
@@ -90,7 +90,7 @@ static int flush_commit_list(struct supe struct reiserfs_journal_list *jl, int flushall);static int can_dirty (struct reiserfs_journal_cnode *cn);static int journal_join (struct reiserfs_transaction_handle *th, -struct super_block *sb,unsigned long nblocks); +struct super_block *sb);static void release_journal_dev (struct super_block *super,struct reiserfs_journal *journal); static int dirty_one_transaction(struct super_block *s,
@@ -1925,7 +1925,7 @@ static int do_journal_release(struct rei* make sure something gets logged to force * our way into the flush code */ -if (!journal_join (&myth, sb,1 )) { +if (!journal_join (&myth, sb)) {reiserfs_prepare_for_journal (sb,SB_BUFFER_WITH_SB (sb),1 );
@@ -1938,7 +1938,7 @@ static int do_journal_release(struct rei/* this also catches errors during the do_journal_end above */ if (!error &&reiserfs_is_journal_aborted (journal)) {memset (&myth,0 ,sizeof (myth)); -if (!journal_join_abort (&myth, sb,1 )) { +if (!journal_join_abort (&myth, sb)) {reiserfs_prepare_for_journal (sb,SB_BUFFER_WITH_SB (sb),1 );
@@ -3092,7 +3092,7 @@ static int do_journal_begin_r(struct rei } goto relock; } - retval =journal_join (&myth, sb,1 ); + retval =journal_join (&myth, sb);if (retval) goto out_fail;
@@ -3181,7 +3181,7 @@ int reiserfs_end_persistent_transaction( }static int journal_join (struct reiserfs_transaction_handle *th, -struct super_block *sb,unsigned long nblocks) +struct super_block *sb) {struct reiserfs_transaction_handle *cur_th = current->journal_info;
@@ -3191,11 +3191,11 @@ static int journal_join(struct reiserfs_*/ th->t_handle_save = cur_th;BUG_ON (cur_th && cur_th->t_refcount >1 ); -return do_journal_begin_r (th, sb, nblocks,JBEGIN_JOIN ); +return do_journal_begin_r (th, sb,1 ,JBEGIN_JOIN ); }int journal_join_abort (struct reiserfs_transaction_handle *th, -struct super_block *sb,unsigned long nblocks) +struct super_block *sb) {struct reiserfs_transaction_handle *cur_th = current->journal_info;
@@ -3205,7 +3205,7 @@ int journal_join_abort(struct reiserfs_t*/ th->t_handle_save = cur_th;BUG_ON (cur_th && cur_th->t_refcount >1 ); -return do_journal_begin_r (th, sb, nblocks,JBEGIN_ABORT ); +return do_journal_begin_r (th, sb,1 ,JBEGIN_ABORT ); } int journal_begin(struct reiserfs_transaction_handle *th,
@@ -3571,7 +3571,7 @@ void reiserfs_flush_old_commits(struct s journal->j_trans_start_time > 0 && journal->j_len > 0 && (now - journal->j_trans_start_time) > journal->j_max_trans_age) { -if (!journal_join (&th, sb,1 )) { +if (!journal_join (&th, sb)) {reiserfs_prepare_for_journal (sb,SB_BUFFER_WITH_SB (sb),1 );
fs/reiserfs/reiserfs.h +1 -1
@@ -2924,7 +2924,7 @@ int reiserfs_in_journal(struct super_bloint journal_begin (struct reiserfs_transaction_handle *,struct super_block *sb,unsigned long );int journal_join_abort (struct reiserfs_transaction_handle *, -struct super_block *sb,unsigned long ); +struct super_block *sb);void reiserfs_abort_journal (struct super_block *sb,int errno);void reiserfs_abort (struct super_block *sb,int errno,const char *fmt, ...); int reiserfs_allocate_list_bitmaps(struct super_block *s,
PATCH 8/29 reiserfs: cleanup, remove leading whitespace from labels
In reply to Jeff MahoneyThis patch moves reiserfs closer to adhering to the style rules by removing leading whitespace from labels.
--- fs/reiserfs/bitmap.c | 4 ++-- fs/reiserfs/dir.c | 2 +- fs/reiserfs/file.c | 4 ++-- fs/reiserfs/fix_node.c | 2 +- fs/reiserfs/inode.c | 48 ++++++++++++++++++++++++------------------------ fs/reiserfs/ioctl.c | 4 ++-- fs/reiserfs/journal.c | 36 ++++++++++++++++++------------------ fs/reiserfs/namei.c | 14 +++++++------- fs/reiserfs/stree.c | 14 +++++++------- fs/reiserfs/xattr.c | 2 +- fs/reiserfs/xattr_acl.c | 6 +++--- 11 files changed, 68 insertions(+), 68 deletions(-)
fs/reiserfs/bitmap.c +2 -2
@@ -167,7 +167,7 @@ static int scan_bitmap_block(struct reisreturn 0 ;while (1 ) { - cont: +cont:if (bi->free_count < min) {brelse (bh);return 0 ;/* No free blocks in this bitmap */
@@ -409,7 +409,7 @@ static int scan_bitmap(struct reiserfs_t nr_allocated =scan_bitmap_block (th, bm, &off, end_off +1 , min, max, unfm); - ret: +ret: *start = bm * off_max + off;return nr_allocated;
fs/reiserfs/dir.c +1 -1
@@ -89,7 +89,7 @@ int reiserfs_readdir_inode(struct inode path_to_entry.reada =PATH_READA ;while (1 ) { - research: +research:/* * search the directory item, containing entry with * specified key
fs/reiserfs/file.c +2 -2
@@ -114,7 +114,7 @@ static int reiserfs_file_release(struct*/ err =reiserfs_truncate_file (inode,0 ); } - out: +out:reiserfs_write_unlock (inode->i_sb);mutex_unlock (&(REISERFS_I (inode)->tailpack));return err;
@@ -228,7 +228,7 @@ int reiserfs_commit_page(struct inode *i }if (logit) { ret =journal_end (&th); - drop_write_lock: +drop_write_lock:reiserfs_write_unlock (s); }/*
fs/reiserfs/fix_node.c +1 -1
@@ -2714,7 +2714,7 @@ int fix_nodes(int op_mode, struct tree_b goto repeat; } - repeat: +repeat:/* * fix_nodes was unable to perform its calculation due to * filesystem got changed under us, lack of free disk space or i/o
fs/reiserfs/inode.c +24 -24
179 lines not on this page · raw message
fs/reiserfs/ioctl.c +2 -2
@@ -219,11 +219,11 @@ int reiserfs_unpack(struct inode *inode, retval =reiserfs_commit_write (NULL , page, write_from, write_from);REISERFS_I (inode)->i_flags |= i_nopack_mask; - out_unlock: +out_unlock:unlock_page (page);page_cache_release (page); - out: +out:mutex_unlock (&inode->i_mutex);reiserfs_write_unlock (inode->i_sb);return retval;
fs/reiserfs/journal.c +18 -18
@@ -160,7 +160,7 @@ static struct reiserfs_bitmap_node *get_struct list_head *entry = journal->j_bitmap_nodes.next; journal->j_used_bitmap_nodes++; - repeat: +repeat:if (entry != &journal->j_bitmap_nodes) { bn = list_entry(entry, struct reiserfs_bitmap_node, list);
@@ -757,7 +757,7 @@ static inline int __add_jh(struct reiser jh = bh->b_private;list_del_init (&jh->list); }else { - no_jh: +no_jh:get_bh (bh); jh =alloc_jh ();spin_lock (&j->j_dirty_buffers_lock);
@@ -836,7 +836,7 @@ static int write_ordered_buffers(spinlocreiserfs_free_jh (bh);unlock_buffer (bh); } - loop_next: +loop_next:put_bh (bh);cond_resched_lock (lock); }
@@ -891,7 +891,7 @@ static int flush_older_commits(struct suunsigned int other_trans_id;unsigned int first_trans_id; - find_first: +find_first:/* * first we walk backwards to find the oldest uncommitted transation */
@@ -1153,7 +1153,7 @@ static int flush_commit_list(struct supeatomic_set (&(jl->j_older_commits_done),1 ); }mutex_unlock (&jl->j_commit_mutex); - put_jl: +put_jl:put_journal_list (s, jl);if (retval)
@@ -1306,7 +1306,7 @@ static int flush_older_journal_lists(str* we know we are the only ones flushing things, no extra race * protection is required. */ - restart: +restart: entry = journal->j_journal_list.next;/* Did we wrap? */ if (entry == &journal->j_journal_list)
@@ -1504,7 +1504,7 @@ static int flush_journal_list(struct sup (unsigned long long )saved_bh-> b_blocknr, __func__); } - free_cnode: +free_cnode: last = cn; cn = cn->next;if (saved_bh) {
@@ -1564,7 +1564,7 @@ static int flush_journal_list(struct supreiserfs_abort (s, -EIO ,"Write error while pushing transaction to disk in %s" , __func__); - flush_older_and_return: +flush_older_and_return:/* * before we can update the journal header block, we _must_ flush all
@@ -1670,7 +1670,7 @@ static int write_one_transaction(struct }put_bh (tmp_bh); } - next: +next: cn = cn->next;cond_resched (); }
@@ -1770,7 +1770,7 @@ static int kupdate_transactions(struct swrite_chunk (&chunk); } - done: +done:mutex_unlock (&journal->j_flush_mutex);return ret; }
@@ -2229,7 +2229,7 @@ static int journal_read_transaction(strureiserfs_warning (sb,"journal-1204" ,"REPLAY FAILURE fsck required! " "Trying to replay onto a log block" ); - abort_replay: +abort_replay:brelse_array (log_blocks, i);brelse_array (real_blocks, i);brelse (c_bh);
@@ -2491,7 +2491,7 @@ static int journal_read(struct super_blobrelse (d_bh); } - start_log_replay: +start_log_replay: cur_dblock = oldest_start;if (oldest_trans_id) { reiserfs_debug(sb, REISERFS_DEBUG_CODE,
@@ -2892,7 +2892,7 @@ int journal_init(struct super_block *sb,INIT_DELAYED_WORK (&journal->j_work, flush_async_commits); journal->j_work_sb = sb;return 0 ; - free_and_return: +free_and_return:free_journal_ram (sb);return 1 ; }
@@ -3031,7 +3031,7 @@ static int do_journal_begin_r(struct rei th->t_refcount =1 ; th->t_super = sb; - relock: +relock:lock_journal (sb);if (join !=JBEGIN_ABORT &&reiserfs_is_journal_aborted (journal)) {unlock_journal (sb);
@@ -3122,7 +3122,7 @@ static int do_journal_begin_r(struct reiINIT_LIST_HEAD (&th->t_list);return 0 ; - out_fail: +out_fail:memset (th,0 ,sizeof (*th));/* * Re-set th->t_super, so we can properly keep track of how many
@@ -3876,7 +3876,7 @@ static int __commit_trans_jl(struct inod* the inode still exists. We know the list is still around * if we've got a larger transaction id than the oldest list */ - flush_commit_only: +flush_commit_only:if (journal_list_still_alive (inode->i_sb, id)) {/* * we only set ret to 1 when we know for sure
@@ -4302,7 +4302,7 @@ static int do_journal_end(struct reiserf* transactions that might get overwritten. If any journal lists * are very old flush them as well. */ - first_jl: +first_jl:list_for_each_safe (entry, safe, &journal->j_journal_list) { temp_jl =JOURNAL_LIST_ENTRY (entry);if (journal->j_start <= temp_jl->j_start) {
@@ -4359,7 +4359,7 @@ static int do_journal_end(struct reiserf journal_list_still_alive(sb, commit_trans_id)) {flush_commit_list (sb, jl,1 ); } - out: +out:reiserfs_check_lock_depth (sb,"journal end2" );memset (th,0 ,sizeof (*th));
fs/reiserfs/namei.c +7 -7
@@ -686,7 +686,7 @@ static int reiserfs_create(struct inoded_instantiate (dentry, inode); retval =journal_end (&th); - out_failed: +out_failed:reiserfs_write_unlock (dir->i_sb);return retval; }
@@ -767,7 +767,7 @@ static int reiserfs_mknod(struct inode *d_instantiate (dentry, inode); retval =journal_end (&th); - out_failed: +out_failed:reiserfs_write_unlock (dir->i_sb);return retval; }
@@ -958,11 +958,11 @@ static int reiserfs_rmdir(struct inode * retval =journal_end (&th);reiserfs_check_path (&path); - out_rmdir: +out_rmdir:reiserfs_write_unlock (dir->i_sb);return retval; - end_rmdir: +end_rmdir:/* * we must release path, because we did not call * reiserfs_cut_from_item, or reiserfs_cut_from_item does not
@@ -1064,13 +1064,13 @@ static int reiserfs_unlink(struct inodereiserfs_write_unlock (dir->i_sb);return retval; - end_unlink: +end_unlink:pathrelse (&path); err =journal_end (&th);reiserfs_check_path (&path);if (err) retval = err; - out_unlink: +out_unlink:reiserfs_write_unlock (dir->i_sb);return retval; }
@@ -1164,7 +1164,7 @@ static int reiserfs_symlink(struct inodeunlock_new_inode (inode);d_instantiate (dentry, inode); retval =journal_end (&th); - out_failed: +out_failed:reiserfs_write_unlock (parent_dir->i_sb);return retval; }
fs/reiserfs/stree.c +7 -7
@@ -668,7 +668,7 @@ int search_by_key(struct super_block *sbif (!buffer_uptodate (bh)) goto io_error; }else { - io_error: +io_error: search_path->path_length--;pathrelse (search_path);return IO_ERROR ;
@@ -2010,7 +2010,7 @@ int reiserfs_do_truncate(struct reiserfs"PAP-5680: truncate did not finish: new_file_size %Ld, current %Ld, oid %d" , new_file_size, file_size, s_item_key.on_disk_key.k_objectid); - update_and_out: +update_and_out:if (update_timestamps) {/* this is truncate, not file closing */ inode->i_mtime =CURRENT_TIME_SEC ;
@@ -2018,7 +2018,7 @@ int reiserfs_do_truncate(struct reiserfs }reiserfs_update_sd (th, inode); - out: +out:pathrelse (&s_search_path);return err; }
@@ -2112,7 +2112,7 @@ int reiserfs_paste_into_item(struct reiswhile ((retval =fix_nodes (M_PASTE , &s_paste_balance,NULL , body)) ==REPEAT_SEARCH ) { - search_again: +search_again:/* file system changed while we were in the fix_nodes */ PROC_INFO_INC (th->t_super, paste_into_item_restarted); retval =
@@ -2143,7 +2143,7 @@ int reiserfs_paste_into_item(struct reisreturn 0 ; } retval = (retval ==NO_DISK_SPACE ) ? -ENOSPC : -EIO ; - error_out: +error_out:/* this also releases the path */ unfix_nodes (&s_paste_balance);#ifdef REISERQUOTA_DEBUG
@@ -2222,7 +2222,7 @@ int reiserfs_insert_item(struct reiserfswhile ((retval =fix_nodes (M_INSERT , &s_ins_balance, ih, body)) ==REPEAT_SEARCH ) { - search_again: +search_again:/* file system changed while we were in the fix_nodes */ PROC_INFO_INC (th->t_super, insert_item_restarted); retval =search_item (th->t_super, key, path);
@@ -2246,7 +2246,7 @@ int reiserfs_insert_item(struct reiserfs } retval = (retval ==NO_DISK_SPACE ) ? -ENOSPC : -EIO ; - error_out: +error_out:/* also releases the path */ unfix_nodes (&s_ins_balance);#ifdef REISERQUOTA_DEBUG
fs/reiserfs/xattr.c +1 -1
@@ -423,7 +423,7 @@ static struct page *reiserfs_get_page(st }return page; - fail: +fail:reiserfs_put_page (page);return ERR_PTR (-EIO ); }
fs/reiserfs/xattr_acl.c +3 -3
@@ -113,7 +113,7 @@ static struct posix_acl *reiserfs_posix_ goto fail;return acl; - fail: +fail:posix_acl_release (acl);return ERR_PTR (-EINVAL ); }
@@ -166,7 +166,7 @@ static void *reiserfs_posix_acl_to_disk( }return (char *)ext_acl; - fail: +fail:kfree (ext_acl);return ERR_PTR (-EINVAL ); }
@@ -345,7 +345,7 @@ reiserfs_inherit_default_acl(struct reisreturn err; - apply_umask: +apply_umask:/* no ACL, apply umask */ inode->i_mode &= ~current_umask ();return err;
PATCH 9/29 reiserfs: cleanup, remove unnecessary parens
In reply to Jeff MahoneyThe reiserfs code is littered with extra parens in places where the authors may not have been certain about precedence of & vs ->. This patch cleans them out.
---
fs/reiserfs/bitmap.c | 6 +-- fs/reiserfs/dir.c | 2 - fs/reiserfs/do_balan.c | 2 - fs/reiserfs/file.c | 16 +++++----- fs/reiserfs/fix_node.c | 8 ++--- fs/reiserfs/ibalance.c | 4 +- fs/reiserfs/inode.c | 10 +++--- fs/reiserfs/item_ops.c | 4 +- fs/reiserfs/journal.c | 73 +++++++++++++++++++++++------------------------ fs/reiserfs/lbalance.c | 76 ++++++++++++++++++++++++------------------------- fs/reiserfs/namei.c | 21 +++++++------ fs/reiserfs/prints.c | 8 ++--- fs/reiserfs/stree.c | 9 ++--- fs/reiserfs/super.c | 16 +++++----- fs/reiserfs/xattr.c | 4 +- 15 files changed, 129 insertions(+), 130 deletions(-)
fs/reiserfs/bitmap.c +3 -3
@@ -78,7 +78,7 @@ int is_reusable(struct super_block *s, b* up front so we need to account for it. */ if (unlikely (test_bit (REISERFS_OLD_FORMAT , - &(REISERFS_SB (s)->s_properties)))) { + &REISERFS_SB (s)->s_properties))) {b_blocknr_t bmap1 =REISERFS_SB (s)->s_sbh->b_blocknr +1 ;if (block >= bmap1 && block <= bmap1 + bmap_count) {
@@ -524,7 +524,7 @@ static void __discard_prealloc(struct reif (dirty)reiserfs_update_sd (th, inode); ei->i_prealloc_block = save; -list_del_init (&(ei->i_prealloc_list)); +list_del_init (&ei->i_prealloc_list); }/* FIXME: It should be inline function */
@@ -1417,7 +1417,7 @@ struct buffer_head *reiserfs_read_bitmap* I doubt there are any of these left, but just in case... */ if (unlikely (test_bit (REISERFS_OLD_FORMAT , - &(REISERFS_SB (sb)->s_properties)))) + &REISERFS_SB (sb)->s_properties))) block =REISERFS_SB (sb)->s_sbh->b_blocknr +1 + bitmap;else if (bitmap ==0 ) block = (REISERFS_DISK_OFFSET_IN_BYTES >> sb->s_blocksize_bits) +1 ;
fs/reiserfs/dir.c +1 -1
@@ -112,7 +112,7 @@ research:store_ih (&tmp_ih, ih);/* we must have found item, that is item of this directory, */ -RFALSE (COMP_SHORT_KEYS (&(ih->ih_key), &pos_key), +RFALSE (COMP_SHORT_KEYS (&ih->ih_key, &pos_key),"vs-9000: found item %h does not match to dir we readdir %K" , ih, &pos_key); RFALSE(item_num > B_NR_ITEMS(bh) - 1,
fs/reiserfs/do_balan.c +1 -1
@@ -1575,7 +1575,7 @@ void do_balance(struct tree_balance *tb,return ; } -atomic_inc (&(fs_generation (tb->tb_sb))); +atomic_inc (&fs_generation (tb->tb_sb));do_balance_starts (tb);/*
fs/reiserfs/file.c +8 -8
@@ -41,10 +41,10 @@ static int reiserfs_file_release(structif (atomic_add_unless (&REISERFS_I (inode)->openers,-1 ,1 ))return 0 ; -mutex_lock (&(REISERFS_I (inode)->tailpack)); +mutex_lock (&REISERFS_I (inode)->tailpack);if (!atomic_dec_and_test (&REISERFS_I (inode)->openers)) { -mutex_unlock (&(REISERFS_I (inode)->tailpack)); +mutex_unlock (&REISERFS_I (inode)->tailpack);return 0 ; }
@@ -52,7 +52,7 @@ static int reiserfs_file_release(structif ((!(REISERFS_I (inode)->i_flags & i_pack_on_close_mask) || !tail_has_to_be_packed (inode)) &&REISERFS_I (inode)->i_prealloc_count <=0 ) { -mutex_unlock (&(REISERFS_I (inode)->tailpack)); +mutex_unlock (&REISERFS_I (inode)->tailpack);return 0 ; }
@@ -116,7 +116,7 @@ static int reiserfs_file_release(struct } out:reiserfs_write_unlock (inode->i_sb); -mutex_unlock (&(REISERFS_I (inode)->tailpack)); +mutex_unlock (&REISERFS_I (inode)->tailpack);return err; }
@@ -126,18 +126,18 @@ static int reiserfs_file_open(struct ino/* somebody might be tailpacking on final close; wait for it */ if (!atomic_inc_not_zero (&REISERFS_I (inode)->openers)) { -mutex_lock (&(REISERFS_I (inode)->tailpack)); +mutex_lock (&REISERFS_I (inode)->tailpack);atomic_inc (&REISERFS_I (inode)->openers); -mutex_unlock (&(REISERFS_I (inode)->tailpack)); +mutex_unlock (&REISERFS_I (inode)->tailpack); }return err; }void reiserfs_vfs_truncate_file (struct inode *inode) { -mutex_lock (&(REISERFS_I (inode)->tailpack)); +mutex_lock (&REISERFS_I (inode)->tailpack);reiserfs_truncate_file (inode,1 ); -mutex_unlock (&(REISERFS_I (inode)->tailpack)); +mutex_unlock (&REISERFS_I (inode)->tailpack); }/* Sync a reiserfs file. */
fs/reiserfs/fix_node.c +4 -4
@@ -81,7 +81,7 @@ static void create_virtual_node(struct t ih =item_head (Sh,0 );/* define the mergeability for 0-th item (if it is not being deleted) */ -if (op_is_left_mergeable (&(ih->ih_key), Sh->b_size) +if (op_is_left_mergeable (&ih->ih_key, Sh->b_size) && (vn->vn_mode !=M_DELETE || vn->vn_affected_item_num)) vn->vn_vi[0 ].vi_type |=VI_TYPE_LEFT_MERGEABLE ;
@@ -682,7 +682,7 @@ static int is_leaf_removable(struct tree/* check whether we can divide 1 remaining item between neighbors */ /* get size of remaining item (in item units) */ - size =op_unit_num (&(vn->vn_vi[to_left])); + size =op_unit_num (&vn->vn_vi[to_left]);if (tb->lbytes + tb->rbytes >= size) { set_parameters(tb, 0, to_left + 1, to_right + 1, 0, NULL,
@@ -720,7 +720,7 @@ static int are_leaves_removable(struct t ih =item_head (S0 ,0 );if (tb->CFR[0 ] - && !comp_short_le_keys (&(ih->ih_key), + && !comp_short_le_keys (&ih->ih_key,internal_key (tb->CFR[0 ], tb->rkey[0 ])))/*
@@ -1287,7 +1287,7 @@ static inline int can_node_be_removed(in/* shifting may merge items which might save space */ - ((!h - &&op_is_left_mergeable (&(ih->ih_key), Sh->b_size)) ?IH_SIZE :0 ) + &&op_is_left_mergeable (&ih->ih_key, Sh->b_size)) ?IH_SIZE :0 ) - ((!h && r_key &&op_is_left_mergeable (r_key, Sh->b_size)) ?IH_SIZE :0 )
fs/reiserfs/ibalance.c +2 -2
@@ -154,9 +154,9 @@ static void internal_insert_childs(struc/* copy to_be_insert disk children */ for (i =0 ; i < count; i++) { -put_dc_size (&(new_dc[i]), +put_dc_size (&new_dc[i],MAX_CHILD_SIZE (bh[i]) -B_FREE_SPACE (bh[i])); -put_dc_block_number (&(new_dc[i]), bh[i]->b_blocknr); +put_dc_block_number (&new_dc[i], bh[i]->b_blocknr); }memcpy (dc, new_dc,DC_SIZE * count);
fs/reiserfs/inode.c +5 -5
@@ -1027,7 +1027,7 @@ research:*/ make_cpu_key (&tmp_key, inode,le_key_k_offset (version, - &(ih->ih_key)) + + &ih->ih_key) +op_bytes_number (ih, inode->i_sb->s_blocksize),TYPE_INDIRECT ,3 );
@@ -1243,9 +1243,9 @@ static void init_inode(struct inode *ino bh =PATH_PLAST_BUFFER (path); ih =tp_item_head (path); -copy_key (INODE_PKEY (inode), &(ih->ih_key)); +copy_key (INODE_PKEY (inode), &ih->ih_key); -INIT_LIST_HEAD (&(REISERFS_I (inode)->i_prealloc_list)); +INIT_LIST_HEAD (&REISERFS_I (inode)->i_prealloc_list);REISERFS_I (inode)->i_flags =0 ;REISERFS_I (inode)->i_prealloc_block =0 ;REISERFS_I (inode)->i_prealloc_count =0 ;
@@ -1967,7 +1967,7 @@ int reiserfs_new_inode(struct reiserfs_telse make_le_item_head (&ih,NULL ,KEY_FORMAT_3_6 ,SD_OFFSET ,TYPE_STAT_DATA ,SD_SIZE ,MAX_US_INT ); -memcpy (INODE_PKEY (inode), &(ih.ih_key),KEY_SIZE ); +memcpy (INODE_PKEY (inode), &ih.ih_key,KEY_SIZE ); args.dirid =le32_to_cpu (ih.ih_key.k_dir_id); depth =reiserfs_write_unlock_nested (inode->i_sb);
@@ -2011,7 +2011,7 @@ int reiserfs_new_inode(struct reiserfs_tREISERFS_I (inode)->i_first_direct_byte =S_ISLNK (mode) ?1 :U32_MAX /*NO_BYTES_IN_DIRECT_ITEM */ ; -INIT_LIST_HEAD (&(REISERFS_I (inode)->i_prealloc_list)); +INIT_LIST_HEAD (&REISERFS_I (inode)->i_prealloc_list);REISERFS_I (inode)->i_flags =0 ;REISERFS_I (inode)->i_prealloc_block =0 ;REISERFS_I (inode)->i_prealloc_count =0 ;
fs/reiserfs/item_ops.c +2 -2
@@ -491,8 +491,8 @@ static int direntry_create_vi(struct vir j =old_entry_num (is_affected, i, vn->vn_pos_in_item, vn->vn_mode); dir_u->entry_sizes[i] = - (j ?deh_location (&(deh[j -1 ])) :ih_item_len (vi->vi_ih)) - -deh_location (&(deh[j])) +DEH_SIZE ; + (j ?deh_location (&deh[j -1 ]) :ih_item_len (vi->vi_ih)) - +deh_location (&deh[j]) +DEH_SIZE ; } size += (dir_u->entry_count *sizeof (short ));
fs/reiserfs/journal.c +36 -37
237 lines not on this page · raw message
fs/reiserfs/lbalance.c +38 -38
217 lines not on this page · raw message
fs/reiserfs/namei.c +11 -10
@@ -86,8 +86,8 @@ inline void set_de_name_and_namelen(strustatic inline void set_de_object_key (struct reiserfs_dir_entry *de) {BUG_ON (de->de_entry_num >=ih_entry_count (de->de_ih)); - de->de_dir_id =deh_dir_id (&(de->de_deh[de->de_entry_num])); - de->de_objectid =deh_objectid (&(de->de_deh[de->de_entry_num])); + de->de_dir_id =deh_dir_id (&de->de_deh[de->de_entry_num]); + de->de_objectid =deh_objectid (&de->de_deh[de->de_entry_num]); }static inline void store_de_entry_key (struct reiserfs_dir_entry *de)
@@ -102,8 +102,8 @@ static inline void store_de_entry_key(stle32_to_cpu (de->de_ih->ih_key.k_dir_id); de->de_entry_key.on_disk_key.k_objectid =le32_to_cpu (de->de_ih->ih_key.k_objectid); -set_cpu_key_k_offset (&(de->de_entry_key),deh_offset (deh)); -set_cpu_key_k_type (&(de->de_entry_key),TYPE_DIRENTRY ); +set_cpu_key_k_offset (&de->de_entry_key,deh_offset (deh)); +set_cpu_key_k_type (&de->de_entry_key,TYPE_DIRENTRY ); }/*
@@ -149,7 +149,7 @@ int search_by_entry_key(struct super_blo#ifdef CONFIG_REISERFS_CHECK if (!is_direntry_le_ih (de->de_ih) || -COMP_SHORT_KEYS (&(de->de_ih->ih_key), key)) { +COMP_SHORT_KEYS (&de->de_ih->ih_key, key)) {print_block (de->de_bh,0 ,-1 ,-1 );reiserfs_panic (sb,"vs-7005" ,"found item %h is not directory " "item or does not belong to the same directory "
@@ -369,7 +369,7 @@ static struct dentry *reiserfs_lookup(stpathrelse (&path_to_entry);if (retval ==NAME_FOUND ) { inode =reiserfs_iget (dir->i_sb, - (struct cpu_key *)&(de.de_dir_id)); + (struct cpu_key *)&de.de_dir_id);if (!inode ||IS_ERR (inode)) {reiserfs_write_unlock (dir->i_sb);return ERR_PTR (-EACCES );
@@ -414,7 +414,7 @@ struct dentry *reiserfs_get_parent(strucreiserfs_write_unlock (dir->i_sb);return ERR_PTR (-ENOENT ); } - inode =reiserfs_iget (dir->i_sb, (struct cpu_key *)&(de.de_dir_id)); + inode =reiserfs_iget (dir->i_sb, (struct cpu_key *)&de.de_dir_id);reiserfs_write_unlock (dir->i_sb);return d_obtain_alias (inode);
@@ -935,7 +935,8 @@ static int reiserfs_rmdir(struct inode * }/* cut entry from dir directory */ - retval =reiserfs_cut_from_item (&th, &path, &(de.de_entry_key), dir,NULL ,/* page */ + retval =reiserfs_cut_from_item (&th, &path, &de.de_entry_key, + dir,NULL ,/* page */ 0 /*new file size - not used here */ );if (retval <0 ) goto end_rmdir;
@@ -1042,7 +1043,7 @@ static int reiserfs_unlink(struct inode savelink = inode->i_nlink; retval = -reiserfs_cut_from_item (&th, &path, &(de.de_entry_key), dir,NULL , +reiserfs_cut_from_item (&th, &path, &de.de_entry_key, dir,NULL ,0 );if (retval <0 ) {inc_nlink (inode);
@@ -1583,7 +1584,7 @@ static int reiserfs_rename(struct inode* entry. This needs one more clean up */ if (reiserfs_cut_from_item - (&th, &old_entry_path, &(old_de.de_entry_key), old_dir,NULL , + (&th, &old_entry_path, &old_de.de_entry_key, old_dir,NULL ,0 ) <0 )reiserfs_error (old_dir->i_sb,"vs-7060" ,"couldn't not cut old name. Fsck later?" );
fs/reiserfs/prints.c +4 -4
@@ -652,11 +652,11 @@ void store_print_tb(struct tree_balance"* %d * %3lld(%2d) * %3lld(%2d) * %3lld(%2d) * %5lld * %5lld * %5lld * %5lld * %5lld *\n" , h, (tbSh) ? (long long )(tbSh->b_blocknr) : (-1LL ), - (tbSh) ?atomic_read (&(tbSh->b_count)) :-1 , + (tbSh) ?atomic_read (&tbSh->b_count) :-1 , (tb->L[h]) ? (long long )(tb->L[h]->b_blocknr) : (-1LL ), - (tb->L[h]) ?atomic_read (&(tb->L[h]->b_count)) :-1 , + (tb->L[h]) ?atomic_read (&tb->L[h]->b_count) :-1 , (tb->R[h]) ? (long long )(tb->R[h]->b_blocknr) : (-1LL ), - (tb->R[h]) ?atomic_read (&(tb->R[h]->b_count)) :-1 , + (tb->R[h]) ?atomic_read (&tb->R[h]->b_count) :-1 , (tbFh) ? (long long )(tbFh->b_blocknr) : (-1LL ), (tb->FL[h]) ? (long long )(tb->FL[h]-> b_blocknr) : (-1LL),
@@ -698,7 +698,7 @@ void store_print_tb(struct tree_balance"%p (%llu %d)%s" , tb->FEB[i], tb->FEB[i] ? (unsigned long long )tb->FEB[i]-> b_blocknr :0ULL , - tb->FEB[i] ?atomic_read (&(tb->FEB[i]->b_count)) :0 , + tb->FEB[i] ?atomic_read (&tb->FEB[i]->b_count) :0 , (i == ARRAY_SIZE(tb->FEB) - 1) ? "\n" : ", "); sprintf(print_tb_buf + strlen(print_tb_buf),
fs/reiserfs/stree.c +4 -5
@@ -748,7 +748,7 @@ io_error: (node_level ==DISK_LEAF_NODE_LEVEL ) ?IH_SIZE :KEY_SIZE , - &(last_element->pe_position)); + &last_element->pe_position);if (node_level == stop_level) {return retval; }
@@ -871,9 +871,8 @@ int search_for_position_by_key(struct su --PATH_LAST_POSITION(search_path)); blk_size = sb->s_blocksize; -if (comp_short_keys (&(p_le_ih->ih_key), p_cpu_key)) { +if (comp_short_keys (&p_le_ih->ih_key, p_cpu_key))return FILE_NOT_FOUND ; - }/* FIXME: quite ugly this far */
@@ -2088,7 +2087,7 @@ int reiserfs_paste_into_item(struct reisreiserfs_debug (inode->i_sb,REISERFS_DEBUG_CODE ,"reiserquota paste_into_item(): allocating %u id=%u type=%c" , pasted_size, inode->i_uid, -key2type (&(key->on_disk_key))); +key2type (&key->on_disk_key));#endif depth =reiserfs_write_unlock_nested (sb);
@@ -2150,7 +2149,7 @@ error_out:reiserfs_debug (inode->i_sb,REISERFS_DEBUG_CODE ,"reiserquota paste_into_item(): freeing %u id=%u type=%c" , pasted_size, inode->i_uid, -key2type (&(key->on_disk_key))); +key2type (&key->on_disk_key));#endif depth =reiserfs_write_unlock_nested (sb);dquot_free_space_nodirty (inode, pasted_size);
fs/reiserfs/super.c +8 -8
@@ -1642,7 +1642,7 @@ static int read_super_block(struct super/* after journal replay, reread all bitmap and super blocks */ static int reread_meta_blocks (struct super_block *s) { -ll_rw_block (READ ,1 , &(SB_BUFFER_WITH_SB (s))); +ll_rw_block (READ ,1 , &SB_BUFFER_WITH_SB (s));wait_on_buffer (SB_BUFFER_WITH_SB (s));if (!buffer_uptodate (SB_BUFFER_WITH_SB (s))) {reiserfs_warning (s,"reiserfs-2504" ,"error reading the super" );
@@ -1886,7 +1886,7 @@ static int reiserfs_fill_super(struct su jdev_name =NULL ;if (reiserfs_parse_options - (s, (char *)data, &(sbi->s_mount_opt), &blocks, &jdev_name, + (s, (char *)data, &sbi->s_mount_opt, &blocks, &jdev_name, &commit_max_age, qf_names, &qfmt) ==0 ) { goto error_unlocked; }
@@ -2003,7 +2003,7 @@ static int reiserfs_fill_super(struct su args.dirid =REISERFS_ROOT_PARENT_OBJECTID ; root_inode =iget5_locked (s,REISERFS_ROOT_OBJECTID , reiserfs_find_actor, - reiserfs_init_locked_inode, (void *)(&args)); + reiserfs_init_locked_inode, (void *)&args);if (!root_inode) {SWARN (silent, s,"jmacd-10" ,"get root inode failed" ); goto error_unlocked;
@@ -2037,11 +2037,11 @@ static int reiserfs_fill_super(struct suif (is_reiserfs_3_5 (rs) || (is_reiserfs_jr (rs) &&SB_VERSION (s) ==REISERFS_VERSION_1 )) -set_bit (REISERFS_3_5 , &(sbi->s_properties)); +set_bit (REISERFS_3_5 , &sbi->s_properties);else if (old_format) -set_bit (REISERFS_OLD_FORMAT , &(sbi->s_properties)); +set_bit (REISERFS_OLD_FORMAT , &sbi->s_properties);else -set_bit (REISERFS_3_6 , &(sbi->s_properties)); +set_bit (REISERFS_3_6 , &sbi->s_properties);if (!(s->s_flags &MS_RDONLY )) {
@@ -2097,8 +2097,8 @@ static int reiserfs_fill_super(struct suset_sb_version (rs,REISERFS_VERSION_2 );reiserfs_convert_objectid_map_v1 (s); -set_bit (REISERFS_3_6 , &(sbi->s_properties)); -clear_bit (REISERFS_3_5 , &(sbi->s_properties)); +set_bit (REISERFS_3_6 , &sbi->s_properties); +clear_bit (REISERFS_3_5 , &sbi->s_properties); }else if (!silent) {reiserfs_info (s,"using 3.5.x disk format\n" ); }
fs/reiserfs/xattr.c +2 -2
@@ -1027,8 +1027,8 @@ int reiserfs_xattr_init(struct super_blo error:if (err) { -clear_bit (REISERFS_XATTRS_USER , &(REISERFS_SB (s)->s_mount_opt)); -clear_bit (REISERFS_POSIXACL , &(REISERFS_SB (s)->s_mount_opt)); +clear_bit (REISERFS_XATTRS_USER , &REISERFS_SB (s)->s_mount_opt); +clear_bit (REISERFS_POSIXACL , &REISERFS_SB (s)->s_mount_opt); }/* The super_block MS_POSIXACL must mirror the (no)acl mount option. */
PATCH 10/29 reiserfs: cleanup, remove unnecessary parens in dirent creation
In reply to Jeff Mahoneymake_empty_dir_item_v1 and make_empty_dir_item also needed a bit of cleanup but it's clearer to use separate pointers rather than the array positions for just two items.
--- fs/reiserfs/dir.c | 67 +++++++++++++++++++++++++++--------------------------- 1 file changed, 34 insertions(+), 33 deletions(-)
fs/reiserfs/dir.c +34 -33
@@ -282,65 +282,66 @@ static int reiserfs_readdir(struct filevoid make_empty_dir_item_v1 (char *body,__le32 dirid,__le32 objid,__le32 par_dirid,__le32 par_objid) { -struct reiserfs_de_head *deh; +struct reiserfs_de_head *dot, *dotdot;memset (body,0 ,EMPTY_DIR_SIZE_V1 ); - deh = (struct reiserfs_de_head *)body; + dot = (struct reiserfs_de_head *)body; + dotdot = dot +1 ;/* direntry header of "." */ -put_deh_offset (&(deh[0 ]),DOT_OFFSET ); +put_deh_offset (dot,DOT_OFFSET );/* these two are from make_le_item_head, and are are LE */ - deh[0 ].deh_dir_id = dirid; - deh[0 ].deh_objectid = objid; - deh[0 ].deh_state =0 ;/* Endian safe if 0 */ -put_deh_location (&(deh[0 ]),EMPTY_DIR_SIZE_V1 -strlen ("." )); -mark_de_visible (&(deh[0 ])); + dot->deh_dir_id = dirid; + dot->deh_objectid = objid; + dot->deh_state =0 ;/* Endian safe if 0 */ +put_deh_location (dot,EMPTY_DIR_SIZE_V1 -strlen ("." )); +mark_de_visible (dot);/* direntry header of ".." */ -put_deh_offset (&(deh[1 ]),DOT_DOT_OFFSET ); +put_deh_offset (dotdot,DOT_DOT_OFFSET );/* key of ".." for the root directory */ /* these two are from the inode, and are are LE */ - deh[1 ].deh_dir_id = par_dirid; - deh[1 ].deh_objectid = par_objid; - deh[1 ].deh_state =0 ;/* Endian safe if 0 */ -put_deh_location (&(deh[1 ]),deh_location (&(deh[0 ])) -strlen (".." )); -mark_de_visible (&(deh[1 ])); + dotdot->deh_dir_id = par_dirid; + dotdot->deh_objectid = par_objid; + dotdot->deh_state =0 ;/* Endian safe if 0 */ +put_deh_location (dotdot,deh_location (dot) -strlen (".." )); +mark_de_visible (dotdot);/* copy ".." and "." */ -memcpy (body +deh_location (&(deh[0 ])),"." ,1 ); -memcpy (body +deh_location (&(deh[1 ])),".." ,2 ); +memcpy (body +deh_location (dot),"." ,1 ); +memcpy (body +deh_location (dotdot),".." ,2 ); }/* compose directory item containing "." and ".." entries */ void make_empty_dir_item (char *body,__le32 dirid,__le32 objid,__le32 par_dirid,__le32 par_objid) { -struct reiserfs_de_head *deh; +struct reiserfs_de_head *dot, *dotdot;memset (body,0 ,EMPTY_DIR_SIZE ); - deh = (struct reiserfs_de_head *)body; + dot = (struct reiserfs_de_head *)body; + dotdot = dot +1 ;/* direntry header of "." */ -put_deh_offset (&(deh[0 ]),DOT_OFFSET ); +put_deh_offset (dot,DOT_OFFSET );/* these two are from make_le_item_head, and are are LE */ - deh[0 ].deh_dir_id = dirid; - deh[0 ].deh_objectid = objid; - deh[0 ].deh_state =0 ;/* Endian safe if 0 */ -put_deh_location (&(deh[0 ]),EMPTY_DIR_SIZE -ROUND_UP (strlen ("." ))); -mark_de_visible (&(deh[0 ])); + dot->deh_dir_id = dirid; + dot->deh_objectid = objid; + dot->deh_state =0 ;/* Endian safe if 0 */ +put_deh_location (dot,EMPTY_DIR_SIZE -ROUND_UP (strlen ("." ))); +mark_de_visible (dot);/* direntry header of ".." */ -put_deh_offset (&(deh[1 ]),DOT_DOT_OFFSET ); +put_deh_offset (dotdot,DOT_DOT_OFFSET );/* key of ".." for the root directory */ /* these two are from the inode, and are are LE */ - deh[1 ].deh_dir_id = par_dirid; - deh[1 ].deh_objectid = par_objid; - deh[1 ].deh_state =0 ;/* Endian safe if 0 */ -put_deh_location (&(deh[1 ]), -deh_location (&(deh[0 ])) -ROUND_UP (strlen (".." ))); -mark_de_visible (&(deh[1 ])); + dotdot->deh_dir_id = par_dirid; + dotdot->deh_objectid = par_objid; + dotdot->deh_state =0 ;/* Endian safe if 0 */ +put_deh_location (dotdot,deh_location (dot) -ROUND_UP (strlen (".." ))); +mark_de_visible (dotdot);/* copy ".." and "." */ -memcpy (body +deh_location (&(deh[0 ])),"." ,1 ); -memcpy (body +deh_location (&(deh[1 ])),".." ,2 ); +memcpy (body +deh_location (dot),"." ,1 ); +memcpy (body +deh_location (dotdot),".." ,2 ); }
PATCH 11/29 reiserfs: cleanup, make hash detection saner
In reply to Jeff MahoneyThe hash detection code uses long ugly macros multiple times to get the same value. This patch cleans it up to be easier to read.
--- fs/reiserfs/super.c | 108 ++++++++++++++++++++++++---------------------------- 1 file changed, 50 insertions(+), 58 deletions(-)
fs/reiserfs/super.c +50 -58
@@ -1668,71 +1668,63 @@ static __u32 find_hash_out(struct super_struct cpu_key key;INITIALIZE_PATH (path);struct reiserfs_dir_entry de; +struct reiserfs_de_head *deh;__u32 hash =DEFAULT_HASH ; +__u32 deh_hashval, teahash, r5hash, yurahash; inode = s->s_root->d_inode; -do {/* Some serious "goto"-hater was there ;) */ -u32 teahash, r5hash, yurahash; +make_cpu_key (&key, inode, ~0 ,TYPE_DIRENTRY ,3 ); + retval =search_by_entry_key (s, &key, &path, &de); +if (retval ==IO_ERROR ) { +pathrelse (&path); +return UNSET_HASH ; + } +if (retval ==NAME_NOT_FOUND ) + de.de_entry_num--; -make_cpu_key (&key, inode, ~0 ,TYPE_DIRENTRY ,3 ); - retval =search_by_entry_key (s, &key, &path, &de); -if (retval ==IO_ERROR ) { -pathrelse (&path); -return UNSET_HASH ; - } -if (retval ==NAME_NOT_FOUND ) - de.de_entry_num--; -set_de_name_and_namelen (&de); -if (deh_offset (&(de.de_deh[de.de_entry_num])) ==DOT_DOT_OFFSET ) { -/* allow override in this case */ -if (reiserfs_rupasov_hash (s)) { - hash =YURA_HASH ; - } -reiserfs_info (s,"FS seems to be empty, autodetect " -"is using the default hash\n" ); -break ; - } - r5hash =GET_HASH_VALUE (r5_hash (de.de_name, de.de_namelen)); - teahash =GET_HASH_VALUE (keyed_hash (de.de_name, de.de_namelen)); - yurahash =GET_HASH_VALUE (yura_hash (de.de_name, de.de_namelen)); -if (((teahash == r5hash) - && - (GET_HASH_VALUE (deh_offset (&(de.de_deh[de.de_entry_num]))) - == r5hash)) || ((teahash == yurahash) - && (yurahash == -GET_HASH_VALUE (deh_offset - (& - (de. - de_deh[de. - de_entry_num]))))) - || ((r5hash == yurahash) - && (yurahash == -GET_HASH_VALUE (deh_offset - (&(de.de_deh[de.de_entry_num])))))) { -reiserfs_warning (s,"reiserfs-2506" ,"Unable to " -"automatically detect hash function. " -"Please mount with -o " -"hash={tea,rupasov,r5}" ); - hash =UNSET_HASH ; -break ; - } -if (GET_HASH_VALUE (deh_offset (&(de.de_deh[de.de_entry_num]))) == - yurahash) +set_de_name_and_namelen (&de); + deh = de.de_deh + de.de_entry_num; + +if (deh_offset (deh) ==DOT_DOT_OFFSET ) { +/* allow override in this case */ +if (reiserfs_rupasov_hash (s)) hash =YURA_HASH ; -else if (GET_HASH_VALUE - (deh_offset (&(de.de_deh[de.de_entry_num]))) == teahash) - hash =TEA_HASH ; -else if (GET_HASH_VALUE - (deh_offset (&(de.de_deh[de.de_entry_num]))) == r5hash) - hash =R5_HASH ; -else { -reiserfs_warning (s,"reiserfs-2506" , -"Unrecognised hash function" ); - hash =UNSET_HASH ; - } - }while (0 ); +reiserfs_info (s,"FS seems to be empty, autodetect is using the default hash\n" ); + goto out; + } + + deh_hashval =GET_HASH_VALUE (deh_offset (deh)); + r5hash =GET_HASH_VALUE (r5_hash (de.de_name, de.de_namelen)); + teahash =GET_HASH_VALUE (keyed_hash (de.de_name, de.de_namelen)); + yurahash =GET_HASH_VALUE (yura_hash (de.de_name, de.de_namelen)); + +if ((teahash == r5hash && deh_hashval == r5hash) || + (teahash == yurahash && deh_hashval == yurahash) || + (r5hash == yurahash && deh_hashval == yurahash)) { +reiserfs_warning (s,"reiserfs-2506" , +"Unable to automatically detect hash " +"function. Please mount with -o " +"hash={tea,rupasov,r5}" ); + hash =UNSET_HASH ; + goto out; + } + +if (deh_hashval == yurahash) + hash =YURA_HASH ; +else if (deh_hashval == teahash) + hash =TEA_HASH ; +else if (deh_hashval == r5hash) + hash =R5_HASH ; +else { +reiserfs_warning (s,"reiserfs-2506" , +"Unrecognised hash function" ); + hash =UNSET_HASH ; + goto out; + } +return hash; +out:pathrelse (&path);return hash; }
Re: [patch 11/29] reiserfs: cleanup, make hash detection saner
Quoted 11 lines · Jeff Mahoney
The hash detection code uses long ugly macros multiple times to get the same value. This patch cleans it up to be easier to read.
Signed-off-by Jeff Mahoney <[email protected]>--- fs/reiserfs/super.c | 108 ++++++++++++++++++++++++---------------------------- 1 file changed, 50 insertions(+), 58 deletions(-)fs/reiserfs/super.c +0
-0@@ -1668,71 +1668,63 @@ static __u32 find_hash_out(struct super_
...
Quoted 4 lines
fs/reiserfs/super.c +4
-0+ +if (deh_hashval == yurahash) + hash =YURA_HASH ; +else if (deh_hashval == teahash)
fs/reiserfs/super.c static __u32 find_hash_out(struct super_ · line 1725
Quoted 10 lines
fs/reiserfs/super.c +10
-0+ hash =TEA_HASH ; + else if (deh_hashval == r5hash) + hash =R5_HASH ; + else { +reiserfs_warning (s,"reiserfs-2506" , +"Unrecognised hash function" ); + hash =UNSET_HASH ; + goto out; + } +return hash;
But you don't call pathrelse(&path) for some cases it seems while
previously it has been called always. Or am I missing something?
Honza
Quoted 7 lines
fs/reiserfs/super.c +1
-0+out:pathrelse (&path);return hash; }
Signature · 2 lines
Jan Kara <[email protected]> SUSE Labs, CR
Re: [patch 11/29] reiserfs: cleanup, make hash detection saner
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Quoted 13 lines · Jan Kara
Quoted 11 lines · Jeff Mahoney
The hash detection code uses long ugly macros multiple times to get the same value. This patch cleans it up to be easier to read.
Signed-off-by Jeff Mahoney <[email protected]> ---
fs/reiserfs/super.c| 108 ++++++++++++++++++++++++---------------------------- 1 file changed, 50 insertions(+), 58 deletions(-)---
a/fs/reiserfs/super.c+++b/fs/reiserfs/super.c@@ -1668,71 +1668,63 @@ static__u32find_hash_out(structsuper_...
Quoted 8 lines
Quoted 6 lines
+ + if (
deh_hashval== yurahash) + hash =YURA_HASH; + else if
(deh_hashval== teahash) + hash =TEA_HASH; + else if
(deh_hashval== r5hash) + hash =R5_HASH; + else { +
reiserfs_warning(s, "reiserfs-2506", + "Unrecognised hash
function"); + hash =UNSET_HASH; + goto out; + } + return
hash;But you don't call
pathrelse(&path)for some cases it seems while previously it has been called always. Or am I missing something?
No, it needs to be called. That return should be dropped and we'll fall through correctly.
Thanks,
- -Jeff
Quoted 6 lines
Honza
Quoted 4 lines
+out:
pathrelse(&path); return hash; }
- --
Jeff Mahoney
SUSE Labs
-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.22 (Darwin)
iQIcBAEBAgAGBQJTaiQBAAoJEB57S2MheeWyQJUP/ROFtjGsRU8s2VxiYok9Zjrt sLDh8sLwOEosri/nDrC82hlbIuFmqLYsKlBfnhp1uNlBpQo6o86gjioTcCYiq+m/ +IPqjO3KQmlBrvUM9SbX16fcPtoKHpeW0s8og5xcXf9o17N6JnGS441C/3jfXdJW EyF3T/W5TPJzAo0X+hnC8I1V6qF9U0MA6cSXo0Jzfsr190OQ7UQBs1jfmyglZ8oV xYOEgtPCf00NX2XWcpiiEqLTt+KKfeGhtTjQpCU4rcb4SayczxlsY6u+2jbpzZol hA1iHKXQ37Bacxy2ySiwHfvwWu30KEf7G+CrVXv0bs6v0kBix+2vvhr3X4Po/hYv rY7DtIwvHEwkXw3qHUj2O4IO+eovDAgdRpEQKjF92S7YxcVEiKed1DcCs0OFV63x CX5JZdegzXAO9K0Lq5vYSyhhNBiT6qRBK65morAayvJIG7AjcUsidrfyO+Cks66a 1iMeL3CAK4TV/HxW/R4i4CFEFKGEyMEaHGMgFPsFR7N/LPkrBZX5/ejuBfgrCqc5 xbkU+h8g4bvnftFIdj12HsmwfvPuEtfOY4lq9d41K1S/EUYjr1v2lbq6DjPr0APd lgIcsgO6MQwkPLuzIR+8EHBwfkF6ypfWBAVqxAR8zJZ++ASy3EE019oZ4shLv6Ww 4RQWhDK0lvMisV5W+4vl
=L6OA
-----END PGP SIGNATURE-----
Re: [patch 11/29] reiserfs: cleanup, make hash detection saner
Quoted 23 lines · Jeff Mahoney
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1Quoted 19 lines · Jan Kara
Quoted 11 lines · Jeff Mahoney
The hash detection code uses long ugly macros multiple times to get the same value. This patch cleans it up to be easier to read.
Signed-off-by Jeff Mahoney <[email protected]> ---
fs/reiserfs/super.c| 108 ++++++++++++++++++++++++---------------------------- 1 file changed, 50 insertions(+), 58 deletions(-)---
a/fs/reiserfs/super.c+++b/fs/reiserfs/super.c@@ -1668,71 +1668,63 @@ static__u32find_hash_out(structsuper_...
Quoted 6 lines
+ + if (
deh_hashval== yurahash) + hash =YURA_HASH; + else if
(deh_hashval== teahash) + hash =TEA_HASH; + else if
(deh_hashval== r5hash) + hash =R5_HASH; + else { +
reiserfs_warning(s, "reiserfs-2506", + "Unrecognised hash
function"); + hash =UNSET_HASH; + goto out; + } + return
hash;
Quoted 5 lines
Quoted 2 lines
But you don't call
pathrelse(&path)for some cases it seems while previously it has been called always. Or am I missing something?No, it needs to be called. That return should be dropped and we'll fall through correctly.
OK, I've fixed up the patch and merged it to my tree.
Honza
Signature · 2 lines
Jan Kara <[email protected]> SUSE Labs, CR
PATCH 12/29 reiserfs: balance_leaf refactor, reformat balance_leaf comments
In reply to Jeff MahoneyThe comments in balance_leaf are as bad as the code. This patch shifts them around to fit in 80 columns and be easier to read.
--- fs/reiserfs/do_balan.c | 84 ++++++++++++++++++++++++++++++------------------- 1 file changed, 52 insertions(+), 32 deletions(-)
fs/reiserfs/do_balan.c +52 -32
@@ -290,31 +290,43 @@ static int balance_leaf_when_delete(strureturn 0 ; } -static int balance_leaf (struct tree_balance *tb,struct item_head *ih,/* item header of inserted item (this is on little endian) */ -const char *body,/* body of inserted item or bytes to paste */ -int flag,/* i - insert, d - delete, c - cut, p - paste -(see comment to do_balance) */ -struct item_head *insert_key,/* in our processing of one level we sometimes determine what -must be inserted into the next higher level. This insertion -consists of a key or two keys and their corresponding -pointers */ -struct buffer_head **insert_ptr/* inserted node-ptrs for the next level */ - ) +/** +* balance_leaf - reiserfs tree balancing algorithm +* @tb: tree balance state +* @ih: item header of inserted item (little endian) +* @body: body of inserted item or bytes to paste +* @flag: i - insert, d - delete, c - cut, p - paste (see do_balance) +* passed back: +* @insert_key: key to insert new nodes +* @insert_ptr: array of nodes to insert at the next level +* +* In our processing of one level we sometimes determine what must be +* inserted into the next higher level. This insertion consists of a +* key or two keys and their corresponding pointers. +*/ +static int balance_leaf (struct tree_balance *tb,struct item_head *ih, +const char *body,int flag, +struct item_head *insert_key, +struct buffer_head **insert_ptr) {struct buffer_head *tbS0 =PATH_PLAST_BUFFER (tb->tb_path); -int item_pos =PATH_LAST_POSITION (tb->tb_path);/* index into the array of item headers in S[0] -of the affected item */ +/* index into the array of item headers in S[0] of the affected item */ +int item_pos =PATH_LAST_POSITION (tb->tb_path);struct buffer_info bi; -struct buffer_head *S_new[2 ];/* new nodes allocated to hold what could not fit into S */ -int snum[2 ];/* number of items that will be placed -into S_new (includes partially shifted -items) */ -int sbytes[2 ];/* if an item is partially shifted into S_new then -if it is a directory item -it is the number of entries from the item that are shifted into S_new -else -it is the number of bytes from the item that are shifted into S_new -*/ +/* new nodes allocated to hold what could not fit into S */ +struct buffer_head *S_new[2 ]; +/* +* number of items that will be placed into S_new +* (includes partially shifted items) +*/ +int snum[2 ]; +/* +* if an item is partially shifted into S_new then if it is a +* directory item it is the number of entries from the item that +* are shifted into S_new else it is the number of bytes from +* the item that are shifted into S_new +*/ +int sbytes[2 ];int n, i;int ret_val;int pos_in_item;
@@ -331,8 +343,10 @@ static int balance_leaf(struct tree_bala zeros_num =ih_item_len (ih); pos_in_item = tb->tb_path->pos_in_item; -/* for indirect item pos_in_item is measured in unformatted node -pointers. Recalculate to bytes */ +/* +* for indirect item pos_in_item is measured in unformatted node +* pointers. Recalculate to bytes +*/ if (flag !=M_INSERT &&is_indirect_le_ih (item_head (tbS0, item_pos))) pos_in_item *=UNFM_P_SIZE ;
@@ -792,16 +806,20 @@ static int balance_leaf(struct tree_balaRFALSE (tb->blknum[0 ] <0 ,"PAP-12185: blknum can not be %d. It must be >= 0" , tb->blknum[0 ]); -/* if while adding to a node we discover that it is possible to split -it in two, and merge the left part into the left neighbor and the -right part into the right neighbor, eliminating the node */ +/* +* if while adding to a node we discover that it is possible to split +* it in two, and merge the left part into the left neighbor and the +* right part into the right neighbor, eliminating the node +*/ if (tb->blknum[0 ] ==0 ) {/* node S[0] is empty now */ RFALSE (!tb->lnum[0 ] || !tb->rnum[0 ],"PAP-12190: lnum and rnum must not be zero" ); -/* if insertion was done before 0-th position in R[0], right -delimiting key of the tb->L[0]'s and left delimiting key are -not set correctly */ +/* +* if insertion was done before 0-th position in R[0], right +* delimiting key of the tb->L[0]'s and left delimiting key are +* not set correctly +*/ if (tb->CFL[0 ]) {if (!tb->CFR[0 ]) reiserfs_panic(tb->tb_sb, "vs-12195",
@@ -1159,9 +1177,11 @@ static int balance_leaf(struct tree_bala"PAP-12290" ,"insert_size is still not 0 (%d)" , tb->insert_size[0]); } -#endif /* CONFIG_REISERFS_CHECK */ +#endif + +/* Leaf level of the tree is balanced (end of balance_leaf) */ return 0 ; -}/* Leaf level of the tree is balanced (end of balance_leaf) */ +}/* Make empty node */ void make_empty_node (struct buffer_info *bi)
PATCH 13/29 reiserfs: balance_leaf refactor, move state variables into tree_balance
In reply to Jeff MahoneyThis patch pushes the rest of the state variables in balance_leaf into the tree_balance structure so we can use them when we split balance_leaf into separate functions.
--- fs/reiserfs/do_balan.c | 391 +++++++++++++++++++++++-------------------------- fs/reiserfs/fix_node.c | 9 - fs/reiserfs/prints.c | 6 fs/reiserfs/reiserfs.h | 30 ++- 4 files changed, 214 insertions(+), 222 deletions(-)
fs/reiserfs/do_balan.c +185 -206
@@ -310,27 +310,9 @@ static int balance_leaf(struct tree_bala struct buffer_head **insert_ptr) {struct buffer_head *tbS0 =PATH_PLAST_BUFFER (tb->tb_path); -/* index into the array of item headers in S[0] of the affected item */ -int item_pos =PATH_LAST_POSITION (tb->tb_path);struct buffer_info bi; -/* new nodes allocated to hold what could not fit into S */ -struct buffer_head *S_new[2 ]; -/* -* number of items that will be placed into S_new -* (includes partially shifted items) -*/ -int snum[2 ]; -/* -* if an item is partially shifted into S_new then if it is a -* directory item it is the number of entries from the item that -* are shifted into S_new else it is the number of bytes from -* the item that are shifted into S_new -*/ -int sbytes[2 ];int n, i;int ret_val; -int pos_in_item; -int zeros_num;PROC_INFO_INC (tb->tb_sb, balance_at[0 ]);
@@ -338,29 +320,30 @@ static int balance_leaf(struct tree_balaif (tb->insert_size[0 ] <0 )return balance_leaf_when_delete (tb, flag); - zeros_num =0 ; + tb->item_pos =PATH_LAST_POSITION (tb->tb_path), + tb->pos_in_item = tb->tb_path->pos_in_item, + tb->zeroes_num =0 ;if (flag ==M_INSERT && !body) - zeros_num =ih_item_len (ih); + tb->zeroes_num =ih_item_len (ih); - pos_in_item = tb->tb_path->pos_in_item;/* * for indirect item pos_in_item is measured in unformatted node * pointers. Recalculate to bytes */ if (flag !=M_INSERT - &&is_indirect_le_ih (item_head (tbS0, item_pos))) - pos_in_item *=UNFM_P_SIZE ; + &&is_indirect_le_ih (item_head (tbS0, tb->item_pos))) + tb->pos_in_item *=UNFM_P_SIZE ;if (tb->lnum[0 ] >0 ) {/* Shift lnum[0] items from S[0] to the left neighbor L[0] */ -if (item_pos < tb->lnum[0 ]) { +if (tb->item_pos < tb->lnum[0 ]) {/* new item or it part falls to L[0], shift it too */ n =B_NR_ITEMS (tb->L[0 ]);switch (flag) {case M_INSERT :/* insert item into L[0] */ -if (item_pos == tb->lnum[0 ] -1 && tb->lbytes !=-1 ) { +if (tb->item_pos == tb->lnum[0 ] -1 && tb->lbytes !=-1 ) {/* part of new item falls into L[0] */ int new_item_len;int version;
@@ -379,8 +362,8 @@ static int balance_leaf(struct tree_bala/* Insert new item into L[0] */ buffer_info_init_left (tb, &bi);leaf_insert_into_buf (&bi, - n + item_pos - ret_val, ih, body, - zeros_num >ih_item_len (ih) ?ih_item_len (ih) : zeros_num); + n + tb->item_pos - ret_val, ih, body, + tb->zeroes_num >ih_item_len (ih) ?ih_item_len (ih) : tb->zeroes_num); version =ih_version (ih);
@@ -389,11 +372,11 @@ static int balance_leaf(struct tree_bala (tb-> lbytes << (is_indirect_le_ih(ih) ? tb->tb_sb-> s_blocksize_bits - UNFM_P_SHIFT : 0)));put_ih_item_len (ih, new_item_len); -if (tb->lbytes > zeros_num) { - body += (tb->lbytes - zeros_num); - zeros_num =0 ; +if (tb->lbytes > tb->zeroes_num) { + body += (tb->lbytes - tb->zeroes_num); + tb->zeroes_num =0 ; }else - zeros_num -= tb->lbytes; + tb->zeroes_num -= tb->lbytes; RFALSE(ih_item_len(ih) <= 0, "PAP-12085: there is nothing to insert into S[0]: ih_item_len=%d",
@@ -404,43 +387,43 @@ static int balance_leaf(struct tree_bala ret_val =leaf_shift_left (tb, tb->lnum[0 ] -1 , tb->lbytes);/* Insert new item into L[0] */ buffer_info_init_left (tb, &bi); -leaf_insert_into_buf (&bi, n + item_pos - ret_val, ih, body, zeros_num); +leaf_insert_into_buf (&bi, n + tb->item_pos - ret_val, ih, body, tb->zeroes_num); tb->insert_size[0 ] =0 ; - zeros_num =0 ; + tb->zeroes_num =0 ; }break ;case M_PASTE :/* append item in L[0] */ -if (item_pos == tb->lnum[0 ] -1 && tb->lbytes !=-1 ) { +if (tb->item_pos == tb->lnum[0 ] -1 && tb->lbytes !=-1 ) {/* we must shift the part of the appended item */ -if (is_direntry_le_ih (item_head (tbS0, item_pos))) { +if (is_direntry_le_ih (item_head (tbS0, tb->item_pos))) { -RFALSE (zeros_num, +RFALSE (tb->zeroes_num,"PAP-12090: invalid parameter in case of a directory" );/* directory item */ -if (tb->lbytes > pos_in_item) { +if (tb->lbytes > tb->pos_in_item) {/* new directory entry falls into L[0] */ struct item_head *pasted; -int l_pos_in_item = pos_in_item; +int l_pos_in_item = tb->pos_in_item;/* Shift lnum[0] - 1 items in whole. Shift lbytes - 1 entries from given directory item */ ret_val =leaf_shift_left (tb, tb->lnum[0 ], tb->lbytes-1 ); -if (ret_val && !item_pos) { +if (ret_val && !tb->item_pos) { pasted =item_head (tb->L[0 ],B_NR_ITEMS (tb->L[0 ]) -1 ); l_pos_in_item +=ih_entry_count (pasted) - (tb->lbytes -1 ); }/* Append given directory entry to directory item */ buffer_info_init_left (tb, &bi); -leaf_paste_in_buffer (&bi, n + item_pos - ret_val, l_pos_in_item, tb->insert_size[0 ], body, zeros_num); +leaf_paste_in_buffer (&bi, n + tb->item_pos - ret_val, l_pos_in_item, tb->insert_size[0 ], body, tb->zeroes_num);/* previous string prepared space for pasting new entry, following string pastes this entry */ /* when we have merge directory item, pos_in_item has been changed too */ /* paste new directory entry. 1 is entry number */ -leaf_paste_entries (&bi, n + item_pos - ret_val, l_pos_in_item, +leaf_paste_entries (&bi, n + tb->item_pos - ret_val, l_pos_in_item,1 , (struct reiserfs_de_head *) body, body +DEH_SIZE , tb->insert_size[0 ]); tb->insert_size[0 ] =0 ;
@@ -450,20 +433,20 @@ static int balance_leaf(struct tree_balaleaf_shift_left (tb, tb->lnum[0 ], tb->lbytes); }/* Calculate new position to append in item body */ - pos_in_item -= tb->lbytes; + tb->pos_in_item -= tb->lbytes; }else {/* regular object */ RFALSE (tb->lbytes <=0 ,"PAP-12095: there is nothing to shift to L[0]. lbytes=%d" , tb->lbytes); -RFALSE (pos_in_item !=ih_item_len (item_head (tbS0, item_pos)), +RFALSE (tb->pos_in_item !=ih_item_len (item_head (tbS0, tb->item_pos)),"PAP-12100: incorrect position to paste: item_len=%d, pos_in_item=%d" , -ih_item_len (item_head (tbS0, item_pos)),pos_in_item); +ih_item_len (item_head (tbS0, tb->item_pos)), tb->pos_in_item); -if (tb->lbytes >= pos_in_item) { +if (tb->lbytes >= tb->pos_in_item) {/* appended item will be in L[0] in whole */ int l_n;/* this bytes number must be appended to the last item of L[h] */ - l_n = tb->lbytes - pos_in_item; + l_n = tb->lbytes - tb->pos_in_item;/* Calculate new insert_size[0] */ tb->insert_size[0 ] -= l_n;
@@ -472,14 +455,14 @@ static int balance_leaf(struct tree_bala"PAP-12105: there is nothing to paste into L[0]. insert_size=%d" , tb->insert_size[0]); ret_val =leaf_shift_left (tb, tb->lnum[0 ],ih_item_len - (item_head (tbS0, item_pos))); + (item_head (tbS0, tb->item_pos)));/* Append to body of item in L[0] */ buffer_info_init_left (tb, &bi);leaf_paste_in_buffer - (&bi, n + item_pos - ret_val,ih_item_len - (item_head (tb->L[0 ], n + item_pos - ret_val)), + (&bi, n + tb->item_pos - ret_val,ih_item_len + (item_head (tb->L[0 ], n + tb->item_pos - ret_val)), l_n, body, - zeros_num > l_n ? l_n : zeros_num); + tb->zeroes_num > l_n ? l_n : tb->zeroes_num);/* 0-th item in S0 can be only of DIRECT type when l_n != 0 */ {int version;
@@ -488,9 +471,9 @@ static int balance_leaf(struct tree_balaRFALSE (ih_item_len (item_head (tbS0,0 )),"PAP-12106: item length must be 0" );RFALSE (comp_short_le_keys (leaf_key (tbS0,0 ),leaf_key - (tb->L[0 ], n + item_pos - ret_val)), + (tb->L[0 ], n + tb->item_pos - ret_val)),"PAP-12107: items must be of the same file" ); -if (is_indirect_le_ih (item_head (tb->L[0 ], n + item_pos - ret_val))) { +if (is_indirect_le_ih (item_head (tb->L[0 ], n + tb->item_pos - ret_val))) { temp_l = l_n << (tb->tb_sb-> s_blocksize_bits -UNFM_P_SHIFT ); }/* update key of first item in S0 */
@@ -503,12 +486,12 @@ static int balance_leaf(struct tree_bala }/* Calculate new body, position in item and insert_size[0] */ -if (l_n > zeros_num) { - body += (l_n - zeros_num); - zeros_num =0 ; +if (l_n > tb->zeroes_num) { + body += (l_n - tb->zeroes_num); + tb->zeroes_num =0 ; }else - zeros_num -= l_n; - pos_in_item =0 ; + tb->zeroes_num -= l_n; + tb->pos_in_item =0 ;RFALSE (comp_short_le_keys (leaf_key (tbS0,0 ),leaf_key (tb->L[0 ],B_NR_ITEMS (tb->L[0 ]) -1 )) || !op_is_left_mergeable(leaf_key(tbS0, 0), tbS0->b_size)
@@ -517,9 +500,9 @@ static int balance_leaf(struct tree_bala }else {/* only part of the appended item will be in L[0] */ /* Calculate position in item for append in S[0] */ - pos_in_item -= tb->lbytes; + tb->pos_in_item -= tb->lbytes; -RFALSE (pos_in_item <=0 ,"PAP-12125: no place for paste. pos_in_item=%d" , pos_in_item); +RFALSE (tb->pos_in_item <=0 ,"PAP-12125: no place for paste. pos_in_item=%d" , tb->pos_in_item);/* Shift lnum[0] - 1 items in whole. Shift lbytes - 1 byte from item number lnum[0] */ leaf_shift_left (tb, tb->lnum[0 ], tb->lbytes);
@@ -529,29 +512,29 @@ static int balance_leaf(struct tree_balastruct item_head *pasted; -if (!item_pos &&op_is_left_mergeable (leaf_key (tbS0,0 ), tbS0->b_size)) {/* if we paste into first item of S[0] and it is left mergable */ +if (!tb->item_pos &&op_is_left_mergeable (leaf_key (tbS0,0 ), tbS0->b_size)) {/* if we paste into first item of S[0] and it is left mergable */ /* then increment pos_in_item by the size of the last item in L[0] */ pasted =item_head (tb->L[0 ], n -1 );if (is_direntry_le_ih (pasted)) - pos_in_item +=ih_entry_count (pasted); + tb->pos_in_item +=ih_entry_count (pasted);else - pos_in_item +=ih_item_len (pasted); + tb->pos_in_item +=ih_item_len (pasted); }/* Shift lnum[0] - 1 items in whole. Shift lbytes - 1 byte from item number lnum[0] */ ret_val =leaf_shift_left (tb, tb->lnum[0 ], tb->lbytes);/* Append to body of item in L[0] */ buffer_info_init_left (tb, &bi); -leaf_paste_in_buffer (&bi, n + item_pos - ret_val, - pos_in_item, +leaf_paste_in_buffer (&bi, n + tb->item_pos - ret_val, + tb->pos_in_item, tb->insert_size[0 ], - body, zeros_num); + body, tb->zeroes_num);/* if appended item is directory, paste entry */ - pasted =item_head (tb->L[0 ], n + item_pos - ret_val); + pasted =item_head (tb->L[0 ], n + tb->item_pos - ret_val);if (is_direntry_le_ih (pasted)) -leaf_paste_entries (&bi, n + item_pos - ret_val, - pos_in_item,1 , +leaf_paste_entries (&bi, n + tb->item_pos - ret_val, + tb->pos_in_item,1 , (struct reiserfs_de_head *) body, body +DEH_SIZE , tb->insert_size[0 ]);
@@ -559,7 +542,7 @@ static int balance_leaf(struct tree_balaif (is_indirect_le_ih (pasted))set_ih_free_space (pasted,0 ); tb->insert_size[0 ] =0 ; - zeros_num =0 ; + tb->zeroes_num =0 ; }break ;default :/* cases d and t */
@@ -576,7 +559,7 @@ static int balance_leaf(struct tree_bala/* tb->lnum[0] > 0 */ /* Calculate new item position */ - item_pos -= (tb->lnum[0 ] - ((tb->lbytes !=-1 ) ?1 :0 )); + tb->item_pos -= (tb->lnum[0 ] - ((tb->lbytes !=-1 ) ?1 :0 ));if (tb->rnum[0 ] >0 ) {/* shift rnum[0] items from S[0] to the right neighbor R[0] */
@@ -584,9 +567,9 @@ static int balance_leaf(struct tree_balaswitch (flag) {case M_INSERT :/* insert item */ -if (n - tb->rnum[0 ] < item_pos) {/* new item or its part falls to R[0] */ -if (item_pos == n - tb->rnum[0 ] +1 && tb->rbytes !=-1 ) {/* part of new item falls into R[0] */ -loff_t old_key_comp, old_len, r_zeros_number; +if (n - tb->rnum[0 ] < tb->item_pos) {/* new item or its part falls to R[0] */ +if (tb->item_pos == n - tb->rnum[0 ] +1 && tb->rbytes !=-1 ) {/* part of new item falls into R[0] */ +loff_t old_key_comp, old_len, r_zeroes_number;const char *r_body;int version;loff_t offset;
@@ -604,17 +587,17 @@ static int balance_leaf(struct tree_balaput_ih_item_len (ih, tb->rbytes);/* Insert part of the item into R[0] */ buffer_info_init_right (tb, &bi); -if ((old_len - tb->rbytes) > zeros_num) { - r_zeros_number =0 ; - r_body = body + (old_len - tb->rbytes) - zeros_num; +if ((old_len - tb->rbytes) > tb->zeroes_num) { + r_zeroes_number =0 ; + r_body = body + (old_len - tb->rbytes) - tb->zeroes_num; }else { r_body = body; - r_zeros_number = zeros_num - (old_len - tb->rbytes); - zeros_num -= r_zeros_number; + r_zeroes_number = tb->zeroes_num - (old_len - tb->rbytes); + tb->zeroes_num -= r_zeroes_number; }leaf_insert_into_buf (&bi,0 , ih, r_body, - r_zeros_number); + r_zeroes_number);/* Replace right delimiting key by first key in R[0] */ replace_key(tb, tb->CFR[0], tb->rkey[0],
@@ -632,16 +615,16 @@ static int balance_leaf(struct tree_bala ret_val =leaf_shift_right (tb, tb->rnum[0 ] -1 , tb->rbytes);/* Insert new item into R[0] */ buffer_info_init_right (tb, &bi); -leaf_insert_into_buf (&bi, item_pos - n + tb->rnum[0 ] -1 , - ih, body, zeros_num); +leaf_insert_into_buf (&bi, tb->item_pos - n + tb->rnum[0 ] -1 , + ih, body, tb->zeroes_num); -if (item_pos - n + tb->rnum[0 ] -1 ==0 ) { +if (tb->item_pos - n + tb->rnum[0 ] -1 ==0 ) {replace_key (tb, tb->CFR[0 ], tb->rkey[0 ], tb->R[0 ],0 ); } - zeros_num = tb->insert_size[0 ] =0 ; + tb->zeroes_num = tb->insert_size[0 ] =0 ; } }else {/* new item or part of it doesn't fall into R[0] */
@@ -651,17 +634,17 @@ static int balance_leaf(struct tree_balacase M_PASTE :/* append item */ -if (n - tb->rnum[0 ] <= item_pos) {/* pasted item or part of it falls to R[0] */ -if (item_pos == n - tb->rnum[0 ] && tb->rbytes !=-1 ) {/* we must shift the part of the appended item */ -if (is_direntry_le_ih (item_head (tbS0, item_pos))) {/* we append to directory item */ +if (n - tb->rnum[0 ] <= tb->item_pos) {/* pasted item or part of it falls to R[0] */ +if (tb->item_pos == n - tb->rnum[0 ] && tb->rbytes !=-1 ) {/* we must shift the part of the appended item */ +if (is_direntry_le_ih (item_head (tbS0, tb->item_pos))) {/* we append to directory item */ int entry_count; -RFALSE (zeros_num, +RFALSE (tb->zeroes_num,"PAP-12145: invalid parameter in case of a directory" ); entry_count =ih_entry_count (item_head - (tbS0, item_pos)); + (tbS0, tb->item_pos));if (entry_count - tb->rbytes < - pos_in_item) + tb->pos_in_item)/* new directory entry falls into R[0] */ {int paste_entry_position;
@@ -672,9 +655,9 @@ static int balance_leaf(struct tree_bala/* Shift rnum[0]-1 items in whole. Shift rbytes-1 directory entries from directory item number rnum[0] */ leaf_shift_right (tb, tb->rnum[0 ], tb->rbytes -1 );/* Paste given directory entry to directory item */ - paste_entry_position = pos_in_item - entry_count + tb->rbytes -1 ; + paste_entry_position = tb->pos_in_item - entry_count + tb->rbytes -1 ;buffer_info_init_right (tb, &bi); -leaf_paste_in_buffer (&bi,0 , paste_entry_position, tb->insert_size[0 ], body, zeros_num); +leaf_paste_in_buffer (&bi,0 , paste_entry_position, tb->insert_size[0 ], body, tb->zeroes_num);/* paste entry */ leaf_paste_entries(&bi, 0, paste_entry_position, 1, (struct reiserfs_de_head *) body,
@@ -686,25 +669,25 @@ static int balance_leaf(struct tree_bala } tb->insert_size[0 ] =0 ; - pos_in_item++; + tb->pos_in_item++; }else {/* new directory entry doesn't fall into R[0] */ leaf_shift_right (tb, tb->rnum[0 ], tb->rbytes); } }else {/* regular object */ -int n_shift, n_rem, r_zeros_number; +int n_shift, n_rem, r_zeroes_number;const char *r_body;/* Calculate number of bytes which must be shifted from appended item */ if ((n_shift = tb->rbytes - tb->insert_size[0 ]) <0 ) n_shift =0 ; -RFALSE (pos_in_item !=ih_item_len - (item_head (tbS0, item_pos)), +RFALSE (tb->pos_in_item !=ih_item_len + (item_head (tbS0, tb->item_pos)),"PAP-12155: invalid position to paste. ih_item_len=%d, pos_in_item=%d" , - pos_in_item,ih_item_len - (item_head (tbS0, item_pos))); + tb->pos_in_item,ih_item_len + (item_head (tbS0, tb->item_pos)));leaf_shift_right (tb, tb->rnum[0 ], n_shift);/* Calculate number of bytes which must remain in body after appending to R[0] */
@@ -730,18 +713,18 @@ static int balance_leaf(struct tree_bala/* Append part of body into R[0] */ buffer_info_init_right (tb, &bi); -if (n_rem > zeros_num) { - r_zeros_number =0 ; - r_body = body + n_rem - zeros_num; +if (n_rem > tb->zeroes_num) { + r_zeroes_number =0 ; + r_body = body + n_rem - tb->zeroes_num; }else { r_body = body; - r_zeros_number = zeros_num - n_rem; - zeros_num -= r_zeros_number; + r_zeroes_number = tb->zeroes_num - n_rem; + tb->zeroes_num -= r_zeroes_number; }leaf_paste_in_buffer (&bi,0 , n_shift, tb->insert_size[0 ] - n_rem, - r_body, r_zeros_number); + r_body, r_zeroes_number);if (is_indirect_le_ih (item_head (tb->R[0 ],0 ))) {#if 0
@@ -752,7 +735,7 @@ static int balance_leaf(struct tree_bala } tb->insert_size[0 ] = n_rem;if (!n_rem) - pos_in_item++; + tb->pos_in_item++; } }else {/* pasted item in whole falls into R[0] */
@@ -760,22 +743,22 @@ static int balance_leaf(struct tree_bala ret_val =leaf_shift_right (tb, tb->rnum[0 ], tb->rbytes);/* append item in R[0] */ -if (pos_in_item >=0 ) { +if (tb->pos_in_item >=0 ) {buffer_info_init_right (tb, &bi); -leaf_paste_in_buffer (&bi, item_pos - n + tb->rnum[0 ], pos_in_item, - tb->insert_size[0 ], body, zeros_num); +leaf_paste_in_buffer (&bi, tb->item_pos - n + tb->rnum[0 ], tb->pos_in_item, + tb->insert_size[0 ], body, tb->zeroes_num); }/* paste new entry, if item is directory item */ - pasted =item_head (tb->R[0 ], item_pos - n + tb->rnum[0 ]); -if (is_direntry_le_ih (pasted) && pos_in_item >=0 ) { -leaf_paste_entries (&bi, item_pos - n + tb->rnum[0 ], - pos_in_item,1 , + pasted =item_head (tb->R[0 ], tb->item_pos - n + tb->rnum[0 ]); +if (is_direntry_le_ih (pasted) && tb->pos_in_item >=0 ) { +leaf_paste_entries (&bi, tb->item_pos - n + tb->rnum[0 ], + tb->pos_in_item,1 , (struct reiserfs_de_head *) body, body +DEH_SIZE , tb->insert_size[0 ]); -if (!pos_in_item) { +if (!tb->pos_in_item) { -RFALSE (item_pos - n + tb->rnum[0 ], +RFALSE (tb->item_pos - n + tb->rnum[0 ],"PAP-12165: directory item must be first item of node when pasting is in 0th position" );/* update delimiting keys */
@@ -785,7 +768,7 @@ static int balance_leaf(struct tree_balaif (is_indirect_le_ih (pasted))set_ih_free_space (pasted,0 ); - zeros_num = tb->insert_size[0 ] =0 ; + tb->zeroes_num = tb->insert_size[0 ] =0 ; } }else {/* new item doesn't fall into R[0] */
@@ -834,39 +817,34 @@ static int balance_leaf(struct tree_bala }/* Fill new nodes that appear in place of S[0] */ - -/* I am told that this copying is because we need an array to enable -the looping code. -Hans */ - snum[0 ] = tb->s1num, snum[1 ] = tb->s2num; - sbytes[0 ] = tb->s1bytes; - sbytes[1 ] = tb->s2bytes;for (i = tb->blknum[0 ] -2 ; i >=0 ; i--) { -RFALSE (!snum[i],"PAP-12200: snum[%d] == %d. Must be > 0" , i, - snum[i]); +RFALSE (!tb->snum[i], +"PAP-12200: snum[%d] == %d. Must be > 0" , i, + tb->snum[i]);/* here we shift from S to S_new nodes */ - S_new[i] =get_FEB (tb); + tb->S_new[i] =get_FEB (tb);/* initialized block type and tree level */ -set_blkh_level (B_BLK_HEAD (S_new[i]),DISK_LEAF_NODE_LEVEL ); +set_blkh_level (B_BLK_HEAD (tb->S_new[i]),DISK_LEAF_NODE_LEVEL ); n =B_NR_ITEMS (tbS0);switch (flag) {case M_INSERT :/* insert item */ -if (n - snum[i] < item_pos) {/* new item or it's part falls to first new node S_new[i] */ -if (item_pos == n - snum[i] +1 && sbytes[i] !=-1 ) {/* part of new item falls into S_new[i] */ -int old_key_comp, old_len, r_zeros_number; +if (n - tb->snum[i] < tb->item_pos) {/* new item or it's part falls to first new node S_new[i] */ +if (tb->item_pos == n - tb->snum[i] +1 && tb->sbytes[i] !=-1 ) {/* part of new item falls into S_new[i] */ +int old_key_comp, old_len, r_zeroes_number;const char *r_body;int version;/* Move snum[i]-1 items from S[0] to S_new[i] */ leaf_move_items (LEAF_FROM_S_TO_SNEW , tb, - snum[i] -1 ,-1 , - S_new[i]); + tb->snum[i] -1 ,-1 , + tb->S_new[i]);/* Remember key component and item length */ version =ih_version (ih); old_key_comp =le_ih_k_offset (ih);
@@ -874,59 +852,59 @@ static int balance_leaf(struct tree_bala/* Calculate key component and item length to insert into S_new[i] */ set_le_ih_k_offset (ih,le_ih_k_offset (ih) + - ((old_len - sbytes[i]) << (is_indirect_le_ih (ih) ? tb->tb_sb-> s_blocksize_bits -UNFM_P_SHIFT :0 ))); + ((old_len - tb->sbytes[i]) << (is_indirect_le_ih (ih) ? tb->tb_sb->s_blocksize_bits -UNFM_P_SHIFT :0 ))); -put_ih_item_len (ih, sbytes[i]); +put_ih_item_len (ih, tb->sbytes[i]);/* Insert part of the item into S_new[i] before 0-th item */ -buffer_info_init_bh (tb, &bi, S_new[i]); +buffer_info_init_bh (tb, &bi, tb->S_new[i]); -if ((old_len - sbytes[i]) > zeros_num) { - r_zeros_number =0 ; - r_body = body + (old_len - sbytes[i]) - zeros_num; +if ((old_len - tb->sbytes[i]) > tb->zeroes_num) { + r_zeroes_number =0 ; + r_body = body + (old_len - tb->sbytes[i]) - tb->zeroes_num; }else { r_body = body; - r_zeros_number = zeros_num - (old_len - sbytes[i]); - zeros_num -= r_zeros_number; + r_zeroes_number = tb->zeroes_num - (old_len - tb->sbytes[i]); + tb->zeroes_num -= r_zeroes_number; } -leaf_insert_into_buf (&bi,0 , ih, r_body, r_zeros_number); +leaf_insert_into_buf (&bi,0 , ih, r_body, r_zeroes_number);/* Calculate key component and item length to insert into S[i] */ set_le_ih_k_offset (ih, old_key_comp); -put_ih_item_len (ih, old_len - sbytes[i]); - tb->insert_size[0 ] -= sbytes[i]; +put_ih_item_len (ih, old_len - tb->sbytes[i]); + tb->insert_size[0 ] -= tb->sbytes[i]; }else {/* whole new item falls into S_new[i] */ /* Shift snum[0] - 1 items to S_new[i] (sbytes[i] of split item) */ leaf_move_items (LEAF_FROM_S_TO_SNEW , tb, - snum[i] -1 , sbytes[i], S_new[i]); + tb->snum[i] -1 , tb->sbytes[i], tb->S_new[i]);/* Insert new item into S_new[i] */ -buffer_info_init_bh (tb, &bi, S_new[i]); -leaf_insert_into_buf (&bi, item_pos - n + snum[i] -1 , - ih, body, zeros_num); +buffer_info_init_bh (tb, &bi, tb->S_new[i]); +leaf_insert_into_buf (&bi, tb->item_pos - n + tb->snum[i] -1 , + ih, body, tb->zeroes_num); - zeros_num = tb->insert_size[0 ] =0 ; + tb->zeroes_num = tb->insert_size[0 ] =0 ; } }else {/* new item or it part don't falls into S_new[i] */ leaf_move_items (LEAF_FROM_S_TO_SNEW , tb, - snum[i], sbytes[i], S_new[i]); + tb->snum[i], tb->sbytes[i], tb->S_new[i]); }break ;case M_PASTE :/* append item */ -if (n - snum[i] <= item_pos) {/* pasted item or part if it falls to S_new[i] */ -if (item_pos == n - snum[i] && sbytes[i] !=-1 ) {/* we must shift part of the appended item */ +if (n - tb->snum[i] <= tb->item_pos) {/* pasted item or part if it falls to S_new[i] */ +if (tb->item_pos == n - tb->snum[i] && tb->sbytes[i] !=-1 ) {/* we must shift part of the appended item */ struct item_head *aux_ih;RFALSE (ih,"PAP-12210: ih must be 0" ); - aux_ih =item_head (tbS0, item_pos); + aux_ih =item_head (tbS0, tb->item_pos);if (is_direntry_le_ih (aux_ih)) {/* we append to directory item */
@@ -934,65 +912,65 @@ static int balance_leaf(struct tree_bala entry_count =ih_entry_count (aux_ih); -if (entry_count - sbytes[i] < pos_in_item && pos_in_item <= entry_count) { +if (entry_count - tb->sbytes[i] < tb->pos_in_item && tb->pos_in_item <= entry_count) {/* new directory entry falls into S_new[i] */ RFALSE (!tb->insert_size[0 ],"PAP-12215: insert_size is already 0" ); -RFALSE (sbytes[i] -1 >= entry_count, +RFALSE (tb->sbytes[i] -1 >= entry_count,"PAP-12220: there are no so much entries (%d), only %d" , - sbytes[i] -1 , entry_count); + tb->sbytes[i] -1 , entry_count);/* Shift snum[i]-1 items in whole. Shift sbytes[i] directory entries from directory item number snum[i] */ -leaf_move_items (LEAF_FROM_S_TO_SNEW , tb, snum[i], sbytes[i] -1 , S_new[i]); +leaf_move_items (LEAF_FROM_S_TO_SNEW , tb, tb->snum[i], tb->sbytes[i] -1 , tb->S_new[i]);/* Paste given directory entry to directory item */ -buffer_info_init_bh (tb, &bi, S_new[i]); -leaf_paste_in_buffer (&bi,0 , pos_in_item - entry_count + sbytes[i] -1 , - tb->insert_size[0 ], body, zeros_num); +buffer_info_init_bh (tb, &bi, tb->S_new[i]); +leaf_paste_in_buffer (&bi,0 , tb->pos_in_item - entry_count + tb->sbytes[i] -1 , + tb->insert_size[0 ], body, tb->zeroes_num);/* paste new directory entry */ -leaf_paste_entries (&bi,0 , pos_in_item - entry_count + sbytes[i] -1 ,1 , +leaf_paste_entries (&bi,0 , tb->pos_in_item - entry_count + tb->sbytes[i] -1 ,1 , (struct reiserfs_de_head *) body, body +DEH_SIZE , tb->insert_size[0 ]); tb->insert_size[0 ] =0 ; - pos_in_item++; + tb->pos_in_item++; }else {/* new directory entry doesn't fall into S_new[i] */ -leaf_move_items (LEAF_FROM_S_TO_SNEW ,tb, snum[i], sbytes[i], S_new[i]); +leaf_move_items (LEAF_FROM_S_TO_SNEW , tb, tb->snum[i], tb->sbytes[i], tb->S_new[i]); } }else {/* regular object */ -int n_shift, n_rem, r_zeros_number; +int n_shift, n_rem, r_zeroes_number;const char *r_body; -RFALSE (pos_in_item !=ih_item_len (item_head (tbS0, item_pos)) || tb->insert_size[0 ] <=0 , +RFALSE (tb->pos_in_item !=ih_item_len (item_head (tbS0, tb->item_pos)) || tb->insert_size[0 ] <=0 ,"PAP-12225: item too short or insert_size <= 0" );/* Calculate number of bytes which must be shifted from appended item */ - n_shift = sbytes[i] - tb->insert_size[0 ]; + n_shift = tb->sbytes[i] - tb->insert_size[0 ];if (n_shift <0 ) n_shift =0 ; -leaf_move_items (LEAF_FROM_S_TO_SNEW , tb, snum[i], n_shift, S_new[i]); +leaf_move_items (LEAF_FROM_S_TO_SNEW , tb, tb->snum[i], n_shift, tb->S_new[i]);/* Calculate number of bytes which must remain in body after append to S_new[i] */ - n_rem = tb->insert_size[0 ] - sbytes[i]; + n_rem = tb->insert_size[0 ] - tb->sbytes[i];if (n_rem <0 ) n_rem =0 ;/* Append part of body into S_new[0] */ -buffer_info_init_bh (tb, &bi, S_new[i]); -if (n_rem > zeros_num) { - r_zeros_number =0 ; - r_body = body + n_rem - zeros_num; +buffer_info_init_bh (tb, &bi, tb->S_new[i]); +if (n_rem > tb->zeroes_num) { + r_zeroes_number =0 ; + r_body = body + n_rem - tb->zeroes_num; }else { r_body = body; - r_zeros_number = zeros_num - n_rem; - zeros_num -= r_zeros_number; + r_zeroes_number = tb->zeroes_num - n_rem; + tb->zeroes_num -= r_zeroes_number; }leaf_paste_in_buffer (&bi,0 , n_shift, tb->insert_size[0 ] - n_rem, - r_body, r_zeros_number); + r_body, r_zeroes_number); {struct item_head *tmp; - tmp =item_head (S_new[i],0 ); + tmp =item_head (tb->S_new[i],0 );if (is_indirect_le_ih (tmp)) {set_ih_free_space (tmp,0 );
@@ -1004,7 +982,7 @@ static int balance_leaf(struct tree_bala tb->insert_size[0 ] = n_rem;if (!n_rem) - pos_in_item++; + tb->pos_in_item++; } }else /* item falls wholly into S_new[i] */
@@ -1013,10 +991,10 @@ static int balance_leaf(struct tree_balastruct item_head *pasted;#ifdef CONFIG_REISERFS_CHECK -struct item_head *ih_check =item_head (tbS0, item_pos); +struct item_head *ih_check =item_head (tbS0, tb->item_pos);if (!is_direntry_le_ih (ih_check) - && (pos_in_item !=ih_item_len (ih_check) + && (tb->pos_in_item !=ih_item_len (ih_check) || tb->insert_size[0 ] <=0 )) reiserfs_panic(tb->tb_sb, "PAP-12235",
@@ -1026,27 +1004,27 @@ static int balance_leaf(struct tree_bala#endif /* CONFIG_REISERFS_CHECK */ leaf_mi =leaf_move_items (LEAF_FROM_S_TO_SNEW , - tb, snum[i], - sbytes[i], - S_new[i]); + tb, tb->snum[i], + tb->sbytes[i], + tb->S_new[i]);RFALSE (leaf_mi,"PAP-12240: unexpected value returned by leaf_move_items (%d)" , leaf_mi);/* paste into item */ -buffer_info_init_bh (tb, &bi, S_new[i]); +buffer_info_init_bh (tb, &bi, tb->S_new[i]);leaf_paste_in_buffer (&bi, - item_pos - n + snum[i], - pos_in_item, + tb->item_pos - n + tb->snum[i], + tb->pos_in_item, tb->insert_size[0 ], - body, zeros_num); + body, tb->zeroes_num); - pasted =item_head (S_new[i], item_pos - n + snum[i]); + pasted =item_head (tb->S_new[i], tb->item_pos - n + tb->snum[i]);if (is_direntry_le_ih (pasted)) {leaf_paste_entries (&bi, - item_pos - n + snum[i], - pos_in_item,1 , + tb->item_pos - n + tb->snum[i], + tb->pos_in_item,1 , (struct reiserfs_de_head *)body, body +DEH_SIZE , tb->insert_size[0]
@@ -1056,14 +1034,14 @@ static int balance_leaf(struct tree_bala/* if we paste to indirect item update ih_free_space */ if (is_indirect_le_ih (pasted))set_ih_free_space (pasted,0 ); - zeros_num = tb->insert_size[0 ] =0 ; + tb->zeroes_num = tb->insert_size[0 ] =0 ; } }else {/* pasted item doesn't fall into S_new[i] */ leaf_move_items (LEAF_FROM_S_TO_SNEW , tb, - snum[i], sbytes[i], S_new[i]); + tb->snum[i], tb->sbytes[i], tb->S_new[i]); }break ;default :/* cases d and t */
@@ -1072,27 +1050,28 @@ static int balance_leaf(struct tree_bala (flag == M_DELETE) ? "DELETE" : ((flag == M_CUT) ? "CUT" : "UNKNOWN"), flag); } -memcpy (insert_key + i,leaf_key (S_new[i],0 ),KEY_SIZE ); - insert_ptr[i] = S_new[i]; +memcpy (insert_key + i,leaf_key (tb->S_new[i],0 ),KEY_SIZE ); + insert_ptr[i] = tb->S_new[i]; -RFALSE (!buffer_journaled (S_new[i]) - ||buffer_journal_dirty (S_new[i]) - ||buffer_dirty (S_new[i]),"PAP-12247: S_new[%d] : (%b)" , - i, S_new[i]); +RFALSE (!buffer_journaled (tb->S_new[i]) + ||buffer_journal_dirty (tb->S_new[i]) + ||buffer_dirty (tb->S_new[i]), +"PAP-12247: S_new[%d] : (%b)" , + i, tb->S_new[i]); }/* if the affected item was not wholly shifted then we perform all necessary operations on that part or whole of the affected item which remains in S */ -if (0 <= item_pos && item_pos < tb->s0num) {/* if we must insert or append into buffer S[0] */ +if (0 <= tb->item_pos && tb->item_pos < tb->s0num) {/* if we must insert or append into buffer S[0] */ switch (flag) {case M_INSERT :/* insert item into S[0] */ buffer_info_init_tbS0 (tb, &bi); -leaf_insert_into_buf (&bi, item_pos, ih, body, - zeros_num); +leaf_insert_into_buf (&bi, tb->item_pos, ih, + body, tb->zeroes_num);/* If we insert the first key change the delimiting key */ -if (item_pos ==0 ) { +if (tb->item_pos ==0 ) {if (tb->CFL[0 ])/* can be 0 in reiserfsck */ replace_key (tb, tb->CFL[0 ], tb->lkey[0 ], tbS0,0 ); }
@@ -1101,26 +1080,26 @@ static int balance_leaf(struct tree_balacase M_PASTE :{/* append item in S[0] */ struct item_head *pasted; - pasted =item_head (tbS0, item_pos); + pasted =item_head (tbS0, tb->item_pos);/* when directory, may be new entry already pasted */ if (is_direntry_le_ih (pasted)) { -if (pos_in_item >=0 && pos_in_item <=ih_entry_count (pasted)) { +if (tb->pos_in_item >=0 && tb->pos_in_item <=ih_entry_count (pasted)) {RFALSE (!tb->insert_size[0 ],"PAP-12260: insert_size is 0 already" );/* prepare space */ buffer_info_init_tbS0 (tb, &bi); -leaf_paste_in_buffer (&bi, item_pos, pos_in_item, +leaf_paste_in_buffer (&bi, tb->item_pos, tb->pos_in_item, tb->insert_size[0 ], body, - zeros_num); + tb->zeroes_num);/* paste entry */ -leaf_paste_entries (&bi, item_pos, pos_in_item,1 , +leaf_paste_entries (&bi, tb->item_pos, tb->pos_in_item,1 , (struct reiserfs_de_head *)body, body +DEH_SIZE , tb->insert_size[0 ]); -if (!item_pos && !pos_in_item) { +if (!tb->item_pos && !tb->pos_in_item) {RFALSE (!tb->CFL[0 ] || !tb->L[0 ],"PAP-12270: CFL[0]/L[0] must be specified" );if (tb->CFL[0 ])
@@ -1129,14 +1108,14 @@ static int balance_leaf(struct tree_bala tb->insert_size[0 ] =0 ; } }else {/* regular object */ -if (pos_in_item ==ih_item_len (pasted)) { +if (tb->pos_in_item ==ih_item_len (pasted)) {RFALSE (tb->insert_size[0 ] <=0 ,"PAP-12275: insert size must not be %d" , tb->insert_size[0 ]);buffer_info_init_tbS0 (tb, &bi); -leaf_paste_in_buffer (&bi, item_pos, pos_in_item, - tb->insert_size[0 ], body, zeros_num); +leaf_paste_in_buffer (&bi, tb->item_pos, tb->pos_in_item, + tb->insert_size[0 ], body, tb->zeroes_num);if (is_indirect_le_ih (pasted)) {#if 0
fs/reiserfs/fix_node.c +5 -4
@@ -631,10 +631,11 @@ static void set_parameters(struct tree_b/* only for leaf level */ if (h ==0 ) {if (s012 !=NULL ) { - tb->s0num = *s012++, - tb->s1num = *s012++, tb->s2num = *s012++; - tb->s1bytes = *s012++; - tb->s2bytes = *s012; + tb->s0num = *s012++; + tb->snum[0 ] = *s012++; + tb->snum[1 ] = *s012++; + tb->sbytes[0 ] = *s012++; + tb->sbytes[1 ] = *s012; } tb->lbytes = lb; tb->rbytes = rb;
fs/reiserfs/prints.c +3 -3
@@ -673,9 +673,9 @@ void store_print_tb(struct tree_balance"* h * size * ln * lb * rn * rb * blkn * s0 * s1 * s1b * s2 * s2b * curb * lk * rk *\n" "* 0 * %4d * %2d * %2d * %2d * %2d * %4d * %2d * %2d * %3d * %2d * %3d * %4d * %2d * %2d *\n" , tb->insert_size[0 ], tb->lnum[0 ], tb->lbytes, tb->rnum[0 ], - tb->rbytes, tb->blknum[0 ], tb->s0num, tb->s1num, tb->s1bytes, - tb->s2num, tb->s2bytes, tb->cur_blknum, tb->lkey[0 ], - tb->rkey[0]); + tb->rbytes, tb->blknum[0 ], tb->s0num, tb->snum[0 ], + tb->sbytes[0 ], tb->snum[1 ], tb->sbytes[1 ], + tb->cur_blknum, tb->lkey[0], tb->rkey[0]);/* this prints balance parameters for non-leaf levels */ h =0 ;
fs/reiserfs/reiserfs.h +21 -9
@@ -2471,12 +2471,6 @@ struct tree_balance {/* number of items that fall into left most node when S[0] splits */ int s0num; -/* number of items that fall into first new node when S[0] splits */ -int s1num; - -/* number of items that fall into second new node when S[0] splits */ -int s2num; -/* * number of bytes which can flow to the left neighbor from the left * most liquid item that cannot be shifted from S[0] entirely
@@ -2491,12 +2485,30 @@ struct tree_balance {*/ int rbytes; +/* -* number of bytes which flow to the first new node when S[0] splits +* index into the array of item headers in +* S[0] of the affected item +*/ +int item_pos; + +/* new nodes allocated to hold what could not fit into S */ +struct buffer_head *S_new[2 ]; + +/* +* number of items that will be placed into nodes in S_new +* when S[0] splits +*/ +int snum[2 ]; + +/* +* number of bytes which flow to nodes in S_new when S[0] splits * note: if S[0] splits into 3 nodes, then items do not need to be cut */ -int s1bytes; -int s2bytes; +int sbytes[2 ]; + +int pos_in_item; +int zeroes_num;/* * buffers which are to be freed after do_balance finishes
PATCH 14/29 reiserfs: balance_leaf refactor, pull out balance_leaf_insert_left
In reply to Jeff MahoneyThis patch factors out a new balance_leaf_insert_left from the code in balance_leaf responsible for inserting new items into the node to the left of S[0] in the tree.
It is not yet formatted correctly.
--- fs/reiserfs/do_balan.c | 108 ++++++++++++++++++++++++++----------------------- 1 file changed, 59 insertions(+), 49 deletions(-)
fs/reiserfs/do_balan.c +59 -49
@@ -290,6 +290,64 @@ static int balance_leaf_when_delete(strureturn 0 ; } +static void balance_leaf_insert_left (struct tree_balance *tb, +struct item_head *ih,const char *body) +{ +int ret_val; +struct buffer_info bi; +int n =B_NR_ITEMS (tb->L[0 ]); + +if (tb->item_pos == tb->lnum[0 ] -1 && tb->lbytes !=-1 ) { +/* part of new item falls into L[0] */ +int new_item_len; +int version; + + ret_val =leaf_shift_left (tb, tb->lnum[0 ] -1 ,-1 ); + +/* Calculate item length to insert to S[0] */ + new_item_len =ih_item_len (ih) - tb->lbytes; +/* Calculate and check item length to insert to L[0] */ +put_ih_item_len (ih,ih_item_len (ih) - new_item_len); + +RFALSE (ih_item_len (ih) <=0 , +"PAP-12080: there is nothing to insert into L[0]: ih_item_len=%d" , +ih_item_len (ih)); + +/* Insert new item into L[0] */ +buffer_info_init_left (tb, &bi); +leaf_insert_into_buf (&bi, + n + tb->item_pos - ret_val, ih, body, + tb->zeroes_num >ih_item_len (ih) ?ih_item_len (ih) : tb->zeroes_num); + + version =ih_version (ih); + +/* Calculate key component, item length and body to insert into S[0] */ +set_le_ih_k_offset (ih,le_ih_k_offset (ih) + + (tb->lbytes << (is_indirect_le_ih (ih) ? tb->tb_sb->s_blocksize_bits -UNFM_P_SHIFT :0 ))); + +put_ih_item_len (ih, new_item_len); +if (tb->lbytes > tb->zeroes_num) { + body += (tb->lbytes - tb->zeroes_num); + tb->zeroes_num =0 ; + }else + tb->zeroes_num -= tb->lbytes; + +RFALSE (ih_item_len (ih) <=0 , +"PAP-12085: there is nothing to insert into S[0]: ih_item_len=%d" , +ih_item_len (ih)); + }else { +/* new item in whole falls into L[0] */ +/* Shift lnum[0]-1 items to L[0] */ + ret_val =leaf_shift_left (tb, tb->lnum[0 ] -1 , tb->lbytes); +/* Insert new item into L[0] */ +buffer_info_init_left (tb, &bi); +leaf_insert_into_buf (&bi, n + tb->item_pos - ret_val, ih, body, tb->zeroes_num); + tb->insert_size[0 ] =0 ; + tb->zeroes_num =0 ; + } + +} +/** * balance_leaf - reiserfs tree balancing algorithm * @tb: tree balance state
@@ -342,55 +400,7 @@ static int balance_leaf(struct tree_balaswitch (flag) {case M_INSERT :/* insert item into L[0] */ - -if (tb->item_pos == tb->lnum[0 ] -1 && tb->lbytes !=-1 ) { -/* part of new item falls into L[0] */ -int new_item_len; -int version; - - ret_val =leaf_shift_left (tb, tb->lnum[0 ] -1 ,-1 ); - -/* Calculate item length to insert to S[0] */ - new_item_len =ih_item_len (ih) - tb->lbytes; -/* Calculate and check item length to insert to L[0] */ -put_ih_item_len (ih,ih_item_len (ih) - new_item_len); - -RFALSE (ih_item_len (ih) <=0 , -"PAP-12080: there is nothing to insert into L[0]: ih_item_len=%d" , -ih_item_len (ih)); - -/* Insert new item into L[0] */ -buffer_info_init_left (tb, &bi); -leaf_insert_into_buf (&bi, - n + tb->item_pos - ret_val, ih, body, - tb->zeroes_num >ih_item_len (ih) ?ih_item_len (ih) : tb->zeroes_num); - - version =ih_version (ih); - -/* Calculate key component, item length and body to insert into S[0] */ -set_le_ih_k_offset (ih,le_ih_k_offset (ih) + - (tb-> lbytes << (is_indirect_le_ih (ih) ? tb->tb_sb-> s_blocksize_bits -UNFM_P_SHIFT :0 ))); - -put_ih_item_len (ih, new_item_len); -if (tb->lbytes > tb->zeroes_num) { - body += (tb->lbytes - tb->zeroes_num); - tb->zeroes_num =0 ; - }else - tb->zeroes_num -= tb->lbytes; - -RFALSE (ih_item_len (ih) <=0 , -"PAP-12085: there is nothing to insert into S[0]: ih_item_len=%d" , -ih_item_len (ih)); - }else { -/* new item in whole falls into L[0] */ -/* Shift lnum[0]-1 items to L[0] */ - ret_val =leaf_shift_left (tb, tb->lnum[0 ] -1 , tb->lbytes); -/* Insert new item into L[0] */ -buffer_info_init_left (tb, &bi); -leaf_insert_into_buf (&bi, n + tb->item_pos - ret_val, ih, body, tb->zeroes_num); - tb->insert_size[0 ] =0 ; - tb->zeroes_num =0 ; - } +balance_leaf_insert_left (tb, ih, body);break ;case M_PASTE :/* append item in L[0] */
PATCH 15/29 reiserfs: balance_leaf refactor, pull out balance_leaf_paste_left
In reply to Jeff MahoneyThis patch factors out a new balance_leaf_paste_left from the code in balance_leaf responsible for pasting new content into an existing item located in the node to the left of S[0] in the tree.
--- fs/reiserfs/do_balan.c | 117 ++++++++++++++++++++++++++----------------------- 1 file changed, 64 insertions(+), 53 deletions(-)
fs/reiserfs/do_balan.c +64 -53
@@ -348,62 +348,13 @@ static void balance_leaf_insert_left(str } -/** -* balance_leaf - reiserfs tree balancing algorithm -* @tb: tree balance state -* @ih: item header of inserted item (little endian) -* @body: body of inserted item or bytes to paste -* @flag: i - insert, d - delete, c - cut, p - paste (see do_balance) -* passed back: -* @insert_key: key to insert new nodes -* @insert_ptr: array of nodes to insert at the next level -* -* In our processing of one level we sometimes determine what must be -* inserted into the next higher level. This insertion consists of a -* key or two keys and their corresponding pointers. -*/ -static int balance_leaf (struct tree_balance *tb,struct item_head *ih, -const char *body,int flag, -struct item_head *insert_key, -struct buffer_head **insert_ptr) +static void balance_leaf_paste_left (struct tree_balance *tb, +struct item_head *ih,const char *body) {struct buffer_head *tbS0 =PATH_PLAST_BUFFER (tb->tb_path); -struct buffer_info bi; -int n, i;int ret_val; - -PROC_INFO_INC (tb->tb_sb, balance_at[0 ]); - -/* Make balance in case insert_size[0] < 0 */ -if (tb->insert_size[0 ] <0 ) -return balance_leaf_when_delete (tb, flag); - - tb->item_pos =PATH_LAST_POSITION (tb->tb_path), - tb->pos_in_item = tb->tb_path->pos_in_item, - tb->zeroes_num =0 ; -if (flag ==M_INSERT && !body) - tb->zeroes_num =ih_item_len (ih); - -/* -* for indirect item pos_in_item is measured in unformatted node -* pointers. Recalculate to bytes -*/ -if (flag !=M_INSERT - &&is_indirect_le_ih (item_head (tbS0, tb->item_pos))) - tb->pos_in_item *=UNFM_P_SIZE ; - -if (tb->lnum[0 ] >0 ) { -/* Shift lnum[0] items from S[0] to the left neighbor L[0] */ -if (tb->item_pos < tb->lnum[0 ]) { -/* new item or it part falls to L[0], shift it too */ - n =B_NR_ITEMS (tb->L[0 ]); - -switch (flag) { -case M_INSERT :/* insert item into L[0] */ -balance_leaf_insert_left (tb, ih, body); -break ; - -case M_PASTE :/* append item in L[0] */ +struct buffer_info bi; +int n =B_NR_ITEMS (tb->L[0 ]);if (tb->item_pos == tb->lnum[0 ] -1 && tb->lbytes !=-1 ) {/* we must shift the part of the appended item */
@@ -554,6 +505,66 @@ static int balance_leaf(struct tree_bala tb->insert_size[0 ] =0 ; tb->zeroes_num =0 ; } + +} + +/** +* balance_leaf - reiserfs tree balancing algorithm +* @tb: tree balance state +* @ih: item header of inserted item (little endian) +* @body: body of inserted item or bytes to paste +* @flag: i - insert, d - delete, c - cut, p - paste (see do_balance) +* passed back: +* @insert_key: key to insert new nodes +* @insert_ptr: array of nodes to insert at the next level +* +* In our processing of one level we sometimes determine what must be +* inserted into the next higher level. This insertion consists of a +* key or two keys and their corresponding pointers. +*/ +static int balance_leaf (struct tree_balance *tb,struct item_head *ih, +const char *body,int flag, +struct item_head *insert_key, +struct buffer_head **insert_ptr) +{ +struct buffer_head *tbS0 =PATH_PLAST_BUFFER (tb->tb_path); +struct buffer_info bi; +int n, i; +int ret_val; + +PROC_INFO_INC (tb->tb_sb, balance_at[0 ]); + +/* Make balance in case insert_size[0] < 0 */ +if (tb->insert_size[0 ] <0 ) +return balance_leaf_when_delete (tb, flag); + + tb->item_pos =PATH_LAST_POSITION (tb->tb_path), + tb->pos_in_item = tb->tb_path->pos_in_item, + tb->zeroes_num =0 ; +if (flag ==M_INSERT && !body) + tb->zeroes_num =ih_item_len (ih); + +/* +* for indirect item pos_in_item is measured in unformatted node +* pointers. Recalculate to bytes +*/ +if (flag !=M_INSERT + &&is_indirect_le_ih (item_head (tbS0, tb->item_pos))) + tb->pos_in_item *=UNFM_P_SIZE ; + +if (tb->lnum[0 ] >0 ) { +/* Shift lnum[0] items from S[0] to the left neighbor L[0] */ +if (tb->item_pos < tb->lnum[0 ]) { +/* new item or it part falls to L[0], shift it too */ + n =B_NR_ITEMS (tb->L[0 ]); + +switch (flag) { +case M_INSERT :/* insert item into L[0] */ +balance_leaf_insert_left (tb, ih, body); +break ; + +case M_PASTE :/* append item in L[0] */ +balance_leaf_paste_left (tb, ih, body);break ;default :/* cases d and t */ reiserfs_panic(tb->tb_sb, "PAP-12130",
PATCH 16/29 reiserfs: balance_leaf refactor, pull out balance_leaf_insert_right
In reply to Jeff MahoneyThis patch factors out a new balance_leaf_insert_right from the code in balance_leaf responsible for inserting new items into the node to the right of S[0] in the tree.
--- fs/reiserfs/do_balan.c | 138 ++++++++++++++++++++++++++----------------------- 1 file changed, 75 insertions(+), 63 deletions(-)
fs/reiserfs/do_balan.c +75 -63
@@ -508,6 +508,80 @@ static void balance_leaf_paste_left(stru } +static void balance_leaf_insert_right (struct tree_balance *tb, +struct item_head *ih,const char *body) +{ + +struct buffer_head *tbS0 =PATH_PLAST_BUFFER (tb->tb_path); +int n =B_NR_ITEMS (tbS0); +struct buffer_info bi; +int ret_val; +if (n - tb->rnum[0 ] < tb->item_pos) {/* new item or its part falls to R[0] */ +if (tb->item_pos == n - tb->rnum[0 ] +1 && tb->rbytes !=-1 ) {/* part of new item falls into R[0] */ +loff_t old_key_comp, old_len, r_zeroes_number; +const char *r_body; +int version; +loff_t offset; + +leaf_shift_right (tb, tb->rnum[0 ] -1 ,-1 ); + + version =ih_version (ih); +/* Remember key component and item length */ + old_key_comp =le_ih_k_offset (ih); + old_len =ih_item_len (ih); + +/* Calculate key component and item length to insert into R[0] */ + offset =le_ih_k_offset (ih) + ((old_len - tb->rbytes) << (is_indirect_le_ih (ih) ? tb->tb_sb->s_blocksize_bits -UNFM_P_SHIFT :0 )); +set_le_ih_k_offset (ih, offset); +put_ih_item_len (ih, tb->rbytes); +/* Insert part of the item into R[0] */ +buffer_info_init_right (tb, &bi); +if ((old_len - tb->rbytes) > tb->zeroes_num) { + r_zeroes_number =0 ; + r_body = body + (old_len - tb->rbytes) - tb->zeroes_num; + }else { + r_body = body; + r_zeroes_number = tb->zeroes_num - (old_len - tb->rbytes); + tb->zeroes_num -= r_zeroes_number; + } + +leaf_insert_into_buf (&bi,0 , ih, r_body, + r_zeroes_number); + +/* Replace right delimiting key by first key in R[0] */ +replace_key (tb, tb->CFR[0 ], tb->rkey[0 ], + tb->R[0 ],0 ); + +/* Calculate key component and item length to insert into S[0] */ +set_le_ih_k_offset (ih, old_key_comp); +put_ih_item_len (ih, old_len - tb->rbytes); + + tb->insert_size[0 ] -= tb->rbytes; + + }else {/* whole new item falls into R[0] */ + +/* Shift rnum[0]-1 items to R[0] */ + ret_val =leaf_shift_right (tb, tb->rnum[0 ] -1 , tb->rbytes); +/* Insert new item into R[0] */ +buffer_info_init_right (tb, &bi); +leaf_insert_into_buf (&bi, tb->item_pos - n + tb->rnum[0 ] -1 , + ih, body, tb->zeroes_num); + +if (tb->item_pos - n + tb->rnum[0 ] -1 ==0 ) { +replace_key (tb, tb->CFR[0 ], + tb->rkey[0 ], + tb->R[0 ],0 ); + + } + tb->zeroes_num = tb->insert_size[0 ] =0 ; + } + }else {/* new item or part of it doesn't fall into R[0] */ + +leaf_shift_right (tb, tb->rnum[0 ], tb->rbytes); + } + +} +/** * balance_leaf - reiserfs tree balancing algorithm * @tb: tree balance state
@@ -588,69 +662,7 @@ static int balance_leaf(struct tree_balaswitch (flag) {case M_INSERT :/* insert item */ -if (n - tb->rnum[0 ] < tb->item_pos) {/* new item or its part falls to R[0] */ -if (tb->item_pos == n - tb->rnum[0 ] +1 && tb->rbytes !=-1 ) {/* part of new item falls into R[0] */ -loff_t old_key_comp, old_len, r_zeroes_number; -const char *r_body; -int version; -loff_t offset; - -leaf_shift_right (tb, tb->rnum[0 ] -1 ,-1 ); - - version =ih_version (ih); -/* Remember key component and item length */ - old_key_comp =le_ih_k_offset (ih); - old_len =ih_item_len (ih); - -/* Calculate key component and item length to insert into R[0] */ - offset =le_ih_k_offset (ih) + ((old_len - tb->rbytes) << (is_indirect_le_ih (ih) ? tb->tb_sb->s_blocksize_bits -UNFM_P_SHIFT :0 )); -set_le_ih_k_offset (ih, offset); -put_ih_item_len (ih, tb->rbytes); -/* Insert part of the item into R[0] */ -buffer_info_init_right (tb, &bi); -if ((old_len - tb->rbytes) > tb->zeroes_num) { - r_zeroes_number =0 ; - r_body = body + (old_len - tb->rbytes) - tb->zeroes_num; - }else { - r_body = body; - r_zeroes_number = tb->zeroes_num - (old_len - tb->rbytes); - tb->zeroes_num -= r_zeroes_number; - } - -leaf_insert_into_buf (&bi,0 , ih, r_body, - r_zeroes_number); - -/* Replace right delimiting key by first key in R[0] */ -replace_key (tb, tb->CFR[0 ], tb->rkey[0 ], - tb->R[0 ],0 ); - -/* Calculate key component and item length to insert into S[0] */ -set_le_ih_k_offset (ih, old_key_comp); -put_ih_item_len (ih, old_len - tb->rbytes); - - tb->insert_size[0 ] -= tb->rbytes; - - }else {/* whole new item falls into R[0] */ - -/* Shift rnum[0]-1 items to R[0] */ - ret_val =leaf_shift_right (tb, tb->rnum[0 ] -1 , tb->rbytes); -/* Insert new item into R[0] */ -buffer_info_init_right (tb, &bi); -leaf_insert_into_buf (&bi, tb->item_pos - n + tb->rnum[0 ] -1 , - ih, body, tb->zeroes_num); - -if (tb->item_pos - n + tb->rnum[0 ] -1 ==0 ) { -replace_key (tb, tb->CFR[0 ], - tb->rkey[0 ], - tb->R[0 ],0 ); - - } - tb->zeroes_num = tb->insert_size[0 ] =0 ; - } - }else {/* new item or part of it doesn't fall into R[0] */ - -leaf_shift_right (tb, tb->rnum[0 ], tb->rbytes); - } +balance_leaf_insert_right (tb, ih, body);break ;case M_PASTE :/* append item */
PATCH 17/29 reiserfs: balance_leaf refactor, pull out balance_leaf_paste_right
In reply to Jeff MahoneyThis patch factors out a new balance_leaf_insert_right from the code in balance_leaf responsible for pasting new contents into an existing item located in the node to the right of S[0] in the tree.
It has not been reformatted yet.
--- fs/reiserfs/do_balan.c | 170 +++++++++++++++++++++++++------------------------ 1 file changed, 90 insertions(+), 80 deletions(-)
fs/reiserfs/do_balan.c +90 -80
@@ -582,91 +582,14 @@ static void balance_leaf_insert_right(st } -/** -* balance_leaf - reiserfs tree balancing algorithm -* @tb: tree balance state -* @ih: item header of inserted item (little endian) -* @body: body of inserted item or bytes to paste -* @flag: i - insert, d - delete, c - cut, p - paste (see do_balance) -* passed back: -* @insert_key: key to insert new nodes -* @insert_ptr: array of nodes to insert at the next level -* -* In our processing of one level we sometimes determine what must be -* inserted into the next higher level. This insertion consists of a -* key or two keys and their corresponding pointers. -*/ -static int balance_leaf (struct tree_balance *tb,struct item_head *ih, -const char *body,int flag, -struct item_head *insert_key, -struct buffer_head **insert_ptr) +static void balance_leaf_paste_right (struct tree_balance *tb, +struct item_head *ih,const char *body) {struct buffer_head *tbS0 =PATH_PLAST_BUFFER (tb->tb_path); +int n =B_NR_ITEMS (tbS0);struct buffer_info bi; -int n, i;int ret_val; -PROC_INFO_INC (tb->tb_sb, balance_at[0 ]); - -/* Make balance in case insert_size[0] < 0 */ -if (tb->insert_size[0 ] <0 ) -return balance_leaf_when_delete (tb, flag); - - tb->item_pos =PATH_LAST_POSITION (tb->tb_path), - tb->pos_in_item = tb->tb_path->pos_in_item, - tb->zeroes_num =0 ; -if (flag ==M_INSERT && !body) - tb->zeroes_num =ih_item_len (ih); - -/* -* for indirect item pos_in_item is measured in unformatted node -* pointers. Recalculate to bytes -*/ -if (flag !=M_INSERT - &&is_indirect_le_ih (item_head (tbS0, tb->item_pos))) - tb->pos_in_item *=UNFM_P_SIZE ; - -if (tb->lnum[0 ] >0 ) { -/* Shift lnum[0] items from S[0] to the left neighbor L[0] */ -if (tb->item_pos < tb->lnum[0 ]) { -/* new item or it part falls to L[0], shift it too */ - n =B_NR_ITEMS (tb->L[0 ]); - -switch (flag) { -case M_INSERT :/* insert item into L[0] */ -balance_leaf_insert_left (tb, ih, body); -break ; - -case M_PASTE :/* append item in L[0] */ -balance_leaf_paste_left (tb, ih, body); -break ; -default :/* cases d and t */ -reiserfs_panic (tb->tb_sb,"PAP-12130" , -"lnum > 0: unexpected mode: " -" %s(%d)" , - (flag ==M_DELETE ) ?"DELETE" : ((flag ==M_CUT ) ?"CUT" :"UNKNOWN" ), flag); - } - }else { -/* new item doesn't fall into L[0] */ -leaf_shift_left (tb, tb->lnum[0 ], tb->lbytes); - } - } - -/* tb->lnum[0] > 0 */ -/* Calculate new item position */ - tb->item_pos -= (tb->lnum[0 ] - ((tb->lbytes !=-1 ) ?1 :0 )); - -if (tb->rnum[0 ] >0 ) { -/* shift rnum[0] items from S[0] to the right neighbor R[0] */ - n =B_NR_ITEMS (tbS0); -switch (flag) { - -case M_INSERT :/* insert item */ -balance_leaf_insert_right (tb, ih, body); -break ; - -case M_PASTE :/* append item */ -if (n - tb->rnum[0 ] <= tb->item_pos) {/* pasted item or part of it falls to R[0] */ if (tb->item_pos == n - tb->rnum[0 ] && tb->rbytes !=-1 ) {/* we must shift the part of the appended item */ if (is_direntry_le_ih (item_head (tbS0, tb->item_pos))) {/* we append to directory item */
@@ -807,6 +730,93 @@ static int balance_leaf(struct tree_balaleaf_shift_right (tb, tb->rnum[0 ], tb->rbytes); } + +} + +/** +* balance_leaf - reiserfs tree balancing algorithm +* @tb: tree balance state +* @ih: item header of inserted item (little endian) +* @body: body of inserted item or bytes to paste +* @flag: i - insert, d - delete, c - cut, p - paste (see do_balance) +* passed back: +* @insert_key: key to insert new nodes +* @insert_ptr: array of nodes to insert at the next level +* +* In our processing of one level we sometimes determine what must be +* inserted into the next higher level. This insertion consists of a +* key or two keys and their corresponding pointers. +*/ +static int balance_leaf (struct tree_balance *tb,struct item_head *ih, +const char *body,int flag, +struct item_head *insert_key, +struct buffer_head **insert_ptr) +{ +struct buffer_head *tbS0 =PATH_PLAST_BUFFER (tb->tb_path); +struct buffer_info bi; +int n, i; + +PROC_INFO_INC (tb->tb_sb, balance_at[0 ]); + +/* Make balance in case insert_size[0] < 0 */ +if (tb->insert_size[0 ] <0 ) +return balance_leaf_when_delete (tb, flag); + + tb->item_pos =PATH_LAST_POSITION (tb->tb_path), + tb->pos_in_item = tb->tb_path->pos_in_item, + tb->zeroes_num =0 ; +if (flag ==M_INSERT && !body) + tb->zeroes_num =ih_item_len (ih); + +/* +* for indirect item pos_in_item is measured in unformatted node +* pointers. Recalculate to bytes +*/ +if (flag !=M_INSERT + &&is_indirect_le_ih (item_head (tbS0, tb->item_pos))) + tb->pos_in_item *=UNFM_P_SIZE ; + +if (tb->lnum[0 ] >0 ) { +/* Shift lnum[0] items from S[0] to the left neighbor L[0] */ +if (tb->item_pos < tb->lnum[0 ]) { +/* new item or it part falls to L[0], shift it too */ + n =B_NR_ITEMS (tb->L[0 ]); + +switch (flag) { +case M_INSERT :/* insert item into L[0] */ +balance_leaf_insert_left (tb, ih, body); +break ; + +case M_PASTE :/* append item in L[0] */ +balance_leaf_paste_left (tb, ih, body); +break ; +default :/* cases d and t */ +reiserfs_panic (tb->tb_sb,"PAP-12130" , +"lnum > 0: unexpected mode: " +" %s(%d)" , + (flag ==M_DELETE ) ?"DELETE" : ((flag ==M_CUT ) ?"CUT" :"UNKNOWN" ), flag); + } + }else { +/* new item doesn't fall into L[0] */ +leaf_shift_left (tb, tb->lnum[0 ], tb->lbytes); + } + } + +/* tb->lnum[0] > 0 */ +/* Calculate new item position */ + tb->item_pos -= (tb->lnum[0 ] - ((tb->lbytes !=-1 ) ?1 :0 )); + +if (tb->rnum[0 ] >0 ) { +/* shift rnum[0] items from S[0] to the right neighbor R[0] */ + n =B_NR_ITEMS (tbS0); +switch (flag) { + +case M_INSERT :/* insert item */ +balance_leaf_insert_right (tb, ih, body); +break ; + +case M_PASTE :/* append item */ +balance_leaf_paste_right (tb, ih, body);break ;default :/* cases d and t */ reiserfs_panic(tb->tb_sb, "PAP-12175",
PATCH 18/29 reiserfs: balance_leaf refactor, pull out balance_leaf_new_nodes_insert
In reply to Jeff MahoneyThis patch factors out a new balance_leaf_new_nodes_insert from the code in balance_leaf responsible for inserting new items into new nodes in the tree.
It has not been reformatted yet.
--- fs/reiserfs/do_balan.c | 133 ++++++++++++++++++++++++++----------------------- 1 file changed, 73 insertions(+), 60 deletions(-)
fs/reiserfs/do_balan.c +73 -60
@@ -733,6 +733,77 @@ static void balance_leaf_paste_right(str } +static void balance_leaf_new_nodes_insert (struct tree_balance *tb, +struct item_head *ih, +const char *body, +struct item_head *insert_key, +struct buffer_head **insert_ptr, +int i) +{ +struct buffer_head *tbS0 =PATH_PLAST_BUFFER (tb->tb_path); +int n =B_NR_ITEMS (tbS0); +struct buffer_info bi; +if (n - tb->snum[i] < tb->item_pos) {/* new item or it's part falls to first new node S_new[i] */ +if (tb->item_pos == n - tb->snum[i] +1 && tb->sbytes[i] !=-1 ) {/* part of new item falls into S_new[i] */ +int old_key_comp, old_len, r_zeroes_number; +const char *r_body; +int version; + +/* Move snum[i]-1 items from S[0] to S_new[i] */ +leaf_move_items (LEAF_FROM_S_TO_SNEW , tb, + tb->snum[i] -1 ,-1 , + tb->S_new[i]); +/* Remember key component and item length */ + version =ih_version (ih); + old_key_comp =le_ih_k_offset (ih); + old_len =ih_item_len (ih); + +/* Calculate key component and item length to insert into S_new[i] */ +set_le_ih_k_offset (ih,le_ih_k_offset (ih) + + ((old_len - tb->sbytes[i]) << (is_indirect_le_ih (ih) ? tb->tb_sb->s_blocksize_bits -UNFM_P_SHIFT :0 ))); + +put_ih_item_len (ih, tb->sbytes[i]); + +/* Insert part of the item into S_new[i] before 0-th item */ +buffer_info_init_bh (tb, &bi, tb->S_new[i]); + +if ((old_len - tb->sbytes[i]) > tb->zeroes_num) { + r_zeroes_number =0 ; + r_body = body + (old_len - tb->sbytes[i]) - tb->zeroes_num; + }else { + r_body = body; + r_zeroes_number = tb->zeroes_num - (old_len - tb->sbytes[i]); + tb->zeroes_num -= r_zeroes_number; + } + +leaf_insert_into_buf (&bi,0 , ih, r_body, r_zeroes_number); + +/* Calculate key component and item length to insert into S[i] */ +set_le_ih_k_offset (ih, old_key_comp); +put_ih_item_len (ih, old_len - tb->sbytes[i]); + tb->insert_size[0 ] -= tb->sbytes[i]; + }else {/* whole new item falls into S_new[i] */ + +/* Shift snum[0] - 1 items to S_new[i] (sbytes[i] of split item) */ +leaf_move_items (LEAF_FROM_S_TO_SNEW , tb, + tb->snum[i] -1 , tb->sbytes[i], tb->S_new[i]); + +/* Insert new item into S_new[i] */ +buffer_info_init_bh (tb, &bi, tb->S_new[i]); +leaf_insert_into_buf (&bi, tb->item_pos - n + tb->snum[i] -1 , + ih, body, tb->zeroes_num); + + tb->zeroes_num = tb->insert_size[0 ] =0 ; + } + } + +else {/* new item or it part don't falls into S_new[i] */ + +leaf_move_items (LEAF_FROM_S_TO_SNEW , tb, + tb->snum[i], tb->sbytes[i], tb->S_new[i]); + } +} +/** * balance_leaf - reiserfs tree balancing algorithm * @tb: tree balance state
@@ -877,66 +948,8 @@ static int balance_leaf(struct tree_balaswitch (flag) {case M_INSERT :/* insert item */ - -if (n - tb->snum[i] < tb->item_pos) {/* new item or it's part falls to first new node S_new[i] */ -if (tb->item_pos == n - tb->snum[i] +1 && tb->sbytes[i] !=-1 ) {/* part of new item falls into S_new[i] */ -int old_key_comp, old_len, r_zeroes_number; -const char *r_body; -int version; - -/* Move snum[i]-1 items from S[0] to S_new[i] */ -leaf_move_items (LEAF_FROM_S_TO_SNEW , tb, - tb->snum[i] -1 ,-1 , - tb->S_new[i]); -/* Remember key component and item length */ - version =ih_version (ih); - old_key_comp =le_ih_k_offset (ih); - old_len =ih_item_len (ih); - -/* Calculate key component and item length to insert into S_new[i] */ -set_le_ih_k_offset (ih,le_ih_k_offset (ih) + - ((old_len - tb->sbytes[i]) << (is_indirect_le_ih (ih) ? tb->tb_sb->s_blocksize_bits -UNFM_P_SHIFT :0 ))); - -put_ih_item_len (ih, tb->sbytes[i]); - -/* Insert part of the item into S_new[i] before 0-th item */ -buffer_info_init_bh (tb, &bi, tb->S_new[i]); - -if ((old_len - tb->sbytes[i]) > tb->zeroes_num) { - r_zeroes_number =0 ; - r_body = body + (old_len - tb->sbytes[i]) - tb->zeroes_num; - }else { - r_body = body; - r_zeroes_number = tb->zeroes_num - (old_len - tb->sbytes[i]); - tb->zeroes_num -= r_zeroes_number; - } - -leaf_insert_into_buf (&bi,0 , ih, r_body, r_zeroes_number); - -/* Calculate key component and item length to insert into S[i] */ -set_le_ih_k_offset (ih, old_key_comp); -put_ih_item_len (ih, old_len - tb->sbytes[i]); - tb->insert_size[0 ] -= tb->sbytes[i]; - }else {/* whole new item falls into S_new[i] */ - -/* Shift snum[0] - 1 items to S_new[i] (sbytes[i] of split item) */ -leaf_move_items (LEAF_FROM_S_TO_SNEW , tb, - tb->snum[i] -1 , tb->sbytes[i], tb->S_new[i]); - -/* Insert new item into S_new[i] */ -buffer_info_init_bh (tb, &bi, tb->S_new[i]); -leaf_insert_into_buf (&bi, tb->item_pos - n + tb->snum[i] -1 , - ih, body, tb->zeroes_num); - - tb->zeroes_num = tb->insert_size[0 ] =0 ; - } - } - -else {/* new item or it part don't falls into S_new[i] */ - -leaf_move_items (LEAF_FROM_S_TO_SNEW , tb, - tb->snum[i], tb->sbytes[i], tb->S_new[i]); - } +balance_leaf_new_nodes_insert (tb, ih, body, insert_key, + insert_ptr, i);break ;case M_PASTE :/* append item */
PATCH 19/29 reiserfs: balance_leaf refactor, pull out balance_leaf_new_nodes_paste
In reply to Jeff MahoneyThis patch factors out a new balance_leaf_new_nodes_insert from the code in balance_leaf responsible for pasting new content into existing items that may have been shifted into new nodes in the tree.
It has not been reformatted yet.
--- fs/reiserfs/do_balan.c | 306 +++++++++++++++++++++++++------------------------ 1 file changed, 160 insertions(+), 146 deletions(-)
fs/reiserfs/do_balan.c +160 -146
@@ -804,6 +804,164 @@ static void balance_leaf_new_nodes_inser } } +static void balance_leaf_new_nodes_paste (struct tree_balance *tb, +struct item_head *ih, +const char *body, +struct item_head *insert_key, +struct buffer_head **insert_ptr, +int i) +{ +struct buffer_head *tbS0 =PATH_PLAST_BUFFER (tb->tb_path); +int n =B_NR_ITEMS (tbS0); +struct buffer_info bi; +if (n - tb->snum[i] <= tb->item_pos) {/* pasted item or part if it falls to S_new[i] */ +if (tb->item_pos == n - tb->snum[i] && tb->sbytes[i] !=-1 ) {/* we must shift part of the appended item */ +struct item_head *aux_ih; + +RFALSE (ih,"PAP-12210: ih must be 0" ); + + aux_ih =item_head (tbS0, tb->item_pos); +if (is_direntry_le_ih (aux_ih)) { +/* we append to directory item */ + +int entry_count; + + entry_count =ih_entry_count (aux_ih); + +if (entry_count - tb->sbytes[i] < tb->pos_in_item && tb->pos_in_item <= entry_count) { +/* new directory entry falls into S_new[i] */ + +RFALSE (!tb->insert_size[0 ],"PAP-12215: insert_size is already 0" ); +RFALSE (tb->sbytes[i] -1 >= entry_count, +"PAP-12220: there are no so much entries (%d), only %d" , + tb->sbytes[i] -1 , entry_count); + +/* Shift snum[i]-1 items in whole. Shift sbytes[i] directory entries from directory item number snum[i] */ +leaf_move_items (LEAF_FROM_S_TO_SNEW , tb, tb->snum[i], tb->sbytes[i] -1 , tb->S_new[i]); +/* Paste given directory entry to directory item */ +buffer_info_init_bh (tb, &bi, tb->S_new[i]); +leaf_paste_in_buffer (&bi,0 , tb->pos_in_item - entry_count + tb->sbytes[i] -1 , + tb->insert_size[0 ], body, tb->zeroes_num); +/* paste new directory entry */ +leaf_paste_entries (&bi,0 , tb->pos_in_item - entry_count + tb->sbytes[i] -1 ,1 , + (struct reiserfs_de_head *) body, + body +DEH_SIZE , tb->insert_size[0 ]); + tb->insert_size[0 ] =0 ; + tb->pos_in_item++; + }else {/* new directory entry doesn't fall into S_new[i] */ +leaf_move_items (LEAF_FROM_S_TO_SNEW , tb, tb->snum[i], tb->sbytes[i], tb->S_new[i]); + } + }else {/* regular object */ + +int n_shift, n_rem, r_zeroes_number; +const char *r_body; + +RFALSE (tb->pos_in_item !=ih_item_len (item_head (tbS0, tb->item_pos)) || tb->insert_size[0 ] <=0 , +"PAP-12225: item too short or insert_size <= 0" ); + +/* Calculate number of bytes which must be shifted from appended item */ + n_shift = tb->sbytes[i] - tb->insert_size[0 ]; +if (n_shift <0 ) + n_shift =0 ; +leaf_move_items (LEAF_FROM_S_TO_SNEW , tb, tb->snum[i], n_shift, tb->S_new[i]); + +/* Calculate number of bytes which must remain in body after append to S_new[i] */ + n_rem = tb->insert_size[0 ] - tb->sbytes[i]; +if (n_rem <0 ) + n_rem =0 ; +/* Append part of body into S_new[0] */ +buffer_info_init_bh (tb, &bi, tb->S_new[i]); +if (n_rem > tb->zeroes_num) { + r_zeroes_number =0 ; + r_body = body + n_rem - tb->zeroes_num; + }else { + r_body = body; + r_zeroes_number = tb->zeroes_num - n_rem; + tb->zeroes_num -= r_zeroes_number; + } + +leaf_paste_in_buffer (&bi,0 , n_shift, + tb->insert_size[0 ] - n_rem, + r_body, r_zeroes_number); + { +struct item_head *tmp; + + tmp =item_head (tb->S_new[i],0 ); +if (is_indirect_le_ih + (tmp)) { +set_ih_free_space (tmp,0 ); +set_le_ih_k_offset (tmp,le_ih_k_offset (tmp) + (n_rem << (tb->tb_sb->s_blocksize_bits -UNFM_P_SHIFT ))); + }else { +set_le_ih_k_offset (tmp,le_ih_k_offset (tmp) + n_rem); + } + } + + tb->insert_size[0 ] = n_rem; +if (!n_rem) + tb->pos_in_item++; + } + }else +/* item falls wholly into S_new[i] */ + { +int leaf_mi; +struct item_head *pasted; + +#ifdef CONFIG_REISERFS_CHECK +struct item_head *ih_check =item_head (tbS0, tb->item_pos); + +if (!is_direntry_le_ih (ih_check) + && (tb->pos_in_item !=ih_item_len (ih_check) + || tb->insert_size[0 ] <=0 )) +reiserfs_panic (tb->tb_sb, +"PAP-12235" , +"pos_in_item " +"must be equal " +"to ih_item_len" ); +#endif /* CONFIG_REISERFS_CHECK */ + + leaf_mi =leaf_move_items (LEAF_FROM_S_TO_SNEW , + tb, tb->snum[i], + tb->sbytes[i], + tb->S_new[i]); + +RFALSE (leaf_mi, +"PAP-12240: unexpected value returned by leaf_move_items (%d)" , + leaf_mi); + +/* paste into item */ +buffer_info_init_bh (tb, &bi, tb->S_new[i]); +leaf_paste_in_buffer (&bi, + tb->item_pos - n + tb->snum[i], + tb->pos_in_item, + tb->insert_size[0 ], + body, tb->zeroes_num); + + pasted =item_head (tb->S_new[i], tb->item_pos - n + tb->snum[i]); +if (is_direntry_le_ih (pasted)) { +leaf_paste_entries (&bi, + tb->item_pos - n + tb->snum[i], + tb->pos_in_item,1 , + (struct reiserfs_de_head *)body, + body +DEH_SIZE , + tb->insert_size[0 ] + ); + } + +/* if we paste to indirect item update ih_free_space */ +if (is_indirect_le_ih (pasted)) +set_ih_free_space (pasted,0 ); + tb->zeroes_num = tb->insert_size[0 ] =0 ; + } + } + +else {/* pasted item doesn't fall into S_new[i] */ + +leaf_move_items (LEAF_FROM_S_TO_SNEW , tb, + tb->snum[i], tb->sbytes[i], tb->S_new[i]); + } + +} +/** * balance_leaf - reiserfs tree balancing algorithm * @tb: tree balance state
@@ -953,152 +1111,8 @@ static int balance_leaf(struct tree_balabreak ;case M_PASTE :/* append item */ - -if (n - tb->snum[i] <= tb->item_pos) {/* pasted item or part if it falls to S_new[i] */ -if (tb->item_pos == n - tb->snum[i] && tb->sbytes[i] !=-1 ) {/* we must shift part of the appended item */ -struct item_head *aux_ih; - -RFALSE (ih,"PAP-12210: ih must be 0" ); - - aux_ih =item_head (tbS0, tb->item_pos); -if (is_direntry_le_ih (aux_ih)) { -/* we append to directory item */ - -int entry_count; - - entry_count =ih_entry_count (aux_ih); - -if (entry_count - tb->sbytes[i] < tb->pos_in_item && tb->pos_in_item <= entry_count) { -/* new directory entry falls into S_new[i] */ - -RFALSE (!tb->insert_size[0 ],"PAP-12215: insert_size is already 0" ); -RFALSE (tb->sbytes[i] -1 >= entry_count, -"PAP-12220: there are no so much entries (%d), only %d" , - tb->sbytes[i] -1 , entry_count); - -/* Shift snum[i]-1 items in whole. Shift sbytes[i] directory entries from directory item number snum[i] */ -leaf_move_items (LEAF_FROM_S_TO_SNEW , tb, tb->snum[i], tb->sbytes[i] -1 , tb->S_new[i]); -/* Paste given directory entry to directory item */ -buffer_info_init_bh (tb, &bi, tb->S_new[i]); -leaf_paste_in_buffer (&bi,0 , tb->pos_in_item - entry_count + tb->sbytes[i] -1 , - tb->insert_size[0 ], body, tb->zeroes_num); -/* paste new directory entry */ -leaf_paste_entries (&bi,0 , tb->pos_in_item - entry_count + tb->sbytes[i] -1 ,1 , - (struct reiserfs_de_head *) body, - body +DEH_SIZE , tb->insert_size[0 ]); - tb->insert_size[0 ] =0 ; - tb->pos_in_item++; - }else {/* new directory entry doesn't fall into S_new[i] */ -leaf_move_items (LEAF_FROM_S_TO_SNEW , tb, tb->snum[i], tb->sbytes[i], tb->S_new[i]); - } - }else {/* regular object */ - -int n_shift, n_rem, r_zeroes_number; -const char *r_body; - -RFALSE (tb->pos_in_item !=ih_item_len (item_head (tbS0, tb->item_pos)) || tb->insert_size[0 ] <=0 , -"PAP-12225: item too short or insert_size <= 0" ); - -/* Calculate number of bytes which must be shifted from appended item */ - n_shift = tb->sbytes[i] - tb->insert_size[0 ]; -if (n_shift <0 ) - n_shift =0 ; -leaf_move_items (LEAF_FROM_S_TO_SNEW , tb, tb->snum[i], n_shift, tb->S_new[i]); - -/* Calculate number of bytes which must remain in body after append to S_new[i] */ - n_rem = tb->insert_size[0 ] - tb->sbytes[i]; -if (n_rem <0 ) - n_rem =0 ; -/* Append part of body into S_new[0] */ -buffer_info_init_bh (tb, &bi, tb->S_new[i]); -if (n_rem > tb->zeroes_num) { - r_zeroes_number =0 ; - r_body = body + n_rem - tb->zeroes_num; - }else { - r_body = body; - r_zeroes_number = tb->zeroes_num - n_rem; - tb->zeroes_num -= r_zeroes_number; - } - -leaf_paste_in_buffer (&bi,0 , n_shift, - tb->insert_size[0 ] - n_rem, - r_body, r_zeroes_number); - { -struct item_head *tmp; - - tmp =item_head (tb->S_new[i],0 ); -if (is_indirect_le_ih - (tmp)) { -set_ih_free_space (tmp,0 ); -set_le_ih_k_offset (tmp,le_ih_k_offset (tmp) + (n_rem << (tb->tb_sb->s_blocksize_bits -UNFM_P_SHIFT ))); - }else { -set_le_ih_k_offset (tmp,le_ih_k_offset (tmp) + n_rem); - } - } - - tb->insert_size[0 ] = n_rem; -if (!n_rem) - tb->pos_in_item++; - } - }else -/* item falls wholly into S_new[i] */ - { -int leaf_mi; -struct item_head *pasted; - -#ifdef CONFIG_REISERFS_CHECK -struct item_head *ih_check =item_head (tbS0, tb->item_pos); - -if (!is_direntry_le_ih (ih_check) - && (tb->pos_in_item !=ih_item_len (ih_check) - || tb->insert_size[0 ] <=0 )) -reiserfs_panic (tb->tb_sb, -"PAP-12235" , -"pos_in_item " -"must be equal " -"to ih_item_len" ); -#endif /* CONFIG_REISERFS_CHECK */ - - leaf_mi =leaf_move_items (LEAF_FROM_S_TO_SNEW , - tb, tb->snum[i], - tb->sbytes[i], - tb->S_new[i]); - -RFALSE (leaf_mi, -"PAP-12240: unexpected value returned by leaf_move_items (%d)" , - leaf_mi); - -/* paste into item */ -buffer_info_init_bh (tb, &bi, tb->S_new[i]); -leaf_paste_in_buffer (&bi, - tb->item_pos - n + tb->snum[i], - tb->pos_in_item, - tb->insert_size[0 ], - body, tb->zeroes_num); - - pasted =item_head (tb->S_new[i], tb->item_pos - n + tb->snum[i]); -if (is_direntry_le_ih (pasted)) { -leaf_paste_entries (&bi, - tb->item_pos - n + tb->snum[i], - tb->pos_in_item,1 , - (struct reiserfs_de_head *)body, - body +DEH_SIZE , - tb->insert_size[0 ] - ); - } - -/* if we paste to indirect item update ih_free_space */ -if (is_indirect_le_ih (pasted)) -set_ih_free_space (pasted,0 ); - tb->zeroes_num = tb->insert_size[0 ] =0 ; - } - } - -else {/* pasted item doesn't fall into S_new[i] */ - -leaf_move_items (LEAF_FROM_S_TO_SNEW , tb, - tb->snum[i], tb->sbytes[i], tb->S_new[i]); - } +balance_leaf_new_nodes_paste (tb, ih, body, insert_key, + insert_ptr, i);break ;default :/* cases d and t */ reiserfs_panic(tb->tb_sb, "PAP-12245",
PATCH 20/29 reiserfs: balance_leaf refactor pull out balance_leaf_finish_node_insert
In reply to Jeff MahoneyThis patch factors out a new balance_leaf_finish_node_insert from the code in balance_leaf responsible for inserting new items into S[0]
It has not been reformatted yet.
--- fs/reiserfs/do_balan.c | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-)
fs/reiserfs/do_balan.c +21 -9
@@ -962,6 +962,26 @@ static void balance_leaf_new_nodes_paste } +static void balance_leaf_finish_node_insert (struct tree_balance *tb, +struct item_head *ih, +const char *body) +{ +struct buffer_head *tbS0 =PATH_PLAST_BUFFER (tb->tb_path); +struct buffer_info bi; +buffer_info_init_tbS0 (tb, &bi); +leaf_insert_into_buf (&bi, tb->item_pos, ih, + body, tb->zeroes_num); + +/* +* If we insert the first key +* change the delimiting key +*/ +if (tb->item_pos ==0 ) { +if (tb->CFL[0 ])/* can be 0 in reiserfsck */ +replace_key (tb, tb->CFL[0 ], tb->lkey[0 ], tbS0,0 ); + } +} +/** * balance_leaf - reiserfs tree balancing algorithm * @tb: tree balance state
@@ -1136,15 +1156,7 @@ static int balance_leaf(struct tree_balaswitch (flag) {case M_INSERT :/* insert item into S[0] */ -buffer_info_init_tbS0 (tb, &bi); -leaf_insert_into_buf (&bi, tb->item_pos, ih, - body, tb->zeroes_num); - -/* If we insert the first key change the delimiting key */ -if (tb->item_pos ==0 ) { -if (tb->CFL[0 ])/* can be 0 in reiserfsck */ -replace_key (tb, tb->CFL[0 ], tb->lkey[0 ], tbS0,0 ); - } +balance_leaf_finish_node_insert (tb, ih, body);break ;case M_PASTE :{/* append item in S[0] */
PATCH 21/29 reiserfs: balance_leaf refactor, pull out balance_leaf_finish_node_paste
In reply to Jeff MahoneyThis patch factors out a new balance_leaf_finish_node_paste from the code in balance_leaf responsible for pasting new content into existing items held in S[0].
--- fs/reiserfs/do_balan.c | 150 +++++++++++++++++++++++++------------------------ 1 file changed, 79 insertions(+), 71 deletions(-)
fs/reiserfs/do_balan.c +79 -71
@@ -982,6 +982,82 @@ static void balance_leaf_finish_node_ins } } +static void balance_leaf_finish_node_paste (struct tree_balance *tb, +struct item_head *ih, +const char *body) +{ +struct buffer_head *tbS0 =PATH_PLAST_BUFFER (tb->tb_path); +struct buffer_info bi; +struct item_head *pasted; + + pasted =item_head (tbS0, tb->item_pos); +/* when directory, may be new entry already pasted */ +if (is_direntry_le_ih (pasted)) { +if (tb->pos_in_item >=0 && tb->pos_in_item <=ih_entry_count (pasted)) { + +RFALSE (!tb->insert_size[0 ], +"PAP-12260: insert_size is 0 already" ); + +/* prepare space */ +buffer_info_init_tbS0 (tb, &bi); +leaf_paste_in_buffer (&bi, tb->item_pos, tb->pos_in_item, + tb->insert_size[0 ], body, + tb->zeroes_num); + +/* paste entry */ +leaf_paste_entries (&bi, tb->item_pos, tb->pos_in_item,1 , + (struct reiserfs_de_head *)body, + body +DEH_SIZE , + tb->insert_size[0 ]); +if (!tb->item_pos && !tb->pos_in_item) { +RFALSE (!tb->CFL[0 ] || !tb->L[0 ], +"PAP-12270: CFL[0]/L[0] must be specified" ); +if (tb->CFL[0 ]) +replace_key (tb, tb->CFL[0 ], tb->lkey[0 ], tbS0,0 ); + } + tb->insert_size[0 ] =0 ; + } + }else {/* regular object */ +if (tb->pos_in_item ==ih_item_len (pasted)) { + +RFALSE (tb->insert_size[0 ] <=0 , +"PAP-12275: insert size must not be %d" , + tb->insert_size[0 ]); +buffer_info_init_tbS0 (tb, &bi); +leaf_paste_in_buffer (&bi, tb->item_pos, tb->pos_in_item, + tb->insert_size[0 ], body, tb->zeroes_num); + +if (is_indirect_le_ih (pasted)) { +#if 0 +RFALSE (tb-> + insert_size[0 ] != +UNFM_P_SIZE , +"PAP-12280: insert_size for indirect item must be %d, not %d" , +UNFM_P_SIZE , + tb-> + insert_size[0 ]); +#endif +set_ih_free_space (pasted,0 ); + } + tb->insert_size[0 ] =0 ; + } +#ifdef CONFIG_REISERFS_CHECK + else { +if (tb->insert_size[0 ]) { +print_cur_tb ("12285" ); +reiserfs_panic (tb->tb_sb, +"PAP-12285" , +"insert_size " +"must be 0 " +"(%d)" , + tb->insert_size[0 ]); + } + } +#endif /* CONFIG_REISERFS_CHECK */ + + } +} +/** * balance_leaf - reiserfs tree balancing algorithm * @tb: tree balance state
@@ -1002,7 +1078,6 @@ static int balance_leaf(struct tree_bala struct buffer_head **insert_ptr) {struct buffer_head *tbS0 =PATH_PLAST_BUFFER (tb->tb_path); -struct buffer_info bi;int n, i;PROC_INFO_INC (tb->tb_sb, balance_at[0 ]);
@@ -1159,76 +1234,9 @@ static int balance_leaf(struct tree_balabalance_leaf_finish_node_insert (tb, ih, body);break ; -case M_PASTE :{/* append item in S[0] */ -struct item_head *pasted; - - pasted =item_head (tbS0, tb->item_pos); -/* when directory, may be new entry already pasted */ -if (is_direntry_le_ih (pasted)) { -if (tb->pos_in_item >=0 && tb->pos_in_item <=ih_entry_count (pasted)) { - -RFALSE (!tb->insert_size[0 ], -"PAP-12260: insert_size is 0 already" ); - -/* prepare space */ -buffer_info_init_tbS0 (tb, &bi); -leaf_paste_in_buffer (&bi, tb->item_pos, tb->pos_in_item, - tb->insert_size[0 ], body, - tb->zeroes_num); - -/* paste entry */ -leaf_paste_entries (&bi, tb->item_pos, tb->pos_in_item,1 , - (struct reiserfs_de_head *)body, - body +DEH_SIZE , - tb->insert_size[0 ]); -if (!tb->item_pos && !tb->pos_in_item) { -RFALSE (!tb->CFL[0 ] || !tb->L[0 ], -"PAP-12270: CFL[0]/L[0] must be specified" ); -if (tb->CFL[0 ]) -replace_key (tb, tb->CFL[0 ], tb->lkey[0 ], tbS0,0 ); - } - tb->insert_size[0 ] =0 ; - } - }else {/* regular object */ -if (tb->pos_in_item ==ih_item_len (pasted)) { - -RFALSE (tb->insert_size[0 ] <=0 , -"PAP-12275: insert size must not be %d" , - tb->insert_size[0 ]); -buffer_info_init_tbS0 (tb, &bi); -leaf_paste_in_buffer (&bi, tb->item_pos, tb->pos_in_item, - tb->insert_size[0 ], body, tb->zeroes_num); - -if (is_indirect_le_ih (pasted)) { -#if 0 -RFALSE (tb-> - insert_size[0 ] != -UNFM_P_SIZE , -"PAP-12280: insert_size for indirect item must be %d, not %d" , -UNFM_P_SIZE , - tb-> - insert_size[0 ]); -#endif -set_ih_free_space (pasted,0 ); - } - tb->insert_size[0 ] =0 ; - } -#ifdef CONFIG_REISERFS_CHECK - else { -if (tb->insert_size[0 ]) { -print_cur_tb ("12285" ); -reiserfs_panic (tb->tb_sb, -"PAP-12285" , -"insert_size " -"must be 0 " -"(%d)" , - tb->insert_size[0 ]); - } - } -#endif /* CONFIG_REISERFS_CHECK */ - - } - }/* case M_PASTE: */ +case M_PASTE :/* append item in S[0] */ +balance_leaf_finish_node_paste (tb, ih, body); +break ; } }#ifdef CONFIG_REISERFS_CHECK
PATCH 22/29 reiserfs: balance_leaf refactor, pull out balance_leaf{left, right, new_nodes, finish_node}
In reply to Jeff MahoneyBreak out the code that splits paste/insert for each phase.
--- fs/reiserfs/do_balan.c | 207 +++++++++++++++++++++++++------------------------ 1 file changed, 108 insertions(+), 99 deletions(-)
fs/reiserfs/do_balan.c +108 -99
@@ -508,6 +508,27 @@ static void balance_leaf_paste_left(stru } +/* Shift lnum[0] items from S[0] to the left neighbor L[0] */ +static void balance_leaf_left (struct tree_balance *tb,struct item_head *ih, +const char *body,int flag) +{ +if (tb->lnum[0 ] <=0 ) +return ; + +/* new item or it part falls to L[0], shift it too */ +if (tb->item_pos < tb->lnum[0 ]) { +BUG_ON (flag !=M_INSERT && flag !=M_PASTE ); + +if (flag ==M_INSERT ) +balance_leaf_insert_left (tb, ih, body); +else /* M_PASTE */ +balance_leaf_paste_left (tb, ih, body); + }else +/* new item doesn't fall into L[0] */ +leaf_shift_left (tb, tb->lnum[0 ], tb->lbytes); +} + +static void balance_leaf_insert_right (struct tree_balance *tb,struct item_head *ih,const char *body) {
@@ -733,6 +754,22 @@ static void balance_leaf_paste_right(str } +/* shift rnum[0] items from S[0] to the right neighbor R[0] */ +static void balance_leaf_right (struct tree_balance *tb,struct item_head *ih, +const char *body,int flag) +{ +if (tb->rnum[0 ] <=0 ) +return ; + +BUG_ON (flag !=M_INSERT && flag !=M_PASTE ); + +if (flag ==M_INSERT ) +balance_leaf_insert_right (tb, ih, body); +else /* M_PASTE */ +balance_leaf_paste_right (tb, ih, body); + +} + static void balance_leaf_new_nodes_insert(struct tree_balance *tb, struct item_head *ih, const char *body,
@@ -962,6 +999,55 @@ static void balance_leaf_new_nodes_paste } +/* Fill new nodes that appear in place of S[0] */ +static void balance_leaf_new_nodes (struct tree_balance *tb, +struct item_head *ih, +const char *body, +struct item_head *insert_key, +struct buffer_head **insert_ptr, +int flag) +{ +int i; +for (i = tb->blknum[0 ] -2 ; i >=0 ; i--) { + +RFALSE (!tb->snum[i], +"PAP-12200: snum[%d] == %d. Must be > 0" , i, + tb->snum[i]); + +/* here we shift from S to S_new nodes */ + + tb->S_new[i] =get_FEB (tb); + +/* initialized block type and tree level */ +set_blkh_level (B_BLK_HEAD (tb->S_new[i]),DISK_LEAF_NODE_LEVEL ); + +switch (flag) { +case M_INSERT :/* insert item */ +balance_leaf_new_nodes_insert (tb, ih, body, insert_key, + insert_ptr, i); +break ; + +case M_PASTE :/* append item */ +balance_leaf_new_nodes_paste (tb, ih, body, insert_key, + insert_ptr, i); +break ; +default :/* cases d and t */ +reiserfs_panic (tb->tb_sb,"PAP-12245" , +"blknum > 2: unexpected mode: %s(%d)" , + (flag ==M_DELETE ) ?"DELETE" : ((flag ==M_CUT ) ?"CUT" :"UNKNOWN" ), flag); + } + +memcpy (insert_key + i,leaf_key (tb->S_new[i],0 ),KEY_SIZE ); + insert_ptr[i] = tb->S_new[i]; + +RFALSE (!buffer_journaled (tb->S_new[i]) + ||buffer_journal_dirty (tb->S_new[i]) + ||buffer_dirty (tb->S_new[i]), +"PAP-12247: S_new[%d] : (%b)" , + i,format_bh (tb->S_new[i])); + } +} +static void balance_leaf_finish_node_insert (struct tree_balance *tb,struct item_head *ih,const char *body)
@@ -1058,6 +1144,24 @@ static void balance_leaf_finish_node_pas } } +/* +* if the affected item was not wholly shifted then we +* perform all necessary operations on that part or whole +* of the affected item which remains in S +*/ +static void balance_leaf_finish_node (struct tree_balance *tb, +struct item_head *ih, +const char *body,int flag) +{ +/* if we must insert or append into buffer S[0] */ +if (0 <= tb->item_pos && tb->item_pos < tb->s0num) { +if (flag ==M_INSERT ) +balance_leaf_finish_node_insert (tb, ih, body); +else /* M_PASTE */ +balance_leaf_finish_node_paste (tb, ih, body); + } +} +/** * balance_leaf - reiserfs tree balancing algorithm * @tb: tree balance state
@@ -1078,7 +1182,6 @@ static int balance_leaf(struct tree_bala struct buffer_head **insert_ptr) {struct buffer_head *tbS0 =PATH_PLAST_BUFFER (tb->tb_path); -int n, i;PROC_INFO_INC (tb->tb_sb, balance_at[0 ]);
@@ -1100,55 +1203,13 @@ static int balance_leaf(struct tree_bala && is_indirect_le_ih(item_head(tbS0, tb->item_pos))) tb->pos_in_item *= UNFM_P_SIZE; -if (tb->lnum[0 ] >0 ) { -/* Shift lnum[0] items from S[0] to the left neighbor L[0] */ -if (tb->item_pos < tb->lnum[0 ]) { -/* new item or it part falls to L[0], shift it too */ - n =B_NR_ITEMS (tb->L[0 ]); - -switch (flag) { -case M_INSERT :/* insert item into L[0] */ -balance_leaf_insert_left (tb, ih, body); -break ; - -case M_PASTE :/* append item in L[0] */ -balance_leaf_paste_left (tb, ih, body); -break ; -default :/* cases d and t */ -reiserfs_panic (tb->tb_sb,"PAP-12130" , -"lnum > 0: unexpected mode: " -" %s(%d)" , - (flag ==M_DELETE ) ?"DELETE" : ((flag ==M_CUT ) ?"CUT" :"UNKNOWN" ), flag); - } - }else { -/* new item doesn't fall into L[0] */ -leaf_shift_left (tb, tb->lnum[0 ], tb->lbytes); - } - } +balance_leaf_left (tb, ih, body, flag);/* tb->lnum[0] > 0 */ /* Calculate new item position */ tb->item_pos -= (tb->lnum[0 ] - ((tb->lbytes !=-1 ) ?1 :0 )); -if (tb->rnum[0 ] >0 ) { -/* shift rnum[0] items from S[0] to the right neighbor R[0] */ - n =B_NR_ITEMS (tbS0); -switch (flag) { - -case M_INSERT :/* insert item */ -balance_leaf_insert_right (tb, ih, body); -break ; - -case M_PASTE :/* append item */ -balance_leaf_paste_right (tb, ih, body); -break ; -default :/* cases d and t */ -reiserfs_panic (tb->tb_sb,"PAP-12175" , -"rnum > 0: unexpected mode: %s(%d)" , - (flag ==M_DELETE ) ?"DELETE" : ((flag ==M_CUT ) ?"CUT" :"UNKNOWN" ), flag); - } - - } +balance_leaf_right (tb, ih, body, flag);/* tb->rnum[0] > 0 */ RFALSE(tb->blknum[0] > 3,
@@ -1183,62 +1244,10 @@ static int balance_leaf(struct tree_balareturn 0 ; } -/* Fill new nodes that appear in place of S[0] */ -for (i = tb->blknum[0 ] -2 ; i >=0 ; i--) { - -RFALSE (!tb->snum[i], -"PAP-12200: snum[%d] == %d. Must be > 0" , i, - tb->snum[i]); - -/* here we shift from S to S_new nodes */ +balance_leaf_new_nodes (tb, ih, body, insert_key, insert_ptr, flag); - tb->S_new[i] =get_FEB (tb); +balance_leaf_finish_node (tb, ih, body, flag); -/* initialized block type and tree level */ -set_blkh_level (B_BLK_HEAD (tb->S_new[i]),DISK_LEAF_NODE_LEVEL ); - - n =B_NR_ITEMS (tbS0); - -switch (flag) { -case M_INSERT :/* insert item */ -balance_leaf_new_nodes_insert (tb, ih, body, insert_key, - insert_ptr, i); -break ; - -case M_PASTE :/* append item */ -balance_leaf_new_nodes_paste (tb, ih, body, insert_key, - insert_ptr, i); -break ; -default :/* cases d and t */ -reiserfs_panic (tb->tb_sb,"PAP-12245" , -"blknum > 2: unexpected mode: %s(%d)" , - (flag ==M_DELETE ) ?"DELETE" : ((flag ==M_CUT ) ?"CUT" :"UNKNOWN" ), flag); - } - -memcpy (insert_key + i,leaf_key (tb->S_new[i],0 ),KEY_SIZE ); - insert_ptr[i] = tb->S_new[i]; - -RFALSE (!buffer_journaled (tb->S_new[i]) - ||buffer_journal_dirty (tb->S_new[i]) - ||buffer_dirty (tb->S_new[i]), -"PAP-12247: S_new[%d] : (%b)" , - i, tb->S_new[i]); - } - -/* if the affected item was not wholly shifted then we perform all necessary operations on that part or whole of the -affected item which remains in S */ -if (0 <= tb->item_pos && tb->item_pos < tb->s0num) {/* if we must insert or append into buffer S[0] */ - -switch (flag) { -case M_INSERT :/* insert item into S[0] */ -balance_leaf_finish_node_insert (tb, ih, body); -break ; - -case M_PASTE :/* append item in S[0] */ -balance_leaf_finish_node_paste (tb, ih, body); -break ; - } - }#ifdef CONFIG_REISERFS_CHECK if (flag ==M_PASTE && tb->insert_size[0 ]) {print_cur_tb ("12290" );
PATCH 23/29 reiserfs: balance_leaf refactor, format balance_leaf_insert_left
In reply to Jeff MahoneyReformat balance_leaf_insert_left to adhere to CodingStyle.
--- fs/reiserfs/do_balan.c | 107 ++++++++++++++++++++++++++----------------------- 1 file changed, 57 insertions(+), 50 deletions(-)
fs/reiserfs/do_balan.c +57 -50
@@ -293,59 +293,66 @@ static int balance_leaf_when_delete(strustatic void balance_leaf_insert_left (struct tree_balance *tb,struct item_head *ih,const char *body) { -int ret_val; +int ret;struct buffer_info bi;int n =B_NR_ITEMS (tb->L[0 ]); -if (tb->item_pos == tb->lnum[0 ] -1 && tb->lbytes !=-1 ) { -/* part of new item falls into L[0] */ -int new_item_len; -int version; - - ret_val =leaf_shift_left (tb, tb->lnum[0 ] -1 ,-1 ); - -/* Calculate item length to insert to S[0] */ - new_item_len =ih_item_len (ih) - tb->lbytes; -/* Calculate and check item length to insert to L[0] */ -put_ih_item_len (ih,ih_item_len (ih) - new_item_len); - -RFALSE (ih_item_len (ih) <=0 , -"PAP-12080: there is nothing to insert into L[0]: ih_item_len=%d" , -ih_item_len (ih)); - -/* Insert new item into L[0] */ -buffer_info_init_left (tb, &bi); -leaf_insert_into_buf (&bi, - n + tb->item_pos - ret_val, ih, body, - tb->zeroes_num >ih_item_len (ih) ?ih_item_len (ih) : tb->zeroes_num); - - version =ih_version (ih); - -/* Calculate key component, item length and body to insert into S[0] */ -set_le_ih_k_offset (ih,le_ih_k_offset (ih) + - (tb->lbytes << (is_indirect_le_ih (ih) ? tb->tb_sb->s_blocksize_bits -UNFM_P_SHIFT :0 ))); - -put_ih_item_len (ih, new_item_len); -if (tb->lbytes > tb->zeroes_num) { - body += (tb->lbytes - tb->zeroes_num); - tb->zeroes_num =0 ; - }else - tb->zeroes_num -= tb->lbytes; - -RFALSE (ih_item_len (ih) <=0 , -"PAP-12085: there is nothing to insert into S[0]: ih_item_len=%d" , -ih_item_len (ih)); - }else { -/* new item in whole falls into L[0] */ -/* Shift lnum[0]-1 items to L[0] */ - ret_val =leaf_shift_left (tb, tb->lnum[0 ] -1 , tb->lbytes); -/* Insert new item into L[0] */ -buffer_info_init_left (tb, &bi); -leaf_insert_into_buf (&bi, n + tb->item_pos - ret_val, ih, body, tb->zeroes_num); - tb->insert_size[0 ] =0 ; - tb->zeroes_num =0 ; - } - +if (tb->item_pos == tb->lnum[0 ] -1 && tb->lbytes !=-1 ) { +/* part of new item falls into L[0] */ +int new_item_len, shift; +int version; + + ret =leaf_shift_left (tb, tb->lnum[0 ] -1 ,-1 ); + +/* Calculate item length to insert to S[0] */ + new_item_len =ih_item_len (ih) - tb->lbytes; + +/* Calculate and check item length to insert to L[0] */ +put_ih_item_len (ih,ih_item_len (ih) - new_item_len); + +RFALSE (ih_item_len (ih) <=0 , +"PAP-12080: there is nothing to insert into L[0]: " +"ih_item_len=%d" ,ih_item_len (ih)); + +/* Insert new item into L[0] */ +buffer_info_init_left (tb, &bi); +leaf_insert_into_buf (&bi, n + tb->item_pos - ret, ih, body, +min_t (int, tb->zeroes_num,ih_item_len (ih))); + + version =ih_version (ih); + +/* +* Calculate key component, item length and body to +* insert into S[0] +*/ + shift =0 ; +if (is_indirect_le_ih (ih)) + shift = tb->tb_sb->s_blocksize_bits -UNFM_P_SHIFT ; + +add_le_ih_k_offset (ih, tb->lbytes << shift); + +put_ih_item_len (ih, new_item_len); +if (tb->lbytes > tb->zeroes_num) { + body += (tb->lbytes - tb->zeroes_num); + tb->zeroes_num =0 ; + }else + tb->zeroes_num -= tb->lbytes; + +RFALSE (ih_item_len (ih) <=0 , +"PAP-12085: there is nothing to insert into S[0]: " +"ih_item_len=%d" ,ih_item_len (ih)); + }else { +/* new item in whole falls into L[0] */ +/* Shift lnum[0]-1 items to L[0] */ + ret =leaf_shift_left (tb, tb->lnum[0 ] -1 , tb->lbytes); + +/* Insert new item into L[0] */ +buffer_info_init_left (tb, &bi); +leaf_insert_into_buf (&bi, n + tb->item_pos - ret, ih, body, + tb->zeroes_num); + tb->insert_size[0 ] =0 ; + tb->zeroes_num =0 ; + } } static void balance_leaf_paste_left(struct tree_balance *tb,
PATCH 24/29 reiserfs: balance_leaf refactor, format balance_leaf_paste_left
In reply to Jeff MahoneyBreak up balance_leaf_paste_left into:balance_leaf_paste_left_shiftbalance_leaf_paste_left_shift_direntbalance_leaf_paste_left_whole
and keep balance_leaf_paste_left as a handler to select which is appropriate.
Also reformat to adhere to CodingStyle.
--- fs/reiserfs/do_balan.c | 387 +++++++++++++++++++++++++++++-------------------- 1 file changed, 235 insertions(+), 152 deletions(-)
fs/reiserfs/do_balan.c +235 -152
@@ -355,164 +355,247 @@ static void balance_leaf_insert_left(str } } -static void balance_leaf_paste_left (struct tree_balance *tb, -struct item_head *ih,const char *body) +static void balance_leaf_paste_left_shift_dirent (struct tree_balance *tb, +struct item_head *ih, +const char *body) +{ +int n =B_NR_ITEMS (tb->L[0 ]); +struct buffer_info bi; + +RFALSE (tb->zeroes_num, +"PAP-12090: invalid parameter in case of a directory" ); + +/* directory item */ +if (tb->lbytes > tb->pos_in_item) { +/* new directory entry falls into L[0] */ +struct item_head *pasted; +int ret, l_pos_in_item = tb->pos_in_item; + +/* +* Shift lnum[0] - 1 items in whole. +* Shift lbytes - 1 entries from given directory item +*/ + ret =leaf_shift_left (tb, tb->lnum[0 ], tb->lbytes -1 ); +if (ret && !tb->item_pos) { + pasted =item_head (tb->L[0 ],B_NR_ITEMS (tb->L[0 ]) -1 ); + l_pos_in_item +=ih_entry_count (pasted) - + (tb->lbytes -1 ); + } + +/* Append given directory entry to directory item */ +buffer_info_init_left (tb, &bi); +leaf_paste_in_buffer (&bi, n + tb->item_pos - ret, + l_pos_in_item, tb->insert_size[0 ], + body, tb->zeroes_num); + +/* +* previous string prepared space for pasting new entry, +* following string pastes this entry +*/ + +/* +* when we have merge directory item, pos_in_item +* has been changed too +*/ + +/* paste new directory entry. 1 is entry number */ +leaf_paste_entries (&bi, n + tb->item_pos - ret, + l_pos_in_item,1 , + (struct reiserfs_de_head *) body, + body +DEH_SIZE , tb->insert_size[0 ]); + tb->insert_size[0 ] =0 ; + }else { +/* new directory item doesn't fall into L[0] */ +/* +* Shift lnum[0]-1 items in whole. Shift lbytes +* directory entries from directory item number lnum[0] +*/ +leaf_shift_left (tb, tb->lnum[0 ], tb->lbytes); + } + +/* Calculate new position to append in item body */ + tb->pos_in_item -= tb->lbytes; +} + +static void balance_leaf_paste_left_shift (struct tree_balance *tb, +struct item_head *ih, +const char *body) {struct buffer_head *tbS0 =PATH_PLAST_BUFFER (tb->tb_path); -int ret_val; +int n =B_NR_ITEMS (tb->L[0 ]);struct buffer_info bi; + +if (is_direntry_le_ih (item_head (tbS0, tb->item_pos))) { +balance_leaf_paste_left_shift_dirent (tb, ih, body); +return ; + } + +RFALSE (tb->lbytes <=0 , +"PAP-12095: there is nothing to shift to L[0]. " +"lbytes=%d" , tb->lbytes); +RFALSE (tb->pos_in_item !=ih_item_len (item_head (tbS0, tb->item_pos)), +"PAP-12100: incorrect position to paste: " +"item_len=%d, pos_in_item=%d" , +ih_item_len (item_head (tbS0, tb->item_pos)), tb->pos_in_item); + +/* appended item will be in L[0] in whole */ +if (tb->lbytes >= tb->pos_in_item) { +struct item_head *tbS0_pos_ih, *tbL0_ih; +struct item_head *tbS0_0_ih; +struct reiserfs_key *left_delim_key; +int ret, l_n, version, temp_l; + + tbS0_pos_ih =item_head (tbS0, tb->item_pos); + tbS0_0_ih =item_head (tbS0,0 ); + +/* +* this bytes number must be appended +* to the last item of L[h] +*/ + l_n = tb->lbytes - tb->pos_in_item; + +/* Calculate new insert_size[0] */ + tb->insert_size[0 ] -= l_n; + +RFALSE (tb->insert_size[0 ] <=0 , +"PAP-12105: there is nothing to paste into " +"L[0]. insert_size=%d" , tb->insert_size[0 ]); + + ret =leaf_shift_left (tb, tb->lnum[0 ], +ih_item_len (tbS0_pos_ih)); + + tbL0_ih =item_head (tb->L[0 ], n + tb->item_pos - ret); + +/* Append to body of item in L[0] */ +buffer_info_init_left (tb, &bi); +leaf_paste_in_buffer (&bi, n + tb->item_pos - ret, +ih_item_len (tbL0_ih), l_n, body, +min_t (int, l_n, tb->zeroes_num)); + +/* +* 0-th item in S0 can be only of DIRECT type +* when l_n != 0 +*/ + temp_l = l_n; + +RFALSE (ih_item_len (tbS0_0_ih), +"PAP-12106: item length must be 0" ); +RFALSE (comp_short_le_keys (&tbS0_0_ih->ih_key, +leaf_key (tb->L[0 ], n + tb->item_pos - ret)), +"PAP-12107: items must be of the same file" ); + +if (is_indirect_le_ih (tbL0_ih)) { +int shift = tb->tb_sb->s_blocksize_bits -UNFM_P_SHIFT ; + temp_l = l_n << shift; + } +/* update key of first item in S0 */ + version =ih_version (tbS0_0_ih); +add_le_key_k_offset (version, &tbS0_0_ih->ih_key, temp_l); + +/* update left delimiting key */ + left_delim_key =internal_key (tb->CFL[0 ], tb->lkey[0 ]); +add_le_key_k_offset (version, left_delim_key, temp_l); + +/* +* Calculate new body, position in item and +* insert_size[0] +*/ +if (l_n > tb->zeroes_num) { + body += (l_n - tb->zeroes_num); + tb->zeroes_num =0 ; + }else + tb->zeroes_num -= l_n; + tb->pos_in_item =0 ; + +RFALSE (comp_short_le_keys (&tbS0_0_ih->ih_key, +leaf_key (tb->L[0 ], +B_NR_ITEMS (tb->L[0 ]) -1 )) || + !op_is_left_mergeable (leaf_key (tbS0,0 ), tbS0->b_size) || + !op_is_left_mergeable (left_delim_key, tbS0->b_size), +"PAP-12120: item must be merge-able with left " +"neighboring item" ); + }else { +/* only part of the appended item will be in L[0] */ + +/* Calculate position in item for append in S[0] */ + tb->pos_in_item -= tb->lbytes; + +RFALSE (tb->pos_in_item <=0 , +"PAP-12125: no place for paste. pos_in_item=%d" , + tb->pos_in_item); + +/* +* Shift lnum[0] - 1 items in whole. +* Shift lbytes - 1 byte from item number lnum[0] +*/ +leaf_shift_left (tb, tb->lnum[0 ], tb->lbytes); + } +} + + +/* appended item will be in L[0] in whole */ +static void balance_leaf_paste_left_whole (struct tree_balance *tb, +struct item_head *ih, +const char *body) +{ +struct buffer_head *tbS0 =PATH_PLAST_BUFFER (tb->tb_path);int n =B_NR_ITEMS (tb->L[0 ]); +struct buffer_info bi; +struct item_head *pasted; +int ret; -if (tb->item_pos == tb->lnum[0 ] -1 && tb->lbytes !=-1 ) { -/* we must shift the part of the appended item */ -if (is_direntry_le_ih (item_head (tbS0, tb->item_pos))) { - -RFALSE (tb->zeroes_num, -"PAP-12090: invalid parameter in case of a directory" ); -/* directory item */ -if (tb->lbytes > tb->pos_in_item) { -/* new directory entry falls into L[0] */ -struct item_head *pasted; -int l_pos_in_item = tb->pos_in_item; - -/* Shift lnum[0] - 1 items in whole. Shift lbytes - 1 entries from given directory item */ - ret_val =leaf_shift_left (tb, tb->lnum[0 ], tb->lbytes-1 ); -if (ret_val && !tb->item_pos) { - pasted =item_head (tb->L[0 ],B_NR_ITEMS (tb->L[0 ]) -1 ); - l_pos_in_item +=ih_entry_count (pasted) - (tb->lbytes -1 ); - } - -/* Append given directory entry to directory item */ -buffer_info_init_left (tb, &bi); -leaf_paste_in_buffer (&bi, n + tb->item_pos - ret_val, l_pos_in_item, tb->insert_size[0 ], body, tb->zeroes_num); - -/* previous string prepared space for pasting new entry, following string pastes this entry */ - -/* when we have merge directory item, pos_in_item has been changed too */ - -/* paste new directory entry. 1 is entry number */ -leaf_paste_entries (&bi, n + tb->item_pos - ret_val, l_pos_in_item, -1 , (struct reiserfs_de_head *) body, - body +DEH_SIZE , tb->insert_size[0 ]); - tb->insert_size[0 ] =0 ; - }else { -/* new directory item doesn't fall into L[0] */ -/* Shift lnum[0]-1 items in whole. Shift lbytes directory entries from directory item number lnum[0] */ -leaf_shift_left (tb, tb->lnum[0 ], tb->lbytes); - } -/* Calculate new position to append in item body */ - tb->pos_in_item -= tb->lbytes; - }else { -/* regular object */ -RFALSE (tb->lbytes <=0 ,"PAP-12095: there is nothing to shift to L[0]. lbytes=%d" , tb->lbytes); -RFALSE (tb->pos_in_item !=ih_item_len (item_head (tbS0, tb->item_pos)), -"PAP-12100: incorrect position to paste: item_len=%d, pos_in_item=%d" , -ih_item_len (item_head (tbS0, tb->item_pos)), tb->pos_in_item); - -if (tb->lbytes >= tb->pos_in_item) { -/* appended item will be in L[0] in whole */ -int l_n; - -/* this bytes number must be appended to the last item of L[h] */ - l_n = tb->lbytes - tb->pos_in_item; - -/* Calculate new insert_size[0] */ - tb->insert_size[0 ] -= l_n; - -RFALSE (tb->insert_size[0 ] <=0 , -"PAP-12105: there is nothing to paste into L[0]. insert_size=%d" , - tb->insert_size[0 ]); - ret_val =leaf_shift_left (tb, tb->lnum[0 ],ih_item_len - (item_head (tbS0, tb->item_pos))); -/* Append to body of item in L[0] */ -buffer_info_init_left (tb, &bi); -leaf_paste_in_buffer - (&bi, n + tb->item_pos - ret_val,ih_item_len - (item_head (tb->L[0 ], n + tb->item_pos - ret_val)), - l_n, body, - tb->zeroes_num > l_n ? l_n : tb->zeroes_num); -/* 0-th item in S0 can be only of DIRECT type when l_n != 0 */ - { -int version; -int temp_l = l_n; - -RFALSE (ih_item_len (item_head (tbS0,0 )), -"PAP-12106: item length must be 0" ); -RFALSE (comp_short_le_keys (leaf_key (tbS0,0 ),leaf_key - (tb->L[0 ], n + tb->item_pos - ret_val)), -"PAP-12107: items must be of the same file" ); -if (is_indirect_le_ih (item_head (tb->L[0 ], n + tb->item_pos - ret_val))) { - temp_l = l_n << (tb->tb_sb-> s_blocksize_bits -UNFM_P_SHIFT ); - } -/* update key of first item in S0 */ - version =ih_version (item_head (tbS0,0 )); -set_le_key_k_offset (version,leaf_key (tbS0,0 ), -le_key_k_offset (version,leaf_key (tbS0,0 )) + temp_l); -/* update left delimiting key */ -set_le_key_k_offset (version,internal_key (tb->CFL[0 ], tb->lkey[0 ]), -le_key_k_offset (version,internal_key (tb->CFL[0 ], tb->lkey[0 ])) + temp_l); - } - -/* Calculate new body, position in item and insert_size[0] */ -if (l_n > tb->zeroes_num) { - body += (l_n - tb->zeroes_num); - tb->zeroes_num =0 ; - }else - tb->zeroes_num -= l_n; - tb->pos_in_item =0 ; - -RFALSE (comp_short_le_keys (leaf_key (tbS0,0 ),leaf_key (tb->L[0 ],B_NR_ITEMS (tb->L[0 ]) -1 )) - || !op_is_left_mergeable (leaf_key (tbS0,0 ), tbS0->b_size) - || !op_is_left_mergeable (internal_key (tb->CFL[0 ], tb->lkey[0 ]), tbS0->b_size), -"PAP-12120: item must be merge-able with left neighboring item" ); - }else {/* only part of the appended item will be in L[0] */ - -/* Calculate position in item for append in S[0] */ - tb->pos_in_item -= tb->lbytes; - -RFALSE (tb->pos_in_item <=0 ,"PAP-12125: no place for paste. pos_in_item=%d" , tb->pos_in_item); - -/* Shift lnum[0] - 1 items in whole. Shift lbytes - 1 byte from item number lnum[0] */ -leaf_shift_left (tb, tb->lnum[0 ], tb->lbytes); - } - } - }else {/* appended item will be in L[0] in whole */ - -struct item_head *pasted; - -if (!tb->item_pos &&op_is_left_mergeable (leaf_key (tbS0,0 ), tbS0->b_size)) {/* if we paste into first item of S[0] and it is left mergable */ -/* then increment pos_in_item by the size of the last item in L[0] */ - pasted =item_head (tb->L[0 ], n -1 ); -if (is_direntry_le_ih (pasted)) - tb->pos_in_item +=ih_entry_count (pasted); -else - tb->pos_in_item +=ih_item_len (pasted); - } - -/* Shift lnum[0] - 1 items in whole. Shift lbytes - 1 byte from item number lnum[0] */ - ret_val =leaf_shift_left (tb, tb->lnum[0 ], tb->lbytes); -/* Append to body of item in L[0] */ -buffer_info_init_left (tb, &bi); -leaf_paste_in_buffer (&bi, n + tb->item_pos - ret_val, - tb->pos_in_item, - tb->insert_size[0 ], - body, tb->zeroes_num); - -/* if appended item is directory, paste entry */ - pasted =item_head (tb->L[0 ], n + tb->item_pos - ret_val); -if (is_direntry_le_ih (pasted)) -leaf_paste_entries (&bi, n + tb->item_pos - ret_val, - tb->pos_in_item,1 , - (struct reiserfs_de_head *) body, - body +DEH_SIZE , - tb->insert_size[0 ]); -/* if appended item is indirect item, put unformatted node into un list */ -if (is_indirect_le_ih (pasted)) -set_ih_free_space (pasted,0 ); - tb->insert_size[0 ] =0 ; - tb->zeroes_num =0 ; - } +/* if we paste into first item of S[0] and it is left mergable */ +if (!tb->item_pos && +op_is_left_mergeable (leaf_key (tbS0,0 ), tbS0->b_size)) { +/* +* then increment pos_in_item by the size of the +* last item in L[0] +*/ + pasted =item_head (tb->L[0 ], n -1 ); +if (is_direntry_le_ih (pasted)) + tb->pos_in_item +=ih_entry_count (pasted); +else + tb->pos_in_item +=ih_item_len (pasted); + } + +/* +* Shift lnum[0] - 1 items in whole. +* Shift lbytes - 1 byte from item number lnum[0] +*/ + ret =leaf_shift_left (tb, tb->lnum[0 ], tb->lbytes); + +/* Append to body of item in L[0] */ +buffer_info_init_left (tb, &bi); +leaf_paste_in_buffer (&bi, n + tb->item_pos - ret, tb->pos_in_item, + tb->insert_size[0 ], body, tb->zeroes_num); + +/* if appended item is directory, paste entry */ + pasted =item_head (tb->L[0 ], n + tb->item_pos - ret); +if (is_direntry_le_ih (pasted)) +leaf_paste_entries (&bi, n + tb->item_pos - ret, + tb->pos_in_item,1 , + (struct reiserfs_de_head *)body, + body +DEH_SIZE , tb->insert_size[0 ]); + +/* +* if appended item is indirect item, put unformatted node +* into un list +*/ +if (is_indirect_le_ih (pasted)) +set_ih_free_space (pasted,0 ); + + tb->insert_size[0 ] =0 ; + tb->zeroes_num =0 ; +} +static void balance_leaf_paste_left (struct tree_balance *tb, +struct item_head *ih,const char *body) +{ +/* we must shift the part of the appended item */ +if (tb->item_pos == tb->lnum[0 ] -1 && tb->lbytes !=-1 ) +balance_leaf_paste_left_shift (tb, ih, body); +else +balance_leaf_paste_left_whole (tb, ih, body); }/* Shift lnum[0] items from S[0] to the left neighbor L[0] */
PATCH 25/29 reiserfs: balance_leaf refactor, format balance_leaf_insert_right
In reply to Jeff MahoneyReformat balance_leaf_insert_right to adhere to CodingStyle.
--- fs/reiserfs/do_balan.c | 139 ++++++++++++++++++++++++++----------------------- 1 file changed, 76 insertions(+), 63 deletions(-)
fs/reiserfs/do_balan.c +76 -63
@@ -626,71 +626,84 @@ static void balance_leaf_insert_right(ststruct buffer_head *tbS0 =PATH_PLAST_BUFFER (tb->tb_path);int n =B_NR_ITEMS (tbS0);struct buffer_info bi; -int ret_val; -if (n - tb->rnum[0 ] < tb->item_pos) {/* new item or its part falls to R[0] */ -if (tb->item_pos == n - tb->rnum[0 ] +1 && tb->rbytes !=-1 ) {/* part of new item falls into R[0] */ -loff_t old_key_comp, old_len, r_zeroes_number; -const char *r_body; -int version; -loff_t offset; - -leaf_shift_right (tb, tb->rnum[0 ] -1 ,-1 ); - - version =ih_version (ih); -/* Remember key component and item length */ - old_key_comp =le_ih_k_offset (ih); - old_len =ih_item_len (ih); - -/* Calculate key component and item length to insert into R[0] */ - offset =le_ih_k_offset (ih) + ((old_len - tb->rbytes) << (is_indirect_le_ih (ih) ? tb->tb_sb->s_blocksize_bits -UNFM_P_SHIFT :0 )); -set_le_ih_k_offset (ih, offset); -put_ih_item_len (ih, tb->rbytes); -/* Insert part of the item into R[0] */ -buffer_info_init_right (tb, &bi); -if ((old_len - tb->rbytes) > tb->zeroes_num) { - r_zeroes_number =0 ; - r_body = body + (old_len - tb->rbytes) - tb->zeroes_num; - }else { - r_body = body; - r_zeroes_number = tb->zeroes_num - (old_len - tb->rbytes); - tb->zeroes_num -= r_zeroes_number; - } - -leaf_insert_into_buf (&bi,0 , ih, r_body, - r_zeroes_number); - -/* Replace right delimiting key by first key in R[0] */ -replace_key (tb, tb->CFR[0 ], tb->rkey[0 ], - tb->R[0 ],0 ); - -/* Calculate key component and item length to insert into S[0] */ -set_le_ih_k_offset (ih, old_key_comp); -put_ih_item_len (ih, old_len - tb->rbytes); - - tb->insert_size[0 ] -= tb->rbytes; - - }else {/* whole new item falls into R[0] */ - -/* Shift rnum[0]-1 items to R[0] */ - ret_val =leaf_shift_right (tb, tb->rnum[0 ] -1 , tb->rbytes); -/* Insert new item into R[0] */ -buffer_info_init_right (tb, &bi); -leaf_insert_into_buf (&bi, tb->item_pos - n + tb->rnum[0 ] -1 , - ih, body, tb->zeroes_num); - -if (tb->item_pos - n + tb->rnum[0 ] -1 ==0 ) { -replace_key (tb, tb->CFR[0 ], - tb->rkey[0 ], - tb->R[0 ],0 ); - - } - tb->zeroes_num = tb->insert_size[0 ] =0 ; - } - }else {/* new item or part of it doesn't fall into R[0] */ +int ret; -leaf_shift_right (tb, tb->rnum[0 ], tb->rbytes); - } +/* new item or part of it doesn't fall into R[0] */ +if (n - tb->rnum[0 ] >= tb->item_pos) { +leaf_shift_right (tb, tb->rnum[0 ], tb->rbytes); +return ; + } + +/* new item or its part falls to R[0] */ + +/* part of new item falls into R[0] */ +if (tb->item_pos == n - tb->rnum[0 ] +1 && tb->rbytes !=-1 ) { +loff_t old_key_comp, old_len, r_zeroes_number; +const char *r_body; +int version, shift; +loff_t offset; + +leaf_shift_right (tb, tb->rnum[0 ] -1 ,-1 ); + + version =ih_version (ih); + +/* Remember key component and item length */ + old_key_comp =le_ih_k_offset (ih); + old_len =ih_item_len (ih); + +/* +* Calculate key component and item length to insert +* into R[0] +*/ + shift =0 ; +if (is_indirect_le_ih (ih)) + shift = tb->tb_sb->s_blocksize_bits -UNFM_P_SHIFT ; + offset =le_ih_k_offset (ih) + ((old_len - tb->rbytes) << shift); +set_le_ih_k_offset (ih, offset); +put_ih_item_len (ih, tb->rbytes); + +/* Insert part of the item into R[0] */ +buffer_info_init_right (tb, &bi); +if ((old_len - tb->rbytes) > tb->zeroes_num) { + r_zeroes_number =0 ; + r_body = body + (old_len - tb->rbytes) - tb->zeroes_num; + }else { + r_body = body; + r_zeroes_number = tb->zeroes_num - + (old_len - tb->rbytes); + tb->zeroes_num -= r_zeroes_number; + } + +leaf_insert_into_buf (&bi,0 , ih, r_body, r_zeroes_number); + +/* Replace right delimiting key by first key in R[0] */ +replace_key (tb, tb->CFR[0 ], tb->rkey[0 ], tb->R[0 ],0 ); + +/* +* Calculate key component and item length to +* insert into S[0] +*/ +set_le_ih_k_offset (ih, old_key_comp); +put_ih_item_len (ih, old_len - tb->rbytes); + + tb->insert_size[0 ] -= tb->rbytes; + + }else { +/* whole new item falls into R[0] */ + +/* Shift rnum[0]-1 items to R[0] */ + ret =leaf_shift_right (tb, tb->rnum[0 ] -1 , tb->rbytes); + +/* Insert new item into R[0] */ +buffer_info_init_right (tb, &bi); +leaf_insert_into_buf (&bi, tb->item_pos - n + tb->rnum[0 ] -1 , + ih, body, tb->zeroes_num); +if (tb->item_pos - n + tb->rnum[0 ] -1 ==0 ) +replace_key (tb, tb->CFR[0 ], tb->rkey[0 ], tb->R[0 ],0 ); + + tb->zeroes_num = tb->insert_size[0 ] =0 ; + } } static void balance_leaf_paste_right(struct tree_balance *tb,
PATCH 26/29 reiserfs: balance_leaf refactor, format balance_leaf_paste_right
In reply to Jeff MahoneyBreak up balance_leaf_paste_right into:balance_leaf_paste_right_shiftbalance_leaf_paste_right_shift_direntbalance_leaf_paste_right_whole
and keep balance_leaf_paste_right as a handler to select which is appropriate.
Also reformat to adhere to CodingStyle.
--- fs/reiserfs/do_balan.c | 300 +++++++++++++++++++++++++++---------------------- 1 file changed, 170 insertions(+), 130 deletions(-)
fs/reiserfs/do_balan.c +170 -130
@@ -706,155 +706,197 @@ static void balance_leaf_insert_right(st } } -static void balance_leaf_paste_right (struct tree_balance *tb, + +static void balance_leaf_paste_right_shift_dirent (struct tree_balance *tb,struct item_head *ih,const char *body) {struct buffer_head *tbS0 =PATH_PLAST_BUFFER (tb->tb_path); -int n =B_NR_ITEMS (tbS0);struct buffer_info bi; -int ret_val; - -if (n - tb->rnum[0 ] <= tb->item_pos) {/* pasted item or part of it falls to R[0] */ -if (tb->item_pos == n - tb->rnum[0 ] && tb->rbytes !=-1 ) {/* we must shift the part of the appended item */ -if (is_direntry_le_ih (item_head (tbS0, tb->item_pos))) {/* we append to directory item */ -int entry_count; - -RFALSE (tb->zeroes_num, -"PAP-12145: invalid parameter in case of a directory" ); - entry_count =ih_entry_count (item_head - (tbS0, tb->item_pos)); -if (entry_count - tb->rbytes < - tb->pos_in_item) -/* new directory entry falls into R[0] */ - { -int paste_entry_position; - -RFALSE (tb->rbytes -1 >= entry_count || !tb-> insert_size[0 ], -"PAP-12150: no enough of entries to shift to R[0]: rbytes=%d, entry_count=%d" , - tb->rbytes, entry_count); -/* Shift rnum[0]-1 items in whole. Shift rbytes-1 directory entries from directory item number rnum[0] */ -leaf_shift_right (tb, tb->rnum[0 ], tb->rbytes -1 ); -/* Paste given directory entry to directory item */ - paste_entry_position = tb->pos_in_item - entry_count + tb->rbytes -1 ; -buffer_info_init_right (tb, &bi); -leaf_paste_in_buffer (&bi,0 , paste_entry_position, tb->insert_size[0 ], body, tb->zeroes_num); -/* paste entry */ -leaf_paste_entries (&bi,0 , paste_entry_position,1 , - (struct reiserfs_de_head *) body, - body +DEH_SIZE , tb->insert_size[0 ]); +int entry_count; -if (paste_entry_position ==0 ) { -/* change delimiting keys */ -replace_key (tb, tb->CFR[0 ], tb->rkey[0 ], tb->R[0 ],0 ); - } - - tb->insert_size[0 ] =0 ; - tb->pos_in_item++; - }else {/* new directory entry doesn't fall into R[0] */ +RFALSE (zeroes_num, +"PAP-12145: invalid parameter in case of a directory" ); + entry_count =ih_entry_count (item_head (tbS0, tb->item_pos)); + +/* new directory entry falls into R[0] */ +if (entry_count - tb->rbytes < tb->pos_in_item) { +int paste_entry_position; + +RFALSE (tb->rbytes -1 >= entry_count || !tb->insert_size[0 ], +"PAP-12150: no enough of entries to shift to R[0]: " +"rbytes=%d, entry_count=%d" , tb->rbytes, entry_count); + +/* +* Shift rnum[0]-1 items in whole. +* Shift rbytes-1 directory entries from directory +* item number rnum[0] +*/ +leaf_shift_right (tb, tb->rnum[0 ], tb->rbytes -1 ); + +/* Paste given directory entry to directory item */ + paste_entry_position = tb->pos_in_item - entry_count + + tb->rbytes -1 ; +buffer_info_init_right (tb, &bi); +leaf_paste_in_buffer (&bi,0 , paste_entry_position, + tb->insert_size[0 ], body, tb->zeroes_num); + +/* paste entry */ +leaf_paste_entries (&bi,0 , paste_entry_position,1 , + (struct reiserfs_de_head *) body, + body +DEH_SIZE , tb->insert_size[0 ]); + +/* change delimiting keys */ +if (paste_entry_position ==0 ) +replace_key (tb, tb->CFR[0 ], tb->rkey[0 ], tb->R[0 ],0 ); + + tb->insert_size[0 ] =0 ; + tb->pos_in_item++; + }else { +/* new directory entry doesn't fall into R[0] */ +leaf_shift_right (tb, tb->rnum[0 ], tb->rbytes); + } +} -leaf_shift_right (tb, tb->rnum[0 ], tb->rbytes); - } - }else {/* regular object */ +static void balance_leaf_paste_right_shift (struct tree_balance *tb, +struct item_head *ih,const char *body) +{ +struct buffer_head *tbS0 =PATH_PLAST_BUFFER (tb->tb_path); +int n_shift, n_rem, r_zeroes_number, version; +unsigned long temp_rem; +const char *r_body; +struct buffer_info bi; -int n_shift, n_rem, r_zeroes_number; -const char *r_body; +/* we append to directory item */ +if (is_direntry_le_ih (item_head (tbS0, tb->item_pos))) { +balance_leaf_paste_right_shift_dirent (tb, ih, body); +return ; + } -/* Calculate number of bytes which must be shifted from appended item */ -if ((n_shift = tb->rbytes - tb->insert_size[0 ]) <0 ) - n_shift =0 ; +/* regular object */ -RFALSE (tb->pos_in_item !=ih_item_len - (item_head (tbS0, tb->item_pos)), -"PAP-12155: invalid position to paste. ih_item_len=%d, pos_in_item=%d" , - tb->pos_in_item,ih_item_len - (item_head (tbS0, tb->item_pos))); - -leaf_shift_right (tb, tb->rnum[0 ], n_shift); -/* Calculate number of bytes which must remain in body after appending to R[0] */ -if ((n_rem = tb->insert_size[0 ] - tb->rbytes) <0 ) - n_rem =0 ; +/* +* Calculate number of bytes which must be shifted +* from appended item +*/ + n_shift = tb->rbytes - tb->insert_size[0 ]; +if (n_shift <0 ) + n_shift =0 ; + +RFALSE (pos_in_item !=ih_item_len (item_head (tbS0, item_pos)), +"PAP-12155: invalid position to paste. ih_item_len=%d, " +"pos_in_item=%d" , pos_in_item, +ih_item_len (item_head (tbS0, item_pos))); + +leaf_shift_right (tb, tb->rnum[0 ], n_shift); + +/* +* Calculate number of bytes which must remain in body +* after appending to R[0] +*/ + n_rem = tb->insert_size[0 ] - tb->rbytes; +if (n_rem <0 ) + n_rem =0 ; + + temp_rem = n_rem; + + version =ih_version (item_head (tb->R[0 ],0 )); + +if (is_indirect_le_key (version,leaf_key (tb->R[0 ],0 ))) { +int shift = tb->tb_sb->s_blocksize_bits -UNFM_P_SHIFT ; + temp_rem = n_rem << shift; + } - { -int version; -unsigned long temp_rem = n_rem; +add_le_key_k_offset (version,leaf_key (tb->R[0 ],0 ), temp_rem); +add_le_key_k_offset (version,internal_key (tb->CFR[0 ], tb->rkey[0 ]), + temp_rem); + +do_balance_mark_internal_dirty (tb, tb->CFR[0 ],0 ); + +/* Append part of body into R[0] */ +buffer_info_init_right (tb, &bi); +if (n_rem > tb->zeroes_num) { + r_zeroes_number =0 ; + r_body = body + n_rem - tb->zeroes_num; + }else { + r_body = body; + r_zeroes_number = tb->zeroes_num - n_rem; + tb->zeroes_num -= r_zeroes_number; + } - version =ih_version (item_head (tb->R[0 ],0 )); -if (is_indirect_le_key (version,leaf_key (tb->R[0 ],0 ))) { - temp_rem = n_rem << (tb->tb_sb->s_blocksize_bits -UNFM_P_SHIFT ); - } -set_le_key_k_offset (version,leaf_key (tb->R[0 ],0 ), -le_key_k_offset (version,leaf_key (tb->R[0 ],0 )) + temp_rem); -set_le_key_k_offset (version,internal_key (tb->CFR[0 ], tb->rkey[0 ]), -le_key_k_offset (version,internal_key (tb->CFR[0 ], tb->rkey[0 ])) + temp_rem); - } -/* k_offset (leaf_key(tb->R[0],0)) += n_rem; -k_offset (internal_key(tb->CFR[0],tb->rkey[0])) += n_rem;*/ -do_balance_mark_internal_dirty (tb, tb->CFR[0 ],0 ); +leaf_paste_in_buffer (&bi,0 , n_shift, tb->insert_size[0 ] - n_rem, + r_body, r_zeroes_number); -/* Append part of body into R[0] */ -buffer_info_init_right (tb, &bi); -if (n_rem > tb->zeroes_num) { - r_zeroes_number =0 ; - r_body = body + n_rem - tb->zeroes_num; - }else { - r_body = body; - r_zeroes_number = tb->zeroes_num - n_rem; - tb->zeroes_num -= r_zeroes_number; - } +if (is_indirect_le_ih (item_head (tb->R[0 ],0 ))) +set_ih_free_space (item_head (tb->R[0 ],0 ),0 ); -leaf_paste_in_buffer (&bi,0 , n_shift, - tb->insert_size[0 ] - n_rem, - r_body, r_zeroes_number); + tb->insert_size[0 ] = n_rem; +if (!n_rem) + tb->pos_in_item++; +} -if (is_indirect_le_ih (item_head (tb->R[0 ],0 ))) { -#if 0 -RFALSE (n_rem, -"PAP-12160: paste more than one unformatted node pointer" ); -#endif -set_ih_free_space (item_head (tb->R[0 ],0 ),0 ); - } - tb->insert_size[0 ] = n_rem; -if (!n_rem) - tb->pos_in_item++; - } - }else {/* pasted item in whole falls into R[0] */ +static void balance_leaf_paste_right_whole (struct tree_balance *tb, +struct item_head *ih,const char *body) +{ +struct buffer_head *tbS0 =PATH_PLAST_BUFFER (tb->tb_path); +int n =B_NR_ITEMS (tbS0); +struct item_head *pasted; +struct buffer_info bi; -struct item_head *pasted; +buffer_info_init_right (tb, &bi); +leaf_shift_right (tb, tb->rnum[0 ], tb->rbytes); - ret_val =leaf_shift_right (tb, tb->rnum[0 ], tb->rbytes); -/* append item in R[0] */ -if (tb->pos_in_item >=0 ) { -buffer_info_init_right (tb, &bi); -leaf_paste_in_buffer (&bi, tb->item_pos - n + tb->rnum[0 ], tb->pos_in_item, - tb->insert_size[0 ], body, tb->zeroes_num); - } +/* append item in R[0] */ +if (tb->pos_in_item >=0 ) { +buffer_info_init_right (tb, &bi); +leaf_paste_in_buffer (&bi, tb->item_pos - n + tb->rnum[0 ], + tb->pos_in_item, tb->insert_size[0 ], body, + tb->zeroes_num); + } -/* paste new entry, if item is directory item */ - pasted =item_head (tb->R[0 ], tb->item_pos - n + tb->rnum[0 ]); -if (is_direntry_le_ih (pasted) && tb->pos_in_item >=0 ) { -leaf_paste_entries (&bi, tb->item_pos - n + tb->rnum[0 ], - tb->pos_in_item,1 , - (struct reiserfs_de_head *) body, - body +DEH_SIZE , tb->insert_size[0 ]); -if (!tb->pos_in_item) { +/* paste new entry, if item is directory item */ + pasted =item_head (tb->R[0 ], tb->item_pos - n + tb->rnum[0 ]); +if (is_direntry_le_ih (pasted) && tb->pos_in_item >=0 ) { +leaf_paste_entries (&bi, tb->item_pos - n + tb->rnum[0 ], + tb->pos_in_item,1 , + (struct reiserfs_de_head *)body, + body +DEH_SIZE , tb->insert_size[0 ]); + +if (!tb->pos_in_item) { + +RFALSE (tb->item_pos - n + tb->rnum[0 ], +"PAP-12165: directory item must be first " +"item of node when pasting is in 0th position" ); + +/* update delimiting keys */ +replace_key (tb, tb->CFR[0 ], tb->rkey[0 ], tb->R[0 ],0 ); + } + } -RFALSE (tb->item_pos - n + tb->rnum[0 ], -"PAP-12165: directory item must be first item of node when pasting is in 0th position" ); +if (is_indirect_le_ih (pasted)) +set_ih_free_space (pasted,0 ); + tb->zeroes_num = tb->insert_size[0 ] =0 ; +} -/* update delimiting keys */ -replace_key (tb, tb->CFR[0 ], tb->rkey[0 ], tb->R[0 ],0 ); - } - } +static void balance_leaf_paste_right (struct tree_balance *tb, +struct item_head *ih,const char *body) +{ +struct buffer_head *tbS0 =PATH_PLAST_BUFFER (tb->tb_path); +int n =B_NR_ITEMS (tbS0); -if (is_indirect_le_ih (pasted)) -set_ih_free_space (pasted,0 ); - tb->zeroes_num = tb->insert_size[0 ] =0 ; - } - }else {/* new item doesn't fall into R[0] */ +/* new item doesn't fall into R[0] */ +if (n - tb->rnum[0 ] > tb->item_pos) { +leaf_shift_right (tb, tb->rnum[0 ], tb->rbytes); +return ; + } -leaf_shift_right (tb, tb->rnum[0 ], tb->rbytes); - } +/* pasted item or part of it falls to R[0] */ +if (tb->item_pos == n - tb->rnum[0 ] && tb->rbytes !=-1 ) +/* we must shift the part of the appended item */ +balance_leaf_paste_right_shift (tb, ih, body); +else +/* pasted item in whole falls into R[0] */ +balance_leaf_paste_right_whole (tb, ih, body); }/* shift rnum[0] items from S[0] to the right neighbor R[0] */
@@ -870,7 +912,6 @@ static void balance_leaf_right(struct trbalance_leaf_insert_right (tb, ih, body); else /* M_PASTE */balance_leaf_paste_right (tb ,ih ,body ); - } static void balance_leaf_new_nodes_insert(struct tree_balance *tb,
@@ -1083,8 +1124,7 @@ static void balance_leaf_new_nodes_paste tb->pos_in_item,1 , (struct reiserfs_de_head *)body, body +DEH_SIZE , - tb->insert_size[0 ] - ); + tb->insert_size[0]); }/* if we paste to indirect item update ih_free_space */
PATCH 27/29 reiserfs: balance_leaf refactor, format balance_leaf_new_nodes_paste
In reply to Jeff MahoneyBreak up balance_leaf_paste_new_nodes into:balance_leaf_paste_new_nodes_shiftbalance_leaf_paste_new_nodes_shift_direntbalance_leaf_paste_new_nodes_whole
and keep balance_leaf_paste_new_nodes as a handler to select which is appropriate.
Also reformat to adhere to CodingStyle.
--- fs/reiserfs/do_balan.c | 498 +++++++++++++++++++++++++++---------------------- 1 file changed, 282 insertions(+), 216 deletions(-)
fs/reiserfs/do_balan.c +282 -216
@@ -714,7 +714,7 @@ static void balance_leaf_paste_right_shistruct buffer_info bi;int entry_count; -RFALSE (zeroes_num, +RFALSE (tb->zeroes_num,"PAP-12145: invalid parameter in case of a directory" ); entry_count =ih_entry_count (item_head (tbS0, tb->item_pos));
@@ -782,10 +782,10 @@ static void balance_leaf_paste_right_shiif (n_shift <0 ) n_shift =0 ; -RFALSE (pos_in_item !=ih_item_len (item_head (tbS0, item_pos)), +RFALSE (tb->pos_in_item !=ih_item_len (item_head (tbS0, tb->item_pos)),"PAP-12155: invalid position to paste. ih_item_len=%d, " -"pos_in_item=%d" , pos_in_item, -ih_item_len (item_head (tbS0, item_pos))); +"pos_in_item=%d" , tb->pos_in_item, +ih_item_len (item_head (tbS0, tb->item_pos)));leaf_shift_right (tb, tb->rnum[0 ], n_shift);
@@ -924,68 +924,144 @@ static void balance_leaf_new_nodes_inserstruct buffer_head *tbS0 =PATH_PLAST_BUFFER (tb->tb_path);int n =B_NR_ITEMS (tbS0);struct buffer_info bi; -if (n - tb->snum[i] < tb->item_pos) {/* new item or it's part falls to first new node S_new[i] */ -if (tb->item_pos == n - tb->snum[i] +1 && tb->sbytes[i] !=-1 ) {/* part of new item falls into S_new[i] */ -int old_key_comp, old_len, r_zeroes_number; -const char *r_body; -int version; - -/* Move snum[i]-1 items from S[0] to S_new[i] */ -leaf_move_items (LEAF_FROM_S_TO_SNEW , tb, - tb->snum[i] -1 ,-1 , - tb->S_new[i]); -/* Remember key component and item length */ - version =ih_version (ih); - old_key_comp =le_ih_k_offset (ih); - old_len =ih_item_len (ih); - -/* Calculate key component and item length to insert into S_new[i] */ -set_le_ih_k_offset (ih,le_ih_k_offset (ih) + - ((old_len - tb->sbytes[i]) << (is_indirect_le_ih (ih) ? tb->tb_sb->s_blocksize_bits -UNFM_P_SHIFT :0 ))); - -put_ih_item_len (ih, tb->sbytes[i]); - -/* Insert part of the item into S_new[i] before 0-th item */ -buffer_info_init_bh (tb, &bi, tb->S_new[i]); - -if ((old_len - tb->sbytes[i]) > tb->zeroes_num) { - r_zeroes_number =0 ; - r_body = body + (old_len - tb->sbytes[i]) - tb->zeroes_num; - }else { - r_body = body; - r_zeroes_number = tb->zeroes_num - (old_len - tb->sbytes[i]); - tb->zeroes_num -= r_zeroes_number; - } - -leaf_insert_into_buf (&bi,0 , ih, r_body, r_zeroes_number); - -/* Calculate key component and item length to insert into S[i] */ -set_le_ih_k_offset (ih, old_key_comp); -put_ih_item_len (ih, old_len - tb->sbytes[i]); - tb->insert_size[0 ] -= tb->sbytes[i]; - }else {/* whole new item falls into S_new[i] */ - -/* Shift snum[0] - 1 items to S_new[i] (sbytes[i] of split item) */ -leaf_move_items (LEAF_FROM_S_TO_SNEW , tb, - tb->snum[i] -1 , tb->sbytes[i], tb->S_new[i]); - -/* Insert new item into S_new[i] */ -buffer_info_init_bh (tb, &bi, tb->S_new[i]); -leaf_insert_into_buf (&bi, tb->item_pos - n + tb->snum[i] -1 , - ih, body, tb->zeroes_num); - - tb->zeroes_num = tb->insert_size[0 ] =0 ; - } - } - -else {/* new item or it part don't falls into S_new[i] */ - -leaf_move_items (LEAF_FROM_S_TO_SNEW , tb, - tb->snum[i], tb->sbytes[i], tb->S_new[i]); - } +int shift; + +/* new item or it part don't falls into S_new[i] */ +if (n - tb->snum[i] >= tb->item_pos) { +leaf_move_items (LEAF_FROM_S_TO_SNEW , tb, + tb->snum[i], tb->sbytes[i], tb->S_new[i]); +return ; + } + +/* new item or it's part falls to first new node S_new[i] */ + +/* part of new item falls into S_new[i] */ +if (tb->item_pos == n - tb->snum[i] +1 && tb->sbytes[i] !=-1 ) { +int old_key_comp, old_len, r_zeroes_number; +const char *r_body; +int version; + +/* Move snum[i]-1 items from S[0] to S_new[i] */ +leaf_move_items (LEAF_FROM_S_TO_SNEW , tb, tb->snum[i] -1 ,-1 , + tb->S_new[i]); + +/* Remember key component and item length */ + version =ih_version (ih); + old_key_comp =le_ih_k_offset (ih); + old_len =ih_item_len (ih); + +/* +* Calculate key component and item length to insert +* into S_new[i] +*/ + shift =0 ; +if (is_indirect_le_ih (ih)) + shift = tb->tb_sb->s_blocksize_bits -UNFM_P_SHIFT ; +set_le_ih_k_offset (ih, +le_ih_k_offset (ih) + + ((old_len - tb->sbytes[i]) << shift)); + +put_ih_item_len (ih, tb->sbytes[i]); + +/* Insert part of the item into S_new[i] before 0-th item */ +buffer_info_init_bh (tb, &bi, tb->S_new[i]); + +if ((old_len - tb->sbytes[i]) > tb->zeroes_num) { + r_zeroes_number =0 ; + r_body = body + (old_len - tb->sbytes[i]) - + tb->zeroes_num; + }else { + r_body = body; + r_zeroes_number = tb->zeroes_num - (old_len - + tb->sbytes[i]); + tb->zeroes_num -= r_zeroes_number; + } + +leaf_insert_into_buf (&bi,0 , ih, r_body, r_zeroes_number); + +/* +* Calculate key component and item length to +* insert into S[i] +*/ +set_le_ih_k_offset (ih, old_key_comp); +put_ih_item_len (ih, old_len - tb->sbytes[i]); + tb->insert_size[0 ] -= tb->sbytes[i]; + }else { +/* whole new item falls into S_new[i] */ + +/* +* Shift snum[0] - 1 items to S_new[i] +* (sbytes[i] of split item) +*/ +leaf_move_items (LEAF_FROM_S_TO_SNEW , tb, + tb->snum[i] -1 , tb->sbytes[i], tb->S_new[i]); + +/* Insert new item into S_new[i] */ +buffer_info_init_bh (tb, &bi, tb->S_new[i]); +leaf_insert_into_buf (&bi, tb->item_pos - n + tb->snum[i] -1 , + ih, body, tb->zeroes_num); + + tb->zeroes_num = tb->insert_size[0 ] =0 ; + } } -static void balance_leaf_new_nodes_paste(struct tree_balance *tb, +/* we append to directory item */ +static void balance_leaf_new_nodes_paste_dirent (struct tree_balance *tb, +struct item_head *ih, +const char *body, +struct item_head *insert_key, +struct buffer_head **insert_ptr, +int i) +{ +struct buffer_head *tbS0 =PATH_PLAST_BUFFER (tb->tb_path); +struct item_head *aux_ih =item_head (tbS0, tb->item_pos); +int entry_count =ih_entry_count (aux_ih); +struct buffer_info bi; + +if (entry_count - tb->sbytes[i] < tb->pos_in_item && + tb->pos_in_item <= entry_count) { +/* new directory entry falls into S_new[i] */ + +RFALSE (!tb->insert_size[0 ], +"PAP-12215: insert_size is already 0" ); +RFALSE (tb->sbytes[i] -1 >= entry_count, +"PAP-12220: there are no so much entries (%d), only %d" , + tb->sbytes[i] -1 , entry_count); + +/* +* Shift snum[i]-1 items in whole. +* Shift sbytes[i] directory entries +* from directory item number snum[i] +*/ +leaf_move_items (LEAF_FROM_S_TO_SNEW , tb, tb->snum[i], + tb->sbytes[i] -1 , tb->S_new[i]); + +/* +* Paste given directory entry to +* directory item +*/ +buffer_info_init_bh (tb, &bi, tb->S_new[i]); +leaf_paste_in_buffer (&bi,0 , tb->pos_in_item - entry_count + + tb->sbytes[i] -1 , tb->insert_size[0 ], + body, tb->zeroes_num); + +/* paste new directory entry */ +leaf_paste_entries (&bi,0 , tb->pos_in_item - entry_count + + tb->sbytes[i] -1 ,1 , + (struct reiserfs_de_head *) body, + body +DEH_SIZE , tb->insert_size[0 ]); + + tb->insert_size[0 ] =0 ; + tb->pos_in_item++; + }else { +/* new directory entry doesn't fall into S_new[i] */ +leaf_move_items (LEAF_FROM_S_TO_SNEW , tb, tb->snum[i], + tb->sbytes[i], tb->S_new[i]); + } + +} + +static void balance_leaf_new_nodes_paste_shift(struct tree_balance *tb, struct item_head *ih, const char *body, struct item_head *insert_key,
@@ -993,154 +1069,152 @@ static void balance_leaf_new_nodes_paste int i) {struct buffer_head *tbS0 =PATH_PLAST_BUFFER (tb->tb_path); +struct item_head *aux_ih =item_head (tbS0, tb->item_pos); +int n_shift, n_rem, r_zeroes_number, shift; +const char *r_body; +struct item_head *tmp; +struct buffer_info bi; + +RFALSE (ih,"PAP-12210: ih must be 0" ); + +if (is_direntry_le_ih (aux_ih)) { +balance_leaf_new_nodes_paste_dirent (tb, ih, body, insert_key, + insert_ptr, i); +return ; + } + +/* regular object */ + + +RFALSE (tb->pos_in_item !=ih_item_len (item_head (tbS0, tb->item_pos)) || + tb->insert_size[0 ] <=0 , +"PAP-12225: item too short or insert_size <= 0" ); + +/* +* Calculate number of bytes which must be shifted from appended item +*/ + n_shift = tb->sbytes[i] - tb->insert_size[0 ]; +if (n_shift <0 ) + n_shift =0 ; +leaf_move_items (LEAF_FROM_S_TO_SNEW , tb, tb->snum[i], n_shift, + tb->S_new[i]); + +/* +* Calculate number of bytes which must remain in body after +* append to S_new[i] +*/ + n_rem = tb->insert_size[0 ] - tb->sbytes[i]; +if (n_rem <0 ) + n_rem =0 ; + +/* Append part of body into S_new[0] */ +buffer_info_init_bh (tb, &bi, tb->S_new[i]); +if (n_rem > tb->zeroes_num) { + r_zeroes_number =0 ; + r_body = body + n_rem - tb->zeroes_num; + }else { + r_body = body; + r_zeroes_number = tb->zeroes_num - n_rem; + tb->zeroes_num -= r_zeroes_number; + } + +leaf_paste_in_buffer (&bi,0 , n_shift, tb->insert_size[0 ] - n_rem, + r_body, r_zeroes_number); + + tmp =item_head (tb->S_new[i],0 ); + shift =0 ; +if (is_indirect_le_ih (tmp)) { +set_ih_free_space (tmp,0 ); + shift = tb->tb_sb->s_blocksize_bits -UNFM_P_SHIFT ; + } +add_le_ih_k_offset (tmp, n_rem << shift); + + tb->insert_size[0 ] = n_rem; +if (!n_rem) + tb->pos_in_item++; +} + +static void balance_leaf_new_nodes_paste_whole (struct tree_balance *tb, +struct item_head *ih, +const char *body, +struct item_head *insert_key, +struct buffer_head **insert_ptr, +int i) + +{ +struct buffer_head *tbS0 =PATH_PLAST_BUFFER (tb->tb_path);int n =B_NR_ITEMS (tbS0); +int leaf_mi; +struct item_head *pasted;struct buffer_info bi; -if (n - tb->snum[i] <= tb->item_pos) {/* pasted item or part if it falls to S_new[i] */ -if (tb->item_pos == n - tb->snum[i] && tb->sbytes[i] !=-1 ) {/* we must shift part of the appended item */ -struct item_head *aux_ih; - -RFALSE (ih,"PAP-12210: ih must be 0" ); - - aux_ih =item_head (tbS0, tb->item_pos); -if (is_direntry_le_ih (aux_ih)) { -/* we append to directory item */ - -int entry_count; - - entry_count =ih_entry_count (aux_ih); - -if (entry_count - tb->sbytes[i] < tb->pos_in_item && tb->pos_in_item <= entry_count) { -/* new directory entry falls into S_new[i] */ - -RFALSE (!tb->insert_size[0 ],"PAP-12215: insert_size is already 0" ); -RFALSE (tb->sbytes[i] -1 >= entry_count, -"PAP-12220: there are no so much entries (%d), only %d" , - tb->sbytes[i] -1 , entry_count); - -/* Shift snum[i]-1 items in whole. Shift sbytes[i] directory entries from directory item number snum[i] */ -leaf_move_items (LEAF_FROM_S_TO_SNEW , tb, tb->snum[i], tb->sbytes[i] -1 , tb->S_new[i]); -/* Paste given directory entry to directory item */ -buffer_info_init_bh (tb, &bi, tb->S_new[i]); -leaf_paste_in_buffer (&bi,0 , tb->pos_in_item - entry_count + tb->sbytes[i] -1 , - tb->insert_size[0 ], body, tb->zeroes_num); -/* paste new directory entry */ -leaf_paste_entries (&bi,0 , tb->pos_in_item - entry_count + tb->sbytes[i] -1 ,1 , - (struct reiserfs_de_head *) body, - body +DEH_SIZE , tb->insert_size[0 ]); - tb->insert_size[0 ] =0 ; - tb->pos_in_item++; - }else {/* new directory entry doesn't fall into S_new[i] */ -leaf_move_items (LEAF_FROM_S_TO_SNEW , tb, tb->snum[i], tb->sbytes[i], tb->S_new[i]); - } - }else {/* regular object */ - -int n_shift, n_rem, r_zeroes_number; -const char *r_body; - -RFALSE (tb->pos_in_item !=ih_item_len (item_head (tbS0, tb->item_pos)) || tb->insert_size[0 ] <=0 , -"PAP-12225: item too short or insert_size <= 0" ); - -/* Calculate number of bytes which must be shifted from appended item */ - n_shift = tb->sbytes[i] - tb->insert_size[0 ]; -if (n_shift <0 ) - n_shift =0 ; -leaf_move_items (LEAF_FROM_S_TO_SNEW , tb, tb->snum[i], n_shift, tb->S_new[i]); - -/* Calculate number of bytes which must remain in body after append to S_new[i] */ - n_rem = tb->insert_size[0 ] - tb->sbytes[i]; -if (n_rem <0 ) - n_rem =0 ; -/* Append part of body into S_new[0] */ -buffer_info_init_bh (tb, &bi, tb->S_new[i]); -if (n_rem > tb->zeroes_num) { - r_zeroes_number =0 ; - r_body = body + n_rem - tb->zeroes_num; - }else { - r_body = body; - r_zeroes_number = tb->zeroes_num - n_rem; - tb->zeroes_num -= r_zeroes_number; - } - -leaf_paste_in_buffer (&bi,0 , n_shift, - tb->insert_size[0 ] - n_rem, - r_body, r_zeroes_number); - { -struct item_head *tmp; - - tmp =item_head (tb->S_new[i],0 ); -if (is_indirect_le_ih - (tmp)) { -set_ih_free_space (tmp,0 ); -set_le_ih_k_offset (tmp,le_ih_k_offset (tmp) + (n_rem << (tb->tb_sb->s_blocksize_bits -UNFM_P_SHIFT ))); - }else { -set_le_ih_k_offset (tmp,le_ih_k_offset (tmp) + n_rem); - } - } - - tb->insert_size[0 ] = n_rem; -if (!n_rem) - tb->pos_in_item++; - } - }else -/* item falls wholly into S_new[i] */ - { -int leaf_mi; -struct item_head *pasted;#ifdef CONFIG_REISERFS_CHECK -struct item_head *ih_check =item_head (tbS0, tb->item_pos); +struct item_head *ih_check =item_head (tbS0, tb->item_pos); -if (!is_direntry_le_ih (ih_check) - && (tb->pos_in_item !=ih_item_len (ih_check) - || tb->insert_size[0 ] <=0 )) -reiserfs_panic (tb->tb_sb, -"PAP-12235" , -"pos_in_item " -"must be equal " -"to ih_item_len" ); -#endif /* CONFIG_REISERFS_CHECK */ - - leaf_mi =leaf_move_items (LEAF_FROM_S_TO_SNEW , - tb, tb->snum[i], - tb->sbytes[i], - tb->S_new[i]); - -RFALSE (leaf_mi, -"PAP-12240: unexpected value returned by leaf_move_items (%d)" , - leaf_mi); - -/* paste into item */ -buffer_info_init_bh (tb, &bi, tb->S_new[i]); -leaf_paste_in_buffer (&bi, - tb->item_pos - n + tb->snum[i], - tb->pos_in_item, - tb->insert_size[0 ], - body, tb->zeroes_num); - - pasted =item_head (tb->S_new[i], tb->item_pos - n + tb->snum[i]); -if (is_direntry_le_ih (pasted)) { -leaf_paste_entries (&bi, - tb->item_pos - n + tb->snum[i], - tb->pos_in_item,1 , - (struct reiserfs_de_head *)body, - body +DEH_SIZE , - tb->insert_size[0 ]); - } - -/* if we paste to indirect item update ih_free_space */ -if (is_indirect_le_ih (pasted)) -set_ih_free_space (pasted,0 ); - tb->zeroes_num = tb->insert_size[0 ] =0 ; - } - } - -else {/* pasted item doesn't fall into S_new[i] */ - -leaf_move_items (LEAF_FROM_S_TO_SNEW , tb, - tb->snum[i], tb->sbytes[i], tb->S_new[i]); - } +if (!is_direntry_le_ih (ih_check) && + (tb->pos_in_item !=ih_item_len (ih_check) || + tb->insert_size[0 ] <=0 )) +reiserfs_panic (tb->tb_sb, +"PAP-12235" , +"pos_in_item must be equal to ih_item_len" ); +#endif + + leaf_mi =leaf_move_items (LEAF_FROM_S_TO_SNEW , tb, tb->snum[i], + tb->sbytes[i], tb->S_new[i]); + +RFALSE (leaf_mi, +"PAP-12240: unexpected value returned by leaf_move_items (%d)" , + leaf_mi); + +/* paste into item */ +buffer_info_init_bh (tb, &bi, tb->S_new[i]); +leaf_paste_in_buffer (&bi, tb->item_pos - n + tb->snum[i], + tb->pos_in_item, tb->insert_size[0 ], + body, tb->zeroes_num); + + pasted =item_head (tb->S_new[i], tb->item_pos - n + + tb->snum[i]); +if (is_direntry_le_ih (pasted)) +leaf_paste_entries (&bi, tb->item_pos - n + tb->snum[i], + tb->pos_in_item,1 , + (struct reiserfs_de_head *)body, + body +DEH_SIZE , tb->insert_size[0 ]); + +/* if we paste to indirect item update ih_free_space */ +if (is_indirect_le_ih (pasted)) +set_ih_free_space (pasted,0 ); + + tb->zeroes_num = tb->insert_size[0 ] =0 ; } +static void balance_leaf_new_nodes_paste (struct tree_balance *tb, +struct item_head *ih, +const char *body, +struct item_head *insert_key, +struct buffer_head **insert_ptr, +int i) +{ +struct buffer_head *tbS0 =PATH_PLAST_BUFFER (tb->tb_path); +int n =B_NR_ITEMS (tbS0); + +/* pasted item doesn't fall into S_new[i] */ +if (n - tb->snum[i] > tb->item_pos) { +leaf_move_items (LEAF_FROM_S_TO_SNEW , tb, + tb->snum[i], tb->sbytes[i], tb->S_new[i]); +return ; + } + +/* pasted item or part if it falls to S_new[i] */ + +if (tb->item_pos == n - tb->snum[i] && tb->sbytes[i] !=-1 ) +/* we must shift part of the appended item */ +balance_leaf_new_nodes_paste_shift (tb, ih, body, insert_key, + insert_ptr, i); +else +/* item falls wholly into S_new[i] */ +balance_leaf_new_nodes_paste_whole (tb, ih, body, insert_key, + insert_ptr, i); +}/* Fill new nodes that appear in place of S[0] */ static void balance_leaf_new_nodes(struct tree_balance *tb,
@@ -1152,6 +1226,7 @@ static void balance_leaf_new_nodes(struc {int i;for (i = tb->blknum[0 ] -2 ; i >=0 ; i--) { +BUG_ON (flag !=M_INSERT && flag !=M_PASTE ); RFALSE(!tb->snum[i], "PAP-12200: snum[%d] == %d. Must be > 0", i,
@@ -1164,21 +1239,12 @@ static void balance_leaf_new_nodes(struc/* initialized block type and tree level */ set_blkh_level (B_BLK_HEAD (tb->S_new[i]),DISK_LEAF_NODE_LEVEL ); -switch (flag) { -case M_INSERT :/* insert item */ +if (flag ==M_INSERT )balance_leaf_new_nodes_insert (tb, ih, body, insert_key, insert_ptr, i); -break ; - -case M_PASTE :/* append item */ +else /* M_PASTE */ balance_leaf_new_nodes_paste (tb, ih, body, insert_key, insert_ptr, i); -break ; -default :/* cases d and t */ -reiserfs_panic (tb->tb_sb,"PAP-12245" , -"blknum > 2: unexpected mode: %s(%d)" , - (flag ==M_DELETE ) ?"DELETE" : ((flag ==M_CUT ) ?"CUT" :"UNKNOWN" ), flag); - }memcpy (insert_key + i,leaf_key (tb->S_new[i],0 ),KEY_SIZE ); insert_ptr[i] = tb->S_new[i];
PATCH 28/29 reiserfs: balance_leaf refactor, format balance_leaf_finish_node
In reply to Jeff MahoneySplit out balance_leaf_finish_node_dirent from balance_leaf_paste_finish_node.
Also reformat to adhere to CodingStyle.
--- fs/reiserfs/do_balan.c | 163 +++++++++++++++++++++---------------------------- 1 file changed, 72 insertions(+), 91 deletions(-)
fs/reiserfs/do_balan.c +72 -91
@@ -72,19 +72,6 @@ inline void do_balance_mark_leaf_dirty(s* if snum1 is larger than 0 we put items into the new node s1 * if snum2 is larger than 0 we put items into the new node s2 * Note that all *num* count new items being created. -* -* It would be easier to read balance_leaf() if each of these summary -* lines was a separate procedure rather than being inlined. I think -* that there are many passages here and in balance_leaf_when_delete() in -* which two calls to one procedure can replace two passages, and it -* might save cache space and improve software maintenance costs to do so. -* -* Vladimir made the perceptive comment that we should offload most of -* the decision making in this function into fix_nodes/check_balance, and -* then create some sort of structure in tb that says what actions should -* be performed by do_balance. -* -* -Hans */ /*
@@ -1263,18 +1250,49 @@ static void balance_leaf_finish_node_ins {struct buffer_head *tbS0 =PATH_PLAST_BUFFER (tb->tb_path);struct buffer_info bi; -buffer_info_init_tbS0 (tb, &bi); -leaf_insert_into_buf (&bi, tb->item_pos, ih, - body, tb->zeroes_num); - -/* -* If we insert the first key -* change the delimiting key -*/ -if (tb->item_pos ==0 ) { -if (tb->CFL[0 ])/* can be 0 in reiserfsck */ -replace_key (tb, tb->CFL[0 ], tb->lkey[0 ], tbS0,0 ); - } +buffer_info_init_tbS0 (tb, &bi); +leaf_insert_into_buf (&bi, tb->item_pos, ih, body, tb->zeroes_num); + +/* If we insert the first key change the delimiting key */ +if (tb->item_pos ==0 ) { +if (tb->CFL[0 ])/* can be 0 in reiserfsck */ +replace_key (tb, tb->CFL[0 ], tb->lkey[0 ], tbS0,0 ); + + } +} + +static void balance_leaf_finish_node_paste_dirent (struct tree_balance *tb, +struct item_head *ih, +const char *body) +{ +struct buffer_head *tbS0 =PATH_PLAST_BUFFER (tb->tb_path); +struct item_head *pasted =item_head (tbS0, tb->item_pos); +struct buffer_info bi; + +if (tb->pos_in_item >=0 && tb->pos_in_item <=ih_entry_count (pasted)) { +RFALSE (!tb->insert_size[0 ], +"PAP-12260: insert_size is 0 already" ); + +/* prepare space */ +buffer_info_init_tbS0 (tb, &bi); +leaf_paste_in_buffer (&bi, tb->item_pos, tb->pos_in_item, + tb->insert_size[0 ], body, tb->zeroes_num); + +/* paste entry */ +leaf_paste_entries (&bi, tb->item_pos, tb->pos_in_item,1 , + (struct reiserfs_de_head *)body, + body +DEH_SIZE , tb->insert_size[0 ]); + +if (!tb->item_pos && !tb->pos_in_item) { +RFALSE (!tb->CFL[0 ] || !tb->L[0 ], +"PAP-12270: CFL[0]/L[0] must be specified" ); +if (tb->CFL[0 ]) +replace_key (tb, tb->CFL[0 ], tb->lkey[0 ], + tbS0,0 ); + } + + tb->insert_size[0 ] =0 ; + } } static void balance_leaf_finish_node_paste(struct tree_balance *tb,
@@ -1283,74 +1301,37 @@ static void balance_leaf_finish_node_pas {struct buffer_head *tbS0 =PATH_PLAST_BUFFER (tb->tb_path);struct buffer_info bi; -struct item_head *pasted; +struct item_head *pasted =item_head (tbS0, tb->item_pos); - pasted =item_head (tbS0, tb->item_pos); -/* when directory, may be new entry already pasted */ -if (is_direntry_le_ih (pasted)) { -if (tb->pos_in_item >=0 && tb->pos_in_item <=ih_entry_count (pasted)) { - -RFALSE (!tb->insert_size[0 ], -"PAP-12260: insert_size is 0 already" ); - -/* prepare space */ -buffer_info_init_tbS0 (tb, &bi); -leaf_paste_in_buffer (&bi, tb->item_pos, tb->pos_in_item, - tb->insert_size[0 ], body, - tb->zeroes_num); - -/* paste entry */ -leaf_paste_entries (&bi, tb->item_pos, tb->pos_in_item,1 , - (struct reiserfs_de_head *)body, - body +DEH_SIZE , - tb->insert_size[0 ]); -if (!tb->item_pos && !tb->pos_in_item) { -RFALSE (!tb->CFL[0 ] || !tb->L[0 ], -"PAP-12270: CFL[0]/L[0] must be specified" ); -if (tb->CFL[0 ]) -replace_key (tb, tb->CFL[0 ], tb->lkey[0 ], tbS0,0 ); - } - tb->insert_size[0 ] =0 ; - } - }else {/* regular object */ -if (tb->pos_in_item ==ih_item_len (pasted)) { - -RFALSE (tb->insert_size[0 ] <=0 , -"PAP-12275: insert size must not be %d" , - tb->insert_size[0 ]); -buffer_info_init_tbS0 (tb, &bi); -leaf_paste_in_buffer (&bi, tb->item_pos, tb->pos_in_item, - tb->insert_size[0 ], body, tb->zeroes_num); - -if (is_indirect_le_ih (pasted)) { -#if 0 -RFALSE (tb-> - insert_size[0 ] != -UNFM_P_SIZE , -"PAP-12280: insert_size for indirect item must be %d, not %d" , -UNFM_P_SIZE , - tb-> - insert_size[0 ]); -#endif -set_ih_free_space (pasted,0 ); - } - tb->insert_size[0 ] =0 ; - } -#ifdef CONFIG_REISERFS_CHECK - else { -if (tb->insert_size[0 ]) { -print_cur_tb ("12285" ); -reiserfs_panic (tb->tb_sb, -"PAP-12285" , -"insert_size " -"must be 0 " -"(%d)" , - tb->insert_size[0 ]); - } - } -#endif /* CONFIG_REISERFS_CHECK */ +/* when directory, may be new entry already pasted */ +if (is_direntry_le_ih (pasted)) { +balance_leaf_finish_node_paste_dirent (tb, ih, body); +return ; + } - } +/* regular object */ + +if (tb->pos_in_item ==ih_item_len (pasted)) { +RFALSE (tb->insert_size[0 ] <=0 , +"PAP-12275: insert size must not be %d" , + tb->insert_size[0 ]); +buffer_info_init_tbS0 (tb, &bi); +leaf_paste_in_buffer (&bi, tb->item_pos, + tb->pos_in_item, tb->insert_size[0 ], body, + tb->zeroes_num); + +if (is_indirect_le_ih (pasted)) +set_ih_free_space (pasted,0 ); + + tb->insert_size[0 ] =0 ; + } +#ifdef CONFIG_REISERFS_CHECK + else if (tb->insert_size[0]) { +print_cur_tb ("12285" ); +reiserfs_panic (tb->tb_sb,"PAP-12285" , +"insert_size must be 0 (%d)" , tb->insert_size[0 ]); + } +#endif }/*
PATCH 29/29 reiserfs: balance_leaf refactor, split up balance_leaf_when_delete
In reply to Jeff MahoneySplut up balance_leaf_when_delete into:balance_leaf_when_delete_delbalance_leaf_when_cutbalance_leaf_when_delete_left
Also reformat to adhere to CodingStyle.
--- fs/reiserfs/do_balan.c | 318 +++++++++++++++++++++++++------------------------ 1 file changed, 163 insertions(+), 155 deletions(-)
fs/reiserfs/do_balan.c +163 -155
@@ -74,6 +74,159 @@ inline void do_balance_mark_leaf_dirty(s* Note that all *num* count new items being created. */ +static void balance_leaf_when_delete_del (struct tree_balance *tb) +{ +struct buffer_head *tbS0 =PATH_PLAST_BUFFER (tb->tb_path); +int item_pos =PATH_LAST_POSITION (tb->tb_path); +struct buffer_info bi; +#ifdef CONFIG_REISERFS_CHECK +struct item_head *ih =item_head (tbS0, item_pos); +#endif + +RFALSE (ih_item_len (ih) +IH_SIZE != -tb->insert_size[0 ], +"vs-12013: mode Delete, insert size %d, ih to be deleted %h" , + -tb->insert_size[0 ], ih); + +buffer_info_init_tbS0 (tb, &bi); +leaf_delete_items (&bi,0 , item_pos,1 ,-1 ); + +if (!item_pos && tb->CFL[0 ]) { +if (B_NR_ITEMS (tbS0)) { +replace_key (tb, tb->CFL[0 ], tb->lkey[0 ], tbS0,0 ); + }else { +if (!PATH_H_POSITION (tb->tb_path,1 )) +replace_key (tb, tb->CFL[0 ], tb->lkey[0 ], +PATH_H_PPARENT (tb->tb_path,0 ),0 ); + } + } + +RFALSE (!item_pos && !tb->CFL[0 ], +"PAP-12020: tb->CFL[0]==%p, tb->L[0]==%p" , tb->CFL[0 ], + tb->L[0 ]); +} + +/* cut item in S[0] */ +static void balance_leaf_when_delete_cut (struct tree_balance *tb) +{ +struct buffer_head *tbS0 =PATH_PLAST_BUFFER (tb->tb_path); +int item_pos =PATH_LAST_POSITION (tb->tb_path); +struct item_head *ih =item_head (tbS0, item_pos); +int pos_in_item = tb->tb_path->pos_in_item; +struct buffer_info bi; +buffer_info_init_tbS0 (tb, &bi); + +if (is_direntry_le_ih (ih)) { +/* +* UFS unlink semantics are such that you can only +* delete one directory entry at a time. +* +* when we cut a directory tb->insert_size[0] means +* number of entries to be cut (always 1) +*/ + tb->insert_size[0 ] =-1 ; +leaf_cut_from_buffer (&bi, item_pos, pos_in_item, + -tb->insert_size[0 ]); + +RFALSE (!item_pos && !pos_in_item && !tb->CFL[0 ], +"PAP-12030: can not change delimiting key. CFL[0]=%p" , + tb->CFL[0 ]); + +if (!item_pos && !pos_in_item && tb->CFL[0 ]) +replace_key (tb, tb->CFL[0 ], tb->lkey[0 ], tbS0,0 ); + }else { +leaf_cut_from_buffer (&bi, item_pos, pos_in_item, + -tb->insert_size[0 ]); + +RFALSE (!ih_item_len (ih), +"PAP-12035: cut must leave non-zero dynamic " +"length of item" ); + } +} + +static int balance_leaf_when_delete_left (struct tree_balance *tb) +{ +struct buffer_head *tbS0 =PATH_PLAST_BUFFER (tb->tb_path); +int n =B_NR_ITEMS (tbS0); + +/* L[0] must be joined with S[0] */ +if (tb->lnum[0 ] ==-1 ) { +/* R[0] must be also joined with S[0] */ +if (tb->rnum[0 ] ==-1 ) { +if (tb->FR[0 ] ==PATH_H_PPARENT (tb->tb_path,0 )) { +/* +* all contents of all the +* 3 buffers will be in L[0] +*/ +if (PATH_H_POSITION (tb->tb_path,1 ) ==0 && +1 <B_NR_ITEMS (tb->FR[0 ])) +replace_key (tb, tb->CFL[0 ], + tb->lkey[0 ], tb->FR[0 ],1 ); + +leaf_move_items (LEAF_FROM_S_TO_L , tb, n,-1 , +NULL ); +leaf_move_items (LEAF_FROM_R_TO_L , tb, +B_NR_ITEMS (tb->R[0 ]),-1 , +NULL ); + +reiserfs_invalidate_buffer (tb, tbS0); +reiserfs_invalidate_buffer (tb, tb->R[0 ]); + +return 0 ; + } + +/* all contents of all the 3 buffers will be in R[0] */ +leaf_move_items (LEAF_FROM_S_TO_R , tb, n,-1 ,NULL ); +leaf_move_items (LEAF_FROM_L_TO_R , tb, +B_NR_ITEMS (tb->L[0 ]),-1 ,NULL ); + +/* right_delimiting_key is correct in R[0] */ +replace_key (tb, tb->CFR[0 ], tb->rkey[0 ], tb->R[0 ],0 ); + +reiserfs_invalidate_buffer (tb, tbS0); +reiserfs_invalidate_buffer (tb, tb->L[0 ]); + +return -1 ; + } + +RFALSE (tb->rnum[0 ] !=0 , +"PAP-12045: rnum must be 0 (%d)" , tb->rnum[0 ]); +/* all contents of L[0] and S[0] will be in L[0] */ +leaf_shift_left (tb, n,-1 ); + +reiserfs_invalidate_buffer (tb, tbS0); + +return 0 ; + } + +/* +* a part of contents of S[0] will be in L[0] and +* the rest part of S[0] will be in R[0] +*/ + +RFALSE ((tb->lnum[0 ] + tb->rnum[0 ] < n) || + (tb->lnum[0 ] + tb->rnum[0 ] > n +1 ), +"PAP-12050: rnum(%d) and lnum(%d) and item " +"number(%d) in S[0] are not consistent" , + tb->rnum[0 ], tb->lnum[0 ], n); +RFALSE ((tb->lnum[0 ] + tb->rnum[0 ] == n) && + (tb->lbytes !=-1 || tb->rbytes !=-1 ), +"PAP-12055: bad rbytes (%d)/lbytes (%d) " +"parameters when items are not split" , + tb->rbytes, tb->lbytes); +RFALSE ((tb->lnum[0 ] + tb->rnum[0 ] == n +1 ) && + (tb->lbytes <1 || tb->rbytes !=-1 ), +"PAP-12060: bad rbytes (%d)/lbytes (%d) " +"parameters when items are split" , + tb->rbytes, tb->lbytes); + +leaf_shift_left (tb, tb->lnum[0 ], tb->lbytes); +leaf_shift_right (tb, tb->rnum[0 ], tb->rbytes); + +reiserfs_invalidate_buffer (tb, tbS0); + +return 0 ; +} +/* * Balance leaf node in case of delete or cut: insert_size[0] < 0 *
@@ -87,7 +240,6 @@ static int balance_leaf_when_delete(stru {struct buffer_head *tbS0 =PATH_PLAST_BUFFER (tb->tb_path);int item_pos =PATH_LAST_POSITION (tb->tb_path); -int pos_in_item = tb->tb_path->pos_in_item;struct buffer_info bi;int n;struct item_head *ih;
@@ -104,166 +256,23 @@ static int balance_leaf_when_delete(stru/* Delete or truncate the item */ -switch (flag) { -case M_DELETE :/* delete item in S[0] */ - -RFALSE (ih_item_len (ih) +IH_SIZE != -tb->insert_size[0 ], -"vs-12013: mode Delete, insert size %d, ih to be deleted %h" , - -tb->insert_size[0 ], ih); - -leaf_delete_items (&bi,0 , item_pos,1 ,-1 ); - -if (!item_pos && tb->CFL[0 ]) { -if (B_NR_ITEMS (tbS0)) { -replace_key (tb, tb->CFL[0 ], tb->lkey[0 ], tbS0, -0 ); - }else { -if (!PATH_H_POSITION (tb->tb_path,1 )) -replace_key (tb, tb->CFL[0 ], tb->lkey[0 ], -PATH_H_PPARENT (tb->tb_path, -0 ),0 ); - } - } - -RFALSE (!item_pos && !tb->CFL[0 ], -"PAP-12020: tb->CFL[0]==%p, tb->L[0]==%p" , tb->CFL[0 ], - tb->L[0 ]); - -break ; - -case M_CUT :{/* cut item in S[0] */ -if (is_direntry_le_ih (ih)) { - -/* -* UFS unlink semantics are such that you -* can only delete one directory entry at -* a time. -*/ - -/* -* when we cut a directory tb->insert_size[0] -* means number of entries to be cut (always 1) -*/ - tb->insert_size[0 ] =-1 ; -leaf_cut_from_buffer (&bi, item_pos, pos_in_item, - -tb->insert_size[0 ]); - -RFALSE (!item_pos && !pos_in_item && !tb->CFL[0 ], -"PAP-12030: can not change delimiting key. CFL[0]=%p" , - tb->CFL[0 ]); - -if (!item_pos && !pos_in_item && tb->CFL[0 ]) { -replace_key (tb, tb->CFL[0 ], tb->lkey[0 ], - tbS0,0 ); - } - }else { -leaf_cut_from_buffer (&bi, item_pos, pos_in_item, - -tb->insert_size[0 ]); - -RFALSE (!ih_item_len (ih), -"PAP-12035: cut must leave non-zero dynamic length of item" ); - } -break ; - } +BUG_ON (flag !=M_DELETE && flag !=M_CUT ); +if (flag ==M_DELETE ) +balance_leaf_when_delete_del (tb); +else /* M_CUT */ +balance_leaf_when_delete_cut (tb); -default : -print_cur_tb ("12040" ); -reiserfs_panic (tb->tb_sb,"PAP-12040" , -"unexpected mode: %s(%d)" , - (flag == -M_PASTE ) ?"PASTE" : ((flag == -M_INSERT ) ?"INSERT" : -"UNKNOWN" ), flag); - }/* * the rule is that no shifting occurs unless by shifting * a node can be freed */ n =B_NR_ITEMS (tbS0); -/* L[0] takes part in balancing */ -if (tb->lnum[0 ]) { -/* L[0] must be joined with S[0] */ -if (tb->lnum[0 ] ==-1 ) { -/* R[0] must be also joined with S[0] */ -if (tb->rnum[0 ] ==-1 ) { -if (tb->FR[0 ] ==PATH_H_PPARENT (tb->tb_path,0 )) { -/* -* all contents of all the 3 buffers -* will be in L[0] -*/ -if (PATH_H_POSITION (tb->tb_path,1 ) ==0 - &&1 <B_NR_ITEMS (tb->FR[0 ])) -replace_key (tb, tb->CFL[0 ], - tb->lkey[0 ], - tb->FR[0 ],1 ); - -leaf_move_items (LEAF_FROM_S_TO_L , tb, n, --1 ,NULL ); -leaf_move_items (LEAF_FROM_R_TO_L , tb, -B_NR_ITEMS (tb->R[0 ]), --1 ,NULL ); - -reiserfs_invalidate_buffer (tb, tbS0); -reiserfs_invalidate_buffer (tb, - tb->R[0 ]); - -return 0 ; - } -/* -* all contents of all the 3 buffers will -* be in R[0] -*/ -leaf_move_items (LEAF_FROM_S_TO_R , tb, n,-1 , -NULL ); -leaf_move_items (LEAF_FROM_L_TO_R , tb, -B_NR_ITEMS (tb->L[0 ]),-1 ,NULL ); -/* right_delimiting_key is correct in R[0] */ -replace_key (tb, tb->CFR[0 ], tb->rkey[0 ], - tb->R[0 ],0 ); -reiserfs_invalidate_buffer (tb, tbS0); -reiserfs_invalidate_buffer (tb, tb->L[0 ]); - -return -1 ; - } - -RFALSE (tb->rnum[0 ] !=0 , -"PAP-12045: rnum must be 0 (%d)" , tb->rnum[0 ]); -/* all contents of L[0] and S[0] will be in L[0] */ -leaf_shift_left (tb, n,-1 ); - -reiserfs_invalidate_buffer (tb, tbS0); - -return 0 ; - } - -/* -* a part of contents of S[0] will be in L[0] and the -* rest part of S[0] will be in R[0] -*/ - -RFALSE ((tb->lnum[0 ] + tb->rnum[0 ] < n) || - (tb->lnum[0 ] + tb->rnum[0 ] > n +1 ), -"PAP-12050: rnum(%d) and lnum(%d) and item number(%d) in S[0] are not consistent" , - tb->rnum[0 ], tb->lnum[0 ], n); -RFALSE ((tb->lnum[0 ] + tb->rnum[0 ] == n) && - (tb->lbytes !=-1 || tb->rbytes !=-1 ), -"PAP-12055: bad rbytes (%d)/lbytes (%d) parameters when items are not split" , - tb->rbytes, tb->lbytes); -RFALSE ((tb->lnum[0 ] + tb->rnum[0 ] == n +1 ) && - (tb->lbytes <1 || tb->rbytes !=-1 ), -"PAP-12060: bad rbytes (%d)/lbytes (%d) parameters when items are split" , - tb->rbytes, tb->lbytes); - -leaf_shift_left (tb, tb->lnum[0 ], tb->lbytes); -leaf_shift_right (tb, tb->rnum[0 ], tb->rbytes); - -reiserfs_invalidate_buffer (tb, tbS0); - -return 0 ; - } +/* L[0] takes part in balancing */ +if (tb->lnum[0 ]) +return balance_leaf_when_delete_left (tb);if (tb->rnum[0 ] ==-1 ) {/* all contents of R[0] and S[0] will be in R[0] */
@@ -1880,9 +1889,8 @@ void do_balance(struct tree_balance *tb,/* Balance internal level of the tree. */ for (h =1 ; h <MAX_HEIGHT && tb->insert_size[h]; h++) - child_pos = -balance_internal (tb, h, child_pos, insert_key, insert_ptr); + child_pos =balance_internal (tb, h, child_pos, insert_key, + insert_ptr);do_balance_completed (tb); - }
Hello Jeff,
Could you update the source in obs as well. openSUSE Build Service > Projects > filesystems > reiserfs
https://build.opensuse.org/package/show/filesystems/reiserfs
logged https://bugzilla.novell.com/show_bug.cgi?id=875332
Thanks Glenn
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Quoted 5 lines · On 4/25/14, 11:46 PM, [email protected] wrote:
Hello Jeff, Could you update the source in obs as well. openSUSE Build Service > Projects > filesystems > reiserfs
https://build.opensuse.org/package/show/filesystems/reiserfs
Hi Glenn -
This patch set is against the kernel, not reiserfsprogs. Also, since there's no functional changes introduced in the patchset (except for the workqueue changes), there's no sense in carrying them separately.
- -Jeff
- --
Jeff Mahoney
SUSE Labs
-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.22 (Darwin)
iQIcBAEBAgAGBQJTW804AAoJEB57S2MheeWyvS0P/A56ymCg2kIzCgtzdY54/mLE JTZLjZJ6ZDB19FJ+UXWvHkQqbsz+1P1/zGCjhGukBlOe8/3DpKi8IEL3xIxh846k 822OuRfNGKhI0EBitiEDVruNKHbN+K+8Ui/yp6K+3/A882/SspsW0jEFtM9V4QAc 2AIXEMRI5GXSAm6d/nf76MeyxUmJMZUHnLAwaQ8vrPmuFTAZCEM8edOYWHkRI8Jh oVRNQkJeooNXxUiFYtWzaF9VPHJzPf+vHkTXRcrSjBk7p2P3V8aAEqG9gX+A6X13 1tMpDyDBGzjqSJDXMHTo0OueZpkGZ7WKAfY1ZXg+YlNUH0LJJWBlzaUpSauumho/ /IeLIB2w+8Bx8WQOo3wxQRz0McMtn+tD+8OQ+X2MSdXj/k5VJKbDodxntB2zwKes VsoZMvVAhgoF9vteVEYFOSfrTEf714W6GQpa8XWKDc8wRd0ZY/n3/ZAhocpjnj2A SAIBvXJ8YEifcAWPswLx4J6DSzKj+oIhwX5aNxxQDSpzms13qapUCxNR439fkHKH gKQK7+RIeSjQ/TQoOc80xO9auPmanB0CVBqBgJhe46oo4xyMDEQGEFflNDK0ZifR sBljbH8NdOmGCZpbPE6qiOD5rNvUQZagAsd3OD5uRhSlLGrupr+mn9Bflss5EwSm 95aqhs5mbOSNR6LPxB2k
=Bwqc
-----END PGP SIGNATURE-----
Quoted 16 lines · Jeff Mahoney
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1Quoted 5 lines · On 4/25/14, 11:46 PM, [email protected] wrote:
Hello Jeff, Could you update the source in obs as well. openSUSE Build Service > Projects > filesystems > reiserfs
https://build.opensuse.org/package/show/filesystems/reiserfsHi Glenn -
This patch set is against the kernel, not reiserfsprogs. Also, since there's no functional changes introduced in the patchset (except for the workqueue changes), there's no sense in carrying them separately.
Quoted 5 lines
- -Jeff
- --
Jeff Mahoney
SUSE Labs
Hello,
Thanks Jeff.
Is there a built kernel rpm with these 29 patches in it on opensuse factory or obs
[patch 00/29] reiserfs cleanup patchset
http://www.spinics.net/lists/reiserfs-devel/msg03814.html
As mentioned This patch set is against the kernel
If so , have you a link to it ?
If not could it be made available ?
Thanks
--Glenn
Quoted 11 lines · On Fri, 16 May 2014 20:47:37 +1000, <[email protected]> wrote:
Quoted 10 lines · Jeff Mahoney
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1Quoted 5 lines · On 4/25/14, 11:46 PM, [email protected] wrote:
Hello Jeff, Could you update the source in obs as well. openSUSE Build Service > Projects > filesystems > reiserfs
https://build.opensuse.org/package/show/filesystems/reiserfs
Quoted 8 lines
Quoted 8 lines
Hi Glenn -
This patch set is against the kernel, not reiserfsprogs. Also, since there's no functional changes introduced in the patchset (except for the workqueue changes), there's no sense in carrying them separately.
- -Jeff
Hello Jeff,
Where can I find a compiled rpms with this [patch 00/29] reiserfs cleanup patchset included ? [in https://build.opensuse.org/]
Thanks Glenn
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Quoted 20 lines · On 5/22/14, 4:24 AM, [email protected] wrote:
Quoted 18 lines · On Fri, 16 May 2014 20:47:37 +1000, <[email protected]> wrote:
Quoted 16 lines · Jeff Mahoney
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Quoted 5 lines · On 4/25/14, 11:46 PM, [email protected] wrote:
Hello Jeff, Could you update the source in obs as well. openSUSE Build Service > Projects > filesystems > reiserfs
https://build.opensuse.org/package/show/filesystems/reiserfsHi Glenn -
This patch set is against the kernel, not reiserfsprogs. Also, since there's no functional changes introduced in the patchset (except for the workqueue changes), there's no sense in carrying them separately.
Quoted 5 lines
Quoted 2 lines
Quoted 2 lines
- -Jeff
Hello Jeff, Where can I find a compiled rpms with this [patch 00/29] reiserfs cleanup patchset included ? [in
https://build.opensuse.org/]
Hi Glenn -
I haven't put together a built kernel with them and don't really have the time to do so.
- -Jeff
- --
Jeff Mahoney
SUSE Labs
-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.22 (Darwin)
iQIcBAEBAgAGBQJTfgD6AAoJEB57S2MheeWyIjwP/jQGrnjpbTqOr7gRRa41n2fw VkHc82sOx0C8+Q7BDeY+0v9BLiw5aCcmJKZFQrUZSGKx2fLB8Jmo0ZO1I7WpZP9F TH/vDgEdzqVENrQuZAVqQXiisNK7qjIMg2IhM+Hn0zYiFW5J0G0gsjgYvYEAlJAo TFqMJWywI+QW7ODwuljin4BDpkhkWmT707lIZFGOGba/MYYdprF5YvfW/RiZ7ruV tPBGlfcQQlCK6IuEeyUXd8AoxS3uFonwBWQgcSm+JBPZY2ekwQxCCY7vznoOunG5 vrdfestyEZxoBzhHUpe1ynjMcy7SexA0U7VTBeLXcqouT5s1aS9Vfr6Kqj892IZM d8cFhvlHO3Gkm10qBxOsFSjH9AHG238LijMANbU5Tur5ECJ0BjEu9GCNWEVBi9TW oZUHWlRlq95JS8cP+sF1pi/sBbCM7wCa5OTEmHDadEVFCLGYCmojLiC9mKm33M+Z wHFFZEVqnomhhlexL2Ohtc0NXQUWnXEATiWTboWrWRSkVCSJlwLtVSRMTfUNUlPr ZmaTTvX+0LdsIHQVhZQS6uUYDfuDMCCExWuV/mCI3CGqxsjYMVYQWUj/WJgUWTQl BNwWXdPcg7SIAMDTD1hG+TyTx5BnA8GxDYcxyZiyPDmcGkKhqjh4jV3H/FsDccGO OxSlldQkv2j9HMxpXdVl
=kZaq
-----END PGP SIGNATURE-----
Quoted 32 lines · Jeff Mahoney
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1Quoted 20 lines · On 5/22/14, 4:24 AM, [email protected] wrote:
Quoted 18 lines · On Fri, 16 May 2014 20:47:37 +1000, <[email protected]> wrote:
Quoted 16 lines · Jeff Mahoney
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Quoted 5 lines · On 4/25/14, 11:46 PM, [email protected] wrote:
Hello Jeff, Could you update the source in obs as well. openSUSE Build Service > Projects > filesystems > reiserfs
https://build.opensuse.org/package/show/filesystems/reiserfsHi Glenn -
This patch set is against the kernel, not reiserfsprogs. Also, since there's no functional changes introduced in the patchset (except for the workqueue changes), there's no sense in carrying them separately.
Quoted 5 lines
Quoted 2 lines
Quoted 2 lines
- -Jeff
Hello Jeff, Where can I find a compiled rpms with this [patch 00/29] reiserfs cleanup patchset included ? [in
https://build.opensuse.org/]Hi Glenn -
Quoted 7 lines
I haven't put together a built kernel with them and don't really have the time to do so.
- -Jeff
- --
Jeff Mahoney
Hello Jeff,
As you mentioned that 'This patch set is against the kernel.'
Question:
Would the following method work to apply patches ? [in a Branch a copy of Kernel:stable/kernel-vanilla -obs]
- Branch a copy of Kernel:stable/kernel-vanilla
- Add patches to patches.rpmify.tar.bz2 patches.rpmify/[patch name]
- Add these lines to series.conf example:
######################################################## # Reiserfs Patches ######################################################## patches.rpmify/01-29-use per-fs commit workqueues.patch
..
patches.rpmify/29-29-balance_leaf refactor split up
balance_leaf_when_delete.patch
Cheers Glenn
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Quoted 11 lines · On 5/26/14, 12:12 AM, [email protected] wrote:
Quoted 9 lines · Jeff Mahoney
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Quoted 6 lines · On 5/22/14, 4:24 AM, [email protected] wrote:
Quoted 4 lines · On Fri, 16 May 2014 20:47:37 +1000, <[email protected]> wrote:
Quoted 2 lines · Jeff Mahoney
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines · On 4/25/14, 11:46 PM, [email protected] wrote:
Quoted 7 lines
Hello Jeff, Could you update the source in obs as well. openSUSE Build Service > Projects > filesystems > reiserfs
https://build.opensuse.org/package/show/filesystems/reiserfs
logged https://bugzilla.novell.com/show_bug.cgi?id=875332
Quoted 33 lines
Quoted 14 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Hi Glenn -
This patch set is against the kernel, not reiserfsprogs. Also, since there's no functional changes introduced in the patchset (except for the workqueue changes), there's no sense in carrying them separately.
Quoted 5 lines
Quoted 2 lines
Quoted 2 lines
- -Jeff
Hello Jeff, Where can I find a compiled rpms with this [patch 00/29] reiserfs cleanup patchset included ? [in
https://build.opensuse.org/]Quoted 8 lines
Hi Glenn -
I haven't put together a built kernel with them and don't really have the time to do so.
- -Jeff
- -- Jeff Mahoney
Hello Jeff, As you mentioned that 'This patch set is against the kernel.'
Question: Would the following method work to apply patches ? [in a Branch a copy of Kernel:stable/kernel-vanilla -obs]
- Branch a copy of Kernel:stable/kernel-vanilla - Add patches to patches.rpmify.tar.bz2 patches.rpmify/[patch name] - Add these lines to series.conf example:
Quoted 7 lines
######################################################## # Reiserfs Patches ########################################################
patches.rpmify/01-29-use per-fs commit workqueues.patch .. patches.rpmify/29-29-balance_leaf refactor split up balance_leaf_when_delete.patch
Yep, that should work.
- -Jeff
- --
Jeff Mahoney
SUSE Labs
-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.22 (Darwin)
iQIcBAEBAgAGBQJTg4bSAAoJEB57S2MheeWyT+cP/R4JQVDmdkTjNkylTfb0mkOR x0E55RZKTrL/+RGpDQ3Bv3U0mzZoW9oVaapv8RRndrTuOPHM/kMa+Lxsi80KHoeI 4ttLiEhryxR5xpttJfkyGL/I0AOinA2298pxymfn8pZvRJU+dLXyi9BgG9JVowRf wK1Ji1xBPJj6YMmPe0qokt1cp5keQ6REsDOYR2BtTIpTcbz75NPTtDGCzllUZP/o 9iS/7+gX3dwFKyCQHgzoO6KX8hAaCcB/0+xEP/byRUpLSVjmToeo5d4zD36AKLPG t/dy5vpwDUKVQsB/ogZTcoX7vIxBWINuYqpJMWYDkLDRQrSSVHbZmm5t9eemr1Ml MxrQf7qnMNZ2ByA33g74OjEygxT6xLazm5DmzbXkxzhBXK/z70Cb1ONOA9B5qLQf gq7AkdJ/zQTfYUtWn6UiBMjR2KzRSkw1NZn9wHXSfI+b9XIhJ4Oh7kadG5eu5mXg 2lx+ufsal61Rfse4For7TG8KE72jMFw0OG/ZVinaQauw0vOkIaK6H8e4djhD0K0H iGGj0pqxTuQwyDFUFwEMnT2Be8jqaDA+q6bF4NPxAEq43XRnQVVuni68nV7JsqmV z8baCA0fgWfuAD2tMF8tpnAtvh5e+vTKjwCzkMzBPOrxT0L+D+E1t0YO91kRVFWu LlXHfndmNFuOIu/Qg43i
=ye8Q
-----END PGP SIGNATURE-----
Quoted 30 lines · Jeff Mahoney
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1Quoted 20 lines · On 5/22/14, 4:24 AM, [email protected] wrote:
Quoted 18 lines · On Fri, 16 May 2014 20:47:37 +1000, <[email protected]> wrote:
Quoted 16 lines · Jeff Mahoney
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Quoted 5 lines · On 4/25/14, 11:46 PM, [email protected] wrote:
Hello Jeff, Could you update the source in obs as well. openSUSE Build Service > Projects > filesystems > reiserfs
https://build.opensuse.org/package/show/filesystems/reiserfsHi Glenn -
This patch set is against the kernel, not reiserfsprogs. Also, since there's no functional changes introduced in the patchset (except for the workqueue changes), there's no sense in carrying them separately.
Quoted 5 lines
Quoted 2 lines
Quoted 2 lines
- -Jeff
Hello Jeff, Where can I find a compiled rpms with this [patch 00/29] reiserfs cleanup patchset included ? [in
https://build.opensuse.org/]
Quoted 7 lines
Hi Glenn -
I haven't put together a built kernel with them and don't really have the time to do so.
- -Jeff
Hello Jeff,
Just to let you know I raised this service request.
https://bugzilla.novell.com/show_bug.cgi?id=882480
The patches 01-29 are included in the attachment [patches.rpmify.tar.bz2]to the request.
Hope it shortens the time frame a little and is of use.
Cheers Glenn
--Glenn
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Quoted 11 lines · On 6/12/14, 10:31 AM, [email protected] wrote:
Quoted 9 lines · Jeff Mahoney
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Quoted 6 lines · On 5/22/14, 4:24 AM, [email protected] wrote:
Quoted 4 lines · On Fri, 16 May 2014 20:47:37 +1000, <[email protected]> wrote:
Quoted 2 lines · Jeff Mahoney
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines · On 4/25/14, 11:46 PM, [email protected] wrote:
Quoted 7 lines
Hello Jeff, Could you update the source in obs as well. openSUSE Build Service > Projects > filesystems > reiserfs
https://build.opensuse.org/package/show/filesystems/reiserfs
logged https://bugzilla.novell.com/show_bug.cgi?id=875332
Quoted 19 lines
Quoted 19 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Hi Glenn -
This patch set is against the kernel, not reiserfsprogs. Also, since there's no functional changes introduced in the patchset (except for the workqueue changes), there's no sense in carrying them separately.
Quoted 5 lines
Quoted 2 lines
Quoted 2 lines
- -Jeff
Hello Jeff, Where can I find a compiled rpms with this [patch 00/29] reiserfs cleanup patchset included ? [in
https://build.opensuse.org/]Hi Glenn -
I haven't put together a built kernel with them and don't really have the time to do so.
Quoted 8 lines
Quoted 2 lines
- -Jeff
Hello Jeff, Just to let you know I raised this service request.
https://bugzilla.novell.com/show_bug.cgi?id=882480The patches 01-29 are included in the attachment [patches.rpmify.tar.bz2]to the request. Hope it shortens the time frame a little and is of use.
Glenn, for the same reason I declined to add them previously, I'm not going to add them to Factory. They'll get pulled in automatically via the next upstream kernel update.
- -Jeff
- --
Jeff Mahoney
SUSE Labs
-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.19 (Darwin)
iQIcBAEBAgAGBQJTmbtuAAoJEB57S2MheeWynOEQAKVBOn9RzXcXhSqe7oLdz/EU Ck7veSqnAZTZt4z3rOBQqrylS2Q4B1y93Hw5Iwmg89NWp/7oVQ7EPg/tmpiYlH92 p4LzaaOwO/jb/e4Xd7cGrsbTFmXEm2Kj6ZNARYpC9fPr+/lMr8jWqEzMaE9M21io mNdoGxrEyDegHoktDo5BkY8tTLXK/OI8bFsZVlP9gmvXZc+AMDJnVMDUMYTW48rb ms8AiMoCFJ3Sdlec7fz4Z46kXN+Fk0fpeCidM/UjD0mA7+A6FEPhmVDwPVqhLdQY rYiN+HbzKR+Atm63oT2X1FLPcE66NgQkOw6/hmm1qPPLxbqekuIveYMClan8QBZF C4MHYT4OulDIvZBLGDUQA+EtluF7Po9IDivjHjt+0WNge5+dvmhAVmxEXXTAjXwk kehkCIQYDeTsVoRV5hQUvHhAuLrnjTAIJOi97CUZ1ZO3LOQyr42Qe+oha6zIHHqV lWXzk6vQX9u1EYB9OGLIqgARJXpfNV7/I1LN++a0Tg4wDBOqbk5ia4BGW0wN0f+S ld5vWJ8fu4kLo2sgOVcOurbqQbKDPN/ymi2zMWtw9NJLqRFCYIxBDmmL70W7b+Zc /RYnD2zQzrUn2JntNIy10hwRUAS7UtbL+kalrmry1dGRUdiuZtayP7QJZ5U9OaTP VXxmAxEb93Ql63WOaG9a
=DS+w
-----END PGP SIGNATURE-----
Quoted 8 lines
Glenn, for the same reason I declined to add them previously, I'm not going to add them to Factory. They'll get pulled in automatically via the next upstream kernel update.
- -Jeff
Hello,
Re:They'll get pulled in automatically via the next upstream kernel update.
Question:
So will the patches come down with say kernel-vanilla-3.15.0x
Example: Kernel:stable > kernel-vanilla > Build Log
[ 433s] build: extracting built packages... [ 465s] RPMS/x86_64/kernel-vanilla-3.15.0-1.1.g9194b64.x86_64.rpm [ 465s] RPMS/x86_64/kernel-vanilla-devel-3.15.0-1.1.g9194b64.x86_64.rpm [ 465s] SRPMS/pesign-repackage-1.0-1.1.src.rpm [ 465s] SRPMS/kernel-vanilla-3.15.0-1.1.g9194b64.nosrc.rpm
Cheers Glenn
I see in factory
http://ftp5.gwdg.de/pub/opensuse/factory/repo/oss/suse/x86_64/kernel-desktop-3.15.rc7-1.2.x86_64.rpm
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Quoted 25 lines · On 6/13/14, 12:20 AM, [email protected] wrote:
Quoted 8 lines
Glenn, for the same reason I declined to add them previously, I'm not going to add them to Factory. They'll get pulled in automatically via the next upstream kernel update.
- -Jeff
Hello,
Re:They'll get pulled in automatically via the next upstream kernel update.
Question: So will the patches come down with say kernel-vanilla-3.15.0x Example: Kernel:stable > kernel-vanilla > Build Log
[ 433s] build: extracting built packages... [ 465s] RPMS/x86_64/kernel-vanilla-3.15.0-1.1.g9194b64.x86_64.rpm [ 465s] RPMS/x86_64/kernel-vanilla-devel-3.15.0-1.1.g9194b64.x86_64.rpm [ 465s] SRPMS/pesign-repackage-1.0-1.1.src.rpm [ 465s] SRPMS/kernel-vanilla-3.15.0-1.1.g9194b64.nosrc.rpm
Quoted 6 lines
Cheers Glenn
I see in factory
http://ftp5.gwdg.de/pub/opensuse/factory/repo/oss/suse/x86_64/kernel-desktop-3.15.rc7-1.2.x86_64.rpm
No, it'll be 3.16 at least.
- -Jeff
- --
Jeff Mahoney
SUSE Labs
-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.22 (Darwin)
iQIcBAEBAgAGBQJTmn1WAAoJEB57S2MheeWyRL8P/3Rt8rK7tYFDfLlyPXQQchD/ Ur1zBlgX8zlQS8Qu1cTyMeHyHeuXBtHUJC1xzturnPu0EHvOMLgNxlEPdsSmY2Jw QqvRud2JV5WErEHRhtOdB9ZAOWq/Tqsm5RvybivonB0oWa0LyYeUoiM3sM3Z9Mqu JWlGDNOqTHGdHmDAFSRhU/HlT9wGaq6MOMS9433TtIK1q2Krag9jatTkeChT02lO pUYjYPVSSGPCBy6dt0TOreKApR5LXcUqzQYJ4yKqlcPGzE0CgJLvzqP9YV8AHpFW Vgn7vJ5DG+QTWce2D/02m+ZPVyxY5mVn3dDQbXra4JBP0hUpevnjD5APWdwX6F+9 GoGcIzlnDXe9EJXdvn/ao+bfD5d5mzKLvBrnLOHBliwUUZHI2nYsOMgDSALRxS+S E2hNC9XSd5u7Y7sX/9qH5lBC9LiI3zTKJfeKgPDTP/tJKHP7RLE5hW3QE2uzW0QA vkbyM8jxOUzU9lnqCyWvdfqX+xqiyo4+9uJ7NeJHtyZQHey3HRFLQCTGbBUtQqBz xRdEwWgMv4JkdIY/53WdpO0JPgrYZOGyXiZ1fStCyE4jeVp9t+D0KGTVur7cfM3l s9yMg2Gqac0JUOjbIOIVgpNZBb2/vH22l2MZCHT+FHWHfASsuuE2/AtuNeDC3q3u bEBUDfdMwgqliu+elrab
=9k6s
-----END PGP SIGNATURE-----
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Quoted 27 lines · Jeff Mahoney
Quoted 23 lines · On 6/13/14, 12:20 AM, [email protected] wrote:
Quoted 7 lines
Glenn, for the same reason I declined to add them previously, I'm not going to add them to Factory. They'll get pulled in automatically via the next upstream kernel update.
- -Jeff
Hello,
Re:They'll get pulled in automatically via the next upstream kernel update.
Question: So will the patches come down with say kernel-vanilla-3.15.0x Example: Kernel:stable > kernel-vanilla > Build Log
[ 433s] build: extracting built packages... [ 465s] RPMS/x86_64/kernel-vanilla-3.15.0-1.1.g9194b64.x86_64.rpm [ 465s] RPMS/x86_64/kernel-vanilla-devel-3.15.0-1.1.g9194b64.x86_64.rpm [ 465s] SRPMS/pesign-repackage-1.0-1.1.src.rpm [ 465s] SRPMS/kernel-vanilla-3.15.0-1.1.g9194b64.nosrc.rpm
Quoted 8 lines
Quoted 6 lines
Cheers Glenn
I see in factory
http://ftp5.gwdg.de/pub/opensuse/factory/repo/oss/suse/x86_64/kernel-desktop-3.15.rc7-1.2.x86_64.rpmNo, it'll be 3.16 at least.
The patchset landed in 3.16-rc1.
- -Jeff
- --
Jeff Mahoney
SUSE Labs
-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.19 (Darwin)
iQIcBAEBAgAGBQJTmxQtAAoJEB57S2MheeWyHnYQAMG/hy5QF4vuvyBMrlaswIvi 4CPPGWumaRcxHqO4MDDs0LJCP/JbcBupzBkBo3wFF/AU6gqDXkDCV23rfZ7fv+iz bazdiPqjpinTBnRm8AdiaQ4cRfejVPwjYufconoez/wI8YOflEPywE14iMrTZ0aL cIL9i/AkoIbZXY8gXVZ+r567w6TRpPIrIiEeZz1gb+lzqce5jRPkl5BD6oo5TdPi 7eJrG9pdgjZ0+yTykdnR6KIzSD7o99oG6vWcP6P1XAFCcJdBh93jq5S4PqRWS7Vq JgjezpQl+rkBb+9WwBzho1BayYsIdu6OE7xtWJ5GBGL7goa9XPE8sh9Vl9vqPmgp qQFKTxzbTTq29HX7oJ+uqxqHEcYaju5xEw4cS94M1GV+GKZ+gEhDntepc4ahfHET PtnJtx6lE4JqQROyw9KVxmdR1uWTzsNhfaQIHQfuas4s4vhGgsvxg4Gjl1BJ1S/L 87VjexdasV+NQbxP6orPvwW6arAAQCLRxdlZfmJvSUf1QXe6+pwDS1GwZNWfNfe3 UU/jRbOkKX1jNKhclS9Sa+NOq+QguMRehuzBtCCNCmlhcPXnQEG0O0U6xZbfvg4H VCQMnGvC4/2UgF8VhjifwJjJVf3jVgltp1fJyMHy+YoQgfoPYpFqu8K9nbpuwtcB M4YjXHdtgbvXam8GWkdF
=n3g4
-----END PGP SIGNATURE-----
Quoted 13 lines · Jeff Mahoney
Hi all -
I've had this patchset kicking around for a while. After a conversation this past week about code that was horrible to read (using reiserfs's
balance_leafas the primary example) and seeing that Dave Jones had scratched a bit of an itch, I decided it was time to resync and push it out so I don't have to update it forever.BTW, as I'm basically the only person with substantial patches against reiserfs, I'm 100% ok with disrupting context to this extent. :)
This set consists of 29 patches in a few areas.
Quoted 16 lines
1 - Convert the commit workqueue to a per-fs workqueue
2 - Clean up ugly accessor macros to use more readable names
3 - Clean up comments to use the normal kernel style
4 - Remove the unused nblocks argument fromjournal_end
5 - Remove superblock argument fromjournal_end(it's in the trans handle) 6 - Remove superblock argument fromjournal_mark_dirty(see #5) 7 - Remove blocks argument fromjournal_join(it's always 1)
8 - Remove leading whitespace from labels
9 - Remove unnecessary parents
10 - Clean up dirent creation
11 - Clean up hash detection
12-29 - Clean upbalance_leaf- This 2500-line function goes through
6 easily distinguishable stages, each with several sub-parts. The patch set splits up the stages and then reformats them to keep the split as obvious as possible. The final result is a whole lot easier to follow and easier on the eyes.
OK, I have merged all the patches into my tree.
Honza
Signature · 2 lines
Jan Kara <[email protected]> SUSE Labs, CR
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Quoted 30 lines · Jan Kara
Quoted 15 lines · Jeff Mahoney
Hi all -
I've had this patchset kicking around for a while. After a conversation this past week about code that was horrible to read (using reiserfs's
balance_leafas the primary example) and seeing that Dave Jones had scratched a bit of an itch, I decided it was time to resync and push it out so I don't have to update it forever.BTW, as I'm basically the only person with substantial patches against reiserfs, I'm 100% ok with disrupting context to this extent. :)
This set consists of 29 patches in a few areas.
Quoted 14 lines
1 - Convert the commit workqueue to a per-fs workqueue 2 - Clean up ugly accessor macros to use more readable names 3 - Clean up comments to use the normal kernel style 4 - Remove the unused nblocks argument from
journal_end5 - Remove superblock argument fromjournal_end(it's in the trans handle) 6 - Remove superblock argument fromjournal_mark_dirty(see #5) 7 - Remove blocks argument fromjournal_join(it's always 1) 8 - Remove leading whitespace from labels 9 - Remove unnecessary parents 10 - Clean up dirent creation 11 - Clean up hash detection 12-29 - Clean upbalance_leaf- This 2500-line function goes through 6 easily distinguishable stages, each with several sub-parts. The patch set splits up the stages and then reformats them to keep the split as obvious as possible. The final result is a whole lot easier to follow and easier on the eyes.
Quoted 2 lines
OK, I have merged all the patches into my tree.
Great, thanks!
- -Jeff
- --
Jeff Mahoney
SUSE Labs
-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.22 (Darwin)
iQIcBAEBAgAGBQJTcikBAAoJEB57S2MheeWy65oQAMJhBwLHNvuc11LEebg1049p XX7o32ltQ22T7ER6YR4+IynNTe0XlJ8a/QtpuCiu3qWBdmHR47b+iVuN8Eu0Z3IY qZMPx7jkJXVPAECF9/CWTh3YJ/HB9QkL1zp5BNfihQvXUmYs+wbHuQGHR0jh4vYH Qj9kxoH76/eQMHnxIFSy1EEeGI3zjBscBM4qvjBZ3ahTiq0WV6xu6ru70Tue0fFv ST2JjyGGAdJ/IpCUBnc10AzHqMNmEpRE7l5ama2mIV/cvNokvxTHwiycuYVz3p1m wRE2IfSJ84Xue8mO57R3TXkgitz2WCIdah67x5oJtyHJUYq61MYcgnEr0SJSAJzr KhO34qrJ2bQSVKnWwHrwnm+fbEBmcmkA25zNqaLNwJfS1y58M+GwxbYriarnZqgE ndu1jB1m7o2vpDCxox+60MhAe5am4tfn95u8WvIuSLOyq3bo/WNZZpRlqL8xfm3+ 5XOd+0jdQp3aIwofnt9QGOBZS5OFGnSR3yya1xuJ4KOv4bjbAKSLat4Tv62/VoFm bYcEA7jV1TtzfgjvR2dA8M70fx1fKY0wntm7XupP5d4Y1BYIK4gbwrhTEc0Z2WNG WSpnxRqOZTvV0E6sGNyYJYVWEkA2MplqeI3X7NeT8UN5/XmgaRsfB7OjJLk0gjN7 rWunXLnovNfP8AWkOS3I
=wYZx
-----END PGP SIGNATURE-----
Quoted 11 lines · Jeff Mahoney
Hi all -
I've had this patchset kicking around for a while. After a conversation this past week about code that was horrible to read (using reiserfs's
balance_leafas the primary example) and seeing that Dave Jones had scratched a bit of an itch, I decided it was time to resync and push it out so I don't have to update it forever.BTW, as I'm basically the only person with substantial patches against reiserfs, I'm 100% ok with disrupting context to this extent. :)
Quoted 7 lines
This set consists of 29 patches in a few areas.
1 - Convert the commit workqueue to a per-fs workqueue 2 - Clean up ugly accessor macros to use more readable names 3 - Clean up comments to use the normal kernel style
4 - Remove the unused nblocks argument fromjournal_end5 - Remove superblock argument fromjournal_end(it's in the trans
handle)
Quoted 8 lines
6 - Remove superblock argument from
journal_mark_dirty(see #5) 7 - Remove blocks argument fromjournal_join(it's always 1) 8 - Remove leading whitespace from labels
9 - Remove unnecessary parents
10 - Clean up dirent creation
11 - Clean up hash detection
12-29 - Clean upbalance_leaf- This 2500-line function goes through
6 easily distinguishable stages, each with several sub-parts.
The
Quoted 6 lines
patch set splits up the stages and then reformats them to keep the split as obvious as possible. The final result is a whole lot easier to follow and easier on the eyes.
-Jeff
Hello Jeff,
I do not see a patch 03/29 in the list.
Is this correct ?
--Glenn
I see:
[patch 01/29] reiserfs: use per-fs commit workqueues, Jeff Mahoney [patch 02/29] reiserfs: cleanup, rename key and item accessors to more friendly names, Jeff Mahoney
[patch 04/29] reiserfs: cleanup, remove nblocks argument from journal_end, Jeff Mahoney
[patch 05/29] reiserfs: cleanup, remove sb argument from journal_end, Jeff Mahoney
[patch 06/29] reiserfs: cleanup, remove sb argument from journal_mark_dirty, Jeff Mahoney
[patch 07/29] reiserfs: cleanup, remove blocks arg from journal_join, Jeff Mahoney
[patch 08/29] reiserfs: cleanup, remove leading whitespace from labels, Jeff Mahoney
[patch 09/29] reiserfs: cleanup, remove unnecessary parens, Jeff Mahoney [patch 10/29] reiserfs: cleanup, remove unnecessary parens in dirent creation, Jeff Mahoney
[patch 11/29] reiserfs: cleanup, make hash detection saner, Jeff Mahoney [patch 12/29] reiserfs: balance_leaf refactor, reformat balance_leaf comments, Jeff Mahoney
[patch 13/29] reiserfs: balance_leaf refactor, move state variables into tree_balance, Jeff Mahoney
[patch 14/29] reiserfs: balance_leaf refactor, pull out balance_leaf_insert_left, Jeff Mahoney
[patch 15/29] reiserfs: balance_leaf refactor, pull out balance_leaf_paste_left, Jeff Mahoney
[patch 16/29] reiserfs: balance_leaf refactor, pull out balance_leaf_insert_right, Jeff Mahoney
[patch 17/29] reiserfs: balance_leaf refactor, pull out balance_leaf_paste_right, Jeff Mahoney
[patch 18/29] reiserfs: balance_leaf refactor, pull out balance_leaf_new_nodes_insert, Jeff Mahoney
[patch 19/29] reiserfs: balance_leaf refactor, pull out balance_leaf_new_nodes_paste, Jeff Mahoney
[patch 20/29] reiserfs: balance_leaf refactor pull out balance_leaf_finish_node_insert, Jeff Mahoney
[patch 21/29] reiserfs: balance_leaf refactor, pull out balance_leaf_finish_node_paste, Jeff Mahoney
[patch 22/29] reiserfs: balance_leaf refactor, pull out balance_leaf{left, right, new_nodes, finish_node}, Jeff Mahoney
[patch 23/29] reiserfs: balance_leaf refactor, format balance_leaf_insert_left, Jeff Mahoney
[patch 24/29] reiserfs: balance_leaf refactor, format balance_leaf_paste_left, Jeff Mahoney
[patch 25/29] reiserfs: balance_leaf refactor, format balance_leaf_insert_right, Jeff Mahoney
[patch 26/29] reiserfs: balance_leaf refactor, format balance_leaf_paste_right, Jeff Mahoney
[patch 27/29] reiserfs: balance_leaf refactor, format balance_leaf_new_nodes_paste, Jeff Mahoney
[patch 28/29] reiserfs: balance_leaf refactor, format balance_leaf_finish_node, Jeff Mahoney
[patch 29/29] reiserfs: balance_leaf refactor, split up balance_leaf_when_delete, Jeff Mahoney
#Reference: http://www.spinics.net/lists/reiserfs-devel/
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Quoted 31 lines · On 5/27/14, 5:23 AM, [email protected] wrote:
Quoted 13 lines · Jeff Mahoney
Hi all -
I've had this patchset kicking around for a while. After a conversation this past week about code that was horrible to read
(using reiserfs'sbalance_leafas the primary example) and
seeing that Dave Jones had scratched a bit of an itch, I decided it was time to resync and push it out so I don't have to update it forever.BTW, as I'm basically the only person with substantial patches against reiserfs, I'm 100% ok with disrupting context to this extent. :)
Quoted 7 lines
This set consists of 29 patches in a few areas.
1 - Convert the commit workqueue to a per-fs workqueue 2 - Clean up ugly accessor macros to use more readable names 3 - Clean up comments to use the normal kernel style 4 - Remove the unused nblocks argument from
journal_end5 - Remove superblock argument fromjournal_end(it's in the transhandle)
Quoted 7 lines
6 - Remove superblock argument from
journal_mark_dirty(see #5) 7 - Remove blocks argument fromjournal_join(it's always 1) 8 - Remove leading whitespace from labels 9 - Remove unnecessary parents 10 - Clean up dirent creation 11 - Clean up hash detection 12-29 - Clean upbalance_leaf- This 2500-line function goes through 6 easily distinguishable stages, each with several sub-parts.The
Quoted 8 lines
Quoted 6 lines
patch set splits up the stages and then reformats them to keep the split as obvious as possible. The final result is a whole lot easier to follow and easier on the eyes.
-Jeff
Hello Jeff, I do not see a patch 03/29 in the list. Is this correct ?
The list seems to have filtered it. I've reposted it, cc'ing you.
- -Jeff
Quoted 45 lines
--Glenn
I see: [patch 01/29] reiserfs: use per-fs commit workqueues, Jeff Mahoney [patch 02/29] reiserfs: cleanup, rename key and item accessors to more friendly names, Jeff Mahoney [patch 04/29]
reiserfs: cleanup, remove nblocks argument fromjournal_end, Jeff Mahoney [patch 05/29] reiserfs: cleanup, remove sb argument fromjournal_end, Jeff Mahoney [patch 06/29] reiserfs: cleanup, remove sb argument fromjournal_mark_dirty, Jeff Mahoney [patch 07/29]
reiserfs: cleanup, remove blocks arg fromjournal_join, Jeff Mahoney [patch 08/29] reiserfs: cleanup, remove leading whitespace from labels, Jeff Mahoney [patch 09/29] reiserfs: cleanup, remove unnecessary parens, Jeff Mahoney [patch 10/29] reiserfs: cleanup, remove unnecessary parens in dirent creation, Jeff Mahoney [patch 11/29] reiserfs: cleanup, make hash detection saner, Jeff Mahoney [patch 12/29] reiserfs:balance_leafrefactor, reformatbalance_leafcomments, Jeff Mahoney [patch 13/29] reiserfs:balance_leafrefactor, move state variables intotree_balance, Jeff Mahoney [patch 14/29] reiserfs:balance_leafrefactor, pull outbalance_leaf_insert_left, Jeff Mahoney [patch 15/29] reiserfs:balance_leafrefactor, pull outbalance_leaf_paste_left, Jeff Mahoney [patch 16/29] reiserfs:balance_leafrefactor, pull outbalance_leaf_insert_right, Jeff Mahoney [patch 17/29] reiserfs:balance_leafrefactor, pull outbalance_leaf_paste_right, Jeff Mahoney [patch 18/29] reiserfs:balance_leafrefactor, pull outbalance_leaf_new_nodes_insert, Jeff Mahoney [patch 19/29]
reiserfs:balance_leafrefactor, pull outbalance_leaf_new_nodes_paste, Jeff Mahoney [patch 20/29] reiserfs:balance_leafrefactor pull outbalance_leaf_finish_node_insert, Jeff Mahoney [patch 21/29] reiserfs:balance_leafrefactor, pull outbalance_leaf_finish_node_paste, Jeff Mahoney [patch 22/29]
reiserfs:balance_leafrefactor, pull out balance_leaf{left, right,new_nodes,finish_node}, Jeff Mahoney [patch 23/29]
reiserfs:balance_leafrefactor, formatbalance_leaf_insert_left, Jeff Mahoney [patch 24/29] reiserfs:balance_leafrefactor, format
balance_leaf_paste_left, Jeff Mahoney [patch 25/29] reiserfs:balance_leafrefactor, formatbalance_leaf_insert_right, Jeff Mahoney [patch 26/29] reiserfs:balance_leafrefactor, formatbalance_leaf_paste_right, Jeff Mahoney [patch 27/29] reiserfs:balance_leafrefactor, formatbalance_leaf_new_nodes_paste, Jeff Mahoney [patch 28/29] reiserfs:balance_leafrefactor, formatbalance_leaf_finish_node, Jeff Mahoney [patch 29/29] reiserfs:balance_leafrefactor, split upbalance_leaf_when_delete, Jeff Mahoney
Quoted 2 lines
#Reference: http://www.spinics.net/lists/reiserfs-devel/
- --
Jeff Mahoney
SUSE Labs
-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.22 (Darwin)
iQIcBAEBAgAGBQJThIbRAAoJEB57S2MheeWyggUQAMb23ZQtmegX1CGO5USs/jL2 ZEHQkwDBURnY3gMVLQwMTAb93pODFvBCMnI0qcLANCUEn0qzb32plN+psSjv1VFG +H6Yn/b/LSr8gqEm67DVfIZXn//seV5BIPwZvbescUzXtfdKY3TaOXytNXgk6weD w4qqwGMNGUShRTmWC/uxYk755JFYU9HG4xSRWNdDmT5kl+E5+5FGNLRCzcpkYO8M Sryi6/FP+jX3GfeQaXwySy/ALki7uQRbhUEHFhWIkNis5LI41QfE2zknNvoljGZd egoNlGdbqvbqisVQiNpqYIgerTKPFkngrg59HORZUyl9wv4YJriDYtNYZtcGfrSR Hc/lHES7ndF9VDF5iUeGc5AkHaT2NCBB8rkuzvpJdI9ZARBvSgoWjqemfn7QLbT9 CYRcrVbJhYKYL24WXueOSasRRIVWNcrilpz5gTBQHWyZcpkb4nxL5ECuL1UIl9Wq 2fSQYs7ItQZYERCXP9GLbS2iGpCgflQeYJIxtx+lEIVKzFSmD9G9F9y7AW8QiL/u qgB+mkZMrKBm2uIq17zxhC/PzL6oHVWGLebATnPQ33OK0dk9aEKNliwiK/v05SIV zac31E/Er7X9huqhyVW9gyfCDIPUA/VcqTeTKL4tXJKbyooI8Yx3ePrZ3CXV+S7j LVEKJb6wfE/R6G8EoqTK
=o6Qb
-----END PGP SIGNATURE-----
"I do not see a patch 03/29 in the list"
Was the above patch ever posted? I can not find it after applying patches 01/29 and 02/29... against reiser4-for-3.14.1.patched kernel 3.14.5 source tree.
Best Professional Regards.
Quoted 121 lines · Jeff Mahoney
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1Quoted 31 lines · On 5/27/14, 5:23 AM, [email protected] wrote:
Quoted 13 lines · Jeff Mahoney
Hi all -
I've had this patchset kicking around for a while. After a conversation this past week about code that was horrible to read
(using reiserfs'sbalance_leafas the primary example) and
seeing that Dave Jones had scratched a bit of an itch, I decided it was time to resync and push it out so I don't have to update it forever.BTW, as I'm basically the only person with substantial patches against reiserfs, I'm 100% ok with disrupting context to this extent. :)
Quoted 7 lines
This set consists of 29 patches in a few areas.
1 - Convert the commit workqueue to a per-fs workqueue 2 - Clean up ugly accessor macros to use more readable names 3 - Clean up comments to use the normal kernel style 4 - Remove the unused nblocks argument from
journal_end5 - Remove superblock argument fromjournal_end(it's in the transhandle)
Quoted 7 lines
6 - Remove superblock argument from
journal_mark_dirty(see #5) 7 - Remove blocks argument fromjournal_join(it's always 1) 8 - Remove leading whitespace from labels 9 - Remove unnecessary parents 10 - Clean up dirent creation 11 - Clean up hash detection 12-29 - Clean upbalance_leaf- This 2500-line function goes through 6 easily distinguishable stages, each with several sub-parts.The
Quoted 8 lines
Quoted 6 lines
patch set splits up the stages and then reformats them to keep the split as obvious as possible. The final result is a whole lot easier to follow and easier on the eyes.
-Jeff
Hello Jeff, I do not see a patch 03/29 in the list. Is this correct ?
The list seems to have filtered it. I've reposted it, cc'ing you.
- -Jeff
Quoted 45 lines
--Glenn
I see: [patch 01/29] reiserfs: use per-fs commit workqueues, Jeff Mahoney [patch 02/29] reiserfs: cleanup, rename key and item accessors to more friendly names, Jeff Mahoney [patch 04/29]
reiserfs: cleanup, remove nblocks argument fromjournal_end, Jeff Mahoney [patch 05/29] reiserfs: cleanup, remove sb argument fromjournal_end, Jeff Mahoney [patch 06/29] reiserfs: cleanup, remove sb argument fromjournal_mark_dirty, Jeff Mahoney [patch 07/29]
reiserfs: cleanup, remove blocks arg fromjournal_join, Jeff Mahoney [patch 08/29] reiserfs: cleanup, remove leading whitespace from labels, Jeff Mahoney [patch 09/29] reiserfs: cleanup, remove unnecessary parens, Jeff Mahoney [patch 10/29] reiserfs: cleanup, remove unnecessary parens in dirent creation, Jeff Mahoney [patch 11/29] reiserfs: cleanup, make hash detection saner, Jeff Mahoney [patch 12/29] reiserfs:balance_leafrefactor, reformatbalance_leafcomments, Jeff Mahoney [patch 13/29] reiserfs:balance_leafrefactor, move state variables intotree_balance, Jeff Mahoney [patch 14/29] reiserfs:balance_leafrefactor, pull outbalance_leaf_insert_left, Jeff Mahoney [patch 15/29] reiserfs:balance_leafrefactor, pull outbalance_leaf_paste_left, Jeff Mahoney [patch 16/29] reiserfs:balance_leafrefactor, pull outbalance_leaf_insert_right, Jeff Mahoney [patch 17/29] reiserfs:balance_leafrefactor, pull outbalance_leaf_paste_right, Jeff Mahoney [patch 18/29] reiserfs:balance_leafrefactor, pull outbalance_leaf_new_nodes_insert, Jeff Mahoney [patch 19/29]
reiserfs:balance_leafrefactor, pull outbalance_leaf_new_nodes_paste, Jeff Mahoney [patch 20/29] reiserfs:balance_leafrefactor pull outbalance_leaf_finish_node_insert, Jeff Mahoney [patch 21/29] reiserfs:balance_leafrefactor, pull outbalance_leaf_finish_node_paste, Jeff Mahoney [patch 22/29]
reiserfs:balance_leafrefactor, pull out balance_leaf{left, right,new_nodes,finish_node}, Jeff Mahoney [patch 23/29]
reiserfs:balance_leafrefactor, formatbalance_leaf_insert_left, Jeff Mahoney [patch 24/29] reiserfs:balance_leafrefactor, format
balance_leaf_paste_left, Jeff Mahoney [patch 25/29] reiserfs:balance_leafrefactor, formatbalance_leaf_insert_right, Jeff Mahoney [patch 26/29] reiserfs:balance_leafrefactor, formatbalance_leaf_paste_right, Jeff Mahoney [patch 27/29] reiserfs:balance_leafrefactor, formatbalance_leaf_new_nodes_paste, Jeff Mahoney [patch 28/29] reiserfs:balance_leafrefactor, formatbalance_leaf_finish_node, Jeff Mahoney [patch 29/29] reiserfs:balance_leafrefactor, split upbalance_leaf_when_delete, Jeff MahoneyQuoted 2 lines
#Reference: http://www.spinics.net/lists/reiserfs-devel/
- --
Jeff Mahoney
SUSE Labs
-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.22 (Darwin)iQIcBAEBAgAGBQJThIbRAAoJEB57S2MheeWyggUQAMb23ZQtmegX1CGO5USs/jL2 ZEHQkwDBURnY3gMVLQwMTAb93pODFvBCMnI0qcLANCUEn0qzb32plN+psSjv1VFG +H6Yn/b/LSr8gqEm67DVfIZXn//seV5BIPwZvbescUzXtfdKY3TaOXytNXgk6weD w4qqwGMNGUShRTmWC/uxYk755JFYU9HG4xSRWNdDmT5kl+E5+5FGNLRCzcpkYO8M Sryi6/FP+jX3GfeQaXwySy/ALki7uQRbhUEHFhWIkNis5LI41QfE2zknNvoljGZd egoNlGdbqvbqisVQiNpqYIgerTKPFkngrg59HORZUyl9wv4YJriDYtNYZtcGfrSR Hc/lHES7ndF9VDF5iUeGc5AkHaT2NCBB8rkuzvpJdI9ZARBvSgoWjqemfn7QLbT9 CYRcrVbJhYKYL24WXueOSasRRIVWNcrilpz5gTBQHWyZcpkb4nxL5ECuL1UIl9Wq 2fSQYs7ItQZYERCXP9GLbS2iGpCgflQeYJIxtx+lEIVKzFSmD9G9F9y7AW8QiL/u qgB+mkZMrKBm2uIq17zxhC/PzL6oHVWGLebATnPQ33OK0dk9aEKNliwiK/v05SIV zac31E/Er7X9huqhyVW9gyfCDIPUA/VcqTeTKL4tXJKbyooI8Yx3ePrZ3CXV+S7j LVEKJb6wfE/R6G8EoqTK
=o6Qb
-----END PGP SIGNATURE-----
--
To unsubscribe from this list: send the line "unsubscribe reiserfs-devel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Signature · 7 lines
Jose R R http://www.metztli-it.com --------------------------------------------------------------------------------------------- NEW Apache OpenOffice 4.1.0! Download for GNU/Linux, Mac OS, Windows. --------------------------------------------------------------------------------------------- Daylight Saving Time in USA & Canada ends: Sunday, November 02, 2014 ---------------------------------------------------------------------------------------------
A message that is not in the archive (sent off-list or not yet received): [email protected]
Re: [patch 00/29] reiserfs cleanup patchset - 03/29 attached [reiserfs: cleanup, reformat comments to normal kernel style]
Thank you, Glenn!
Quoted 8 lines · On Thu, Jun 5, 2014 at 8:41 PM, <[email protected]> wrote:
Quoted 5 lines · Jose R R
"I do not see a patch 03/29 in the list"
Was the above patch ever posted? I can not find it after applying patches 01/29 and 02/29... against reiser4-for-3.14.1.patched kernel 3.14.5 source tree.
Quoted 7 lines
Hello,
see attached.
--Glenn# [patch 03/29 repost] reiserfs: cleanup, reformat comments to normal kernel style
# Signed-off-by: Jeff Mahoney <jeffm@xxxxxxxx>
I had been working in a blog post which I completed today:
Debian Closure: Enhancing Linux Kernel 3.15.1 With Reiser4 Patch
-- (& Patching Legacy #Grub-97 for Reiser4 on /boot)
http://www.metztli-it.com/blog/index.php/aG2?blog=4
Best Professional Regards.
Signature · 7 lines
Jose R R http://www.metztli-it.com --------------------------------------------------------------------------------------------- NEW Apache OpenOffice 4.1.0! Download for GNU/Linux, Mac OS, Windows. --------------------------------------------------------------------------------------------- Daylight Saving Time in USA & Canada ends: Sunday, November 02, 2014 ---------------------------------------------------------------------------------------------