Skip to contentSkip to conversation

a fix of logging return value.

PATCH New Wengang Wang 4 participants 7 messages Jul 10, 2009 OCFS2

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 a fix of logging return value.

in ocfs2_file_aio_write(), log_exit() could don't log the value
which is really returned. this patch fixes it.

---
 fs/ocfs2/file.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
fs/ocfs2/file.c +3 -1
index 62442e4..a49fa44 100644
@@ -1918,8 +1918,10 @@ out_sems:
 
 	mutex_unlock(&inode->i_mutex);
 
+	if (written)
+		ret = written;
 	mlog_exit(ret);
-	return written ? written : ret;
+	return ret;
 }
 
 static int ocfs2_splice_to_file(struct pipe_inode_info *pipe,
Signature · 1 line
1.6.2.5
#1 lore raw

PATCH 1/1 a fix of logging return value.

sob

Hi Wengang, functions is aops.c are missing mlogs. Do you have the bandwidth to help out?

Quoted 32 lines · Wengang Wang

in ocfs2_file_aio_write(), log_exit() could don't log the value
which is really returned. this patch fixes it.

---
fs/ocfs2/file.c | 4 +++-

1 files changed, 3 insertions(+), 1 deletions(-)
fs/ocfs2/file.c +3 -1
index 62442e4..a49fa44 100644
@@ -1918,8 +1918,10 @@ out_sems:
 
   mutex_unlock(&inode->i_mutex);
 
+    if (written)
+        ret = written;
   mlog_exit(ret);
-    return written ? written : ret;
+    return ret;
 }
 
 static int ocfs2_splice_to_file(struct pipe_inode_info *pipe,
Signature · 7 lines
1.6.2.5


_______________________________________________
Ocfs2-devel mailing list
Ocfs2-devel at oss.oracle.com
http://oss.oracle.com/mailman/listinfo/ocfs2-devel
#2 lore raw

PATCH 1/1 a fix of logging return value.

Hi Sunil,

Ok. I will post patche(s) for it later.

regards,
wengang.

Quoted 34 lines · Sunil Mushran

sob

Hi Wengang, functions is aops.c are missing mlogs. Do you have the bandwidth to help out?

Quoted 27 lines · Wengang Wang

in ocfs2_file_aio_write(), log_exit() could don't log the value
which is really returned. this patch fixes it.

---
fs/ocfs2/file.c | 4 +++-

1 files changed, 3 insertions(+), 1 deletions(-)
fs/ocfs2/file.c +3 -1
index 62442e4..a49fa44 100644
@@ -1918,8 +1918,10 @@ out_sems:
 
   mutex_unlock(&inode->i_mutex);
 
+    if (written)
+        ret = written;
   mlog_exit(ret);
-    return written ? written : ret;
+    return ret;
 }
 
 static int ocfs2_splice_to_file(struct pipe_inode_info *pipe,
Signature · 1 line
1.6.2.5
#3 lore raw

PATCH 1/1 a fix of logging return value.

Sunil,

in the src, I see both mlog(ML_ERROR...)(finally printk(KERN_ERR...)) and ocfs2_error()(finally printk(KERN_CRIT...).
could you tell me in what case one should be used?

regards,
wengang.

Quoted 48 lines · Wengang Wang

Hi Sunil,

Ok. I will post patche(s) for it later.

regards,
wengang.

Quoted 30 lines · Sunil Mushran

sob

Hi Wengang, functions is aops.c are missing mlogs. Do you have the bandwidth to help out?

Quoted 23 lines · Wengang Wang

in ocfs2_file_aio_write(), log_exit() could don't log the value
which is really returned. this patch fixes it.

---
fs/ocfs2/file.c | 4 +++-

1 files changed, 3 insertions(+), 1 deletions(-)
fs/ocfs2/file.c +3 -1
index 62442e4..a49fa44 100644
@@ -1918,8 +1918,10 @@ out_sems:
 
   mutex_unlock(&inode->i_mutex);
 
+    if (written)
+        ret = written;
   mlog_exit(ret);
-    return written ? written : ret;
+    return ret;
 }
 
Quoted 4 lines
Quoted 4 lines
fs/ocfs2/file.c +0 -0
 static int ocfs2_splice_to_file(struct pipe_inode_info *pipe,
Signature · 1 line
1.6.2.5

_______________________________________________
Ocfs2-devel mailing list
Ocfs2-devel at oss.oracle.com
http://oss.oracle.com/mailman/listinfo/ocfs2-devel

Signature · 1 line
--just begin to learn, you are never too late...
#4 lore raw

PATCH 1/1 a fix of logging return value.

Hi wengang,

Quoted 5 lines · Wengang Wang

Sunil,

in the src, I see both mlog(ML_ERROR...)(finally printk(KERN_ERR...)) and ocfs2_error()(finally printk(KERN_CRIT...).
could you tell me in what case one should be used?

mlog(ML_ERROR...) only print errors. But ocfs2_error does other things, sometimes make the volume readonly. Please check ocfs2_handle_error for details.

Regards,
Tao

Quoted 53 lines

regards,
wengang.

Quoted 47 lines · Wengang Wang

Hi Sunil,

Ok. I will post patche(s) for it later.

regards,
wengang.

Quoted 30 lines · Sunil Mushran

sob

Hi Wengang, functions is aops.c are missing mlogs. Do you have the bandwidth to help out?

Quoted 23 lines · Wengang Wang

in ocfs2_file_aio_write(), log_exit() could don't log the value
which is really returned. this patch fixes it.

---
fs/ocfs2/file.c | 4 +++-

1 files changed, 3 insertions(+), 1 deletions(-)
fs/ocfs2/file.c +3 -1
index 62442e4..a49fa44 100644
@@ -1918,8 +1918,10 @@ out_sems:
 
   mutex_unlock(&inode->i_mutex);
 
+    if (written)
+        ret = written;
   mlog_exit(ret);
-    return written ? written : ret;
+    return ret;
 }
 
Quoted 4 lines
Quoted 4 lines
fs/ocfs2/file.c +0 -0
 static int ocfs2_splice_to_file(struct pipe_inode_info *pipe,
Signature · 1 line
1.6.2.5

_______________________________________________
Ocfs2-devel mailing list
Ocfs2-devel at oss.oracle.com
http://oss.oracle.com/mailman/listinfo/ocfs2-devel

#5 lore raw

PATCH 1/1 a fix of logging return value.

Quoted 12 lines · Tao Ma

Hi wengang,

Quoted 5 lines · Wengang Wang

Sunil,

in the src, I see both mlog(ML_ERROR...)(finally printk(KERN_ERR...)) and ocfs2_error()(finally printk(KERN_CRIT...).
could you tell me in what case one should be used?

mlog(ML_ERROR...) only print errors. But ocfs2_error does other things, sometimes make the volume readonly. Please check ocfs2_handle_error for details.

Yes. ocfs2_error() is only called when an ondisk structure read reveals a corrupted block. Depending on the mount option, it either panics or remounts ro.

printk(KERN_ERR) is only called if we need to print messages before mlog_sys_init() is called. So you'll see those printks during module loads.

There are few instances of printk(KERN_CRIT). We call them because mlog does not handle such messages. We could add it. But there are only 3 instances of this message. So why bother.

The mlogs that you can use are:

mlog_errno() Error if the only information is ret/status.

mlog(ML_ERROR, ...) Error with vararg.

mlog(ML_NOTICE, ...) Notice with vararg. Use very very selectively as NOTICE is enabled by default.

mlog(0, ...) Like notice but is printed only when the user enables the mask bit.
Use liberally.

mlog_entry() Entry with varargs. Use carefully. We don't want mlog to dereference
null pointers. ;)

mlog_entry_void() Entry with no args. Preferably use mlog(0) somewhere in the
middle of the function with usable information.

mlog_exit() All mlog_entry*() should have an exit. mlog_exit_ptr()
mlog_exit_void()

We use mlog() to narrow down the scope of an error. Say a read is returning EIO or EINVAL. By enabling tracing selectively, we can get more information.

However, too much tracing is counterproductive because not only is it hard to wade thru the logs, the printk ring buffer loses a lot of messages. So, when you add, think whether it will be useful. This is subjective of course.

An easy example would be function ocfs2_unlock_and_free_pages(). It does what it says. Now we could add an entry and an exit trace. But the exit is clearly useless because it does not return any information. So a better solution could be to have a mlog(0, ...).

mlog(0, "num_pages = %d\n", num_pages);

Do not forget the trailing newline.

Thanks for taking on this task.
Sunil

#6 lore raw

PATCH 1/1 a fix of logging return value.

In reply to Wengang Wang
Quoted 4 lines · Wengang Wang

in ocfs2_file_aio_write(), log_exit() could don't log the value
which is really returned. this patch fixes it.

This patch is now in the fixes branch of ocfs2.git

Joel

Signature · 9 lines
Life's Little Instruction Book #207

	"Swing for the fence."

Joel Becker
Principal Software Developer
Oracle
E-mail: joel.becker at oracle.com
Phone: (650) 506-8127