mirror of
https://github.com/torvalds/linux.git
synced 2026-05-23 06:31:58 +02:00
NFSv4/flexfiles: Commit path updates for striped layouts
Updates the commit path to be stripe aware. This required updating the ds_commit_idx to be stripe aware. ds_commit_idx == mirror_idx * dss_count + dss_id. Updates code paths to utilize the new ds_commit_idx and derive dss_id & mirror_idx where appropriate to contact the correct DS using the corresponding parameters. Signed-off-by: Jonathan Curley <jcurley@purestorage.com> Signed-off-by: Anna Schumaker <anna.schumaker@oracle.com>
This commit is contained in:
parent
4934ccbeae
commit
8a8729db67
|
|
@ -605,6 +605,18 @@ ff_layout_free_lseg(struct pnfs_layout_segment *lseg)
|
|||
_ff_layout_free_lseg(fls);
|
||||
}
|
||||
|
||||
static u32 calc_mirror_idx_from_commit(struct pnfs_layout_segment *lseg,
|
||||
u32 commit_index)
|
||||
{
|
||||
return commit_index / FF_LAYOUT_LSEG(lseg)->mirror_array[0]->dss_count;
|
||||
}
|
||||
|
||||
static u32 calc_dss_id_from_commit(struct pnfs_layout_segment *lseg,
|
||||
u32 commit_index)
|
||||
{
|
||||
return commit_index % FF_LAYOUT_LSEG(lseg)->mirror_array[0]->dss_count;
|
||||
}
|
||||
|
||||
static void
|
||||
nfs4_ff_start_busy_timer(struct nfs4_ff_busy_timer *timer, ktime_t now)
|
||||
{
|
||||
|
|
@ -2105,20 +2117,15 @@ ff_layout_write_pagelist(struct nfs_pgio_header *hdr, int sync)
|
|||
return PNFS_NOT_ATTEMPTED;
|
||||
}
|
||||
|
||||
static u32 calc_ds_index_from_commit(struct pnfs_layout_segment *lseg, u32 i)
|
||||
{
|
||||
return i;
|
||||
}
|
||||
|
||||
static struct nfs_fh *
|
||||
select_ds_fh_from_commit(struct pnfs_layout_segment *lseg, u32 i)
|
||||
select_ds_fh_from_commit(struct pnfs_layout_segment *lseg, u32 i, u32 dss_id)
|
||||
{
|
||||
struct nfs4_ff_layout_segment *flseg = FF_LAYOUT_LSEG(lseg);
|
||||
|
||||
/* FIXME: Assume that there is only one NFS version available
|
||||
* for the DS.
|
||||
*/
|
||||
return &flseg->mirror_array[i]->dss[0].fh_versions[0];
|
||||
return &flseg->mirror_array[i]->dss[dss_id].fh_versions[0];
|
||||
}
|
||||
|
||||
static int ff_layout_initiate_commit(struct nfs_commit_data *data, int how)
|
||||
|
|
@ -2129,7 +2136,7 @@ static int ff_layout_initiate_commit(struct nfs_commit_data *data, int how)
|
|||
struct nfsd_file *localio;
|
||||
struct nfs4_ff_layout_mirror *mirror;
|
||||
const struct cred *ds_cred;
|
||||
u32 idx;
|
||||
u32 idx, dss_id;
|
||||
int vers, ret;
|
||||
struct nfs_fh *fh;
|
||||
|
||||
|
|
@ -2137,22 +2144,23 @@ static int ff_layout_initiate_commit(struct nfs_commit_data *data, int how)
|
|||
test_bit(NFS_LSEG_LAYOUTRETURN, &lseg->pls_flags)))
|
||||
goto out_err;
|
||||
|
||||
idx = calc_ds_index_from_commit(lseg, data->ds_commit_index);
|
||||
idx = calc_mirror_idx_from_commit(lseg, data->ds_commit_index);
|
||||
mirror = FF_LAYOUT_COMP(lseg, idx);
|
||||
ds = nfs4_ff_layout_prepare_ds(lseg, mirror, 0, true);
|
||||
dss_id = calc_dss_id_from_commit(lseg, data->ds_commit_index);
|
||||
ds = nfs4_ff_layout_prepare_ds(lseg, mirror, dss_id, true);
|
||||
if (IS_ERR(ds))
|
||||
goto out_err;
|
||||
|
||||
ds_clnt = nfs4_ff_find_or_create_ds_client(mirror, ds->ds_clp,
|
||||
data->inode, 0);
|
||||
data->inode, dss_id);
|
||||
if (IS_ERR(ds_clnt))
|
||||
goto out_err;
|
||||
|
||||
ds_cred = ff_layout_get_ds_cred(mirror, &lseg->pls_range, data->cred, 0);
|
||||
ds_cred = ff_layout_get_ds_cred(mirror, &lseg->pls_range, data->cred, dss_id);
|
||||
if (!ds_cred)
|
||||
goto out_err;
|
||||
|
||||
vers = nfs4_ff_layout_ds_version(mirror, 0);
|
||||
vers = nfs4_ff_layout_ds_version(mirror, dss_id);
|
||||
|
||||
dprintk("%s ino %lu, how %d cl_count %d vers %d\n", __func__,
|
||||
data->inode->i_ino, how, refcount_read(&ds->ds_clp->cl_count),
|
||||
|
|
@ -2161,12 +2169,12 @@ static int ff_layout_initiate_commit(struct nfs_commit_data *data, int how)
|
|||
data->cred = ds_cred;
|
||||
refcount_inc(&ds->ds_clp->cl_count);
|
||||
data->ds_clp = ds->ds_clp;
|
||||
fh = select_ds_fh_from_commit(lseg, data->ds_commit_index);
|
||||
fh = select_ds_fh_from_commit(lseg, idx, dss_id);
|
||||
if (fh)
|
||||
data->args.fh = fh;
|
||||
|
||||
/* Start IO accounting for local commit */
|
||||
localio = ff_local_open_fh(lseg, idx, 0, ds->ds_clp, ds_cred, fh,
|
||||
localio = ff_local_open_fh(lseg, idx, dss_id, ds->ds_clp, ds_cred, fh,
|
||||
FMODE_READ|FMODE_WRITE);
|
||||
if (localio) {
|
||||
data->task.tk_start = ktime_get();
|
||||
|
|
@ -2270,8 +2278,9 @@ ff_layout_setup_ds_info(struct pnfs_ds_commit_info *fl_cinfo,
|
|||
struct nfs4_ff_layout_segment *flseg = FF_LAYOUT_LSEG(lseg);
|
||||
struct inode *inode = lseg->pls_layout->plh_inode;
|
||||
struct pnfs_commit_array *array, *new;
|
||||
u32 size = flseg->mirror_array_cnt * flseg->mirror_array[0]->dss_count;
|
||||
|
||||
new = pnfs_alloc_commit_array(flseg->mirror_array_cnt,
|
||||
new = pnfs_alloc_commit_array(size,
|
||||
nfs_io_gfp_mask());
|
||||
if (new) {
|
||||
spin_lock(&inode->i_lock);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user