Commit 312cd4cb authored by Trond Myklebust's avatar Trond Myklebust

NFS/flexfiles: Simplify ff_layout_get_ds_cred()

Pass in a pointer to the mirror rather than forcing another
array access.
Signed-off-by: default avatarTrond Myklebust <trond.myklebust@hammerspace.com>
parent 561d6f8a
...@@ -1783,7 +1783,7 @@ ff_layout_read_pagelist(struct nfs_pgio_header *hdr) ...@@ -1783,7 +1783,7 @@ ff_layout_read_pagelist(struct nfs_pgio_header *hdr)
if (IS_ERR(ds_clnt)) if (IS_ERR(ds_clnt))
goto out_failed; goto out_failed;
ds_cred = ff_layout_get_ds_cred(lseg, idx, hdr->cred); ds_cred = ff_layout_get_ds_cred(mirror, &lseg->pls_range, hdr->cred);
if (!ds_cred) if (!ds_cred)
goto out_failed; goto out_failed;
...@@ -1848,7 +1848,7 @@ ff_layout_write_pagelist(struct nfs_pgio_header *hdr, int sync) ...@@ -1848,7 +1848,7 @@ ff_layout_write_pagelist(struct nfs_pgio_header *hdr, int sync)
if (IS_ERR(ds_clnt)) if (IS_ERR(ds_clnt))
goto out_failed; goto out_failed;
ds_cred = ff_layout_get_ds_cred(lseg, idx, hdr->cred); ds_cred = ff_layout_get_ds_cred(mirror, &lseg->pls_range, hdr->cred);
if (!ds_cred) if (!ds_cred)
goto out_failed; goto out_failed;
...@@ -1933,7 +1933,7 @@ static int ff_layout_initiate_commit(struct nfs_commit_data *data, int how) ...@@ -1933,7 +1933,7 @@ static int ff_layout_initiate_commit(struct nfs_commit_data *data, int how)
if (IS_ERR(ds_clnt)) if (IS_ERR(ds_clnt))
goto out_err; goto out_err;
ds_cred = ff_layout_get_ds_cred(lseg, idx, data->cred); ds_cred = ff_layout_get_ds_cred(mirror, &lseg->pls_range, data->cred);
if (!ds_cred) if (!ds_cred)
goto out_err; goto out_err;
......
...@@ -218,8 +218,9 @@ struct rpc_clnt * ...@@ -218,8 +218,9 @@ struct rpc_clnt *
nfs4_ff_find_or_create_ds_client(struct nfs4_ff_layout_mirror *mirror, nfs4_ff_find_or_create_ds_client(struct nfs4_ff_layout_mirror *mirror,
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 nfs4_ff_layout_mirror *mirror,
u32 ds_idx, const struct cred *mdscred); const struct pnfs_layout_range *range,
const struct cred *mdscred);
bool ff_layout_avoid_mds_available_ds(struct pnfs_layout_segment *lseg); bool ff_layout_avoid_mds_available_ds(struct pnfs_layout_segment *lseg);
bool ff_layout_avoid_read_on_rw(struct pnfs_layout_segment *lseg); bool ff_layout_avoid_read_on_rw(struct pnfs_layout_segment *lseg);
......
...@@ -446,14 +446,14 @@ nfs4_ff_layout_prepare_ds(struct pnfs_layout_segment *lseg, ...@@ -446,14 +446,14 @@ nfs4_ff_layout_prepare_ds(struct pnfs_layout_segment *lseg,
} }
const struct cred * const struct cred *
ff_layout_get_ds_cred(struct pnfs_layout_segment *lseg, u32 ds_idx, ff_layout_get_ds_cred(struct nfs4_ff_layout_mirror *mirror,
const struct pnfs_layout_range *range,
const struct cred *mdscred) const struct cred *mdscred)
{ {
struct nfs4_ff_layout_mirror *mirror = FF_LAYOUT_COMP(lseg, ds_idx);
const struct cred *cred; const struct cred *cred;
if (mirror && !mirror->mirror_ds->ds_versions[0].tightly_coupled) { if (mirror && !mirror->mirror_ds->ds_versions[0].tightly_coupled) {
cred = ff_layout_get_mirror_cred(mirror, lseg->pls_range.iomode); cred = ff_layout_get_mirror_cred(mirror, range->iomode);
if (!cred) if (!cred)
cred = get_cred(mdscred); cred = get_cred(mdscred);
} else { } else {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment