Lines Matching full:cd
82 struct cache_detail *cd) in sunrpc_begin_cache_remove_entry() argument
84 /* Must be called under cd->hash_lock */ in sunrpc_begin_cache_remove_entry()
87 cd->entries --; in sunrpc_begin_cache_remove_entry()
91 struct cache_detail *cd) in sunrpc_end_cache_remove_entry() argument
93 cache_fresh_unlocked(ch, cd); in sunrpc_end_cache_remove_entry()
94 cache_put(ch, cd); in sunrpc_end_cache_remove_entry()
383 void sunrpc_init_cache_detail(struct cache_detail *cd) in sunrpc_init_cache_detail() argument
385 spin_lock_init(&cd->hash_lock); in sunrpc_init_cache_detail()
386 INIT_LIST_HEAD(&cd->queue); in sunrpc_init_cache_detail()
388 cd->nextcheck = 0; in sunrpc_init_cache_detail()
389 cd->entries = 0; in sunrpc_init_cache_detail()
390 atomic_set(&cd->writers, 0); in sunrpc_init_cache_detail()
391 cd->last_close = 0; in sunrpc_init_cache_detail()
392 cd->last_warn = -1; in sunrpc_init_cache_detail()
393 list_add(&cd->others, &cache_list); in sunrpc_init_cache_detail()
401 void sunrpc_destroy_cache_detail(struct cache_detail *cd) in sunrpc_destroy_cache_detail() argument
403 cache_purge(cd); in sunrpc_destroy_cache_detail()
405 spin_lock(&cd->hash_lock); in sunrpc_destroy_cache_detail()
406 if (current_detail == cd) in sunrpc_destroy_cache_detail()
408 list_del_init(&cd->others); in sunrpc_destroy_cache_detail()
409 spin_unlock(&cd->hash_lock); in sunrpc_destroy_cache_detail()
812 loff_t *ppos, struct cache_detail *cd) in cache_read() argument
827 while (rp->q.list.next != &cd->queue && in cache_read()
833 if (rp->q.list.next == &cd->queue) { in cache_read()
846 err = cache_request(cd, rq); in cache_read()
881 cache_put(rq->item, cd); in cache_read()
894 size_t count, struct cache_detail *cd) in cache_do_downcall() argument
903 ret = cd->cache_parse(cd, kaddr, count); in cache_do_downcall()
910 size_t count, struct cache_detail *cd) in cache_slow_downcall() argument
918 ret = cache_do_downcall(write_buf, buf, count, cd); in cache_slow_downcall()
926 size_t count, struct cache_detail *cd) in cache_downcall() argument
940 ret = cache_do_downcall(kaddr, buf, count, cd); in cache_downcall()
946 return cache_slow_downcall(buf, count, cd); in cache_downcall()
951 struct cache_detail *cd) in cache_write() argument
957 if (!cd->cache_parse) in cache_write()
961 ret = cache_downcall(mapping, buf, count, cd); in cache_write()
970 struct cache_detail *cd) in cache_poll() argument
986 for (cq= &rp->q; &cq->list != &cd->queue; in cache_poll()
998 struct cache_detail *cd) in cache_ioctl() argument
1012 for (cq= &rp->q; &cq->list != &cd->queue; in cache_ioctl()
1026 struct cache_detail *cd) in cache_open() argument
1030 if (!cd || !try_module_get(cd->owner)) in cache_open()
1036 module_put(cd->owner); in cache_open()
1043 list_add(&rp->q.list, &cd->queue); in cache_open()
1047 atomic_inc(&cd->writers); in cache_open()
1053 struct cache_detail *cd) in cache_release() argument
1061 for (cq= &rp->q; &cq->list != &cd->queue; in cache_release()
1078 atomic_dec(&cd->writers); in cache_release()
1079 cd->last_close = seconds_since_boot(); in cache_release()
1081 module_put(cd->owner); in cache_release()
1349 struct cache_detail *cd = m->private; in __cache_seq_start() local
1356 hlist_for_each_entry_rcu(ch, &cd->hash_table[hash], cache_list) in __cache_seq_start()
1363 } while(hash < cd->hash_size && in __cache_seq_start()
1364 hlist_empty(&cd->hash_table[hash])); in __cache_seq_start()
1365 if (hash >= cd->hash_size) in __cache_seq_start()
1369 hlist_first_rcu(&cd->hash_table[hash])), in __cache_seq_start()
1377 struct cache_detail *cd = m->private; in cache_seq_next() local
1391 while (hash < cd->hash_size && in cache_seq_next()
1392 hlist_empty(&cd->hash_table[hash])) { in cache_seq_next()
1396 if (hash >= cd->hash_size) in cache_seq_next()
1400 hlist_first_rcu(&cd->hash_table[hash])), in cache_seq_next()
1428 struct cache_detail *cd = m->private; in c_show() local
1431 return cd->cache_show(m, cd, NULL); in c_show()
1438 if (cache_check(cd, cp, NULL)) in c_show()
1442 if (cache_is_expired(cd, cp)) in c_show()
1444 cache_put(cp, cd); in c_show()
1447 return cd->cache_show(m, cd, cp); in c_show()
1458 struct cache_detail *cd) in content_open() argument
1463 if (!cd || !try_module_get(cd->owner)) in content_open()
1468 module_put(cd->owner); in content_open()
1473 seq->private = cd; in content_open()
1478 struct cache_detail *cd) in content_release() argument
1481 module_put(cd->owner); in content_release()
1486 struct cache_detail *cd) in open_flush() argument
1488 if (!cd || !try_module_get(cd->owner)) in open_flush()
1494 struct cache_detail *cd) in release_flush() argument
1496 module_put(cd->owner); in release_flush()
1502 struct cache_detail *cd) in read_flush() argument
1508 convert_to_wallclock(cd->flush_time)); in read_flush()
1514 struct cache_detail *cd) in write_flush() argument
1541 if (cd->flush_time >= now) in write_flush()
1542 now = cd->flush_time + 1; in write_flush()
1544 cd->flush_time = now; in write_flush()
1545 cd->nextcheck = now; in write_flush()
1548 if (cd->flush) in write_flush()
1549 cd->flush(); in write_flush()
1558 struct cache_detail *cd = PDE_DATA(file_inode(filp)); in cache_read_procfs() local
1560 return cache_read(filp, buf, count, ppos, cd); in cache_read_procfs()
1566 struct cache_detail *cd = PDE_DATA(file_inode(filp)); in cache_write_procfs() local
1568 return cache_write(filp, buf, count, ppos, cd); in cache_write_procfs()
1573 struct cache_detail *cd = PDE_DATA(file_inode(filp)); in cache_poll_procfs() local
1575 return cache_poll(filp, wait, cd); in cache_poll_procfs()
1582 struct cache_detail *cd = PDE_DATA(inode); in cache_ioctl_procfs() local
1584 return cache_ioctl(inode, filp, cmd, arg, cd); in cache_ioctl_procfs()
1589 struct cache_detail *cd = PDE_DATA(inode); in cache_open_procfs() local
1591 return cache_open(inode, filp, cd); in cache_open_procfs()
1596 struct cache_detail *cd = PDE_DATA(inode); in cache_release_procfs() local
1598 return cache_release(inode, filp, cd); in cache_release_procfs()
1613 struct cache_detail *cd = PDE_DATA(inode); in content_open_procfs() local
1615 return content_open(inode, filp, cd); in content_open_procfs()
1620 struct cache_detail *cd = PDE_DATA(inode); in content_release_procfs() local
1622 return content_release(inode, filp, cd); in content_release_procfs()
1634 struct cache_detail *cd = PDE_DATA(inode); in open_flush_procfs() local
1636 return open_flush(inode, filp, cd); in open_flush_procfs()
1641 struct cache_detail *cd = PDE_DATA(inode); in release_flush_procfs() local
1643 return release_flush(inode, filp, cd); in release_flush_procfs()
1649 struct cache_detail *cd = PDE_DATA(file_inode(filp)); in read_flush_procfs() local
1651 return read_flush(filp, buf, count, ppos, cd); in read_flush_procfs()
1658 struct cache_detail *cd = PDE_DATA(file_inode(filp)); in write_flush_procfs() local
1660 return write_flush(filp, buf, count, ppos, cd); in write_flush_procfs()
1671 static void remove_cache_proc_entries(struct cache_detail *cd) in remove_cache_proc_entries() argument
1673 if (cd->procfs) { in remove_cache_proc_entries()
1674 proc_remove(cd->procfs); in remove_cache_proc_entries()
1675 cd->procfs = NULL; in remove_cache_proc_entries()
1680 static int create_cache_proc_entries(struct cache_detail *cd, struct net *net) in create_cache_proc_entries() argument
1686 cd->procfs = proc_mkdir(cd->name, sn->proc_net_rpc); in create_cache_proc_entries()
1687 if (cd->procfs == NULL) in create_cache_proc_entries()
1691 cd->procfs, &cache_flush_proc_ops, cd); in create_cache_proc_entries()
1695 if (cd->cache_request || cd->cache_parse) { in create_cache_proc_entries()
1696 p = proc_create_data("channel", S_IFREG | 0600, cd->procfs, in create_cache_proc_entries()
1697 &cache_channel_proc_ops, cd); in create_cache_proc_entries()
1701 if (cd->cache_show) { in create_cache_proc_entries()
1702 p = proc_create_data("content", S_IFREG | 0400, cd->procfs, in create_cache_proc_entries()
1703 &content_proc_ops, cd); in create_cache_proc_entries()
1709 remove_cache_proc_entries(cd); in create_cache_proc_entries()
1713 static int create_cache_proc_entries(struct cache_detail *cd, struct net *net) in create_cache_proc_entries() argument
1724 int cache_register_net(struct cache_detail *cd, struct net *net) in cache_register_net() argument
1728 sunrpc_init_cache_detail(cd); in cache_register_net()
1729 ret = create_cache_proc_entries(cd, net); in cache_register_net()
1731 sunrpc_destroy_cache_detail(cd); in cache_register_net()
1736 void cache_unregister_net(struct cache_detail *cd, struct net *net) in cache_unregister_net() argument
1738 remove_cache_proc_entries(cd); in cache_unregister_net()
1739 sunrpc_destroy_cache_detail(cd); in cache_unregister_net()
1745 struct cache_detail *cd; in cache_create_net() local
1748 cd = kmemdup(tmpl, sizeof(struct cache_detail), GFP_KERNEL); in cache_create_net()
1749 if (cd == NULL) in cache_create_net()
1752 cd->hash_table = kcalloc(cd->hash_size, sizeof(struct hlist_head), in cache_create_net()
1754 if (cd->hash_table == NULL) { in cache_create_net()
1755 kfree(cd); in cache_create_net()
1759 for (i = 0; i < cd->hash_size; i++) in cache_create_net()
1760 INIT_HLIST_HEAD(&cd->hash_table[i]); in cache_create_net()
1761 cd->net = net; in cache_create_net()
1762 return cd; in cache_create_net()
1766 void cache_destroy_net(struct cache_detail *cd, struct net *net) in cache_destroy_net() argument
1768 kfree(cd->hash_table); in cache_destroy_net()
1769 kfree(cd); in cache_destroy_net()
1776 struct cache_detail *cd = RPC_I(file_inode(filp))->private; in cache_read_pipefs() local
1778 return cache_read(filp, buf, count, ppos, cd); in cache_read_pipefs()
1784 struct cache_detail *cd = RPC_I(file_inode(filp))->private; in cache_write_pipefs() local
1786 return cache_write(filp, buf, count, ppos, cd); in cache_write_pipefs()
1791 struct cache_detail *cd = RPC_I(file_inode(filp))->private; in cache_poll_pipefs() local
1793 return cache_poll(filp, wait, cd); in cache_poll_pipefs()
1800 struct cache_detail *cd = RPC_I(inode)->private; in cache_ioctl_pipefs() local
1802 return cache_ioctl(inode, filp, cmd, arg, cd); in cache_ioctl_pipefs()
1807 struct cache_detail *cd = RPC_I(inode)->private; in cache_open_pipefs() local
1809 return cache_open(inode, filp, cd); in cache_open_pipefs()
1814 struct cache_detail *cd = RPC_I(inode)->private; in cache_release_pipefs() local
1816 return cache_release(inode, filp, cd); in cache_release_pipefs()
1832 struct cache_detail *cd = RPC_I(inode)->private; in content_open_pipefs() local
1834 return content_open(inode, filp, cd); in content_open_pipefs()
1839 struct cache_detail *cd = RPC_I(inode)->private; in content_release_pipefs() local
1841 return content_release(inode, filp, cd); in content_release_pipefs()
1853 struct cache_detail *cd = RPC_I(inode)->private; in open_flush_pipefs() local
1855 return open_flush(inode, filp, cd); in open_flush_pipefs()
1860 struct cache_detail *cd = RPC_I(inode)->private; in release_flush_pipefs() local
1862 return release_flush(inode, filp, cd); in release_flush_pipefs()
1868 struct cache_detail *cd = RPC_I(file_inode(filp))->private; in read_flush_pipefs() local
1870 return read_flush(filp, buf, count, ppos, cd); in read_flush_pipefs()
1877 struct cache_detail *cd = RPC_I(file_inode(filp))->private; in write_flush_pipefs() local
1879 return write_flush(filp, buf, count, ppos, cd); in write_flush_pipefs()
1892 struct cache_detail *cd) in sunrpc_cache_register_pipefs() argument
1894 struct dentry *dir = rpc_create_cache_dir(parent, name, umode, cd); in sunrpc_cache_register_pipefs()
1897 cd->pipefs = dir; in sunrpc_cache_register_pipefs()
1902 void sunrpc_cache_unregister_pipefs(struct cache_detail *cd) in sunrpc_cache_unregister_pipefs() argument
1904 if (cd->pipefs) { in sunrpc_cache_unregister_pipefs()
1905 rpc_remove_cache_dir(cd->pipefs); in sunrpc_cache_unregister_pipefs()
1906 cd->pipefs = NULL; in sunrpc_cache_unregister_pipefs()
1911 void sunrpc_cache_unhash(struct cache_detail *cd, struct cache_head *h) in sunrpc_cache_unhash() argument
1913 spin_lock(&cd->hash_lock); in sunrpc_cache_unhash()
1915 sunrpc_begin_cache_remove_entry(h, cd); in sunrpc_cache_unhash()
1916 spin_unlock(&cd->hash_lock); in sunrpc_cache_unhash()
1917 sunrpc_end_cache_remove_entry(h, cd); in sunrpc_cache_unhash()
1919 spin_unlock(&cd->hash_lock); in sunrpc_cache_unhash()