From: Kinglong Mee <kinglongmee-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: Al Viro <viro-RmSDqhL/yNMiFSDQTTA3OLVCufUGDwFn@public.gmane.org>,
"J. Bruce Fields"
<bfields-uC3wQj2KruNg9hUCZPvPmw@public.gmane.org>,
"linux-nfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
<linux-nfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
linux-fsdevel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Cc: NeilBrown <neilb-l3A5Bk7waGM@public.gmane.org>,
Trond Myklebust
<trond.myklebust-7I+n7zu2hftEKMMhf/gKZA@public.gmane.org>,
kinglongmee-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
Subject: [PATCH 08/10] sunrpc: New helper cache_delete_entry for deleting cache_head directly
Date: Thu, 25 Jun 2015 22:34:18 +0800 [thread overview]
Message-ID: <558C116A.2080609@gmail.com> (raw)
In-Reply-To: <558C0D6A.9050104-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
A new helper cache_delete_entry() for delete cache_head from
cache_detail directly.
It will be used by pin_kill, so make sure the cache_detail is valid
before deleting is needed.
Because pin_kill is not many times,
so the influence of performance is accepted.
Signed-off-by: Kinglong Mee <kinglongmee-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
---
include/linux/sunrpc/cache.h | 1 +
net/sunrpc/cache.c | 30 ++++++++++++++++++++++++++++++
2 files changed, 31 insertions(+)
diff --git a/include/linux/sunrpc/cache.h b/include/linux/sunrpc/cache.h
index ecc0ff6..5a4b921 100644
--- a/include/linux/sunrpc/cache.h
+++ b/include/linux/sunrpc/cache.h
@@ -210,6 +210,7 @@ extern int cache_check(struct cache_detail *detail,
struct cache_head *h, struct cache_req *rqstp);
extern void cache_flush(void);
extern void cache_purge(struct cache_detail *detail);
+extern void cache_delete_entry(struct cache_detail *cd, struct cache_head *h);
#define NEVER (0x7FFFFFFF)
extern void __init cache_initialize(void);
extern int cache_register_net(struct cache_detail *cd, struct net *net);
diff --git a/net/sunrpc/cache.c b/net/sunrpc/cache.c
index ad2155c..8a27483 100644
--- a/net/sunrpc/cache.c
+++ b/net/sunrpc/cache.c
@@ -458,6 +458,36 @@ static int cache_clean(void)
return rv;
}
+void cache_delete_entry(struct cache_detail *detail, struct cache_head *h)
+{
+ struct cache_detail *tmp;
+
+ if (!detail || !h)
+ return;
+
+ spin_lock(&cache_list_lock);
+ list_for_each_entry(tmp, &cache_list, others) {
+ if (tmp == detail)
+ goto found;
+ }
+ spin_unlock(&cache_list_lock);
+ printk(KERN_WARNING "%s: Deleted cache detail %p\n", __func__, detail);
+ return ;
+
+found:
+ write_lock(&detail->hash_lock);
+
+ list_del_init(&h->cache_list);
+ detail->entries--;
+ set_bit(CACHE_CLEANED, &h->flags);
+
+ write_unlock(&detail->hash_lock);
+ spin_unlock(&cache_list_lock);
+
+ cache_put(h, detail);
+}
+EXPORT_SYMBOL_GPL(cache_delete_entry);
+
/*
* We want to regularly clean the cache, so we need to schedule some work ...
*/
--
2.4.3
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2015-06-25 14:34 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-25 14:17 [PATCH 00/10 v6] NFSD: Pin to vfsmount for nfsd exports cache Kinglong Mee
2015-06-25 14:19 ` [PATCH 02/10 v6] fs_pin: Export functions for specific filesystem Kinglong Mee
2015-06-25 14:19 ` [PATCH 03/10 v6] path: New helpers path_get_pin/path_put_unpin for path pin Kinglong Mee
2015-06-25 14:21 ` [PATCH 04/10 v6] fs: New helper legitimize_mntget() for getting a legitimize mnt Kinglong Mee
[not found] ` <558C0D6A.9050104-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2015-06-25 14:18 ` [PATCH 01/10 v6] fs_pin: Initialize value for fs_pin explicitly Kinglong Mee
2015-06-25 14:25 ` [PATCH 05/10 v6] sunrpc: Store cache_detail in seq_file's private directly Kinglong Mee
2015-06-25 14:34 ` Kinglong Mee [this message]
2015-06-25 14:36 ` [PATCH 09/10 v6] sunrpc: Support validate/invalidate for reference change in cache_detail Kinglong Mee
2015-06-25 14:27 ` [PATCH 06/10 v6] sunrpc/nfsd: Remove redundant code by exports seq_operations functions Kinglong Mee
2015-06-25 14:29 ` [PATCH 07/10 v6] sunrpc: Switch to using list_head instead single list Kinglong Mee
2015-06-25 14:37 ` [PATCH 10/10 v6] nfsd: Allows user un-mounting filesystem where nfsd exports base on Kinglong Mee
2015-07-01 5:47 ` Al Viro
[not found] ` <20150701054751.GB17109-3bDd1+5oDREiFSDQTTA3OLVCufUGDwFn@public.gmane.org>
2015-07-02 15:17 ` Kinglong Mee
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=558C116A.2080609@gmail.com \
--to=kinglongmee-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
--cc=bfields-uC3wQj2KruNg9hUCZPvPmw@public.gmane.org \
--cc=linux-fsdevel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-nfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=neilb-l3A5Bk7waGM@public.gmane.org \
--cc=trond.myklebust-7I+n7zu2hftEKMMhf/gKZA@public.gmane.org \
--cc=viro-RmSDqhL/yNMiFSDQTTA3OLVCufUGDwFn@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).