Lines Matching refs:cd

192 static int cache_make_upcall(struct cache_detail *cd, struct cache_head *h)  in cache_make_upcall()  argument
194 if (cd->cache_upcall) in cache_make_upcall()
195 return cd->cache_upcall(cd, h); in cache_make_upcall()
196 return sunrpc_cache_pipe_upcall(cd, h); in cache_make_upcall()
339 void sunrpc_init_cache_detail(struct cache_detail *cd) in sunrpc_init_cache_detail() argument
341 rwlock_init(&cd->hash_lock); in sunrpc_init_cache_detail()
342 INIT_LIST_HEAD(&cd->queue); in sunrpc_init_cache_detail()
344 cd->nextcheck = 0; in sunrpc_init_cache_detail()
345 cd->entries = 0; in sunrpc_init_cache_detail()
346 atomic_set(&cd->readers, 0); in sunrpc_init_cache_detail()
347 cd->last_close = 0; in sunrpc_init_cache_detail()
348 cd->last_warn = -1; in sunrpc_init_cache_detail()
349 list_add(&cd->others, &cache_list); in sunrpc_init_cache_detail()
357 void sunrpc_destroy_cache_detail(struct cache_detail *cd) in sunrpc_destroy_cache_detail() argument
359 cache_purge(cd); in sunrpc_destroy_cache_detail()
361 write_lock(&cd->hash_lock); in sunrpc_destroy_cache_detail()
362 if (cd->entries || atomic_read(&cd->inuse)) { in sunrpc_destroy_cache_detail()
363 write_unlock(&cd->hash_lock); in sunrpc_destroy_cache_detail()
367 if (current_detail == cd) in sunrpc_destroy_cache_detail()
369 list_del_init(&cd->others); in sunrpc_destroy_cache_detail()
370 write_unlock(&cd->hash_lock); in sunrpc_destroy_cache_detail()
378 printk(KERN_ERR "RPC: failed to unregister %s cache\n", cd->name); in sunrpc_destroy_cache_detail()
757 loff_t *ppos, struct cache_detail *cd) in cache_read() argument
772 while (rp->q.list.next != &cd->queue && in cache_read()
778 if (rp->q.list.next == &cd->queue) { in cache_read()
791 err = cache_request(cd, rq); in cache_read()
826 cache_put(rq->item, cd); in cache_read()
839 size_t count, struct cache_detail *cd) in cache_do_downcall() argument
848 ret = cd->cache_parse(cd, kaddr, count); in cache_do_downcall()
855 size_t count, struct cache_detail *cd) in cache_slow_downcall() argument
863 ret = cache_do_downcall(write_buf, buf, count, cd); in cache_slow_downcall()
871 size_t count, struct cache_detail *cd) in cache_downcall() argument
885 ret = cache_do_downcall(kaddr, buf, count, cd); in cache_downcall()
891 return cache_slow_downcall(buf, count, cd); in cache_downcall()
896 struct cache_detail *cd) in cache_write() argument
902 if (!cd->cache_parse) in cache_write()
906 ret = cache_downcall(mapping, buf, count, cd); in cache_write()
915 struct cache_detail *cd) in cache_poll() argument
931 for (cq= &rp->q; &cq->list != &cd->queue; in cache_poll()
943 struct cache_detail *cd) in cache_ioctl() argument
957 for (cq= &rp->q; &cq->list != &cd->queue; in cache_ioctl()
971 struct cache_detail *cd) in cache_open() argument
975 if (!cd || !try_module_get(cd->owner)) in cache_open()
981 module_put(cd->owner); in cache_open()
986 atomic_inc(&cd->readers); in cache_open()
988 list_add(&rp->q.list, &cd->queue); in cache_open()
996 struct cache_detail *cd) in cache_release() argument
1004 for (cq= &rp->q; &cq->list != &cd->queue; in cache_release()
1019 cd->last_close = seconds_since_boot(); in cache_release()
1020 atomic_dec(&cd->readers); in cache_release()
1022 module_put(cd->owner); in cache_release()
1274 struct cache_detail *cd; member
1278 __acquires(cd->hash_lock) in c_start()
1283 struct cache_detail *cd = ((struct handle*)m->private)->cd; in c_start() local
1286 read_lock(&cd->hash_lock); in c_start()
1292 for (ch=cd->hash_table[hash]; ch; ch=ch->next) in c_start()
1299 } while(hash < cd->hash_size && in c_start()
1300 cd->hash_table[hash]==NULL); in c_start()
1301 if (hash >= cd->hash_size) in c_start()
1304 return cd->hash_table[hash]; in c_start()
1311 struct cache_detail *cd = ((struct handle*)m->private)->cd; in c_next() local
1323 while (hash < cd->hash_size && in c_next()
1324 cd->hash_table[hash] == NULL) { in c_next()
1328 if (hash >= cd->hash_size) in c_next()
1331 return cd->hash_table[hash]; in c_next()
1335 __releases(cd->hash_lock) in c_stop()
1337 struct cache_detail *cd = ((struct handle*)m->private)->cd; in c_stop() local
1338 read_unlock(&cd->hash_lock); in c_stop()
1344 struct cache_detail *cd = ((struct handle*)m->private)->cd; in c_show() local
1347 return cd->cache_show(m, cd, NULL); in c_show()
1354 if (cache_check(cd, cp, NULL)) in c_show()
1358 if (cache_is_expired(cd, cp)) in c_show()
1360 cache_put(cp, cd); in c_show()
1363 return cd->cache_show(m, cd, cp); in c_show()
1374 struct cache_detail *cd) in content_open() argument
1378 if (!cd || !try_module_get(cd->owner)) in content_open()
1382 module_put(cd->owner); in content_open()
1386 han->cd = cd; in content_open()
1391 struct cache_detail *cd) in content_release() argument
1394 module_put(cd->owner); in content_release()
1399 struct cache_detail *cd) in open_flush() argument
1401 if (!cd || !try_module_get(cd->owner)) in open_flush()
1407 struct cache_detail *cd) in release_flush() argument
1409 module_put(cd->owner); in release_flush()
1415 struct cache_detail *cd) in read_flush() argument
1421 snprintf(tbuf, sizeof(tbuf), "%lu\n", convert_to_wallclock(cd->flush_time)); in read_flush()
1436 struct cache_detail *cd) in write_flush() argument
1451 cd->flush_time = get_expiry(&bp); in write_flush()
1452 cd->nextcheck = seconds_since_boot(); in write_flush()
1462 struct cache_detail *cd = PDE_DATA(file_inode(filp)); in cache_read_procfs() local
1464 return cache_read(filp, buf, count, ppos, cd); in cache_read_procfs()
1470 struct cache_detail *cd = PDE_DATA(file_inode(filp)); in cache_write_procfs() local
1472 return cache_write(filp, buf, count, ppos, cd); in cache_write_procfs()
1477 struct cache_detail *cd = PDE_DATA(file_inode(filp)); in cache_poll_procfs() local
1479 return cache_poll(filp, wait, cd); in cache_poll_procfs()
1486 struct cache_detail *cd = PDE_DATA(inode); in cache_ioctl_procfs() local
1488 return cache_ioctl(inode, filp, cmd, arg, cd); in cache_ioctl_procfs()
1493 struct cache_detail *cd = PDE_DATA(inode); in cache_open_procfs() local
1495 return cache_open(inode, filp, cd); in cache_open_procfs()
1500 struct cache_detail *cd = PDE_DATA(inode); in cache_release_procfs() local
1502 return cache_release(inode, filp, cd); in cache_release_procfs()
1518 struct cache_detail *cd = PDE_DATA(inode); in content_open_procfs() local
1520 return content_open(inode, filp, cd); in content_open_procfs()
1525 struct cache_detail *cd = PDE_DATA(inode); in content_release_procfs() local
1527 return content_release(inode, filp, cd); in content_release_procfs()
1539 struct cache_detail *cd = PDE_DATA(inode); in open_flush_procfs() local
1541 return open_flush(inode, filp, cd); in open_flush_procfs()
1546 struct cache_detail *cd = PDE_DATA(inode); in release_flush_procfs() local
1548 return release_flush(inode, filp, cd); in release_flush_procfs()
1554 struct cache_detail *cd = PDE_DATA(file_inode(filp)); in read_flush_procfs() local
1556 return read_flush(filp, buf, count, ppos, cd); in read_flush_procfs()
1563 struct cache_detail *cd = PDE_DATA(file_inode(filp)); in write_flush_procfs() local
1565 return write_flush(filp, buf, count, ppos, cd); in write_flush_procfs()
1576 static void remove_cache_proc_entries(struct cache_detail *cd, struct net *net) in remove_cache_proc_entries() argument
1580 if (cd->u.procfs.proc_ent == NULL) in remove_cache_proc_entries()
1582 if (cd->u.procfs.flush_ent) in remove_cache_proc_entries()
1583 remove_proc_entry("flush", cd->u.procfs.proc_ent); in remove_cache_proc_entries()
1584 if (cd->u.procfs.channel_ent) in remove_cache_proc_entries()
1585 remove_proc_entry("channel", cd->u.procfs.proc_ent); in remove_cache_proc_entries()
1586 if (cd->u.procfs.content_ent) in remove_cache_proc_entries()
1587 remove_proc_entry("content", cd->u.procfs.proc_ent); in remove_cache_proc_entries()
1588 cd->u.procfs.proc_ent = NULL; in remove_cache_proc_entries()
1590 remove_proc_entry(cd->name, sn->proc_net_rpc); in remove_cache_proc_entries()
1594 static int create_cache_proc_entries(struct cache_detail *cd, struct net *net) in create_cache_proc_entries() argument
1600 cd->u.procfs.proc_ent = proc_mkdir(cd->name, sn->proc_net_rpc); in create_cache_proc_entries()
1601 if (cd->u.procfs.proc_ent == NULL) in create_cache_proc_entries()
1603 cd->u.procfs.channel_ent = NULL; in create_cache_proc_entries()
1604 cd->u.procfs.content_ent = NULL; in create_cache_proc_entries()
1607 cd->u.procfs.proc_ent, in create_cache_proc_entries()
1608 &cache_flush_operations_procfs, cd); in create_cache_proc_entries()
1609 cd->u.procfs.flush_ent = p; in create_cache_proc_entries()
1613 if (cd->cache_request || cd->cache_parse) { in create_cache_proc_entries()
1615 cd->u.procfs.proc_ent, in create_cache_proc_entries()
1616 &cache_file_operations_procfs, cd); in create_cache_proc_entries()
1617 cd->u.procfs.channel_ent = p; in create_cache_proc_entries()
1621 if (cd->cache_show) { in create_cache_proc_entries()
1623 cd->u.procfs.proc_ent, in create_cache_proc_entries()
1624 &content_file_operations_procfs, cd); in create_cache_proc_entries()
1625 cd->u.procfs.content_ent = p; in create_cache_proc_entries()
1631 remove_cache_proc_entries(cd, net); in create_cache_proc_entries()
1635 static int create_cache_proc_entries(struct cache_detail *cd, struct net *net) in create_cache_proc_entries() argument
1646 int cache_register_net(struct cache_detail *cd, struct net *net) in cache_register_net() argument
1650 sunrpc_init_cache_detail(cd); in cache_register_net()
1651 ret = create_cache_proc_entries(cd, net); in cache_register_net()
1653 sunrpc_destroy_cache_detail(cd); in cache_register_net()
1658 void cache_unregister_net(struct cache_detail *cd, struct net *net) in cache_unregister_net() argument
1660 remove_cache_proc_entries(cd, net); in cache_unregister_net()
1661 sunrpc_destroy_cache_detail(cd); in cache_unregister_net()
1667 struct cache_detail *cd; in cache_create_net() local
1669 cd = kmemdup(tmpl, sizeof(struct cache_detail), GFP_KERNEL); in cache_create_net()
1670 if (cd == NULL) in cache_create_net()
1673 cd->hash_table = kzalloc(cd->hash_size * sizeof(struct cache_head *), in cache_create_net()
1675 if (cd->hash_table == NULL) { in cache_create_net()
1676 kfree(cd); in cache_create_net()
1679 cd->net = net; in cache_create_net()
1680 return cd; in cache_create_net()
1684 void cache_destroy_net(struct cache_detail *cd, struct net *net) in cache_destroy_net() argument
1686 kfree(cd->hash_table); in cache_destroy_net()
1687 kfree(cd); in cache_destroy_net()
1694 struct cache_detail *cd = RPC_I(file_inode(filp))->private; in cache_read_pipefs() local
1696 return cache_read(filp, buf, count, ppos, cd); in cache_read_pipefs()
1702 struct cache_detail *cd = RPC_I(file_inode(filp))->private; in cache_write_pipefs() local
1704 return cache_write(filp, buf, count, ppos, cd); in cache_write_pipefs()
1709 struct cache_detail *cd = RPC_I(file_inode(filp))->private; in cache_poll_pipefs() local
1711 return cache_poll(filp, wait, cd); in cache_poll_pipefs()
1718 struct cache_detail *cd = RPC_I(inode)->private; in cache_ioctl_pipefs() local
1720 return cache_ioctl(inode, filp, cmd, arg, cd); in cache_ioctl_pipefs()
1725 struct cache_detail *cd = RPC_I(inode)->private; in cache_open_pipefs() local
1727 return cache_open(inode, filp, cd); in cache_open_pipefs()
1732 struct cache_detail *cd = RPC_I(inode)->private; in cache_release_pipefs() local
1734 return cache_release(inode, filp, cd); in cache_release_pipefs()
1750 struct cache_detail *cd = RPC_I(inode)->private; in content_open_pipefs() local
1752 return content_open(inode, filp, cd); in content_open_pipefs()
1757 struct cache_detail *cd = RPC_I(inode)->private; in content_release_pipefs() local
1759 return content_release(inode, filp, cd); in content_release_pipefs()
1771 struct cache_detail *cd = RPC_I(inode)->private; in open_flush_pipefs() local
1773 return open_flush(inode, filp, cd); in open_flush_pipefs()
1778 struct cache_detail *cd = RPC_I(inode)->private; in release_flush_pipefs() local
1780 return release_flush(inode, filp, cd); in release_flush_pipefs()
1786 struct cache_detail *cd = RPC_I(file_inode(filp))->private; in read_flush_pipefs() local
1788 return read_flush(filp, buf, count, ppos, cd); in read_flush_pipefs()
1795 struct cache_detail *cd = RPC_I(file_inode(filp))->private; in write_flush_pipefs() local
1797 return write_flush(filp, buf, count, ppos, cd); in write_flush_pipefs()
1810 struct cache_detail *cd) in sunrpc_cache_register_pipefs() argument
1812 struct dentry *dir = rpc_create_cache_dir(parent, name, umode, cd); in sunrpc_cache_register_pipefs()
1815 cd->u.pipefs.dir = dir; in sunrpc_cache_register_pipefs()
1820 void sunrpc_cache_unregister_pipefs(struct cache_detail *cd) in sunrpc_cache_unregister_pipefs() argument
1822 rpc_remove_cache_dir(cd->u.pipefs.dir); in sunrpc_cache_unregister_pipefs()
1823 cd->u.pipefs.dir = NULL; in sunrpc_cache_unregister_pipefs()