Re: [PATCH 10/13] nfs: make the buf_to_pages_noslab function available to the nfs code

Schumaker, Anna
2020-03-12T20:36:29Z

Hi Frank,

On Wed, 2020-03-11 at 19:56 +0000, Frank van der Linden wrote:
> Make the buf_to_pages_noslab function available to the rest of the NFS
> code. Rename it to nfs4_buf_to_pages_noslab to be consistent.
>
> This will be used later in the NFSv4.2 xattr code.
>
> Signed-off-by: Frank van der Linden <fllinden@amazon.com>
> ---
> fs/nfs/internal.h | 3 +++
> fs/nfs/nfs4proc.c | 4 ++--
> 2 files changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/fs/nfs/internal.h b/fs/nfs/internal.h
> index 68f235a571e1..1e3a7e119c93 100644
> --- a/fs/nfs/internal.h
> +++ b/fs/nfs/internal.h
> @@ -317,6 +317,9 @@ extern const u32 nfs42_maxlistxattrs_overhead;
> extern const struct rpc_procinfo nfs4_procedures[];
> #endif
>
> +extern int nfs4_buf_to_pages_noslab(const void *buf, size_t buflen,
> + struct page **pages);
> +

Please put this in nfs4_fs.h, as its only callers are nfs4proc.c and nfs42proc.c

Thanks,
Anna

> #ifdef CONFIG_NFS_V4_SECURITY_LABEL
> extern struct nfs4_label *nfs4_label_alloc(struct nfs_server *server, gfp_t
> flags);
> static inline struct nfs4_label *
> diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
> index 725ae64f62f7..aee3a1c97def 100644
> --- a/fs/nfs/nfs4proc.c
> +++ b/fs/nfs/nfs4proc.c
> @@ -5553,7 +5553,7 @@ static inline int nfs4_server_supports_acls(struct
> nfs_server *server)
> */
> #define NFS4ACL_MAXPAGES DIV_ROUND_UP(XATTR_SIZE_MAX, PAGE_SIZE)
>
> -static int buf_to_pages_noslab(const void *buf, size_t buflen,
> +int nfs4_buf_to_pages_noslab(const void *buf, size_t buflen,
> struct page **pages)
> {
> struct page *newpage, **spages;
> @@ -5795,7 +5795,7 @@ static int __nfs4_proc_set_acl(struct inode *inode,
> const void *buf, size_t bufl
> return -EOPNOTSUPP;
> if (npages > ARRAY_SIZE(pages))
> return -ERANGE;
> - i = buf_to_pages_noslab(buf, buflen, arg.acl_pages);
> + i = nfs4_buf_to_pages_noslab(buf, buflen, arg.acl_pages);
> if (i < 0)
> return i;
> nfs4_inode_make_writeable(inode);