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 |
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.
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 --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 */