aboutsummaryrefslogtreecommitdiffstats
path: root/fs/jbd2/journal.c
diff options
context:
space:
mode:
authorTheodore Ts'o <tytso@mit.edu>2011-07-10 22:05:08 -0400
committerTheodore Ts'o <tytso@mit.edu>2011-07-10 22:05:08 -0400
commit4862fd6047ed02e2726667c54d35f538eecc56aa (patch)
treefc97f075946120157c63f48e283a5d753d22763a /fs/jbd2/journal.c
parent575a1d4bdfa2ea9fc10733013136145b497e1be0 (diff)
jbd2: remove jbd2_dev_to_name() from jbd2 tracepoints
Using function calls in TP_printk causes perf heartburn, so print the MAJOR/MINOR device numbers instead. Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'fs/jbd2/journal.c')
-rw-r--r--fs/jbd2/journal.c67
1 files changed, 0 insertions, 67 deletions
diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c
index 0dfa5b598e68..f24df13adc4e 100644
--- a/fs/jbd2/journal.c
+++ b/fs/jbd2/journal.c
@@ -2390,73 +2390,6 @@ static void __exit journal_exit(void)
2390 jbd2_journal_destroy_caches(); 2390 jbd2_journal_destroy_caches();
2391} 2391}
2392 2392
2393/*
2394 * jbd2_dev_to_name is a utility function used by the jbd2 and ext4
2395 * tracing infrastructure to map a dev_t to a device name.
2396 *
2397 * The caller should use rcu_read_lock() in order to make sure the
2398 * device name stays valid until its done with it. We use
2399 * rcu_read_lock() as well to make sure we're safe in case the caller
2400 * gets sloppy, and because rcu_read_lock() is cheap and can be safely
2401 * nested.
2402 */
2403struct devname_cache {
2404 struct rcu_head rcu;
2405 dev_t device;
2406 char devname[BDEVNAME_SIZE];
2407};
2408#define CACHE_SIZE_BITS 6
2409static struct devname_cache *devcache[1 << CACHE_SIZE_BITS];
2410static DEFINE_SPINLOCK(devname_cache_lock);
2411
2412static void free_devcache(struct rcu_head *rcu)
2413{
2414 kfree(rcu);
2415}
2416
2417const char *jbd2_dev_to_name(dev_t device)
2418{
2419 int i = hash_32(device, CACHE_SIZE_BITS);
2420 char *ret;
2421 struct block_device *bd;
2422 static struct devname_cache *new_dev;
2423
2424 rcu_read_lock();
2425 if (devcache[i] && devcache[i]->device == device) {
2426 ret = devcache[i]->devname;
2427 rcu_read_unlock();
2428 return ret;
2429 }
2430 rcu_read_unlock();
2431
2432 new_dev = kmalloc(sizeof(struct devname_cache), GFP_KERNEL);
2433 if (!new_dev)
2434 return "NODEV-ALLOCFAILURE"; /* Something non-NULL */
2435 bd = bdget(device);
2436 spin_lock(&devname_cache_lock);
2437 if (devcache[i]) {
2438 if (devcache[i]->device == device) {
2439 kfree(new_dev);
2440 bdput(bd);
2441 ret = devcache[i]->devname;
2442 spin_unlock(&devname_cache_lock);
2443 return ret;
2444 }
2445 call_rcu(&devcache[i]->rcu, free_devcache);
2446 }
2447 devcache[i] = new_dev;
2448 devcache[i]->device = device;
2449 if (bd) {
2450 bdevname(bd, devcache[i]->devname);
2451 bdput(bd);
2452 } else
2453 __bdevname(device, devcache[i]->devname);
2454 ret = devcache[i]->devname;
2455 spin_unlock(&devname_cache_lock);
2456 return ret;
2457}
2458EXPORT_SYMBOL(jbd2_dev_to_name);
2459
2460MODULE_LICENSE("GPL"); 2393MODULE_LICENSE("GPL");
2461module_init(journal_init); 2394module_init(journal_init);
2462module_exit(journal_exit); 2395module_exit(journal_exit);