Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

authored by

Jonathan Curley and committed by
Anna Schumaker
8a8729db 4934ccbe

+25 -16
+25 -16
fs/nfs/flexfilelayout/flexfilelayout.c
··· 605 605 _ff_layout_free_lseg(fls); 606 606 } 607 607 608 + static u32 calc_mirror_idx_from_commit(struct pnfs_layout_segment *lseg, 609 + u32 commit_index) 610 + { 611 + return commit_index / FF_LAYOUT_LSEG(lseg)->mirror_array[0]->dss_count; 612 + } 613 + 614 + static u32 calc_dss_id_from_commit(struct pnfs_layout_segment *lseg, 615 + u32 commit_index) 616 + { 617 + return commit_index % FF_LAYOUT_LSEG(lseg)->mirror_array[0]->dss_count; 618 + } 619 + 608 620 static void 609 621 nfs4_ff_start_busy_timer(struct nfs4_ff_busy_timer *timer, ktime_t now) 610 622 { ··· 2117 2105 return PNFS_NOT_ATTEMPTED; 2118 2106 } 2119 2107 2120 - static u32 calc_ds_index_from_commit(struct pnfs_layout_segment *lseg, u32 i) 2121 - { 2122 - return i; 2123 - } 2124 - 2125 2108 static struct nfs_fh * 2126 - select_ds_fh_from_commit(struct pnfs_layout_segment *lseg, u32 i) 2109 + select_ds_fh_from_commit(struct pnfs_layout_segment *lseg, u32 i, u32 dss_id) 2127 2110 { 2128 2111 struct nfs4_ff_layout_segment *flseg = FF_LAYOUT_LSEG(lseg); 2129 2112 2130 2113 /* FIXME: Assume that there is only one NFS version available 2131 2114 * for the DS. 2132 2115 */ 2133 - return &flseg->mirror_array[i]->dss[0].fh_versions[0]; 2116 + return &flseg->mirror_array[i]->dss[dss_id].fh_versions[0]; 2134 2117 } 2135 2118 2136 2119 static int ff_layout_initiate_commit(struct nfs_commit_data *data, int how) ··· 2136 2129 struct nfsd_file *localio; 2137 2130 struct nfs4_ff_layout_mirror *mirror; 2138 2131 const struct cred *ds_cred; 2139 - u32 idx; 2132 + u32 idx, dss_id; 2140 2133 int vers, ret; 2141 2134 struct nfs_fh *fh; 2142 2135 ··· 2144 2137 test_bit(NFS_LSEG_LAYOUTRETURN, &lseg->pls_flags))) 2145 2138 goto out_err; 2146 2139 2147 - idx = calc_ds_index_from_commit(lseg, data->ds_commit_index); 2140 + idx = calc_mirror_idx_from_commit(lseg, data->ds_commit_index); 2148 2141 mirror = FF_LAYOUT_COMP(lseg, idx); 2149 - ds = nfs4_ff_layout_prepare_ds(lseg, mirror, 0, true); 2142 + dss_id = calc_dss_id_from_commit(lseg, data->ds_commit_index); 2143 + ds = nfs4_ff_layout_prepare_ds(lseg, mirror, dss_id, true); 2150 2144 if (IS_ERR(ds)) 2151 2145 goto out_err; 2152 2146 2153 2147 ds_clnt = nfs4_ff_find_or_create_ds_client(mirror, ds->ds_clp, 2154 - data->inode, 0); 2148 + data->inode, dss_id); 2155 2149 if (IS_ERR(ds_clnt)) 2156 2150 goto out_err; 2157 2151 2158 - ds_cred = ff_layout_get_ds_cred(mirror, &lseg->pls_range, data->cred, 0); 2152 + ds_cred = ff_layout_get_ds_cred(mirror, &lseg->pls_range, data->cred, dss_id); 2159 2153 if (!ds_cred) 2160 2154 goto out_err; 2161 2155 2162 - vers = nfs4_ff_layout_ds_version(mirror, 0); 2156 + vers = nfs4_ff_layout_ds_version(mirror, dss_id); 2163 2157 2164 2158 dprintk("%s ino %lu, how %d cl_count %d vers %d\n", __func__, 2165 2159 data->inode->i_ino, how, refcount_read(&ds->ds_clp->cl_count), ··· 2169 2161 data->cred = ds_cred; 2170 2162 refcount_inc(&ds->ds_clp->cl_count); 2171 2163 data->ds_clp = ds->ds_clp; 2172 - fh = select_ds_fh_from_commit(lseg, data->ds_commit_index); 2164 + fh = select_ds_fh_from_commit(lseg, idx, dss_id); 2173 2165 if (fh) 2174 2166 data->args.fh = fh; 2175 2167 2176 2168 /* Start IO accounting for local commit */ 2177 - localio = ff_local_open_fh(lseg, idx, 0, ds->ds_clp, ds_cred, fh, 2169 + localio = ff_local_open_fh(lseg, idx, dss_id, ds->ds_clp, ds_cred, fh, 2178 2170 FMODE_READ|FMODE_WRITE); 2179 2171 if (localio) { 2180 2172 data->task.tk_start = ktime_get(); ··· 2278 2270 struct nfs4_ff_layout_segment *flseg = FF_LAYOUT_LSEG(lseg); 2279 2271 struct inode *inode = lseg->pls_layout->plh_inode; 2280 2272 struct pnfs_commit_array *array, *new; 2273 + u32 size = flseg->mirror_array_cnt * flseg->mirror_array[0]->dss_count; 2281 2274 2282 - new = pnfs_alloc_commit_array(flseg->mirror_array_cnt, 2275 + new = pnfs_alloc_commit_array(size, 2283 2276 nfs_io_gfp_mask()); 2284 2277 if (new) { 2285 2278 spin_lock(&inode->i_lock);