Lines Matching refs:root
482 struct kernfs_root *root = kernfs_root(kn); in kernfs_drain() local
484 lockdep_assert_held_write(&root->kernfs_rwsem); in kernfs_drain()
497 up_write(&root->kernfs_rwsem); in kernfs_drain()
505 wait_event(root->deactivate_waitq, in kernfs_drain()
516 down_write(&root->kernfs_rwsem); in kernfs_drain()
541 struct kernfs_root *root; in kernfs_put() local
545 root = kernfs_root(kn); in kernfs_put()
567 idr_remove(&root->ino_idr, (u32)kernfs_ino(kn)); in kernfs_put()
577 idr_destroy(&root->ino_idr); in kernfs_put()
578 kfree(root); in kernfs_put()
601 static struct kernfs_node *__kernfs_new_node(struct kernfs_root *root, in __kernfs_new_node() argument
621 ret = idr_alloc_cyclic(&root->ino_idr, kn, 1, 0, GFP_ATOMIC); in __kernfs_new_node()
622 if (ret >= 0 && ret < root->last_id_lowbits) in __kernfs_new_node()
623 root->id_highbits++; in __kernfs_new_node()
624 id_highbits = root->id_highbits; in __kernfs_new_node()
625 root->last_id_lowbits = ret; in __kernfs_new_node()
663 idr_remove(&root->ino_idr, (u32)kernfs_ino(kn)); in __kernfs_new_node()
699 struct kernfs_node *kernfs_find_and_get_node_by_id(struct kernfs_root *root, in kernfs_find_and_get_node_by_id() argument
708 kn = idr_find(&root->ino_idr, (u32)ino); in kernfs_find_and_get_node_by_id()
752 struct kernfs_root *root = kernfs_root(parent); in kernfs_add_one() local
757 down_write(&root->kernfs_rwsem); in kernfs_add_one()
779 down_write(&root->kernfs_iattr_rwsem); in kernfs_add_one()
787 up_write(&root->kernfs_iattr_rwsem); in kernfs_add_one()
788 up_write(&root->kernfs_rwsem); in kernfs_add_one()
802 up_write(&root->kernfs_rwsem); in kernfs_add_one()
895 struct kernfs_root *root = kernfs_root(parent); in kernfs_find_and_get_ns() local
897 down_read(&root->kernfs_rwsem); in kernfs_find_and_get_ns()
900 up_read(&root->kernfs_rwsem); in kernfs_find_and_get_ns()
921 struct kernfs_root *root = kernfs_root(parent); in kernfs_walk_and_get_ns() local
923 down_read(&root->kernfs_rwsem); in kernfs_walk_and_get_ns()
926 up_read(&root->kernfs_rwsem); in kernfs_walk_and_get_ns()
943 struct kernfs_root *root; in kernfs_create_root() local
946 root = kzalloc(sizeof(*root), GFP_KERNEL); in kernfs_create_root()
947 if (!root) in kernfs_create_root()
950 idr_init(&root->ino_idr); in kernfs_create_root()
951 init_rwsem(&root->kernfs_rwsem); in kernfs_create_root()
952 init_rwsem(&root->kernfs_iattr_rwsem); in kernfs_create_root()
953 init_rwsem(&root->kernfs_supers_rwsem); in kernfs_create_root()
954 INIT_LIST_HEAD(&root->supers); in kernfs_create_root()
963 root->id_highbits = 0; in kernfs_create_root()
965 root->id_highbits = 1; in kernfs_create_root()
967 kn = __kernfs_new_node(root, NULL, "", S_IFDIR | S_IRUGO | S_IXUGO, in kernfs_create_root()
971 idr_destroy(&root->ino_idr); in kernfs_create_root()
972 kfree(root); in kernfs_create_root()
977 kn->dir.root = root; in kernfs_create_root()
979 root->syscall_ops = scops; in kernfs_create_root()
980 root->flags = flags; in kernfs_create_root()
981 root->kn = kn; in kernfs_create_root()
982 init_waitqueue_head(&root->deactivate_waitq); in kernfs_create_root()
984 if (!(root->flags & KERNFS_ROOT_CREATE_DEACTIVATED)) in kernfs_create_root()
987 return root; in kernfs_create_root()
997 void kernfs_destroy_root(struct kernfs_root *root) in kernfs_destroy_root() argument
1003 kernfs_get(root->kn); in kernfs_destroy_root()
1004 kernfs_remove(root->kn); in kernfs_destroy_root()
1005 kernfs_put(root->kn); /* will also free @root */ in kernfs_destroy_root()
1014 struct kernfs_node *kernfs_root_to_node(struct kernfs_root *root) in kernfs_root_to_node() argument
1016 return root->kn; in kernfs_root_to_node()
1045 kn->dir.root = parent->dir.root; in kernfs_create_dir_ns()
1078 kn->dir.root = parent->dir.root; in kernfs_create_empty_dir()
1094 struct kernfs_root *root; in kernfs_dop_revalidate() local
1119 root = kernfs_root_from_sb(dentry->d_sb); in kernfs_dop_revalidate()
1120 down_read(&root->kernfs_rwsem); in kernfs_dop_revalidate()
1124 up_read(&root->kernfs_rwsem); in kernfs_dop_revalidate()
1128 up_read(&root->kernfs_rwsem); in kernfs_dop_revalidate()
1137 root = kernfs_root(kn); in kernfs_dop_revalidate()
1138 down_read(&root->kernfs_rwsem); in kernfs_dop_revalidate()
1157 up_read(&root->kernfs_rwsem); in kernfs_dop_revalidate()
1160 up_read(&root->kernfs_rwsem); in kernfs_dop_revalidate()
1174 struct kernfs_root *root; in kernfs_iop_lookup() local
1178 root = kernfs_root(parent); in kernfs_iop_lookup()
1179 down_read(&root->kernfs_rwsem); in kernfs_iop_lookup()
1190 up_read(&root->kernfs_rwsem); in kernfs_iop_lookup()
1205 up_read(&root->kernfs_rwsem); in kernfs_iop_lookup()
1326 struct kernfs_node *root) in kernfs_next_descendant_post() argument
1330 lockdep_assert_held_write(&kernfs_root(root)->kernfs_rwsem); in kernfs_next_descendant_post()
1334 return kernfs_leftmost_descendant(root); in kernfs_next_descendant_post()
1337 if (pos == root) in kernfs_next_descendant_post()
1380 struct kernfs_root *root = kernfs_root(kn); in kernfs_activate() local
1382 down_write(&root->kernfs_rwsem); in kernfs_activate()
1388 up_write(&root->kernfs_rwsem); in kernfs_activate()
1405 struct kernfs_root *root = kernfs_root(kn); in kernfs_show() local
1410 down_write(&root->kernfs_rwsem); in kernfs_show()
1423 up_write(&root->kernfs_rwsem); in kernfs_show()
1499 struct kernfs_root *root; in kernfs_remove() local
1504 root = kernfs_root(kn); in kernfs_remove()
1506 down_write(&root->kernfs_rwsem); in kernfs_remove()
1508 up_write(&root->kernfs_rwsem); in kernfs_remove()
1596 struct kernfs_root *root = kernfs_root(kn); in kernfs_remove_self() local
1598 down_write(&root->kernfs_rwsem); in kernfs_remove_self()
1626 up_write(&root->kernfs_rwsem); in kernfs_remove_self()
1628 down_write(&root->kernfs_rwsem); in kernfs_remove_self()
1641 up_write(&root->kernfs_rwsem); in kernfs_remove_self()
1659 struct kernfs_root *root; in kernfs_remove_by_name_ns() local
1667 root = kernfs_root(parent); in kernfs_remove_by_name_ns()
1668 down_write(&root->kernfs_rwsem); in kernfs_remove_by_name_ns()
1677 up_write(&root->kernfs_rwsem); in kernfs_remove_by_name_ns()
1698 struct kernfs_root *root; in kernfs_rename_ns() local
1706 root = kernfs_root(kn); in kernfs_rename_ns()
1707 down_write(&root->kernfs_rwsem); in kernfs_rename_ns()
1761 up_write(&root->kernfs_rwsem); in kernfs_rename_ns()
1826 struct kernfs_root *root; in kernfs_fop_readdir() local
1832 root = kernfs_root(parent); in kernfs_fop_readdir()
1833 down_read(&root->kernfs_rwsem); in kernfs_fop_readdir()
1850 up_read(&root->kernfs_rwsem); in kernfs_fop_readdir()
1853 down_read(&root->kernfs_rwsem); in kernfs_fop_readdir()
1855 up_read(&root->kernfs_rwsem); in kernfs_fop_readdir()