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()
811 loff_t *ppos, struct cache_detail *cd) in cache_read() argument
826 while (rp->q.list.next != &cd->queue && in cache_read()
832 if (rp->q.list.next == &cd->queue) { in cache_read()
845 err = cache_request(cd, rq); in cache_read()
880 cache_put(rq->item, cd); in cache_read()
893 size_t count, struct cache_detail *cd) in cache_do_downcall() argument
902 ret = cd->cache_parse(cd, kaddr, count); in cache_do_downcall()
910 size_t count, struct cache_detail *cd) in cache_downcall() argument
924 ret = cache_do_downcall(write_buf, buf, count, cd); in cache_downcall()
932 struct cache_detail *cd) in cache_write() argument
938 if (!cd->cache_parse) in cache_write()
942 ret = cache_downcall(mapping, buf, count, cd); in cache_write()
951 struct cache_detail *cd) in cache_poll() argument
967 for (cq= &rp->q; &cq->list != &cd->queue; in cache_poll()
979 struct cache_detail *cd) in cache_ioctl() argument
993 for (cq= &rp->q; &cq->list != &cd->queue; in cache_ioctl()
1007 struct cache_detail *cd) in cache_open() argument
1011 if (!cd || !try_module_get(cd->owner)) in cache_open()
1017 module_put(cd->owner); in cache_open()
1024 list_add(&rp->q.list, &cd->queue); in cache_open()
1028 atomic_inc(&cd->writers); in cache_open()
1034 struct cache_detail *cd) in cache_release() argument
1042 for (cq= &rp->q; &cq->list != &cd->queue; in cache_release()
1059 atomic_dec(&cd->writers); in cache_release()
1060 cd->last_close = seconds_since_boot(); in cache_release()
1062 module_put(cd->owner); in cache_release()
1330 struct cache_detail *cd = m->private; in __cache_seq_start() local
1337 hlist_for_each_entry_rcu(ch, &cd->hash_table[hash], cache_list) in __cache_seq_start()
1344 } while(hash < cd->hash_size && in __cache_seq_start()
1345 hlist_empty(&cd->hash_table[hash])); in __cache_seq_start()
1346 if (hash >= cd->hash_size) in __cache_seq_start()
1350 hlist_first_rcu(&cd->hash_table[hash])), in __cache_seq_start()
1358 struct cache_detail *cd = m->private; in cache_seq_next() local
1372 while (hash < cd->hash_size && in cache_seq_next()
1373 hlist_empty(&cd->hash_table[hash])) { in cache_seq_next()
1377 if (hash >= cd->hash_size) in cache_seq_next()
1381 hlist_first_rcu(&cd->hash_table[hash])), in cache_seq_next()
1409 struct cache_detail *cd = m->private; in c_show() local
1412 return cd->cache_show(m, cd, NULL); in c_show()
1419 if (cache_check(cd, cp, NULL)) in c_show()
1423 if (cache_is_expired(cd, cp)) in c_show()
1425 cache_put(cp, cd); in c_show()
1428 return cd->cache_show(m, cd, cp); in c_show()
1439 struct cache_detail *cd) in content_open() argument
1444 if (!cd || !try_module_get(cd->owner)) in content_open()
1449 module_put(cd->owner); in content_open()
1454 seq->private = cd; in content_open()
1459 struct cache_detail *cd) in content_release() argument
1462 module_put(cd->owner); in content_release()
1467 struct cache_detail *cd) in open_flush() argument
1469 if (!cd || !try_module_get(cd->owner)) in open_flush()
1475 struct cache_detail *cd) in release_flush() argument
1477 module_put(cd->owner); in release_flush()
1483 struct cache_detail *cd) in read_flush() argument
1489 convert_to_wallclock(cd->flush_time)); in read_flush()
1495 struct cache_detail *cd) in write_flush() argument
1522 if (cd->flush_time >= now) in write_flush()
1523 now = cd->flush_time + 1; in write_flush()
1525 cd->flush_time = now; in write_flush()
1526 cd->nextcheck = now; in write_flush()
1529 if (cd->flush) in write_flush()
1530 cd->flush(); in write_flush()
1539 struct cache_detail *cd = PDE_DATA(file_inode(filp)); in cache_read_procfs() local
1541 return cache_read(filp, buf, count, ppos, cd); in cache_read_procfs()
1547 struct cache_detail *cd = PDE_DATA(file_inode(filp)); in cache_write_procfs() local
1549 return cache_write(filp, buf, count, ppos, cd); in cache_write_procfs()
1554 struct cache_detail *cd = PDE_DATA(file_inode(filp)); in cache_poll_procfs() local
1556 return cache_poll(filp, wait, cd); in cache_poll_procfs()
1563 struct cache_detail *cd = PDE_DATA(inode); in cache_ioctl_procfs() local
1565 return cache_ioctl(inode, filp, cmd, arg, cd); in cache_ioctl_procfs()
1570 struct cache_detail *cd = PDE_DATA(inode); in cache_open_procfs() local
1572 return cache_open(inode, filp, cd); in cache_open_procfs()
1577 struct cache_detail *cd = PDE_DATA(inode); in cache_release_procfs() local
1579 return cache_release(inode, filp, cd); in cache_release_procfs()
1594 struct cache_detail *cd = PDE_DATA(inode); in content_open_procfs() local
1596 return content_open(inode, filp, cd); in content_open_procfs()
1601 struct cache_detail *cd = PDE_DATA(inode); in content_release_procfs() local
1603 return content_release(inode, filp, cd); in content_release_procfs()
1615 struct cache_detail *cd = PDE_DATA(inode); in open_flush_procfs() local
1617 return open_flush(inode, filp, cd); in open_flush_procfs()
1622 struct cache_detail *cd = PDE_DATA(inode); in release_flush_procfs() local
1624 return release_flush(inode, filp, cd); in release_flush_procfs()
1630 struct cache_detail *cd = PDE_DATA(file_inode(filp)); in read_flush_procfs() local
1632 return read_flush(filp, buf, count, ppos, cd); in read_flush_procfs()
1639 struct cache_detail *cd = PDE_DATA(file_inode(filp)); in write_flush_procfs() local
1641 return write_flush(filp, buf, count, ppos, cd); in write_flush_procfs()
1652 static void remove_cache_proc_entries(struct cache_detail *cd) in remove_cache_proc_entries() argument
1654 if (cd->procfs) { in remove_cache_proc_entries()
1655 proc_remove(cd->procfs); in remove_cache_proc_entries()
1656 cd->procfs = NULL; in remove_cache_proc_entries()
1661 static int create_cache_proc_entries(struct cache_detail *cd, struct net *net) in create_cache_proc_entries() argument
1667 cd->procfs = proc_mkdir(cd->name, sn->proc_net_rpc); in create_cache_proc_entries()
1668 if (cd->procfs == NULL) in create_cache_proc_entries()
1672 cd->procfs, &cache_flush_proc_ops, cd); in create_cache_proc_entries()
1676 if (cd->cache_request || cd->cache_parse) { in create_cache_proc_entries()
1677 p = proc_create_data("channel", S_IFREG | 0600, cd->procfs, in create_cache_proc_entries()
1678 &cache_channel_proc_ops, cd); in create_cache_proc_entries()
1682 if (cd->cache_show) { in create_cache_proc_entries()
1683 p = proc_create_data("content", S_IFREG | 0400, cd->procfs, in create_cache_proc_entries()
1684 &content_proc_ops, cd); in create_cache_proc_entries()
1690 remove_cache_proc_entries(cd); in create_cache_proc_entries()
1694 static int create_cache_proc_entries(struct cache_detail *cd, struct net *net) in create_cache_proc_entries() argument
1705 int cache_register_net(struct cache_detail *cd, struct net *net) in cache_register_net() argument
1709 sunrpc_init_cache_detail(cd); in cache_register_net()
1710 ret = create_cache_proc_entries(cd, net); in cache_register_net()
1712 sunrpc_destroy_cache_detail(cd); in cache_register_net()
1717 void cache_unregister_net(struct cache_detail *cd, struct net *net) in cache_unregister_net() argument
1719 remove_cache_proc_entries(cd); in cache_unregister_net()
1720 sunrpc_destroy_cache_detail(cd); in cache_unregister_net()
1726 struct cache_detail *cd; in cache_create_net() local
1729 cd = kmemdup(tmpl, sizeof(struct cache_detail), GFP_KERNEL); in cache_create_net()
1730 if (cd == NULL) in cache_create_net()
1733 cd->hash_table = kcalloc(cd->hash_size, sizeof(struct hlist_head), in cache_create_net()
1735 if (cd->hash_table == NULL) { in cache_create_net()
1736 kfree(cd); in cache_create_net()
1740 for (i = 0; i < cd->hash_size; i++) in cache_create_net()
1741 INIT_HLIST_HEAD(&cd->hash_table[i]); in cache_create_net()
1742 cd->net = net; in cache_create_net()
1743 return cd; in cache_create_net()
1747 void cache_destroy_net(struct cache_detail *cd, struct net *net) in cache_destroy_net() argument
1749 kfree(cd->hash_table); in cache_destroy_net()
1750 kfree(cd); in cache_destroy_net()
1757 struct cache_detail *cd = RPC_I(file_inode(filp))->private; in cache_read_pipefs() local
1759 return cache_read(filp, buf, count, ppos, cd); in cache_read_pipefs()
1765 struct cache_detail *cd = RPC_I(file_inode(filp))->private; in cache_write_pipefs() local
1767 return cache_write(filp, buf, count, ppos, cd); in cache_write_pipefs()
1772 struct cache_detail *cd = RPC_I(file_inode(filp))->private; in cache_poll_pipefs() local
1774 return cache_poll(filp, wait, cd); in cache_poll_pipefs()
1781 struct cache_detail *cd = RPC_I(inode)->private; in cache_ioctl_pipefs() local
1783 return cache_ioctl(inode, filp, cmd, arg, cd); in cache_ioctl_pipefs()
1788 struct cache_detail *cd = RPC_I(inode)->private; in cache_open_pipefs() local
1790 return cache_open(inode, filp, cd); in cache_open_pipefs()
1795 struct cache_detail *cd = RPC_I(inode)->private; in cache_release_pipefs() local
1797 return cache_release(inode, filp, cd); in cache_release_pipefs()
1813 struct cache_detail *cd = RPC_I(inode)->private; in content_open_pipefs() local
1815 return content_open(inode, filp, cd); in content_open_pipefs()
1820 struct cache_detail *cd = RPC_I(inode)->private; in content_release_pipefs() local
1822 return content_release(inode, filp, cd); in content_release_pipefs()
1834 struct cache_detail *cd = RPC_I(inode)->private; in open_flush_pipefs() local
1836 return open_flush(inode, filp, cd); in open_flush_pipefs()
1841 struct cache_detail *cd = RPC_I(inode)->private; in release_flush_pipefs() local
1843 return release_flush(inode, filp, cd); in release_flush_pipefs()
1849 struct cache_detail *cd = RPC_I(file_inode(filp))->private; in read_flush_pipefs() local
1851 return read_flush(filp, buf, count, ppos, cd); in read_flush_pipefs()
1858 struct cache_detail *cd = RPC_I(file_inode(filp))->private; in write_flush_pipefs() local
1860 return write_flush(filp, buf, count, ppos, cd); in write_flush_pipefs()
1873 struct cache_detail *cd) in sunrpc_cache_register_pipefs() argument
1875 struct dentry *dir = rpc_create_cache_dir(parent, name, umode, cd); in sunrpc_cache_register_pipefs()
1878 cd->pipefs = dir; in sunrpc_cache_register_pipefs()
1883 void sunrpc_cache_unregister_pipefs(struct cache_detail *cd) in sunrpc_cache_unregister_pipefs() argument
1885 if (cd->pipefs) { in sunrpc_cache_unregister_pipefs()
1886 rpc_remove_cache_dir(cd->pipefs); in sunrpc_cache_unregister_pipefs()
1887 cd->pipefs = NULL; in sunrpc_cache_unregister_pipefs()
1892 void sunrpc_cache_unhash(struct cache_detail *cd, struct cache_head *h) in sunrpc_cache_unhash() argument
1894 spin_lock(&cd->hash_lock); in sunrpc_cache_unhash()
1896 sunrpc_begin_cache_remove_entry(h, cd); in sunrpc_cache_unhash()
1897 spin_unlock(&cd->hash_lock); in sunrpc_cache_unhash()
1898 sunrpc_end_cache_remove_entry(h, cd); in sunrpc_cache_unhash()
1900 spin_unlock(&cd->hash_lock); in sunrpc_cache_unhash()