Commit e7421ce7 authored by Chuck Lever's avatar Chuck Lever

NFSD: Rename struct svc_cacherep

The svc_ prefix is identified with the SunRPC layer. Although the
duplicate reply cache caches RPC replies, it is only for the NFS
protocol. Rename the struct to better reflect its purpose.
Reviewed-by: default avatarJeff Layton <jlayton@kernel.org>
Signed-off-by: default avatarChuck Lever <chuck.lever@oracle.com>
parent cb18eca4
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
* typical sockaddr_storage. This is for space reasons, since sockaddr_storage * typical sockaddr_storage. This is for space reasons, since sockaddr_storage
* is much larger than a sockaddr_in6. * is much larger than a sockaddr_in6.
*/ */
struct svc_cacherep { struct nfsd_cacherep {
struct { struct {
/* Keep often-read xid, csum in the same cache line: */ /* Keep often-read xid, csum in the same cache line: */
__be32 k_xid; __be32 k_xid;
...@@ -85,8 +85,8 @@ void nfsd_net_reply_cache_destroy(struct nfsd_net *nn); ...@@ -85,8 +85,8 @@ void nfsd_net_reply_cache_destroy(struct nfsd_net *nn);
int nfsd_reply_cache_init(struct nfsd_net *); int nfsd_reply_cache_init(struct nfsd_net *);
void nfsd_reply_cache_shutdown(struct nfsd_net *); void nfsd_reply_cache_shutdown(struct nfsd_net *);
int nfsd_cache_lookup(struct svc_rqst *rqstp, int nfsd_cache_lookup(struct svc_rqst *rqstp,
struct svc_cacherep **cacherep); struct nfsd_cacherep **cacherep);
void nfsd_cache_update(struct svc_rqst *rqstp, struct svc_cacherep *rp, void nfsd_cache_update(struct svc_rqst *rqstp, struct nfsd_cacherep *rp,
int cachetype, __be32 *statp); int cachetype, __be32 *statp);
int nfsd_reply_cache_stats_show(struct seq_file *m, void *v); int nfsd_reply_cache_stats_show(struct seq_file *m, void *v);
......
...@@ -84,11 +84,11 @@ nfsd_hashsize(unsigned int limit) ...@@ -84,11 +84,11 @@ nfsd_hashsize(unsigned int limit)
return roundup_pow_of_two(limit / TARGET_BUCKET_SIZE); return roundup_pow_of_two(limit / TARGET_BUCKET_SIZE);
} }
static struct svc_cacherep * static struct nfsd_cacherep *
nfsd_cacherep_alloc(struct svc_rqst *rqstp, __wsum csum, nfsd_cacherep_alloc(struct svc_rqst *rqstp, __wsum csum,
struct nfsd_net *nn) struct nfsd_net *nn)
{ {
struct svc_cacherep *rp; struct nfsd_cacherep *rp;
rp = kmem_cache_alloc(drc_slab, GFP_KERNEL); rp = kmem_cache_alloc(drc_slab, GFP_KERNEL);
if (rp) { if (rp) {
...@@ -110,7 +110,7 @@ nfsd_cacherep_alloc(struct svc_rqst *rqstp, __wsum csum, ...@@ -110,7 +110,7 @@ nfsd_cacherep_alloc(struct svc_rqst *rqstp, __wsum csum,
return rp; return rp;
} }
static void nfsd_cacherep_free(struct svc_cacherep *rp) static void nfsd_cacherep_free(struct nfsd_cacherep *rp)
{ {
if (rp->c_type == RC_REPLBUFF) if (rp->c_type == RC_REPLBUFF)
kfree(rp->c_replvec.iov_base); kfree(rp->c_replvec.iov_base);
...@@ -120,11 +120,11 @@ static void nfsd_cacherep_free(struct svc_cacherep *rp) ...@@ -120,11 +120,11 @@ static void nfsd_cacherep_free(struct svc_cacherep *rp)
static unsigned long static unsigned long
nfsd_cacherep_dispose(struct list_head *dispose) nfsd_cacherep_dispose(struct list_head *dispose)
{ {
struct svc_cacherep *rp; struct nfsd_cacherep *rp;
unsigned long freed = 0; unsigned long freed = 0;
while (!list_empty(dispose)) { while (!list_empty(dispose)) {
rp = list_first_entry(dispose, struct svc_cacherep, c_lru); rp = list_first_entry(dispose, struct nfsd_cacherep, c_lru);
list_del(&rp->c_lru); list_del(&rp->c_lru);
nfsd_cacherep_free(rp); nfsd_cacherep_free(rp);
freed++; freed++;
...@@ -134,7 +134,7 @@ nfsd_cacherep_dispose(struct list_head *dispose) ...@@ -134,7 +134,7 @@ nfsd_cacherep_dispose(struct list_head *dispose)
static void static void
nfsd_cacherep_unlink_locked(struct nfsd_net *nn, struct nfsd_drc_bucket *b, nfsd_cacherep_unlink_locked(struct nfsd_net *nn, struct nfsd_drc_bucket *b,
struct svc_cacherep *rp) struct nfsd_cacherep *rp)
{ {
if (rp->c_type == RC_REPLBUFF && rp->c_replvec.iov_base) if (rp->c_type == RC_REPLBUFF && rp->c_replvec.iov_base)
nfsd_stats_drc_mem_usage_sub(nn, rp->c_replvec.iov_len); nfsd_stats_drc_mem_usage_sub(nn, rp->c_replvec.iov_len);
...@@ -147,7 +147,7 @@ nfsd_cacherep_unlink_locked(struct nfsd_net *nn, struct nfsd_drc_bucket *b, ...@@ -147,7 +147,7 @@ nfsd_cacherep_unlink_locked(struct nfsd_net *nn, struct nfsd_drc_bucket *b,
} }
static void static void
nfsd_reply_cache_free_locked(struct nfsd_drc_bucket *b, struct svc_cacherep *rp, nfsd_reply_cache_free_locked(struct nfsd_drc_bucket *b, struct nfsd_cacherep *rp,
struct nfsd_net *nn) struct nfsd_net *nn)
{ {
nfsd_cacherep_unlink_locked(nn, b, rp); nfsd_cacherep_unlink_locked(nn, b, rp);
...@@ -155,7 +155,7 @@ nfsd_reply_cache_free_locked(struct nfsd_drc_bucket *b, struct svc_cacherep *rp, ...@@ -155,7 +155,7 @@ nfsd_reply_cache_free_locked(struct nfsd_drc_bucket *b, struct svc_cacherep *rp,
} }
static void static void
nfsd_reply_cache_free(struct nfsd_drc_bucket *b, struct svc_cacherep *rp, nfsd_reply_cache_free(struct nfsd_drc_bucket *b, struct nfsd_cacherep *rp,
struct nfsd_net *nn) struct nfsd_net *nn)
{ {
spin_lock(&b->cache_lock); spin_lock(&b->cache_lock);
...@@ -167,7 +167,7 @@ nfsd_reply_cache_free(struct nfsd_drc_bucket *b, struct svc_cacherep *rp, ...@@ -167,7 +167,7 @@ nfsd_reply_cache_free(struct nfsd_drc_bucket *b, struct svc_cacherep *rp,
int nfsd_drc_slab_create(void) int nfsd_drc_slab_create(void)
{ {
drc_slab = kmem_cache_create("nfsd_drc", drc_slab = kmem_cache_create("nfsd_drc",
sizeof(struct svc_cacherep), 0, 0, NULL); sizeof(struct nfsd_cacherep), 0, 0, NULL);
return drc_slab ? 0: -ENOMEM; return drc_slab ? 0: -ENOMEM;
} }
...@@ -236,7 +236,7 @@ int nfsd_reply_cache_init(struct nfsd_net *nn) ...@@ -236,7 +236,7 @@ int nfsd_reply_cache_init(struct nfsd_net *nn)
void nfsd_reply_cache_shutdown(struct nfsd_net *nn) void nfsd_reply_cache_shutdown(struct nfsd_net *nn)
{ {
struct svc_cacherep *rp; struct nfsd_cacherep *rp;
unsigned int i; unsigned int i;
unregister_shrinker(&nn->nfsd_reply_cache_shrinker); unregister_shrinker(&nn->nfsd_reply_cache_shrinker);
...@@ -244,7 +244,7 @@ void nfsd_reply_cache_shutdown(struct nfsd_net *nn) ...@@ -244,7 +244,7 @@ void nfsd_reply_cache_shutdown(struct nfsd_net *nn)
for (i = 0; i < nn->drc_hashsize; i++) { for (i = 0; i < nn->drc_hashsize; i++) {
struct list_head *head = &nn->drc_hashtbl[i].lru_head; struct list_head *head = &nn->drc_hashtbl[i].lru_head;
while (!list_empty(head)) { while (!list_empty(head)) {
rp = list_first_entry(head, struct svc_cacherep, c_lru); rp = list_first_entry(head, struct nfsd_cacherep, c_lru);
nfsd_reply_cache_free_locked(&nn->drc_hashtbl[i], nfsd_reply_cache_free_locked(&nn->drc_hashtbl[i],
rp, nn); rp, nn);
} }
...@@ -261,7 +261,7 @@ void nfsd_reply_cache_shutdown(struct nfsd_net *nn) ...@@ -261,7 +261,7 @@ void nfsd_reply_cache_shutdown(struct nfsd_net *nn)
* not already scheduled. * not already scheduled.
*/ */
static void static void
lru_put_end(struct nfsd_drc_bucket *b, struct svc_cacherep *rp) lru_put_end(struct nfsd_drc_bucket *b, struct nfsd_cacherep *rp)
{ {
rp->c_timestamp = jiffies; rp->c_timestamp = jiffies;
list_move_tail(&rp->c_lru, &b->lru_head); list_move_tail(&rp->c_lru, &b->lru_head);
...@@ -284,7 +284,7 @@ nfsd_prune_bucket_locked(struct nfsd_net *nn, struct nfsd_drc_bucket *b, ...@@ -284,7 +284,7 @@ nfsd_prune_bucket_locked(struct nfsd_net *nn, struct nfsd_drc_bucket *b,
unsigned int max, struct list_head *dispose) unsigned int max, struct list_head *dispose)
{ {
unsigned long expiry = jiffies - RC_EXPIRE; unsigned long expiry = jiffies - RC_EXPIRE;
struct svc_cacherep *rp, *tmp; struct nfsd_cacherep *rp, *tmp;
unsigned int freed = 0; unsigned int freed = 0;
lockdep_assert_held(&b->cache_lock); lockdep_assert_held(&b->cache_lock);
...@@ -402,8 +402,8 @@ nfsd_cache_csum(struct svc_rqst *rqstp) ...@@ -402,8 +402,8 @@ nfsd_cache_csum(struct svc_rqst *rqstp)
} }
static int static int
nfsd_cache_key_cmp(const struct svc_cacherep *key, nfsd_cache_key_cmp(const struct nfsd_cacherep *key,
const struct svc_cacherep *rp, struct nfsd_net *nn) const struct nfsd_cacherep *rp, struct nfsd_net *nn)
{ {
if (key->c_key.k_xid == rp->c_key.k_xid && if (key->c_key.k_xid == rp->c_key.k_xid &&
key->c_key.k_csum != rp->c_key.k_csum) { key->c_key.k_csum != rp->c_key.k_csum) {
...@@ -419,11 +419,11 @@ nfsd_cache_key_cmp(const struct svc_cacherep *key, ...@@ -419,11 +419,11 @@ nfsd_cache_key_cmp(const struct svc_cacherep *key,
* Must be called with cache_lock held. Returns the found entry or * Must be called with cache_lock held. Returns the found entry or
* inserts an empty key on failure. * inserts an empty key on failure.
*/ */
static struct svc_cacherep * static struct nfsd_cacherep *
nfsd_cache_insert(struct nfsd_drc_bucket *b, struct svc_cacherep *key, nfsd_cache_insert(struct nfsd_drc_bucket *b, struct nfsd_cacherep *key,
struct nfsd_net *nn) struct nfsd_net *nn)
{ {
struct svc_cacherep *rp, *ret = key; struct nfsd_cacherep *rp, *ret = key;
struct rb_node **p = &b->rb_head.rb_node, struct rb_node **p = &b->rb_head.rb_node,
*parent = NULL; *parent = NULL;
unsigned int entries = 0; unsigned int entries = 0;
...@@ -432,7 +432,7 @@ nfsd_cache_insert(struct nfsd_drc_bucket *b, struct svc_cacherep *key, ...@@ -432,7 +432,7 @@ nfsd_cache_insert(struct nfsd_drc_bucket *b, struct svc_cacherep *key,
while (*p != NULL) { while (*p != NULL) {
++entries; ++entries;
parent = *p; parent = *p;
rp = rb_entry(parent, struct svc_cacherep, c_node); rp = rb_entry(parent, struct nfsd_cacherep, c_node);
cmp = nfsd_cache_key_cmp(key, rp, nn); cmp = nfsd_cache_key_cmp(key, rp, nn);
if (cmp < 0) if (cmp < 0)
...@@ -478,10 +478,10 @@ nfsd_cache_insert(struct nfsd_drc_bucket *b, struct svc_cacherep *key, ...@@ -478,10 +478,10 @@ nfsd_cache_insert(struct nfsd_drc_bucket *b, struct svc_cacherep *key,
* %RC_REPLY: Reply from cache * %RC_REPLY: Reply from cache
* %RC_DROPIT: Do not process the request further * %RC_DROPIT: Do not process the request further
*/ */
int nfsd_cache_lookup(struct svc_rqst *rqstp, struct svc_cacherep **cacherep) int nfsd_cache_lookup(struct svc_rqst *rqstp, struct nfsd_cacherep **cacherep)
{ {
struct nfsd_net *nn; struct nfsd_net *nn;
struct svc_cacherep *rp, *found; struct nfsd_cacherep *rp, *found;
__wsum csum; __wsum csum;
struct nfsd_drc_bucket *b; struct nfsd_drc_bucket *b;
int type = rqstp->rq_cachetype; int type = rqstp->rq_cachetype;
...@@ -586,7 +586,7 @@ int nfsd_cache_lookup(struct svc_rqst *rqstp, struct svc_cacherep **cacherep) ...@@ -586,7 +586,7 @@ int nfsd_cache_lookup(struct svc_rqst *rqstp, struct svc_cacherep **cacherep)
* nfsd failed to encode a reply that otherwise would have been cached. * nfsd failed to encode a reply that otherwise would have been cached.
* In this case, nfsd_cache_update is called with statp == NULL. * In this case, nfsd_cache_update is called with statp == NULL.
*/ */
void nfsd_cache_update(struct svc_rqst *rqstp, struct svc_cacherep *rp, void nfsd_cache_update(struct svc_rqst *rqstp, struct nfsd_cacherep *rp,
int cachetype, __be32 *statp) int cachetype, __be32 *statp)
{ {
struct nfsd_net *nn = net_generic(SVC_NET(rqstp), nfsd_net_id); struct nfsd_net *nn = net_generic(SVC_NET(rqstp), nfsd_net_id);
......
...@@ -1046,7 +1046,7 @@ int nfsd_dispatch(struct svc_rqst *rqstp) ...@@ -1046,7 +1046,7 @@ int nfsd_dispatch(struct svc_rqst *rqstp)
{ {
const struct svc_procedure *proc = rqstp->rq_procinfo; const struct svc_procedure *proc = rqstp->rq_procinfo;
__be32 *statp = rqstp->rq_accept_statp; __be32 *statp = rqstp->rq_accept_statp;
struct svc_cacherep *rp; struct nfsd_cacherep *rp;
/* /*
* Give the xdr decoder a chance to change this if it wants * Give the xdr decoder a chance to change this if it wants
......
...@@ -1241,8 +1241,8 @@ TRACE_EVENT(nfsd_drc_found, ...@@ -1241,8 +1241,8 @@ TRACE_EVENT(nfsd_drc_found,
TRACE_EVENT(nfsd_drc_mismatch, TRACE_EVENT(nfsd_drc_mismatch,
TP_PROTO( TP_PROTO(
const struct nfsd_net *nn, const struct nfsd_net *nn,
const struct svc_cacherep *key, const struct nfsd_cacherep *key,
const struct svc_cacherep *rp const struct nfsd_cacherep *rp
), ),
TP_ARGS(nn, key, rp), TP_ARGS(nn, key, rp),
TP_STRUCT__entry( TP_STRUCT__entry(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment