Lines Matching refs:cd

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