From: Hans Reiser Bug fix for list manipulations. List_splice in reiser4's type safe list API differed from struct list_head's list_splice: it appeneded one list to the end of another one while list_splice inserts list to the beginning of another list. This patch fixes bugs which appeared due to this difference when type safe lists were replaced by struct list_head. There are also few ending white spaces removals. Signed-off-by: Vladimir V. Saveliev Signed-off-by: Andrew Morton --- fs/reiser4/blocknrset.c | 3 +-- fs/reiser4/flush_queue.c | 4 +--- fs/reiser4/plugin/item/extent_flush_ops.c | 9 +++------ fs/reiser4/reiser4.h | 2 +- fs/reiser4/txnmgr.c | 14 +++----------- reiser4/ktxnmgrd.c | 0 reiser4/plugin/item/extent.h | 0 7 files changed, 9 insertions(+), 23 deletions(-) diff -puN fs/reiser4/blocknrset.c~reiser4-fix-list_splice-usage fs/reiser4/blocknrset.c --- devel/fs/reiser4/blocknrset.c~reiser4-fix-list_splice-usage 2005-09-28 22:56:20.000000000 -0700 +++ devel-akpm/fs/reiser4/blocknrset.c 2005-09-28 22:56:20.000000000 -0700 @@ -299,8 +299,7 @@ void blocknr_set_merge(blocknr_set * fro } /* Splice lists together. */ - list_splice(&from->entries, &into->entries); - INIT_LIST_HEAD(&from->entries); + list_splice_init(&from->entries, into->entries.prev); /* Add the partial entry back to the head of the list. */ if (bse_into != NULL) { diff -puN fs/reiser4/flush_queue.c~reiser4-fix-list_splice-usage fs/reiser4/flush_queue.c --- devel/fs/reiser4/flush_queue.c~reiser4-fix-list_splice-usage 2005-09-28 22:56:20.000000000 -0700 +++ devel-akpm/fs/reiser4/flush_queue.c 2005-09-28 22:56:20.000000000 -0700 @@ -377,9 +377,7 @@ void fuse_fq(txn_atom *to, txn_atom *fro spin_unlock_fq(fq); } - list_splice(&from->flush_queues, &to->flush_queues); - INIT_LIST_HEAD(&from->flush_queues); - + list_splice_init(&from->flush_queues, to->flush_queues.prev); #if REISER4_DEBUG to->num_queued += from->num_queued; diff -puN fs/reiser4/ktxnmgrd.c~reiser4-fix-list_splice-usage fs/reiser4/ktxnmgrd.c diff -puN fs/reiser4/plugin/item/extent_flush_ops.c~reiser4-fix-list_splice-usage fs/reiser4/plugin/item/extent_flush_ops.c --- devel/fs/reiser4/plugin/item/extent_flush_ops.c~reiser4-fix-list_splice-usage 2005-09-28 22:56:20.000000000 -0700 +++ devel-akpm/fs/reiser4/plugin/item/extent_flush_ops.c 2005-09-28 22:56:20.000000000 -0700 @@ -452,8 +452,7 @@ unprotect_extent_nodes(flush_pos_t *flus /* move back to dirty list */ protected_list_split(protected_nodes, &unprotected_nodes, node); - list_splice(&unprotected_nodes, ATOM_DIRTY_LIST(atom, LEAF_LEVEL)); - INIT_LIST_HEAD(&unprotected_nodes); + list_splice_init(&unprotected_nodes, ATOM_DIRTY_LIST(atom, LEAF_LEVEL)->prev); UNLOCK_ATOM(atom); } @@ -726,8 +725,7 @@ assign_real_blocknrs(flush_pos_t *flush_ i++; } - list_splice(protected_nodes, ATOM_FQ_LIST(fq)); - INIT_LIST_HEAD(protected_nodes); + list_splice_init(protected_nodes, ATOM_FQ_LIST(fq)->prev); assert("vs-1687", count == i); if (state == UNALLOCATED_EXTENT) @@ -800,8 +798,7 @@ static void mark_jnodes_overwrite(flush_ atomic_dec(&node->x_count); } - list_splice(&jnodes, ATOM_OVRWR_LIST(atom)); - INIT_LIST_HEAD(&jnodes); + list_splice_init(&jnodes, ATOM_OVRWR_LIST(atom)->prev); UNLOCK_ATOM(atom); } diff -puN fs/reiser4/plugin/item/extent.h~reiser4-fix-list_splice-usage fs/reiser4/plugin/item/extent.h diff -puN fs/reiser4/reiser4.h~reiser4-fix-list_splice-usage fs/reiser4/reiser4.h --- devel/fs/reiser4/reiser4.h~reiser4-fix-list_splice-usage 2005-09-28 22:56:20.000000000 -0700 +++ devel-akpm/fs/reiser4/reiser4.h 2005-09-28 22:56:20.000000000 -0700 @@ -97,7 +97,7 @@ extern const int REISER4_MAGIC_OFFSET; / #define REISER4_USE_ENTD (1) /* Using of emergency flush is an option. */ -#define REISER4_USE_EFLUSH (1) +#define REISER4_USE_EFLUSH (0) /* key allocation is Plan-A */ #define REISER4_PLANA_KEY_ALLOCATION (1) diff -puN fs/reiser4/txnmgr.c~reiser4-fix-list_splice-usage fs/reiser4/txnmgr.c --- devel/fs/reiser4/txnmgr.c~reiser4-fix-list_splice-usage 2005-09-28 22:56:20.000000000 -0700 +++ devel-akpm/fs/reiser4/txnmgr.c 2005-09-28 22:56:20.000000000 -0700 @@ -3344,9 +3344,7 @@ capture_fuse_jnode_lists(txn_atom *large } /* Splice the lists. */ - list_splice(small_head, large_head); - /* list_splice does not clean small_head */ - INIT_LIST_HEAD(small_head); + list_splice_init(small_head, large_head->prev); return count; } @@ -3373,9 +3371,7 @@ capture_fuse_txnh_lists(txn_atom *large, } /* Splice the txn_handle list. */ - list_splice(small_head, large_head); - /* list_splice does not clean small_head */ - INIT_LIST_HEAD(small_head); + list_splice_init(small_head, large_head->prev); return count; } @@ -3439,11 +3435,7 @@ static void capture_fuse_into(txn_atom * } } /* Splice the lists of lists. */ - list_splice(&small->protected, &large->protected); - /* list_splice does not clean &small->protected */ - if (!list_empty(&small->protected)) - warning("XXX", "list-splice does not clean list"); - INIT_LIST_HEAD(&small->protected); + list_splice_init(&small->protected, large->protected.prev); /* Check our accounting. */ assert("jmacd-1063", _