NFS: Allow setting rsize / wsize to a multiple of PAGE_SIZE
Previously, we required this to value to be a power of 2 for UDP related reasons. This patch keeps the power of 2 rule for UDP but allows more flexibility for TCP and RDMA. Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com> Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
This commit is contained in:
Родитель
f1bafa7375
Коммит
940261a195
|
@ -708,9 +708,9 @@ static int nfs_init_server(struct nfs_server *server,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ctx->rsize)
|
if (ctx->rsize)
|
||||||
server->rsize = nfs_block_size(ctx->rsize, NULL);
|
server->rsize = nfs_io_size(ctx->rsize, clp->cl_proto);
|
||||||
if (ctx->wsize)
|
if (ctx->wsize)
|
||||||
server->wsize = nfs_block_size(ctx->wsize, NULL);
|
server->wsize = nfs_io_size(ctx->wsize, clp->cl_proto);
|
||||||
|
|
||||||
server->acregmin = ctx->acregmin * HZ;
|
server->acregmin = ctx->acregmin * HZ;
|
||||||
server->acregmax = ctx->acregmax * HZ;
|
server->acregmax = ctx->acregmax * HZ;
|
||||||
|
@ -755,18 +755,19 @@ error:
|
||||||
static void nfs_server_set_fsinfo(struct nfs_server *server,
|
static void nfs_server_set_fsinfo(struct nfs_server *server,
|
||||||
struct nfs_fsinfo *fsinfo)
|
struct nfs_fsinfo *fsinfo)
|
||||||
{
|
{
|
||||||
|
struct nfs_client *clp = server->nfs_client;
|
||||||
unsigned long max_rpc_payload, raw_max_rpc_payload;
|
unsigned long max_rpc_payload, raw_max_rpc_payload;
|
||||||
|
|
||||||
/* Work out a lot of parameters */
|
/* Work out a lot of parameters */
|
||||||
if (server->rsize == 0)
|
if (server->rsize == 0)
|
||||||
server->rsize = nfs_block_size(fsinfo->rtpref, NULL);
|
server->rsize = nfs_io_size(fsinfo->rtpref, clp->cl_proto);
|
||||||
if (server->wsize == 0)
|
if (server->wsize == 0)
|
||||||
server->wsize = nfs_block_size(fsinfo->wtpref, NULL);
|
server->wsize = nfs_io_size(fsinfo->wtpref, clp->cl_proto);
|
||||||
|
|
||||||
if (fsinfo->rtmax >= 512 && server->rsize > fsinfo->rtmax)
|
if (fsinfo->rtmax >= 512 && server->rsize > fsinfo->rtmax)
|
||||||
server->rsize = nfs_block_size(fsinfo->rtmax, NULL);
|
server->rsize = nfs_io_size(fsinfo->rtmax, clp->cl_proto);
|
||||||
if (fsinfo->wtmax >= 512 && server->wsize > fsinfo->wtmax)
|
if (fsinfo->wtmax >= 512 && server->wsize > fsinfo->wtmax)
|
||||||
server->wsize = nfs_block_size(fsinfo->wtmax, NULL);
|
server->wsize = nfs_io_size(fsinfo->wtmax, clp->cl_proto);
|
||||||
|
|
||||||
raw_max_rpc_payload = rpc_max_payload(server->client);
|
raw_max_rpc_payload = rpc_max_payload(server->client);
|
||||||
max_rpc_payload = nfs_block_size(raw_max_rpc_payload, NULL);
|
max_rpc_payload = nfs_block_size(raw_max_rpc_payload, NULL);
|
||||||
|
|
|
@ -113,8 +113,10 @@ nfs4_ff_alloc_deviceid_node(struct nfs_server *server, struct pnfs_device *pdev,
|
||||||
goto out_err_drain_dsaddrs;
|
goto out_err_drain_dsaddrs;
|
||||||
ds_versions[i].version = be32_to_cpup(p++);
|
ds_versions[i].version = be32_to_cpup(p++);
|
||||||
ds_versions[i].minor_version = be32_to_cpup(p++);
|
ds_versions[i].minor_version = be32_to_cpup(p++);
|
||||||
ds_versions[i].rsize = nfs_block_size(be32_to_cpup(p++), NULL);
|
ds_versions[i].rsize = nfs_io_size(be32_to_cpup(p++),
|
||||||
ds_versions[i].wsize = nfs_block_size(be32_to_cpup(p++), NULL);
|
server->nfs_client->cl_proto);
|
||||||
|
ds_versions[i].wsize = nfs_io_size(be32_to_cpup(p++),
|
||||||
|
server->nfs_client->cl_proto);
|
||||||
ds_versions[i].tightly_coupled = be32_to_cpup(p);
|
ds_versions[i].tightly_coupled = be32_to_cpup(p);
|
||||||
|
|
||||||
if (ds_versions[i].rsize > NFS_MAX_FILE_IO_SIZE)
|
if (ds_versions[i].rsize > NFS_MAX_FILE_IO_SIZE)
|
||||||
|
|
|
@ -704,6 +704,24 @@ unsigned long nfs_block_size(unsigned long bsize, unsigned char *nrbitsp)
|
||||||
return nfs_block_bits(bsize, nrbitsp);
|
return nfs_block_bits(bsize, nrbitsp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Compute and set NFS server rsize / wsize
|
||||||
|
*/
|
||||||
|
static inline
|
||||||
|
unsigned long nfs_io_size(unsigned long iosize, enum xprt_transports proto)
|
||||||
|
{
|
||||||
|
if (iosize < NFS_MIN_FILE_IO_SIZE)
|
||||||
|
iosize = NFS_DEF_FILE_IO_SIZE;
|
||||||
|
else if (iosize >= NFS_MAX_FILE_IO_SIZE)
|
||||||
|
iosize = NFS_MAX_FILE_IO_SIZE;
|
||||||
|
else
|
||||||
|
iosize = iosize & PAGE_MASK;
|
||||||
|
|
||||||
|
if (proto == XPRT_TRANSPORT_UDP)
|
||||||
|
return nfs_block_bits(iosize, NULL);
|
||||||
|
return iosize;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Determine the maximum file size for a superblock
|
* Determine the maximum file size for a superblock
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1161,9 +1161,9 @@ static int nfs4_init_server(struct nfs_server *server, struct fs_context *fc)
|
||||||
return error;
|
return error;
|
||||||
|
|
||||||
if (ctx->rsize)
|
if (ctx->rsize)
|
||||||
server->rsize = nfs_block_size(ctx->rsize, NULL);
|
server->rsize = nfs_io_size(ctx->rsize, server->nfs_client->cl_proto);
|
||||||
if (ctx->wsize)
|
if (ctx->wsize)
|
||||||
server->wsize = nfs_block_size(ctx->wsize, NULL);
|
server->wsize = nfs_io_size(ctx->wsize, server->nfs_client->cl_proto);
|
||||||
|
|
||||||
server->acregmin = ctx->acregmin * HZ;
|
server->acregmin = ctx->acregmin * HZ;
|
||||||
server->acregmax = ctx->acregmax * HZ;
|
server->acregmax = ctx->acregmax * HZ;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче