Skip to contentSkip to conversation

ext4: use non-racy method for proc entries creation

PATCH New [email protected] 1 participant 1 message Apr 29, 2008 ext4 file system

lore
Share & tools
lore
#0 lore raw

PATCH 212/311 ext4: use non-racy method for proc entries creation

From: "Denis V. Lunev" <[email protected]>

Use proc_create()/proc_create_data() to make sure that ->proc_fops and ->data be setup before gluing PDE to main tree.

---

 fs/ext4/mballoc.c |   15 ++++-----------
 1 file changed, 4 insertions(+), 11 deletions(-)
fs/ext4/mballoc.c renamed from fs/ext4/mballoc.c~ext4-use-non-racy-method-for-proc-entries-creation +4 -11
diff -puN fs/ext4/mballoc.c~ext4-use-non-racy-method-for-proc-entries-creation fs/ext4/mballoc.c
@@ -2449,17 +2449,10 @@ static void ext4_mb_history_init(struct 
 	int i;
 
 	if (sbi->s_mb_proc != NULL) {
-		struct proc_dir_entry *p;
-		p = create_proc_entry("mb_history", S_IRUGO, sbi->s_mb_proc);
-		if (p) {
-			p->proc_fops = &ext4_mb_seq_history_fops;
-			p->data = sb;
-		}
-		p = create_proc_entry("mb_groups", S_IRUGO, sbi->s_mb_proc);
-		if (p) {
-			p->proc_fops = &ext4_mb_seq_groups_fops;
-			p->data = sb;
-		}
+		proc_create_data("mb_history", S_IRUGO, sbi->s_mb_proc,
+				 &ext4_mb_seq_history_fops, sb);
+		proc_create_data("mb_groups", S_IRUGO, sbi->s_mb_proc,
+				 &ext4_mb_seq_groups_fops, sb);
 	}
 
 	sbi->s_mb_history_max = 1000;

_