diff mbox series

[v1,03/11] NFS test for intra vs inter COPY

Message ID 20181019152932.32462-4-olga.kornievskaia@gmail.com (mailing list archive)
State New, archived
Headers show
Series client-side support for "inter" SSC copy | expand

Commit Message

Olga Kornievskaia Oct. 19, 2018, 3:29 p.m. UTC
From: Olga Kornievskaia <kolga@netapp.com>

Signed-off-by: Olga Kornievskaia <kolga@netapp.com>
---
 fs/nfs/nfs42.h | 11 +++++++++++
 1 file changed, 11 insertions(+)

Comments

Jeff Layton Oct. 21, 2018, 2:44 p.m. UTC | #1
On Fri, 2018-10-19 at 11:29 -0400, Olga Kornievskaia wrote:
> From: Olga Kornievskaia <kolga@netapp.com>
> 
> Signed-off-by: Olga Kornievskaia <kolga@netapp.com>
> ---
>  fs/nfs/nfs42.h | 11 +++++++++++
>  1 file changed, 11 insertions(+)
> 
> diff --git a/fs/nfs/nfs42.h b/fs/nfs/nfs42.h
> index 19ec38f8..5abff4d 100644
> --- a/fs/nfs/nfs42.h
> +++ b/fs/nfs/nfs42.h
> @@ -6,6 +6,7 @@
>  #ifndef __LINUX_FS_NFS_NFS4_2_H
>  #define __LINUX_FS_NFS_NFS4_2_H
>  
> +#include <linux/sunrpc/addr.h>
>  /*
>   * FIXME:  four LAYOUTSTATS calls per compound at most! Do we need to support
>   * more? Need to consider not to pre-alloc too much for a compound.
> @@ -21,4 +22,14 @@ int nfs42_proc_layoutstats_generic(struct nfs_server *,
>  				   struct nfs42_layoutstat_data *);
>  int nfs42_proc_clone(struct file *, struct file *, loff_t, loff_t, loff_t);
>  
> +static inline bool nfs42_files_from_same_server(struct file *in,
> +						struct file *out)
> +{
> +	struct nfs_client *c_in = (NFS_SERVER(file_inode(in)))->nfs_client;
> +	struct nfs_client *c_out = (NFS_SERVER(file_inode(out)))->nfs_client;
> +
> +	return rpc_cmp_addr((struct sockaddr *)&c_in->cl_addr,
> +				(struct sockaddr *)&c_out->cl_addr);
> +}
> +
>  #endif /* __LINUX_FS_NFS_NFS4_2_H */

What about trunking? If the addresses don't match, should you compare
cl_serverowner or something too? Or maybe just do that instead of
testing addresses?

It's usually best to add infrastructure like this in the same patch with
an initial caller so we can see how it's intended to be used.
Olga Kornievskaia Oct. 22, 2018, 5:48 p.m. UTC | #2
On Sun, Oct 21, 2018 at 10:44 AM Jeff Layton <jlayton@kernel.org> wrote:
>
> On Fri, 2018-10-19 at 11:29 -0400, Olga Kornievskaia wrote:
> > From: Olga Kornievskaia <kolga@netapp.com>
> >
> > Signed-off-by: Olga Kornievskaia <kolga@netapp.com>
> > ---
> >  fs/nfs/nfs42.h | 11 +++++++++++
> >  1 file changed, 11 insertions(+)
> >
> > diff --git a/fs/nfs/nfs42.h b/fs/nfs/nfs42.h
> > index 19ec38f8..5abff4d 100644
> > --- a/fs/nfs/nfs42.h
> > +++ b/fs/nfs/nfs42.h
> > @@ -6,6 +6,7 @@
> >  #ifndef __LINUX_FS_NFS_NFS4_2_H
> >  #define __LINUX_FS_NFS_NFS4_2_H
> >
> > +#include <linux/sunrpc/addr.h>
> >  /*
> >   * FIXME:  four LAYOUTSTATS calls per compound at most! Do we need to support
> >   * more? Need to consider not to pre-alloc too much for a compound.
> > @@ -21,4 +22,14 @@ int nfs42_proc_layoutstats_generic(struct nfs_server *,
> >                                  struct nfs42_layoutstat_data *);
> >  int nfs42_proc_clone(struct file *, struct file *, loff_t, loff_t, loff_t);
> >
> > +static inline bool nfs42_files_from_same_server(struct file *in,
> > +                                             struct file *out)
> > +{
> > +     struct nfs_client *c_in = (NFS_SERVER(file_inode(in)))->nfs_client;
> > +     struct nfs_client *c_out = (NFS_SERVER(file_inode(out)))->nfs_client;
> > +
> > +     return rpc_cmp_addr((struct sockaddr *)&c_in->cl_addr,
> > +                             (struct sockaddr *)&c_out->cl_addr);
> > +}
> > +
> >  #endif /* __LINUX_FS_NFS_NFS4_2_H */
>
> What about trunking? If the addresses don't match, should you compare
> cl_serverowner or something too? Or maybe just do that instead of
> testing addresses?
>
> It's usually best to add infrastructure like this in the same patch with
> an initial caller so we can see how it's intended to be used.

Thanks, I will change it to use nfs4_check_serverowner_major_id()
instead and merge it with one of the callers.

> --
> Jeff Layton <jlayton@kernel.org>
>
diff mbox series

Patch

diff --git a/fs/nfs/nfs42.h b/fs/nfs/nfs42.h
index 19ec38f8..5abff4d 100644
--- a/fs/nfs/nfs42.h
+++ b/fs/nfs/nfs42.h
@@ -6,6 +6,7 @@ 
 #ifndef __LINUX_FS_NFS_NFS4_2_H
 #define __LINUX_FS_NFS_NFS4_2_H
 
+#include <linux/sunrpc/addr.h>
 /*
  * FIXME:  four LAYOUTSTATS calls per compound at most! Do we need to support
  * more? Need to consider not to pre-alloc too much for a compound.
@@ -21,4 +22,14 @@  int nfs42_proc_layoutstats_generic(struct nfs_server *,
 				   struct nfs42_layoutstat_data *);
 int nfs42_proc_clone(struct file *, struct file *, loff_t, loff_t, loff_t);
 
+static inline bool nfs42_files_from_same_server(struct file *in,
+						struct file *out)
+{
+	struct nfs_client *c_in = (NFS_SERVER(file_inode(in)))->nfs_client;
+	struct nfs_client *c_out = (NFS_SERVER(file_inode(out)))->nfs_client;
+
+	return rpc_cmp_addr((struct sockaddr *)&c_in->cl_addr,
+				(struct sockaddr *)&c_out->cl_addr);
+}
+
 #endif /* __LINUX_FS_NFS_NFS4_2_H */