Skip to content

Commit

Permalink
NFS: Additional refactoring for fs_context conversion
Browse files Browse the repository at this point in the history
Split out from commit "NFS: Add fs_context support."

This patch adds additional refactoring for the conversion of NFS to use
fs_context, namely:

 (*) Merge nfs_mount_info and nfs_clone_mount into nfs_fs_context.
     nfs_clone_mount has had several fields removed, and nfs_mount_info
     has been removed altogether.
 (*) Various functions now take an fs_context as an argument instead
     of nfs_mount_info, nfs_fs_context, etc.

Signed-off-by: Scott Mayhew <smayhew@redhat.com>
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
  • Loading branch information
scottmayhew authored and amschuma-ntap committed Jan 15, 2020
1 parent f2aedb7 commit 62a55d0
Show file tree
Hide file tree
Showing 13 changed files with 204 additions and 273 deletions.
22 changes: 11 additions & 11 deletions fs/nfs/client.c
Original file line number Diff line number Diff line change
Expand Up @@ -658,17 +658,17 @@ EXPORT_SYMBOL_GPL(nfs_init_client);
* Create a version 2 or 3 client
*/
static int nfs_init_server(struct nfs_server *server,
const struct nfs_fs_context *ctx,
struct nfs_subversion *nfs_mod)
const struct fs_context *fc)
{
const struct nfs_fs_context *ctx = nfs_fc2context(fc);
struct rpc_timeout timeparms;
struct nfs_client_initdata cl_init = {
.hostname = ctx->nfs_server.hostname,
.addr = (const struct sockaddr *)&ctx->nfs_server.address,
.addrlen = ctx->nfs_server.addrlen,
.nfs_mod = nfs_mod,
.nfs_mod = ctx->nfs_mod,
.proto = ctx->nfs_server.protocol,
.net = ctx->net,
.net = fc->net_ns,
.timeparms = &timeparms,
.cred = server->cred,
.nconnect = ctx->nfs_server.nconnect,
Expand Down Expand Up @@ -951,10 +951,10 @@ EXPORT_SYMBOL_GPL(nfs_free_server);
* Create a version 2 or 3 volume record
* - keyed on server and FSID
*/
struct nfs_server *nfs_create_server(struct nfs_mount_info *mount_info)
struct nfs_server *nfs_create_server(struct fs_context *fc)
{
struct nfs_fs_context *ctx = nfs_fc2context(fc);
struct nfs_server *server;
struct nfs_subversion *nfs_mod = mount_info->nfs_mod;
struct nfs_fattr *fattr;
int error;

Expand All @@ -970,27 +970,27 @@ struct nfs_server *nfs_create_server(struct nfs_mount_info *mount_info)
goto error;

/* Get a client representation */
error = nfs_init_server(server, mount_info->ctx, nfs_mod);
error = nfs_init_server(server, fc);
if (error < 0)
goto error;

/* Probe the root fh to retrieve its FSID */
error = nfs_probe_fsinfo(server, mount_info->mntfh, fattr);
error = nfs_probe_fsinfo(server, ctx->mntfh, fattr);
if (error < 0)
goto error;
if (server->nfs_client->rpc_ops->version == 3) {
if (server->namelen == 0 || server->namelen > NFS3_MAXNAMLEN)
server->namelen = NFS3_MAXNAMLEN;
if (!(mount_info->ctx->flags & NFS_MOUNT_NORDIRPLUS))
if (!(ctx->flags & NFS_MOUNT_NORDIRPLUS))
server->caps |= NFS_CAP_READDIRPLUS;
} else {
if (server->namelen == 0 || server->namelen > NFS2_MAXNAMLEN)
server->namelen = NFS2_MAXNAMLEN;
}

if (!(fattr->valid & NFS_ATTR_FATTR)) {
error = nfs_mod->rpc_ops->getattr(server, mount_info->mntfh,
fattr, NULL, NULL);
error = ctx->nfs_mod->rpc_ops->getattr(server, ctx->mntfh,
fattr, NULL, NULL);
if (error < 0) {
dprintk("nfs_create_server: getattr error = %d\n", -error);
goto error;
Expand Down
Loading

0 comments on commit 62a55d0

Please sign in to comment.