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

NFSv4.1/flexfiles: Remove mirror backpointer to lseg.

When we start sharing mirrors between several lsegs, we won't be able to
keep it.

Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>

+12 -14
+12 -13
fs/nfs/flexfilelayout/flexfilelayout.c
··· 290 290 } 291 291 292 292 fls->mirror_array[i]->ds_count = ds_count; 293 - fls->mirror_array[i]->lseg = &fls->generic_hdr; 294 293 295 294 /* deviceid */ 296 295 rc = decode_deviceid(&stream, &devid); ··· 512 513 } 513 514 514 515 static void 515 - nfs4_ff_layout_stat_io_start_read(struct nfs4_ff_layout_mirror *mirror, 516 + nfs4_ff_layout_stat_io_start_read(struct inode *inode, 517 + struct nfs4_ff_layout_mirror *mirror, 516 518 __u64 requested, ktime_t now) 517 519 { 518 520 bool report; ··· 524 524 spin_unlock(&mirror->lock); 525 525 526 526 if (report) 527 - pnfs_report_layoutstat(mirror->lseg->pls_layout->plh_inode, 528 - GFP_KERNEL); 527 + pnfs_report_layoutstat(inode, GFP_KERNEL); 529 528 } 530 529 531 530 static void ··· 541 542 } 542 543 543 544 static void 544 - nfs4_ff_layout_stat_io_start_write(struct nfs4_ff_layout_mirror *mirror, 545 + nfs4_ff_layout_stat_io_start_write(struct inode *inode, 546 + struct nfs4_ff_layout_mirror *mirror, 545 547 __u64 requested, ktime_t now) 546 548 { 547 549 bool report; ··· 553 553 spin_unlock(&mirror->lock); 554 554 555 555 if (report) 556 - pnfs_report_layoutstat(mirror->lseg->pls_layout->plh_inode, 557 - GFP_NOIO); 556 + pnfs_report_layoutstat(inode, GFP_NOIO); 558 557 } 559 558 560 559 static void ··· 1097 1098 static int ff_layout_read_prepare_common(struct rpc_task *task, 1098 1099 struct nfs_pgio_header *hdr) 1099 1100 { 1100 - nfs4_ff_layout_stat_io_start_read( 1101 + nfs4_ff_layout_stat_io_start_read(hdr->inode, 1101 1102 FF_LAYOUT_COMP(hdr->lseg, hdr->pgio_mirror_idx), 1102 1103 hdr->args.count, 1103 1104 task->tk_start); ··· 1284 1285 static int ff_layout_write_prepare_common(struct rpc_task *task, 1285 1286 struct nfs_pgio_header *hdr) 1286 1287 { 1287 - nfs4_ff_layout_stat_io_start_write( 1288 + nfs4_ff_layout_stat_io_start_write(hdr->inode, 1288 1289 FF_LAYOUT_COMP(hdr->lseg, hdr->pgio_mirror_idx), 1289 1290 hdr->args.count, 1290 1291 task->tk_start); ··· 1366 1367 static void ff_layout_commit_prepare_common(struct rpc_task *task, 1367 1368 struct nfs_commit_data *cdata) 1368 1369 { 1369 - nfs4_ff_layout_stat_io_start_write( 1370 + nfs4_ff_layout_stat_io_start_write(cdata->inode, 1370 1371 FF_LAYOUT_COMP(cdata->lseg, cdata->ds_commit_index), 1371 1372 0, task->tk_start); 1372 1373 } ··· 1911 1912 devinfo->layout_type = LAYOUT_FLEX_FILES; 1912 1913 devinfo->layoutstats_encode = ff_layout_encode_layoutstats; 1913 1914 devinfo->layout_private = mirror; 1914 - /* lseg refcount put in cleanup_layoutstats */ 1915 - pnfs_get_lseg(pls); 1915 + /* mirror refcount put in cleanup_layoutstats */ 1916 + atomic_inc(&mirror->ref); 1916 1917 1917 1918 ++(*dev_count); 1918 1919 } ··· 1964 1965 for (i = 0; i < data->args.num_dev; i++) { 1965 1966 mirror = data->args.devinfo[i].layout_private; 1966 1967 data->args.devinfo[i].layout_private = NULL; 1967 - pnfs_put_lseg(mirror->lseg); 1968 + ff_layout_put_mirror(mirror); 1968 1969 } 1969 1970 } 1970 1971
-1
fs/nfs/flexfilelayout/flexfilelayout.h
··· 67 67 }; 68 68 69 69 struct nfs4_ff_layout_mirror { 70 - struct pnfs_layout_segment *lseg; /* back pointer */ 71 70 u32 ds_count; 72 71 u32 efficiency; 73 72 struct nfs4_ff_layout_ds *mirror_ds;