mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-12 13:55:32 +00:00
NFS/flexfiles: Simplify nfs4_ff_find_or_create_ds_client()
Pass in a pointer to the mirror rather than forcing another array access. Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
This commit is contained in:
parent
749da527b3
commit
561d6f8aaf
3 changed files with 6 additions and 10 deletions
|
@ -1778,7 +1778,7 @@ ff_layout_read_pagelist(struct nfs_pgio_header *hdr)
|
||||||
if (!ds)
|
if (!ds)
|
||||||
goto out_failed;
|
goto out_failed;
|
||||||
|
|
||||||
ds_clnt = nfs4_ff_find_or_create_ds_client(lseg, idx, ds->ds_clp,
|
ds_clnt = nfs4_ff_find_or_create_ds_client(mirror, ds->ds_clp,
|
||||||
hdr->inode);
|
hdr->inode);
|
||||||
if (IS_ERR(ds_clnt))
|
if (IS_ERR(ds_clnt))
|
||||||
goto out_failed;
|
goto out_failed;
|
||||||
|
@ -1843,7 +1843,7 @@ ff_layout_write_pagelist(struct nfs_pgio_header *hdr, int sync)
|
||||||
if (!ds)
|
if (!ds)
|
||||||
goto out_failed;
|
goto out_failed;
|
||||||
|
|
||||||
ds_clnt = nfs4_ff_find_or_create_ds_client(lseg, idx, ds->ds_clp,
|
ds_clnt = nfs4_ff_find_or_create_ds_client(mirror, ds->ds_clp,
|
||||||
hdr->inode);
|
hdr->inode);
|
||||||
if (IS_ERR(ds_clnt))
|
if (IS_ERR(ds_clnt))
|
||||||
goto out_failed;
|
goto out_failed;
|
||||||
|
@ -1928,7 +1928,7 @@ static int ff_layout_initiate_commit(struct nfs_commit_data *data, int how)
|
||||||
if (!ds)
|
if (!ds)
|
||||||
goto out_err;
|
goto out_err;
|
||||||
|
|
||||||
ds_clnt = nfs4_ff_find_or_create_ds_client(lseg, idx, ds->ds_clp,
|
ds_clnt = nfs4_ff_find_or_create_ds_client(mirror, ds->ds_clp,
|
||||||
data->inode);
|
data->inode);
|
||||||
if (IS_ERR(ds_clnt))
|
if (IS_ERR(ds_clnt))
|
||||||
goto out_err;
|
goto out_err;
|
||||||
|
|
|
@ -215,8 +215,7 @@ nfs4_ff_layout_prepare_ds(struct pnfs_layout_segment *lseg,
|
||||||
bool fail_return);
|
bool fail_return);
|
||||||
|
|
||||||
struct rpc_clnt *
|
struct rpc_clnt *
|
||||||
nfs4_ff_find_or_create_ds_client(struct pnfs_layout_segment *lseg,
|
nfs4_ff_find_or_create_ds_client(struct nfs4_ff_layout_mirror *mirror,
|
||||||
u32 ds_idx,
|
|
||||||
struct nfs_client *ds_clp,
|
struct nfs_client *ds_clp,
|
||||||
struct inode *inode);
|
struct inode *inode);
|
||||||
const struct cred *ff_layout_get_ds_cred(struct pnfs_layout_segment *lseg,
|
const struct cred *ff_layout_get_ds_cred(struct pnfs_layout_segment *lseg,
|
||||||
|
|
|
@ -464,8 +464,7 @@ ff_layout_get_ds_cred(struct pnfs_layout_segment *lseg, u32 ds_idx,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* nfs4_ff_find_or_create_ds_client - Find or create a DS rpc client
|
* nfs4_ff_find_or_create_ds_client - Find or create a DS rpc client
|
||||||
* @lseg: pointer to layout segment
|
* @mirror: pointer to the mirror
|
||||||
* @ds_idx: mirror index
|
|
||||||
* @ds_clp: nfs_client for the DS
|
* @ds_clp: nfs_client for the DS
|
||||||
* @inode: pointer to inode
|
* @inode: pointer to inode
|
||||||
*
|
*
|
||||||
|
@ -473,11 +472,9 @@ ff_layout_get_ds_cred(struct pnfs_layout_segment *lseg, u32 ds_idx,
|
||||||
* in the nfs_client cl_ds_clients list.
|
* in the nfs_client cl_ds_clients list.
|
||||||
*/
|
*/
|
||||||
struct rpc_clnt *
|
struct rpc_clnt *
|
||||||
nfs4_ff_find_or_create_ds_client(struct pnfs_layout_segment *lseg, u32 ds_idx,
|
nfs4_ff_find_or_create_ds_client(struct nfs4_ff_layout_mirror *mirror,
|
||||||
struct nfs_client *ds_clp, struct inode *inode)
|
struct nfs_client *ds_clp, struct inode *inode)
|
||||||
{
|
{
|
||||||
struct nfs4_ff_layout_mirror *mirror = FF_LAYOUT_COMP(lseg, ds_idx);
|
|
||||||
|
|
||||||
switch (mirror->mirror_ds->ds_versions[0].version) {
|
switch (mirror->mirror_ds->ds_versions[0].version) {
|
||||||
case 3:
|
case 3:
|
||||||
/* For NFSv3 DS, flavor is set when creating DS connections */
|
/* For NFSv3 DS, flavor is set when creating DS connections */
|
||||||
|
|
Loading…
Reference in a new issue