diff mbox

[1/2] rpc_pipe: export simple_dentry_operations and have rpc_pipefs use it

Message ID 1372122340-28982-2-git-send-email-jlayton@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Jeff Layton June 25, 2013, 1:05 a.m. UTC
...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(-)

Comments

Trond Myklebust June 25, 2013, 3:36 p.m. UTC | #1
On Mon, 2013-06-24 at 21:05 -0400, Jeff Layton wrote:
> ...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(-)
> 

Can you please get an ACK from Al on this patch.

Cheers
  Trond

> 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);
Jeff Layton July 1, 2013, 4:22 p.m. UTC | #2
On Tue, 25 Jun 2013 15:36:54 +0000
"Myklebust, Trond" <Trond.Myklebust@netapp.com> wrote:

> On Mon, 2013-06-24 at 21:05 -0400, Jeff Layton wrote:
> > ...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(-)
> > 
> 
> Can you please get an ACK from Al on this patch.
> 
> Cheers
>   Trond
> 

Al, could you weigh in on this? The only real change to generic VFS
code is that I'm exporting simple_dentry_operations here.

Thanks,
Jeff

> > 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);
> 
>
Jeff Layton July 2, 2013, 3:29 p.m. UTC | #3
On Mon, 2013-07-01 at 12:22 -0400, Jeff Layton wrote:
> On Tue, 25 Jun 2013 15:36:54 +0000
> "Myklebust, Trond" <Trond.Myklebust@netapp.com> wrote:
> 
> > On Mon, 2013-06-24 at 21:05 -0400, Jeff Layton wrote:
> > > ...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(-)
> > > 
> > 
> > Can you please get an ACK from Al on this patch.
> > 
> > Cheers
> >   Trond
> > 
> 
> Al, could you weigh in on this? The only real change to generic VFS
> code is that I'm exporting simple_dentry_operations here.
> 

Trond, I've been unable to get in touch with Al to get him to ACK this.
I'm guessing he's busy getting patches together for the merge window. 

I propose we do this instead:

I'll respin the patch such that sb->s_d_op is set to
rpc_dentry_operations, and we'll just keep those for now. Then, I can
propose a patch later to export simple_dentry_operations and convert
rpc_pipefs to use that afterward (probably for 3.12).

I'll post the respin after I've done a bit of testing...
diff mbox

Patch

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);