All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 2/4] ext4: Address various akpm jbd2 stats comments
@ 2007-12-03 23:29 Eric Sandeen
  0 siblings, 0 replies; only message in thread
From: Eric Sandeen @ 2007-12-03 23:29 UTC (permalink / raw)
  To: ext4 development

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

 

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2007-12-03 23:29 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-12-03 23:29 [PATCH 2/4] ext4: Address various akpm jbd2 stats comments Eric Sandeen

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.