Commit 4cbc8a57 authored by Trond Myklebust's avatar Trond Myklebust

NFS/flexfile: Simplify nfs4_ff_layout_select_ds_stateid()

Pass in a pointer to the mirror rather than forcing another
array access.
Signed-off-by: default avatarTrond Myklebust <trond.myklebust@hammerspace.com>
parent 626d48b1
...@@ -1799,9 +1799,7 @@ ff_layout_read_pagelist(struct nfs_pgio_header *hdr) ...@@ -1799,9 +1799,7 @@ ff_layout_read_pagelist(struct nfs_pgio_header *hdr)
if (fh) if (fh)
hdr->args.fh = fh; hdr->args.fh = fh;
if (vers == 4 && nfs4_ff_layout_select_ds_stateid(mirror, &hdr->args.stateid);
!nfs4_ff_layout_select_ds_stateid(lseg, idx, &hdr->args.stateid))
goto out_failed;
/* /*
* Note that if we ever decide to split across DSes, * Note that if we ever decide to split across DSes,
...@@ -1867,9 +1865,7 @@ ff_layout_write_pagelist(struct nfs_pgio_header *hdr, int sync) ...@@ -1867,9 +1865,7 @@ ff_layout_write_pagelist(struct nfs_pgio_header *hdr, int sync)
if (fh) if (fh)
hdr->args.fh = fh; hdr->args.fh = fh;
if (vers == 4 && nfs4_ff_layout_select_ds_stateid(mirror, &hdr->args.stateid);
!nfs4_ff_layout_select_ds_stateid(lseg, idx, &hdr->args.stateid))
goto out_failed;
/* /*
* Note that if we ever decide to split across DSes, * Note that if we ever decide to split across DSes,
......
...@@ -204,10 +204,9 @@ unsigned int ff_layout_fetch_ds_ioerr(struct pnfs_layout_hdr *lo, ...@@ -204,10 +204,9 @@ unsigned int ff_layout_fetch_ds_ioerr(struct pnfs_layout_hdr *lo,
unsigned int maxnum); unsigned int maxnum);
struct nfs_fh * struct nfs_fh *
nfs4_ff_layout_select_ds_fh(struct nfs4_ff_layout_mirror *mirror); nfs4_ff_layout_select_ds_fh(struct nfs4_ff_layout_mirror *mirror);
int void
nfs4_ff_layout_select_ds_stateid(struct pnfs_layout_segment *lseg, nfs4_ff_layout_select_ds_stateid(const struct nfs4_ff_layout_mirror *mirror,
u32 mirror_idx, nfs4_stateid *stateid);
nfs4_stateid *stateid);
struct nfs4_pnfs_ds * struct nfs4_pnfs_ds *
nfs4_ff_layout_prepare_ds(struct pnfs_layout_segment *lseg, nfs4_ff_layout_prepare_ds(struct pnfs_layout_segment *lseg,
......
...@@ -357,23 +357,12 @@ nfs4_ff_layout_select_ds_fh(struct nfs4_ff_layout_mirror *mirror) ...@@ -357,23 +357,12 @@ nfs4_ff_layout_select_ds_fh(struct nfs4_ff_layout_mirror *mirror)
return &mirror->fh_versions[0]; return &mirror->fh_versions[0];
} }
int void
nfs4_ff_layout_select_ds_stateid(struct pnfs_layout_segment *lseg, nfs4_ff_layout_select_ds_stateid(const struct nfs4_ff_layout_mirror *mirror,
u32 mirror_idx, nfs4_stateid *stateid)
nfs4_stateid *stateid)
{ {
struct nfs4_ff_layout_mirror *mirror = FF_LAYOUT_COMP(lseg, mirror_idx); if (nfs4_ff_layout_ds_version(mirror) == 4)
nfs4_stateid_copy(stateid, &mirror->stateid);
if (!ff_layout_mirror_valid(lseg, mirror, false)) {
pr_err_ratelimited("NFS: %s: No data server for mirror offset index %d\n",
__func__, mirror_idx);
goto out;
}
nfs4_stateid_copy(stateid, &mirror->stateid);
return 1;
out:
return 0;
} }
/** /**
......
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