All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Sandeen <sandeen@redhat.com>
To: ext4 development <linux-ext4@vger.kernel.org>
Subject: [PATCH 2/4] ext4: Address various akpm jbd2 stats comments
Date: Mon, 03 Dec 2007 17:29:47 -0600	[thread overview]
Message-ID: <4754916B.2060607@redhat.com> (raw)

(Andrew, cc'ing you since these address your original review comments; feel free
to just pick the patch up via Ted/Mingming if you prefer)

Address several of akpm's comments on the jbd2 stats patch:

o return -ENOMEM not -EIO on memory failure
o avoid unneeded casts of void pointers
o minor formatting changes
o size bdevname char arrays with BDEVNAME_SIZE
o use "#ifdef" vs. "#if defined()" for single test

Signed-off-by: Eric Sandeen <sandeen@redhat.com>

---

Index: linux-2.6.24-rc3/fs/jbd2/journal.c
===================================================================
--- linux-2.6.24-rc3.orig/fs/jbd2/journal.c
+++ linux-2.6.24-rc3/fs/jbd2/journal.c
@@ -747,12 +747,12 @@ static int jbd2_seq_history_open(struct 
 
 	s = kmalloc(sizeof(*s), GFP_KERNEL);
 	if (s == NULL)
-		return -EIO;
+		return -ENOMEM;
 	size = sizeof(struct transaction_stats_s) * journal->j_history_max;
 	s->stats = kmalloc(size, GFP_KERNEL);
 	if (s->stats == NULL) {
 		kfree(s);
-		return -EIO;
+		return -ENOMEM;
 	}
 	spin_lock(&journal->j_history_lock);
 	memcpy(s->stats, journal->j_history, size);
@@ -762,7 +762,7 @@ static int jbd2_seq_history_open(struct 
 
 	rc = seq_open(file, &jbd2_seq_history_ops);
 	if (rc == 0) {
-		struct seq_file *m = (struct seq_file *)file->private_data;
+		struct seq_file *m = file->private_data;
 		m->private = s;
 	} else {
 		kfree(s->stats);
@@ -774,8 +774,9 @@ static int jbd2_seq_history_open(struct 
 
 static int jbd2_seq_history_release(struct inode *inode, struct file *file)
 {
-	struct seq_file *seq = (struct seq_file *)file->private_data;
+	struct seq_file *seq = file->private_data;
 	struct jbd2_stats_proc_session *s = seq->private;
+
 	kfree(s->stats);
 	kfree(s);
 	return seq_release(inode, file);
@@ -802,6 +803,7 @@ static void *jbd2_seq_info_next(struct s
 static int jbd2_seq_info_show(struct seq_file *seq, void *v)
 {
 	struct jbd2_stats_proc_session *s = seq->private;
+
 	if (v != SEQ_START_TOKEN)
 		return 0;
 	seq_printf(seq, "%lu transaction, each upto %u blocks\n",
@@ -847,12 +849,12 @@ static int jbd2_seq_info_open(struct ino
 
 	s = kmalloc(sizeof(*s), GFP_KERNEL);
 	if (s == NULL)
-		return -EIO;
+		return -ENOMEM;
 	size = sizeof(struct transaction_stats_s);
 	s->stats = kmalloc(size, GFP_KERNEL);
 	if (s->stats == NULL) {
 		kfree(s);
-		return -EIO;
+		return -ENOMEM;
 	}
 	spin_lock(&journal->j_history_lock);
 	memcpy(s->stats, &journal->j_stats, size);
@@ -861,7 +863,7 @@ static int jbd2_seq_info_open(struct ino
 
 	rc = seq_open(file, &jbd2_seq_info_ops);
 	if (rc == 0) {
-		struct seq_file *m = (struct seq_file *)file->private_data;
+		struct seq_file *m = file->private_data;
 		m->private = s;
 	} else {
 		kfree(s->stats);
@@ -873,7 +875,7 @@ static int jbd2_seq_info_open(struct ino
 
 static int jbd2_seq_info_release(struct inode *inode, struct file *file)
 {
-	struct seq_file *seq = (struct seq_file *)file->private_data;
+	struct seq_file *seq = file->private_data;
 	struct jbd2_stats_proc_session *s = seq->private;
 	kfree(s->stats);
 	kfree(s);
@@ -892,7 +894,7 @@ static struct proc_dir_entry *proc_jbd2_
 
 static void jbd2_stats_proc_init(journal_t *journal)
 {
-	char name[64];
+	char name[BDEVNAME_SIZE];
 
 	snprintf(name, sizeof(name) - 1, "%s", bdevname(journal->j_dev, name));
 	journal->j_proc_entry = proc_mkdir(name, proc_jbd2_stats);
@@ -915,7 +917,7 @@ static void jbd2_stats_proc_init(journal
 
 static void jbd2_stats_proc_exit(journal_t *journal)
 {
-	char name[64];
+	char name[BDEVNAME_SIZE];
 
 	snprintf(name, sizeof(name) - 1, "%s", bdevname(journal->j_dev, name));
 	remove_proc_entry("info", journal->j_proc_entry);
@@ -2207,7 +2209,7 @@ static void __exit jbd2_remove_debugfs_e
 
 #endif
 
-#if defined(CONFIG_PROC_FS)
+#ifdef CONFIG_PROC_FS
 
 #define JBD2_STATS_PROC_NAME "fs/jbd2"
 

 

                 reply	other threads:[~2007-12-03 23:29 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4754916B.2060607@redhat.com \
    --to=sandeen@redhat.com \
    --cc=linux-ext4@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.