summaryrefslogtreecommitdiff
path: root/fs/kernfs
diff options
context:
space:
mode:
authorShaohua Li <shli@fb.com>2017-07-12 11:49:55 -0700
committerJens Axboe <axboe@kernel.dk>2017-07-29 09:00:03 -0600
commit69fd5c391763bd94a40dd152bc72a7f230137150 (patch)
tree9f44111556c0f8ac14410703a79c42289ea768c2 /fs/kernfs
parent007cc56b7eeca8848021bc43aca2b8607fbe5589 (diff)
blktrace: add an option to allow displaying cgroup path
By default we output cgroup id in blktrace. This adds an option to display cgroup path. Since get cgroup path is a relativly heavy operation, we don't enable it by default. with the option enabled, blktrace will output something like this: dd-1353 [007] d..2 293.015252: 8,0 /test/level D R 24 + 8 [dd] Signed-off-by: Shaohua Li <shli@fb.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'fs/kernfs')
-rw-r--r--fs/kernfs/mount.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/fs/kernfs/mount.c b/fs/kernfs/mount.c
index fa323589704f..7c452f4d83e9 100644
--- a/fs/kernfs/mount.c
+++ b/fs/kernfs/mount.c
@@ -65,6 +65,25 @@ const struct super_operations kernfs_sops = {
.show_path = kernfs_sop_show_path,
};
+/*
+ * Similar to kernfs_fh_get_inode, this one gets kernfs node from inode
+ * number and generation
+ */
+struct kernfs_node *kernfs_get_node_by_id(struct kernfs_root *root,
+ const union kernfs_node_id *id)
+{
+ struct kernfs_node *kn;
+
+ kn = kernfs_find_and_get_node_by_ino(root, id->ino);
+ if (!kn)
+ return NULL;
+ if (kn->id.generation != id->generation) {
+ kernfs_put(kn);
+ return NULL;
+ }
+ return kn;
+}
+
static struct inode *kernfs_fh_get_inode(struct super_block *sb,
u64 ino, u32 generation)
{