Lines Matching full:cd
84 struct cache_detail *cd) in sunrpc_begin_cache_remove_entry() argument
86 /* Must be called under cd->hash_lock */ in sunrpc_begin_cache_remove_entry()
89 cd->entries --; in sunrpc_begin_cache_remove_entry()
93 struct cache_detail *cd) in sunrpc_end_cache_remove_entry() argument
95 cache_fresh_unlocked(ch, cd); in sunrpc_end_cache_remove_entry()
96 cache_put(ch, cd); in sunrpc_end_cache_remove_entry()
385 void sunrpc_init_cache_detail(struct cache_detail *cd) in sunrpc_init_cache_detail() argument
387 spin_lock_init(&cd->hash_lock); in sunrpc_init_cache_detail()
388 INIT_LIST_HEAD(&cd->queue); in sunrpc_init_cache_detail()
390 cd->nextcheck = 0; in sunrpc_init_cache_detail()
391 cd->entries = 0; in sunrpc_init_cache_detail()
392 atomic_set(&cd->writers, 0); in sunrpc_init_cache_detail()
393 cd->last_close = 0; in sunrpc_init_cache_detail()
394 cd->last_warn = -1; in sunrpc_init_cache_detail()
395 list_add(&cd->others, &cache_list); in sunrpc_init_cache_detail()
403 void sunrpc_destroy_cache_detail(struct cache_detail *cd) in sunrpc_destroy_cache_detail() argument
405 cache_purge(cd); in sunrpc_destroy_cache_detail()
407 spin_lock(&cd->hash_lock); in sunrpc_destroy_cache_detail()
408 if (current_detail == cd) in sunrpc_destroy_cache_detail()
410 list_del_init(&cd->others); in sunrpc_destroy_cache_detail()
411 spin_unlock(&cd->hash_lock); in sunrpc_destroy_cache_detail()
827 loff_t *ppos, struct cache_detail *cd) in cache_read() argument
842 while (rp->q.list.next != &cd->queue && in cache_read()
848 if (rp->q.list.next == &cd->queue) { in cache_read()
861 err = cache_request(cd, rq); in cache_read()
896 cache_put(rq->item, cd); in cache_read()
909 size_t count, struct cache_detail *cd) in cache_do_downcall() argument
918 ret = cd->cache_parse(cd, kaddr, count); in cache_do_downcall()
926 size_t count, struct cache_detail *cd) in cache_downcall() argument
940 ret = cache_do_downcall(write_buf, buf, count, cd); in cache_downcall()
948 struct cache_detail *cd) in cache_write() argument
954 if (!cd->cache_parse) in cache_write()
958 ret = cache_downcall(mapping, buf, count, cd); in cache_write()
967 struct cache_detail *cd) in cache_poll() argument
983 for (cq= &rp->q; &cq->list != &cd->queue; in cache_poll()
995 struct cache_detail *cd) in cache_ioctl() argument
1009 for (cq= &rp->q; &cq->list != &cd->queue; in cache_ioctl()
1023 struct cache_detail *cd) in cache_open() argument
1027 if (!cd || !try_module_get(cd->owner)) in cache_open()
1033 module_put(cd->owner); in cache_open()
1040 list_add(&rp->q.list, &cd->queue); in cache_open()
1044 atomic_inc(&cd->writers); in cache_open()
1050 struct cache_detail *cd) in cache_release() argument
1058 for (cq= &rp->q; &cq->list != &cd->queue; in cache_release()
1075 atomic_dec(&cd->writers); in cache_release()
1076 cd->last_close = seconds_since_boot(); in cache_release()
1078 module_put(cd->owner); in cache_release()
1346 struct cache_detail *cd = m->private; in __cache_seq_start() local
1353 hlist_for_each_entry_rcu(ch, &cd->hash_table[hash], cache_list) in __cache_seq_start()
1360 } while(hash < cd->hash_size && in __cache_seq_start()
1361 hlist_empty(&cd->hash_table[hash])); in __cache_seq_start()
1362 if (hash >= cd->hash_size) in __cache_seq_start()
1366 hlist_first_rcu(&cd->hash_table[hash])), in __cache_seq_start()
1374 struct cache_detail *cd = m->private; in cache_seq_next() local
1388 while (hash < cd->hash_size && in cache_seq_next()
1389 hlist_empty(&cd->hash_table[hash])) { in cache_seq_next()
1393 if (hash >= cd->hash_size) in cache_seq_next()
1397 hlist_first_rcu(&cd->hash_table[hash])), in cache_seq_next()
1425 struct cache_detail *cd = m->private; in c_show() local
1428 return cd->cache_show(m, cd, NULL); in c_show()
1435 if (cache_check(cd, cp, NULL)) in c_show()
1439 if (cache_is_expired(cd, cp)) in c_show()
1441 cache_put(cp, cd); in c_show()
1444 return cd->cache_show(m, cd, cp); in c_show()
1455 struct cache_detail *cd) in content_open() argument
1460 if (!cd || !try_module_get(cd->owner)) in content_open()
1465 module_put(cd->owner); in content_open()
1470 seq->private = cd; in content_open()
1475 struct cache_detail *cd) in content_release() argument
1478 module_put(cd->owner); in content_release()
1483 struct cache_detail *cd) in open_flush() argument
1485 if (!cd || !try_module_get(cd->owner)) in open_flush()
1491 struct cache_detail *cd) in release_flush() argument
1493 module_put(cd->owner); in release_flush()
1499 struct cache_detail *cd) in read_flush() argument
1505 convert_to_wallclock(cd->flush_time)); in read_flush()
1511 struct cache_detail *cd) in write_flush() argument
1538 if (cd->flush_time >= now) in write_flush()
1539 now = cd->flush_time + 1; in write_flush()
1541 cd->flush_time = now; in write_flush()
1542 cd->nextcheck = now; in write_flush()
1545 if (cd->flush) in write_flush()
1546 cd->flush(); in write_flush()
1555 struct cache_detail *cd = pde_data(file_inode(filp)); in cache_read_procfs() local
1557 return cache_read(filp, buf, count, ppos, cd); in cache_read_procfs()
1563 struct cache_detail *cd = pde_data(file_inode(filp)); in cache_write_procfs() local
1565 return cache_write(filp, buf, count, ppos, cd); in cache_write_procfs()
1570 struct cache_detail *cd = pde_data(file_inode(filp)); in cache_poll_procfs() local
1572 return cache_poll(filp, wait, cd); in cache_poll_procfs()
1579 struct cache_detail *cd = pde_data(inode); in cache_ioctl_procfs() local
1581 return cache_ioctl(inode, filp, cmd, arg, cd); in cache_ioctl_procfs()
1586 struct cache_detail *cd = pde_data(inode); in cache_open_procfs() local
1588 return cache_open(inode, filp, cd); in cache_open_procfs()
1593 struct cache_detail *cd = pde_data(inode); in cache_release_procfs() local
1595 return cache_release(inode, filp, cd); in cache_release_procfs()
1610 struct cache_detail *cd = pde_data(inode); in content_open_procfs() local
1612 return content_open(inode, filp, cd); in content_open_procfs()
1617 struct cache_detail *cd = pde_data(inode); in content_release_procfs() local
1619 return content_release(inode, filp, cd); in content_release_procfs()
1631 struct cache_detail *cd = pde_data(inode); in open_flush_procfs() local
1633 return open_flush(inode, filp, cd); in open_flush_procfs()
1638 struct cache_detail *cd = pde_data(inode); in release_flush_procfs() local
1640 return release_flush(inode, filp, cd); in release_flush_procfs()
1646 struct cache_detail *cd = pde_data(file_inode(filp)); in read_flush_procfs() local
1648 return read_flush(filp, buf, count, ppos, cd); in read_flush_procfs()
1655 struct cache_detail *cd = pde_data(file_inode(filp)); in write_flush_procfs() local
1657 return write_flush(filp, buf, count, ppos, cd); in write_flush_procfs()
1668 static void remove_cache_proc_entries(struct cache_detail *cd) in remove_cache_proc_entries() argument
1670 if (cd->procfs) { in remove_cache_proc_entries()
1671 proc_remove(cd->procfs); in remove_cache_proc_entries()
1672 cd->procfs = NULL; in remove_cache_proc_entries()
1677 static int create_cache_proc_entries(struct cache_detail *cd, struct net *net) in create_cache_proc_entries() argument
1683 cd->procfs = proc_mkdir(cd->name, sn->proc_net_rpc); in create_cache_proc_entries()
1684 if (cd->procfs == NULL) in create_cache_proc_entries()
1688 cd->procfs, &cache_flush_proc_ops, cd); in create_cache_proc_entries()
1692 if (cd->cache_request || cd->cache_parse) { in create_cache_proc_entries()
1693 p = proc_create_data("channel", S_IFREG | 0600, cd->procfs, in create_cache_proc_entries()
1694 &cache_channel_proc_ops, cd); in create_cache_proc_entries()
1698 if (cd->cache_show) { in create_cache_proc_entries()
1699 p = proc_create_data("content", S_IFREG | 0400, cd->procfs, in create_cache_proc_entries()
1700 &content_proc_ops, cd); in create_cache_proc_entries()
1706 remove_cache_proc_entries(cd); in create_cache_proc_entries()
1710 static int create_cache_proc_entries(struct cache_detail *cd, struct net *net) in create_cache_proc_entries() argument
1721 int cache_register_net(struct cache_detail *cd, struct net *net) in cache_register_net() argument
1725 sunrpc_init_cache_detail(cd); in cache_register_net()
1726 ret = create_cache_proc_entries(cd, net); in cache_register_net()
1728 sunrpc_destroy_cache_detail(cd); in cache_register_net()
1733 void cache_unregister_net(struct cache_detail *cd, struct net *net) in cache_unregister_net() argument
1735 remove_cache_proc_entries(cd); in cache_unregister_net()
1736 sunrpc_destroy_cache_detail(cd); in cache_unregister_net()
1742 struct cache_detail *cd; in cache_create_net() local
1745 cd = kmemdup(tmpl, sizeof(struct cache_detail), GFP_KERNEL); in cache_create_net()
1746 if (cd == NULL) in cache_create_net()
1749 cd->hash_table = kcalloc(cd->hash_size, sizeof(struct hlist_head), in cache_create_net()
1751 if (cd->hash_table == NULL) { in cache_create_net()
1752 kfree(cd); in cache_create_net()
1756 for (i = 0; i < cd->hash_size; i++) in cache_create_net()
1757 INIT_HLIST_HEAD(&cd->hash_table[i]); in cache_create_net()
1758 cd->net = net; in cache_create_net()
1759 return cd; in cache_create_net()
1763 void cache_destroy_net(struct cache_detail *cd, struct net *net) in cache_destroy_net() argument
1765 kfree(cd->hash_table); in cache_destroy_net()
1766 kfree(cd); in cache_destroy_net()
1773 struct cache_detail *cd = RPC_I(file_inode(filp))->private; in cache_read_pipefs() local
1775 return cache_read(filp, buf, count, ppos, cd); in cache_read_pipefs()
1781 struct cache_detail *cd = RPC_I(file_inode(filp))->private; in cache_write_pipefs() local
1783 return cache_write(filp, buf, count, ppos, cd); in cache_write_pipefs()
1788 struct cache_detail *cd = RPC_I(file_inode(filp))->private; in cache_poll_pipefs() local
1790 return cache_poll(filp, wait, cd); in cache_poll_pipefs()
1797 struct cache_detail *cd = RPC_I(inode)->private; in cache_ioctl_pipefs() local
1799 return cache_ioctl(inode, filp, cmd, arg, cd); in cache_ioctl_pipefs()
1804 struct cache_detail *cd = RPC_I(inode)->private; in cache_open_pipefs() local
1806 return cache_open(inode, filp, cd); in cache_open_pipefs()
1811 struct cache_detail *cd = RPC_I(inode)->private; in cache_release_pipefs() local
1813 return cache_release(inode, filp, cd); in cache_release_pipefs()
1829 struct cache_detail *cd = RPC_I(inode)->private; in content_open_pipefs() local
1831 return content_open(inode, filp, cd); in content_open_pipefs()
1836 struct cache_detail *cd = RPC_I(inode)->private; in content_release_pipefs() local
1838 return content_release(inode, filp, cd); in content_release_pipefs()
1850 struct cache_detail *cd = RPC_I(inode)->private; in open_flush_pipefs() local
1852 return open_flush(inode, filp, cd); in open_flush_pipefs()
1857 struct cache_detail *cd = RPC_I(inode)->private; in release_flush_pipefs() local
1859 return release_flush(inode, filp, cd); in release_flush_pipefs()
1865 struct cache_detail *cd = RPC_I(file_inode(filp))->private; in read_flush_pipefs() local
1867 return read_flush(filp, buf, count, ppos, cd); in read_flush_pipefs()
1874 struct cache_detail *cd = RPC_I(file_inode(filp))->private; in write_flush_pipefs() local
1876 return write_flush(filp, buf, count, ppos, cd); in write_flush_pipefs()
1889 struct cache_detail *cd) in sunrpc_cache_register_pipefs() argument
1891 struct dentry *dir = rpc_create_cache_dir(parent, name, umode, cd); in sunrpc_cache_register_pipefs()
1894 cd->pipefs = dir; in sunrpc_cache_register_pipefs()
1899 void sunrpc_cache_unregister_pipefs(struct cache_detail *cd) in sunrpc_cache_unregister_pipefs() argument
1901 if (cd->pipefs) { in sunrpc_cache_unregister_pipefs()
1902 rpc_remove_cache_dir(cd->pipefs); in sunrpc_cache_unregister_pipefs()
1903 cd->pipefs = NULL; in sunrpc_cache_unregister_pipefs()
1908 void sunrpc_cache_unhash(struct cache_detail *cd, struct cache_head *h) in sunrpc_cache_unhash() argument
1910 spin_lock(&cd->hash_lock); in sunrpc_cache_unhash()
1912 sunrpc_begin_cache_remove_entry(h, cd); in sunrpc_cache_unhash()
1913 spin_unlock(&cd->hash_lock); in sunrpc_cache_unhash()
1914 sunrpc_end_cache_remove_entry(h, cd); in sunrpc_cache_unhash()
1916 spin_unlock(&cd->hash_lock); in sunrpc_cache_unhash()