From: Jeff Layton <jlayton@redhat.com>
To: Trond Myklebust <Trond.Myklebust@netapp.com>
Cc: linux-nfs@vger.kernel.org, linux-fsdevel@vger.kernel.org,
"J. Bruce Fields" <bfields@fieldses.org>
Subject: [PATCH 1/2] rpc_pipe: export simple_dentry_operations and have rpc_pipefs use it
Date: Mon, 24 Jun 2013 21:05:39 -0400 [thread overview]
Message-ID: <1372122340-28982-2-git-send-email-jlayton@redhat.com> (raw)
In-Reply-To: <1372122340-28982-1-git-send-email-jlayton@redhat.com>
...instead of replicating a copy of them.
Signed-off-by: Jeff Layton <jlayton@redhat.com>
---
fs/libfs.c | 9 +++++----
include/linux/fs.h | 1 +
net/sunrpc/rpc_pipe.c | 11 +----------
3 files changed, 7 insertions(+), 14 deletions(-)
diff --git a/fs/libfs.c b/fs/libfs.c
index 916da8c..69793f7 100644
--- a/fs/libfs.c
+++ b/fs/libfs.c
@@ -49,16 +49,16 @@ static int simple_delete_dentry(const struct dentry *dentry)
return 1;
}
+const struct dentry_operations simple_dentry_operations = {
+ .d_delete = simple_delete_dentry,
+};
+
/*
* Lookup the data. This is trivial - if the dentry didn't already
* exist, we know it is negative. Set d_op to delete negative dentries.
*/
struct dentry *simple_lookup(struct inode *dir, struct dentry *dentry, unsigned int flags)
{
- static const struct dentry_operations simple_dentry_operations = {
- .d_delete = simple_delete_dentry,
- };
-
if (dentry->d_name.len > NAME_MAX)
return ERR_PTR(-ENAMETOOLONG);
d_set_d_op(dentry, &simple_dentry_operations);
@@ -987,6 +987,7 @@ EXPORT_SYMBOL(simple_write_begin);
EXPORT_SYMBOL(simple_write_end);
EXPORT_SYMBOL(simple_dir_inode_operations);
EXPORT_SYMBOL(simple_dir_operations);
+EXPORT_SYMBOL(simple_dentry_operations);
EXPORT_SYMBOL(simple_empty);
EXPORT_SYMBOL(simple_fill_super);
EXPORT_SYMBOL(simple_getattr);
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 65c2be2..1d21364 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -2546,6 +2546,7 @@ extern int simple_write_end(struct file *file, struct address_space *mapping,
extern struct dentry *simple_lookup(struct inode *, struct dentry *, unsigned int flags);
extern ssize_t generic_read_dir(struct file *, char __user *, size_t, loff_t *);
extern const struct file_operations simple_dir_operations;
+extern const struct dentry_operations simple_dentry_operations;
extern const struct inode_operations simple_dir_inode_operations;
struct tree_descr { char *name; const struct file_operations *ops; int mode; };
struct dentry *d_alloc_name(struct dentry *, const char *);
diff --git a/net/sunrpc/rpc_pipe.c b/net/sunrpc/rpc_pipe.c
index a816b3a..99cd7db 100644
--- a/net/sunrpc/rpc_pipe.c
+++ b/net/sunrpc/rpc_pipe.c
@@ -471,15 +471,6 @@ struct rpc_filelist {
umode_t mode;
};
-static int rpc_delete_dentry(const struct dentry *dentry)
-{
- return 1;
-}
-
-static const struct dentry_operations rpc_dentry_operations = {
- .d_delete = rpc_delete_dentry,
-};
-
static struct inode *
rpc_get_inode(struct super_block *sb, umode_t mode)
{
@@ -668,7 +659,7 @@ static struct dentry *__rpc_lookup_create_exclusive(struct dentry *parent,
}
if (dentry->d_inode == NULL) {
if (!dentry->d_op)
- d_set_d_op(dentry, &rpc_dentry_operations);
+ d_set_d_op(dentry, &simple_dentry_operations);
return dentry;
}
dput(dentry);
--
1.8.1.4
next prev parent reply other threads:[~2013-06-25 1:05 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-25 1:05 [PATCH 0/2] rpc_pipe: clean up how dentry operations get set in rpc_pipefs Jeff Layton
2013-06-25 1:05 ` Jeff Layton [this message]
2013-06-25 15:36 ` [PATCH 1/2] rpc_pipe: export simple_dentry_operations and have rpc_pipefs use it Myklebust, Trond
2013-07-01 16:22 ` Jeff Layton
2013-07-02 15:29 ` Jeff Layton
2013-06-25 1:05 ` [PATCH 2/2] rpc_pipe: set dentry operations at d_alloc time Jeff Layton
2013-06-25 11:00 ` Jeff Layton
2013-07-02 17:00 ` [PATCH v2] " Jeff Layton
2013-07-14 14:00 ` Al Viro
2013-07-15 10:43 ` Jeff Layton
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=1372122340-28982-2-git-send-email-jlayton@redhat.com \
--to=jlayton@redhat.com \
--cc=Trond.Myklebust@netapp.com \
--cc=bfields@fieldses.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-nfs@vger.kernel.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).