Skip to contentSkip to conversation

-mm -> 2.6.13 merge status

PATCH In review Andi Kleen 18 participants 49 messages Jun 21, 2005 – Jun 27, 2005 6 messages not in the archive

Subsystems (2)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

Andi Kleen

author
#1 lore raw
Quoted 5 lines · Andrew Morton

perfctr

Not yet, but getting closer. The PPC64 guys still need to sort out a few interface issues with Mikael. We might be able to fit this into 2.6.13 if people get a move on.

So the problems IA64 had with this are resolved now?

Unfortunately there is a perfmon for i386/x86-64 implementation floating around now (with some unmergeable stuff but might be fixable) which is kind of competing now :/

Quoted 7 lines

reiser4

Merge it, I guess.

The patches still contain all the reiser4-specific namespace enhancements, only it is disabled, so it is effectively dead code. Maybe we should ask that it actually be removed?

Has there been actually any serious review on this? Last time I looked there was a lot of very ugly code in there.

Also I'm not sure things like comming with an own profiler and spinlock debugger are really acceptable. At least this stuff should be removed too.

-Andi

#2 lore raw

vs and zam, please comment on what we get from our profiler and spinlock debugger that the standard tools don't supply. I am sure you have a reason, but now is the time to articulate it.

We would like to keep the disabled code in there until we have a chance to prove (or fail to prove) that cycle detection can be resolved effectively, and then with a solution in hand argue its merits.

Hans

Quoted 16 lines · Andi Kleen

Also I'm not sure things like comming with an own profiler

and spinlock debugger are really acceptable. At least this stuff should be removed too.

(quoted diff) +0 -2
-Andi
 
-

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

author
#3 lore raw
Quoted 7 lines · Hans Reiser

vs and zam, please comment on what we get from our profiler and spinlock debugger that the standard tools don't supply. I am sure you have a reason, but now is the time to articulate it.

We would like to keep the disabled code in there until we have a chance to prove (or fail to prove) that cycle detection can be resolved effectively, and then with a solution in hand argue its merits.

How about the review of your code base? Has reiser4 ever been fully reviewed by people outside your group?

Normally full review is a requirement for merging.

-Andi

#4 lore raw
Quoted 11 lines · Andi Kleen
Quoted 7 lines · Hans Reiser

vs and zam, please comment on what we get from our profiler and spinlock debugger that the standard tools don't supply. I am sure you have a reason, but now is the time to articulate it.

We would like to keep the disabled code in there until we have a chance to prove (or fail to prove) that cycle detection can be resolved effectively, and then with a solution in hand argue its merits.

How about the review of your code base? Has reiser4 ever been fully reviewed by people outside your group?

I don't think so. Everyone used the previous criteria of the broken core changes, broken filesystem semantics and it's own useless abtraction layer (*) as an excuse not to look deeply at this huge mess yet.

(*) which isn't gone yet. and I need to look again if the core changes are okay yet. And the broken sematics should go completely aswell, if you want to reintroduce them it needs to happen at the VFS level anyway.

#5 lore raw
In reply to Andi Kleen
Quoted 13 lines · Andi Kleen
Quoted 9 lines · Hans Reiser

vs and zam, please comment on what we get from our profiler and spinlock debugger that the standard tools don't supply. I am sure you have a reason, but now is the time to articulate it.

We would like to keep the disabled code in there until we have a chance to prove (or fail to prove) that cycle detection can be resolved effectively, and then with a solution in hand argue its merits.

Quoted 6 lines

How about the review of your code base? Has reiser4 ever been fully reviewed by people outside your group?

Normally full review is a requirement for merging.

V4 has a mailing list, and a large number of testers who read the code
and comment on it. V4 has been reviewed and tested much more than V3
was before merging. Given that we sent it in quite some time ago, your
suggestion that an additional review by unspecified additional others be a requirement for merging seems untimely. Do you see my point of view on this?

I would however enjoy receiving coding suggestions at ANY time. We
don't get as much of that as I would like. I would in particular love
to have you Andi Kleen do a full review of V4 if you could be that generous with your time, as I liked much of the advice you gave us on V3.

Unspecified others doing a review, well, who knows, I will surely take the time to consider what is said by them though.....

I would prefer to not get reviews from authors of other filesystems who prefer their own code, skim through our code without taking the time to grok our philosophy and approach in depth, and then complain that our code is different from what they chose to write, and think that our changing to be like them should be mandated. I will not name names here....

Some of the suggestions on our mailing list are great, some reflect a lack of 5 years working with our code, perhaps I should feed our mailing list into the linux kernel mailing list so that people on the kernel mailing list are more aware that we exist and are active?

Quoted 5 lines

-Andi

#6 lore raw
Quoted 12 lines · Hans Reiser

V4 has a mailing list, and a large number of testers who read the code
and comment on it. V4 has been reviewed and tested much more than V3
was before merging. Given that we sent it in quite some time ago, your
suggestion that an additional review by unspecified additional others be a requirement for merging seems untimely. Do you see my point of view on this?

I would however enjoy receiving coding suggestions at ANY time. We
don't get as much of that as I would like. I would in particular love
to have you Andi Kleen do a full review of V4 if you could be that generous with your time, as I liked much of the advice you gave us on V3.

Quoted 8 lines

Unspecified others doing a review, well, who knows, I will surely take the time to consider what is said by them though.....

I would prefer to not get reviews from authors of other filesystems who prefer their own code, skim through our code without taking the time to grok our philosophy and approach in depth, and then complain that our code is different from what they chose to write, and think that our changing to be like them should be mandated. I will not name names here....

The Linux system isn't the greatest in the world, but here's reality: when a merge is imminent, a lot more attention is paid.

Andrew regularly uses this knowledge of human psychology to his (and Linux's) benefit :)

The MAJOR downside is that merge-stopping issues are sometimes ignored until an upstream merge is imminent.

If you want to get your code merged, you gotta work with the system, and LISTEN to the feedback.

Jeff, who doesn't have a filesystem axe to grind

author
#7 lore raw
In reply to Hans Reiser
Quoted 6 lines · Hans Reiser

V4 has a mailing list, and a large number of testers who read the code
and comment on it. V4 has been reviewed and tested much more than V3
was before merging. Given that we sent it in quite some time ago, your
suggestion that an additional review by unspecified additional others be a requirement for merging seems untimely. Do you see my point of view on this?

The point of the merge review is that people who are familiar with the existing Linux code double check that the way your code interfacts
with the rest of the kernel is sane, does not have obvious bugs and follows the existing good practice.

Once the code is in mainline it will get maintained and fixed when needed, but to make this possible without undue work on the mainline hackers it is needed to do a full review first.

AFAIK reiserfs has not gotten such a full review yet.

Also good reviewers are rare so it is not a good idea to be picky here.

Quoted 8 lines

Unspecified others doing a review, well, who knows, I will surely take the time to consider what is said by them though.....

I would prefer to not get reviews from authors of other filesystems who prefer their own code, skim through our code without taking the time to grok our philosophy and approach in depth, and then complain that our code is different from what they chose to write, and think that our changing to be like them should be mandated. I will not name names here....

Someone qualified to review a new file system for inclusion will have need necessary some experience in Linux file systems, and that can be hardly gotten without ever having touched one. So you will have to live with other file system authors commenting on your code.

The main philosophy that is of concern here is also the philosophy of the core VFS and other kernel interfaces.

Quoted 4 lines

Some of the suggestions on our mailing list are great, some reflect a lack of 5 years working with our code, perhaps I should feed our mailing list into the linux kernel mailing list so that people on the kernel mailing list are more aware that we exist and are active?

Nobody doubts that you are active. Just there are doubts that your code follows the Linux coding standards enough to not be a undue mainteance burden in mainline. A review with the following changes could probably fix that.

-Andi

#8 lore raw
Quoted 5 lines · Andi Kleen

Just there are doubts that your
code follows the Linux coding standards enough to not be a undue mainteance burden in mainline.

We get only a few bugfixes from outsiders, and the rest are done by us. The customers who buy licenses in addition to the GPL from us for hundreds of thousands of dollars tend to make remarks to the effect of "we licensed your code for more money in part because it was way easier to work on than XXX linux filesystem".

I like feedback on our code, and I particularly like feedback from a Mr. Andi Kleen, but there is no need to tie it to merging. If, however, it serves as an effective excuse to get some of your time allocated by SuSE management, sure, go for it.;-)

Hans

#9 lore raw
Quoted 4 lines · Hans Reiser

I like feedback on our code, and I particularly like feedback from a Mr. Andi Kleen, but there is no need to tie it to merging. If, however, it serves as an effective excuse to get some of your time allocated by SuSE management, sure, go for it.;-)

All merges of new code go like this. You've been around here for a while, this should not be a shock.

"Hans' team says its good stuff" is not a criteria for merging.

Jeff

#10 lore raw
Quoted 5 lines · Jeff Garzik

"Hans' team says its good stuff" is not a criteria for merging.

Try benchmarking it. Maybe benchmarks mean more than our chattering..... at least to the users.....

#11 lore raw
Quoted 5 lines · Hans Reiser
Quoted 1 line · Jeff Garzik

"Hans' team says its good stuff" is not a criteria for merging.

Try benchmarking it. Maybe benchmarks mean more than our chattering..... at least to the users.....

Still not a criteria for merging.

We have to care about the code behind the benchmarks.

Jeff

#12 lore raw
In reply to Hans Reiser

Hi Hans,

Quoted 3 lines · Hans Reiser

I would in particular love to have you Andi Kleen do a full review of V4 if you could be that generous with your time, as I liked much of the advice you gave us on V3.

Well, I am not Andi Kleen and this is not even in the ballpark of a full review but here goes...

P.S. Would it be possible to have a version without the plugin stuff submitted (and perhaps file as directory)? It would make much more sense for the rest of us to review reiser4 without the most controversial bits and get the bits that people agree on merged.

Pekka

fs/reiser4/pool.c

Quoted 13 lines
fs/reiser4/pool.c new file +11 -0
+/* initialise new pool */
+reiser4_internal void
+reiser4_init_pool(reiser4_pool * pool /* pool to initialise */ ,
+		  size_t obj_size /* size of objects in @pool */ ,
+		  int num_of_objs /* number of preallocated objects */ ,
+		  char *data /* area for preallocated objects */ )
+{
+	reiser4_pool_header *h;
+	int i;
+
+	assert("nikita-955", pool != NULL);

These assertion codes are meaningless to the rest of us so please drop them.

fs/reiser4/type_safe_hash.h line 5

Quoted 8 lines
fs/reiser4/type_safe_hash.h new file +5 -0
@@ -0,0 +1,320 @@
+/* Copyright 2001, 2002, 2003 by Hans Reiser, licensing governed by
+ * reiser4/README */
+
+/* A hash table class that uses hash chains (singly-linked) and is
+   parametrized to provide type safety.  */

This belongs to include/linux, not reiser4.

fs/reiser4/type_safe_list.h line 9

Quoted 12 lines
fs/reiser4/type_safe_list.h new file +9 -0
@@ -0,0 +1,436 @@
+/* Copyright 2001, 2002, 2003 by Hans Reiser, licensing governed by reiser4/README */
+
+#ifndef __REISER4_TYPE_SAFE_LIST_H__
+#define __REISER4_TYPE_SAFE_LIST_H__
+
+#include "debug.h"
+/* A circular doubly linked list that differs from the previous
+   <linux/list.h> implementation because it is parametrized to provide
+   type safety.  This data structure is also useful as a queue or stack.

This belongs to include/linux, not reiser4.

fs/reiser4/vfs_ops.c

Quoted 10 lines
fs/reiser4/vfs_ops.c new file +8 -0
+/* ->get_sb() method of file_system operations. */
+static struct super_block *
+reiser4_get_sb(struct file_system_type *fs_type	/* file
+						 * system
+						 * type */ ,
+	       int flags /* flags */ ,
+	       const char *dev_name /* device name */ ,
+	       void *data /* mount options */ )

Please drop the useless parameter comments.

Quoted 15 lines
fs/reiser4/vfs_ops.c new file +15 -0
+/*
+ * Initialization stages for reiser4.
+ *
+ * These enumerate various things that have to be done during reiser4
+ * startup. Initialization code (init_reiser4()) keeps track of what stage was
+ * reached, so that proper undo can be done if error occurs during
+ * initialization.
+ */
+typedef enum {
+	INIT_NONE,               /* nothing is initialized yet */
+	INIT_INODECACHE,         /* inode cache created */
+	INIT_CONTEXT_MGR,        /* list of active contexts created */
+	INIT_ZNODES,             /* znode slab created */
+	INIT_PLUGINS,            /* plugins initialized */
+	INIT_PLUGIN_SET,         /* psets initialized */

fs/reiser4/vfs_ops.c

Quoted 10 lines
fs/reiser4/vfs_ops.c new file +10 -0
+	INIT_TXN,                /* transaction manager initialized */
+	INIT_FAKES,              /* fake inode initialized */
+	INIT_JNODES,             /* jnode slab initialized */
+	INIT_EFLUSH,             /* emergency flush initialized */
+	INIT_FQS,                /* flush queues initialized */
+	INIT_DENTRY_FSDATA,      /* dentry_fsdata slab initialized */
+	INIT_FILE_FSDATA,        /* file_fsdata slab initialized */
+	INIT_D_CURSOR,           /* d_cursor suport initialized */
+	INIT_FS_REGISTERED,      /* reiser4 file system type registered */
+} reiser4_init_stage;

Please use regular gotos instead. This is a silly hack especially since you don't have release function for all of the stages.

Quoted 7 lines
fs/reiser4/vfs_ops.c new file +7 -0
+reiser4_internal void reiser4_handle_error(void)
+{
+	struct super_block *sb = reiser4_get_current_sb();
+
+	if ( !sb )
+		return;
+	reiser4_status_write(REISER4_STATUS_DAMAGED, 0, "Filesystem error occured");

fs/reiser4/vfs_ops.c

Quoted 10 lines
fs/reiser4/vfs_ops.c new file +10 -0
+	switch ( get_super_private(sb)->onerror ) {
+	case 0:
+		reiser4_panic("foobar-42", "Filesystem error occured\n");
+	case 1:
+		if ( sb->s_flags & MS_RDONLY )
+			return;
+		sb->s_flags |= MS_RDONLY;
+		break;
+	case 2:
+		machine_restart(NULL);

Probably not something you should do at fs level.

Quoted 5 lines
fs/reiser4/vfs_ops.c new file +5 -0
+/* free this znode */
+reiser4_internal void
+zfree(znode * node /* znode to free */ )
+{
+	assert("nikita-465", node != NULL);

fs/reiser4/vfs_ops.c

Quoted 10 lines
fs/reiser4/vfs_ops.c new file +10 -0
+	assert("nikita-2120", znode_page(node) == NULL);
+	assert("nikita-2301", owners_list_empty(&node->lock.owners));
+	assert("nikita-2302", requestors_list_empty(&node->lock.requestors));
+	assert("nikita-2663", capture_list_is_clean(ZJNODE(node)) && NODE_LIST(ZJNODE(node)) == NOT_CAPTURED);
+	assert("nikita-2773", !JF_ISSET(ZJNODE(node), JNODE_EFLUSH));
+	assert("nikita-3220", list_empty(&ZJNODE(node)->jnodes));
+	assert("nikita-3293", !znode_is_right_connected(node));
+	assert("nikita-3294", !znode_is_left_connected(node));
+	assert("nikita-3295", node->left == NULL);
+	assert("nikita-3296", node->right == NULL);

Are all these still required? Seems bit too defensive for the kernel.

fs/reiser4/vfs_ops.c

Quoted 6 lines
fs/reiser4/vfs_ops.c new file +6 -0
+
+
+	/* not yet phash_jnode_destroy(ZJNODE(node)); */
+
+	/* poison memory. */
+	ON_DEBUG(memset(node, 0xde, sizeof *node));

Poisoning belongs to slab, not fs.

fs/reiser4/vfs_ops.c

Quoted 9 lines
fs/reiser4/vfs_ops.c new file +9 -0
+/* allocate fresh znode */
+reiser4_internal znode *
+zalloc(int gfp_flag /* allocation flag */ )
+{
+	znode *node;
+
+	node = kmem_cache_alloc(znode_slab, gfp_flag);
+	return node;
+}

Please drop this useless wrapper.

Quoted 8 lines
fs/reiser4/vfs_ops.c new file +8 -0
+reiser4_internal void
+znode_remove(znode * node /* znode to remove */ , reiser4_tree * tree)
+{
+	assert("nikita-2108", node != NULL);
+	assert("nikita-470", node->c_count == 0);
+	assert("zam-879", rw_tree_is_write_locked(tree));
+
+	/* remove reference to this znode from cbk cache */

fs/reiser4/vfs_ops.c

Quoted 10 lines
fs/reiser4/vfs_ops.c new file +10 -0
+	cbk_cache_invalidate(node, tree);
+
+	/* update c_count of parent */
+	if (znode_parent(node) != NULL) {
+		assert("nikita-472", znode_parent(node)->c_count > 0);
+		/* father, onto your hands I forward my spirit... */
+		znode_parent(node)->c_count --;
+		node->in_parent.node = NULL;
+	} else {
+		/* orphaned znode?! Root? */

Drop the useless else branch.

Quoted 13 lines
fs/reiser4/debug.c new file +10 -0
@@ -0,0 +1,447 @@
+/* Copyright 2001, 2002, 2003 by Hans Reiser, licensing governed by
+ * reiser4/README */
+
+/* Debugging facilities. */
+
+/*
+ * This file contains generic debugging functions used by reiser4. Roughly
+ * following:
+ *
+ *     panicking: reiser4_do_panic(), reiser4_print_prefix().

fs/reiser4/debug.c line 20

Quoted 10 lines
fs/reiser4/debug.c new file +10 -0
+ *
+ *     locking: schedulable(), lock_counters(), print_lock_counters(),
+ *     no_counters_are_held(), commit_check_locks()
+ *
+ *     {debug,trace,log}_flags: reiser4_are_all_debugged(),
+ *     reiser4_is_debugged(), get_current_trace_flags(),
+ *     get_current_log_flags().
+ *
+ *     kmalloc/kfree leak detection: reiser4_kmalloc(), reiser4_kfree(),
+ *     reiser4_kfree_in_sb().

Please don't do this! We've had enough trouble trying to get the current subsystem specific allocators out, so do not introduce a new one. If you need memory leak detection, make it generic and submit that. Reiser4, like all other subsystems, should use kmalloc() and friends directly.

fs/reiser4/debug.h

Quoted 5 lines
fs/reiser4/debug.h new file +3 -0
+
+/*
+ * Error code tracing facility. (Idea is borrowed from XFS code.)

Could this be turned into a generic facility?

Quoted 4 lines

+ *
+ * Suppose some strange and/or unexpected code is returned from some function
+ * (for example, write(2) returns -EEXIST). It is possible to place a
+ * breakpoint in the reiser4_write(), but it is too late here. How to find out

--

fs/reiser4/debug.h

Quoted 10 lines
fs/reiser4/debug.h new file +9 -0
+#define RETERR(code) 				\
+({						\
+	typeof(code) __code;			\
+						\
+	__code = (code);			\
+	return_err(__code, __FILE__, __LINE__);	\
+	__code;					\
+})
 
+#define reiser4_internal

Please drop the above useless #define.

fs/reiser4/emergency_flush.c line 4

Quoted 7 lines
fs/reiser4/emergency_flush.c new file +4 -0
@@ -0,0 +1,913 @@
+/* Copyright 2002, 2003 by Hans Reiser, licensing governed by reiser4/README */
+
+/* This file exists only until VM gets fixed to reserve pages properly, which
+ * might or might not be very political. */

Please fix vm instead of working around it in fs.

fs/reiser4/init_super.c

Quoted 8 lines
fs/reiser4/init_super.c new file +6 -0
+
+#define _INIT_PARAM_LIST (struct super_block * s, reiser4_context * ctx, void * data, int silent)
+#define _DONE_PARAM_LIST (struct super_block * s)
+
+#define _INIT_(subsys) static int _init_##subsys _INIT_PARAM_LIST
+#define _DONE_(subsys) static void _done_##subsys _DONE_PARAM_LIST

Please remove this macro obfuscation.

Quoted 19 lines
fs/reiser4/init_super.c new file +19 -0
+
+_DONE_EMPTY(exit_context)
+
+struct reiser4_subsys {
+	int  (*init) _INIT_PARAM_LIST;
+	void (*done) _DONE_PARAM_LIST;
+};
+
+#define _SUBSYS(subsys) {.init = &_init_##subsys, .done = &_done_##subsys}
+static struct reiser4_subsys subsys_array[] = {
+	_SUBSYS(mount_flags_check),
+	_SUBSYS(sinfo),
+	_SUBSYS(context),
+	_SUBSYS(parse_options),
+	_SUBSYS(object_ops),
+	_SUBSYS(read_super),
+	_SUBSYS(tree0),
+	_SUBSYS(txnmgr),
+	_SUBSYS(ktxnmgrd_context),

fs/reiser4/init_super.c

Quoted 10 lines
fs/reiser4/init_super.c new file +10 -0
+	_SUBSYS(ktxnmgrd),
+	_SUBSYS(entd),
+	_SUBSYS(formatted_fake),
+	_SUBSYS(disk_format),
+	_SUBSYS(sb_counters),
+	_SUBSYS(d_cursor),
+	_SUBSYS(fs_root),
+	_SUBSYS(safelink),
+	_SUBSYS(exit_context)
+};

The above is overkill and silly. parse_options and read_super, for example, are _not_ a subsystem inits but regular fs ops. Please consider dropping this altogether but at least trim it down to something sane.

fs/reiser4/page_cache.c

Quoted 8 lines
fs/reiser4/page_cache.c new file +6 -0
+/* one-time initialization of fake inodes handling functions. */
+reiser4_internal int
+init_fakes()
+{
+	return 0;
+}

Please drop this empty function.

#13 lore raw
Quoted 5 lines · Pekka Enberg

Hi Hans,

On 6/22/05, Hans Reiser <[email protected]> wrote:

Quoted 10 lines
Quoted 5 lines

I would in particular love to have you Andi Kleen do a full review of V4 if you could be that generous with your time, as I liked much of the advice you gave us on V3.

Well, I am not Andi Kleen and this is not even in the ballpark of a full review but here goes...

thanks kindly for your time, your comments were appreciated

Quoted 3 lines

P.S. Would it be possible to have a version without the plugin stuff submitted (and perhaps file as directory)?

No, I am sorry. It is like asking for ext2 without directories.

Quoted 18 lines

It would make much more
sense for the rest of us to review reiser4 without the most controversial bits and get the bits that people agree on merged.

Pekka

Quoted 10 lines
fs/reiser4/pool.c new file +8 -0
+/* initialise new pool */
+reiser4_internal void
+reiser4_init_pool(reiser4_pool * pool /* pool to initialise */ ,
+		  size_t obj_size /* size of objects in @pool */ ,
+		  int num_of_objs /* number of preallocated objects */ ,
+		  char *data /* area for preallocated objects */ )
+{
+	reiser4_pool_header *h;
Quoted 10 lines

fs/reiser4/pool.c

Quoted 5 lines
fs/reiser4/pool.c new file +3 -0
+	int i;
+
+	assert("nikita-955", pool != NULL);

These assertion codes are meaningless to the rest of us so please drop them.

I think you don't appreciate the role of assertions in making code easier to audit and debug.

Quoted 16 lines

fs/reiser4/type_safe_hash.h line 5

Quoted 12 lines
fs/reiser4/type_safe_hash.h new file +5 -0
@@ -0,0 +1,320 @@
+/* Copyright 2001, 2002, 2003 by Hans Reiser, licensing governed by
+ * reiser4/README */
+
+/* A hash table class that uses hash chains (singly-linked) and is
+   parametrized to provide type safety.  */

This belongs to include/linux, not reiser4.

Too much politics are involved in modifying other peoples directories, or I'd agree with you. The first person outside the reiser4 project to use it should move it into a different place.

Quoted 20 lines
Quoted 7 lines

fs/reiser4/type_safe_list.h line 9

Quoted 9 lines
fs/reiser4/type_safe_list.h new file +9 -0
@@ -0,0 +1,436 @@
+/* Copyright 2001, 2002, 2003 by Hans Reiser, licensing governed by reiser4/README */
+
+#ifndef __REISER4_TYPE_SAFE_LIST_H__
+#define __REISER4_TYPE_SAFE_LIST_H__
+
+#include "debug.h"
+/* A circular doubly linked list that differs from the previous
+   <linux/list.h> implementation because it is parametrized to provide
+   type safety.  This data structure is also useful as a queue or stack.

This belongs to include/linux, not reiser4.

Yes, but see above about first person outside reiser4 project should.....

Quoted 18 lines
Quoted 6 lines

fs/reiser4/vfs_ops.c

Quoted 8 lines
fs/reiser4/vfs_ops.c new file +8 -0
+/* ->get_sb() method of file_system operations. */
+static struct super_block *
+reiser4_get_sb(struct file_system_type *fs_type	/* file
+						 * system
+						 * type */ ,
+	       int flags /* flags */ ,
+	       const char *dev_name /* device name */ ,
+	       void *data /* mount options */ )

Please drop the useless parameter comments.

vs, figure out who added the flags and device name comments and ask them to prepare a patch. If nobody admits to the shameful act,;-) have Edward fix it.

Quoted 24 lines
Quoted 24 lines
fs/reiser4/vfs_ops.c new file +22 -0
+/*
+ * Initialization stages for reiser4.
+ *
+ * These enumerate various things that have to be done during reiser4
+ * startup. Initialization code (init_reiser4()) keeps track of what stage was
+ * reached, so that proper undo can be done if error occurs during
+ * initialization.
+ */
+typedef enum {
+	INIT_NONE,               /* nothing is initialized yet */
+	INIT_INODECACHE,         /* inode cache created */
+	INIT_CONTEXT_MGR,        /* list of active contexts created */
+	INIT_ZNODES,             /* znode slab created */
+	INIT_PLUGINS,            /* plugins initialized */
+	INIT_PLUGIN_SET,         /* psets initialized */
+	INIT_TXN,                /* transaction manager initialized */
+	INIT_FAKES,              /* fake inode initialized */
+	INIT_JNODES,             /* jnode slab initialized */
+	INIT_EFLUSH,             /* emergency flush initialized */
+	INIT_FQS,                /* flush queues initialized */
+	INIT_DENTRY_FSDATA,      /* dentry_fsdata slab initialized */
+	INIT_FILE_FSDATA,        /* file_fsdata slab initialized */
Quoted 10 lines

fs/reiser4/vfs_ops.c

Quoted 5 lines
fs/reiser4/vfs_ops.c new file +3 -0
+	INIT_D_CURSOR,           /* d_cursor suport initialized */
+	INIT_FS_REGISTERED,      /* reiser4 file system type registered */
+} reiser4_init_stage;

Please use regular gotos instead. This is a silly hack especially since you don't have release function for all of the stages.

I'll let vs comment.

Quoted 15 lines
Quoted 15 lines
fs/reiser4/vfs_ops.c new file +13 -0
+reiser4_internal void reiser4_handle_error(void)
+{
+	struct super_block *sb = reiser4_get_current_sb();
+
+	if ( !sb )
+		return;
+	reiser4_status_write(REISER4_STATUS_DAMAGED, 0, "Filesystem error occured");
+	switch ( get_super_private(sb)->onerror ) {
+	case 0:
+		reiser4_panic("foobar-42", "Filesystem error occured\n");
+	case 1:
+		if ( sb->s_flags & MS_RDONLY )
+			return;
Quoted 10 lines

fs/reiser4/vfs_ops.c

Quoted 6 lines
fs/reiser4/vfs_ops.c new file +4 -0
+		sb->s_flags |= MS_RDONLY;
+		break;
+	case 2:
+		machine_restart(NULL);

Probably not something you should do at fs level.

Not sure why you say that.

vs, given the existence of case 0, why do we need to have case 2?

Quoted 13 lines
Quoted 13 lines
fs/reiser4/vfs_ops.c new file +11 -0
+/* free this znode */
+reiser4_internal void
+zfree(znode * node /* znode to free */ )
+{
+	assert("nikita-465", node != NULL);
+	assert("nikita-2120", znode_page(node) == NULL);
+	assert("nikita-2301", owners_list_empty(&node->lock.owners));
+	assert("nikita-2302", requestors_list_empty(&node->lock.requestors));
+	assert("nikita-2663", capture_list_is_clean(ZJNODE(node)) && NODE_LIST(ZJNODE(node)) == NOT_CAPTURED);
+	assert("nikita-2773", !JF_ISSET(ZJNODE(node), JNODE_EFLUSH));
+	assert("nikita-3220", list_empty(&ZJNODE(node)->jnodes));
Quoted 10 lines

fs/reiser4/vfs_ops.c

Quoted 6 lines
fs/reiser4/vfs_ops.c new file +4 -0
+	assert("nikita-3293", !znode_is_right_connected(node));
+	assert("nikita-3294", !znode_is_left_connected(node));
+	assert("nikita-3295", node->left == NULL);
+	assert("nikita-3296", node->right == NULL);

Are all these still required? Seems bit too defensive for the kernel.

Hmm, someday must put you in a room with DARPA guys, and let you get us another round of funding by trying to convince them that our code is too defensive.;-)

This is not too defensive. Nikita did well here. The culture of code auditors is very different from most programmers. Like most specialists, they have wisdom to offer those who listen to them. In essence, they teach that every function should have a specification of every possible restriction on allowed input that can be imagined and is correct as a restriction. Code auditors love assertions like this. I look at my understanding of this before DARPA, and I wince. DARPA patiently taught me much in this area as I listened to security talks at our meetings, and I thank them for it.

Large scale projects like reiser4 are crippled by debugging costs. Anything that reduces debugging time is worth so much.....

Quoted 14 lines

fs/reiser4/vfs_ops.c

Quoted 10 lines
fs/reiser4/vfs_ops.c new file +6 -0
+
+
+	/* not yet phash_jnode_destroy(ZJNODE(node)); */
+
+	/* poison memory. */
+	ON_DEBUG(memset(node, 0xde, sizeof *node));

Poisoning belongs to slab, not fs.

vs, please comment.

Quoted 17 lines

fs/reiser4/vfs_ops.c

Quoted 13 lines
fs/reiser4/vfs_ops.c new file +9 -0
+/* allocate fresh znode */
+reiser4_internal znode *
+zalloc(int gfp_flag /* allocation flag */ )
+{
+	znode *node;
+
+	node = kmem_cache_alloc(znode_slab, gfp_flag);
+	return node;
+}

Please drop this useless wrapper.

Thanks. vs, I think he is right here.... I see zalloc used in only two places..... Or is the desire to ease future porting work?

Quoted 48 lines
Quoted 12 lines
fs/reiser4/vfs_ops.c new file +8 -0
+reiser4_internal void
+znode_remove(znode * node /* znode to remove */ , reiser4_tree * tree)
+{
+	assert("nikita-2108", node != NULL);
+	assert("nikita-470", node->c_count == 0);
+	assert("zam-879", rw_tree_is_write_locked(tree));
+
+	/* remove reference to this znode from cbk cache */

fs/reiser4/vfs_ops.c

Quoted 10 lines
fs/reiser4/vfs_ops.c new file +10 -0
+	cbk_cache_invalidate(node, tree);
+
+	/* update c_count of parent */
+	if (znode_parent(node) != NULL) {
+		assert("nikita-472", znode_parent(node)->c_count > 0);
+		/* father, onto your hands I forward my spirit... */
+		znode_parent(node)->c_count --;
+		node->in_parent.node = NULL;
+	} else {
+		/* orphaned znode?! Root? */

Drop the useless else branch.

Quoted 22 lines
fs/reiser4/debug.c new file +19 -0
@@ -0,0 +1,447 @@
+/* Copyright 2001, 2002, 2003 by Hans Reiser, licensing governed by
+ * reiser4/README */
+
+/* Debugging facilities. */
+
+/*
+ * This file contains generic debugging functions used by reiser4. Roughly
+ * following:
+ *
+ *     panicking: reiser4_do_panic(), reiser4_print_prefix().
+ *
+ *     locking: schedulable(), lock_counters(), print_lock_counters(),
+ *     no_counters_are_held(), commit_check_locks()
+ *
+ *     {debug,trace,log}_flags: reiser4_are_all_debugged(),
+ *     reiser4_is_debugged(), get_current_trace_flags(),
+ *     get_current_log_flags().
+ *
+ *     kmalloc/kfree leak detection: reiser4_kmalloc(), reiser4_kfree(),
Quoted 10 lines

fs/reiser4/debug.c line 20

Quoted 3 lines
fs/reiser4/debug.c new file +1 -0
+ *     reiser4_kfree_in_sb().

Please don't do this! We've had enough trouble trying to get the current subsystem specific allocators out, so do not introduce a new one. If you need memory leak detection, make it generic and submit that. Reiser4, like all other subsystems, should use kmalloc() and friends directly.

I will let vs comment.

Quoted 13 lines

fs/reiser4/debug.h

Quoted 9 lines
fs/reiser4/debug.h new file +3 -0
+
+/*
+ * Error code tracing facility. (Idea is borrowed from XFS code.)

Could this be turned into a generic facility?

Probably it already is one. Getting it used as such sounds like a lot of political work though. Maybe the first person outside the reiser4 project to want to use it should move the code into a different location.

Quoted 32 lines
Quoted 8 lines

+ *
+ * Suppose some strange and/or unexpected code is returned from some function
+ * (for example, write(2) returns -EEXIST). It is possible to place a
+ * breakpoint in the reiser4_write(), but it is too late here. How to find out

--

Quoted 6 lines
fs/reiser4/debug.h new file +4 -0
+#define RETERR(code) 				\
+({						\
+	typeof(code) __code;			\
+						\

fs/reiser4/debug.h

Quoted 10 lines
fs/reiser4/debug.h new file +5 -0
+	__code = (code);			\
+	return_err(__code, __FILE__, __LINE__);	\
+	__code;					\
+})
 
 
 
 
 
+#define reiser4_internal

Please drop the above useless #define.

Quoted 13 lines

fs/reiser4/emergency_flush.c line 4

Quoted 9 lines
fs/reiser4/emergency_flush.c new file +4 -0
@@ -0,0 +1,913 @@
+/* Copyright 2002, 2003 by Hans Reiser, licensing governed by reiser4/README */
+
+/* This file exists only until VM gets fixed to reserve pages properly, which
+ * might or might not be very political. */

Please fix vm instead of working around it in fs.

actually I want to see emergency flush die very very much. As for
fixing vm, easier said than done, politically.

Quoted 16 lines

fs/reiser4/init_super.c

Quoted 12 lines
fs/reiser4/init_super.c new file +6 -0
+
+#define _INIT_PARAM_LIST (struct super_block * s, reiser4_context * ctx, void * data, int silent)
+#define _DONE_PARAM_LIST (struct super_block * s)
+
+#define _INIT_(subsys) static int _init_##subsys _INIT_PARAM_LIST
+#define _DONE_(subsys) static void _done_##subsys _DONE_PARAM_LIST

Please remove this macro obfuscation.

vs, I think he is right, do you?

Quoted 29 lines
Quoted 29 lines
fs/reiser4/init_super.c new file +27 -0
+
+_DONE_EMPTY(exit_context)
+
+struct reiser4_subsys {
+	int  (*init) _INIT_PARAM_LIST;
+	void (*done) _DONE_PARAM_LIST;
+};
+
+#define _SUBSYS(subsys) {.init = &_init_##subsys, .done = &_done_##subsys}
+static struct reiser4_subsys subsys_array[] = {
+	_SUBSYS(mount_flags_check),
+	_SUBSYS(sinfo),
+	_SUBSYS(context),
+	_SUBSYS(parse_options),
+	_SUBSYS(object_ops),
+	_SUBSYS(read_super),
+	_SUBSYS(tree0),
+	_SUBSYS(txnmgr),
+	_SUBSYS(ktxnmgrd_context),
+	_SUBSYS(ktxnmgrd),
+	_SUBSYS(entd),
+	_SUBSYS(formatted_fake),
+	_SUBSYS(disk_format),
+	_SUBSYS(sb_counters),
+	_SUBSYS(d_cursor),
+	_SUBSYS(fs_root),
+	_SUBSYS(safelink),
Quoted 10 lines

fs/reiser4/init_super.c

Quoted 4 lines
fs/reiser4/init_super.c new file +2 -0
+	_SUBSYS(exit_context)
+};

The above is overkill and silly. parse_options and read_super, for example, are _not_ a subsystem inits but regular fs ops. Please consider dropping this altogether but at least trim it down to something sane.

vs please comment.

Quoted 18 lines

fs/reiser4/page_cache.c

Quoted 12 lines
fs/reiser4/page_cache.c new file +6 -0
+/* one-time initialization of fake inodes handling functions. */
+reiser4_internal int
+init_fakes()
+{
+	return 0;
+}

Please drop this empty function.

sure.

#14 lore raw

Hi Hans,

Quoted 5 lines · Hans Reiser
Quoted 2 lines

These assertion codes are meaningless to the rest of us so please drop them.

I think you don't appreciate the role of assertions in making code easier to audit and debug.

I did not say you should drop the assertions. I referred to the "nikita-955" part which is redundant and pointless. Using __FILE__:__LINE__ (or BUG_ON even) will give you enough information to identify where the error occured.

Quoted 5 lines · Hans Reiser
Quoted 1 line

This belongs to include/linux, not reiser4.

Too much politics are involved in modifying other peoples directories, or I'd agree with you. The first person outside the reiser4 project to use it should move it into a different place.

What politics? Please do hide generic code in your fs. How should someone outside reiser4 know you have type-safe hash tables and linked lists in there? Why should they care? It is obvious that you did not think <linux/list.h> and <linux/jhash.h> were sufficient so please fix those instead and use them.

Quoted 22 lines
Quoted 13 lines
Quoted 13 lines
(quoted diff) +13 -0
+reiser4_internal void reiser4_handle_error(void)
+{
+   struct super_block *sb = reiser4_get_current_sb();
+
+   if ( !sb )
+           return;
+   reiser4_status_write(REISER4_STATUS_DAMAGED, 0, "Filesystem error occured");
+   switch ( get_super_private(sb)->onerror ) {
+   case 0:
+           reiser4_panic("foobar-42", "Filesystem error occured\n");
+   case 1:
+           if ( sb->s_flags & MS_RDONLY )
+                   return;
Quoted 8 lines

Review

Quoted 6 lines
(quoted diff) +4 -0
+           sb->s_flags |= MS_RDONLY;
+           break;
+   case 2:
+           machine_restart(NULL);

Probably not something you should do at fs level.

Quoted 1 line

Not sure why you say that.

Because Reiser4 hitting an error condition and restarting the machine silently is silly. Just do panic() there.

Quoted 9 lines

This is not too defensive. Nikita did well here. The culture of code auditors is very different from most programmers. Like most specialists, they have wisdom to offer those who listen to them. In essence, they teach that every function should have a specification of every possible restriction on allowed input that can be imagined and is correct as a restriction. Code auditors love assertions like this. I look at my understanding of this before DARPA, and I wince. DARPA patiently taught me much in this area as I listened to security talks at our meetings, and I thank them for it.

Hans, I am aware of techniques such as design-by-contract but it is not the kernel coding style. That's because it makes the code harder to read and refactor.

Quoted 1 line

Large scale projects like reiser4 are crippled by debugging costs. Anything that reduces debugging time is worth so much.....

Then start writing automated unit tests.

Quoted 15 lines
Quoted 5 lines
Quoted 5 lines
(quoted diff) +5 -0
+/* allocate fresh znode */
+reiser4_internal znode *
+zalloc(int gfp_flag /* allocation flag */ )
+{
+   znode *node;
Quoted 10 lines

Review

Quoted 6 lines
(quoted diff) +4 -0
+
+   node = kmem_cache_alloc(znode_slab, gfp_flag);
+   return node;
+}

Please drop this useless wrapper.

Quoted 2 lines

Thanks. vs, I think he is right here.... I see zalloc used in only two places..... Or is the desire to ease future porting work?

Then add it later. It is a useless wrapper now.

Quoted 11 lines
Quoted 9 lines

fs/reiser4/debug.h 2005-06-03 17:49:38.297184283 +0400

Quoted 7 lines
fs/reiser4/debug.h 2005-06-03 17:49:38.297184283 +0400 renamed from dev/null 2003-09-23 21:59:22.000000000 +0400 +3 -0
+
+/*
+ * Error code tracing facility. (Idea is borrowed from XFS code.)

Could this be turned into a generic facility?

Quoted 3 lines

Probably it already is one. Getting it used as such sounds like a lot of political work though. Maybe the first person outside the reiser4 project to want to use it should move the code into a different location.

What political work? Just whoop up a patch to introduce it as a generic
facility and let others review it. There are plenty of janitors that are
willing to convert the existing code. Please note that you're now duplicating code from XFS (even if it is just an idea you borrowed).

This stuff is fairly simple: if the technique you're using is good, it should probably be generic; if it isn't, you shouldn't be using it either. Please don't let the pissing contest between you and hch create more work for the rest of us.

Quoted 2 lines

actually I want to see emergency flush die very very much. As for
fixing vm, easier said than done, politically.

As you might have noticed, I don't care for politics. Just post the patch to fix the vm for review.

Pekka

#15 lore raw
Quoted 5 lines · Pekka J Enberg

Hi Hans,

Quoted 2 lines · Hans Reiser
Quoted 2 lines

These assertion codes are meaningless to the rest of us so please drop them.

Quoted 8 lines
Quoted 2 lines

I think you don't appreciate the role of assertions in making code easier to audit and debug.

I did not say you should drop the assertions. I referred to the "nikita-955" part which is redundant and pointless. Using __FILE__:__LINE__ (or BUG_ON even) will give you enough information to identify where the error occured.

but then it does not tell me who I assign the bug to.

Quoted 3 lines

Because Reiser4 hitting an error condition and restarting the machine silently is silly. Just do panic() there.

Well, it seems we agreed and did not realize it. Oh well. The silent restart seems like a silly option to have available. If someone can think of a case where it is useful, let me know, otherwise vs please remove it.

#16 lore raw
In reply to Hans Reiser

Hello

Quoted 14 lines · Hans Reiser
Quoted 12 lines · Pekka Enberg
Quoted 12 lines
fs/reiser4/pool.c new file +9 -0
+/* initialise new pool */
+reiser4_internal void
+reiser4_init_pool(reiser4_pool * pool /* pool to initialise */ ,
+		  size_t obj_size /* size of objects in @pool */ ,
+		  int num_of_objs /* number of preallocated objects */ ,
+		  char *data /* area for preallocated objects */ )
+{
+	reiser4_pool_header *h;
+	int i;
Quoted 8 lines
Quoted 8 lines

fs/reiser4/pool.c

Quoted 4 lines
fs/reiser4/pool.c new file +2 -0
+
+	assert("nikita-955", pool != NULL);

These assertion codes are meaningless to the rest of us so please drop them.

Pekka, am I correct that you object aginst assertion ids like "joe-700"?

Quoted 10 lines
Quoted 10 lines

fs/reiser4/type_safe_hash.h line 5

Quoted 8 lines
fs/reiser4/type_safe_hash.h new file +5 -0
@@ -0,0 +1,320 @@
+/* Copyright 2001, 2002, 2003 by Hans Reiser, licensing governed by
+ * reiser4/README */
+
+/* A hash table class that uses hash chains (singly-linked) and is
+   parametrized to provide type safety.  */

This belongs to include/linux, not reiser4.

ok.

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
fs/reiser4/type_safe_list.h new file +4 -0
@@ -0,0 +1,436 @@
+/* Copyright 2001, 2002, 2003 by Hans Reiser, licensing governed by reiser4/README */
+
+#ifndef __REISER4_TYPE_SAFE_LIST_H__
+#define __REISER4_TYPE_SAFE_LIST_H__
Quoted 8 lines
Quoted 8 lines

fs/reiser4/type_safe_list.h line 9

Quoted 5 lines
fs/reiser4/type_safe_list.h new file +5 -0
+
+#include "debug.h"
+/* A circular doubly linked list that differs from the previous
+   <linux/list.h> implementation because it is parametrized to provide
+   type safety.  This data structure is also useful as a queue or stack.

This belongs to include/linux, not reiser4.

ok

Quoted 32 lines
Quoted 22 lines
Quoted 22 lines
fs/reiser4/type_safe_list.h new file +22 -0
+/*
+ * Initialization stages for reiser4.
+ *
+ * These enumerate various things that have to be done during reiser4
+ * startup. Initialization code (init_reiser4()) keeps track of what stage was
+ * reached, so that proper undo can be done if error occurs during
+ * initialization.
+ */
+typedef enum {
+	INIT_NONE,               /* nothing is initialized yet */
+	INIT_INODECACHE,         /* inode cache created */
+	INIT_CONTEXT_MGR,        /* list of active contexts created */
+	INIT_ZNODES,             /* znode slab created */
+	INIT_PLUGINS,            /* plugins initialized */
+	INIT_PLUGIN_SET,         /* psets initialized */
+	INIT_TXN,                /* transaction manager initialized */
+	INIT_FAKES,              /* fake inode initialized */
+	INIT_JNODES,             /* jnode slab initialized */
+	INIT_EFLUSH,             /* emergency flush initialized */
+	INIT_FQS,                /* flush queues initialized */
+	INIT_DENTRY_FSDATA,      /* dentry_fsdata slab initialized */
+	INIT_FILE_FSDATA,        /* file_fsdata slab initialized */
Quoted 10 lines

fs/reiser4/type_safe_list.h line 34

Quoted 5 lines
fs/reiser4/type_safe_list.h new file +3 -0
+	INIT_D_CURSOR,           /* d_cursor suport initialized */
+	INIT_FS_REGISTERED,      /* reiser4 file system type registered */
+} reiser4_init_stage;

Please use regular gotos instead. This is a silly hack especially since you don't have release function for all of the stages.

Quoted 2 lines

I'll let vs comment.

IMHO, it is convinient. But lets change it as requested.

Quoted 16 lines
Quoted 16 lines
Quoted 16 lines
fs/reiser4/type_safe_list.h new file +14 -0
+reiser4_internal void reiser4_handle_error(void)
+{
+	struct super_block *sb = reiser4_get_current_sb();
+
+	if ( !sb )
+		return;
+	reiser4_status_write(REISER4_STATUS_DAMAGED, 0, "Filesystem error occured");
+	switch ( get_super_private(sb)->onerror ) {
+	case 0:
+		reiser4_panic("foobar-42", "Filesystem error occured\n");
+	case 1:
+		if ( sb->s_flags & MS_RDONLY )
+			return;
+		sb->s_flags |= MS_RDONLY;
Quoted 8 lines
Quoted 8 lines

fs/reiser4/type_safe_list.h line 51

Quoted 5 lines
fs/reiser4/type_safe_list.h new file +3 -0
+		break;
+	case 2:
+		machine_restart(NULL);

Probably not something you should do at fs level.

ok

Quoted 10 lines
Quoted 10 lines

fs/reiser4/type_safe_list.h line 56

Quoted 7 lines
fs/reiser4/type_safe_list.h new file +5 -0
+
+	/* not yet phash_jnode_destroy(ZJNODE(node)); */
+
+	/* poison memory. */
+	ON_DEBUG(memset(node, 0xde, sizeof *node));

Poisoning belongs to slab, not fs.

ok

Quoted 16 lines
Quoted 16 lines

fs/reiser4/type_safe_list.h line 65

Quoted 13 lines
fs/reiser4/type_safe_list.h new file +9 -0
+/* allocate fresh znode */
+reiser4_internal znode *
+zalloc(int gfp_flag /* allocation flag */ )
+{
+	znode *node;
+
+	node = kmem_cache_alloc(znode_slab, gfp_flag);
+	return node;
+}

Please drop this useless wrapper.

ok

Quoted 58 lines
Quoted 48 lines
Quoted 12 lines
fs/reiser4/type_safe_list.h new file +8 -0
+reiser4_internal void
+znode_remove(znode * node /* znode to remove */ , reiser4_tree * tree)
+{
+	assert("nikita-2108", node != NULL);
+	assert("nikita-470", node->c_count == 0);
+	assert("zam-879", rw_tree_is_write_locked(tree));
+
+	/* remove reference to this znode from cbk cache */

fs/reiser4/type_safe_list.h line 83

Quoted 10 lines
fs/reiser4/type_safe_list.h new file +10 -0
+	cbk_cache_invalidate(node, tree);
+
+	/* update c_count of parent */
+	if (znode_parent(node) != NULL) {
+		assert("nikita-472", znode_parent(node)->c_count > 0);
+		/* father, onto your hands I forward my spirit... */
+		znode_parent(node)->c_count --;
+		node->in_parent.node = NULL;
+	} else {
+		/* orphaned znode?! Root? */

Drop the useless else branch.

Quoted 22 lines
fs/reiser4/debug.c new file +19 -0
@@ -0,0 +1,447 @@
+/* Copyright 2001, 2002, 2003 by Hans Reiser, licensing governed by
+ * reiser4/README */
+
+/* Debugging facilities. */
+
+/*
+ * This file contains generic debugging functions used by reiser4. Roughly
+ * following:
+ *
+ *     panicking: reiser4_do_panic(), reiser4_print_prefix().
+ *
+ *     locking: schedulable(), lock_counters(), print_lock_counters(),
+ *     no_counters_are_held(), commit_check_locks()
+ *
+ *     {debug,trace,log}_flags: reiser4_are_all_debugged(),
+ *     reiser4_is_debugged(), get_current_trace_flags(),
+ *     get_current_log_flags().
+ *
+ *     kmalloc/kfree leak detection: reiser4_kmalloc(), reiser4_kfree(),
Quoted 10 lines

fs/reiser4/debug.c line 20

Quoted 3 lines
fs/reiser4/debug.c new file +1 -0
+ *     reiser4_kfree_in_sb().

Please don't do this! We've had enough trouble trying to get the current subsystem specific allocators out, so do not introduce a new one. If you need memory leak detection, make it generic and submit that. Reiser4, like all other subsystems, should use kmalloc() and friends directly.

Quoted 2 lines

I will let vs comment.

I agree with Pekka.

Quoted 12 lines
Quoted 12 lines

fs/reiser4/debug.h

Quoted 9 lines
fs/reiser4/debug.h new file +3 -0
+
+/*
+ * Error code tracing facility. (Idea is borrowed from XFS code.)

Could this be turned into a generic facility?

I do not think that it will ever become accepted.
To get use of that task_t would have to be extended with fields to store error code, file name and line in it, and several return addresses. Moreover lines like
return -ENOENT;
would have to be replaced with:
return RETERR(-ENOENT);

This is debugging feature, we should probably move it to our internal debugging patch.

Quoted 9 lines
Quoted 9 lines
Quoted 6 lines

+#define reiser4_internal

Please drop the above useless #define.

ok

Quoted 15 lines
Quoted 15 lines

fs/reiser4/init_super.c

Quoted 11 lines
fs/reiser4/init_super.c new file +6 -0
+
+#define _INIT_PARAM_LIST (struct super_block * s, reiser4_context * ctx, void * data, int silent)
+#define _DONE_PARAM_LIST (struct super_block * s)
+
+#define _INIT_(subsys) static int _init_##subsys _INIT_PARAM_LIST
+#define _DONE_(subsys) static void _done_##subsys _DONE_PARAM_LIST

Please remove this macro obfuscation.

Quoted 40 lines

vs, I think he is right, do you?

Quoted 38 lines
Quoted 23 lines
fs/reiser4/init_super.c new file +19 -0
+
+_DONE_EMPTY(exit_context)
+
+struct reiser4_subsys {
+	int  (*init) _INIT_PARAM_LIST;
+	void (*done) _DONE_PARAM_LIST;
+};
+
+#define _SUBSYS(subsys) {.init = &_init_##subsys, .done = &_done_##subsys}
+static struct reiser4_subsys subsys_array[] = {
+	_SUBSYS(mount_flags_check),
+	_SUBSYS(sinfo),
+	_SUBSYS(context),
+	_SUBSYS(parse_options),
+	_SUBSYS(object_ops),
+	_SUBSYS(read_super),
+	_SUBSYS(tree0),
+	_SUBSYS(txnmgr),
+	_SUBSYS(ktxnmgrd_context),

fs/reiser4/init_super.c

Quoted 10 lines
fs/reiser4/init_super.c new file +10 -0
+	_SUBSYS(ktxnmgrd),
+	_SUBSYS(entd),
+	_SUBSYS(formatted_fake),
+	_SUBSYS(disk_format),
+	_SUBSYS(sb_counters),
+	_SUBSYS(d_cursor),
+	_SUBSYS(fs_root),
+	_SUBSYS(safelink),
+	_SUBSYS(exit_context)
+};

The above is overkill and silly. parse_options and read_super, for example, are _not_ a subsystem inits but regular fs ops. Please consider dropping this altogether but at least trim it down to something sane.

Pekka, would you prefer something like:

reiser4_fill_super()

{
    if (init_a() == 0) {
	if (init_b() == 0) {
	    if (init_c() == 0) {
		if (init_last() == 0)
		    return 0;
		else {
		    done_c();
		    done_b();
		    done_a();
		}
	    } else {
		done_b();
		done_a();
	    }
	} else {
	    done_a();
	}
    }
}

With these macros we have reiser4_fill_super to look like the below, and it remains unchanged when something new is added for initilizing on filesystem mounting.

reiser4_fill_super()

{
	for (i = 0; i < REISER4_NR_SUBSYS; i++) {
		ret = subsys_array[i].init(s, &ctx, data, silent);
		if (ret) {
			done_super(s, i - 1);
			return ret;
		}
	}
}
#17 lore raw
Quoted 15 lines · Vladimir Saveliev

Pekka, would you prefer something like:

reiser4_fill_super()

{
    if (init_a() == 0) {
	if (init_b() == 0) {
	    if (init_c() == 0) {
		if (init_last() == 0)
		    return 0;
		else {
		    done_c();
		    done_b();
		    done_a();
		}
	    } else {
Quoted 8 lines
		done_b();
		done_a();
	    }
	} else {
	    done_a();
	}
    }
}

No, I think he means the traditional:

reiser4_fill_super()
{
if (init_a())

     goto failed_a;
   if (init_b())
     goto failed_b;
   if (init_c())
     goto failed_c;
   if (init_last())
     goto failed_last;

return 0;

failed_last:
done_c();
failed_c:
done_b();
failed_b:
done_a();
failed_a:
return 1;
}

#18 lore raw
Quoted 6 lines · Olivier Galibert

No, I think he means the traditional:

reiser4_fill_super()

{
   if (init_a())
     goto failed_a;

.
.
.

IMO this works very well when the initialization always completes or fails totally in a single routine. When your init routine can leave something partially inited, then putting all of the cleanup code in a single function and using the enums eliminates duplicate code and makes things easier to read. (it's a state machine like many device drivers and network stacks).

Also, perhaps a compromise on the asserts at the beggining of functions. If they are moved into a header file, say resier4_contracts.h and replaced with a single macro, you get most of the benefits and elminate most of the clutter. If properly done, there may even be some advantages gained by auto generating the conttact.h file(s) from some sort of formal spec or design doc.

Ross

#19 lore raw
In reply to Vladimir Saveliev
Quoted 37 lines · Vladimir Saveliev
Quoted 37 lines
Quoted 37 lines
Quoted 21 lines
(quoted diff) +15 -0
+/*
+ * Initialization stages for reiser4.
+ *
+ * These enumerate various things that have to be done during reiser4
+ * startup. Initialization code (init_reiser4()) keeps track of what stage was
+ * reached, so that proper undo can be done if error occurs during
+ * initialization.
+ */
+typedef enum {
+	INIT_NONE,               /* nothing is initialized yet */
+	INIT_INODECACHE,         /* inode cache created */
+	INIT_CONTEXT_MGR,        /* list of active contexts created */
+	INIT_ZNODES,             /* znode slab created */
+	INIT_PLUGINS,            /* plugins initialized */
+	INIT_PLUGIN_SET,         /* psets initialized */

Review

Quoted 10 lines
(quoted diff) +10 -0
+	INIT_TXN,                /* transaction manager initialized */
+	INIT_FAKES,              /* fake inode initialized */
+	INIT_JNODES,             /* jnode slab initialized */
+	INIT_EFLUSH,             /* emergency flush initialized */
+	INIT_FQS,                /* flush queues initialized */
+	INIT_DENTRY_FSDATA,      /* dentry_fsdata slab initialized */
+	INIT_FILE_FSDATA,        /* file_fsdata slab initialized */
+	INIT_D_CURSOR,           /* d_cursor suport initialized */
+	INIT_FS_REGISTERED,      /* reiser4 file system type registered */
+} reiser4_init_stage;

Please use regular gotos instead. This is a silly hack especially since you don't have release function for all of the stages.

Quoted 8 lines
Quoted 4 lines

I'll let vs comment.

IMHO, it is convinient. But lets change it as requested.

No, if you like it, say so and it stays.

Quoted 15 lines
Quoted 15 lines
Quoted 15 lines
Quoted 7 lines

+ *
+ * kmalloc/kfree leak detection: reiser4_kmalloc(), reiser4_kfree(),
+ * reiser4_kfree_in_sb().

Please don't do this! We've had enough trouble trying to get the current subsystem specific allocators out, so do not introduce a new one. If you need memory leak detection, make it generic and submit that. Reiser4, like all other subsystems, should use kmalloc() and friends directly.

Quoted 7 lines
Quoted 4 lines

I will let vs comment.

I agree with Pekka.

Ok, can you make it generic easily?

Quoted 131 lines
Quoted 6 lines
Quoted 6 lines
Quoted 13 lines
Quoted 13 lines

fs/reiser4/debug.h

Quoted 9 lines
fs/reiser4/debug.h new file +3 -0
+
+/*
+ * Error code tracing facility. (Idea is borrowed from XFS code.)

Could this be turned into a generic facility?

I do not think that it will ever become accepted.
To get use of that task_t would have to be extended with fields to store error code, file name and line in it, and several return addresses. Moreover lines like
return -ENOENT;
would have to be replaced with:
return RETERR(-ENOENT);

This is debugging feature, we should probably move it to our internal debugging patch.

Quoted 9 lines
Quoted 9 lines
Quoted 9 lines

+#define reiser4_internal

Quoted 4 lines
Quoted 4 lines

Please drop the above useless #define.

ok

Quoted 17 lines
Quoted 5 lines
Quoted 5 lines
fs/reiser4/init_super.c new file +3 -0
+
+#define _INIT_PARAM_LIST (struct super_block * s, reiser4_context * ctx, void * data, int silent)
+#define _DONE_PARAM_LIST (struct super_block * s)
Quoted 12 lines

fs/reiser4/init_super.c

Quoted 7 lines
fs/reiser4/init_super.c new file +3 -0
+
+#define _INIT_(subsys) static int _init_##subsys _INIT_PARAM_LIST
+#define _DONE_(subsys) static void _done_##subsys _DONE_PARAM_LIST

Please remove this macro obfuscation.

Quoted 47 lines

vs, I think he is right, do you?

Quoted 43 lines
Quoted 27 lines
fs/reiser4/init_super.c new file +19 -0
+
+_DONE_EMPTY(exit_context)
+
+struct reiser4_subsys {
+	int  (*init) _INIT_PARAM_LIST;
+	void (*done) _DONE_PARAM_LIST;
+};
+
+#define _SUBSYS(subsys) {.init = &_init_##subsys, .done = &_done_##subsys}
+static struct reiser4_subsys subsys_array[] = {
+	_SUBSYS(mount_flags_check),
+	_SUBSYS(sinfo),
+	_SUBSYS(context),
+	_SUBSYS(parse_options),
+	_SUBSYS(object_ops),
+	_SUBSYS(read_super),
+	_SUBSYS(tree0),
+	_SUBSYS(txnmgr),
+	_SUBSYS(ktxnmgrd_context),

fs/reiser4/init_super.c

Quoted 10 lines
fs/reiser4/init_super.c new file +10 -0
+	_SUBSYS(ktxnmgrd),
+	_SUBSYS(entd),
+	_SUBSYS(formatted_fake),
+	_SUBSYS(disk_format),
+	_SUBSYS(sb_counters),
+	_SUBSYS(d_cursor),
+	_SUBSYS(fs_root),
+	_SUBSYS(safelink),
+	_SUBSYS(exit_context)
+};

The above is overkill and silly. parse_options and read_super, for example, are _not_ a subsystem inits but regular fs ops. Please consider dropping this altogether but at least trim it down to something sane.

Pekka, would you prefer something like:

reiser4_fill_super()

{
   if (init_a() == 0) {
	if (init_b() == 0) {
	    if (init_c() == 0) {
		if (init_last() == 0)
		    return 0;
		else {
		    done_c();
		    done_b();
		    done_a();
		}
	    } else {
Quoted 10 lines
		done_b();
		done_a();
	    }
	} else {
	    done_a();
	}
   }
}

I think the above is easier to read than the below. Macros can obscure sometimes, and one of our weaknesses is a tendency to use macros in such
a way that it frustrates meta-. use in emacs. Nikita did however
mention that there was something that could understand macros when constructing tags files, but I forgot what that was.

Quoted 20 lines

With these macros we have reiser4_fill_super to look like the below, and it remains unchanged when something new is added for initilizing on filesystem mounting.

reiser4_fill_super()

{
	for (i = 0; i < REISER4_NR_SUBSYS; i++) {
		ret = subsys_array[i].init(s, &ctx, data, silent);
		if (ret) {
			done_super(s, i - 1);
			return ret;
		}
	}
}
#20 lore raw

Hans Reiser writes:

[...]

Quoted 5 lines

I think the above is easier to read than the below. Macros can obscure sometimes, and one of our weaknesses is a tendency to use macros in such
a way that it frustrates meta-. use in emacs. Nikita did however
mention that there was something that could understand macros when constructing tags files, but I forgot what that was.

xref.el (http://xref-tech.com/xrefactory/main.html). With it one can type current->[TAB] and it shows fields of struct task_struct in the emacs completion buffer.

Nikita.

#21 lore raw
In reply to Pekka Enberg
Quoted 8 lines · Pekka Enberg
Quoted 8 lines
fs/reiser4/pool.c new file +6 -0
+/* initialise new pool */
+reiser4_internal void
+reiser4_init_pool(reiser4_pool * pool /* pool to initialise */ ,
+		  size_t obj_size /* size of objects in @pool */ ,
+		  int num_of_objs /* number of preallocated objects */ ,
+		  char *data /* area for preallocated objects */ )
Quoted 8 lines

fs/reiser4/pool.c

Quoted 5 lines
fs/reiser4/pool.c new file +5 -0
+{
+	reiser4_pool_header *h;
+	int i;
+
+	assert("nikita-955", pool != NULL);

These assertion codes are meaningless to the rest of us so please drop them.

As someone who spends time debugging reiser3 issues, I've grown accustomed to the named assertions. They make discussing a particular assertion much more natural in conversation than file:line. It also makes difficult to reproduce assertions more trackable over time. The assertion number never changes, but the line number can with even the most trivial of patches.

That said, one of my gripes with the named assertions in reiser3 (and reiser4 now) is that the development staff changes over time. There are many named assertions in reiser3 that refer to developers no longer employed by Hans. The quoted one is a perfect example.

Hans, would it be acceptable to you to keep only numbered assertions and
keep a code responsbility list internal to namesys? It would serve a
dual purpose of keeping the idea of named assertions, but also remove a huge number of strings that bloat the implementation.

-Jeff

Signature · 2 lines
Jeff Mahoney
SuSE Labs
#22 lore raw
Quoted 9 lines · Jeff Mahoney
Quoted 5 lines

Review

Quoted 2 lines
(quoted diff) +1 -0
+	assert("nikita-955", pool != NULL);

These assertion codes are meaningless to the rest of us so please drop them.

As someone who spends time debugging reiser3 issues, I've grown accustomed to the named assertions. They make discussing a particular assertion much more natural in conversation than file:line.

__FUNCTION__?

#23 lore raw
Quoted 11 lines · Andrew Morton
Quoted 8 lines · Jeff Mahoney
Quoted 4 lines

Review

Quoted 1 line
(quoted diff) +1 -0
+	assert("nikita-955", pool != NULL);

These assertion codes are meaningless to the rest of us so please drop them.

As someone who spends time debugging reiser3 issues, I've grown accustomed to the named assertions. They make discussing a particular assertion much more natural in conversation than file:line.

__FUNCTION__?

__FUNCTION__ gives additional context, sure, but it doesn't address one
of the main advantages of numbered assertions: the ability to track the
same assertion across different versions without having to verify that it is indeed the same assertion on every one. The line number can still change very easily, and if there are several assertions in a row, it's not immediately obvious (at a glance) that it is the same assertion. Reiser[34] warnings use the same mechanism.

I do agree that some pain comes with it, you can end up with assertion numbers that are all over the place or you start by spreading them out in a manner we all thought we left behind when we moved beyond BASIC. I'm not totally committed to it, I just wanted to address the assumption that numbered assertions were worthless to the rest of the world.

However, I do want to take a moment to address what I think is a bigger issue in the code. Perhaps it's not enough to be a barrier to inclusion, but since I'm going through the reiser3 code and addressing these now, I thought I'd mention them.

All the assertions (a quick grep through the code shows something like 3800 of them) ultimately result in a reiser4_panic, which BUG()'s. Are *all* of these assertions really worth taking the system down? I think a reiser4_error function that can abort just that filesystem and recover somewhat gracefully would be a bit more in order.

-Jeff

Signature · 2 lines
Jeff Mahoney
SuSE Labs
#24 lore raw
Quoted 7 lines · Jeff Mahoney

All the assertions (a quick grep through the code shows something like 3800 of them) ultimately result in a reiser4_panic, which BUG()'s. Are *all* of these assertions really worth taking the system down? I think a reiser4_error function that can abort just that filesystem and recover somewhat gracefully would be a bit more in order.

A good point. Thanks for it.

#25 lore raw
In reply to Andrew Morton
Quoted 7 lines · Andrew Morton
Quoted 6 lines · Jeff Mahoney
Quoted 5 lines

Review

Quoted 2 lines
(quoted diff) +1 -0
+	assert("nikita-955", pool != NULL);

These assertion codes are meaningless to the rest of us so please drop them.

Quoted 5 lines
Quoted 3 lines

As someone who spends time debugging reiser3 issues, I've grown accustomed to the named assertions. They make discussing a particular assertion much more natural in conversation than file:line.

__FUNCTION__?

Doesn't help a lot. I've also been annoyed several times in the past when having to lookup a BUG() for a kernel source I don't exactly have at hand right then and there. If you have constructs ala

function()

{
        if (cond_a)
                BUG();
        if (cond_b)
                BUG();
        if (cond_c)
                BUG();

        do_stuff...
}

then it's impossible to know which one it is without the identical source at hand.

That said, I don't like the reiser name-number style. If you must do something like this, mark responsibility by using a named identifier covering the layer in question instead.

        assert("trace_hash-89", is_hashed(foo) != 0);

or whatever.

Signature · 1 line
Jens Axboe
#26 lore raw

Hi,

Quoted 2 lines · Jens Axboe

then it's impossible to know which one it is without the identical source at hand.

In which case, debugging is risky IMO (the source code could have changed a lot).

Quoted 5 lines · Jens Axboe

That said, I don't like the reiser name-number style. If you must do something like this, mark responsibility by using a named identifier covering the layer in question instead.

        assert("trace_hash-89", is_hashed(foo) != 0);

A human readable message would be nicer. For example, "foo was hashed".

Pekka

#27 lore raw
Quoted 5 lines · Pekka Enberg

On Thu, 2005-06-23 at 21:32 +0200, Jens Axboe wrote:

Quoted 7 lines
Quoted 7 lines

That said, I don't like the reiser name-number style. If you must do something like this, mark responsibility by using a named identifier covering the layer in question instead.

       assert("trace_hash-89", is_hashed(foo) != 0);

Lots of people like corporate anonymity. Some don't. I don't. I like knowing who wrote what. It helps me know who to pay how much. It helps
me know who to forward the bug report to. Losing your anonymity
exposes you, mostly for better since more communication is on balance a good thing, but the fear is there for some. I don't think we can agree on this, it is an issue of the soul.

#28 lore raw
Quoted 9 lines · Hans Reiser
Quoted 3 lines
Quoted 3 lines
       assert("trace_hash-89", is_hashed(foo) != 0);

Lots of people like corporate anonymity. Some don't. I don't. I like knowing who wrote what. It helps me know who to pay how much. It helps
me know who to forward the bug report to. Losing your anonymity
exposes you, mostly for better since more communication is on balance a good thing, but the fear is there for some. I don't think we can agree on this, it is an issue of the soul.

Fallacy.

The assert doesn't tell you who is at fault; it tells you who placed the assert which triggered; it could have triggered due to bugs caused by anyone, including the propietary binary-only module from Nvidia which the user loaded into his system....

- Ted

#29 lore raw
Quoted 16 lines · Theodore Ts'o
Quoted 4 lines · Hans Reiser
Quoted 4 lines
Quoted 4 lines
      assert("trace_hash-89", is_hashed(foo) != 0);
Quoted 8 lines

Lots of people like corporate anonymity. Some don't. I don't. I like knowing who wrote what. It helps me know who to pay how much. It helps
me know who to forward the bug report to. Losing your anonymity
exposes you, mostly for better since more communication is on balance a good thing, but the fear is there for some. I don't think we can agree on this, it is an issue of the soul.

Quoted 12 lines

Fallacy.

The assert doesn't tell you who is at fault; it tells you who placed the assert which triggered; it could have triggered due to bugs caused by anyone, including the propietary binary-only module from Nvidia which the user loaded into his system....

- Ted

If you read the thread again carefully, you will see that I already said that it doesn't tell you who is at fault for the bug. Furthermore, I said that the basis of the resistance of some developers to the use of this is that they are not fully convinced that others understand that it identifies only the assertion writer not the bug writer. As the boss of the guys writing these assertions, I see no reason to indulge baseless fears. When guys become experienced members of our team, they lose this fear. Sending the bug report to the assertion writer often works nicely as a first step, in my project, in my experience, in the cases where I don't know anything about the likely implications of the assertion myself.

#30 lore raw
In reply to Hans Reiser
Quoted 4 lines · Hans Reiser
Quoted 1 line
Quoted 1 line

assert("trace_hash-89", is_hashed(foo) != 0);

Lots of people like corporate anonymity. Some don't. I don't. I like knowing who wrote what. ...

For what it's worth (I know: not much), I like the named asserts in Reiser4/Reiserfs. Although I haven't been bitten by any BUGs yet (maybe I'm just lucky), whenever I see these on the mailing list, it gives the impression that the users are interacting more directly with the developers, and it helps us to get to know the developers better.

If people really want more standard-looking identifiers, I think Namesys should keep the names and make a hybrid identifier, like "nikita-123(<file>:<line>)"

Signature · 4 lines
Hubert Chan <[email protected]> - http://www.uhoreg.ca/
PGP/GnuPG key: 1024D/124B61FA
Fingerprint: 96C5 012F 5F74 A5F7 1FF7  5291 AF29 C719 124B 61FA
Key available at wwwkeys.pgp.net.   Encrypted e-mail preferred.
#31 lore raw
Quoted 13 lines · Hubert Chan
Quoted 4 lines · Hans Reiser
Quoted 1 line
Quoted 1 line

assert("trace_hash-89", is_hashed(foo) != 0);

Lots of people like corporate anonymity. Some don't. I don't. I like knowing who wrote what. ...

For what it's worth (I know: not much), I like the named asserts in Reiser4/Reiserfs. Although I haven't been bitten by any BUGs yet (maybe I'm just lucky), whenever I see these on the mailing list, it gives the impression that the users are interacting more directly with the developers, and it helps us to get to know the developers better.

Quoted 3 lines

If people really want more standard-looking identifiers, I think Namesys should keep the names and make a hybrid identifier, like "nikita-123(<file>:<line>)"

This already happens: together with <uid>-<serial>, reiser4 outputs __FILE__, __LINE__, __FUNCTION__, and a bunch of other stuff:

----------------------------------------------------------------------
reiser4[xine(11262)]: txn_end (fs/reiser4/txnmgr.c:504)[nominaodiosasunt-2967]:
code: -2 at fs/reiser4/search.c:1285
reiser4 panicked cowardly: assertion failed: lock_stack_isclean(get_current_lock_stack())
----------------------------------------------------------------------

Nikita.

#32 lore raw
In reply to Pekka Enberg
Quoted 8 lines · Pekka Enberg

Hi,

Quoted 2 lines · Jens Axboe

then it's impossible to know which one it is without the identical source at hand.

In which case, debugging is risky IMO (the source code could have changed a lot).

That's not an argument, there are plenty of cases where knowing which BUG() triggered provides ample clue to at least start thinking about possible issues.

Quoted 8 lines · Jens Axboe
Quoted 5 lines

That said, I don't like the reiser name-number style. If you must do something like this, mark responsibility by using a named identifier covering the layer in question instead.

        assert("trace_hash-89", is_hashed(foo) != 0);

A human readable message would be nicer. For example, "foo was hashed".

Indeed.

Signature · 1 line
Jens Axboe
author
#33 lore raw
Quoted 10 lines
Quoted 8 lines · Jens Axboe
Quoted 5 lines

That said, I don't like the reiser name-number style. If you must do something like this, mark responsibility by using a named identifier covering the layer in question instead.

        assert("trace_hash-89", is_hashed(foo) != 0);

A human readable message would be nicer. For example, "foo was hashed".

Indeed.

You can just dump the expression (with #argument). That is what traditional userspace assert did forever.

It won't help for BUG_ON(a || b || c || d || e) but these are bad style anyways and should be avoided.

-Andi

#34 lore raw
Quoted 5 lines · Andi Kleen

You can just dump the expression (with #argument). That is what traditional userspace assert did forever.

It won't help for BUG_ON(a || b || c || d || e) but these are bad style anyways and should be avoided.

Sounds good to me. Jens, would this work for you?

Pekka

Show BUG_ON expression when assertion fails.

---

 bug.h |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletion(-)
include/asm-generic/bug.h +6 -1
Index: 2.6/include/asm-generic/bug.h
===================================================================
@@ -13,7 +13,12 @@
 #endif
 
 #ifndef HAVE_ARCH_BUG_ON
-#define BUG_ON(condition) do { if (unlikely((condition)!=0)) BUG(); } while(0)
+#define BUG_ON(condition) do { \
+	if (unlikely((condition) != 0)) { \
+		printk("kernel BUG '%s' at %s:%d!\n", #condition, __FILE__, __LINE__); \
+		panic("BUG!"); \
+	} \
+} while(0)
 #endif
 
 #ifndef HAVE_ARCH_WARN_ON
#35 lore raw

include/asm-generic/bug.h line 22

Quoted 10 lines · Pekka J Enberg

#ifndef HAVE_ARCH_BUG_ON

include/asm-generic/bug.h +6 -1
-#define BUG_ON(condition) do { if (unlikely((condition)!=0)) BUG(); } while(0)
+#define BUG_ON(condition) do { \
+	if (unlikely((condition) != 0)) { \
+		printk("kernel BUG '%s' at %s:%d!\n", #condition, __FILE__, __LINE__); \
+		panic("BUG!"); \
+	} \
+} while(0)
 #endif

o How about those architectures, where BUG() and panic() are not the same thing?
o Embedded people might prefer not to have the additional string constants in the kernel. Some config option would ease their wrath. And no, not all embedded people #define BUG() to nothing.

Jörn

Signature · 2 lines
Happiness isn't having what you want, it's wanting what you have.
-- unknown
author
#36 lore raw
In reply to Pekka J Enberg
Quoted 8 lines · Pekka J Enberg
Quoted 5 lines · Andi Kleen

You can just dump the expression (with #argument). That is what traditional userspace assert did forever.

It won't help for BUG_ON(a || b || c || d || e) but these are bad style anyways and should be avoided.

Sounds good to me. Jens, would this work for you?

It won't work for me because it'll bloat the kernel .text considerable. There is a reason why BUG is implemented like it is. Compare it.

-Andi

#37 lore raw

PATCH 1/1 verbose BUG_ON reporting

Quoted 3 lines · Andi Kleen

It won't work for me because it'll bloat the kernel .text considerable. There is a reason why BUG is implemented like it is. Compare it.

The assertion codes bloat the kernel all the same. So how about this instead?

This patch adds a CONFIG_DEBUG_BUG_ON_VERBOSE that makes BUG_ON report the evaluated expression in human readable form when the assertion fails.

The size of vmlinux with allyesconfig increases about 100k when the config option is enabled:

text data bss dec filename
19333351 6699691 1845604 27878646 vmlinux-2.6.12-git8 19434139 6699691 1845604 27979434 vmlinux-2.6.12-git8-verbose-bug_on

---

 include/asm-generic/bug.h |   11 ++++++++++-
 lib/Kconfig.debug         |    7 +++++++
 2 files changed, 17 insertions(+), 1 deletion(-)
include/asm-generic/bug.h +10 -1
Index: 2.6/include/asm-generic/bug.h
===================================================================
@@ -12,8 +12,17 @@
 } while (0)
 #endif
 
+#ifdef CONFIG_DEBUG_BUG_ON_VERBOSE
+#define FAIL_BUG_ON(expr_str) do { \
+	printk("BUG_ON(%s) failed.\n", expr_str); \
+	BUG(); \
+} while (0)
+#else
+#define FAIL_BUG_ON(expr_str) BUG()
+#endif
+
 #ifndef HAVE_ARCH_BUG_ON
-#define BUG_ON(condition) do { if (unlikely((condition)!=0)) BUG(); } while(0)
+#define BUG_ON(condition) do { if (unlikely((condition)!=0)) FAIL_BUG_ON(#condition); } while(0)
 #endif
 
 #ifndef HAVE_ARCH_WARN_ON
lib/Kconfig.debug +7 -0
Index: 2.6/lib/Kconfig.debug
===================================================================
@@ -116,6 +116,13 @@ config DEBUG_BUGVERBOSE
 	  of the BUG call as well as the EIP and oops trace.  This aids
 	  debugging but costs about 70-100K of memory.
 
+config DEBUG_BUG_ON_VERBOSE
+	bool "Verbose BUG_ON() reporting"
+	depends on DEBUG_KERNEL && BUG
+	default false
+	help
+	  Say Y here to make BUG_ON() panics output the evaluated expression.
+
 config DEBUG_INFO
 	bool "Compile the kernel with debug info"
 	depends on DEBUG_KERNEL
author
#38 lore raw

Re: [PATCH] verbose BUG_ON reporting

Quoted 7 lines · Pekka J Enberg
Quoted 3 lines · Andi Kleen

It won't work for me because it'll bloat the kernel .text considerable. There is a reason why BUG is implemented like it is. Compare it.

The assertion codes bloat the kernel all the same. So how about this instead?

It's still useless - it is too bloated to turn on by default and then if you need it you still won't have it. And when you explicitely turn it on then you likely don't need it because you control the source.

-Andi

#39 lore raw

Re: verbose BUG_ON reporting

Quoted 4 lines · Andi Kleen

It's still useless - it is too bloated to turn on by default and then if you need it you still won't have it. And when you explicitely turn it on then you likely don't need it because you control the source.

Hmm. Would a BUG_ON_WITH_TEXT be a better solution? The home-grown assert macro in reiser4 can't be a long-term solution if people really want this kind of functionality. Btw, the bloat argument applies to assertion codes too.

Pekka

#40 lore raw

Re: [PATCH] verbose BUG_ON reporting

In reply to Pekka J Enberg
Quoted 7 lines · Pekka J Enberg
Quoted 3 lines · Andi Kleen

It won't work for me because it'll bloat the kernel .text considerable. There is a reason why BUG is implemented like it is. Compare it.

The assertion codes bloat the kernel all the same. So how about this instead?

Removes my objections. I still wouldn't want to enable the config option, but maybe others do.

Jörn

Signature · 2 lines
A surrounded army must be given a way out.
-- Sun Tzu
#41 lore raw
In reply to Jeff Mahoney
Quoted 30 lines · Jeff Mahoney
Quoted 9 lines · Pekka Enberg
Quoted 9 lines
fs/reiser4/pool.c new file +7 -0
+/* initialise new pool */
+reiser4_internal void
+reiser4_init_pool(reiser4_pool * pool /* pool to initialise */ ,
+		  size_t obj_size /* size of objects in @pool */ ,
+		  int num_of_objs /* number of preallocated objects */ ,
+		  char *data /* area for preallocated objects */ )
+{
Quoted 10 lines

fs/reiser4/pool.c

Quoted 6 lines
fs/reiser4/pool.c new file +4 -0
+	reiser4_pool_header *h;
+	int i;
+
+	assert("nikita-955", pool != NULL);

These assertion codes are meaningless to the rest of us so please drop them.

As someone who spends time debugging reiser3 issues, I've grown accustomed to the named assertions. They make discussing a particular assertion much more natural in conversation than file:line. It also makes difficult to reproduce assertions more trackable over time. The assertion number never changes, but the line number can with even the most trivial of patches.

Quoted 6 lines

That said, one of my gripes with the named assertions in reiser3 (and reiser4 now) is that the development staff changes over time. There are many named assertions in reiser3 that refer to developers no longer employed by Hans. The quoted one is a perfect example.

Yes, but when I get stuck I still send him an email and he still sends me an answer. He is a nice guy even if he can't stand working for me....

Quoted 3 lines

Hans, would it be acceptable to you to keep only numbered assertions and keep a code responsbility list internal to namesys?

No effort to document who is the current maintainer of a section of our code (and thus presumed to be able to figure something nonobvious about it out) has ever worked as well as these named assertions.

Efforts to put at the top of files who worked on what part of it always get miserably out of date, and people are always too shy to update them for valid social reasons.

Internal lists are not the open source way.

The reason some developers hate these named assertions is because they are afraid that it makes them famous for their bugs, when actually it does not. Assertions hit are not equal to bugs authored, and users understand that better than those developers think. Writing an assertion means you can understand a bug, not that you created it. The real effect of your name being on many assertions is that people know you contributed a lot.

It is not necessary for Namesys to be an opaque corporation with no faces on its surface. My name is on the filesystem, every bit of credit I can give to the others I owe them many times over.

#42 lore raw
In reply to Jeff Mahoney
Quoted 6 lines · Jeff Mahoney

As someone who spends time debugging reiser3 issues, I've grown accustomed to the named assertions. They make discussing a particular assertion much more natural in conversation than file:line. It also makes difficult to reproduce assertions more trackable over time. The assertion number never changes, but the line number can with even the most trivial of patches.

How about something of the form "nikita-955(file:line)"? Or the
reverse: "file:line(nikita-955)". Would that keep everyone happy?

Signature · 4 lines
Hubert Chan <[email protected]> - http://www.uhoreg.ca/
PGP/GnuPG key: 1024D/124B61FA
Fingerprint: 96C5 012F 5F74 A5F7 1FF7  5291 AF29 C719 124B 61FA
Key available at wwwkeys.pgp.net.   Encrypted e-mail preferred.
#43 lore raw
Quoted 3 lines · Hubert Chan

How about something of the form "nikita-955(file:line)"? Or the
reverse: "file:line(nikita-955)". Would that keep everyone happy?

Damn, I was wondering how long it would take until someone would come up with a compromise solution ; ) Compromises everywhere will lead to nowhere, I've learned that the hard way. But this is really not a major issue, so let's not make a showstopper out of this one and the likes.

For what I know about the whole inclusion discussion until now, there's been a whole lot of flamewar chickenshit so far. Considering that I have no FS developing abilities whatsoever, I'm pretty pissed at people who do know better in their field and should know better than waste their time on discussions other than constructive ones.

Get the personal bullshit out of the way, everyone, please! Get in touch and work out your differences in a productive manner. If every interesting yet at first intrusive extension to the kernel causes as much kindergarten as this one, where will we end up? Stagnation sucks, yet good progress is sometimes slow-paced...

Peace, everyone!
Chris
(hardcore, not hippie)

#44 lore raw
Quoted 5 lines · Christian Trefzer
Quoted 3 lines · Hubert Chan

How about something of the form "nikita-955(file:line)"? Or the
reverse: "file:line(nikita-955)". Would that keep everyone happy?

Makes me happy.....

#45 lore raw
Quoted 12 lines · Hans Reiser
Quoted 6 lines · Christian Trefzer
Quoted 3 lines · Hubert Chan

How about something of the form "nikita-955(file:line)"? Or the
reverse: "file:line(nikita-955)". Would that keep everyone happy?

Makes me happy.....

Nice, how about the others?

Hey, if we need some objective and neutral mediators on lkml, I'd be glad to give my reading frenzies a meaning : )

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

author
#51 lore raw

Re: reiser4 plugins

First Hans let me remind you that this discussion is not XFS vs reiser4. Christoph does a lot of reviewing and your child definitely is in serious need of that to be mergeable. I'm sure Christoph is able to review inpartially even when he is involved with other FS.

Quoted 9 lines · Jeff Garzik

You're basically implementing another VFS layer inside of reiser4, which is a big layering violation.

This sort of feature should -not- be done at the low-level filesystem level.

What happens if people decide plugins are a good idea, and they want them in ext3? We need massive surgery to extract the guts from reiser4.

We already kind of have them, there are toolkits to do stackable FS with the existing VFS.

However I suspect Hans is unwilling to redo his file system in this point. While it looks quite unnecessary there might be other areas which deserve more attention. In general all the code needs review, even if it is not as controversal as the reinvented VFS.

-Andi

#52 lore raw

Re: reiser4 plugins

Quoted 2 lines · Andi Kleen

Christoph does a lot of reviewing

and he is notorious for making needed linux contributors go away and not come back, and I won't say which famous person on this mailing list told me that....

Quoted 5 lines

and your child definitely
is in serious need of that to be mergeable. I'm sure Christoph is able to review inpartially even when he is involved with other FS.

As impartial as a puppy on PCP....

Christoph is aggressive about things he does not take the time to
understand or ask about first. I hate that. I wish he would go away
please. He is not exactly an Ousterhout, Rob Pike, Granger, Mazieres, Frans Kaashoek, etc., in his accomplishments, so why is he reviewing other people's filesystems? Reviews are great, how about finding persons who have created filesystem innovations (and thus are less likely to reject innovations without understanding them) to do them?

How about review by benchmark instead?

It works, it runs faster than the competition, users like it, we addressed the core kernel patch complaints, it should go in and receive the exposure that will result in lots of useful improvements and
suggestions. It seems like we are getting an unusual review process.

I used a bunch of algorithms for which there was a consensus among those consulted that the algorithms were a bad idea, only the fact that I paid for the code to be written and required that it be done my way (ignoring the "you just use me as a typewriter" remarks as best I could) caused the algorithms to get implemented at all, and the benchmarks then proved the algorithms were a good idea. V3 performance sucks in major part
because I listened to the consensus when I knew better. I don't really
care for consensus on my FS anymore. If you guys want to understand
what I am doing I am happy to talk about it extensively, but please don't require that I groupthink. I frankly think that with my benchmarks, I should be allowed to tinker on my own.

Hans The Mad

#53 lore raw

Re: reiser4 plugins

Quoted 5 lines · Hans Reiser
Quoted 3 lines · Andi Kleen

and your child definitely
is in serious need of that to be mergeable. I'm sure Christoph is able to review inpartially even when he is involved with other FS.

As impartial as a puppy on PCP....

So where else are you planning to get a competent reviewer who is fluent in the internals of filesystems? Good reviewers don't grow on trees, and in order to be able to understand filesystem issues, one must generally have worked with them before... Besides, what good is insulting others going to do?

Quoted 2 lines

Christoph is aggressive about things he does not take the time to understand or ask about first.

[rant snipped]

From my objective re-reading of his posts, I can see that he is critical of things that are difficult to understand not just to be critical, but to provoke additional thought over those portions of the code. In many cases this leads to better abstractions and simpler code than otherwise.

Quoted 1 line

How about review by benchmark instead?

/dev/sda is a great filesystem with awesome benchmarks, assuming one only needs to store a single file. Besides, benchmarks aren't the only thing important about code. If the interface consists of:

void clear_current_filename(void);
void add_char_to_current_filename(char x);
void read_bytes_from_current_file(char *byte, unsigned long size); void write_bytes_to_current_file(const char *byte, unsigned long
size);

then this is clearly not a good API, regardless of how well or poorly it may perform.

Quoted 4 lines

It works, it runs faster than the competition, users like it, we addressed the core kernel patch complaints, it should go in and receive the exposure that will result in lots of useful improvements and
suggestions. It seems like we are getting an unusual review process.

If you look over other patches in -mm, you will see that your review process is not unusual, especially given the number of concerns that other developers have raised over Reiser4.

[irrelevant algorithm rant snipped]

Quoted 4 lines

If you guys want to understand
what I am doing I am happy to talk about it extensively, but please don't require that I groupthink. I frankly think that with my benchmarks, I should be allowed to tinker on my own.

Yes, you can tinker on your own all you want. Another project that has taken that route is GrSecurity, which was alive and well last I checked.

If you don't like others criticisms, take up your marbles and go home, just don't expect them to accept your work when you've not fixed it to community standards.

Cheers,
Kyle Moffett

--
Somone asked my why I work on this free (http://www.fsf.org/philosophy/)
software stuff and not get a real job. Charles Shultz had the best answer:

"Why do musicians compose symphonies and poets write poems? They do it because life wouldn't have any meaning for them if they didn't. That's why I draw cartoons. It's my life."
-- Charles Shultz

#54 lore raw

Re: reiser4 plugins

In reply to Hans Reiser
Quoted 15 lines · Hans Reiser
Quoted 2 lines · Andi Kleen

Christoph does a lot of reviewing

and he is notorious for making needed linux contributors go away and not come back, and I won't say which famous person on this mailing list told me that....

Quoted 5 lines

and your child definitely
is in serious need of that to be mergeable. I'm sure Christoph is able to review inpartially even when he is involved with other FS.

As impartial as a puppy on PCP....

Quoted 7 lines

Christoph is aggressive about things he does not take the time to
understand or ask about first. I hate that. I wish he would go away
please. He is not exactly an Ousterhout, Rob Pike, Granger, Mazieres, Frans Kaashoek, etc., in his accomplishments, so why is he reviewing other people's filesystems? Reviews are great, how about finding persons who have created filesystem innovations (and thus are less likely to reject innovations without understanding them) to do them?

Well, because of his classy hair-style of course.

Seriously, Linux is not managed by a committee. There is nobody to appoint Official File System Reviewers of Her Majesty. Everything here (including your credentials as a file system designer) is self-proclaimed.

Quoted 2 lines

How about review by benchmark instead?

[...]

Quoted 2 lines

I frankly think that with my
benchmarks, I should be allowed to tinker on my own.

I am afraid it will sound picky, but 10 month ago you said you are planning to replace benchmarks on the namesys.com with fairer ones:

http://marc.theaimsgroup.com/?l=reiserfs&m=109368686019301&w=2

Last time I checked, http://namesys.com/benchmarks.html still features only mongo runs with overwrite/modify phases off and with all operations done in readdir order (most favorable mode for reiser4).

Quoted 3 lines

Hans The Mad

Nikita.