All of lore.kernel.org
 help / color / mirror / Atom feed
* [patch 00/29] reiserfs cleanup patchset
@ 2014-04-23 14:00 Jeff Mahoney
  2014-04-23 14:00 ` [patch 01/29] reiserfs: use per-fs commit workqueues Jeff Mahoney
                   ` (30 more replies)
  0 siblings, 31 replies; 50+ messages in thread
From: Jeff Mahoney @ 2014-04-23 14:00 UTC (permalink / raw)
  To: ReiserFS Development List; +Cc: Jan Kara, Dave Jones

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


^ permalink raw reply	[flat|nested] 50+ messages in thread

* [patch 01/29] reiserfs: use per-fs commit workqueues
  2014-04-23 14:00 [patch 00/29] reiserfs cleanup patchset Jeff Mahoney
@ 2014-04-23 14:00 ` Jeff Mahoney
  2014-04-23 14:00 ` [patch 02/29] reiserfs: cleanup, rename key and item accessors to more friendly names Jeff Mahoney
                   ` (29 subsequent siblings)
  30 siblings, 0 replies; 50+ messages in thread
From: Jeff Mahoney @ 2014-04-23 14:00 UTC (permalink / raw)
  To: ReiserFS Development List; +Cc: Jan Kara, Dave Jones

[-- Attachment #1: patches.fixes/reiserfs-get-rid-of-reiserfs_mounted_fs_count --]
[-- Type: text/plain, Size: 3775 bytes --]

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.

Signed-off-by: Jeff Mahoney <jeffm@suse.com>
---
 fs/reiserfs/journal.c  |   22 +++-------------------
 fs/reiserfs/reiserfs.h |    2 ++
 fs/reiserfs/super.c    |   21 +++++++++++++++------
 3 files changed, 20 insertions(+), 25 deletions(-)

--- a/fs/reiserfs/journal.c
+++ b/fs/reiserfs/journal.c
@@ -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 rei
 	reiserfs_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 reiserf
 		flush_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
--- a/fs/reiserfs/reiserfs.h
+++ b/fs/reiserfs/reiserfs.h
@@ -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
--- a/fs/reiserfs/super.c
+++ b/fs/reiserfs/super.c
@@ -560,6 +560,7 @@ static void reiserfs_put_super(struct su
 
 	reiserfs_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 su
 	mutex_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();
 



^ permalink raw reply	[flat|nested] 50+ messages in thread

* [patch 02/29] reiserfs: cleanup, rename key and item accessors to more friendly names
  2014-04-23 14:00 [patch 00/29] reiserfs cleanup patchset Jeff Mahoney
  2014-04-23 14:00 ` [patch 01/29] reiserfs: use per-fs commit workqueues Jeff Mahoney
@ 2014-04-23 14:00 ` Jeff Mahoney
  2014-04-23 14:00 ` [patch 04/29] reiserfs: cleanup, remove nblocks argument from journal_end Jeff Mahoney
                   ` (28 subsequent siblings)
  30 siblings, 0 replies; 50+ messages in thread
From: Jeff Mahoney @ 2014-04-23 14:00 UTC (permalink / raw)
  To: ReiserFS Development List; +Cc: Jan Kara, Dave Jones

[-- Attachment #1: reiserfs/reiserfs-rename-key-and-item_head-accessors-to-more-friendly-names --]
[-- Type: text/plain, Size: 60366 bytes --]

This 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().

Signed-off-by: Jeff Mahoney <jeffm@suse.com>
---
 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(-)

--- a/fs/reiserfs/bitmap.c
+++ b/fs/reiserfs/bitmap.c
@@ -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;
 
--- a/fs/reiserfs/dir.c
+++ b/fs/reiserfs/dir.c
@@ -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;
--- a/fs/reiserfs/do_balan.c
+++ b/fs/reiserfs/do_balan.c
@@ -114,7 +114,7 @@ static int balance_leaf_when_delete(stru
 	RFALSE(!tb->blknum[0] && !PATH_H_PPARENT(tb->tb_path, 0),
 	       "PAP-12010: tree can not be empty");
 
-	ih = B_N_PITEM_HEAD(tbS0, item_pos);
+	ih = item_head(tbS0, item_pos);
 	buffer_info_init_tbS0(tb, &bi);
 
 	/* Delete or truncate the item */
@@ -312,7 +312,7 @@ static int balance_leaf(struct tree_bala
 	/* for indirect item pos_in_item is measured in unformatted node
 	   pointers. Recalculate to bytes */
 	if (flag != M_INSERT
-	    && is_indirect_le_ih(B_N_PITEM_HEAD(tbS0, item_pos)))
+	    && is_indirect_le_ih(item_head(tbS0, item_pos)))
 		pos_in_item *= UNFM_P_SIZE;
 
 	if (tb->lnum[0] > 0) {
@@ -378,7 +378,7 @@ static int balance_leaf(struct tree_bala
 
 				if (item_pos == tb->lnum[0] - 1 && tb->lbytes != -1) {
 					/* we must shift the part of the appended item */
-					if (is_direntry_le_ih(B_N_PITEM_HEAD(tbS0, item_pos))) {
+					if (is_direntry_le_ih(item_head(tbS0, item_pos))) {
 
 						RFALSE(zeros_num,
 						       "PAP-12090: invalid parameter in case of a directory");
@@ -391,8 +391,8 @@ static int balance_leaf(struct tree_bala
 							/* 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) {
-								pasted = B_N_PITEM_HEAD(tb->L[0], B_NR_ITEMS(tb->L[0]) - 1);
-								l_pos_in_item += I_ENTRY_COUNT(pasted) - (tb->lbytes -1);
+								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 */
@@ -418,9 +418,9 @@ static int balance_leaf(struct tree_bala
 					} 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(B_N_PITEM_HEAD(tbS0, item_pos)),
+						RFALSE(pos_in_item != ih_item_len(item_head(tbS0, item_pos)),
 						       "PAP-12100: incorrect position to paste: item_len=%d, pos_in_item=%d",
-						       ih_item_len(B_N_PITEM_HEAD(tbS0, item_pos)),pos_in_item);
+						       ih_item_len(item_head(tbS0, item_pos)),pos_in_item);
 
 						if (tb->lbytes >= pos_in_item) {
 							/* appended item will be in L[0] in whole */
@@ -436,12 +436,12 @@ 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
-									    (B_N_PITEM_HEAD(tbS0, item_pos)));
+									    (item_head(tbS0, 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
-							     (B_N_PITEM_HEAD(tb->L[0], n + item_pos - ret_val)),
+							     (item_head(tb->L[0], n + item_pos - ret_val)),
 							     l_n, body,
 							     zeros_num > l_n ? l_n : zeros_num);
 							/* 0-th item in S0 can be only of DIRECT type when l_n != 0 */
@@ -449,21 +449,21 @@ static int balance_leaf(struct tree_bala
 								int version;
 								int temp_l = l_n;
 
-								RFALSE(ih_item_len(B_N_PITEM_HEAD(tbS0, 0)),
+								RFALSE(ih_item_len(item_head(tbS0, 0)),
 								     "PAP-12106: item length must be 0");
-								RFALSE(comp_short_le_keys(B_N_PKEY(tbS0, 0), B_N_PKEY
+								RFALSE(comp_short_le_keys(leaf_key(tbS0, 0), leaf_key
 								      (tb->L[0], n + item_pos - ret_val)),
 								     "PAP-12107: items must be of the same file");
-								if (is_indirect_le_ih(B_N_PITEM_HEAD(tb->L[0], n + item_pos - ret_val))) {
+								if (is_indirect_le_ih(item_head(tb->L[0], n + 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(B_N_PITEM_HEAD(tbS0, 0));
-								set_le_key_k_offset(version, B_N_PKEY(tbS0, 0),
-								     le_key_k_offset(version,B_N_PKEY(tbS0, 0)) + temp_l);
+								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, B_N_PDELIM_KEY(tb->CFL[0], tb->lkey[0]),
-								     le_key_k_offset(version, B_N_PDELIM_KEY(tb->CFL[0], tb->lkey[0])) + temp_l);
+								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] */
@@ -474,9 +474,9 @@ static int balance_leaf(struct tree_bala
 								zeros_num -= l_n;
 							pos_in_item = 0;
 
-							RFALSE(comp_short_le_keys(B_N_PKEY(tbS0, 0), B_N_PKEY(tb->L[0], B_NR_ITEMS(tb->L[0]) - 1))
-							     || !op_is_left_mergeable(B_N_PKEY(tbS0, 0), tbS0->b_size)
-							     || !op_is_left_mergeable(B_N_PDELIM_KEY(tb->CFL[0], tb->lkey[0]), tbS0->b_size),
+							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] */
 
@@ -493,9 +493,9 @@ static int balance_leaf(struct tree_bala
 
 					struct item_head *pasted;
 
-					if (!item_pos && op_is_left_mergeable(B_N_PKEY(tbS0, 0), tbS0->b_size)) {	/* if we paste into first item of S[0] and it is left mergable */
+					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 */
 						/* then increment pos_in_item by the size of the last item in L[0] */
-						pasted = B_N_PITEM_HEAD(tb->L[0], n - 1);
+						pasted = item_head(tb->L[0], n - 1);
 						if (is_direntry_le_ih(pasted))
 							pos_in_item += ih_entry_count(pasted);
 						else
@@ -512,7 +512,7 @@ static int balance_leaf(struct tree_bala
 							     body, zeros_num);
 
 					/* if appended item is directory, paste entry */
-					pasted = B_N_PITEM_HEAD(tb->L[0], n + item_pos - ret_val);
+					pasted = item_head(tb->L[0], n + item_pos - ret_val);
 					if (is_direntry_le_ih(pasted))
 						leaf_paste_entries(&bi, n + item_pos - ret_val,
 								   pos_in_item, 1,
@@ -617,12 +617,12 @@ static int balance_leaf(struct tree_bala
 
 			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(B_N_PITEM_HEAD(tbS0, item_pos))) {	/* we append to directory item */
+					if (is_direntry_le_ih(item_head(tbS0, item_pos))) {	/* we append to directory item */
 						int entry_count;
 
 						RFALSE(zeros_num,
 						       "PAP-12145: invalid parameter in case of a directory");
-						entry_count = I_ENTRY_COUNT(B_N_PITEM_HEAD
+						entry_count = ih_entry_count(item_head
 								  (tbS0, item_pos));
 						if (entry_count - tb->rbytes <
 						    pos_in_item)
@@ -665,10 +665,10 @@ static int balance_leaf(struct tree_bala
 							n_shift = 0;
 
 						RFALSE(pos_in_item != ih_item_len
-						       (B_N_PITEM_HEAD(tbS0, item_pos)),
+						       (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
-						       (B_N_PITEM_HEAD(tbS0, item_pos)));
+						       (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] */
@@ -679,17 +679,17 @@ static int balance_leaf(struct tree_bala
 							int version;
 							unsigned long temp_rem = n_rem;
 
-							version = ih_version(B_N_PITEM_HEAD(tb->R[0], 0));
-							if (is_indirect_le_key(version, B_N_PKEY(tb->R[0], 0))) {
+							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, B_N_PKEY(tb->R[0], 0),
-							     le_key_k_offset(version, B_N_PKEY(tb->R[0], 0)) + temp_rem);
-							set_le_key_k_offset(version, B_N_PDELIM_KEY(tb->CFR[0], tb->rkey[0]),
-							     le_key_k_offset(version, B_N_PDELIM_KEY(tb->CFR[0], tb->rkey[0])) + temp_rem);
+							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 (B_N_PKEY(tb->R[0],0)) += n_rem;
-		  k_offset (B_N_PDELIM_KEY(tb->CFR[0],tb->rkey[0])) += n_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);
 
 						/* Append part of body into R[0] */
@@ -707,12 +707,12 @@ static int balance_leaf(struct tree_bala
 								     tb->insert_size[0] - n_rem,
 								     r_body, r_zeros_number);
 
-						if (is_indirect_le_ih(B_N_PITEM_HEAD(tb->R[0], 0))) {
+						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(B_N_PITEM_HEAD(tb->R[0], 0), 0);
+							set_ih_free_space(item_head(tb->R[0], 0), 0);
 						}
 						tb->insert_size[0] = n_rem;
 						if (!n_rem)
@@ -731,7 +731,7 @@ static int balance_leaf(struct tree_bala
 					}
 
 					/* paste new entry, if item is directory item */
-					pasted = B_N_PITEM_HEAD(tb->R[0], item_pos - n + tb->rnum[0]);
+					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,
@@ -784,8 +784,8 @@ static int balance_leaf(struct tree_bala
 			if (!tb->CFR[0])
 				reiserfs_panic(tb->tb_sb, "vs-12195",
 					       "CFR not initialized");
-			copy_key(B_N_PDELIM_KEY(tb->CFL[0], tb->lkey[0]),
-				 B_N_PDELIM_KEY(tb->CFR[0], tb->rkey[0]));
+			copy_key(internal_key(tb->CFL[0], tb->lkey[0]),
+				 internal_key(tb->CFR[0], tb->rkey[0]));
 			do_balance_mark_internal_dirty(tb, tb->CFL[0], 0);
 		}
 
@@ -886,7 +886,7 @@ static int balance_leaf(struct tree_bala
 
 					RFALSE(ih, "PAP-12210: ih must be 0");
 
-					aux_ih = B_N_PITEM_HEAD(tbS0, item_pos);
+					aux_ih = item_head(tbS0, item_pos);
 					if (is_direntry_le_ih(aux_ih)) {
 						/* we append to directory item */
 
@@ -922,7 +922,7 @@ static int balance_leaf(struct tree_bala
 						int n_shift, n_rem, r_zeros_number;
 						const char *r_body;
 
-						RFALSE(pos_in_item != ih_item_len(B_N_PITEM_HEAD(tbS0, item_pos)) || tb->insert_size[0] <= 0,
+						RFALSE(pos_in_item != ih_item_len(item_head(tbS0, 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 */
@@ -952,7 +952,7 @@ static int balance_leaf(struct tree_bala
 						{
 							struct item_head *tmp;
 
-							tmp = B_N_PITEM_HEAD(S_new[i], 0);
+							tmp = item_head(S_new[i], 0);
 							if (is_indirect_le_ih
 							    (tmp)) {
 								set_ih_free_space(tmp, 0);
@@ -973,7 +973,7 @@ static int balance_leaf(struct tree_bala
 					struct item_head *pasted;
 
 #ifdef CONFIG_REISERFS_CHECK
-					struct item_head *ih_check = B_N_PITEM_HEAD(tbS0, item_pos);
+					struct item_head *ih_check = item_head(tbS0, item_pos);
 
 					if (!is_direntry_le_ih(ih_check)
 					    && (pos_in_item != ih_item_len(ih_check)
@@ -1002,7 +1002,7 @@ static int balance_leaf(struct tree_bala
 							     tb->insert_size[0],
 							     body, zeros_num);
 
-					pasted = B_N_PITEM_HEAD(S_new[i], item_pos - n + snum[i]);
+					pasted = item_head(S_new[i], item_pos - n + snum[i]);
 					if (is_direntry_le_ih(pasted)) {
 						leaf_paste_entries(&bi,
 								   item_pos - n + snum[i],
@@ -1032,7 +1032,7 @@ static int balance_leaf(struct tree_bala
 				       (flag == M_DELETE) ? "DELETE" : ((flag == M_CUT) ? "CUT" : "UNKNOWN"), flag);
 		}
 
-		memcpy(insert_key + i, B_N_PKEY(S_new[i], 0), KEY_SIZE);
+		memcpy(insert_key + i, leaf_key(S_new[i], 0), KEY_SIZE);
 		insert_ptr[i] = S_new[i];
 
 		RFALSE(!buffer_journaled(S_new[i])
@@ -1061,7 +1061,7 @@ static int balance_leaf(struct tree_bala
 		case M_PASTE:{	/* append item in S[0] */
 				struct item_head *pasted;
 
-				pasted = B_N_PITEM_HEAD(tbS0, item_pos);
+				pasted = item_head(tbS0, 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)) {
@@ -1246,10 +1246,10 @@ void replace_key(struct tree_balance *tb
 
 	if (B_IS_ITEMS_LEVEL(src))
 		/* source buffer contains leaf node */
-		memcpy(B_N_PDELIM_KEY(dest, n_dest), B_N_PITEM_HEAD(src, n_src),
+		memcpy(internal_key(dest, n_dest), item_head(src, n_src),
 		       KEY_SIZE);
 	else
-		memcpy(B_N_PDELIM_KEY(dest, n_dest), B_N_PDELIM_KEY(src, n_src),
+		memcpy(internal_key(dest, n_dest), internal_key(src, n_src),
 		       KEY_SIZE);
 
 	do_balance_mark_internal_dirty(tb, dest, 0);
--- a/fs/reiserfs/fix_node.c
+++ b/fs/reiserfs/fix_node.c
@@ -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 t
 	if (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(in
 	struct 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 */
--- a/fs/reiserfs/ibalance.c
+++ b/fs/reiserfs/ibalance.c
@@ -153,7 +153,7 @@ static void internal_insert_childs(struc
 	memcpy(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_items
 	memcpy(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_bal
 	if (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,
--- a/fs/reiserfs/inode.c
+++ b/fs/reiserfs/inode.c
@@ -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 *ino
 
 	if (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 tree
 	struct 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 tree
 
 	if (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);
--- a/fs/reiserfs/item_ops.c
+++ b/fs/reiserfs/item_ops.c
@@ -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++) {
 		;
 	}
 }
--- a/fs/reiserfs/lbalance.c
+++ b/fs/reiserfs/lbalance.c
@@ -35,7 +35,7 @@ static void leaf_copy_dir_entries(struct
 	int copy_records_len;	/* length of all records in item to be copied */
 	char *records;
 
-	ih = B_N_PITEM_HEAD(source, item_num);
+	ih = item_head(source, item_num);
 
 	RFALSE(!is_direntry_le_ih(ih), "vs-10000: item must be directory item");
 
@@ -64,7 +64,7 @@ static void leaf_copy_dir_entries(struct
 	    (last_first == FIRST_TO_LAST && le_ih_k_offset(ih) == DOT_OFFSET) ||
 	    (last_first == LAST_TO_FIRST
 	     && comp_short_le_keys /*COMP_SHORT_KEYS */ (&ih->ih_key,
-							 B_N_PKEY(dest,
+							 leaf_key(dest,
 								  item_num_in_dest))))
 	{
 		/* create new item in dest */
@@ -80,7 +80,7 @@ static void leaf_copy_dir_entries(struct
 
 		if (last_first == LAST_TO_FIRST) {
 			/* form key by the following way */
-			if (from < I_ENTRY_COUNT(ih)) {
+			if (from < ih_entry_count(ih)) {
 				set_le_ih_k_offset(&new_ih,
 						   deh_offset(&(deh[from])));
 				/*memcpy (&new_ih.ih_key.k_offset, &deh[from].deh_offset, SHORT_KEY_SIZE); */
@@ -113,7 +113,7 @@ static void leaf_copy_dir_entries(struct
 
 	leaf_paste_entries(dest_bi, item_num_in_dest,
 			   (last_first ==
-			    FIRST_TO_LAST) ? I_ENTRY_COUNT(B_N_PITEM_HEAD(dest,
+			    FIRST_TO_LAST) ? ih_entry_count(item_head(dest,
 									  item_num_in_dest))
 			   : 0, copy_count, deh + from, records,
 			   DEH_SIZE * copy_count + copy_records_len);
@@ -138,8 +138,8 @@ static int leaf_copy_boundary_item(struc
 		/* if ( DEST is empty or first item of SOURCE and last item of DEST are the items of different objects
 		   or of different types ) then there is no need to treat this item differently from the other items
 		   that we copy, so we return */
-		ih = B_N_PITEM_HEAD(src, 0);
-		dih = B_N_PITEM_HEAD(dest, dest_nr_item - 1);
+		ih = item_head(src, 0);
+		dih = item_head(dest, dest_nr_item - 1);
 		if (!dest_nr_item
 		    || (!op_is_left_mergeable(&(ih->ih_key), src->b_size)))
 			/* there is nothing to merge */
@@ -180,7 +180,7 @@ static int leaf_copy_boundary_item(struc
 		   item of dest buffer. Both are of the same file */
 		leaf_paste_in_buffer(dest_bi,
 				     dest_nr_item - 1, ih_item_len(dih),
-				     bytes_or_entries, B_I_PITEM(src, ih), 0);
+				     bytes_or_entries, ih_item_body(src, ih), 0);
 
 		if (is_indirect_le_ih(dih)) {
 			RFALSE(get_ih_free_space(dih),
@@ -199,8 +199,8 @@ static int leaf_copy_boundary_item(struc
 	   are the items of different object or of different types )
 	 */
 	src_nr_item = B_NR_ITEMS(src);
-	ih = B_N_PITEM_HEAD(src, src_nr_item - 1);
-	dih = B_N_PITEM_HEAD(dest, 0);
+	ih = item_head(src, src_nr_item - 1);
+	dih = item_head(dest, 0);
 
 	if (!dest_nr_item || !op_is_left_mergeable(&(dih->ih_key), src->b_size))
 		return 0;
@@ -270,7 +270,7 @@ static int leaf_copy_boundary_item(struc
 	}
 
 	leaf_paste_in_buffer(dest_bi, 0, 0, bytes_or_entries,
-			     B_I_PITEM(src,
+			     ih_item_body(src,
 				       ih) + ih_item_len(ih) - bytes_or_entries,
 			     0);
 	return 1;
@@ -315,7 +315,7 @@ static void leaf_copy_items_entirely(str
 	dest_before = (last_first == LAST_TO_FIRST) ? 0 : nr;
 
 	/* location of head of first new item */
-	ih = B_N_PITEM_HEAD(dest, dest_before);
+	ih = item_head(dest, dest_before);
 
 	RFALSE(blkh_free_space(blkh) < cpy_num * IH_SIZE,
 	       "vs-10140: not enough free space for headers %d (needed %d)",
@@ -325,7 +325,7 @@ static void leaf_copy_items_entirely(str
 	memmove(ih + cpy_num, ih, (nr - dest_before) * IH_SIZE);
 
 	/* copy item headers */
-	memcpy(ih, B_N_PITEM_HEAD(src, first), cpy_num * IH_SIZE);
+	memcpy(ih, item_head(src, first), cpy_num * IH_SIZE);
 
 	free_space -= (IH_SIZE * cpy_num);
 	set_blkh_free_space(blkh, free_space);
@@ -352,7 +352,8 @@ static void leaf_copy_items_entirely(str
 
 	/* copy items */
 	memcpy(dest->b_data + last_inserted_loc,
-	       B_N_PITEM(src, (first + cpy_num - 1)), j - last_inserted_loc);
+	       item_body(src, (first + cpy_num - 1)),
+	       j - last_inserted_loc);
 
 	/* sizes, item number */
 	set_blkh_nr_item(blkh, nr + cpy_num);
@@ -390,7 +391,7 @@ static void leaf_item_bottle(struct buff
 
 	if (last_first == FIRST_TO_LAST) {
 		/* if ( if item in position item_num in buffer SOURCE is directory item ) */
-		ih = B_N_PITEM_HEAD(src, item_num);
+		ih = item_head(src, item_num);
 		if (is_direntry_le_ih(ih))
 			leaf_copy_dir_entries(dest_bi, src, FIRST_TO_LAST,
 					      item_num, 0, cpy_bytes);
@@ -415,15 +416,15 @@ static void leaf_item_bottle(struct buff
 			       "vs-10190: bad mergeability of item %h", ih);
 			n_ih.ih_version = ih->ih_version;	/* JDM Endian safe, both le */
 			leaf_insert_into_buf(dest_bi, B_NR_ITEMS(dest), &n_ih,
-					     B_N_PITEM(src, item_num), 0);
+					     item_body(src, item_num), 0);
 		}
 	} else {
 		/*  if ( if item in position item_num in buffer SOURCE is directory item ) */
-		ih = B_N_PITEM_HEAD(src, item_num);
+		ih = item_head(src, item_num);
 		if (is_direntry_le_ih(ih))
 			leaf_copy_dir_entries(dest_bi, src, LAST_TO_FIRST,
 					      item_num,
-					      I_ENTRY_COUNT(ih) - cpy_bytes,
+					      ih_entry_count(ih) - cpy_bytes,
 					      cpy_bytes);
 		else {
 			struct item_head n_ih;
@@ -461,9 +462,8 @@ static void leaf_item_bottle(struct buff
 			n_ih.ih_version = ih->ih_version;	/* JDM Endian safe, both le */
 
 			leaf_insert_into_buf(dest_bi, 0, &n_ih,
-					     B_N_PITEM(src,
-						       item_num) +
-					     ih_item_len(ih) - cpy_bytes, 0);
+					     item_body(src, item_num) +
+						ih_item_len(ih) - cpy_bytes, 0);
 		}
 	}
 }
@@ -691,10 +691,10 @@ int leaf_shift_left(struct tree_balance
 			replace_key(tb, tb->CFL[0], tb->lkey[0], S0, 0);
 
 			RFALSE((shift_bytes != -1 &&
-				!(is_direntry_le_ih(B_N_PITEM_HEAD(S0, 0))
-				  && !I_ENTRY_COUNT(B_N_PITEM_HEAD(S0, 0)))) &&
+				!(is_direntry_le_ih(item_head(S0, 0))
+				  && !ih_entry_count(item_head(S0, 0)))) &&
 			       (!op_is_left_mergeable
-				(B_N_PKEY(S0, 0), S0->b_size)),
+				(leaf_key(S0, 0), S0->b_size)),
 			       "vs-10280: item must be mergeable");
 		}
 	}
@@ -776,7 +776,7 @@ void leaf_delete_items(struct buffer_inf
 			leaf_delete_items_entirely(cur_bi, first + 1,
 						   del_num - 1);
 
-			ih = B_N_PITEM_HEAD(bh, B_NR_ITEMS(bh) - 1);
+			ih = item_head(bh, B_NR_ITEMS(bh) - 1);
 			if (is_direntry_le_ih(ih))
 				/* the last item is directory  */
 				/* len = numbers of directory entries in this item */
@@ -820,7 +820,7 @@ void leaf_insert_into_buf(struct buffer_
 	       zeros_number, ih_item_len(inserted_item_ih));
 
 	/* get item new item must be inserted before */
-	ih = B_N_PITEM_HEAD(bh, before);
+	ih = item_head(bh, before);
 
 	/* prepare space for the body of new item */
 	last_loc = nr ? ih_location(&(ih[nr - before - 1])) : bh->b_size;
@@ -902,7 +902,7 @@ void leaf_paste_in_buffer(struct buffer_
 #endif				/* CONFIG_REISERFS_CHECK */
 
 	/* item to be appended */
-	ih = B_N_PITEM_HEAD(bh, affected_item_num);
+	ih = item_head(bh, affected_item_num);
 
 	last_loc = ih_location(&(ih[nr - affected_item_num - 1]));
 	unmoved_loc = affected_item_num ? ih_location(ih - 1) : bh->b_size;
@@ -974,9 +974,9 @@ static int leaf_cut_entries(struct buffe
 	/* make sure, that item is directory and there are enough entries to
 	   remove */
 	RFALSE(!is_direntry_le_ih(ih), "10180: item is not directory item");
-	RFALSE(I_ENTRY_COUNT(ih) < from + del_count,
+	RFALSE(ih_entry_count(ih) < from + del_count,
 	       "10185: item contains not enough entries: entry_count = %d, from = %d, to delete = %d",
-	       I_ENTRY_COUNT(ih), from, del_count);
+	       ih_entry_count(ih), from, del_count);
 
 	if (del_count == 0)
 		return 0;
@@ -996,7 +996,7 @@ static int leaf_cut_entries(struct buffe
 	prev_record = item + prev_record_offset;
 
 	/* adjust locations of remaining entries */
-	for (i = I_ENTRY_COUNT(ih) - 1; i > from + del_count - 1; i--)
+	for (i = ih_entry_count(ih) - 1; i > from + del_count - 1; i--)
 		put_deh_location(&(deh[i]),
 				 deh_location(&deh[i]) -
 				 (DEH_SIZE * del_count));
@@ -1043,7 +1043,7 @@ void leaf_cut_from_buffer(struct buffer_
 	nr = blkh_nr_item(blkh);
 
 	/* item head of truncated item */
-	ih = B_N_PITEM_HEAD(bh, cut_item_num);
+	ih = item_head(bh, cut_item_num);
 
 	if (is_direntry_le_ih(ih)) {
 		/* first cut entry () */
@@ -1156,7 +1156,7 @@ static void leaf_delete_items_entirely(s
 		return;
 	}
 
-	ih = B_N_PITEM_HEAD(bh, first);
+	ih = item_head(bh, first);
 
 	/* location of unmovable item */
 	j = (first == 0) ? bh->b_size : ih_location(ih - 1);
@@ -1213,13 +1213,13 @@ void leaf_paste_entries(struct buffer_in
 	if (new_entry_count == 0)
 		return;
 
-	ih = B_N_PITEM_HEAD(bh, item_num);
+	ih = item_head(bh, item_num);
 
 	/* make sure, that item is directory, and there are enough records in it */
 	RFALSE(!is_direntry_le_ih(ih), "10225: item is not directory item");
-	RFALSE(I_ENTRY_COUNT(ih) < before,
+	RFALSE(ih_entry_count(ih) < before,
 	       "10230: there are no entry we paste entries before. entry_count = %d, before = %d",
-	       I_ENTRY_COUNT(ih), before);
+	       ih_entry_count(ih), before);
 
 	/* first byte of dest item */
 	item = bh->b_data + ih_location(ih);
@@ -1234,7 +1234,7 @@ void leaf_paste_entries(struct buffer_in
 	     : (ih_item_len(ih) - paste_size));
 
 	/* adjust locations of records that will be AFTER new records */
-	for (i = I_ENTRY_COUNT(ih) - 1; i >= before; i--)
+	for (i = ih_entry_count(ih) - 1; i >= before; i--)
 		put_deh_location(&(deh[i]),
 				 deh_location(&(deh[i])) +
 				 (DEH_SIZE * new_entry_count));
@@ -1244,7 +1244,7 @@ void leaf_paste_entries(struct buffer_in
 		put_deh_location(&(deh[i]),
 				 deh_location(&(deh[i])) + paste_size);
 
-	old_entry_num = I_ENTRY_COUNT(ih);
+	old_entry_num = ih_entry_count(ih);
 	put_ih_entry_count(ih, ih_entry_count(ih) + new_entry_count);
 
 	/* prepare space for pasted records */
@@ -1285,10 +1285,10 @@ void leaf_paste_entries(struct buffer_in
 		int prev, next;
 		/* check record locations */
 		deh = B_I_DEH(bh, ih);
-		for (i = 0; i < I_ENTRY_COUNT(ih); i++) {
+		for (i = 0; i < ih_entry_count(ih); i++) {
 			next =
 			    (i <
-			     I_ENTRY_COUNT(ih) -
+			     ih_entry_count(ih) -
 			     1) ? deh_location(&(deh[i + 1])) : 0;
 			prev = (i != 0) ? deh_location(&(deh[i - 1])) : 0;
 
--- a/fs/reiserfs/namei.c
+++ b/fs/reiserfs/namei.c
@@ -31,7 +31,7 @@ static int bin_search_in_dir_item(struct
 	int 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 inode
 			return -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 inode
 			return -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 inode
 				return -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);
--- a/fs/reiserfs/prints.c
+++ b/fs/reiserfs/prints.c
@@ -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_head
 	check_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)
--- a/fs/reiserfs/reiserfs.h
+++ b/fs/reiserfs/reiserfs.h
@@ -1275,9 +1275,11 @@ static inline loff_t le_ih_k_offset(cons
 
 static inline loff_t le_key_k_type(int version, const struct reiserfs_key *key)
 {
-	return (version == KEY_FORMAT_3_5) ?
-	    uniqueness2type(le32_to_cpu(key->u.k_offset_v1.k_uniqueness)) :
-	    offset_v2_k_type(&(key->u.k_offset_v2));
+	if (version == KEY_FORMAT_3_5) {
+		loff_t val = le32_to_cpu(key->u.k_offset_v1.k_uniqueness);
+		return uniqueness2type(val);
+	} else
+		return offset_v2_k_type(&(key->u.k_offset_v2));
 }
 
 static inline loff_t le_ih_k_type(const struct item_head *ih)
@@ -1288,8 +1290,22 @@ static inline loff_t le_ih_k_type(const
 static inline void set_le_key_k_offset(int version, struct reiserfs_key *key,
 				       loff_t offset)
 {
-	(version == KEY_FORMAT_3_5) ? (void)(key->u.k_offset_v1.k_offset = cpu_to_le32(offset)) :	/* jdm check */
-	    (void)(set_offset_v2_k_offset(&(key->u.k_offset_v2), offset));
+	if (version == KEY_FORMAT_3_5)
+		key->u.k_offset_v1.k_offset = cpu_to_le32(offset);
+	else
+		set_offset_v2_k_offset(&key->u.k_offset_v2, offset);
+}
+
+static inline void add_le_key_k_offset(int version, struct reiserfs_key *key,
+				       loff_t offset)
+{
+	set_le_key_k_offset(version, key,
+			    le_key_k_offset(version, key) + offset);
+}
+
+static inline void add_le_ih_k_offset(struct item_head *ih, loff_t offset)
+{
+	add_le_key_k_offset(ih_version(ih), &(ih->ih_key), offset);
 }
 
 static inline void set_le_ih_k_offset(struct item_head *ih, loff_t offset)
@@ -1300,10 +1316,11 @@ static inline void set_le_ih_k_offset(st
 static inline void set_le_key_k_type(int version, struct reiserfs_key *key,
 				     int type)
 {
-	(version == KEY_FORMAT_3_5) ?
-	    (void)(key->u.k_offset_v1.k_uniqueness =
-		   cpu_to_le32(type2uniqueness(type)))
-	    : (void)(set_offset_v2_k_type(&(key->u.k_offset_v2), type));
+	if (version == KEY_FORMAT_3_5) {
+		type = type2uniqueness(type);
+		key->u.k_offset_v1.k_uniqueness = cpu_to_le32(type);
+	} else
+	       set_offset_v2_k_type(&key->u.k_offset_v2, type);
 }
 
 static inline void set_le_ih_k_type(struct item_head *ih, int type)
@@ -1721,39 +1738,6 @@ extern void make_empty_dir_item_v1(char
 extern void make_empty_dir_item(char *body, __le32 dirid, __le32 objid,
 				__le32 par_dirid, __le32 par_objid);
 
-/* array of the entry headers */
- /* get item body */
-#define B_I_PITEM(bh,ih) ( (bh)->b_data + ih_location(ih) )
-#define B_I_DEH(bh,ih) ((struct reiserfs_de_head *)(B_I_PITEM(bh,ih)))
-
-/* length of the directory entry in directory item. This define
-   calculates length of i-th directory entry using directory entry
-   locations from dir entry head. When it calculates length of 0-th
-   directory entry, it uses length of whole item in place of entry
-   location of the non-existent following entry in the calculation.
-   See picture above.*/
-/*
-#define I_DEH_N_ENTRY_LENGTH(ih,deh,i) \
-((i) ? (deh_location((deh)-1) - deh_location((deh))) : (ih_item_len((ih)) - deh_location((deh))))
-*/
-static inline int entry_length(const struct buffer_head *bh,
-			       const struct item_head *ih, int pos_in_item)
-{
-	struct reiserfs_de_head *deh;
-
-	deh = B_I_DEH(bh, ih) + pos_in_item;
-	if (pos_in_item)
-		return deh_location(deh - 1) - deh_location(deh);
-
-	return ih_item_len(ih) - deh_location(deh);
-}
-
-/* number of entries in the directory item, depends on ENTRY_COUNT being at the start of directory dynamic data. */
-#define I_ENTRY_COUNT(ih) (ih_entry_count((ih)))
-
-/* name by bh, ih and entry_num */
-#define B_I_E_NAME(bh,ih,entry_num) ((char *)(bh->b_data + ih_location(ih) + deh_location(B_I_DEH(bh,ih)+(entry_num))))
-
 // two entries per block (at least)
 #define REISERFS_MAX_NAME(block_size) 255
 
@@ -1781,7 +1765,8 @@ struct reiserfs_dir_entry {
 /* these defines are useful when a particular member of a reiserfs_dir_entry is needed */
 
 /* pointer to file name, stored in entry */
-#define B_I_DEH_ENTRY_FILE_NAME(bh,ih,deh) (B_I_PITEM (bh, ih) + deh_location(deh))
+#define B_I_DEH_ENTRY_FILE_NAME(bh, ih, deh) \
+				(ih_item_body(bh, ih) + deh_location(deh))
 
 /* length of name */
 #define I_DEH_N_ENTRY_FILE_NAME_LENGTH(ih,deh,entry_num) \
@@ -1916,8 +1901,6 @@ struct treepath var = {.path_length = IL
 				   dumping paths... -Hans */
 #define PATH_LAST_POSITION(path) (PATH_OFFSET_POSITION((path), (path)->path_length))
 
-#define PATH_PITEM_HEAD(path)    B_N_PITEM_HEAD(PATH_PLAST_BUFFER(path), PATH_LAST_POSITION(path))
-
 /* in do_balance leaf has h == 0 in contrast with path structure,
    where root has level == 0. That is why we need these defines */
 #define PATH_H_PBUFFER(path, h) PATH_OFFSET_PBUFFER (path, path->path_length - (h))	/* tb->S[h] */
@@ -1927,13 +1910,89 @@ struct treepath var = {.path_length = IL
 
 #define PATH_H_PATH_OFFSET(path, n_h) ((path)->path_length - (n_h))
 
+static inline void *reiserfs_node_data(const struct buffer_head *bh)
+{
+	return bh->b_data + sizeof(struct block_head);
+}
+
+/* get key from internal node */
+static inline struct reiserfs_key *internal_key(struct buffer_head *bh,
+						int item_num)
+{
+	struct reiserfs_key *key = reiserfs_node_data(bh);
+
+	return &key[item_num];
+}
+
+/* get the item header from leaf node */
+static inline struct item_head *item_head(const struct buffer_head *bh,
+					  int item_num)
+{
+	struct item_head *ih = reiserfs_node_data(bh);
+
+	return &ih[item_num];
+}
+
+/* get the key from leaf node */
+static inline struct reiserfs_key *leaf_key(const struct buffer_head *bh,
+					    int item_num)
+{
+	return &item_head(bh, item_num)->ih_key;
+}
+
+static inline void *ih_item_body(const struct buffer_head *bh,
+				 const struct item_head *ih)
+{
+	return bh->b_data + ih_location(ih);
+}
+
+/* get item body from leaf node */
+static inline void *item_body(const struct buffer_head *bh, int item_num)
+{
+	return ih_item_body(bh, item_head(bh, item_num));
+}
+
+static inline struct item_head *tp_item_head(const struct treepath *path)
+{
+	return item_head(PATH_PLAST_BUFFER(path), PATH_LAST_POSITION(path));
+}
+
+static inline void *tp_item_body(const struct treepath *path)
+{
+	return item_body(PATH_PLAST_BUFFER(path), PATH_LAST_POSITION(path));
+}
+
 #define get_last_bh(path) PATH_PLAST_BUFFER(path)
-#define get_ih(path) PATH_PITEM_HEAD(path)
 #define get_item_pos(path) PATH_LAST_POSITION(path)
-#define get_item(path) ((void *)B_N_PITEM(PATH_PLAST_BUFFER(path), PATH_LAST_POSITION (path)))
 #define item_moved(ih,path) comp_items(ih, path)
 #define path_changed(ih,path) comp_items (ih, path)
 
+/* array of the entry headers */
+ /* get item body */
+#define B_I_DEH(bh, ih) ((struct reiserfs_de_head *)(ih_item_body(bh, ih)))
+
+/* length of the directory entry in directory item. This define
+   calculates length of i-th directory entry using directory entry
+   locations from dir entry head. When it calculates length of 0-th
+   directory entry, it uses length of whole item in place of entry
+   location of the non-existent following entry in the calculation.
+   See picture above.*/
+/*
+#define I_DEH_N_ENTRY_LENGTH(ih,deh,i) \
+((i) ? (deh_location((deh)-1) - deh_location((deh))) : (ih_item_len((ih)) - deh_location((deh))))
+*/
+static inline int entry_length(const struct buffer_head *bh,
+			       const struct item_head *ih, int pos_in_item)
+{
+	struct reiserfs_de_head *deh;
+
+	deh = B_I_DEH(bh, ih) + pos_in_item;
+	if (pos_in_item)
+		return deh_location(deh - 1) - deh_location(deh);
+
+	return ih_item_len(ih) - deh_location(deh);
+}
+
 /***************************************************************************/
 /*                       MISC                                              */
 /***************************************************************************/
@@ -2224,22 +2283,6 @@ extern struct item_operations *item_ops[
 
 /* number of bytes contained by the direct item or the unformatted nodes the indirect item points to */
 
-/* get the item header */
-#define B_N_PITEM_HEAD(bh,item_num) ( (struct item_head * )((bh)->b_data + BLKH_SIZE) + (item_num) )
-
-/* get key */
-#define B_N_PDELIM_KEY(bh,item_num) ( (struct reiserfs_key * )((bh)->b_data + BLKH_SIZE) + (item_num) )
-
-/* get the key */
-#define B_N_PKEY(bh,item_num) ( &(B_N_PITEM_HEAD(bh,item_num)->ih_key) )
-
-/* get item body */
-#define B_N_PITEM(bh,item_num) ( (bh)->b_data + ih_location(B_N_PITEM_HEAD((bh),(item_num))))
-
-/* get the stat data by the buffer header and the item order */
-#define B_N_STAT_DATA(bh,nr) \
-( (struct stat_data *)((bh)->b_data + ih_location(B_N_PITEM_HEAD((bh),(nr))) ) )
-
     /* following defines use reiserfs buffer header and item header */
 
 /* get stat-data */
@@ -2251,8 +2294,10 @@ extern struct item_operations *item_ops[
 /* indirect items consist of entries which contain blocknrs, pos
    indicates which entry, and B_I_POS_UNFM_POINTER resolves to the
    blocknr contained by the entry pos points to */
-#define B_I_POS_UNFM_POINTER(bh,ih,pos) le32_to_cpu(*(((unp_t *)B_I_PITEM(bh,ih)) + (pos)))
-#define PUT_B_I_POS_UNFM_POINTER(bh,ih,pos, val) do {*(((unp_t *)B_I_PITEM(bh,ih)) + (pos)) = cpu_to_le32(val); } while (0)
+#define B_I_POS_UNFM_POINTER(bh, ih, pos)				\
+	le32_to_cpu(*(((unp_t *)ih_item_body(bh, ih)) + (pos)))
+#define PUT_B_I_POS_UNFM_POINTER(bh, ih, pos, val)			\
+	(*(((unp_t *)ih_item_body(bh, ih)) + (pos)) = cpu_to_le32(val))
 
 struct reiserfs_iget_args {
 	__u32 objectid;
--- a/fs/reiserfs/stree.c
+++ b/fs/reiserfs/stree.c
@@ -272,7 +272,7 @@ static inline const struct reiserfs_key
 			return &MAX_KEY;
 		/* Return delimiting key if position in the parent is not equal to zero. */
 		if (position)
-			return B_N_PDELIM_KEY(parent, position - 1);
+			return internal_key(parent, position - 1);
 	}
 	/* Return MIN_KEY if we are in the root of the buffer tree. */
 	if (PATH_OFFSET_PBUFFER(chk_path, FIRST_PATH_ELEMENT_OFFSET)->
@@ -315,7 +315,7 @@ inline const struct reiserfs_key *get_rk
 			return &MIN_KEY;
 		/* Return delimiting key if position in the parent is not the last one. */
 		if (position != B_NR_ITEMS(parent))
-			return B_N_PDELIM_KEY(parent, position);
+			return internal_key(parent, position);
 	}
 	/* Return MAX_KEY if we are in the root of the buffer tree. */
 	if (PATH_OFFSET_PBUFFER(chk_path, FIRST_PATH_ELEMENT_OFFSET)->
@@ -732,7 +732,7 @@ int search_by_key(struct super_block *sb
 		       "vs-5152: tree level (%d) is less than stop level (%d)",
 		       node_level, stop_level);
 
-		retval = bin_search(key, B_N_PITEM_HEAD(bh, 0),
+		retval = bin_search(key, item_head(bh, 0),
 				      B_NR_ITEMS(bh),
 				      (node_level ==
 				       DISK_LEAF_NODE_LEVEL) ? IH_SIZE :
@@ -779,7 +779,7 @@ int search_by_key(struct super_block *sb
 				/*
 				 * check to make sure we're in the same object
 				 */
-				le_key = B_N_PDELIM_KEY(bh, pos);
+				le_key = internal_key(bh, pos);
 				if (le32_to_cpu(le_key->k_objectid) !=
 				    key->on_disk_key.k_objectid) {
 					break;
@@ -830,7 +830,7 @@ int search_for_position_by_key(struct su
 	if (retval == ITEM_FOUND) {
 
 		RFALSE(!ih_item_len
-		       (B_N_PITEM_HEAD
+		       (item_head
 			(PATH_PLAST_BUFFER(search_path),
 			 PATH_LAST_POSITION(search_path))),
 		       "PAP-5165: item length equals zero");
@@ -844,7 +844,7 @@ int search_for_position_by_key(struct su
 
 	/* Item is not found. Set path to the previous item. */
 	p_le_ih =
-	    B_N_PITEM_HEAD(PATH_PLAST_BUFFER(search_path),
+	    item_head(PATH_PLAST_BUFFER(search_path),
 			   --PATH_LAST_POSITION(search_path));
 	blk_size = sb->s_blocksize;
 
@@ -892,7 +892,7 @@ int comp_items(const struct item_head *s
 		return 1;
 
 	/* we need only to know, whether it is the same item */
-	ih = get_ih(path);
+	ih = tp_item_head(path);
 	return memcmp(stored_ih, ih, IH_SIZE);
 }
 
@@ -987,7 +987,7 @@ static char prepare_for_delete_or_cut(st
     )
 {
 	struct super_block *sb = inode->i_sb;
-	struct item_head *p_le_ih = PATH_PITEM_HEAD(path);
+	struct item_head *p_le_ih = tp_item_head(path);
 	struct buffer_head *bh = PATH_PLAST_BUFFER(path);
 
 	BUG_ON(!th->t_trans_id);
@@ -1033,7 +1033,7 @@ static char prepare_for_delete_or_cut(st
 		need_re_search = 0;
 		*cut_size = 0;
 		bh = PATH_PLAST_BUFFER(path);
-		copy_item_head(&s_ih, PATH_PITEM_HEAD(path));
+		copy_item_head(&s_ih, tp_item_head(path));
 		pos = I_UNFM_NUM(&s_ih);
 
 		while (le_ih_k_offset (&s_ih) + (pos - 1) * blk_size > new_file_length) {
@@ -1047,7 +1047,7 @@ static char prepare_for_delete_or_cut(st
 			reiserfs_transaction_free_space(th) < JOURNAL_FOR_FREE_BLOCK_AND_UPDATE_SD)
 			break;
 
-		    unfm = (__le32 *)B_I_PITEM(bh, &s_ih) + pos - 1;
+		    unfm = (__le32 *)ih_item_body(bh, &s_ih) + pos - 1;
 		    block = get_block_num(unfm, 0);
 
 		    if (block != 0) {
@@ -1095,7 +1095,7 @@ static char prepare_for_delete_or_cut(st
 static int calc_deleted_bytes_number(struct tree_balance *tb, char mode)
 {
 	int del_size;
-	struct item_head *p_le_ih = PATH_PITEM_HEAD(tb->tb_path);
+	struct item_head *p_le_ih = tp_item_head(tb->tb_path);
 
 	if (is_statdata_le_ih(p_le_ih))
 		return 0;
@@ -1212,7 +1212,7 @@ int reiserfs_delete_item(struct reiserfs
 
 		RFALSE(mode != M_DELETE, "PAP-5320: mode must be M_DELETE");
 
-		copy_item_head(&s_ih, PATH_PITEM_HEAD(path));
+		copy_item_head(&s_ih, tp_item_head(path));
 		s_del_balance.insert_size[0] = del_size;
 
 		ret_value = fix_nodes(M_DELETE, &s_del_balance, NULL, NULL);
@@ -1240,7 +1240,7 @@ int reiserfs_delete_item(struct reiserfs
 	}
 	// reiserfs_delete_item returns item length when success
 	ret_value = calc_deleted_bytes_number(&s_del_balance, M_DELETE);
-	q_ih = get_ih(path);
+	q_ih = tp_item_head(path);
 	quota_cut_bytes = ih_item_len(q_ih);
 
 	/* hack so the quota code doesn't have to guess if the file
@@ -1284,7 +1284,7 @@ int reiserfs_delete_item(struct reiserfs
 		data = kmap_atomic(un_bh->b_page);
 		off = ((le_ih_k_offset(&s_ih) - 1) & (PAGE_CACHE_SIZE - 1));
 		memcpy(data + off,
-		       B_I_PITEM(PATH_PLAST_BUFFER(path), &s_ih),
+		       ih_item_body(PATH_PLAST_BUFFER(path), &s_ih),
 		       ret_value);
 		kunmap_atomic(data);
 	}
@@ -1362,11 +1362,11 @@ void reiserfs_delete_solid_item(struct r
 		}
 		if (!tb_init) {
 			tb_init = 1;
-			item_len = ih_item_len(PATH_PITEM_HEAD(&path));
+			item_len = ih_item_len(tp_item_head(&path));
 			init_tb_struct(th, &tb, th->t_super, &path,
 				       -(IH_SIZE + item_len));
 		}
-		quota_cut_bytes = ih_item_len(PATH_PITEM_HEAD(&path));
+		quota_cut_bytes = ih_item_len(tp_item_head(&path));
 
 		retval = fix_nodes(M_DELETE, &tb, NULL, NULL);
 		if (retval == REPEAT_SEARCH) {
@@ -1521,7 +1521,7 @@ static void indirect_to_direct_roll_back
 			reiserfs_panic(inode->i_sb, "vs-5615",
 				       "found invalid item");
 		RFALSE(path->pos_in_item !=
-		       ih_item_len(PATH_PITEM_HEAD(path)) - 1,
+		       ih_item_len(tp_item_head(path)) - 1,
 		       "vs-5616: appended bytes found");
 		PATH_LAST_POSITION(path)--;
 
@@ -1671,7 +1671,7 @@ int reiserfs_cut_from_item(struct reiser
 	/* Calculate number of bytes that need to be cut from the item. */
 	quota_cut_bytes =
 	    (mode ==
-	     M_DELETE) ? ih_item_len(get_ih(path)) : -s_cut_balance.
+	     M_DELETE) ? ih_item_len(tp_item_head(path)) : -s_cut_balance.
 	    insert_size[0];
 	if (retval2 == -1)
 		ret_value = calc_deleted_bytes_number(&s_cut_balance, mode);
@@ -1681,7 +1681,7 @@ int reiserfs_cut_from_item(struct reiser
 	/* For direct items, we only change the quota when deleting the last
 	 ** item.
 	 */
-	p_le_ih = PATH_PITEM_HEAD(s_cut_balance.tb_path);
+	p_le_ih = tp_item_head(s_cut_balance.tb_path);
 	if (!S_ISLNK(inode->i_mode) && is_direct_le_ih(p_le_ih)) {
 		if (mode == M_DELETE &&
 		    (le_ih_k_offset(p_le_ih) & (sb->s_blocksize - 1)) ==
@@ -1696,7 +1696,7 @@ int reiserfs_cut_from_item(struct reiser
 #ifdef CONFIG_REISERFS_CHECK
 	if (is_inode_locked) {
 		struct item_head *le_ih =
-		    PATH_PITEM_HEAD(s_cut_balance.tb_path);
+		    tp_item_head(s_cut_balance.tb_path);
 		/* we are going to complete indirect2direct conversion. Make
 		   sure, that we exactly remove last unformatted node pointer
 		   of the item */
@@ -1819,7 +1819,7 @@ int reiserfs_do_truncate(struct reiserfs
 	s_search_path.pos_in_item--;
 
 	/* Get real file size (total length of all file items) */
-	p_le_ih = PATH_PITEM_HEAD(&s_search_path);
+	p_le_ih = tp_item_head(&s_search_path);
 	if (is_statdata_le_ih(p_le_ih))
 		file_size = 0;
 	else {
@@ -1922,7 +1922,7 @@ int reiserfs_do_truncate(struct reiserfs
 static void check_research_for_paste(struct treepath *path,
 				     const struct cpu_key *key)
 {
-	struct item_head *found_ih = get_ih(path);
+	struct item_head *found_ih = tp_item_head(path);
 
 	if (is_direct_le_ih(found_ih)) {
 		if (le_ih_k_offset(found_ih) +
--- a/fs/reiserfs/super.c
+++ b/fs/reiserfs/super.c
@@ -259,7 +259,7 @@ static int finish_unfinished(struct supe
 			break;
 		}
 		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);
--- a/fs/reiserfs/tail_conversion.c
+++ b/fs/reiserfs/tail_conversion.c
@@ -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_tran
 		return -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_tran
 			reiserfs_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 -



^ permalink raw reply	[flat|nested] 50+ messages in thread

* [patch 04/29] reiserfs: cleanup, remove nblocks argument from journal_end
  2014-04-23 14:00 [patch 00/29] reiserfs cleanup patchset Jeff Mahoney
  2014-04-23 14:00 ` [patch 01/29] reiserfs: use per-fs commit workqueues Jeff Mahoney
  2014-04-23 14:00 ` [patch 02/29] reiserfs: cleanup, rename key and item accessors to more friendly names Jeff Mahoney
@ 2014-04-23 14:00 ` Jeff Mahoney
  2014-04-23 14:00 ` [patch 05/29] reiserfs: cleanup, remove sb " Jeff Mahoney
                   ` (27 subsequent siblings)
  30 siblings, 0 replies; 50+ messages in thread
From: Jeff Mahoney @ 2014-04-23 14:00 UTC (permalink / raw)
  To: ReiserFS Development List; +Cc: Jan Kara, Dave Jones

[-- Attachment #1: reiserfs/reiserfs-cleanup-remove-nblocks-argument-from-journal_end --]
[-- Type: text/plain, Size: 23410 bytes --]

journal_end takes a block count argument but doesn't actually use it
for anything. We can remove it.

Signed-off-by: Jeff Mahoney <jeffm@suse.com>
---
 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(-)

--- a/fs/reiserfs/file.c
+++ b/fs/reiserfs/file.c
@@ -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);
 	}
--- a/fs/reiserfs/inode.c
+++ b/fs/reiserfs/inode.c
@@ -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 re
 		return 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 *i
 		reiserfs_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_t
 	if (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_t
 		if (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_t
 		if (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_t
 	reiserfs_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 fil
 		mark_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 *f
 		mark_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 *dent
 		if (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;
--- a/fs/reiserfs/journal.c
+++ b/fs/reiserfs/journal.c
@@ -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 rei
 	if (!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_t
 	return 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 inod
 			reiserfs_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);
--- a/fs/reiserfs/namei.c
+++ b/fs/reiserfs/namei.c
@@ -672,7 +672,7 @@ static int reiserfs_create(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);
@@ -684,7 +684,7 @@ static int reiserfs_create(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);
@@ -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 inode
 		int 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 inode
 
 	unlock_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 inode
 		if (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 inode
 				pathrelse(&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 inode
 		reiserfs_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;
 }
--- a/fs/reiserfs/reiserfs.h
+++ b/fs/reiserfs/reiserfs.h
@@ -2914,10 +2914,9 @@ int journal_init(struct super_block *, c
 int 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);
--- a/fs/reiserfs/resize.c
+++ b/fs/reiserfs/resize.c
@@ -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);
 }
--- a/fs/reiserfs/stree.c
+++ b/fs/reiserfs/stree.c
@@ -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,
--- a/fs/reiserfs/super.c
+++ b/fs/reiserfs/super.c
@@ -75,7 +75,7 @@ static int reiserfs_sync_fs(struct super
 	dquot_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 su
 
 
 		journal_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;
 	}
--- a/fs/reiserfs/xattr.c
+++ b/fs/reiserfs/xattr.c
@@ -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;
--- a/fs/reiserfs/xattr_acl.c
+++ b/fs/reiserfs/xattr_acl.c
@@ -39,7 +39,7 @@ reiserfs_set_acl(struct inode *inode, st
 	if (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;



^ permalink raw reply	[flat|nested] 50+ messages in thread

* [patch 05/29] reiserfs: cleanup, remove sb argument from journal_end
  2014-04-23 14:00 [patch 00/29] reiserfs cleanup patchset Jeff Mahoney
                   ` (2 preceding siblings ...)
  2014-04-23 14:00 ` [patch 04/29] reiserfs: cleanup, remove nblocks argument from journal_end Jeff Mahoney
@ 2014-04-23 14:00 ` Jeff Mahoney
  2014-04-23 14:00 ` [patch 06/29] reiserfs: cleanup, remove sb argument from journal_mark_dirty Jeff Mahoney
                   ` (26 subsequent siblings)
  30 siblings, 0 replies; 50+ messages in thread
From: Jeff Mahoney @ 2014-04-23 14:00 UTC (permalink / raw)
  To: ReiserFS Development List; +Cc: Jan Kara, Dave Jones

[-- Attachment #1: reiserfs/reiserfs-cleanup-remove-sb-argument-from-journal_end --]
[-- Type: text/plain, Size: 22221 bytes --]

journal_end doesn't need a separate sb argument; it's provided by the
transaction handle.

Signed-off-by: Jeff Mahoney <jeffm@suse.com>
---
 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(-)

--- a/fs/reiserfs/file.c
+++ b/fs/reiserfs/file.c
@@ -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);
 	}
--- a/fs/reiserfs/inode.c
+++ b/fs/reiserfs/inode.c
@@ -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 re
 		return 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 *i
 		reiserfs_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_t
 	if (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_t
 		if (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_t
 		if (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_t
 	reiserfs_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 fil
 		mark_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 *f
 		mark_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 *dent
 		if (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;
--- a/fs/reiserfs/journal.c
+++ b/fs/reiserfs/journal.c
@@ -83,8 +83,7 @@
 #define COMMIT_NOW  2		/* end and commit this transaction */
 #define WAIT        4		/* wait for the log blocks to hit the disk */
 
-static int do_journal_end(struct reiserfs_transaction_handle *,
-			  struct super_block *, int flags);
+static int do_journal_end(struct reiserfs_transaction_handle *, 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,
@@ -1920,7 +1919,7 @@ static int do_journal_release(struct rei
 	if (!error && !(sb->s_flags & MS_RDONLY)) {
 		/* end the current trans */
 		BUG_ON(!th->t_trans_id);
-		do_journal_end(th, sb, FLUSH_ALL);
+		do_journal_end(th, FLUSH_ALL);
 
 		/*
 		 * make sure something gets logged to force
@@ -1932,7 +1931,7 @@ static int do_journal_release(struct rei
 						     1);
 			journal_mark_dirty(&myth, sb,
 					   SB_BUFFER_WITH_SB(sb));
-			do_journal_end(&myth, sb, FLUSH_ALL);
+			do_journal_end(&myth, FLUSH_ALL);
 			flushed = 1;
 		}
 	}
@@ -1946,7 +1945,7 @@ static int do_journal_release(struct rei
 						     1);
 			journal_mark_dirty(&myth, sb,
 					   SB_BUFFER_WITH_SB(sb));
-			do_journal_end(&myth, sb, FLUSH_ALL);
+			do_journal_end(&myth, FLUSH_ALL);
 		}
 	}
 
@@ -3101,9 +3100,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, 0);
+			retval = do_journal_end(&myth, 0);
 		} else {
-			retval = do_journal_end(&myth, sb, COMMIT_NOW);
+			retval = do_journal_end(&myth, COMMIT_NOW);
 		}
 
 		if (retval)
@@ -3173,7 +3172,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);
+		ret = journal_end(th);
 	else
 		ret = -EIO;
 	if (th->t_refcount == 0) {
@@ -3374,8 +3373,9 @@ int journal_mark_dirty(struct reiserfs_t
 	return 0;
 }
 
-int journal_end(struct reiserfs_transaction_handle *th, struct super_block *sb)
+int journal_end(struct reiserfs_transaction_handle *th)
 {
+	struct super_block *sb = th->t_super;
 	if (!current->journal_info && th->t_refcount > 1)
 		reiserfs_warning(sb, "REISER-NESTING",
 				 "th NULL, refcount %d", th->t_refcount);
@@ -3402,7 +3402,7 @@ int journal_end(struct reiserfs_transact
 		}
 		return 0;
 	} else {
-		return do_journal_end(th, sb, 0);
+		return do_journal_end(th, 0);
 	}
 }
 
@@ -3511,9 +3511,9 @@ static int can_dirty(struct reiserfs_jou
  * syncs the commit blocks, but does not force the real buffers to disk
  * will wait until the current transaction is done/committed before returning
  */
-int journal_end_sync(struct reiserfs_transaction_handle *th,
-		     struct super_block *sb)
+int journal_end_sync(struct reiserfs_transaction_handle *th)
 {
+	struct super_block *sb = th->t_super;
 	struct reiserfs_journal *journal = SB_JOURNAL(sb);
 
 	BUG_ON(!th->t_trans_id);
@@ -3524,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, COMMIT_NOW | WAIT);
+	return do_journal_end(th, COMMIT_NOW | WAIT);
 }
 
 /* writeback the pending async commits to disk */
@@ -3584,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, COMMIT_NOW | WAIT);
+			do_journal_end(&th, COMMIT_NOW | WAIT);
 		}
 	}
 }
@@ -3604,8 +3604,7 @@ void reiserfs_flush_old_commits(struct s
  * Note, we can't allow the journal_end to proceed while there are still
  * writers in the log.
  */
-static int check_journal_end(struct reiserfs_transaction_handle *th,
-			     struct super_block *sb, int flags)
+static int check_journal_end(struct reiserfs_transaction_handle *th, int flags)
 {
 
 	time_t now;
@@ -3613,6 +3612,7 @@ static int check_journal_end(struct reis
 	int commit_now = flags & COMMIT_NOW;
 	int wait_on_commit = flags & WAIT;
 	struct reiserfs_journal_list *jl;
+	struct super_block *sb = th->t_super;
 	struct reiserfs_journal *journal = SB_JOURNAL(sb);
 
 	BUG_ON(!th->t_trans_id);
@@ -3864,11 +3864,11 @@ static int __commit_trans_jl(struct inod
 			reiserfs_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);
+			ret = journal_end(&th);
 			goto flush_commit_only;
 		}
 
-		ret = journal_end_sync(&th, sb);
+		ret = journal_end_sync(&th);
 		if (!ret)
 			ret = 1;
 
@@ -3974,9 +3974,9 @@ int reiserfs_prepare_for_journal(struct
  * If the journal is aborted, we just clean up. Things like flushing
  * journal lists, etc just won't happen.
  */
-static int do_journal_end(struct reiserfs_transaction_handle *th,
-			  struct super_block *sb, int flags)
+static int do_journal_end(struct reiserfs_transaction_handle *th, int flags)
 {
+	struct super_block *sb = th->t_super;
 	struct reiserfs_journal *journal = SB_JOURNAL(sb);
 	struct reiserfs_journal_cnode *cn, *next, *jl_cn;
 	struct reiserfs_journal_cnode *last_cn = NULL;
@@ -3998,6 +3998,7 @@ static int do_journal_end(struct reiserf
 
 	BUG_ON(th->t_refcount > 1);
 	BUG_ON(!th->t_trans_id);
+	BUG_ON(!th->t_super);
 
 	/*
 	 * protect flush_older_commits from doing mistakes if the
@@ -4031,7 +4032,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, flags)) {
+	if (!check_journal_end(th, flags)) {
 		reiserfs_schedule_old_flush(sb);
 		wake_queued_writers(sb);
 		reiserfs_async_progress_wait(sb);
--- a/fs/reiserfs/namei.c
+++ b/fs/reiserfs/namei.c
@@ -672,7 +672,7 @@ static int reiserfs_create(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);
@@ -684,7 +684,7 @@ static int reiserfs_create(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);
@@ -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 inode
 		int 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 inode
 
 	unlock_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 inode
 		if (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 inode
 				pathrelse(&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 inode
 		reiserfs_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;
 }
--- a/fs/reiserfs/reiserfs.h
+++ b/fs/reiserfs/reiserfs.h
@@ -2914,9 +2914,8 @@ int journal_init(struct super_block *, c
 int 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);
--- a/fs/reiserfs/resize.c
+++ b/fs/reiserfs/resize.c
@@ -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);
 }
--- a/fs/reiserfs/stree.c
+++ b/fs/reiserfs/stree.c
@@ -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,
--- a/fs/reiserfs/super.c
+++ b/fs/reiserfs/super.c
@@ -75,7 +75,7 @@ static int reiserfs_sync_fs(struct super
 	dquot_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 su
 
 
 		journal_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;
 	}
--- a/fs/reiserfs/xattr.c
+++ b/fs/reiserfs/xattr.c
@@ -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;
--- a/fs/reiserfs/xattr_acl.c
+++ b/fs/reiserfs/xattr_acl.c
@@ -39,7 +39,7 @@ reiserfs_set_acl(struct inode *inode, st
 	if (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;



^ permalink raw reply	[flat|nested] 50+ messages in thread

* [patch 06/29] reiserfs: cleanup, remove sb argument from journal_mark_dirty
  2014-04-23 14:00 [patch 00/29] reiserfs cleanup patchset Jeff Mahoney
                   ` (3 preceding siblings ...)
  2014-04-23 14:00 ` [patch 05/29] reiserfs: cleanup, remove sb " Jeff Mahoney
@ 2014-04-23 14:00 ` Jeff Mahoney
  2014-04-23 14:00 ` [patch 07/29] reiserfs: cleanup, remove blocks arg from journal_join Jeff Mahoney
                   ` (25 subsequent siblings)
  30 siblings, 0 replies; 50+ messages in thread
From: Jeff Mahoney @ 2014-04-23 14:00 UTC (permalink / raw)
  To: ReiserFS Development List; +Cc: Jan Kara, Dave Jones

[-- Attachment #1: reiserfs/reiserfs-cleanup-remove-sb-argument-from-journal_mark_dirty --]
[-- Type: text/plain, Size: 12177 bytes --]

journal_mark_dirty doesn't need a separate sb argument; It's provided
by the transaction handle.

Signed-off-by: Jeff Mahoney <jeffm@suse.com>
---
 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(-)

--- a/fs/reiserfs/bitmap.c
+++ b/fs/reiserfs/bitmap.c
@@ -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);
--- a/fs/reiserfs/do_balan.c
+++ b/fs/reiserfs/do_balan.c
@@ -56,8 +56,7 @@ static inline void buffer_info_init_bh(s
 inline 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
--- a/fs/reiserfs/file.c
+++ b/fs/reiserfs/file.c
@@ -212,7 +212,7 @@ int reiserfs_commit_page(struct inode *i
 			set_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);
 				/*
--- a/fs/reiserfs/fix_node.c
+++ b/fs/reiserfs/fix_node.c
@@ -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;
--- a/fs/reiserfs/inode.c
+++ b/fs/reiserfs/inode.c
@@ -816,7 +816,7 @@ int reiserfs_get_block(struct inode *ino
 				reiserfs_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 reis
 		break;
 	}
 	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(struc
 		memcpy(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(stru
 
 		if (checked) {
 			reiserfs_prepare_for_journal(s, bh, 1);
-			journal_mark_dirty(&th, s, bh);
+			journal_mark_dirty(&th, bh);
 			continue;
 		}
 		/*
--- a/fs/reiserfs/journal.c
+++ b/fs/reiserfs/journal.c
@@ -1929,8 +1929,7 @@ static int do_journal_release(struct rei
 			reiserfs_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 rei
 			reiserfs_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_tra
 	if (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 s
 			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));
 
 			/*
 			 * we're only being called from kreiserfsd, it makes
@@ -3863,7 +3861,7 @@ static int __commit_trans_jl(struct inod
 		if (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 reiserf
 	if (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);
--- a/fs/reiserfs/namei.c
+++ b/fs/reiserfs/namei.c
@@ -1531,10 +1531,10 @@ static int reiserfs_rename(struct inode
 
 	mark_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 inode
 	if (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
--- a/fs/reiserfs/objectid.c
+++ b/fs/reiserfs/objectid.c
@@ -89,7 +89,7 @@ __u32 reiserfs_get_unused_objectid(struc
 		set_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 re
 	check_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
--- a/fs/reiserfs/reiserfs.h
+++ b/fs/reiserfs/reiserfs.h
@@ -2864,7 +2864,7 @@ void reiserfs_free_jh(struct buffer_head
 int 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)
 {
--- a/fs/reiserfs/resize.c
+++ b/fs/reiserfs/resize.c
@@ -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);
--- a/fs/reiserfs/stree.c
+++ b/fs/reiserfs/stree.c
@@ -1101,7 +1101,7 @@ static char prepare_for_delete_or_cut(st
 		    if (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);
 		    }
 
--- a/fs/reiserfs/super.c
+++ b/fs/reiserfs/super.c
@@ -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 super
 		if (!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 su
 			set_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(stru
 		unlock_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);



^ permalink raw reply	[flat|nested] 50+ messages in thread

* [patch 07/29] reiserfs: cleanup, remove blocks arg from journal_join
  2014-04-23 14:00 [patch 00/29] reiserfs cleanup patchset Jeff Mahoney
                   ` (4 preceding siblings ...)
  2014-04-23 14:00 ` [patch 06/29] reiserfs: cleanup, remove sb argument from journal_mark_dirty Jeff Mahoney
@ 2014-04-23 14:00 ` Jeff Mahoney
  2014-04-23 14:00 ` [patch 08/29] reiserfs: cleanup, remove leading whitespace from labels Jeff Mahoney
                   ` (24 subsequent siblings)
  30 siblings, 0 replies; 50+ messages in thread
From: Jeff Mahoney @ 2014-04-23 14:00 UTC (permalink / raw)
  To: ReiserFS Development List; +Cc: Jan Kara, Dave Jones

[-- Attachment #1: reiserfs/reiserfs-cleanup-remove-blocks-arg-from-journal_join --]
[-- Type: text/plain, Size: 4082 bytes --]

journal_join is always called with a block count of 1. Let's just get
rid of the argument.

Signed-off-by: Jeff Mahoney <jeffm@suse.com>
---
 fs/reiserfs/file.c     |    2 +-
 fs/reiserfs/journal.c  |   18 +++++++++---------
 fs/reiserfs/reiserfs.h |    2 +-
 3 files changed, 11 insertions(+), 11 deletions(-)

--- a/fs/reiserfs/file.c
+++ b/fs/reiserfs/file.c
@@ -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) {
 			/*
--- a/fs/reiserfs/journal.c
+++ b/fs/reiserfs/journal.c
@@ -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);
--- a/fs/reiserfs/reiserfs.h
+++ b/fs/reiserfs/reiserfs.h
@@ -2924,7 +2924,7 @@ int reiserfs_in_journal(struct super_blo
 int 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,



^ permalink raw reply	[flat|nested] 50+ messages in thread

* [patch 08/29] reiserfs: cleanup, remove leading whitespace from labels
  2014-04-23 14:00 [patch 00/29] reiserfs cleanup patchset Jeff Mahoney
                   ` (5 preceding siblings ...)
  2014-04-23 14:00 ` [patch 07/29] reiserfs: cleanup, remove blocks arg from journal_join Jeff Mahoney
@ 2014-04-23 14:00 ` Jeff Mahoney
  2014-04-23 14:00 ` [patch 09/29] reiserfs: cleanup, remove unnecessary parens Jeff Mahoney
                   ` (23 subsequent siblings)
  30 siblings, 0 replies; 50+ messages in thread
From: Jeff Mahoney @ 2014-04-23 14:00 UTC (permalink / raw)
  To: ReiserFS Development List; +Cc: Jan Kara, Dave Jones

[-- Attachment #1: reiserfs/reiserfs-cleanup-remove-leading-whitespace-from-labels --]
[-- Type: text/plain, Size: 16267 bytes --]

This patch moves reiserfs closer to adhering to the style rules by
removing leading whitespace from labels.

Signed-off-by: Jeff Mahoney <jeffm@suse.com>
---
 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(-)

--- a/fs/reiserfs/bitmap.c
+++ b/fs/reiserfs/bitmap.c
@@ -167,7 +167,7 @@ static int scan_bitmap_block(struct reis
 		return 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;
 
--- a/fs/reiserfs/dir.c
+++ b/fs/reiserfs/dir.c
@@ -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
--- a/fs/reiserfs/file.c
+++ b/fs/reiserfs/file.c
@@ -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);
 	}
 	/*
--- a/fs/reiserfs/fix_node.c
+++ b/fs/reiserfs/fix_node.c
@@ -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
--- a/fs/reiserfs/inode.c
+++ b/fs/reiserfs/inode.c
@@ -449,7 +449,7 @@ static int _get_block_create_0(struct in
 	flush_dcache_page(bh_result->b_page);
 	kunmap(bh_result->b_page);
 
-      finished:
+finished:
 	pathrelse(&path);
 
 	if (result == IO_ERROR)
@@ -558,7 +558,7 @@ static int reiserfs_get_blocks_direct_io
 		if (err < 0)
 			ret = err;
 	}
-      out:
+out:
 	return ret;
 }
 
@@ -626,12 +626,12 @@ static int convert_tail_for_hole(struct
 
 	retval = reiserfs_commit_write(NULL, tail_page, tail_start, tail_end);
 
-      unlock:
+unlock:
 	if (tail_page != hole_page) {
 		unlock_page(tail_page);
 		page_cache_release(tail_page);
 	}
-      out:
+out:
 	return retval;
 }
 
@@ -727,7 +727,7 @@ int reiserfs_get_block(struct inode *ino
 	/* set the key of the first byte in the 'block'-th block of file */
 	make_cpu_key(&key, inode, new_offset, TYPE_ANY, 3 /*key length */ );
 	if ((new_offset + inode->i_sb->s_blocksize - 1) > inode->i_size) {
-	      start_trans:
+start_trans:
 		th = reiserfs_persistent_transaction(inode->i_sb, jbegin_count);
 		if (!th) {
 			retval = -ENOMEM;
@@ -735,7 +735,7 @@ int reiserfs_get_block(struct inode *ino
 		}
 		reiserfs_update_inode_transaction(inode);
 	}
-      research:
+research:
 
 	retval = search_for_position_by_key(inode->i_sb, &key, &path);
 	if (retval == IO_ERROR) {
@@ -1143,7 +1143,7 @@ int reiserfs_get_block(struct inode *ino
 
 	retval = 0;
 
-      failure:
+failure:
 	if (th && (!dangle || (retval && !th->t_trans_id))) {
 		int err;
 		if (th->t_trans_id)
@@ -2137,7 +2137,7 @@ int reiserfs_new_inode(struct reiserfs_t
 
 	return 0;
 
-      out_bad_inode:
+out_bad_inode:
 	/* Invalidate the object, nothing was inserted yet */
 	INODE_PKEY(inode)->k_objectid = 0;
 
@@ -2146,7 +2146,7 @@ int reiserfs_new_inode(struct reiserfs_t
 	dquot_free_inode(inode);
 	reiserfs_write_lock_nested(inode->i_sb, depth);
 
-      out_end_trans:
+out_end_trans:
 	journal_end(th);
 	/*
 	 * Drop can be outside and it needs more credits so it's better
@@ -2158,7 +2158,7 @@ int reiserfs_new_inode(struct reiserfs_t
 	inode->i_flags |= S_NOQUOTA;
 	make_bad_inode(inode);
 
-      out_inserted_sd:
+out_inserted_sd:
 	clear_nlink(inode);
 	th->t_trans_id = 0;	/* so the caller can't use this handle later */
 	unlock_new_inode(inode); /* OK to do even if we hadn't locked it */
@@ -2245,10 +2245,10 @@ static int grab_tail_page(struct inode *
 	*bh_result = bh;
 	*page_result = page;
 
-      out:
+out:
 	return error;
 
-      unlock:
+unlock:
 	unlock_page(page);
 	page_cache_release(page);
 	return error;
@@ -2350,7 +2350,7 @@ int reiserfs_truncate_file(struct inode
 	reiserfs_write_unlock(inode->i_sb);
 
 	return 0;
-      out:
+out:
 	if (page) {
 		unlock_page(page);
 		page_cache_release(page);
@@ -2393,11 +2393,11 @@ static int map_block_for_writepage(struc
 	}
 
 	kmap(bh_result->b_page);
-      start_over:
+start_over:
 	reiserfs_write_lock(inode->i_sb);
 	make_cpu_key(&key, inode, byte_offset, TYPE_ANY, 3);
 
-      research:
+research:
 	retval = search_for_position_by_key(inode->i_sb, &key, &path);
 	if (retval != POSITION_FOUND) {
 		use_get_block = 1;
@@ -2477,7 +2477,7 @@ static int map_block_for_writepage(struc
 	}
 	retval = 0;
 
-      out:
+out:
 	pathrelse(&path);
 	if (trans_running) {
 		int err = journal_end(&th);
@@ -2675,7 +2675,7 @@ static int reiserfs_write_full_page(stru
 	} while (bh != head);
 
 	error = 0;
-      done:
+done:
 	if (nr == 0) {
 		/*
 		 * if this page only had a direct item, it is very possible for
@@ -2697,7 +2697,7 @@ static int reiserfs_write_full_page(stru
 	}
 	return error;
 
-      fail:
+fail:
 	/*
 	 * catches various errors, we need to make sure any valid dirty blocks
 	 * get to the media.  The page is currently locked and not marked for
@@ -2969,7 +2969,7 @@ static int reiserfs_write_end(struct fil
 			goto out;
 	}
 
-      out:
+out:
 	if (locked)
 		reiserfs_write_unlock(inode->i_sb);
 	unlock_page(page);
@@ -2980,7 +2980,7 @@ static int reiserfs_write_end(struct fil
 
 	return ret == 0 ? copied : ret;
 
-      journal_error:
+journal_error:
 	reiserfs_write_unlock(inode->i_sb);
 	locked = false;
 	if (th) {
@@ -3054,10 +3054,10 @@ int reiserfs_commit_write(struct file *f
 			goto out;
 	}
 
-      out:
+out:
 	return ret;
 
-      journal_error:
+journal_error:
 	if (th) {
 		if (!update_sd)
 			reiserfs_update_sd(th, inode);
@@ -3163,7 +3163,7 @@ static int invalidatepage_can_drop(struc
 		    && jl != SB_JOURNAL(inode->i_sb)->j_current_jl)
 			ret = 0;
 	}
-      free_jh:
+free_jh:
 	if (ret && bh->b_private) {
 		reiserfs_free_jh(bh);
 	}
@@ -3222,7 +3222,7 @@ static void reiserfs_invalidatepage(stru
 		ret = try_to_release_page(page, 0);
 		/* maybe should BUG_ON(!ret); - neilb */
 	}
-      out:
+out:
 	return;
 }
 
--- a/fs/reiserfs/ioctl.c
+++ b/fs/reiserfs/ioctl.c
@@ -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;
--- a/fs/reiserfs/journal.c
+++ b/fs/reiserfs/journal.c
@@ -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(spinloc
 			reiserfs_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 su
 	unsigned 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 supe
 		atomic_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 sup
 		reiserfs_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 s
 		write_chunk(&chunk);
 	}
 
-      done:
+done:
 	mutex_unlock(&journal->j_flush_mutex);
 	return ret;
 }
@@ -2229,7 +2229,7 @@ static int journal_read_transaction(stru
 			reiserfs_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_blo
 		brelse(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 rei
 	INIT_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));
--- a/fs/reiserfs/namei.c
+++ b/fs/reiserfs/namei.c
@@ -686,7 +686,7 @@ static int reiserfs_create(struct inode
 	d_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 inode
 	reiserfs_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 inode
 	unlock_new_inode(inode);
 	d_instantiate(dentry, inode);
 	retval = journal_end(&th);
-      out_failed:
+out_failed:
 	reiserfs_write_unlock(parent_dir->i_sb);
 	return retval;
 }
--- a/fs/reiserfs/stree.c
+++ b/fs/reiserfs/stree.c
@@ -668,7 +668,7 @@ int search_by_key(struct super_block *sb
 			if (!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 reis
 	while ((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 reis
 		return 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 reiserfs
 	while ((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
--- a/fs/reiserfs/xattr.c
+++ b/fs/reiserfs/xattr.c
@@ -423,7 +423,7 @@ static struct page *reiserfs_get_page(st
 	}
 	return page;
 
-      fail:
+fail:
 	reiserfs_put_page(page);
 	return ERR_PTR(-EIO);
 }
--- a/fs/reiserfs/xattr_acl.c
+++ b/fs/reiserfs/xattr_acl.c
@@ -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 reis
 
 	return err;
 
-      apply_umask:
+apply_umask:
 	/* no ACL, apply umask */
 	inode->i_mode &= ~current_umask();
 	return err;



^ permalink raw reply	[flat|nested] 50+ messages in thread

* [patch 09/29] reiserfs: cleanup, remove unnecessary parens
  2014-04-23 14:00 [patch 00/29] reiserfs cleanup patchset Jeff Mahoney
                   ` (6 preceding siblings ...)
  2014-04-23 14:00 ` [patch 08/29] reiserfs: cleanup, remove leading whitespace from labels Jeff Mahoney
@ 2014-04-23 14:00 ` Jeff Mahoney
  2014-04-23 14:00 ` [patch 10/29] reiserfs: cleanup, remove unnecessary parens in dirent creation Jeff Mahoney
                   ` (22 subsequent siblings)
  30 siblings, 0 replies; 50+ messages in thread
From: Jeff Mahoney @ 2014-04-23 14:00 UTC (permalink / raw)
  To: ReiserFS Development List; +Cc: Jan Kara, Dave Jones

[-- Attachment #1: reiserfs/reiserfs-cleanup-remove-unnecessary-parens --]
[-- Type: text/plain, Size: 34398 bytes --]

The 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.

Signed-off-by: Jeff Mahoney <jeffm@suse.com>
---

 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(-)

--- a/fs/reiserfs/bitmap.c
+++ b/fs/reiserfs/bitmap.c
@@ -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 re
 	if (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;
--- a/fs/reiserfs/dir.c
+++ b/fs/reiserfs/dir.c
@@ -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,
--- a/fs/reiserfs/do_balan.c
+++ b/fs/reiserfs/do_balan.c
@@ -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);
 
 	/*
--- a/fs/reiserfs/file.c
+++ b/fs/reiserfs/file.c
@@ -41,10 +41,10 @@ static int reiserfs_file_release(struct
         if (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(struct
 	if ((!(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. */
--- a/fs/reiserfs/fix_node.c
+++ b/fs/reiserfs/fix_node.c
@@ -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)
--- a/fs/reiserfs/ibalance.c
+++ b/fs/reiserfs/ibalance.c
@@ -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);
 
--- a/fs/reiserfs/inode.c
+++ b/fs/reiserfs/inode.c
@@ -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_t
 	else
 		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_t
 	REISERFS_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;
--- a/fs/reiserfs/item_ops.c
+++ b/fs/reiserfs/item_ops.c
@@ -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));
--- a/fs/reiserfs/journal.c
+++ b/fs/reiserfs/journal.c
@@ -1016,9 +1016,9 @@ static int flush_commit_list(struct supe
 	BUG_ON(jl->j_trans_id == 0);
 
 	/* this commit is done, exit */
-	if (atomic_read(&(jl->j_commit_left)) <= 0) {
+	if (atomic_read(&jl->j_commit_left) <= 0) {
 		if (flushall) {
-			atomic_set(&(jl->j_older_commits_done), 1);
+			atomic_set(&jl->j_older_commits_done, 1);
 		}
 		mutex_unlock(&jl->j_commit_mutex);
 		goto put_jl;
@@ -1094,10 +1094,10 @@ static int flush_commit_list(struct supe
 		put_bh(tbh);
 		/* once due to original getblk in do_journal_end */
 		put_bh(tbh);
-		atomic_dec(&(jl->j_commit_left));
+		atomic_dec(&jl->j_commit_left);
 	}
 
-	BUG_ON(atomic_read(&(jl->j_commit_left)) != 1);
+	BUG_ON(atomic_read(&jl->j_commit_left) != 1);
 
 	/*
 	 * If there was a write error in the journal - we can't commit
@@ -1147,10 +1147,10 @@ static int flush_commit_list(struct supe
 	/* mark the metadata dirty */
 	if (!retval)
 		dirty_one_transaction(s, jl);
-	atomic_dec(&(jl->j_commit_left));
+	atomic_dec(&jl->j_commit_left);
 
 	if (flushall) {
-		atomic_set(&(jl->j_older_commits_done), 1);
+		atomic_set(&jl->j_older_commits_done, 1);
 	}
 	mutex_unlock(&jl->j_commit_mutex);
 put_jl:
@@ -1379,8 +1379,8 @@ static int flush_journal_list(struct sup
 	}
 
 	/* if all the work is already done, get out of here */
-	if (atomic_read(&(jl->j_nonzerolen)) <= 0 &&
-	    atomic_read(&(jl->j_commit_left)) <= 0) {
+	if (atomic_read(&jl->j_nonzerolen) <= 0 &&
+	    atomic_read(&jl->j_commit_left) <= 0) {
 		goto flush_older_and_return;
 	}
 
@@ -1395,8 +1395,8 @@ static int flush_journal_list(struct sup
 		BUG();
 
 	/* are we done now? */
-	if (atomic_read(&(jl->j_nonzerolen)) <= 0 &&
-	    atomic_read(&(jl->j_commit_left)) <= 0) {
+	if (atomic_read(&jl->j_nonzerolen) <= 0 &&
+	    atomic_read(&jl->j_commit_left) <= 0) {
 		goto flush_older_and_return;
 	}
 
@@ -1404,7 +1404,7 @@ static int flush_journal_list(struct sup
 	 * loop through each cnode, see if we need to write it,
 	 * or wait on a more recent transaction, or just ignore it
 	 */
-	if (atomic_read(&(journal->j_wcount)) != 0) {
+	if (atomic_read(&journal->j_wcount) != 0) {
 		reiserfs_panic(s, "journal-844", "journal list is flushing, "
 			       "wcount is not 0");
 	}
@@ -1513,7 +1513,7 @@ free_cnode:
 			 * taking the buffer head away
 			 */
 			put_bh(saved_bh);
-			if (atomic_read(&(saved_bh->b_count)) < 0) {
+			if (atomic_read(&saved_bh->b_count) < 0) {
 				reiserfs_warning(s, "journal-945",
 						 "saved_bh->b_count < 0");
 			}
@@ -1614,7 +1614,7 @@ flush_older_and_return:
 	 * help find code using dead lists later on
 	 */
 	jl->j_len = 0;
-	atomic_set(&(jl->j_nonzerolen), 0);
+	atomic_set(&jl->j_nonzerolen, 0);
 	jl->j_start = 0;
 	jl->j_realblock = NULL;
 	jl->j_commit_bh = NULL;
@@ -1873,7 +1873,7 @@ void remove_journal_hash(struct super_bl
 			 * dec the nonzerolen
 			 */
 			if (cur->bh && cur->jlist)
-				atomic_dec(&(cur->jlist->j_nonzerolen));
+				atomic_dec(&cur->jlist->j_nonzerolen);
 			cur->bh = NULL;
 			cur->jlist = NULL;
 		}
@@ -2836,20 +2836,20 @@ int journal_init(struct super_block *sb,
 	journal->j_start = 0;
 	journal->j_len = 0;
 	journal->j_len_alloc = 0;
-	atomic_set(&(journal->j_wcount), 0);
-	atomic_set(&(journal->j_async_throttle), 0);
+	atomic_set(&journal->j_wcount, 0);
+	atomic_set(&journal->j_async_throttle, 0);
 	journal->j_bcount = 0;
 	journal->j_trans_start_time = 0;
 	journal->j_last = NULL;
 	journal->j_first = NULL;
-	init_waitqueue_head(&(journal->j_join_wait));
+	init_waitqueue_head(&journal->j_join_wait);
 	mutex_init(&journal->j_mutex);
 	mutex_init(&journal->j_flush_mutex);
 
 	journal->j_trans_id = 10;
 	journal->j_mount_id = 10;
 	journal->j_state = 0;
-	atomic_set(&(journal->j_jlock), 0);
+	atomic_set(&journal->j_jlock, 0);
 	journal->j_cnode_free_list = allocate_cnodes(num_cnodes);
 	journal->j_cnode_free_orig = journal->j_cnode_free_list;
 	journal->j_cnode_free = journal->j_cnode_free_list ? num_cnodes : 0;
@@ -2913,7 +2913,7 @@ int journal_transaction_should_end(struc
 		return 0;
 	if (journal->j_must_wait > 0 ||
 	    (journal->j_len_alloc + new_alloc) >= journal->j_max_batch ||
-	    atomic_read(&(journal->j_jlock)) ||
+	    atomic_read(&journal->j_jlock) ||
 	    (now - journal->j_trans_start_time) > journal->j_max_trans_age ||
 	    journal->j_cnode_free < (journal->j_trans_max * 3)) {
 		return 1;
@@ -3113,7 +3113,7 @@ relock:
 	if (journal->j_trans_start_time == 0) {
 		journal->j_trans_start_time = get_seconds();
 	}
-	atomic_inc(&(journal->j_wcount));
+	atomic_inc(&journal->j_wcount);
 	journal->j_len_alloc += nblocks;
 	th->t_blocks_logged = 0;
 	th->t_blocks_allocated = nblocks;
@@ -3306,10 +3306,10 @@ int journal_mark_dirty(struct reiserfs_t
 				 buffer_journal_dirty(bh) ? ' ' : '!');
 	}
 
-	if (atomic_read(&(journal->j_wcount)) <= 0) {
+	if (atomic_read(&journal->j_wcount) <= 0) {
 		reiserfs_warning(sb, "journal-1409",
 				 "returning because j_wcount was %d",
-				 atomic_read(&(journal->j_wcount)));
+				 atomic_read(&journal->j_wcount));
 		return 1;
 	}
 	/*
@@ -3448,7 +3448,7 @@ static int remove_from_transaction(struc
 		clear_buffer_dirty(bh);
 		clear_buffer_journal_test(bh);
 		put_bh(bh);
-		if (atomic_read(&(bh->b_count)) < 0) {
+		if (atomic_read(&bh->b_count) < 0) {
 			reiserfs_warning(sb, "journal-1752",
 					 "b_count < 0");
 		}
@@ -3497,7 +3497,7 @@ static int can_dirty(struct reiserfs_jou
 	cur = cn->hnext;
 	while (cur && can_dirty) {
 		if (cur->jlist && cur->jlist->j_len > 0 &&
-		    atomic_read(&(cur->jlist->j_commit_left)) > 0 && cur->bh &&
+		    atomic_read(&cur->jlist->j_commit_left) > 0 && cur->bh &&
 		    cur->blocknr && cur->sb == sb && cur->blocknr == blocknr) {
 			can_dirty = 0;
 		}
@@ -3623,8 +3623,8 @@ static int check_journal_end(struct reis
 
 	journal->j_len_alloc -= (th->t_blocks_allocated - th->t_blocks_logged);
 	/* <= 0 is allowed.  unmounting might not call begin */
-	if (atomic_read(&(journal->j_wcount)) > 0)
-		atomic_dec(&(journal->j_wcount));
+	if (atomic_read(&journal->j_wcount) > 0)
+		atomic_dec(&journal->j_wcount);
 
 	/*
 	 * BUG, deal with case where j_len is 0, but people previously
@@ -3642,7 +3642,7 @@ static int check_journal_end(struct reis
 	 * because the rest of journal end was already done for this
 	 * transaction.
 	 */
-	if (atomic_read(&(journal->j_wcount)) > 0) {
+	if (atomic_read(&journal->j_wcount) > 0) {
 		if (flush || commit_now) {
 			unsigned trans_id;
 
@@ -3650,7 +3650,7 @@ static int check_journal_end(struct reis
 			trans_id = jl->j_trans_id;
 			if (wait_on_commit)
 				jl->j_state |= LIST_COMMIT_PENDING;
-			atomic_set(&(journal->j_jlock), 1);
+			atomic_set(&journal->j_jlock, 1);
 			if (flush) {
 				journal->j_next_full_flush = 1;
 			}
@@ -3666,7 +3666,7 @@ static int check_journal_end(struct reis
 				} else {
 					lock_journal(sb);
 					if (journal->j_trans_id == trans_id) {
-						atomic_set(&(journal->j_jlock),
+						atomic_set(&journal->j_jlock,
 							   1);
 					}
 					unlock_journal(sb);
@@ -3693,7 +3693,7 @@ static int check_journal_end(struct reis
 	}
 	/* don't batch when someone is waiting on j_join_wait */
 	/* don't batch when syncing the commit or flushing the whole trans */
-	if (!(journal->j_must_wait > 0) && !(atomic_read(&(journal->j_jlock)))
+	if (!(journal->j_must_wait > 0) && !(atomic_read(&journal->j_jlock))
 	    && !flush && !commit_now && (journal->j_len < journal->j_max_batch)
 	    && journal->j_len_alloc < journal->j_max_batch
 	    && journal->j_cnode_free > (journal->j_trans_max * 3)) {
@@ -3792,7 +3792,7 @@ int journal_mark_freed(struct reiserfs_t
 						cleaned = 1;
 						put_bh(cn->bh);
 						if (atomic_read
-						    (&(cn->bh->b_count)) < 0) {
+						    (&cn->bh->b_count) < 0) {
 							reiserfs_warning(sb,
 								 "journal-2138",
 								 "cn->bh->b_count < 0");
@@ -3803,9 +3803,8 @@ int journal_mark_freed(struct reiserfs_t
 					 * we MUST dec nonzerolen
 					 */
 					if (cn->jlist) {
-						atomic_dec(&
-							   (cn->jlist->
-							    j_nonzerolen));
+						atomic_dec(&cn->jlist->
+							   j_nonzerolen);
 					}
 					cn->bh = NULL;
 				}
@@ -4244,7 +4243,7 @@ static int do_journal_end(struct reiserf
 	journal->j_start =
 	    (journal->j_start + journal->j_len +
 	     2) % SB_ONDISK_JOURNAL_SIZE(sb);
-	atomic_set(&(journal->j_wcount), 0);
+	atomic_set(&journal->j_wcount, 0);
 	journal->j_bcount = 0;
 	journal->j_last = NULL;
 	journal->j_first = NULL;
@@ -4349,11 +4348,11 @@ first_jl:
 			       "could not get a list bitmap");
 	}
 
-	atomic_set(&(journal->j_jlock), 0);
+	atomic_set(&journal->j_jlock, 0);
 	unlock_journal(sb);
 	/* wake up any body waiting to join. */
 	clear_bit(J_WRITERS_QUEUED, &journal->j_state);
-	wake_up(&(journal->j_join_wait));
+	wake_up(&journal->j_join_wait);
 
 	if (!flush && wait_on_commit &&
 	    journal_list_still_alive(sb, commit_trans_id)) {
--- a/fs/reiserfs/lbalance.c
+++ b/fs/reiserfs/lbalance.c
@@ -38,12 +38,12 @@ static void leaf_copy_dir_entries(struct
 	 */
 	deh = B_I_DEH(source, ih);
 	if (copy_count) {
-		copy_records_len = (from ? deh_location(&(deh[from - 1])) :
+		copy_records_len = (from ? deh_location(&deh[from - 1]) :
 				    ih_item_len(ih)) -
-		    deh_location(&(deh[from + copy_count - 1]));
+		    deh_location(&deh[from + copy_count - 1]);
 		records =
 		    source->b_data + ih_location(ih) +
-		    deh_location(&(deh[from + copy_count - 1]));
+		    deh_location(&deh[from + copy_count - 1]);
 	} else {
 		copy_records_len = 0;
 		records = NULL;
@@ -81,7 +81,7 @@ static void leaf_copy_dir_entries(struct
 			/* form key by the following way */
 			if (from < ih_entry_count(ih)) {
 				set_le_ih_k_offset(&new_ih,
-						   deh_offset(&(deh[from])));
+						   deh_offset(&deh[from]));
 			} else {
 				/*
 				 * no entries will be copied to this
@@ -94,7 +94,7 @@ static void leaf_copy_dir_entries(struct
 				 * for it, so we -1
 				 */
 			}
-			set_le_key_k_type(KEY_FORMAT_3_5, &(new_ih.ih_key),
+			set_le_key_k_type(KEY_FORMAT_3_5, &new_ih.ih_key,
 					  TYPE_DIRENTRY);
 		}
 
@@ -155,7 +155,7 @@ static int leaf_copy_boundary_item(struc
 
 		/* there is nothing to merge */
 		if (!dest_nr_item
-		    || (!op_is_left_mergeable(&(ih->ih_key), src->b_size)))
+		    || (!op_is_left_mergeable(&ih->ih_key, src->b_size)))
 			return 0;
 
 		RFALSE(!ih_item_len(ih),
@@ -221,7 +221,7 @@ static int leaf_copy_boundary_item(struc
 	ih = item_head(src, src_nr_item - 1);
 	dih = item_head(dest, 0);
 
-	if (!dest_nr_item || !op_is_left_mergeable(&(dih->ih_key), src->b_size))
+	if (!dest_nr_item || !op_is_left_mergeable(&dih->ih_key, src->b_size))
 		return 0;
 
 	if (is_direntry_le_ih(ih)) {
@@ -368,8 +368,8 @@ static void leaf_copy_items_entirely(str
 	}
 
 	/* prepare space for items */
-	last_loc = ih_location(&(ih[nr + cpy_num - 1 - dest_before]));
-	last_inserted_loc = ih_location(&(ih[cpy_num - 1]));
+	last_loc = ih_location(&ih[nr + cpy_num - 1 - dest_before]);
+	last_inserted_loc = ih_location(&ih[cpy_num - 1]);
 
 	/* check free space */
 	RFALSE(free_space < j - last_inserted_loc,
@@ -449,7 +449,7 @@ static void leaf_item_bottle(struct buff
 				set_ih_free_space(&n_ih, 0);
 			}
 
-			RFALSE(op_is_left_mergeable(&(ih->ih_key), src->b_size),
+			RFALSE(op_is_left_mergeable(&ih->ih_key, src->b_size),
 			       "vs-10190: bad mergeability of item %h", ih);
 			n_ih.ih_version = ih->ih_version;	/* JDM Endian safe, both le */
 			leaf_insert_into_buf(dest_bi, B_NR_ITEMS(dest), &n_ih,
@@ -926,7 +926,7 @@ void leaf_insert_into_buf(struct buffer_
 	ih = item_head(bh, before);
 
 	/* prepare space for the body of new item */
-	last_loc = nr ? ih_location(&(ih[nr - before - 1])) : bh->b_size;
+	last_loc = nr ? ih_location(&ih[nr - before - 1]) : bh->b_size;
 	unmoved_loc = before ? ih_location(ih - 1) : bh->b_size;
 
 	memmove(bh->b_data + last_loc - ih_item_len(inserted_item_ih),
@@ -949,8 +949,8 @@ void leaf_insert_into_buf(struct buffer_
 
 	/* change locations */
 	for (i = before; i < nr + 1; i++) {
-		unmoved_loc -= ih_item_len(&(ih[i - before]));
-		put_ih_location(&(ih[i - before]), unmoved_loc);
+		unmoved_loc -= ih_item_len(&ih[i - before]);
+		put_ih_location(&ih[i - before], unmoved_loc);
 	}
 
 	/* sizes, free space, item number */
@@ -1009,7 +1009,7 @@ void leaf_paste_in_buffer(struct buffer_
 	/* item to be appended */
 	ih = item_head(bh, affected_item_num);
 
-	last_loc = ih_location(&(ih[nr - affected_item_num - 1]));
+	last_loc = ih_location(&ih[nr - affected_item_num - 1]);
 	unmoved_loc = affected_item_num ? ih_location(ih - 1) : bh->b_size;
 
 	/* prepare space */
@@ -1018,8 +1018,8 @@ void leaf_paste_in_buffer(struct buffer_
 
 	/* change locations */
 	for (i = affected_item_num; i < nr; i++)
-		put_ih_location(&(ih[i - affected_item_num]),
-				ih_location(&(ih[i - affected_item_num])) -
+		put_ih_location(&ih[i - affected_item_num],
+				ih_location(&ih[i - affected_item_num]) -
 				paste_size);
 
 	if (body) {
@@ -1101,19 +1101,19 @@ static int leaf_cut_entries(struct buffe
 	 * (prev_record) and length of all removed records (cut_records_len)
 	 */
 	prev_record_offset =
-	    (from ? deh_location(&(deh[from - 1])) : ih_item_len(ih));
+	    (from ? deh_location(&deh[from - 1]) : ih_item_len(ih));
 	cut_records_len = prev_record_offset /*from_record */  -
-	    deh_location(&(deh[from + del_count - 1]));
+	    deh_location(&deh[from + del_count - 1]);
 	prev_record = item + prev_record_offset;
 
 	/* adjust locations of remaining entries */
 	for (i = ih_entry_count(ih) - 1; i > from + del_count - 1; i--)
-		put_deh_location(&(deh[i]),
+		put_deh_location(&deh[i],
 				 deh_location(&deh[i]) -
 				 (DEH_SIZE * del_count));
 
 	for (i = 0; i < from; i++)
-		put_deh_location(&(deh[i]),
+		put_deh_location(&deh[i],
 				 deh_location(&deh[i]) - (DEH_SIZE * del_count +
 							  cut_records_len));
 
@@ -1200,7 +1200,7 @@ void leaf_cut_from_buffer(struct buffer_
 	}
 
 	/* location of the last item */
-	last_loc = ih_location(&(ih[nr - cut_item_num - 1]));
+	last_loc = ih_location(&ih[nr - cut_item_num - 1]);
 
 	/* location of the item, which is remaining at the same place */
 	unmoved_loc = cut_item_num ? ih_location(ih - 1) : bh->b_size;
@@ -1219,7 +1219,7 @@ void leaf_cut_from_buffer(struct buffer_
 
 	/* change locations */
 	for (i = cut_item_num; i < nr; i++)
-		put_ih_location(&(ih[i - cut_item_num]),
+		put_ih_location(&ih[i - cut_item_num],
 				ih_location(&ih[i - cut_item_num]) + cut_size);
 
 	/* size, free space */
@@ -1273,8 +1273,8 @@ static void leaf_delete_items_entirely(s
 	j = (first == 0) ? bh->b_size : ih_location(ih - 1);
 
 	/* delete items */
-	last_loc = ih_location(&(ih[nr - 1 - first]));
-	last_removed_loc = ih_location(&(ih[del_num - 1]));
+	last_loc = ih_location(&ih[nr - 1 - first]);
+	last_removed_loc = ih_location(&ih[del_num - 1]);
 
 	memmove(bh->b_data + last_loc + j - last_removed_loc,
 		bh->b_data + last_loc, last_removed_loc - last_loc);
@@ -1284,8 +1284,8 @@ static void leaf_delete_items_entirely(s
 
 	/* change item location */
 	for (i = first; i < nr - del_num; i++)
-		put_ih_location(&(ih[i - first]),
-				ih_location(&(ih[i - first])) + (j -
+		put_ih_location(&ih[i - first],
+				ih_location(&ih[i - first]) + (j -
 								 last_removed_loc));
 
 	/* sizes, item number */
@@ -1347,19 +1347,19 @@ void leaf_paste_entries(struct buffer_in
 	/* new records will be pasted at this point */
 	insert_point =
 	    item +
-	    (before ? deh_location(&(deh[before - 1]))
+	    (before ? deh_location(&deh[before - 1])
 	     : (ih_item_len(ih) - paste_size));
 
 	/* adjust locations of records that will be AFTER new records */
 	for (i = ih_entry_count(ih) - 1; i >= before; i--)
-		put_deh_location(&(deh[i]),
-				 deh_location(&(deh[i])) +
+		put_deh_location(&deh[i],
+				 deh_location(&deh[i]) +
 				 (DEH_SIZE * new_entry_count));
 
 	/* adjust locations of records that will be BEFORE new records */
 	for (i = 0; i < before; i++)
-		put_deh_location(&(deh[i]),
-				 deh_location(&(deh[i])) + paste_size);
+		put_deh_location(&deh[i],
+				 deh_location(&deh[i]) + paste_size);
 
 	old_entry_num = ih_entry_count(ih);
 	put_ih_entry_count(ih, ih_entry_count(ih) + new_entry_count);
@@ -1383,10 +1383,10 @@ void leaf_paste_entries(struct buffer_in
 
 	/* set locations of new records */
 	for (i = 0; i < new_entry_count; i++) {
-		put_deh_location(&(deh[i]),
-				 deh_location(&(deh[i])) +
+		put_deh_location(&deh[i],
+				 deh_location(&deh[i]) +
 				 (-deh_location
-				  (&(new_dehs[new_entry_count - 1])) +
+				  (&new_dehs[new_entry_count - 1]) +
 				  insert_point + DEH_SIZE * new_entry_count -
 				  item));
 	}
@@ -1404,16 +1404,16 @@ void leaf_paste_entries(struct buffer_in
 			next =
 			    (i <
 			     ih_entry_count(ih) -
-			     1) ? deh_location(&(deh[i + 1])) : 0;
-			prev = (i != 0) ? deh_location(&(deh[i - 1])) : 0;
+			     1) ? deh_location(&deh[i + 1]) : 0;
+			prev = (i != 0) ? deh_location(&deh[i - 1]) : 0;
 
-			if (prev && prev <= deh_location(&(deh[i])))
+			if (prev && prev <= deh_location(&deh[i]))
 				reiserfs_error(sb_from_bi(bi), "vs-10240",
 					       "directory item (%h) "
 					       "corrupted (prev %a, "
 					       "cur(%d) %a)",
 					       ih, deh + i - 1, i, deh + i);
-			if (next && next >= deh_location(&(deh[i])))
+			if (next && next >= deh_location(&deh[i]))
 				reiserfs_error(sb_from_bi(bi), "vs-10250",
 					       "directory item (%h) "
 					       "corrupted (cur(%d) %a, "
--- a/fs/reiserfs/namei.c
+++ b/fs/reiserfs/namei.c
@@ -86,8 +86,8 @@ inline void set_de_name_and_namelen(stru
 static 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(st
 	    le32_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(st
 	pathrelse(&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(struc
 		reiserfs_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?");
--- a/fs/reiserfs/prints.c
+++ b/fs/reiserfs/prints.c
@@ -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),
--- a/fs/reiserfs/stree.c
+++ b/fs/reiserfs/stree.c
@@ -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 reis
 	reiserfs_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);
--- a/fs/reiserfs/super.c
+++ b/fs/reiserfs/super.c
@@ -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 su
 
 	if (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 su
 
 				set_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");
 			}
--- a/fs/reiserfs/xattr.c
+++ b/fs/reiserfs/xattr.c
@@ -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. */



^ permalink raw reply	[flat|nested] 50+ messages in thread

* [patch 10/29] reiserfs: cleanup, remove unnecessary parens in dirent creation
  2014-04-23 14:00 [patch 00/29] reiserfs cleanup patchset Jeff Mahoney
                   ` (7 preceding siblings ...)
  2014-04-23 14:00 ` [patch 09/29] reiserfs: cleanup, remove unnecessary parens Jeff Mahoney
@ 2014-04-23 14:00 ` Jeff Mahoney
  2014-04-23 14:00 ` [patch 11/29] reiserfs: cleanup, make hash detection saner Jeff Mahoney
                   ` (21 subsequent siblings)
  30 siblings, 0 replies; 50+ messages in thread
From: Jeff Mahoney @ 2014-04-23 14:00 UTC (permalink / raw)
  To: ReiserFS Development List; +Cc: Jan Kara, Dave Jones

[-- Attachment #1: reiserfs/reiserfs-cleanup-remove-unnecessary-parens-in-dirent-creation --]
[-- Type: text/plain, Size: 4057 bytes --]

make_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.

Signed-off-by: Jeff Mahoney <jeffm@suse.com>
---
 fs/reiserfs/dir.c |   67 +++++++++++++++++++++++++++---------------------------
 1 file changed, 34 insertions(+), 33 deletions(-)

--- a/fs/reiserfs/dir.c
+++ b/fs/reiserfs/dir.c
@@ -282,65 +282,66 @@ static int reiserfs_readdir(struct file
 void 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);
 }



^ permalink raw reply	[flat|nested] 50+ messages in thread

* [patch 11/29] reiserfs: cleanup, make hash detection saner
  2014-04-23 14:00 [patch 00/29] reiserfs cleanup patchset Jeff Mahoney
                   ` (8 preceding siblings ...)
  2014-04-23 14:00 ` [patch 10/29] reiserfs: cleanup, remove unnecessary parens in dirent creation Jeff Mahoney
@ 2014-04-23 14:00 ` Jeff Mahoney
  2014-05-06 21:27   ` Jan Kara
  2014-04-23 14:00 ` [patch 12/29] reiserfs: balance_leaf refactor, reformat balance_leaf comments Jeff Mahoney
                   ` (20 subsequent siblings)
  30 siblings, 1 reply; 50+ messages in thread
From: Jeff Mahoney @ 2014-04-23 14:00 UTC (permalink / raw)
  To: ReiserFS Development List; +Cc: Jan Kara, Dave Jones

[-- Attachment #1: reiserfs/reiserfs-cleanup-make-hash-detection-saner --]
[-- Type: text/plain, Size: 4069 bytes --]

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 <jeffm@suse.com>
---
 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 __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;
 }



^ permalink raw reply	[flat|nested] 50+ messages in thread

* [patch 12/29] reiserfs: balance_leaf refactor, reformat balance_leaf comments
  2014-04-23 14:00 [patch 00/29] reiserfs cleanup patchset Jeff Mahoney
                   ` (9 preceding siblings ...)
  2014-04-23 14:00 ` [patch 11/29] reiserfs: cleanup, make hash detection saner Jeff Mahoney
@ 2014-04-23 14:00 ` Jeff Mahoney
  2014-04-23 14:00 ` [patch 13/29] reiserfs: balance_leaf refactor, move state variables into tree_balance Jeff Mahoney
                   ` (19 subsequent siblings)
  30 siblings, 0 replies; 50+ messages in thread
From: Jeff Mahoney @ 2014-04-23 14:00 UTC (permalink / raw)
  To: ReiserFS Development List; +Cc: Jan Kara, Dave Jones

[-- Attachment #1: reiserfs/reiserfs-balance_leaf-refactor-reformat-balance_leaf-comments --]
[-- Type: text/plain, Size: 5272 bytes --]

The 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.

Signed-off-by: Jeff Mahoney <jeffm@suse.com>
---
 fs/reiserfs/do_balan.c |   84 ++++++++++++++++++++++++++++++-------------------
 1 file changed, 52 insertions(+), 32 deletions(-)

--- a/fs/reiserfs/do_balan.c
+++ b/fs/reiserfs/do_balan.c
@@ -290,31 +290,43 @@ static int balance_leaf_when_delete(stru
 	return 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_bala
 	RFALSE(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)



^ permalink raw reply	[flat|nested] 50+ messages in thread

* [patch 13/29] reiserfs: balance_leaf refactor, move state variables into tree_balance
  2014-04-23 14:00 [patch 00/29] reiserfs cleanup patchset Jeff Mahoney
                   ` (10 preceding siblings ...)
  2014-04-23 14:00 ` [patch 12/29] reiserfs: balance_leaf refactor, reformat balance_leaf comments Jeff Mahoney
@ 2014-04-23 14:00 ` Jeff Mahoney
  2014-04-23 14:00 ` [patch 14/29] reiserfs: balance_leaf refactor, pull out balance_leaf_insert_left Jeff Mahoney
                   ` (18 subsequent siblings)
  30 siblings, 0 replies; 50+ messages in thread
From: Jeff Mahoney @ 2014-04-23 14:00 UTC (permalink / raw)
  To: ReiserFS Development List; +Cc: Jan Kara, Dave Jones

[-- Attachment #1: reiserfs/reiserfs-balance_leaf-refactor-move-state-variables-into-tree_balance --]
[-- Type: text/plain, Size: 38650 bytes --]

This 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.

Signed-off-by: Jeff Mahoney <jeffm@suse.com>
---
 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(-)

--- a/fs/reiserfs/do_balan.c
+++ b/fs/reiserfs/do_balan.c
@@ -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_bala
 	if (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_bala
 							leaf_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_bala
 								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 + 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_bala
 
 					struct 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_bala
 					if (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_bala
 		switch (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_bala
 					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) > 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_bala
 
 		case 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_bala
 
 					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 {	/* 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_bala
 					struct 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_bala
 		case 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
--- a/fs/reiserfs/fix_node.c
+++ b/fs/reiserfs/fix_node.c
@@ -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;
--- a/fs/reiserfs/prints.c
+++ b/fs/reiserfs/prints.c
@@ -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;
--- a/fs/reiserfs/reiserfs.h
+++ b/fs/reiserfs/reiserfs.h
@@ -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



^ permalink raw reply	[flat|nested] 50+ messages in thread

* [patch 14/29] reiserfs: balance_leaf refactor, pull out balance_leaf_insert_left
  2014-04-23 14:00 [patch 00/29] reiserfs cleanup patchset Jeff Mahoney
                   ` (11 preceding siblings ...)
  2014-04-23 14:00 ` [patch 13/29] reiserfs: balance_leaf refactor, move state variables into tree_balance Jeff Mahoney
@ 2014-04-23 14:00 ` Jeff Mahoney
  2014-04-23 14:00 ` [patch 15/29] reiserfs: balance_leaf refactor, pull out balance_leaf_paste_left Jeff Mahoney
                   ` (17 subsequent siblings)
  30 siblings, 0 replies; 50+ messages in thread
From: Jeff Mahoney @ 2014-04-23 14:00 UTC (permalink / raw)
  To: ReiserFS Development List; +Cc: Jan Kara, Dave Jones

[-- Attachment #1: reiserfs/reiserfs-balance_leaf-refactor-pull-out-balance_leaf_insert_left --]
[-- Type: text/plain, Size: 4710 bytes --]

This 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.

Signed-off-by: Jeff Mahoney <jeffm@suse.com>
---
 fs/reiserfs/do_balan.c |  108 ++++++++++++++++++++++++++-----------------------
 1 file changed, 59 insertions(+), 49 deletions(-)

--- a/fs/reiserfs/do_balan.c
+++ b/fs/reiserfs/do_balan.c
@@ -290,6 +290,64 @@ static int balance_leaf_when_delete(stru
 	return 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_bala
 
 			switch (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] */



^ permalink raw reply	[flat|nested] 50+ messages in thread

* [patch 15/29] reiserfs: balance_leaf refactor, pull out balance_leaf_paste_left
  2014-04-23 14:00 [patch 00/29] reiserfs cleanup patchset Jeff Mahoney
                   ` (12 preceding siblings ...)
  2014-04-23 14:00 ` [patch 14/29] reiserfs: balance_leaf refactor, pull out balance_leaf_insert_left Jeff Mahoney
@ 2014-04-23 14:00 ` Jeff Mahoney
  2014-04-23 14:00 ` [patch 16/29] reiserfs: balance_leaf refactor, pull out balance_leaf_insert_right Jeff Mahoney
                   ` (16 subsequent siblings)
  30 siblings, 0 replies; 50+ messages in thread
From: Jeff Mahoney @ 2014-04-23 14:00 UTC (permalink / raw)
  To: ReiserFS Development List; +Cc: Jan Kara, Dave Jones

[-- Attachment #1: reiserfs/reiserfs-balance_leaf-refactor-pull-out-balance_leaf_paste_left --]
[-- Type: text/plain, Size: 4780 bytes --]

This 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.

Signed-off-by: Jeff Mahoney <jeffm@suse.com>
---
 fs/reiserfs/do_balan.c |  117 ++++++++++++++++++++++++++-----------------------
 1 file changed, 64 insertions(+), 53 deletions(-)

--- a/fs/reiserfs/do_balan.c
+++ b/fs/reiserfs/do_balan.c
@@ -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",



^ permalink raw reply	[flat|nested] 50+ messages in thread

* [patch 16/29] reiserfs: balance_leaf refactor, pull out balance_leaf_insert_right
  2014-04-23 14:00 [patch 00/29] reiserfs cleanup patchset Jeff Mahoney
                   ` (13 preceding siblings ...)
  2014-04-23 14:00 ` [patch 15/29] reiserfs: balance_leaf refactor, pull out balance_leaf_paste_left Jeff Mahoney
@ 2014-04-23 14:00 ` Jeff Mahoney
  2014-04-23 14:00 ` [patch 17/29] reiserfs: balance_leaf refactor, pull out balance_leaf_paste_right Jeff Mahoney
                   ` (15 subsequent siblings)
  30 siblings, 0 replies; 50+ messages in thread
From: Jeff Mahoney @ 2014-04-23 14:00 UTC (permalink / raw)
  To: ReiserFS Development List; +Cc: Jan Kara, Dave Jones

[-- Attachment #1: reiserfs/reiserfs-balance_leaf-refactor-pull-out-balance_leaf_insert_right --]
[-- Type: text/plain, Size: 5625 bytes --]

This 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.

Signed-off-by: Jeff Mahoney <jeffm@suse.com>
---
 fs/reiserfs/do_balan.c |  138 ++++++++++++++++++++++++++-----------------------
 1 file changed, 75 insertions(+), 63 deletions(-)

--- a/fs/reiserfs/do_balan.c
+++ b/fs/reiserfs/do_balan.c
@@ -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_bala
 		switch (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 */



^ permalink raw reply	[flat|nested] 50+ messages in thread

* [patch 17/29] reiserfs: balance_leaf refactor, pull out balance_leaf_paste_right
  2014-04-23 14:00 [patch 00/29] reiserfs cleanup patchset Jeff Mahoney
                   ` (14 preceding siblings ...)
  2014-04-23 14:00 ` [patch 16/29] reiserfs: balance_leaf refactor, pull out balance_leaf_insert_right Jeff Mahoney
@ 2014-04-23 14:00 ` Jeff Mahoney
  2014-04-23 14:00 ` [patch 18/29] reiserfs: balance_leaf refactor, pull out balance_leaf_new_nodes_insert Jeff Mahoney
                   ` (14 subsequent siblings)
  30 siblings, 0 replies; 50+ messages in thread
From: Jeff Mahoney @ 2014-04-23 14:00 UTC (permalink / raw)
  To: ReiserFS Development List; +Cc: Jan Kara, Dave Jones

[-- Attachment #1: reiserfs/reiserfs-balance_leaf-refactor-pull-out-balance_leaf_paste_right --]
[-- Type: text/plain, Size: 6557 bytes --]

This 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.

Signed-off-by: Jeff Mahoney <jeffm@suse.com>
---
 fs/reiserfs/do_balan.c |  170 +++++++++++++++++++++++++------------------------
 1 file changed, 90 insertions(+), 80 deletions(-)

--- a/fs/reiserfs/do_balan.c
+++ b/fs/reiserfs/do_balan.c
@@ -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_bala
 
 				leaf_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",



^ permalink raw reply	[flat|nested] 50+ messages in thread

* [patch 18/29] reiserfs: balance_leaf refactor, pull out balance_leaf_new_nodes_insert
  2014-04-23 14:00 [patch 00/29] reiserfs cleanup patchset Jeff Mahoney
                   ` (15 preceding siblings ...)
  2014-04-23 14:00 ` [patch 17/29] reiserfs: balance_leaf refactor, pull out balance_leaf_paste_right Jeff Mahoney
@ 2014-04-23 14:00 ` Jeff Mahoney
  2014-04-23 14:00 ` [patch 19/29] reiserfs: balance_leaf refactor, pull out balance_leaf_new_nodes_paste Jeff Mahoney
                   ` (13 subsequent siblings)
  30 siblings, 0 replies; 50+ messages in thread
From: Jeff Mahoney @ 2014-04-23 14:00 UTC (permalink / raw)
  To: ReiserFS Development List; +Cc: Jan Kara, Dave Jones

[-- Attachment #1: reiserfs/reiserfs-balance_leaf-refactor-pull-out-balance_leaf_new_nodes_insert --]
[-- Type: text/plain, Size: 5759 bytes --]

This 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.

Signed-off-by: Jeff Mahoney <jeffm@suse.com>
---
 fs/reiserfs/do_balan.c |  133 ++++++++++++++++++++++++++-----------------------
 1 file changed, 73 insertions(+), 60 deletions(-)

--- a/fs/reiserfs/do_balan.c
+++ b/fs/reiserfs/do_balan.c
@@ -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_bala
 
 		switch (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 */



^ permalink raw reply	[flat|nested] 50+ messages in thread

* [patch 19/29] reiserfs: balance_leaf refactor, pull out balance_leaf_new_nodes_paste
  2014-04-23 14:00 [patch 00/29] reiserfs cleanup patchset Jeff Mahoney
                   ` (16 preceding siblings ...)
  2014-04-23 14:00 ` [patch 18/29] reiserfs: balance_leaf refactor, pull out balance_leaf_new_nodes_insert Jeff Mahoney
@ 2014-04-23 14:00 ` Jeff Mahoney
  2014-04-23 14:00 ` [patch 20/29] reiserfs: balance_leaf refactor pull out balance_leaf_finish_node_insert Jeff Mahoney
                   ` (12 subsequent siblings)
  30 siblings, 0 replies; 50+ messages in thread
From: Jeff Mahoney @ 2014-04-23 14:00 UTC (permalink / raw)
  To: ReiserFS Development List; +Cc: Jan Kara, Dave Jones

[-- Attachment #1: reiserfs/reiserfs-balance_leaf-refactor-pull-out-balance_leaf_new_nodes_paste --]
[-- Type: text/plain, Size: 11760 bytes --]

This 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.

Signed-off-by: Jeff Mahoney <jeffm@suse.com>
---
 fs/reiserfs/do_balan.c |  306 +++++++++++++++++++++++++------------------------
 1 file changed, 160 insertions(+), 146 deletions(-)

--- a/fs/reiserfs/do_balan.c
+++ b/fs/reiserfs/do_balan.c
@@ -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_bala
 			break;
 
 		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",



^ permalink raw reply	[flat|nested] 50+ messages in thread

* [patch 20/29] reiserfs: balance_leaf refactor pull out balance_leaf_finish_node_insert
  2014-04-23 14:00 [patch 00/29] reiserfs cleanup patchset Jeff Mahoney
                   ` (17 preceding siblings ...)
  2014-04-23 14:00 ` [patch 19/29] reiserfs: balance_leaf refactor, pull out balance_leaf_new_nodes_paste Jeff Mahoney
@ 2014-04-23 14:00 ` Jeff Mahoney
  2014-04-23 14:00 ` [patch 21/29] reiserfs: balance_leaf refactor, pull out balance_leaf_finish_node_paste Jeff Mahoney
                   ` (11 subsequent siblings)
  30 siblings, 0 replies; 50+ messages in thread
From: Jeff Mahoney @ 2014-04-23 14:00 UTC (permalink / raw)
  To: ReiserFS Development List; +Cc: Jan Kara, Dave Jones

[-- Attachment #1: reiserfs/reiserfs-balance_leaf-refactor-pull-out-balance_leaf_finish_node_insert --]
[-- Type: text/plain, Size: 1681 bytes --]

This 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.

Signed-off-by: Jeff Mahoney <jeffm@suse.com>
---
 fs/reiserfs/do_balan.c |   30 +++++++++++++++++++++---------
 1 file changed, 21 insertions(+), 9 deletions(-)

--- a/fs/reiserfs/do_balan.c
+++ b/fs/reiserfs/do_balan.c
@@ -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_bala
 
 		switch (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] */



^ permalink raw reply	[flat|nested] 50+ messages in thread

* [patch 21/29] reiserfs: balance_leaf refactor, pull out balance_leaf_finish_node_paste
  2014-04-23 14:00 [patch 00/29] reiserfs cleanup patchset Jeff Mahoney
                   ` (18 preceding siblings ...)
  2014-04-23 14:00 ` [patch 20/29] reiserfs: balance_leaf refactor pull out balance_leaf_finish_node_insert Jeff Mahoney
@ 2014-04-23 14:00 ` Jeff Mahoney
  2014-04-23 14:00 ` [patch 22/29] reiserfs: balance_leaf refactor, pull out balance_leaf{left, right, new_nodes, finish_node} Jeff Mahoney
                   ` (10 subsequent siblings)
  30 siblings, 0 replies; 50+ messages in thread
From: Jeff Mahoney @ 2014-04-23 14:00 UTC (permalink / raw)
  To: ReiserFS Development List; +Cc: Jan Kara, Dave Jones

[-- Attachment #1: reiserfs/reiserfs-balance_leaf-refactor-pull-out-balance_leaf_finish_node_paste --]
[-- Type: text/plain, Size: 5618 bytes --]

This 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].

Signed-off-by: Jeff Mahoney <jeffm@suse.com>
---
 fs/reiserfs/do_balan.c |  150 +++++++++++++++++++++++++------------------------
 1 file changed, 79 insertions(+), 71 deletions(-)

--- a/fs/reiserfs/do_balan.c
+++ b/fs/reiserfs/do_balan.c
@@ -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_bala
 			balance_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



^ permalink raw reply	[flat|nested] 50+ messages in thread

* [patch 22/29] reiserfs: balance_leaf refactor, pull out balance_leaf{left, right, new_nodes, finish_node}
  2014-04-23 14:00 [patch 00/29] reiserfs cleanup patchset Jeff Mahoney
                   ` (19 preceding siblings ...)
  2014-04-23 14:00 ` [patch 21/29] reiserfs: balance_leaf refactor, pull out balance_leaf_finish_node_paste Jeff Mahoney
@ 2014-04-23 14:00 ` Jeff Mahoney
  2014-04-23 14:00 ` [patch 23/29] reiserfs: balance_leaf refactor, format balance_leaf_insert_left Jeff Mahoney
                   ` (9 subsequent siblings)
  30 siblings, 0 replies; 50+ messages in thread
From: Jeff Mahoney @ 2014-04-23 14:00 UTC (permalink / raw)
  To: ReiserFS Development List; +Cc: Jan Kara, Dave Jones

[-- Attachment #1: reiserfs-balance_leaf-refactor-pull-out-balance_leaf-left-right-new_nodes-finish_node --]
[-- Type: text/plain, Size: 8136 bytes --]

Break out the code that splits paste/insert for each phase.

Signed-off-by: Jeff Mahoney <jeffm@suse.com>
---
 fs/reiserfs/do_balan.c |  207 +++++++++++++++++++++++++------------------------
 1 file changed, 108 insertions(+), 99 deletions(-)

--- a/fs/reiserfs/do_balan.c
+++ b/fs/reiserfs/do_balan.c
@@ -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_bala
 		return 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");



^ permalink raw reply	[flat|nested] 50+ messages in thread

* [patch 23/29] reiserfs: balance_leaf refactor, format balance_leaf_insert_left
  2014-04-23 14:00 [patch 00/29] reiserfs cleanup patchset Jeff Mahoney
                   ` (20 preceding siblings ...)
  2014-04-23 14:00 ` [patch 22/29] reiserfs: balance_leaf refactor, pull out balance_leaf{left, right, new_nodes, finish_node} Jeff Mahoney
@ 2014-04-23 14:00 ` Jeff Mahoney
  2014-04-23 14:00 ` [patch 24/29] reiserfs: balance_leaf refactor, format balance_leaf_paste_left Jeff Mahoney
                   ` (8 subsequent siblings)
  30 siblings, 0 replies; 50+ messages in thread
From: Jeff Mahoney @ 2014-04-23 14:00 UTC (permalink / raw)
  To: ReiserFS Development List; +Cc: Jan Kara, Dave Jones

[-- Attachment #1: reiserfs/reiserfs-balance_leaf-refactor-format-balance_leaf_insert_left --]
[-- Type: text/plain, Size: 4189 bytes --]

Reformat balance_leaf_insert_left to adhere to CodingStyle.

Signed-off-by: Jeff Mahoney <jeffm@suse.com>
---
 fs/reiserfs/do_balan.c |  107 ++++++++++++++++++++++++++-----------------------
 1 file changed, 57 insertions(+), 50 deletions(-)

--- a/fs/reiserfs/do_balan.c
+++ b/fs/reiserfs/do_balan.c
@@ -293,59 +293,66 @@ static int balance_leaf_when_delete(stru
 static 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,



^ permalink raw reply	[flat|nested] 50+ messages in thread

* [patch 24/29] reiserfs: balance_leaf refactor, format balance_leaf_paste_left
  2014-04-23 14:00 [patch 00/29] reiserfs cleanup patchset Jeff Mahoney
                   ` (21 preceding siblings ...)
  2014-04-23 14:00 ` [patch 23/29] reiserfs: balance_leaf refactor, format balance_leaf_insert_left Jeff Mahoney
@ 2014-04-23 14:00 ` Jeff Mahoney
  2014-04-23 14:00 ` [patch 25/29] reiserfs: balance_leaf refactor, format balance_leaf_insert_right Jeff Mahoney
                   ` (7 subsequent siblings)
  30 siblings, 0 replies; 50+ messages in thread
From: Jeff Mahoney @ 2014-04-23 14:00 UTC (permalink / raw)
  To: ReiserFS Development List; +Cc: Jan Kara, Dave Jones

[-- Attachment #1: reiserfs/reiserfs-balance_leaf-refactor-format-balance_leaf_paste_left --]
[-- Type: text/plain, Size: 14784 bytes --]

Break up balance_leaf_paste_left into:
balance_leaf_paste_left_shift
balance_leaf_paste_left_shift_dirent
balance_leaf_paste_left_whole

and keep balance_leaf_paste_left as a handler to select which is appropriate.

Also reformat to adhere to CodingStyle.

Signed-off-by: Jeff Mahoney <jeffm@suse.com>
---
 fs/reiserfs/do_balan.c |  387 +++++++++++++++++++++++++++++--------------------
 1 file changed, 235 insertions(+), 152 deletions(-)

--- a/fs/reiserfs/do_balan.c
+++ b/fs/reiserfs/do_balan.c
@@ -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] */



^ permalink raw reply	[flat|nested] 50+ messages in thread

* [patch 25/29] reiserfs: balance_leaf refactor, format balance_leaf_insert_right
  2014-04-23 14:00 [patch 00/29] reiserfs cleanup patchset Jeff Mahoney
                   ` (22 preceding siblings ...)
  2014-04-23 14:00 ` [patch 24/29] reiserfs: balance_leaf refactor, format balance_leaf_paste_left Jeff Mahoney
@ 2014-04-23 14:00 ` Jeff Mahoney
  2014-04-23 14:00 ` [patch 26/29] reiserfs: balance_leaf refactor, format balance_leaf_paste_right Jeff Mahoney
                   ` (6 subsequent siblings)
  30 siblings, 0 replies; 50+ messages in thread
From: Jeff Mahoney @ 2014-04-23 14:00 UTC (permalink / raw)
  To: ReiserFS Development List; +Cc: Jan Kara, Dave Jones

[-- Attachment #1: reiserfs/reiserfs-balance_leaf-refactor-format-balance_leaf_insert_right --]
[-- Type: text/plain, Size: 5067 bytes --]

Reformat balance_leaf_insert_right to adhere to CodingStyle.

Signed-off-by: Jeff Mahoney <jeffm@suse.com>
---
 fs/reiserfs/do_balan.c |  139 ++++++++++++++++++++++++++-----------------------
 1 file changed, 76 insertions(+), 63 deletions(-)

--- a/fs/reiserfs/do_balan.c
+++ b/fs/reiserfs/do_balan.c
@@ -626,71 +626,84 @@ static void balance_leaf_insert_right(st
 	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] */
+	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,



^ permalink raw reply	[flat|nested] 50+ messages in thread

* [patch 26/29] reiserfs: balance_leaf refactor, format balance_leaf_paste_right
  2014-04-23 14:00 [patch 00/29] reiserfs cleanup patchset Jeff Mahoney
                   ` (23 preceding siblings ...)
  2014-04-23 14:00 ` [patch 25/29] reiserfs: balance_leaf refactor, format balance_leaf_insert_right Jeff Mahoney
@ 2014-04-23 14:00 ` Jeff Mahoney
  2014-04-23 14:01 ` [patch 27/29] reiserfs: balance_leaf refactor, format balance_leaf_new_nodes_paste Jeff Mahoney
                   ` (5 subsequent siblings)
  30 siblings, 0 replies; 50+ messages in thread
From: Jeff Mahoney @ 2014-04-23 14:00 UTC (permalink / raw)
  To: ReiserFS Development List; +Cc: Jan Kara, Dave Jones

[-- Attachment #1: reiserfs/reiserfs-balance_leaf-refactor-format-balance_leaf_paste_right --]
[-- Type: text/plain, Size: 12570 bytes --]

Break up balance_leaf_paste_right into:
balance_leaf_paste_right_shift
balance_leaf_paste_right_shift_dirent
balance_leaf_paste_right_whole

and keep balance_leaf_paste_right as a handler to select which is appropriate.

Also reformat to adhere to CodingStyle.

Signed-off-by: Jeff Mahoney <jeffm@suse.com>
---
 fs/reiserfs/do_balan.c |  300 +++++++++++++++++++++++++++----------------------
 1 file changed, 170 insertions(+), 130 deletions(-)

--- a/fs/reiserfs/do_balan.c
+++ b/fs/reiserfs/do_balan.c
@@ -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 tr
 		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,
@@ -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 */



^ permalink raw reply	[flat|nested] 50+ messages in thread

* [patch 27/29] reiserfs: balance_leaf refactor, format balance_leaf_new_nodes_paste
  2014-04-23 14:00 [patch 00/29] reiserfs cleanup patchset Jeff Mahoney
                   ` (24 preceding siblings ...)
  2014-04-23 14:00 ` [patch 26/29] reiserfs: balance_leaf refactor, format balance_leaf_paste_right Jeff Mahoney
@ 2014-04-23 14:01 ` Jeff Mahoney
  2014-04-23 14:01 ` [patch 28/29] reiserfs: balance_leaf refactor, format balance_leaf_finish_node Jeff Mahoney
                   ` (4 subsequent siblings)
  30 siblings, 0 replies; 50+ messages in thread
From: Jeff Mahoney @ 2014-04-23 14:01 UTC (permalink / raw)
  To: ReiserFS Development List; +Cc: Jan Kara, Dave Jones

[-- Attachment #1: reiserfs/reiserfs-balance_leaf-refactor-format-balance_leaf_new_nodes_paste --]
[-- Type: text/plain, Size: 18853 bytes --]

Break up balance_leaf_paste_new_nodes into:
balance_leaf_paste_new_nodes_shift
balance_leaf_paste_new_nodes_shift_dirent
balance_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.

Signed-off-by: Jeff Mahoney <jeffm@suse.com>
---
 fs/reiserfs/do_balan.c |  498 +++++++++++++++++++++++++++----------------------
 1 file changed, 282 insertions(+), 216 deletions(-)

--- a/fs/reiserfs/do_balan.c
+++ b/fs/reiserfs/do_balan.c
@@ -714,7 +714,7 @@ static void balance_leaf_paste_right_shi
 	struct 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_shi
 	if (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_inser
 	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]);
-			}
+	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];



^ permalink raw reply	[flat|nested] 50+ messages in thread

* [patch 28/29] reiserfs: balance_leaf refactor, format balance_leaf_finish_node
  2014-04-23 14:00 [patch 00/29] reiserfs cleanup patchset Jeff Mahoney
                   ` (25 preceding siblings ...)
  2014-04-23 14:01 ` [patch 27/29] reiserfs: balance_leaf refactor, format balance_leaf_new_nodes_paste Jeff Mahoney
@ 2014-04-23 14:01 ` Jeff Mahoney
  2014-04-23 14:01 ` [patch 29/29] reiserfs: balance_leaf refactor, split up balance_leaf_when_delete Jeff Mahoney
                   ` (3 subsequent siblings)
  30 siblings, 0 replies; 50+ messages in thread
From: Jeff Mahoney @ 2014-04-23 14:01 UTC (permalink / raw)
  To: ReiserFS Development List; +Cc: Jan Kara, Dave Jones

[-- Attachment #1: reiserfs/reiserfs-balance_leaf-refactor-format-balance_leaf_finish_node --]
[-- Type: text/plain, Size: 6351 bytes --]

Split out balance_leaf_finish_node_dirent from balance_leaf_paste_finish_node.

Also reformat to adhere to CodingStyle.

Signed-off-by: Jeff Mahoney <jeffm@suse.com>
---
 fs/reiserfs/do_balan.c |  163 +++++++++++++++++++++----------------------------
 1 file changed, 72 insertions(+), 91 deletions(-)

--- a/fs/reiserfs/do_balan.c
+++ b/fs/reiserfs/do_balan.c
@@ -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
 }
 
 /*



^ permalink raw reply	[flat|nested] 50+ messages in thread

* [patch 29/29] reiserfs: balance_leaf refactor, split up balance_leaf_when_delete
  2014-04-23 14:00 [patch 00/29] reiserfs cleanup patchset Jeff Mahoney
                   ` (26 preceding siblings ...)
  2014-04-23 14:01 ` [patch 28/29] reiserfs: balance_leaf refactor, format balance_leaf_finish_node Jeff Mahoney
@ 2014-04-23 14:01 ` Jeff Mahoney
  2014-04-26  3:46 ` [patch 00/29] reiserfs cleanup patchset doiggl
                   ` (2 subsequent siblings)
  30 siblings, 0 replies; 50+ messages in thread
From: Jeff Mahoney @ 2014-04-23 14:01 UTC (permalink / raw)
  To: ReiserFS Development List; +Cc: Jan Kara, Dave Jones

[-- Attachment #1: reiserfs/reiserfs-balance_leaf-refactor-split-up-balance_leaf_when_delete --]
[-- Type: text/plain, Size: 10812 bytes --]

Splut up balance_leaf_when_delete into:
balance_leaf_when_delete_del
balance_leaf_when_cut
balance_leaf_when_delete_left

Also reformat to adhere to CodingStyle.

Signed-off-by: Jeff Mahoney <jeffm@suse.com>
---
 fs/reiserfs/do_balan.c |  318 +++++++++++++++++++++++++------------------------
 1 file changed, 163 insertions(+), 155 deletions(-)

--- a/fs/reiserfs/do_balan.c
+++ b/fs/reiserfs/do_balan.c
@@ -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);
-
 }



^ permalink raw reply	[flat|nested] 50+ messages in thread

* Re: [patch 00/29] reiserfs cleanup patchset
  2014-04-23 14:00 [patch 00/29] reiserfs cleanup patchset Jeff Mahoney
                   ` (27 preceding siblings ...)
  2014-04-23 14:01 ` [patch 29/29] reiserfs: balance_leaf refactor, split up balance_leaf_when_delete Jeff Mahoney
@ 2014-04-26  3:46 ` doiggl
  2014-04-26 15:14   ` Jeff Mahoney
  2014-05-13 14:13 ` Jan Kara
  2014-05-27  9:23 ` doiggl
  30 siblings, 1 reply; 50+ messages in thread
From: doiggl @ 2014-04-26  3:46 UTC (permalink / raw)
  To: Jeff Mahoney; +Cc: ReiserFS Development List, Jan Kara, Dave Jones

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

^ permalink raw reply	[flat|nested] 50+ messages in thread

* Re: [patch 00/29] reiserfs cleanup patchset
  2014-04-26  3:46 ` [patch 00/29] reiserfs cleanup patchset doiggl
@ 2014-04-26 15:14   ` Jeff Mahoney
  2014-05-16 10:47     ` doiggl
  0 siblings, 1 reply; 50+ messages in thread
From: Jeff Mahoney @ 2014-04-26 15:14 UTC (permalink / raw)
  To: doiggl; +Cc: ReiserFS Development List, Jan Kara, Dave Jones

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 4/25/14, 11:46 PM, doiggl@velocitynet.com.au 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
> 
> logged https://bugzilla.novell.com/show_bug.cgi?id=875332

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-----

^ permalink raw reply	[flat|nested] 50+ messages in thread

* Re: [patch 11/29] reiserfs: cleanup, make hash detection saner
  2014-04-23 14:00 ` [patch 11/29] reiserfs: cleanup, make hash detection saner Jeff Mahoney
@ 2014-05-06 21:27   ` Jan Kara
  2014-05-07 12:16     ` Jeff Mahoney
  0 siblings, 1 reply; 50+ messages in thread
From: Jan Kara @ 2014-05-06 21:27 UTC (permalink / raw)
  To: Jeff Mahoney; +Cc: ReiserFS Development List, Jan Kara, Dave Jones

On Wed 23-04-14 10:00:44, Jeff Mahoney wrote:
> 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 <jeffm@suse.com>
> ---
>  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 __u32 find_hash_out(struct super_
...
> +
> +	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?

								Honza
>  
> +out:
>  	pathrelse(&path);
>  	return hash;
>  }
> 
> 
-- 
Jan Kara <jack@suse.cz>
SUSE Labs, CR

^ permalink raw reply	[flat|nested] 50+ messages in thread

* Re: [patch 11/29] reiserfs: cleanup, make hash detection saner
  2014-05-06 21:27   ` Jan Kara
@ 2014-05-07 12:16     ` Jeff Mahoney
  2014-05-07 15:50       ` Jan Kara
  0 siblings, 1 reply; 50+ messages in thread
From: Jeff Mahoney @ 2014-05-07 12:16 UTC (permalink / raw)
  To: Jan Kara; +Cc: ReiserFS Development List, Dave Jones

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 5/6/14, 5:27 PM, Jan Kara wrote:
> On Wed 23-04-14 10:00:44, Jeff Mahoney wrote:
>> 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 <jeffm@suse.com> --- 
>> 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 __u32 find_hash_out(struct super_
> ...
>> + +	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

> 
> Honza
>> 
>> +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-----

^ permalink raw reply	[flat|nested] 50+ messages in thread

* Re: [patch 11/29] reiserfs: cleanup, make hash detection saner
  2014-05-07 12:16     ` Jeff Mahoney
@ 2014-05-07 15:50       ` Jan Kara
  0 siblings, 0 replies; 50+ messages in thread
From: Jan Kara @ 2014-05-07 15:50 UTC (permalink / raw)
  To: Jeff Mahoney; +Cc: Jan Kara, ReiserFS Development List, Dave Jones

On Wed 07-05-14 08:16:02, Jeff Mahoney wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> On 5/6/14, 5:27 PM, Jan Kara wrote:
> > On Wed 23-04-14 10:00:44, Jeff Mahoney wrote:
> >> 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 <jeffm@suse.com> --- 
> >> 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 __u32 find_hash_out(struct super_
> > ...
> >> + +	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.
  OK, I've fixed up the patch and merged it to my tree.

								Honza
-- 
Jan Kara <jack@suse.cz>
SUSE Labs, CR

^ permalink raw reply	[flat|nested] 50+ messages in thread

* Re: [patch 00/29] reiserfs cleanup patchset
  2014-04-23 14:00 [patch 00/29] reiserfs cleanup patchset Jeff Mahoney
                   ` (28 preceding siblings ...)
  2014-04-26  3:46 ` [patch 00/29] reiserfs cleanup patchset doiggl
@ 2014-05-13 14:13 ` Jan Kara
  2014-05-13 14:15   ` Jeff Mahoney
  2014-05-27  9:23 ` doiggl
  30 siblings, 1 reply; 50+ messages in thread
From: Jan Kara @ 2014-05-13 14:13 UTC (permalink / raw)
  To: Jeff Mahoney; +Cc: ReiserFS Development List, Jan Kara, Dave Jones

On Wed 23-04-14 10:00:33, Jeff Mahoney wrote:
> 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.
  OK, I have merged all the patches into my tree.

								Honza
-- 
Jan Kara <jack@suse.cz>
SUSE Labs, CR

^ permalink raw reply	[flat|nested] 50+ messages in thread

* Re: [patch 00/29] reiserfs cleanup patchset
  2014-05-13 14:13 ` Jan Kara
@ 2014-05-13 14:15   ` Jeff Mahoney
  0 siblings, 0 replies; 50+ messages in thread
From: Jeff Mahoney @ 2014-05-13 14:15 UTC (permalink / raw)
  To: Jan Kara; +Cc: ReiserFS Development List, Dave Jones

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 5/13/14, 10:13 AM, Jan Kara wrote:
> On Wed 23-04-14 10:00:33, Jeff Mahoney wrote:
>> 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.
> 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-----

^ permalink raw reply	[flat|nested] 50+ messages in thread

* Re: [patch 00/29] reiserfs cleanup patchset
  2014-04-26 15:14   ` Jeff Mahoney
@ 2014-05-16 10:47     ` doiggl
  2014-05-22  8:24       ` doiggl
  0 siblings, 1 reply; 50+ messages in thread
From: doiggl @ 2014-05-16 10:47 UTC (permalink / raw)
  To: Jeff Mahoney; +Cc: reiserfs-devel

On Sat, 26 Apr 2014 11:14:00 -0400, Jeff Mahoney <jeffm@suse.com> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> On 4/25/14, 11:46 PM, doiggl@velocitynet.com.au 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
>> 
>> logged https://bugzilla.novell.com/show_bug.cgi?id=875332
> 
> 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

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

^ permalink raw reply	[flat|nested] 50+ messages in thread

* Re: [patch 00/29] reiserfs cleanup patchset
  2014-05-16 10:47     ` doiggl
@ 2014-05-22  8:24       ` doiggl
  2014-05-22 13:51         ` Jeff Mahoney
  0 siblings, 1 reply; 50+ messages in thread
From: doiggl @ 2014-05-22  8:24 UTC (permalink / raw)
  To: doiggl; +Cc: Jeff Mahoney, reiserfs-devel

On Fri, 16 May 2014 20:47:37 +1000, <doiggl@velocitynet.com.au> wrote:
> On Sat, 26 Apr 2014 11:14:00 -0400, Jeff Mahoney <jeffm@suse.com> wrote:
>> -----BEGIN PGP SIGNED MESSAGE-----
>> Hash: SHA1
>> 
>> On 4/25/14, 11:46 PM, doiggl@velocitynet.com.au 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
>>> 
>>> logged https://bugzilla.novell.com/show_bug.cgi?id=875332
>> 
>> 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


^ permalink raw reply	[flat|nested] 50+ messages in thread

* Re: [patch 00/29] reiserfs cleanup patchset
  2014-05-22  8:24       ` doiggl
@ 2014-05-22 13:51         ` Jeff Mahoney
  2014-05-26  4:12           ` doiggl
  2014-06-12 14:31           ` doiggl
  0 siblings, 2 replies; 50+ messages in thread
From: Jeff Mahoney @ 2014-05-22 13:51 UTC (permalink / raw)
  To: doiggl; +Cc: reiserfs-devel

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 5/22/14, 4:24 AM, doiggl@velocitynet.com.au wrote:
> On Fri, 16 May 2014 20:47:37 +1000, <doiggl@velocitynet.com.au>
> wrote:
>> On Sat, 26 Apr 2014 11:14:00 -0400, Jeff Mahoney <jeffm@suse.com>
>> wrote:
>>> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
>>> 
>>> On 4/25/14, 11:46 PM, doiggl@velocitynet.com.au 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
>>>> 
>>>> logged https://bugzilla.novell.com/show_bug.cgi?id=875332
>>> 
>>> 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/]

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-----

^ permalink raw reply	[flat|nested] 50+ messages in thread

* Re: [patch 00/29] reiserfs cleanup patchset
  2014-05-22 13:51         ` Jeff Mahoney
@ 2014-05-26  4:12           ` doiggl
  2014-05-26 18:24             ` Jeff Mahoney
  2014-06-12 14:31           ` doiggl
  1 sibling, 1 reply; 50+ messages in thread
From: doiggl @ 2014-05-26  4:12 UTC (permalink / raw)
  To: Jeff Mahoney; +Cc: reiserfs-devel

On Thu, 22 May 2014 09:51:54 -0400, Jeff Mahoney <jeffm@suse.com> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> On 5/22/14, 4:24 AM, doiggl@velocitynet.com.au wrote:
>> On Fri, 16 May 2014 20:47:37 +1000, <doiggl@velocitynet.com.au>
>> wrote:
>>> On Sat, 26 Apr 2014 11:14:00 -0400, Jeff Mahoney <jeffm@suse.com>
>>> wrote:
>>>> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
>>>> 
>>>> On 4/25/14, 11:46 PM, doiggl@velocitynet.com.au 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
>>>>> 
>>>>> logged https://bugzilla.novell.com/show_bug.cgi?id=875332
>>>> 
>>>> 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/]
> 
> 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:

	########################################################
	# 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

^ permalink raw reply	[flat|nested] 50+ messages in thread

* Re: [patch 00/29] reiserfs cleanup patchset
  2014-05-26  4:12           ` doiggl
@ 2014-05-26 18:24             ` Jeff Mahoney
  0 siblings, 0 replies; 50+ messages in thread
From: Jeff Mahoney @ 2014-05-26 18:24 UTC (permalink / raw)
  To: doiggl; +Cc: reiserfs-devel

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 5/26/14, 12:12 AM, doiggl@velocitynet.com.au wrote:
> On Thu, 22 May 2014 09:51:54 -0400, Jeff Mahoney <jeffm@suse.com>
> wrote:
>> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
>> 
>> On 5/22/14, 4:24 AM, doiggl@velocitynet.com.au wrote:
>>> On Fri, 16 May 2014 20:47:37 +1000,
>>> <doiggl@velocitynet.com.au> wrote:
>>>> On Sat, 26 Apr 2014 11:14:00 -0400, Jeff Mahoney
>>>> <jeffm@suse.com> wrote:
>>>>> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
>>>>> 
>>>>> On 4/25/14, 11:46 PM, doiggl@velocitynet.com.au 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
>>>>>>
>>>>>>
>>>>>> 
logged https://bugzilla.novell.com/show_bug.cgi?id=875332
>>>>> 
>>>>> 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/]
>> 
>> 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:
> 
> ######################################################## # 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-----

^ permalink raw reply	[flat|nested] 50+ messages in thread

* Re: [patch 00/29] reiserfs cleanup patchset
  2014-04-23 14:00 [patch 00/29] reiserfs cleanup patchset Jeff Mahoney
                   ` (29 preceding siblings ...)
  2014-05-13 14:13 ` Jan Kara
@ 2014-05-27  9:23 ` doiggl
  2014-05-27 12:36   ` Jeff Mahoney
  30 siblings, 1 reply; 50+ messages in thread
From: doiggl @ 2014-05-27  9:23 UTC (permalink / raw)
  To: Jeff Mahoney; +Cc: ReiserFS Development List, Jan Kara, Dave Jones

On Wed, 23 Apr 2014 10:00:33 -0400, Jeff Mahoney <jeffm@suse.com> wrote:
> 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
> 
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/

^ permalink raw reply	[flat|nested] 50+ messages in thread

* Re: [patch 00/29] reiserfs cleanup patchset
  2014-05-27  9:23 ` doiggl
@ 2014-05-27 12:36   ` Jeff Mahoney
  2014-06-05  3:21     ` Jose R R
  0 siblings, 1 reply; 50+ messages in thread
From: Jeff Mahoney @ 2014-05-27 12:36 UTC (permalink / raw)
  To: doiggl; +Cc: ReiserFS Development List

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 5/27/14, 5:23 AM, doiggl@velocitynet.com.au wrote:
> On Wed, 23 Apr 2014 10:00:33 -0400, Jeff Mahoney <jeffm@suse.com> 
> wrote:
>> 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
>> 
> 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

> --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/
> 


- -- 
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-----

^ permalink raw reply	[flat|nested] 50+ messages in thread

* Re: [patch 00/29] reiserfs cleanup patchset
  2014-05-27 12:36   ` Jeff Mahoney
@ 2014-06-05  3:21     ` Jose R R
       [not found]       ` <47aabceb9575031270f0940059da157c@mail.velocitynet.com.au>
  0 siblings, 1 reply; 50+ messages in thread
From: Jose R R @ 2014-06-05  3:21 UTC (permalink / raw)
  To: Jeff Mahoney; +Cc: doiggl, ReiserFS Development List

"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.

On Tue, May 27, 2014 at 5:36 AM, Jeff Mahoney <jeffm@suse.com> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> On 5/27/14, 5:23 AM, doiggl@velocitynet.com.au wrote:
>> On Wed, 23 Apr 2014 10:00:33 -0400, Jeff Mahoney <jeffm@suse.com>
>> wrote:
>>> 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
>>>
>> 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
>
>> --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/
>>
>
>
> - --
> 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 majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html



-- 
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
---------------------------------------------------------------------------------------------

^ permalink raw reply	[flat|nested] 50+ messages in thread

* Re: [patch 00/29] reiserfs cleanup patchset
  2014-05-22 13:51         ` Jeff Mahoney
  2014-05-26  4:12           ` doiggl
@ 2014-06-12 14:31           ` doiggl
  2014-06-12 14:38             ` Jeff Mahoney
  1 sibling, 1 reply; 50+ messages in thread
From: doiggl @ 2014-06-12 14:31 UTC (permalink / raw)
  To: Jeff Mahoney; +Cc: reiserfs-devel

On Thu, 22 May 2014 09:51:54 -0400, Jeff Mahoney <jeffm@suse.com> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> On 5/22/14, 4:24 AM, doiggl@velocitynet.com.au wrote:
>> On Fri, 16 May 2014 20:47:37 +1000, <doiggl@velocitynet.com.au>
>> wrote:
>>> On Sat, 26 Apr 2014 11:14:00 -0400, Jeff Mahoney <jeffm@suse.com>
>>> wrote:
>>>> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
>>>> 
>>>> On 4/25/14, 11:46 PM, doiggl@velocitynet.com.au 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
>>>>> 
>>>>> logged https://bugzilla.novell.com/show_bug.cgi?id=875332
>>>> 
>>>> 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/]
> 
> 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

^ permalink raw reply	[flat|nested] 50+ messages in thread

* Re: [patch 00/29] reiserfs cleanup patchset
  2014-06-12 14:31           ` doiggl
@ 2014-06-12 14:38             ` Jeff Mahoney
  2014-06-13  4:20               ` doiggl
  0 siblings, 1 reply; 50+ messages in thread
From: Jeff Mahoney @ 2014-06-12 14:38 UTC (permalink / raw)
  To: doiggl; +Cc: reiserfs-devel

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 6/12/14, 10:31 AM, doiggl@velocitynet.com.au wrote:
> On Thu, 22 May 2014 09:51:54 -0400, Jeff Mahoney <jeffm@suse.com>
> wrote:
>> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
>> 
>> On 5/22/14, 4:24 AM, doiggl@velocitynet.com.au wrote:
>>> On Fri, 16 May 2014 20:47:37 +1000,
>>> <doiggl@velocitynet.com.au> wrote:
>>>> On Sat, 26 Apr 2014 11:14:00 -0400, Jeff Mahoney
>>>> <jeffm@suse.com> wrote:
>>>>> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
>>>>> 
>>>>> On 4/25/14, 11:46 PM, doiggl@velocitynet.com.au 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
>>>>>>
>>>>>>
>>>>>> 
logged https://bugzilla.novell.com/show_bug.cgi?id=875332
>>>>> 
>>>>> 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/]
>> 
>> 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.

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-----

^ permalink raw reply	[flat|nested] 50+ messages in thread

* Re: [patch 00/29] reiserfs cleanup patchset
  2014-06-12 14:38             ` Jeff Mahoney
@ 2014-06-13  4:20               ` doiggl
  2014-06-13  4:25                 ` Jeff Mahoney
  0 siblings, 1 reply; 50+ messages in thread
From: doiggl @ 2014-06-13  4:20 UTC (permalink / raw)
  To: Jeff Mahoney; +Cc: reiserfs-devel


> 
> 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

^ permalink raw reply	[flat|nested] 50+ messages in thread

* Re: [patch 00/29] reiserfs cleanup patchset
  2014-06-13  4:20               ` doiggl
@ 2014-06-13  4:25                 ` Jeff Mahoney
  2014-06-13 15:09                   ` Jeff Mahoney
  0 siblings, 1 reply; 50+ messages in thread
From: Jeff Mahoney @ 2014-06-13  4:25 UTC (permalink / raw)
  To: doiggl; +Cc: reiserfs-devel

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 6/13/14, 12:20 AM, doiggl@velocitynet.com.au wrote:
> 
>> 
>> 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
>
> 
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-----

^ permalink raw reply	[flat|nested] 50+ messages in thread

* Re: [patch 00/29] reiserfs cleanup patchset
  2014-06-13  4:25                 ` Jeff Mahoney
@ 2014-06-13 15:09                   ` Jeff Mahoney
  0 siblings, 0 replies; 50+ messages in thread
From: Jeff Mahoney @ 2014-06-13 15:09 UTC (permalink / raw)
  To: doiggl; +Cc: reiserfs-devel

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 6/13/14, 12:25 AM, Jeff Mahoney wrote:
> On 6/13/14, 12:20 AM, doiggl@velocitynet.com.au wrote:
> 
>>> 
>>> 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
>
>> 
> 
> No, 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-----

^ permalink raw reply	[flat|nested] 50+ messages in thread

* Re: [patch 00/29] reiserfs cleanup patchset - 03/29 attached [reiserfs: cleanup, reformat comments to normal kernel style]
       [not found]       ` <47aabceb9575031270f0940059da157c@mail.velocitynet.com.au>
@ 2014-06-26 14:27         ` Jose R R
  0 siblings, 0 replies; 50+ messages in thread
From: Jose R R @ 2014-06-26 14:27 UTC (permalink / raw)
  To: doiggl; +Cc: ReiserFS Development List

Thank you, Glenn!


On Thu, Jun 5, 2014 at 8:41 PM, <doiggl@velocitynet.com.au> wrote:
>
> On Wed, 4 Jun 2014 20:21:38 -0700, Jose R R <Jose.r.r@metztli-it.com>
> wrote:
> > "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.
> 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.


-- 
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
---------------------------------------------------------------------------------------------

^ permalink raw reply	[flat|nested] 50+ messages in thread

end of thread, other threads:[~2014-06-26 14:27 UTC | newest]

Thread overview: 50+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-23 14:00 [patch 00/29] reiserfs cleanup patchset Jeff Mahoney
2014-04-23 14:00 ` [patch 01/29] reiserfs: use per-fs commit workqueues Jeff Mahoney
2014-04-23 14:00 ` [patch 02/29] reiserfs: cleanup, rename key and item accessors to more friendly names Jeff Mahoney
2014-04-23 14:00 ` [patch 04/29] reiserfs: cleanup, remove nblocks argument from journal_end Jeff Mahoney
2014-04-23 14:00 ` [patch 05/29] reiserfs: cleanup, remove sb " Jeff Mahoney
2014-04-23 14:00 ` [patch 06/29] reiserfs: cleanup, remove sb argument from journal_mark_dirty Jeff Mahoney
2014-04-23 14:00 ` [patch 07/29] reiserfs: cleanup, remove blocks arg from journal_join Jeff Mahoney
2014-04-23 14:00 ` [patch 08/29] reiserfs: cleanup, remove leading whitespace from labels Jeff Mahoney
2014-04-23 14:00 ` [patch 09/29] reiserfs: cleanup, remove unnecessary parens Jeff Mahoney
2014-04-23 14:00 ` [patch 10/29] reiserfs: cleanup, remove unnecessary parens in dirent creation Jeff Mahoney
2014-04-23 14:00 ` [patch 11/29] reiserfs: cleanup, make hash detection saner Jeff Mahoney
2014-05-06 21:27   ` Jan Kara
2014-05-07 12:16     ` Jeff Mahoney
2014-05-07 15:50       ` Jan Kara
2014-04-23 14:00 ` [patch 12/29] reiserfs: balance_leaf refactor, reformat balance_leaf comments Jeff Mahoney
2014-04-23 14:00 ` [patch 13/29] reiserfs: balance_leaf refactor, move state variables into tree_balance Jeff Mahoney
2014-04-23 14:00 ` [patch 14/29] reiserfs: balance_leaf refactor, pull out balance_leaf_insert_left Jeff Mahoney
2014-04-23 14:00 ` [patch 15/29] reiserfs: balance_leaf refactor, pull out balance_leaf_paste_left Jeff Mahoney
2014-04-23 14:00 ` [patch 16/29] reiserfs: balance_leaf refactor, pull out balance_leaf_insert_right Jeff Mahoney
2014-04-23 14:00 ` [patch 17/29] reiserfs: balance_leaf refactor, pull out balance_leaf_paste_right Jeff Mahoney
2014-04-23 14:00 ` [patch 18/29] reiserfs: balance_leaf refactor, pull out balance_leaf_new_nodes_insert Jeff Mahoney
2014-04-23 14:00 ` [patch 19/29] reiserfs: balance_leaf refactor, pull out balance_leaf_new_nodes_paste Jeff Mahoney
2014-04-23 14:00 ` [patch 20/29] reiserfs: balance_leaf refactor pull out balance_leaf_finish_node_insert Jeff Mahoney
2014-04-23 14:00 ` [patch 21/29] reiserfs: balance_leaf refactor, pull out balance_leaf_finish_node_paste Jeff Mahoney
2014-04-23 14:00 ` [patch 22/29] reiserfs: balance_leaf refactor, pull out balance_leaf{left, right, new_nodes, finish_node} Jeff Mahoney
2014-04-23 14:00 ` [patch 23/29] reiserfs: balance_leaf refactor, format balance_leaf_insert_left Jeff Mahoney
2014-04-23 14:00 ` [patch 24/29] reiserfs: balance_leaf refactor, format balance_leaf_paste_left Jeff Mahoney
2014-04-23 14:00 ` [patch 25/29] reiserfs: balance_leaf refactor, format balance_leaf_insert_right Jeff Mahoney
2014-04-23 14:00 ` [patch 26/29] reiserfs: balance_leaf refactor, format balance_leaf_paste_right Jeff Mahoney
2014-04-23 14:01 ` [patch 27/29] reiserfs: balance_leaf refactor, format balance_leaf_new_nodes_paste Jeff Mahoney
2014-04-23 14:01 ` [patch 28/29] reiserfs: balance_leaf refactor, format balance_leaf_finish_node Jeff Mahoney
2014-04-23 14:01 ` [patch 29/29] reiserfs: balance_leaf refactor, split up balance_leaf_when_delete Jeff Mahoney
2014-04-26  3:46 ` [patch 00/29] reiserfs cleanup patchset doiggl
2014-04-26 15:14   ` Jeff Mahoney
2014-05-16 10:47     ` doiggl
2014-05-22  8:24       ` doiggl
2014-05-22 13:51         ` Jeff Mahoney
2014-05-26  4:12           ` doiggl
2014-05-26 18:24             ` Jeff Mahoney
2014-06-12 14:31           ` doiggl
2014-06-12 14:38             ` Jeff Mahoney
2014-06-13  4:20               ` doiggl
2014-06-13  4:25                 ` Jeff Mahoney
2014-06-13 15:09                   ` Jeff Mahoney
2014-05-13 14:13 ` Jan Kara
2014-05-13 14:15   ` Jeff Mahoney
2014-05-27  9:23 ` doiggl
2014-05-27 12:36   ` Jeff Mahoney
2014-06-05  3:21     ` Jose R R
     [not found]       ` <47aabceb9575031270f0940059da157c@mail.velocitynet.com.au>
2014-06-26 14:27         ` [patch 00/29] reiserfs cleanup patchset - 03/29 attached [reiserfs: cleanup, reformat comments to normal kernel style] Jose R R

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.