Commit ecde28237e10de3750a97579f42bc2ec65b8a0e1
1 parent
40437c718a
Exists in
master
and in
20 other branches
oprofilefs_mkdir() doesn't need superblock argument
it's always equal to ->d_sb of the second argument (parent dentry), due to either being literally that, or ->d_sb of parent's parent. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Showing 11 changed files with 21 additions and 23 deletions Side-by-side Diff
- arch/alpha/oprofile/common.c
- arch/avr32/oprofile/op_model_avr32.c
- arch/mips/oprofile/common.c
- arch/powerpc/oprofile/common.c
- arch/s390/oprofile/init.c
- arch/x86/oprofile/nmi_int.c
- arch/x86/oprofile/op_model_amd.c
- drivers/oprofile/oprofile_perf.c
- drivers/oprofile/oprofile_stats.c
- drivers/oprofile/oprofilefs.c
- include/linux/oprofile.h
arch/alpha/oprofile/common.c
... | ... | @@ -115,7 +115,7 @@ |
115 | 115 | char buf[4]; |
116 | 116 | |
117 | 117 | snprintf(buf, sizeof buf, "%d", i); |
118 | - dir = oprofilefs_mkdir(root->d_sb, root, buf); | |
118 | + dir = oprofilefs_mkdir(root, buf); | |
119 | 119 | |
120 | 120 | oprofilefs_create_ulong(root->d_sb, dir, "enabled", &ctr[i].enabled); |
121 | 121 | oprofilefs_create_ulong(root->d_sb, dir, "event", &ctr[i].event); |
arch/avr32/oprofile/op_model_avr32.c
... | ... | @@ -105,7 +105,7 @@ |
105 | 105 | |
106 | 106 | for (i = 0; i < NR_counter; i++) { |
107 | 107 | snprintf(filename, sizeof(filename), "%u", i); |
108 | - dir = oprofilefs_mkdir(root->d_sb, root, filename); | |
108 | + dir = oprofilefs_mkdir(root, filename); | |
109 | 109 | |
110 | 110 | oprofilefs_create_ulong(root->d_sb, dir, "enabled", |
111 | 111 | &counter[i].enabled); |
arch/mips/oprofile/common.c
... | ... | @@ -42,7 +42,7 @@ |
42 | 42 | char buf[4]; |
43 | 43 | |
44 | 44 | snprintf(buf, sizeof buf, "%d", i); |
45 | - dir = oprofilefs_mkdir(root->d_sb, root, buf); | |
45 | + dir = oprofilefs_mkdir(root, buf); | |
46 | 46 | |
47 | 47 | oprofilefs_create_ulong(root->d_sb, dir, "enabled", &ctr[i].enabled); |
48 | 48 | oprofilefs_create_ulong(root->d_sb, dir, "event", &ctr[i].event); |
arch/powerpc/oprofile/common.c
... | ... | @@ -160,7 +160,7 @@ |
160 | 160 | char buf[4]; |
161 | 161 | |
162 | 162 | snprintf(buf, sizeof buf, "%d", i); |
163 | - dir = oprofilefs_mkdir(root->d_sb, root, buf); | |
163 | + dir = oprofilefs_mkdir(root, buf); | |
164 | 164 | |
165 | 165 | oprofilefs_create_ulong(root->d_sb, dir, "enabled", &ctr[i].enabled); |
166 | 166 | oprofilefs_create_ulong(root->d_sb, dir, "event", &ctr[i].event); |
arch/s390/oprofile/init.c
... | ... | @@ -350,7 +350,7 @@ |
350 | 350 | { |
351 | 351 | struct dentry *dir; |
352 | 352 | |
353 | - dir = oprofilefs_mkdir(root->d_sb, root, "timer"); | |
353 | + dir = oprofilefs_mkdir(root, "timer"); | |
354 | 354 | if (!dir) |
355 | 355 | return -EINVAL; |
356 | 356 | |
... | ... | @@ -375,7 +375,7 @@ |
375 | 375 | * and can only be set to 0. |
376 | 376 | */ |
377 | 377 | |
378 | - dir = oprofilefs_mkdir(root->d_sb, root, "0"); | |
378 | + dir = oprofilefs_mkdir(root, "0"); | |
379 | 379 | if (!dir) |
380 | 380 | return -EINVAL; |
381 | 381 | |
... | ... | @@ -395,7 +395,7 @@ |
395 | 395 | * space tools. The /dev/oprofile/hwsampling fs is |
396 | 396 | * provided in that case. |
397 | 397 | */ |
398 | - dir = oprofilefs_mkdir(root->d_sb, root, "hwsampling"); | |
398 | + dir = oprofilefs_mkdir(root, "hwsampling"); | |
399 | 399 | if (!dir) |
400 | 400 | return -EINVAL; |
401 | 401 |
arch/x86/oprofile/nmi_int.c
... | ... | @@ -420,7 +420,7 @@ |
420 | 420 | continue; |
421 | 421 | |
422 | 422 | snprintf(buf, sizeof(buf), "%d", i); |
423 | - dir = oprofilefs_mkdir(root->d_sb, root, buf); | |
423 | + dir = oprofilefs_mkdir(root, buf); | |
424 | 424 | oprofilefs_create_ulong(root->d_sb, dir, "enabled", &counter_config[i].enabled); |
425 | 425 | oprofilefs_create_ulong(root->d_sb, dir, "event", &counter_config[i].event); |
426 | 426 | oprofilefs_create_ulong(root->d_sb, dir, "count", &counter_config[i].count); |
arch/x86/oprofile/op_model_amd.c
... | ... | @@ -479,7 +479,7 @@ |
479 | 479 | ibs_config.max_cnt_op = 250000; |
480 | 480 | |
481 | 481 | if (ibs_caps & IBS_CAPS_FETCHSAM) { |
482 | - dir = oprofilefs_mkdir(root->d_sb, root, "ibs_fetch"); | |
482 | + dir = oprofilefs_mkdir(root, "ibs_fetch"); | |
483 | 483 | oprofilefs_create_ulong(root->d_sb, dir, "enable", |
484 | 484 | &ibs_config.fetch_enabled); |
485 | 485 | oprofilefs_create_ulong(root->d_sb, dir, "max_count", |
... | ... | @@ -489,7 +489,7 @@ |
489 | 489 | } |
490 | 490 | |
491 | 491 | if (ibs_caps & IBS_CAPS_OPSAM) { |
492 | - dir = oprofilefs_mkdir(root->d_sb, root, "ibs_op"); | |
492 | + dir = oprofilefs_mkdir(root, "ibs_op"); | |
493 | 493 | oprofilefs_create_ulong(root->d_sb, dir, "enable", |
494 | 494 | &ibs_config.op_enabled); |
495 | 495 | oprofilefs_create_ulong(root->d_sb, dir, "max_count", |
drivers/oprofile/oprofile_perf.c
... | ... | @@ -147,7 +147,7 @@ |
147 | 147 | char buf[4]; |
148 | 148 | |
149 | 149 | snprintf(buf, sizeof buf, "%d", i); |
150 | - dir = oprofilefs_mkdir(root->d_sb, root, buf); | |
150 | + dir = oprofilefs_mkdir(root, buf); | |
151 | 151 | oprofilefs_create_ulong(root->d_sb, dir, "enabled", &counter_config[i].enabled); |
152 | 152 | oprofilefs_create_ulong(root->d_sb, dir, "event", &counter_config[i].event); |
153 | 153 | oprofilefs_create_ulong(root->d_sb, dir, "count", &counter_config[i].count); |
drivers/oprofile/oprofile_stats.c
... | ... | @@ -46,14 +46,14 @@ |
46 | 46 | char buf[10]; |
47 | 47 | int i; |
48 | 48 | |
49 | - dir = oprofilefs_mkdir(root->d_sb, root, "stats"); | |
49 | + dir = oprofilefs_mkdir(root, "stats"); | |
50 | 50 | if (!dir) |
51 | 51 | return; |
52 | 52 | |
53 | 53 | for_each_possible_cpu(i) { |
54 | 54 | cpu_buf = &per_cpu(op_cpu_buffer, i); |
55 | 55 | snprintf(buf, 10, "cpu%d", i); |
56 | - cpudir = oprofilefs_mkdir(root->d_sb, dir, buf); | |
56 | + cpudir = oprofilefs_mkdir(dir, buf); | |
57 | 57 | |
58 | 58 | /* Strictly speaking access to these ulongs is racy, |
59 | 59 | * but we can't simply lock them, and they are |
drivers/oprofile/oprofilefs.c
... | ... | @@ -211,28 +211,27 @@ |
211 | 211 | } |
212 | 212 | |
213 | 213 | |
214 | -struct dentry *oprofilefs_mkdir(struct super_block *sb, | |
215 | - struct dentry *root, char const *name) | |
214 | +struct dentry *oprofilefs_mkdir(struct dentry *parent, char const *name) | |
216 | 215 | { |
217 | 216 | struct dentry *dentry; |
218 | 217 | struct inode *inode; |
219 | 218 | |
220 | - mutex_lock(&root->d_inode->i_mutex); | |
221 | - dentry = d_alloc_name(root, name); | |
219 | + mutex_lock(&parent->d_inode->i_mutex); | |
220 | + dentry = d_alloc_name(parent, name); | |
222 | 221 | if (!dentry) { |
223 | - mutex_unlock(&root->d_inode->i_mutex); | |
222 | + mutex_unlock(&parent->d_inode->i_mutex); | |
224 | 223 | return NULL; |
225 | 224 | } |
226 | - inode = oprofilefs_get_inode(sb, S_IFDIR | 0755); | |
225 | + inode = oprofilefs_get_inode(parent->d_sb, S_IFDIR | 0755); | |
227 | 226 | if (!inode) { |
228 | 227 | dput(dentry); |
229 | - mutex_unlock(&root->d_inode->i_mutex); | |
228 | + mutex_unlock(&parent->d_inode->i_mutex); | |
230 | 229 | return NULL; |
231 | 230 | } |
232 | 231 | inode->i_op = &simple_dir_inode_operations; |
233 | 232 | inode->i_fop = &simple_dir_operations; |
234 | 233 | d_add(dentry, inode); |
235 | - mutex_unlock(&root->d_inode->i_mutex); | |
234 | + mutex_unlock(&parent->d_inode->i_mutex); | |
236 | 235 | return dentry; |
237 | 236 | } |
238 | 237 |
include/linux/oprofile.h
... | ... | @@ -144,8 +144,7 @@ |
144 | 144 | char const * name, atomic_t * val); |
145 | 145 | |
146 | 146 | /** create a directory */ |
147 | -struct dentry * oprofilefs_mkdir(struct super_block * sb, struct dentry * root, | |
148 | - char const * name); | |
147 | +struct dentry *oprofilefs_mkdir(struct dentry *parent, char const *name); | |
149 | 148 | |
150 | 149 | /** |
151 | 150 | * Write the given asciz string to the given user buffer @buf, updating *offset |