summaryrefslogtreecommitdiff
path: root/include/linux/sunrpc/cache.h
diff options
context:
space:
mode:
authorNeil Brown <neilb@cse.unsw.edu.au>2002-10-11 05:40:00 -0700
committerLinus Torvalds <torvalds@home.transmeta.com>2002-10-11 05:40:00 -0700
commitea2212232c15d28b58e817d374c7986b0190d7d4 (patch)
treeeaa024243ff1e5ab44fb706dc86f7c97c1b65ffd /include/linux/sunrpc/cache.h
parentac26cbd76d8f30304ef6790dbf631cb2da5b5cc3 (diff)
[PATCH] kNFSd: Provide support for request deferral and revisit.
cache.c gets code to allow a 'request' to be referred pending an update of a cache item, and revisited when the item is updates. svcsock.c gets code to store the relevant part of a request on deferral, and to re-queue it when the cache item that caused the deferral is filled in.
Diffstat (limited to 'include/linux/sunrpc/cache.h')
-rw-r--r--include/linux/sunrpc/cache.h24
1 files changed, 23 insertions, 1 deletions
diff --git a/include/linux/sunrpc/cache.h b/include/linux/sunrpc/cache.h
index efbf31293a6c..ef69dfa21817 100644
--- a/include/linux/sunrpc/cache.h
+++ b/include/linux/sunrpc/cache.h
@@ -86,6 +86,25 @@ struct cache_detail {
};
+/* this must be embedded in any request structure that
+ * identifies an object that will want a callback on
+ * a cache fill
+ */
+struct cache_req {
+ struct cache_deferred_req *(*defer)(struct cache_req *req);
+};
+/* this must be embedded in a deferred_request that is being
+ * delayed awaiting cache-fill
+ */
+struct cache_deferred_req {
+ struct list_head hash; /* on hash chain */
+ struct list_head recent; /* on fifo */
+ struct cache_head *item; /* cache item we wait on */
+ time_t recv_time;
+ void (*revisit)(struct cache_deferred_req *req,
+ int too_many);
+};
+
/*
* just like a template in C++, this macro does cache lookup
* for us.
@@ -206,6 +225,9 @@ RTN *FNAME ARGS \
+extern void cache_defer_req(struct cache_req *req, struct cache_head *item);
+extern void cache_revisit_request(struct cache_head *item);
+
static inline struct cache_head *cache_get(struct cache_head *h)
{
atomic_inc(&h->refcnt);
@@ -230,7 +252,7 @@ extern void cache_init(struct cache_head *h);
extern void cache_fresh(struct cache_detail *detail,
struct cache_head *head, time_t expiry);
extern int cache_check(struct cache_detail *detail,
- struct cache_head *h);
+ struct cache_head *h, struct cache_req *rqstp);
extern int cache_clean(void);
extern void cache_flush(void);
extern void cache_purge(struct cache_detail *detail);